fd2893
diff -up openssl-1.0.2k/apps/req.c.req-x509 openssl-1.0.2k/apps/req.c
fd2893
--- openssl-1.0.2k/apps/req.c.req-x509	2017-03-09 17:59:26.269231647 +0100
fd2893
+++ openssl-1.0.2k/apps/req.c	2017-05-17 13:23:31.236556216 +0200
fd2893
@@ -331,7 +331,6 @@ int MAIN(int argc, char **argv)
fd2893
         else if (strcmp(*argv, "-text") == 0)
fd2893
             text = 1;
fd2893
         else if (strcmp(*argv, "-x509") == 0) {
fd2893
-            newreq = 1;
fd2893
             x509 = 1;
fd2893
         } else if (strcmp(*argv, "-asn1-kludge") == 0)
fd2893
             kludge = 1;
fd2893
@@ -447,6 +446,9 @@ int MAIN(int argc, char **argv)
fd2893
         goto end;
fd2893
     }
fd2893
 
fd2893
+    if (x509 && infile == NULL)
fd2893
+        newreq = 1;
fd2893
+
fd2893
     ERR_load_crypto_strings();
fd2893
     if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
fd2893
         BIO_printf(bio_err, "Error getting passwords\n");
fd2893
@@ -753,7 +755,7 @@ int MAIN(int argc, char **argv)
fd2893
         }
fd2893
     }
fd2893
 
fd2893
-    if (newreq) {
fd2893
+    if (newreq || x509) {
fd2893
         if (pkey == NULL) {
fd2893
             BIO_printf(bio_err, "you need to specify a private key\n");
fd2893
             goto end;