summaryrefslogtreecommitdiffstats
path: root/apps/req.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2021-02-08 20:03:35 +0100
committerPauli <ppzgs1@gmail.com>2021-02-11 23:34:17 +0100
commitd0190e11639956677747f6bc7bb5bcd610fd8600 (patch)
tree65b3b8fa880bd32563f4e59bc82624489673da6d /apps/req.c
parentLoad rand state after loading providers (diff)
downloadopenssl-d0190e11639956677747f6bc7bb5bcd610fd8600.tar.xz
openssl-d0190e11639956677747f6bc7bb5bcd610fd8600.zip
Process digest option 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/req.c')
-rw-r--r--apps/req.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/apps/req.c b/apps/req.c
index 4cd31cf4ba..881cbb45c7 100644
--- a/apps/req.c
+++ b/apps/req.c
@@ -245,7 +245,7 @@ int req_main(int argc, char **argv)
BIO *addext_bio = NULL;
char *extensions = NULL;
const char *infile = NULL, *CAfile = NULL, *CAkeyfile = NULL;
- char *outfile = NULL, *keyfile = NULL;
+ char *outfile = NULL, *keyfile = NULL, *digestname = NULL;
char *keyalgstr = NULL, *p, *prog, *passargin = NULL, *passargout = NULL;
char *passin = NULL, *passout = NULL;
char *nofree_passin = NULL, *nofree_passout = NULL;
@@ -468,9 +468,7 @@ int req_main(int argc, char **argv)
newreq = precert = 1;
break;
case OPT_MD:
- if (!opt_md(opt_unknown(), &md_alg))
- goto opthelp;
- digest = md_alg;
+ digestname = opt_unknown();
break;
}
}
@@ -481,6 +479,12 @@ int req_main(int argc, char **argv)
goto opthelp;
app_RAND_load();
+ if (digestname != NULL) {
+ if (!opt_md(digestname, &md_alg))
+ goto opthelp;
+ digest = md_alg;
+ }
+
if (!gen_x509) {
if (days != UNSET_DAYS)
BIO_printf(bio_err, "Ignoring -days without -x509; not generating a certificate\n");