summaryrefslogtreecommitdiffstats
path: root/apps/rsa.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2021-02-08 14:20:01 -0500
committerPauli <ppzgs1@gmail.com>2021-02-12 08:34:17 +1000
commit03bbd346f4410c329d472cc043fb6c49f6688eba (patch)
tree4404d27a430f7a3c8a33ddd6d0633fb35d9a4065 /apps/rsa.c
parentd0190e11639956677747f6bc7bb5bcd610fd8600 (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/rsa.c')
-rw-r--r--apps/rsa.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/apps/rsa.c b/apps/rsa.c
index b65c8fc793..1a75681c70 100644
--- a/apps/rsa.c
+++ b/apps/rsa.c
@@ -93,7 +93,7 @@ int rsa_main(int argc, char **argv)
EVP_PKEY *pkey = NULL;
EVP_PKEY_CTX *pctx;
const EVP_CIPHER *enc = NULL;
- char *infile = NULL, *outfile = NULL, *prog;
+ char *infile = NULL, *outfile = NULL, *ciphername = NULL, *prog;
char *passin = NULL, *passout = NULL, *passinarg = NULL, *passoutarg = NULL;
int private = 0;
int informat = FORMAT_PEM, outformat = FORMAT_PEM, text = 0, check = 0;
@@ -171,8 +171,7 @@ int rsa_main(int argc, char **argv)
check = 1;
break;
case OPT_CIPHER:
- if (!opt_cipher(opt_unknown(), &enc))
- goto opthelp;
+ ciphername = opt_unknown();
break;
case OPT_PROV_CASES:
if (!opt_provider(o))
@@ -189,6 +188,10 @@ int rsa_main(int argc, char **argv)
if (argc != 0)
goto opthelp;
+ if (ciphername != NULL) {
+ if (!opt_cipher(ciphername, &enc))
+ goto opthelp;
+ }
private = (text && !pubin) || (!pubout && !noout) ? 1 : 0;
if (!app_passwd(passinarg, passoutarg, &passin, &passout)) {