From d0190e11639956677747f6bc7bb5bcd610fd8600 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Mon, 8 Feb 2021 14:03:35 -0500 Subject: Process digest option 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/cms.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'apps/cms.c') diff --git a/apps/cms.c b/apps/cms.c index 451f0862c2..4f1e614e4c 100644 --- a/apps/cms.c +++ b/apps/cms.c @@ -286,7 +286,7 @@ int cms_main(int argc, char **argv) X509_VERIFY_PARAM *vpm = NULL; char *certfile = NULL, *keyfile = NULL, *contfile = NULL; const char *CAfile = NULL, *CApath = NULL, *CAstore = NULL; - char *certsoutfile = NULL; + char *certsoutfile = NULL, *digestname = NULL; int noCAfile = 0, noCApath = 0, noCAstore = 0; char *infile = NULL, *outfile = NULL, *rctfile = NULL; char *passinarg = NULL, *passin = NULL, *signerfile = NULL, *originatorfile = NULL, *recipfile = NULL; @@ -565,8 +565,7 @@ int cms_main(int argc, char **argv) certsoutfile = opt_arg(); break; case OPT_MD: - if (!opt_md(opt_arg(), &sign_md)) - goto end; + digestname = opt_arg(); break; case OPT_SIGNER: /* If previous -signer argument add signer to list */ @@ -699,6 +698,8 @@ int cms_main(int argc, char **argv) } } app_RAND_load(); + if (digestname != NULL && !opt_md(digestname, &sign_md)) + goto end; /* Remaining args are files to process. */ argc = opt_num_rest(); -- cgit v1.2.3