summaryrefslogtreecommitdiffstats
path: root/crypto/rsa/rsa_eay.c
AgeCommit message (Collapse)Author
2015-01-22Rerun util/openssl-format-source -v -c .OpenSSL_1_0_1-post-auto-reformatMatt Caswell
Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-01-22Run util/openssl-format-source -v -c .Matt Caswell
Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-01-22indent has problems with comments that are on the right hand side of a line.Matt Caswell
Sometimes it fails to format them very well, and sometimes it corrupts them! This commit moves some particularly problematic ones. Conflicts: crypto/bn/bn.h crypto/ec/ec_lcl.h crypto/rsa/rsa.h demos/engines/ibmca/hw_ibmca.c ssl/ssl.h ssl/ssl3.h Conflicts: crypto/ec/ec_lcl.h ssl/tls1.h Reviewed-by: Tim Hudson <tjh@openssl.org>
2014-07-05Return smaller of ret and f.Alan Hryngle
PR#3418. (cherry picked from commit fdea4fff8fb058be928980600b24cf4c62ef3630)
2012-06-08Reduce version skew.Ben Laurie
2011-10-19BN_BLINDING multi-threading fix.Bodo Möller
Submitted by: Emilia Kasper (Google)
2010-10-11PR: 2295Dr. Stephen Henson
Submitted by: Alexei Khlebnikov <alexei.khlebnikov@opera.com> Reviewed by: steve OOM checking. Leak in OOM fix. Fall-through comment. Duplicate code elimination.
2008-09-14Really get rid of unsafe double-checked locking.Bodo Möller
Also, "CHANGES" clean-ups.
2008-08-06Remove the dual-callback scheme for numeric and pointer thread IDs,Geoff Thorpe
deprecate the original (numeric-only) scheme, and replace with the CRYPTO_THREADID object. This hides the platform-specifics and should reduce the possibility for programming errors (where failing to explicitly check both thread ID forms could create subtle, platform-specific bugs). Thanks to Bodo, for invaluable review and feedback.
2008-07-03Revert my earlier CRYPTO_THREADID commit, I will commit a reworkedGeoff Thorpe
version some time soon.
2008-03-28There was a need to support thread ID types that couldn't be reliably castGeoff Thorpe
to 'unsigned long' (ie. odd platforms/compilers), so a pointer-typed version was added but it required portable code to check *both* modes to determine equality. This commit maintains the availability of both thread ID types, but deprecates the type-specific accessor APIs that invoke the callbacks - instead a single type-independent API is used. This simplifies software that calls into this interface, and should also make it less error-prone - as forgetting to call and compare *both* thread ID accessors could have led to hard-to-debug/infrequent bugs (that might only affect certain platforms or thread implementations). As the CHANGES note says, there were corresponding deprecations and replacements in the thread-related functions for BN_BLINDING and ERR too.
2008-02-27fix BIGNUM flag handlingBodo Möller
2007-03-28Change to mitigate branch prediction attacksBodo Möller
Submitted by: Matthew D Wood Reviewed by: Bodo Moeller
2006-09-28Introduce limits to prevent malicious keys being able toBodo Möller
cause a denial of service. (CVE-2006-2940) [Steve Henson, Bodo Moeller]
2006-09-06Remove non-functional part of recent patch, after discussion withBodo Möller
Colin Percival (this would have caused more problems than solved, and isn't really necessary anyway)
2006-09-05Avoid PKCS #1 v1.5 signature attack discovered by Daniel BleichenbacherMark J. Cox
(CVE-2006-4339) Submitted by: Ben Laurie, Google Security Team Reviewed by: bmoeller, mjc, shenson
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-14Thread-safety fixesBodo Möller
2005-09-22protect BN_BLINDING_invert with a write lock and BN_BLINDING_convertNils Larsch
with a read lock Submitted by: Leandro Santi <lesanti@fiuba7504.com.ar>
2005-05-28Update from 0.9.7-stable. Also repatch and rebuild error codes.Dr. Stephen Henson
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-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-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-03-25By adding a BN_CTX parameter to the 'rsa_mod_exp' callback, private keyGeoff Thorpe
operations no longer require two distinct BN_CTX structures. This may put more "strain" on the current BN_CTX implementation (which has a fixed limit to the number of variables it will hold), but so far this limit is not triggered by any of the tests pass and I will be changing BN_CTX in the near future to avoid this problem anyway. This also changes the default RSA implementation code to use the BN_CTX in favour of initialising some of its variables locally in each function.
2004-03-15Make sure that the last argument to RAND_add() is a float, or someRichard Levitte
compilers may complain.
2003-04-15Memory leak fix: local blinding structure not freed in rsa_eay_private_decrypt()Richard Levitte
2003-04-08We seem to carry some rests of the 0.9.6 [engine] ENGINE framework in formRichard Levitte
of unneeded includes of openssl/engine.h.
2003-04-02make RSA blinding thread-safeBodo Möller
2003-03-20make sure RSA blinding works when the PRNG is not properly seeded;Bodo Möller
enable it automatically for the built-in engine
2003-02-15We cache a montgomery form for 'n' if the PUBLIC flag is set, not PRIVATE.Geoff Thorpe
Also, I've added handling for other mod_exp calls that were not using any cached montgomery forms. These cases matter only for special RSA keys (eg. ones that are missing information) so are unlikely to be used in normal circumstances.
2003-02-14David Brumley <dbrumley@stanford.edu> noted and corrected a case in theGeoff Thorpe
verification step of CRT private key operations in the RSA code - previously no montgomery form was checked or used for 'n', and so it would be generated on the fly each time. As a result, private key operations are now a percent or two faster. Rather than adding this as another repetition of the nearly-identical montgomery "check for first-use" initialisation code blocks, I've taken this chance to create a helper function and macro-wrapper to replace them. PR: 475
2003-01-30Add the possibility to build without the ENGINE framework.Richard Levitte
PR: 287
2003-01-07This is the first step in allowing RSA_METHODs to implement their own keyGeoff Thorpe
generation. This prototype matches the new API function RSA_generate_key_ex(), though both may be subject to change during development before 0.9.8.
2002-11-28Cleanse memory using the new OPENSSL_cleanse() function.Richard Levitte
I've covered all the memset()s I felt safe modifying, but may have missed some.
2002-11-04implement and use new macros BN_get_sign(), BN_set_sign()Bodo Möller
Submitted by: Nils Larsch
2002-05-30Check the return values where memory allocation failures may happen.Richard Levitte
PR: 49
2001-09-25This commits changes to various parts of libcrypto required by the recentGeoff Thorpe
ENGINE surgery. DH, DSA, RAND, and RSA now use *both* "method" and ENGINE pointers to manage their hooking with ENGINE. Previously their use of "method" pointers was replaced by use of ENGINE references. See crypto/engine/README for details. Also, remove the ENGINE iterations from evp_test - even when the cipher/digest code is committed in, this functionality would require a different set of API calls.
2001-09-20commentsBodo Möller
2001-07-25always reject data >= nBodo Möller
2001-07-20Currently, RSA code, when using no padding scheme, simply checks that inputGeoff Thorpe
does not contain more bytes than the RSA modulus 'n' - it does not check that the input is strictly *less* than 'n'. Whether this should be the case or not is open to debate - however, due to security problems with returning miscalculated CRT results, the 'rsa_mod_exp' implementation in rsa_eay.c now performs a public-key exponentiation to verify the CRT result and in the event of an error will instead recalculate and return a non-CRT (more expensive) mod_exp calculation. As the mod_exp of 'I' is equivalent to the mod_exp of 'I mod n', and the verify result is automatically between 0 and n-1 inclusive, the verify only matches the input if 'I' was less than 'n', otherwise even a correct CRT calculation is only congruent to 'I' (ie. they differ by a multiple of 'n'). Rather than rejecting correct calculations and doing redundant and slower ones instead, this changes the equality check in the verification code to a congruence check.
2001-03-28check CRTUlf Möller
2001-03-28check CRTUlf Möller
2001-02-19Make all configuration macros available for application by makingRichard Levitte
sure they are available in opensslconf.h, by giving them names starting with "OPENSSL_" to avoid conflicts with other packages and by making sure e_os2.h will cover all platform-specific cases together with opensslconf.h. I've checked fairly well that nothing breaks with this (apart from external software that will adapt if they have used something like NO_KRB5), but I can't guarantee it completely, so a review of this change would be a good thing.
2000-12-19fix indentationBodo Möller
2000-12-19Don't hold CRYPTO_LOCK_RSA during time-consuming operations.Bodo Möller
2000-12-18Add a comment (intended change)Bodo Möller
2000-12-18Obtain lock CRYPTO_LOCK_RSA before creating BN_MONT_CTXBodo Möller
structures and setting rsa->_method_mod_{n,p,q}. Submitted by: "Reddie, Steven" <Steven.Reddie@ca.com>