diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2021-02-26 11:42:49 +0100 |
---|---|---|
committer | Dr. David von Oheimb <dev@ddvo.net> | 2021-02-28 11:46:34 +0100 |
commit | ed0a5ac9200466d876a847b82bf95694356cef99 (patch) | |
tree | ad498be5d943458c90052d3de28c6fc3681da9c6 /apps/x509.c | |
parent | rand: use params argument on instantiate call (diff) | |
download | openssl-ed0a5ac9200466d876a847b82bf95694356cef99.tar.xz openssl-ed0a5ac9200466d876a847b82bf95694356cef99.zip |
apps/x509.c: Fix too eager call to X509_set_issuer_name() introduced recently
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14340)
Diffstat (limited to '')
-rw-r--r-- | apps/x509.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/apps/x509.c b/apps/x509.c index 67895c8169..562f28098d 100644 --- a/apps/x509.c +++ b/apps/x509.c @@ -793,10 +793,6 @@ int x509_main(int argc, char **argv) X509_EXTENSION_free(X509_delete_ext(x, i)); } - if ((reqfile || newcert || signkey != NULL || CAfile != NULL) - && !preserve_dates && !set_cert_times(x, NULL, NULL, days)) - goto end; - issuer_cert = x; if (CAfile != NULL) { issuer_cert = xca; @@ -809,8 +805,12 @@ int x509_main(int argc, char **argv) if (sno != NULL && !X509_set_serialNumber(x, sno)) goto end; - if (!X509_set_issuer_name(x, X509_get_subject_name(issuer_cert))) - goto end; + if (reqfile || newcert || signkey != NULL || CAfile != NULL) { + if (!preserve_dates && !set_cert_times(x, NULL, NULL, days)) + goto end; + if (!X509_set_issuer_name(x, X509_get_subject_name(issuer_cert))) + goto end; + } X509V3_set_ctx(&ext_ctx, issuer_cert, x, req, NULL, X509V3_CTX_REPLACE); if (extconf != NULL) { |