summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_exp.c
AgeCommit message (Collapse)Author
2014-09-04Ensure that x**0 mod 1 = 0.Adam Langley
(cherry picked from commit 2b0180c37fa6ffc48ee40caa831ca398b828e680) Reviewed-by: Ben Laurie <ben@openssl.org>
2009-06-17Update from HEAD.Dr. Stephen Henson
2007-03-28Change to mitigate branch prediction attacksBodo Möller
Submitted by: Matthew D Wood Reviewed by: Bodo Moeller
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
2004-03-25Adjust various bignum functions to use BN_CTX for variables instead ofGeoff Thorpe
locally initialising their own. NB: I've removed the "BN_clear_free()" loops for the exit-paths in some of these functions, and that may be a major part of the performance improvements we're seeing. The "free" part can be removed because we're using BN_CTX. The "clear" part OTOH can be removed because BN_CTX destruction automatically performs this task, so performing it inside functions that may be called repeatedly is wasteful. This is currently safe within openssl due to the fact that BN_CTX objects are never created for longer than a single high-level operation. However, that is only because there's currently no mechanism in openssl for thread-local storage. Beyond that, this might be an issue for applications using the bignum API directly and caching their own BN_CTX objects. The solution is to introduce a flag to BN_CTX_start() that allows its variables to be automatically sanitised on release during BN_CTX_end(). This way any higher-level function (and perhaps the application) can specify this flag in its own BN_CTX_start()/BN_CTX_end() pair, and this will cause inner-loop functions specifying the flag to be ignored so that sanitisation is handled only once back out at the higher level. I will be implementing this in the near future.
2004-03-13Convert openssl code not to assume the deprecated form of BN_zero().Geoff Thorpe
Remove certain redundant BN_zero() initialisations, because BN_CTX_get(), BN_init(), [etc] already initialise to zero. Correct error checking in bn_sqr.c, and be less wishy-wash about how/why the result's 'top' value is set (note also, 'max' is always > 0 at this point).
2003-12-02Use the BN_is_odd() macro in place of code that (inconsistently) does muchGeoff Thorpe
the same thing. Also, I have some stuff on the back-burner related to some BN_CTX notes from Peter Gutmann about his cryptlib hacks to the bignum code. The BN_CTX comments are there to remind me of some relevant points in the code.
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.
2000-12-07Fix some things that look like bugs.Bodo Möller
One problem that looked like a problem in bn_recp.c at first turned out to be a BN_mul bug. An example is given in bn_recp.c; finding the bug responsible for this is left as an exercise.
2000-11-30Move reduction step from BN_mod_exp to BN_mod_exp_mont_word.Bodo Möller
Fix BN_mod_exp_simple for a==0 (mod m). Skip useless round in BN_mod_sqrt (1 is always a square, no need to test BN_kronecker for it).
2000-11-30Handle special cases correctly in exponentation functions.Bodo Möller
test_bn still fails in the BN_sqrt test because small primes appear to turn into zero for no obvious reason, leading to "div by zero" errors.
2000-11-30BN_sqrtBodo Möller
2000-11-29Improve BN_mod_inverse performance.Bodo Möller
Get the BN_mod_exp_mont bugfix (for handling negative inputs) correct this time.
2000-11-28Timings.Bodo Möller
2000-11-26modular arithmeticsBodo Möller
"make update"
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-10-26Merge the engine branch into the main trunk. All conflicts resolved.Richard Levitte
At the same time, add VMS support for Rijndael.
2000-06-23Actually comment out the parts of BN_MOD_MUL_WORD that I inteded toBodo Möller
comment out in the previous commit
2000-06-23In BN_mod_exp_mont_word, avoid one application of BN_MOD_MUL_WORD,Bodo Möller
and for small 'a' also a couple of calls to BN_mod_mul_montgomery(r, r, r, ...).
2000-06-13Use BN_CTX_end when exiting early from BN_mod_exp_mont_word becauseBodo Möller
BN_mod_exp_atalla could be used.
2000-06-13The atalla functionality doesn't work with the "word" version ofGeoff Thorpe
BN_mod_exp. Call the regular atalla mod_exp operation instead.
2000-06-08Slightly faster DSA verification (BN_mod_exp2_mont),Bodo Möller
marginally faster BN_mod_exp for 1024 bit exponents.
2000-06-08Use the equivalent of a sliding window (without precomputationBodo Möller
because we're only handling words anyway) in BN_mod_exp_mont_word making it a little faster for very small exponents, and adjust the performance gain estimate in CHANGES according to slightly more thorough measurements. (15% faster than BN_mod_exp_mont for "large" base, 20% faster than BN_mod_exp_mont for small base.)
2000-06-07Speed up DH with small generator.Bodo Möller
2000-02-16Add support for Compaq Atalla crypto accelerator.Ben Laurie
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.
1999-06-04Some constification and stacks that slipped through the cracks (how?).Ben Laurie
1999-04-19Change functions to ANSI C.Ulf Möller
1999-01-28Fixes to BN code. Previously the default was to define BN_RECURSIONMark J. Cox
but the BN code had some problems that would cause failures when doing certificate verification and some other functions. Submitted by: Eric A Young from a C2Net version of SSLeay Reviewed by: Mark J Cox PR:
1998-12-21Import of old SSLeay release: SSLeay 0.9.1b (unreleased)SSLeayRalf S. Engelschall
1998-12-21Import of old SSLeay release: SSLeay 0.9.0bRalf S. Engelschall
1998-12-21Import of old SSLeay release: SSLeay 0.8.1bRalf S. Engelschall