summaryrefslogtreecommitdiffstats
path: root/apps/genrsa.c
diff options
context:
space:
mode:
authorGeorg Schmidt <gs-develop@gs-sys.de>2018-05-31 01:42:39 +0200
committerDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>2018-06-05 18:08:01 +0200
commit0336df2fa316a3e08b8f0d2d0e8d4bc175e46634 (patch)
tree02fa8e84b24a147a48580777445f56f1dc12f1da /apps/genrsa.c
parent630fe1da888490b7dfef3fe0928b813ddff5d51a (diff)
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/genrsa.c')
-rw-r--r--apps/genrsa.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/apps/genrsa.c b/apps/genrsa.c
index 2bc8fa0827..c17cd14715 100644
--- a/apps/genrsa.c
+++ b/apps/genrsa.c
@@ -123,6 +123,11 @@ opthelp:
if (argc == 1) {
if (!opt_int(argv[0], &num) || num <= 0)
goto end;
+ if (num > 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 %d! Larger key size may behave not as expected.\n",
+ OPENSSL_RSA_MAX_MODULUS_BITS, num);
} else if (argc > 0) {
BIO_printf(bio_err, "Extra arguments given.\n");
goto opthelp;