apps/x509: Fix -CAfile option being neglected with -new or -in
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Fri, 20 May 2022 04:23:54 +0000 (06:23 +0200)
committerHugo Landau <hlandau@openssl.org>
Thu, 14 Jul 2022 06:23:58 +0000 (07:23 +0100)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18373)

apps/x509.c

index 28558736041b95d9dd0b9f07bbfd94e89ccf0a8b..182730be9624f085797b416d3628ec6451fd4678 100644 (file)
@@ -730,7 +730,7 @@ int x509_main(int argc, char **argv)
         }
         if ((x = X509_new_ex(app_get0_libctx(), app_get0_propq())) == NULL)
             goto end;
-        if (sno == NULL) {
+        if (CAfile == NULL && sno == NULL) {
             sno = ASN1_INTEGER_new();
             if (sno == NULL || !rand_serial(NULL, sno))
                 goto end;