diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2020-06-05 21:40:28 +0200 |
---|---|---|
committer | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2020-06-10 11:08:21 +0200 |
commit | 2a3158ac5ba5aae516f8d3264d723f1b7e86fc34 (patch) | |
tree | f1b6e8b0ffcd011dd6b4775f67ab45e3486c8e93 /apps/dsaparam.c | |
parent | 8da42c8b26393f56acc4f301b95f925eb8902442 (diff) |
Make error output of dhparams and dsaparams app more consistent
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12062)
Diffstat (limited to 'apps/dsaparam.c')
-rw-r--r-- | apps/dsaparam.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/apps/dsaparam.c b/apps/dsaparam.c index 19cb1bdd46..dfcaf38ca9 100644 --- a/apps/dsaparam.c +++ b/apps/dsaparam.c @@ -149,7 +149,6 @@ int dsaparam_main(int argc, char **argv) ctx = EVP_PKEY_CTX_new_from_name(NULL, "DSA", NULL); if (ctx == NULL) { - ERR_print_errors(bio_err); BIO_printf(bio_err, "Error, DSA parameter generation context allocation failed\n"); goto end; @@ -169,19 +168,16 @@ int dsaparam_main(int argc, char **argv) BIO_printf(bio_err, "This could take some time\n"); } if (EVP_PKEY_paramgen_init(ctx) <= 0) { - ERR_print_errors(bio_err); BIO_printf(bio_err, "Error, DSA key generation paramgen init failed\n"); goto end; } if (!EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, num)) { - ERR_print_errors(bio_err); BIO_printf(bio_err, "Error, DSA key generation setting bit length failed\n"); goto end; } if (EVP_PKEY_paramgen(ctx, ¶ms) <= 0) { - ERR_print_errors(bio_err); BIO_printf(bio_err, "Error, DSA key generation failed\n"); goto end; } @@ -191,8 +187,7 @@ int dsaparam_main(int argc, char **argv) params = PEM_read_bio_Parameters(in, NULL); } if (params == NULL) { - BIO_printf(bio_err, "unable to load DSA parameters\n"); - ERR_print_errors(bio_err); + BIO_printf(bio_err, "Error, unable to load DSA parameters\n"); goto end; } @@ -247,8 +242,7 @@ int dsaparam_main(int argc, char **argv) else i = PEM_write_bio_Parameters(out, params); if (!i) { - BIO_printf(bio_err, "unable to write DSA parameters\n"); - ERR_print_errors(bio_err); + BIO_printf(bio_err, "Error, unable to write DSA parameters\n"); goto end; } } @@ -256,19 +250,17 @@ int dsaparam_main(int argc, char **argv) EVP_PKEY_CTX_free(ctx); ctx = EVP_PKEY_CTX_new(params, NULL); if (ctx == NULL) { - ERR_print_errors(bio_err); BIO_printf(bio_err, "Error, DSA key generation context allocation failed\n"); goto end; } if (!EVP_PKEY_keygen_init(ctx)) { - BIO_printf(bio_err, "unable to initialise for key generation\n"); - ERR_print_errors(bio_err); + BIO_printf(bio_err, + "Error, unable to initialise for key generation\n"); goto end; } if (!EVP_PKEY_keygen(ctx, &pkey)) { - BIO_printf(bio_err, "unable to generate key\n"); - ERR_print_errors(bio_err); + BIO_printf(bio_err, "Error, unable to generate key\n"); goto end; } assert(private); @@ -279,6 +271,8 @@ int dsaparam_main(int argc, char **argv) } ret = 0; end: + if (ret != 0) + ERR_print_errors(bio_err); BIO_free(in); BIO_free_all(out); EVP_PKEY_CTX_free(ctx); |