diff options
author | Rich Salz <rsalz@akamai.com> | 2021-02-08 14:20:01 -0500 |
---|---|---|
committer | Pauli <ppzgs1@gmail.com> | 2021-02-12 08:34:17 +1000 |
commit | 03bbd346f4410c329d472cc043fb6c49f6688eba (patch) | |
tree | 4404d27a430f7a3c8a33ddd6d0633fb35d9a4065 /apps/pkey.c | |
parent | d0190e11639956677747f6bc7bb5bcd610fd8600 (diff) |
Fetch cipher after loading providers
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14135)
Diffstat (limited to 'apps/pkey.c')
-rw-r--r-- | apps/pkey.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/apps/pkey.c b/apps/pkey.c index a48c9856bf..1a53447401 100644 --- a/apps/pkey.c +++ b/apps/pkey.c @@ -73,7 +73,7 @@ int pkey_main(int argc, char **argv) EVP_PKEY_CTX *ctx = NULL; const EVP_CIPHER *cipher = NULL; char *infile = NULL, *outfile = NULL, *passin = NULL, *passout = NULL; - char *passinarg = NULL, *passoutarg = NULL, *prog; + char *passinarg = NULL, *passoutarg = NULL, *ciphername = NULL, *prog; OPTION_CHOICE o; int informat = FORMAT_PEM, outformat = FORMAT_PEM; int pubin = 0, pubout = 0, text_pub = 0, text = 0, noout = 0, ret = 1; @@ -143,8 +143,7 @@ int pkey_main(int argc, char **argv) pub_check = 1; break; case OPT_CIPHER: - if (!opt_cipher(opt_unknown(), &cipher)) - goto opthelp; + ciphername = opt_unknown(); break; case OPT_EC_CONV_FORM: #ifdef OPENSSL_NO_EC @@ -187,6 +186,10 @@ int pkey_main(int argc, char **argv) "Warning: The -traditional is ignored since there is no PEM output\n"); private = (!noout && !pubout) || (text && !text_pub); + if (ciphername != NULL) { + if (!opt_cipher(ciphername, &cipher)) + goto opthelp; + } if (cipher == NULL) { if (passoutarg != NULL) BIO_printf(bio_err, |