diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2014-04-08 20:15:18 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2014-04-08 20:15:18 +0000 |
commit | 06369e3974fbc83d3778807c090fbe69f20a27d4 (patch) | |
tree | 287eb1e7dc05df721bd9cce14889bd9c693295e3 /apps/req.c | |
parent | 2dc7f78169ea4545102b8d9b0604f785cdc798f5 (diff) |
Diffstat (limited to 'apps/req.c')
-rw-r--r-- | apps/req.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/apps/req.c b/apps/req.c index 85526581cefed..5e034a85e8028 100644 --- a/apps/req.c +++ b/apps/req.c @@ -644,6 +644,11 @@ bad: if (inrand) app_RAND_load_files(inrand); + if (!NCONF_get_number(req_conf,SECTION,BITS, &newkey)) + { + newkey=DEFAULT_KEY_LENGTH; + } + if (keyalg) { genctx = set_keygen_ctx(bio_err, keyalg, &pkey_type, &newkey, @@ -652,12 +657,6 @@ bad: goto end; } - if (newkey <= 0) - { - if (!NCONF_get_number(req_conf,SECTION,BITS, &newkey)) - newkey=DEFAULT_KEY_LENGTH; - } - if (newkey < MIN_KEY_LENGTH && (pkey_type == EVP_PKEY_RSA || pkey_type == EVP_PKEY_DSA)) { BIO_printf(bio_err,"private key length is too short,\n"); @@ -1649,6 +1648,8 @@ static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr, int *pkey_type, keylen = atol(p + 1); *pkeylen = keylen; } + else + keylen = *pkeylen; } else if (p) paramfile = p + 1; |