From 03bbd346f4410c329d472cc043fb6c49f6688eba Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Mon, 8 Feb 2021 14:20:01 -0500 Subject: Fetch cipher after loading providers Reviewed-by: Shane Lontis Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/14135) --- apps/smime.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'apps/smime.c') diff --git a/apps/smime.c b/apps/smime.c index fd1e2e6810..63578f28d5 100644 --- a/apps/smime.c +++ b/apps/smime.c @@ -146,7 +146,7 @@ int smime_main(int argc, char **argv) char *certfile = NULL, *keyfile = NULL, *contfile = NULL; char *infile = NULL, *outfile = NULL, *signerfile = NULL, *recipfile = NULL; char *passinarg = NULL, *passin = NULL, *to = NULL, *from = NULL; - char *subject = NULL, *digestname = NULL; + char *subject = NULL, *digestname = NULL, *ciphername = NULL; OPTION_CHOICE o; int noCApath = 0, noCAfile = 0, noCAstore = 0; int flags = PKCS7_DETACHED, operation = 0, ret = 0, indef = 0; @@ -297,8 +297,7 @@ int smime_main(int argc, char **argv) digestname = opt_arg(); break; case OPT_CIPHER: - if (!opt_cipher(opt_unknown(), &cipher)) - goto opthelp; + ciphername = opt_unknown(); break; case OPT_INKEY: /* If previous -inkey argument add signer to list */ @@ -365,6 +364,10 @@ int smime_main(int argc, char **argv) if (!opt_md(digestname, &sign_md)) goto opthelp; } + if (ciphername != NULL) { + if (!opt_cipher(ciphername, &cipher)) + goto opthelp; + } if (!(operation & SMIME_SIGNERS) && (skkeys != NULL || sksigners != NULL)) { BIO_puts(bio_err, "Multiple signers or keys not allowed\n"); goto opthelp; -- cgit v1.2.3