summaryrefslogtreecommitdiff
path: root/mpi/mpi-inv.c
Commit message (Collapse)AuthorAgeFilesLines
* mpi: More fix of off-by-one mistake mpi_invm_pow2.NIIBE Yutaka2020-06-011-4/+6
| | | | | | | | | | | * mpi/mpi-inv.c (mpi_invm_pow2): Avoid out-of-band read/write. -- Suggested-by: Jussi Kivilinna <jussi.kivilinna@iki.fi> Reported-by: Guido Vranken <guidovranken@gmail.com> Fixes-commit: 3bb9f74764b3626ed1116fc7e517921232d6be54 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* mpi: Fix off-by-one mistake mpi_invm_pow2.NIIBE Yutaka2020-05-131-4/+6
| | | | | | | | | | * mpi/mpi-inv.c (mpi_invm_pow2): Avoid out-of-band read/write. -- Reported-by: Guido Vranken <guidovranken@gmail.com> Fixes-commit: 3bb9f74764b3626ed1116fc7e517921232d6be54 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* mpi: Fix the return value of mpi_invm_generic.NIIBE Yutaka2020-04-271-7/+20
| | | | | | * mpi/mpi-inv.c (mpi_invm_generic): Return correct value. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* mpi: Fix return value of mpi_invm_generic.NIIBE Yutaka2020-04-241-1/+5
| | | | | | * mpi/mpi-inv.c (mpi_invm_generic): Return 0 if inverse does not exist. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* mpi: More use of mpih API for _gcry_mpi_invm.NIIBE Yutaka2020-04-241-51/+56
| | | | | | | * mpi/mpi-inv.c (mpi_invm_pow2): Remove. (_gcry_mpi_invm): Use mpih_invm_pow2 instead. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* mpi: Use mpih interface internally for mpi-inv.NIIBE Yutaka2020-04-241-31/+51
| | | | | | | * mpi/mpi-inv.c (mpih_invm_pow2): Converted from mpi_invm_pow2. (mpi_invm_pow2): Use mpih_invm_pow2. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* mpi: Fix size of A in mpi_invm_pow2.NIIBE Yutaka2020-04-241-9/+10
| | | | | | * mpi/mpi-inv.c (mpi_invm_pow2): Fix size of A. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* mpi: More fix for _gcry_mpi_invm.NIIBE Yutaka2020-04-231-12/+8
| | | | | | | | | | * mpi/mpi-inv.c (_gcry_mpi_invm): Fix comments and use of CRT path. -- Note that it's not constant-time when N is even, strictly speaking. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* mpi: Fix off-by-one mistake mpi_invm_pow2.NIIBE Yutaka2020-04-221-1/+1
| | | | | | * mpi/mpi-inv.c (mpi_invm_pow2): Fix computation of iterations. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* mpi: Use mpi_invm_pow2 for mpi_invm.NIIBE Yutaka2020-04-211-5/+72
| | | | | | * mpi/mpi-inv.c (_gcry_mpi_invm): Use mpi_invm_pow2. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* mpi: Fix mpi_invm_pow2.NIIBE Yutaka2020-04-211-0/+3
| | | | | | | * mpi/mpi-inv.c (mpi_invm_pow2): Fix the algo implementation. Fixes-commit: 515bd6e9fae448e966f71e23635503716201158d Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* mpi: Use mpi_invm_pow2 for N=2^k.NIIBE Yutaka2020-04-171-2/+9
| | | | | | | * mpi/mpi-inv.c (mpi_invm_pow2): Fix. (_gcry_mpi_invm): Use mpi_invm_pow2. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* mpi: Rewrite mpi_invm_odd into mpih_invm_odd.NIIBE Yutaka2020-04-171-38/+58
| | | | | | | * mpi/mpi-inv.c (mpih_invm_odd): Use mpi_ptr_t API. (_gcry_mpi_invm): Use _gcry_mpih_mod and mpih_invm_odd. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* mpi: Add internal functipn mpi_invm_pow2.NIIBE Yutaka2020-04-171-0/+61
| | | | | | * mpi/mpi-inv.c (mpi_invm_pow2): New. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* mpih: Expose const-time MPI helper functions.NIIBE Yutaka2020-04-161-101/+0
| | | | | | | | | | | * mpi/Makefile.am (libmpi_la_SOURCES): Add mpih-const-time.c. * mpi/ec.c (mpih_set_cond): Move to mpih-const-time.c. * mpi/mpi-internal.h: Add macros and declarations. * mpi/mpi-inv.c (mpih_add_n_cond): Likewise. (mpih_sub_n_cond, mpih_swap_cond, mpih_abs_cond): Likewise. * mpi/mpih-const-time.c: New. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* mpi: Constant time mpi_inv with some conditions.NIIBE Yutaka2020-03-181-7/+200
| | | | | | | | | | | | | * mpi/mpi-inv.c (mpih_add_n_cond, mpih_sub_n_cond, mpih_swap_cond) (mpih_abs_cond): New. (mpi_invm_odd): New. (mpi_invm_generic): Rename from _gcry_mpi_invm. (_gcry_mpi_invm): Use mpi_invm_odd for usual odd cases. -- GnuPG-bug-id: 4869 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Remove macro hacks for internal vs. external functions. Part 1.Werner Koch2013-12-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/visibility.h: Remove almost all define/undef hacks for symbol visibility. Add macros to detect the use of the public functions. Change all affected functions by prefixing them explicitly with an underscore and change all internal callers to call the underscore prefixed versions. Provide convenience macros from sexp and mpi functions. * src/visibility.c: Change all functions to use only gpg_err_code_t and translate to gpg_error_t only in visibility.c. -- The use of the macro magic made if hard to follow the function calls in the source. It was not easy to see if an internal or external function (as defined by visibility.c) was called. The change is quite large but hopefully makes Libgcrypt easier to maintain. Some function have not yet been fixed; this will be done soon. Because Libgcrypt does no make use of any other libgpg-error using libraries it is useless to always translate between gpg_error_t and gpg_err_code_t (i.e with and w/o error source identifier). This translation has no mostly be moved to the function wrappers in visibility.c. An additional advantage of using gpg_err_code_t is that comparison can be done without using gpg_err_code(). I am sorry for that large patch, but a series of patches would actually be more work to audit. Signed-off-by: Werner Koch <wk@gnupg.org>
* mpi: Improve gcry_mpi_invm to detect bad input.Werner Koch2013-08-051-0/+5
| | | | | | | | | * mpi/mpi-inv.c (gcry_mpi_invm): Return 0 for bad input. -- Without this patch the function may enter and endless loop. Signed-off-by: Werner Koch <wk@gnupg.org>
* Reorganizatiosn to support the visibility attribute.Werner Koch2007-10-311-12/+4
| | | | | | This can be improved by using fucntion aliases instead of wrapper functions.
* 2003-06-16 Moritz Schulte <moritz@g10code.com>Moritz Schulte2003-06-171-7/+7
| | | | | | | | | | | | | | | | | | * mpi-add.c: Replace last occurences of old type names with newer names (i.e. replace MPI with gcry_mpi_t). * mpi-bit.c: Likewise. * mpi-cmp.c: Likewise. * mpi-div.c: Likewise. * mpi-gcd.c: Likewise. * mpi-internal.h: Likewise. * mpi-inv.c: Likewise. * mpi-mpow.c: Likewise. * mpi-mul.c: Likewise. * mpi-pow.c: Likewise. * mpi-scan.c: Likewise. * mpicoder.c: Likewise. * mpiutil.c: Likewise.
* 2003-06-09 Moritz Schulte <moritz@g10code.com>Moritz Schulte2003-06-091-4/+4
| | | | | | | | | | | | | | | | | | | | | | * mpicoder.c (gcry_mpi_scan): Adjust for libgpg-error. (gcry_mpi_print): Likewise. (gcry_mpi_aprint): Likewise. 2003-06-07 Moritz Schulte <moritz@g10code.com> * longlong.h, mpi-add.c, mpi-bit.c, mpi-cmp.c, mpi-div.c, mpi-gcd.c, mpi-inline.c, mpi-inline.h, mpi-internal.h, mpi-inv.c, mpi-mpow.c, mpi-mul.c, mpi-pow.c, mpi-scan.c, mpicoder.c, mpih-div.c, mpih-mul.c, mpiutil.c, generic/mpi-asm-defs.h, generic/mpih-add1.c, generic/mpih-lshift.c, generic/mpih-mul1.c, generic/mpih-mul2.c, generic/mpih-mul3.c, generic/mpih-rshift.c, generic/mpih-sub1.c, generic/udiv-w-sdiv.c, i386/syntax.h, m68k/syntax.h, mips3/mpi-asm-defs.h, powerpc32/syntax.h: Edited all preprocessor instructions to remove whitespace before the '#'. This is not required by C89, but there are some compilers out there that don't like it. Replaced any occurence of the now deprecated type names with the new ones.
* * mpiutil.c (gcry_mpi_swap): New.V1-1-8Werner Koch2002-06-251-1/+6
| | | | | | | | | * mpi-div.c (gcry_mpi_div): New. (gcry_mpi_mod): New. * mpi-inv.c (gcry_mpi_invm): New. * mpicoder.c (do_get_buffer): Make sure that we allocate at least one byte.
* Change the license to the LGPL.now-less-freedom-protectedWerner Koch2002-05-141-7/+7
|
* jnlib/Werner Koch2002-01-241-4/+4
| | | | | | | | | | | | | | | Replaced by a fresh copy from GnuPG (actually the NewPG development branch). Adjusted Makefile.am and jnlib-config.h accordingly. * logging.c (log_printf): Do not initialize ARG_PTR with 0, we don't know the correct type. Instead, run va_start and va_end unconditionally. Reported by Jose Carlos Garcia Sogo <jsogo@debian.org>. mpi/ * mpi-inv.c (_gcry_mpi_invm): Typo fixes, noted by Carlo Perassi.
* The first libgcrypt only release.V1-1-3Werner Koch2001-05-311-3/+3
|
* Changed program name in all filesWerner Koch2000-12-211-3/+3
|
* See ChangeLog: Wed Dec 23 13:34:22 CET 1998 Werner KochWerner Koch1998-12-231-3/+3
|
* backupWerner Koch1998-10-121-0/+3
|
* edit-key is now completeWerner Koch1998-07-291-0/+2
|
* intermediate releaseV0-3-1Werner Koch1998-07-061-0/+1
|
* Renamed to GNUPGV-0-2-8Werner Koch1998-02-241-4/+4
|
* import worksWerner Koch1998-02-171-4/+4
|
* a couple of changes; but some parts are now brokenWerner Koch1998-02-111-1/+102
|
* ElGamal funktioniert und ist defaultWerner Koch1997-11-241-1/+1
|
* Output armor works, RSA keygen works.Werner Koch1997-11-191-58/+94
|
* initially checkinWerner Koch1997-11-181-0/+127