summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_lib.c
AgeCommit message (Collapse)Author
2007-01-21Constify version strings and some structures.Dr. Stephen Henson
2005-12-16Eliminate warning induced by http://cvs.openssl.org/chngview?cn=14690 andAndy Polyakov
keep disclaiming narrower than 32-bit support.
2005-05-03remove BN_ncopy, it was only used in bn_nist.c and wasn't particularNils Larsch
useful anyway
2005-04-22- use BN_set_negative and BN_is_negative instead of BN_set_signNils Larsch
and BN_get_sign - implement BN_set_negative as a function - always use "#define BN_is_zero(a) ((a)->top == 0)"
2004-06-20Tidy up, including;Geoff Thorpe
- Remove unused and unuseful debug cruft. - Remove unnecessary 'top' fudging from BN_copy(). - Fix a potential memory leak and simplify the expansion logic in BN_bin2bn(). Submitted by: Nils Larsch Reviewed by: Geoff Thorpe
2004-06-17Deprecate unused cruft, and "make update".Geoff Thorpe
2004-06-17Actually, that last change to BN_get_word() was a little too simple.Geoff Thorpe
2004-06-17As Nils put it;Geoff Thorpe
Yet another question: some time ago you changed BN_set_word. Why didn't you change BN_get_word as well? Quite. I'm also removing the older commented-out implementations to improve readability. This complex stuff seems to date from a time when the types didn't match up well. Submitted by: Nils Larsch, Geoff Thorpe
2004-03-17Variety of belt-tightenings in the bignum code. (Please help test this!)Geoff Thorpe
- Remove some unnecessary "+1"-like fudges. Sizes should be handled exactly, as enlarging size parameters causes needless bloat and may just make bugs less likely rather than fixing them: bn_expand() macro, bn_expand_internal(), and BN_sqr(). - Deprecate bn_dup_expand() - it's new since 0.9.7, unused, and not that useful. - Remove unnecessary zeroing of unused bytes in bn_expand2(). - Rewrite BN_set_word() - it should be much simpler, the previous complexities probably date from old mismatched type issues. - Add missing bn_check_top() macros in bn_word.c - Improve some degenerate case handling in BN_[add|sub]_word(), add comments, and avoid a bignum expansion if an overflow isn't possible.
2003-12-27Use BUF_strlcpy() instead of strcpy().Richard Levitte
Use BUF_strlcat() instead of strcat(). Use BIO_snprintf() instead of sprintf(). In some cases, keep better track of buffer lengths. This is part of a large change submitted by Markus Friedl <markus@openbsd.org>
2003-12-02Incremental cleanups to bn_lib.c.Geoff Thorpe
- Add missing bn_check_top() calls and relocate some others - Use BN_is_zero() where appropriate - Remove assert()s that bn_check_top() is already covering - Simplify the code in places (esp. bn_expand2()) - Only keep ambiguous zero handling if BN_STRICT isn't defined - Remove some white-space and make some other aesthetic tweaks
2003-12-02BN_FLG_FREE is of extremely dubious usefulness, and is only referred toGeoff Thorpe
once in the source (where it is set for the benefit of no other code whatsoever). I've deprecated the declaration in the header and likewise made the use of the flag conditional in bn_lib.c. Note, this change also NULLs the 'd' pointer in a BIGNUM when it is reset but not deallocated.
2003-12-01Declare the static BIGNUM "BN_value_one()" more carefully.Geoff Thorpe
2003-11-29This improves the placement of check_top() macros in a couple of bn_libGeoff Thorpe
functions.
2003-11-15BN_set_bit() etc should use "unsigned int".Ulf Möller
Keep it as is to avoid an API change, but check for negativ values. Submitted by: Nils Larsch
2003-11-05This is a revert of my previous commit to "improve" the declaration ofGeoff Thorpe
constant BIGNUMs. It turns out that this trips up different but equally useful compiler warnings to -Wcast-qual, and so wasn't worth the ugliness it created. (Thanks to Ulf for the forehead-slap.)
2003-11-04Put the first stage of my bignum debugging adventures into CVS. This codeGeoff Thorpe
is itself experimental, and in addition may cause execution to break on existing openssl "bugs" that previously were harmless or at least invisible.
2003-11-04This is the least unacceptable way I've found for declaring the bignum dataGeoff Thorpe
and structures as constant without having to cast away const at any point. There is still plenty of other code that makes gcc's "-Wcast-qual" unhappy, but crypto/bn/ is now ok. Purists are welcome to suggest alternatives.
2003-10-29Some provisional bignum debugging has begun to detect inconsistent BIGNUMGeoff Thorpe
structures being passed in to or out of API functions, and this corrects a couple of cases found so far. Also, lop off a couple of bytes of white-space.
2003-10-29A general spring-cleaning (in autumn) to fix up signed/unsigned warnings.Geoff Thorpe
I have tried to convert 'len' type variable declarations to unsigned as a means to address these warnings when appropriate, but when in doubt I have used casts in the comparisons instead. The better solution (that would get us all lynched by API users) would be to go through and convert all the function prototypes and structure definitions to use unsigned variables except when signed is necessary. The proliferation of (signed) "int" for strictly non-negative uses is unfortunate.
2002-11-29A few more memset()s converted to OPENSSL_cleanse().Richard Levitte
I *think* I got them all covered by now, bu please, if you find any more, tell me and I'll correct it. PR: 343
2002-10-28fast reduction for NIST curvesBodo Möller
Submitted by: Nils Larsch
2002-08-03fix bn_expand2Bodo Möller
2002-08-02fix bn_expand2Bodo Möller
2002-07-25Move zeroing from bn_expand_internal() to bn_expand2() so that itBodo Möller
happens reliably, even if the BIGNUM is already sufficiently large. [Note that the bn_expand()/bn_wexpand() macros call bn_expand2() only if the BIGNUM actually has to grow, so this change does not add any new overhead as currently bn_expand2() is never called directly.]
2001-03-08Constify BN_value_one.Bodo Möller
2000-12-04Change error message to "bignum too long"Bodo Möller
2000-12-03include <limits.h>Bodo Möller
2000-12-03Don't allow BIGNUMs to become so large that computations with dmaxBodo Möller
might overflow.
2000-12-02Add a comment to explain the purpose of bn_cmp_part_words().Richard Levitte
2000-12-02last commit was wrong. Now it works. :)Ulf Möller
2000-12-02arglUlf Möller
2000-12-02Fix bn_cmp_part_words() and move it to bn_lib.c.Ulf Möller
2000-11-29Fix warnings in expspeed.c (but the segmentation fault remains)Bodo Möller
Improve readability of bn_shift.c. Add comment in bn_lib.c (why zero data between top and max?) Change bntest.c output for BN_kronecker test
2000-11-29BN_bin2bn did *not* contain an off-by-one error;Bodo Möller
I'm still investigating what caused the segementation fault (maybe "make clean; make" will cure it ...). But BN_bin2bn should always reset ret->neg.
2000-11-29Expand expspeed.c to make BN_kronecker timings.Bodo Möller
This caused a segmentation fault in calls to malloc, so I cleaned up bn_lib.c a little so that it is easier to see what is going on. The bug turned out to be an off-by-one error in BN_bin2bn.
2000-11-26modular arithmeticsBodo Möller
"make update"
2000-11-16More constification of the BN library.Richard Levitte
2000-11-07Handle BN_copy failure after successful BN_new.Bodo Möller
2000-11-07handle the case when BN_new returns NULLBodo Möller
2000-11-06Constify the BIGNUM routines a bit more. The only trouble were theRichard Levitte
two functions that did expansion on in parameters (BN_mul() and BN_sqr()). The problem was solved by making bn_dup_expand() which is a mix of bn_expand2() and BN_dup().
2000-09-04Avoid abort() throughout the library, except when preprocessorBodo Möller
symbols for debugging are defined.
2000-08-04Changes needed for Tandem NSK, supplied by Scott Uroff (scott@xypro.com).Dr. Stephen Henson
Fix warnings with BIO_dump_indent().
2000-06-01There have been a number of complaints from a number of sources that namesRichard Levitte
like Malloc, Realloc and especially Free conflict with already existing names on some operating systems or other packages. That is reason enough to change the names of the OpenSSL memory allocation macros to something that has a better chance of being unique, like prepending them with OPENSSL_. This change includes all the name changes needed throughout all C files.
2000-02-26Reorganize bn_mul.c (no bugfix yet), remove obsolete files in BN library.Ulf Möller
2000-02-05New functions BN_CTX_start(), BN_CTX_get(), BN_CTX_end() to accessUlf Möller
temporary BIGNUMs. BN_CTX still uses a fixed number of BIGNUMs, but the BN_CTX implementation could now easily be changed.
2000-02-03ispell (and minor modifications)Ulf Möller
2000-01-23Document the BN library.Ulf Möller
1999-07-30by request: let BN_dup(NULL) just return NULLBodo Möller
1999-06-20New functions CONF_load_bio() and CONF_load_fp() to load a configurationDr. Stephen Henson
file from a bio or fp. Added some more constification to the BN library.