summaryrefslogtreecommitdiffstats
path: root/apps/req.c
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2021-04-26 12:08:27 +0200
committerTomas Mraz <tomas@openssl.org>2021-04-28 09:38:31 +0200
commiteaf8a40d97d642ccd2c55fbf8bb8ee3242aec04a (patch)
tree23ef2d3756c42a91841270eb74330a8840dbf5d0 /apps/req.c
parentc0a79e9836a9aa30912978f69fab3b3bb3a8ddc5 (diff)
Prefer fetch over legacy get_digestby/get_cipherby
Fixes #14198 Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15028)
Diffstat (limited to 'apps/req.c')
-rw-r--r--apps/req.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/apps/req.c b/apps/req.c
index 4e1cae6ba6..89bde55b93 100644
--- a/apps/req.c
+++ b/apps/req.c
@@ -240,7 +240,7 @@ int req_main(int argc, char **argv)
X509 *new_x509 = NULL, *CAcert = NULL;
X509_REQ *req = NULL;
EVP_CIPHER *cipher = NULL;
- EVP_MD *md_alg = NULL, *digest = NULL;
+ EVP_MD *digest = NULL;
int ext_copy = EXT_COPY_UNSET;
BIO *addext_bio = NULL;
char *extensions = NULL;
@@ -482,9 +482,8 @@ int req_main(int argc, char **argv)
goto end;
if (digestname != NULL) {
- if (!opt_md(digestname, &md_alg))
+ if (!opt_md(digestname, &digest))
goto opthelp;
- digest = md_alg;
}
if (!gen_x509) {
@@ -536,14 +535,13 @@ int req_main(int argc, char **argv)
if (!add_oid_section(req_conf))
goto end;
- if (md_alg == NULL) {
+ if (digest == NULL) {
p = NCONF_get_string(req_conf, section, "default_md");
if (p == NULL) {
ERR_clear_error();
} else {
- if (!opt_md(p, &md_alg))
+ if (!opt_md(p, &digest))
goto opthelp;
- digest = md_alg;
}
}
@@ -1058,7 +1056,6 @@ int req_main(int argc, char **argv)
BIO_free(addext_bio);
BIO_free_all(out);
EVP_PKEY_free(pkey);
- EVP_MD_free(md_alg);
EVP_MD_free(digest);
EVP_PKEY_CTX_free(genctx);
sk_OPENSSL_STRING_free(pkeyopts);