Add error message to genpkey app for the '-genparam' option
authorShane Lontis <shane.lontis@oracle.com>
Sat, 29 Aug 2020 02:06:05 +0000 (12:06 +1000)
committerMatt Caswell <matt@openssl.org>
Fri, 18 Sep 2020 13:20:38 +0000 (14:20 +0100)
The ordering of this option is important so inform the user if they do it incorrectly.

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/12745)

apps/genpkey.c

index 9da5b556e8c4cdfcdf170355563206076d39fded..94453af15cedb7ac063ae590d563043d3af0400b 100644 (file)
@@ -125,8 +125,12 @@ int genpkey_main(int argc, char **argv)
             }
             break;
         case OPT_GENPARAM:
-            if (ctx != NULL)
+            if (ctx != NULL) {
+                BIO_printf(bio_err,
+                           "%s: '-genparam' option must be set before"
+                            " the '-algorithm' option.\n", prog);
                 goto opthelp;
+            }
             do_param = 1;
             break;
         case OPT_TEXT: