Previously this x509 command line was working, restore that
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Sun, 25 Mar 2018 11:47:48 +0000 (13:47 +0200)
committerBernd Edlinger <bernd.edlinger@hotmail.de>
Mon, 26 Mar 2018 13:15:28 +0000 (15:15 +0200)
openssl x509 -in server.pem -signkey privkey.pem -out server.pem

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5747)

apps/x509.c

index fd391164edb3b69e5b1e0434362f1faf715ba801..9c97d7a02f954755346c634c817599fac64df974 100644 (file)
@@ -450,10 +450,6 @@ int x509_main(int argc, char **argv)
     if (!nmflag_set)
         nmflag = XN_FLAG_ONELINE;
 
-    out = bio_open_default(outfile, 'w', outformat);
-    if (out == NULL)
-        goto end;
-
     if (need_rand)
         app_RAND_load_file(NULL, 0);
 
@@ -579,10 +575,12 @@ int x509_main(int argc, char **argv)
             goto end;
     }
 
-    if (!noout || text || next_serial) {
-        OBJ_create("2.99999.3", "SET.ex3", "SET x509v3 extension 3");
+    out = bio_open_default(outfile, 'w', outformat);
+    if (out == NULL)
+        goto end;
 
-    }
+    if (!noout || text || next_serial)
+        OBJ_create("2.99999.3", "SET.ex3", "SET x509v3 extension 3");
 
     if (alias)
         X509_alias_set1(x, (unsigned char *)alias, -1);