aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/rsa/rsa_gen.c
Commit message (Collapse)AuthorAgeFilesLines
* Deprecate the flags that switch off constant timeMatt Caswell2016-06-061-37/+24
| | | | | | | | | The flags RSA_FLAG_NO_CONSTTIME, DSA_FLAG_NO_EXP_CONSTTIME and DH_FLAG_NO_EXP_CONSTTIME which previously provided the ability to switch off the constant time implementation for RSA, DSA and DH have been made no-ops and deprecated. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Copyright consolidation 08/10Rich Salz2016-05-171-54/+6
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Make the RSA structure opaqueRichard Levitte2016-04-061-1/+1
| | | | | | | | Move rsa_st away from public headers. Add accessor/writer functions for the public RSA data. Adapt all other source to use the accessors and writers. Reviewed-by: Matt Caswell <matt@openssl.org>
* Remove /* foo.c */ commentsRich Salz2016-01-261-1/+0
| | | | | | | | | | | | This was done by the following find . -name '*.[ch]' | /tmp/pl where /tmp/pl is the following three-line script: print unless $. == 1 && m@/\* .*\.[ch] \*/@; close ARGV if eof; # Close file to reset $. And then some hand-editing of other files. Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
* Tighten up BN_with_flags usage and avoid a reachable assertMatt Caswell2015-11-261-40/+58
| | | | | | | | | | | | | | | | | | The function rsa_ossl_mod_exp uses the function BN_with_flags to create a temporary copy (local_r1) of a BIGNUM (r1) with modified flags. This temporary copy shares some state with the original r1. If the state of r1 gets updated then local_r1's state will be stale. This was occurring in the function so that when local_r1 was freed a call to bn_check_top was made which failed an assert due to the stale state. To resolve this we must free local_r1 immediately after we have finished using it and not wait until the end of the function. This problem prompted a review of all BN_with_flag usage within the codebase. All other usage appears to be correct, although often not obviously so. This commit refactors things to make it much clearer for these other uses. Reviewed-by: Emilia Käsper <emilia@openssl.org>
* Continue standardising malloc style for libcryptoMatt Caswell2015-11-091-1/+1
| | | | | | | Continuing from previous commit ensure our style is consistent for malloc return checks. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* More secure storage of key material.Rich Salz2015-06-231-6/+6
| | | | | | | | | Add secure heap for storage of private keys (when possible). Add BIO_s_secmem(), CBIGNUM, etc. Add BIO_CTX_secure_new so all BIGNUM's in the context are secure. Contributed by Akamai Technologies under the Corporate CLA. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Identify and move common internal libcrypto header filesRichard Levitte2015-05-141-1/+1
| | | | | | | | | | | | | There are header files in crypto/ that are used by a number of crypto/ submodules. Move those to crypto/include/internal and adapt the affected source code and Makefiles. The header files that got moved are: crypto/cryptolib.h crypto/md32_common.h Reviewed-by: Rich Salz <rsalz@openssl.org>
* free NULL cleanup 7Rich Salz2015-04-301-9/+5
| | | | | | | | | | | This gets BN_.*free: BN_BLINDING_free BN_CTX_free BN_FLG_FREE BN_GENCB_free BN_MONT_CTX_free BN_RECP_CTX_free BN_clear_free BN_free BUF_MEM_free Also fix a call to DSA_SIG_free to ccgost engine and remove some #ifdef'd dead code in engines/e_ubsec. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Run util/openssl-format-source -v -c .Matt Caswell2015-01-221-168/+184
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* Implement internally opaque bn access from rsaMatt Caswell2014-12-081-4/+13
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* remove OPENSSL_FIPSAPIDr. Stephen Henson2014-12-081-1/+1
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* remove FIPS module code from crypto/rsaDr. Stephen Henson2014-12-081-128/+0
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* Rename FIPS_mode_set and FIPS_mode. Theses symbols will be defined inDr. Stephen Henson2011-05-111-2/+2
| | | | the FIPS capable OpenSSL.
* Add PRNG security strength checking.Dr. Stephen Henson2011-04-231-1/+45
|
* Use 0 for tbslen to perform strlen.Dr. Stephen Henson2011-04-191-3/+3
|
* Remove several of the old obsolete FIPS_corrupt_*() functions.Dr. Stephen Henson2011-04-141-10/+0
|
* Initial incomplete POST overhaul: add support for POST callback toDr. Stephen Henson2011-04-141-3/+3
| | | | allow status of POST to be monitored and/or failures induced.
* Update pairwise consistency checks to use SHA-256.Dr. Stephen Henson2011-02-151-3/+3
|
* Move all FIPSAPI renames into fips.h header file, include early inDr. Stephen Henson2011-01-271-1/+2
| | | | | | crypto.h if needed. Modify source tree to handle change.
* Redirect FIPS memory allocation to FIPS_malloc() routine, removeDr. Stephen Henson2011-01-271-0/+2
| | | | OpenSSL malloc dependencies.
* FIPS mode RSA changes:Dr. Stephen Henson2011-01-261-0/+93
| | | | | | | | | | Check for selftest failures. Pairwise consistency test for RSA key generation. Use some EVP macros instead of EVP functions. Use minimal FIPS EVP where needed.
* Change to mitigate branch prediction attacksBodo Möller2007-03-281-4/+29
| | | | | Submitted by: Matthew D Wood Reviewed by: Bodo Moeller
* fix error found by coverity: check if ctx is != NULL before calling BN_CTX_end()Nils Larsch2006-03-131-2/+5
|
* Fix more error codes.Bodo Möller2005-05-111-2/+2
| | | | | (Also improve util/ck_errf.pl script, and occasionally fix source code formatting.)
* Remove distracting comments and code. Thanks to Nils for picking up on theGeoff Thorpe2004-09-191-16/+0
| | | | | | outstanding ticket. PR: 926
* With the new dynamic BN_CTX implementation, there should be no need forGeoff Thorpe2004-04-271-6/+3
| | | | additional contexts.
* The problem of rsa key-generation getting stuck in a loop for (pointlessly)Geoff Thorpe2004-04-261-2/+15
| | | | | | | | | small key sizes seems to result from the code continually regenerating the same prime value once the range is small enough. From my tests, this change fixes the problem by setting an escape velocity of 3 repeats for the second of the two primes. PR: 874
* Allow RSA key-generation to specify an arbitrary public exponent. JelteGeoff Thorpe2004-04-261-15/+4
| | | | | | | | | proposed the change and submitted the patch, I jiggled it slightly and adjusted the other parts of openssl that were affected. PR: 867 Submitted by: Jelte Jansen Reviewed by: Geoff Thorpe
* A general spring-cleaning (in autumn) to fix up signed/unsigned warnings.Geoff Thorpe2003-10-291-1/+2
| | | | | | | | | | 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.
* This is the first step in allowing RSA_METHODs to implement their own keyGeoff Thorpe2003-01-071-0/+14
| | | | | | 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.
* Nils Larsch submitted;Geoff Thorpe2002-12-081-8/+2
| | | | | | | | - 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.
* This is a first-cut at improving the callback mechanisms used inGeoff Thorpe2002-12-081-28/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Bug fix for 64 bit HP-UX.Ulf Möller2000-06-011-1/+1
| | | | Submitted by: Karsten Spang <ks@bellesystems.com>
* New functions BN_CTX_start(), BN_CTX_get(), BN_CTX_end() to accessUlf Möller2000-02-051-5/+7
| | | | | temporary BIGNUMs. BN_CTX still uses a fixed number of BIGNUMs, but the BN_CTX implementation could now easily be changed.
* Eliminate a warning: BN_mod_inverse() returns a (BIGNUM *) and remove andDr. Stephen Henson1999-07-131-1/+1
| | | | unnecessary cast.
* More evil cast removal.Ben Laurie1999-06-031-1/+1
|
* Remove NOPROTO-related macros.Ulf Möller1999-04-261-1/+1
|
* Change #include filenames from <foo.h> to <openssl.h>.Bodo Möller1999-04-231-2/+2
| | | | | | Submitted by: Reviewed by: PR:
* Change functions to ANSI C.Ulf Möller1999-04-191-5/+2
|
* Import of old SSLeay release: SSLeay 0.9.1b (unreleased)Ralf S. Engelschall1998-12-211-11/+22
|
* Import of old SSLeay release: SSLeay 0.9.0bRalf S. Engelschall1998-12-211-9/+10
|
* Import of old SSLeay release: SSLeay 0.8.1bRalf S. Engelschall1998-12-211-0/+186