summaryrefslogtreecommitdiff
path: root/mpi/mpi-bit.c
AgeCommit message (Collapse)AuthorFilesLines
2014-05-09mpi: Fix a subtle bug setting spurious bits with in mpi_set_bit.Werner Koch1-2/+6
* mpi/mpi-bit.c (_gcry_mpi_set_bit, _gcry_mpi_set_highbit): Clear allocated but not used bits before resizing. * tests/t-mpi-bits.c (set_bit_with_resize): New. -- Reported-by: Martin Sewelies. This bug is probably with us for many years. Probably due to different memory allocation patterns, it did first revealed itself with 1.6. It could be the reason for other heisenbugs. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-12-05Remove macro hacks for internal vs. external functions. Part 1.Werner Koch1-9/+9
* 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>
2013-03-13Add GCRYMPI_FLAG_IMMUTABLE to help debugging.Werner Koch1-25/+68
* src/gcrypt.h.in (GCRYMPI_FLAG_IMMUTABLE): New. * src/mpi.h (mpi_is_immutable): New macro. * mpi/mpiutil.c (gcry_mpi_set_flag, gcry_mpi_clear_flag) (gcry_mpi_get_flag): Implement new flag (_gcry_mpi_immutable_failed): New. * mpi/mpiutil.c (_gcry_mpi_clear, _gcry_mpi_free, gcry_mpi_snatch) (gcry_mpi_set, gcry_mpi_randomize): Act upon the immutable flag. * mpi/mpi-bit.c (gcry_mpi_set_bit, gcry_mpi_set_highbit) (gcry_mpi_clear_highbit, gcry_mpi_clear_bit) (_gcry_mpi_rshift_limbs, gcry_mpi_lshift): Ditto. * mpi/mpicoder.c (_gcry_mpi_set_buffer): Ditto. -- Note that this flag is currently only checked by a few MPI functions. The reason why we eventually need such a flag is to help implementing a generic way to retrieve and set ECC parameters without accidentally changing a curve parameter taken from a list of predefined curves.
2011-02-04Nuked almost all trailing whitespace.Werner Koch1-7/+6
Check and install the standard git pre-commit hook.
2010-04-12Applied spelling fixes and more verbose test diagnositcs by Brad Hards.Werner Koch1-1/+1
2008-08-20Replace assert calls by a new gcry_assert at most places.Werner Koch1-1/+0
2008-08-20Implemented gcry_mpi_lshift.Werner Koch1-32/+68
Reordered some code in mpi-bit.c
2008-08-19Adding gcry_mpi_lshift.Werner Koch1-0/+10
Preparing a release candidate.
2007-03-23Did some performance experiments and added code for Barrett reduction.Werner Koch1-1/+2
2006-08-28Fixed a problem with shifting MPIs by 0.Werner Koch1-1/+11
Add a way to check whether the RNG is in fake mode.
2006-08-04Fixed gcry_mpi_set_bit and enhanced mpi_rshift.Werner Koch1-38/+89
Cleaned up andom-daemon initialization.
2005-10-09mpi/ChangeLog:Moritz Schulte1-1/+2
2005-10-09 Moritz Schulte <moritz@g10code.com> * mpi-cmp.c (gcry_mpi_cmp_ui): Rewritten; correctly handle case of zero limbs in U.
2003-07-302003-07-30 Moritz Schulte <moritz@g10code.com>Moritz Schulte1-1/+1
* longlong.h (__clz_tab): Renamed to _gcry_clz_tab. * mpi-bit.c (__clz_tab): Likewise.
2003-06-172003-06-16 Moritz Schulte <moritz@g10code.com>Moritz Schulte1-10/+10
* 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.
2002-05-14Change the license to the LGPL.Werner Koch1-7/+7
2001-05-31The first libgcrypt only release.Werner Koch1-25/+18
2000-12-21Changed program name in all filesWerner Koch1-3/+3
1999-12-31See ChangeLog: Fri Dec 31 14:06:56 CET 1999 Werner KochWerner Koch1-0/+5
1999-12-08See ChangeLog: Wed Dec 8 21:58:32 CET 1999 Werner KochWerner Koch1-7/+4
1999-07-02See ChangeLog: Fri Jul 2 11:45:54 CEST 1999 Werner KochWerner Koch1-0/+48
1999-01-09See ChangeLog: Sat Jan 9 16:02:23 CET 1999 Werner KochWerner Koch1-1/+1
1999-01-07See ChangeLog: Thu Jan 7 18:00:58 CET 1999 Werner KochWerner Koch1-0/+13
1998-12-23See ChangeLog: Wed Dec 23 13:34:22 CET 1998 Werner KochWerner Koch1-3/+3
1998-08-07chnages done at the trainWerner Koch1-50/+0
1998-06-16some more internall structure changesWerner Koch1-0/+7
1998-04-14applied Mathews typo and grammar fixesWerner Koch1-1/+1
1998-03-19some cleanupsWerner Koch1-0/+19
1998-02-24Renamed to GNUPGWerner Koch1-4/+4
1998-02-03Fixed a few bugsWerner Koch1-5/+6
1998-01-25rel 0.2.0Werner Koch1-0/+3
1998-01-24Trust stuff works partly.Werner Koch1-0/+22
1998-01-16added some trust model stuffWerner Koch1-2/+1
1997-12-19better prime number generator. improved ELG key generationWerner Koch1-5/+51
1997-11-19Output armor works, RSA keygen works.Werner Koch1-0/+21
1997-11-18initially checkinWerner Koch1-0/+133