X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=apps%2Fprime.c;h=6944797646962c369f3f7bed27c7f4086282c270;hp=1092cf215e4b6c3031c9e63fb9fa08e89149fd17;hb=0b3f5eab644dfcb7023b2396ec0c9aa6785f48e2;hpb=44c83ebd7089825a82545c9cacc4c4e2de81d001 diff --git a/apps/prime.c b/apps/prime.c index 1092cf215e..6944797646 100644 --- a/apps/prime.c +++ b/apps/prime.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -10,6 +10,7 @@ #include #include "apps.h" +#include "progs.h" #include typedef enum OPTION_choice { @@ -43,6 +44,7 @@ int prime_main(int argc, char **argv) switch (o) { case OPT_EOF: case OPT_ERR: +opthelp: BIO_printf(bio_err, "%s: Use -help for summary.\n", prog); goto end; case OPT_HELP: @@ -69,9 +71,14 @@ int prime_main(int argc, char **argv) argc = opt_num_rest(); argv = opt_rest(); - if (argc == 0 && !generate) { + if (generate) { + if (argc != 0) { + BIO_printf(bio_err, "Extra arguments given.\n"); + goto opthelp; + } + } else if (argc == 0) { BIO_printf(bio_err, "%s: No prime specified\n", prog); - goto end; + goto opthelp; } if (generate) { @@ -106,7 +113,7 @@ int prime_main(int argc, char **argv) else r = BN_dec2bn(&bn, argv[0]); - if(!r) { + if (!r) { BIO_printf(bio_err, "Failed to process value (%s)\n", argv[0]); goto end; }