summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn.h
AgeCommit message (Collapse)Author
2006-06-23New functions CRYPTO_set_idptr_callback(),Bodo Möller
CRYPTO_get_idptr_callback(), CRYPTO_thread_idptr() for a 'void *' type thread ID, since the 'unsigned long' type of the existing thread ID does not always work well.
2006-06-18Change array representation of binary polynomials to make GF2m part ofBodo Möller
the BN library more generally useful. Submitted by: Douglas Stebila
2006-04-11Add support for setting keybits and public exponent value for pkey RSA keygen.Dr. Stephen Henson
2006-01-13fix commentNils Larsch
PR: 1270
2005-12-16We all make typos:-) Fix just introduced ones in bn.hAndy Polyakov
2005-12-16Eliminate warning induced by http://cvs.openssl.org/chngview?cn=14690 andAndy Polyakov
keep disclaiming narrower than 32-bit support.
2005-12-15Allow for bn(64,32) on LP64 platforms.Andy Polyakov
2005-11-06Move declaration for optional bn_mul_mont to bn_lcl.h in order to hideAndy Polyakov
it from mkdef.pl.
2005-10-22Change bn_mul_mont declaration and BN_MONT_CTX. Update CHANGES.Andy Polyakov
2005-10-06Leave the decision to call/implement bn_sqr_mont to assembler developer.Andy Polyakov
2005-10-05Initialize bignum constants using BN_bin2bn() instead of BN_hex2bn(). ThisDr. Stephen Henson
saves a bit of space and avoids a compiler warning about string length.
2005-10-04Reserve for SMALL_FOOTPRINT bn_asm.c. Currently OPENSSL_SMALL_FOOTPRINTAndy Polyakov
is defined on Windows CE targets.
2005-10-04Add reference implementation for bn_[mul|sqr]_mont, new candidates forAndy Polyakov
assembler implementation.
2005-08-28fix warnings when building openssl with the following compiler options:Nils Larsch
-Wmissing-prototypes -Wcomment -Wformat -Wimplicit -Wmain -Wmultichar -Wswitch -Wshadow -Wtrigraphs -Werror -Wchar-subscripts -Wstrict-prototypes -Wreturn-type -Wpointer-arith -W -Wunused -Wno-unused-parameter -Wuninitialized
2005-08-21Make D-H safer, include well-known primes.Ben Laurie
2005-06-28Replace _int64 with __int64, which is more widely accepted among Win32Andy Polyakov
compiler vendors.
2005-05-27Use BN_with_flags() in a cleaner way.Bodo Möller
2005-05-16Implement fixed-window exponentiation to mitigate hyper-threadingBodo Möller
timing attacks. BN_FLG_EXP_CONSTTIME requests this algorithm, and this done by default for RSA/DSA/DH private key computations unless RSA_FLAG_NO_EXP_CONSTTIME/DSA_FLAG_NO_EXP_CONSTTIME/ DH_FLAG_NO_EXP_CONSTTIME is set. Submitted by: Matthew D Wood Reviewed by: Bodo Moeller
2005-05-11Fix more error codes.Bodo Möller
(Also improve util/ck_errf.pl script, and occasionally fix source code formatting.)
2005-05-06Since BN_LLONG will only be defined for Alpha/VMS and not VAX/VMS,Richard Levitte
there's no need to undefine it here. Then, let's get a bit paranoid and not define BN_ULLONG on THIRTY_TWO_BIT machines when BN_LLONG isn't defined.
2005-05-03remove BN_ncopy, it was only used in bn_nist.c and wasn't particularNils Larsch
useful anyway
2005-04-26Port BN_MONT_CTX_set_locked() from stable branch.Dr. Stephen Henson
The function rsa_eay_mont_helper() has been removed because it is no longer needed after this change.
2005-04-26some updates for the blinding code; summary:Nils Larsch
- possibility of re-creation of the blinding parameters after a fixed number of uses (suggested by Bodo) - calculatition of the rsa::e in case it's absent and p and q are present (see bug report #785) - improve the performance when if one rsa structure is shared by more than a thread (see bug report #555) - fix the problem described in bug report #827 - hide the definition ot the BN_BLINDING structure in bn_blind.c
2005-04-26Fix various incorrect error function codes.Bodo Möller
("perl util/ck_errf.pl */*.c */*/*.c" still reports many more.)
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-07-06Improve error handling if decompression of an ec point fails, and cleanupGeoff Thorpe
ec_curve.c (unify comments, etc). Submitted by: Nils Larsch Reviewed by: Bodo Moeller, Geoff Thorpe
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-05-15Make some more API types opaquely available from ossl_typ.h, meaning theGeoff Thorpe
corresponding headers are only required for API functions or structure details. This now includes the bignum types and BUF_MEM. Subsequent commits will remove various dependencies on bn.h and buffer.h and update the makefile dependencies.
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.
2004-03-13The efforts to eliminate the dual-representation of zero and to ensureGeoff Thorpe
bignums are passed in and out of functions and APIs in a consistent form has highlighted that zero-valued bignums don't need any allocated word data. The use of BN_set_word() to initialise a bignum to zero causes needless allocation and gives it a return value that must be checked. This change converts BN_zero() to a self-contained macro that has no return/expression value and does not cause any expansion of bignum data. Note, it would be tempting to rewrite the deprecated version as a success-valued comma expression, such as; #define BN_zero(a) ((a)->top = (a)->neg = 0, 1) However, this evaluates 'a' twice and would confuse initialisation loops (eg. while(..) { BN_zero(bn++) } ). As such, the deprecated version continues to use BN_set_word().
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-11-30If BN_STRICT is defined, don't accept an ambiguous representation of zeroGeoff Thorpe
(ie. where top may be zero, or it may be one if the corresponding word is set to zero). Note, this only affects the macros in bn.h, there are probably similar corrections required in some c files. Also, clarify the audit-related macros at the top of the header. Mental note: I must not forget to clean all this out before 0.9.8 is released ...
2003-11-30Improve a couple of the bignum macros. Note, this doesn't eliminateGeoff Thorpe
tolerance of ambiguous zero-representation, it just improves BN_abs_is_word() and simplifies other macros that depend on it.
2003-11-30Make BN_DEBUG_RAND less painfully slow by only consuming one byte ofGeoff Thorpe
pseudo-random data for each bn_pollute().
2003-11-06This extends the debugging macros to use "pollution" duringGeoff Thorpe
bn_correct_top(), previously only bn_check_top() did this.
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-05cleanup as discussed with GeoffUlf Möller
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-29BN_CTX is opaque and the static initialiser BN_CTX_init() is not usedGeoff Thorpe
except internally to the allocator BN_CTX_new(), as such this deprecates the use of BN_CTX_init() in the API. Moreover, the structure definition of BN_CTX is taken out of bn_lcl.h and moved into bn_ctx.c itself. NDEBUG should probably only be "forced" in the top-level configuration, but until it is I will avoid removing it from bn_ctx.c which might surprise people with massive slow-downs in their keygens. So I've left it in bn_ctx.c but tidied up the preprocessor logic a touch and made it more tolerant of debugging efforts.
2003-04-02make RSA blinding thread-safeBodo Möller
2002-12-08Nils Larsch submitted;Geoff Thorpe
- a patch to fix a memory leak in rsa_gen.c - a note about compiler warnings with unions - a note about improving structure element names This applies his patch and implements a solution to the notes.
2002-12-08This is a first-cut at improving the callback mechanisms used inGeoff Thorpe
key-generation and prime-checking functions. Rather than explicitly passing callback functions and caller-defined context data for the callbacks, a new structure BN_GENCB is defined that encapsulates this; a pointer to the structure is passed to all such functions instead. This wrapper structure allows the encapsulation of "old" and "new" style callbacks - "new" callbacks return a boolean result on the understanding that returning FALSE should terminate keygen/primality processing. The BN_GENCB abstraction will allow future callback modifications without needing to break binary compatibility nor change the API function prototypes. The new API functions have been given names ending in "_ex" and the old functions are implemented as wrappers to the new ones. The OPENSSL_NO_DEPRECATED symbol has been introduced so that, if defined, declaration of the older functions will be skipped. NB: Some openssl-internal code will stick with the older callbacks for now, so appropriate "#undef" logic will be put in place - this is in case the user is *building* openssl (rather than *including* its headers) with this symbol defined. There is another change in the new _ex functions; the key-generation functions do not return key structures but operate on structures passed by the caller, the return value is a boolean. This will allow for a smoother transition to having key-generation as "virtual function" in the various ***_METHOD tables.
2002-11-04implement and use new macros BN_get_sign(), BN_set_sign()Bodo Möller
Submitted by: Nils Larsch
2002-10-29Sun has agreed to removing the covenant language from most files.Bodo Möller
Submitted by: Sheueling Chang <Sheueling.Chang@Sun.COM>
2002-10-28clean up new code for NIST primesBodo Möller
create new lock CRYPTO_LOCK_BN to avoid race condition
2002-10-28fast reduction for NIST curvesBodo Möller
Submitted by: Nils Larsch
2002-08-12Do not use the word 'modulus', which is a class template name in VC++ 6.0/SP5.Richard Levitte
PR: 216, point 3
2002-08-02Binary field arithmetic contributed by Sun Microsystems.Bodo Möller
The 'OPENSSL_NO_SUN_DIV' default is still subject to change, so I didn't bother to finish the CHANGES entry yet. Submitted by: Douglas Stebila <douglas.stebila@sun.com>, Sheueling Chang <sheueling.chang@sun.com> (CHANGES entry by Bodo Moeller)