diff options
author | Georg Schmidt <gs-develop@gs-sys.de> | 2018-05-31 01:42:39 +0200 |
---|---|---|
committer | Dr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> | 2018-06-05 18:08:01 +0200 |
commit | 0336df2fa316a3e08b8f0d2d0e8d4bc175e46634 (patch) | |
tree | 02fa8e84b24a147a48580777445f56f1dc12f1da /apps/req.c | |
parent | Improve wording (diff) | |
download | openssl-0336df2fa316a3e08b8f0d2d0e8d4bc175e46634.tar.xz openssl-0336df2fa316a3e08b8f0d2d0e8d4bc175e46634.zip |
Issue warnings for large DSA and RSA keys
Issue a warning when generating DSA or RSA keys of size greater than
OPENSSL_DSA_MAX_MODULUS_BITS resp. OPENSSL_RSA_MAX_MODULUS_BITS.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/6380)
Diffstat (limited to 'apps/req.c')
-rw-r--r-- | apps/req.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/apps/req.c b/apps/req.c index ca4b7ec891..59baa89bcf 100644 --- a/apps/req.c +++ b/apps/req.c @@ -517,6 +517,18 @@ int req_main(int argc, char **argv) goto end; } + if (pkey_type == EVP_PKEY_RSA && newkey > OPENSSL_RSA_MAX_MODULUS_BITS) + BIO_printf(bio_err, + "Warning: It is not recommended to use more than %d bit for RSA keys.\n" + " Your key size is %ld! Larger key size may behave not as expected.\n", + OPENSSL_RSA_MAX_MODULUS_BITS, newkey); + + if (pkey_type == EVP_PKEY_DSA && newkey > OPENSSL_DSA_MAX_MODULUS_BITS) + BIO_printf(bio_err, + "Warning: It is not recommended to use more than %d bit for DSA keys.\n" + " Your key size is %ld! Larger key size may behave not as expected.\n", + OPENSSL_DSA_MAX_MODULUS_BITS, newkey); + if (genctx == NULL) { genctx = set_keygen_ctx(NULL, &pkey_type, &newkey, &keyalgstr, gen_eng); |