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