diff options
author | Philip Prindeville <philipp@redfish-solutions.com> | 2018-08-09 15:19:19 -0600 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2019-05-01 16:41:49 +1000 |
commit | b6a07f676071b2b9fdc0e625896ebd57563028cd (patch) | |
tree | 252e299684d6e5407f0dec94be57df52c09179a9 /apps/gendsa.c | |
parent | c43fa566ea3918ec3b468d214fd9eb80d79e0d0d (diff) | |
download | openssl-new-b6a07f676071b2b9fdc0e625896ebd57563028cd.tar.gz |
gendsa: dsaparam: introduce -verbose option to enable output
Other commands like 'req' support -verbose, so why not gendsa and dsaparam?
Part of a larger and more ambitious effort to add -verbose to all apps
that might be used in scripts and need to otherwise run silently (well,
without belching out anything that isn't a warning or error... which ties
into a later scrub of using STDOUT were appropriate for informative
messages instead of STDERR)... so that scripts also have the option of
doing >/dev/null without losing anything critical.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/6908)
Diffstat (limited to 'apps/gendsa.c')
-rw-r--r-- | apps/gendsa.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/apps/gendsa.c b/apps/gendsa.c index c44311b536..9671b23424 100644 --- a/apps/gendsa.c +++ b/apps/gendsa.c @@ -27,7 +27,7 @@ NON_EMPTY_TRANSLATION_UNIT typedef enum OPTION_choice { OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, - OPT_OUT, OPT_PASSOUT, OPT_ENGINE, OPT_CIPHER, + OPT_OUT, OPT_PASSOUT, OPT_ENGINE, OPT_CIPHER, OPT_VERBOSE, OPT_R_ENUM } OPTION_CHOICE; @@ -42,6 +42,7 @@ const OPTIONS gendsa_options[] = { # ifndef OPENSSL_NO_ENGINE {"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"}, # endif + {"verbose", OPT_VERBOSE, '-', "Verbose output"}, {NULL} }; @@ -54,7 +55,7 @@ int gendsa_main(int argc, char **argv) char *dsaparams = NULL; char *outfile = NULL, *passoutarg = NULL, *passout = NULL, *prog; OPTION_CHOICE o; - int ret = 1, private = 0; + int ret = 1, private = 0, verbose = 0; const BIGNUM *p = NULL; prog = opt_init(argc, argv, gendsa_options); @@ -86,6 +87,9 @@ int gendsa_main(int argc, char **argv) if (!opt_cipher(opt_unknown(), &enc)) goto end; break; + case OPT_VERBOSE: + verbose = 1; + break; } } argc = opt_num_rest(); @@ -124,7 +128,8 @@ int gendsa_main(int argc, char **argv) " Your key size is %d! Larger key size may behave not as expected.\n", OPENSSL_DSA_MAX_MODULUS_BITS, BN_num_bits(p)); - BIO_printf(bio_err, "Generating DSA key, %d bits\n", BN_num_bits(p)); + if (verbose) + BIO_printf(bio_err, "Generating DSA key, %d bits\n", BN_num_bits(p)); if (!DSA_generate_key(dsa)) goto end; |