summaryrefslogtreecommitdiffstats
path: root/apps/x509.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2021-02-08 14:03:35 -0500
committerPauli <ppzgs1@gmail.com>2021-02-12 08:34:17 +1000
commitd0190e11639956677747f6bc7bb5bcd610fd8600 (patch)
tree65b3b8fa880bd32563f4e59bc82624489673da6d /apps/x509.c
parent51e5df0ed01efa47335940425cc8744ecff1b6ae (diff)
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/x509.c')
-rw-r--r--apps/x509.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/apps/x509.c b/apps/x509.c
index 2ddb549939..67895c8169 100644
--- a/apps/x509.c
+++ b/apps/x509.c
@@ -246,7 +246,7 @@ int x509_main(int argc, char **argv)
X509V3_CTX ext_ctx;
EVP_PKEY *signkey = NULL, *CAkey = NULL, *pubkey = NULL;
int newcert = 0;
- char *subj = NULL;
+ char *subj = NULL, *digestname = NULL;
X509_NAME *fsubj = NULL;
const unsigned long chtype = MBSTRING_ASC;
const int multirdn = 1;
@@ -569,8 +569,8 @@ int x509_main(int argc, char **argv)
preserve_dates = 1;
break;
case OPT_MD:
- if (!opt_md(opt_unknown(), &digest))
- goto opthelp;
+ digestname = opt_unknown();
+ break;
}
}
@@ -580,6 +580,10 @@ int x509_main(int argc, char **argv)
goto opthelp;
app_RAND_load();
+ if (digestname != NULL) {
+ if (!opt_md(digestname, &digest))
+ goto opthelp;
+ }
if (preserve_dates && days != UNSET_DAYS) {
BIO_printf(bio_err, "Cannot use -preserve_dates with -days option\n");
goto end;