diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2021-01-21 12:36:58 +0100 |
---|---|---|
committer | Dr. David von Oheimb <dev@ddvo.net> | 2021-02-22 08:49:52 +0100 |
commit | 7f90026b3fca9cfd3d9098d358d949d37509a2e5 (patch) | |
tree | d91a6f22702f8977560f7ffec75ac0e10e942bc9 /apps/rsa.c | |
parent | 4718326a46ad460fefc5cc240a8599af4b5993c7 (diff) |
Handle NULL result of ERR_reason_error_string() in some apps
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13920)
Diffstat (limited to 'apps/rsa.c')
-rw-r--r-- | apps/rsa.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/apps/rsa.c b/apps/rsa.c index 499013bae4..251f84f210 100644 --- a/apps/rsa.c +++ b/apps/rsa.c @@ -259,7 +259,7 @@ int rsa_main(int argc, char **argv) pctx = EVP_PKEY_CTX_new_from_pkey(NULL, pkey, NULL); if (pctx == NULL) { - BIO_printf(out, "RSA unable to create PKEY context\n"); + BIO_printf(bio_err, "RSA unable to create PKEY context\n"); ERR_print_errors(bio_err); goto end; } @@ -269,15 +269,8 @@ int rsa_main(int argc, char **argv) if (r == 1) { BIO_printf(out, "RSA key ok\n"); } else if (r == 0) { - unsigned long err; - - while ((err = ERR_peek_error()) != 0 && - ERR_GET_LIB(err) == ERR_LIB_RSA && - ERR_GET_REASON(err) != ERR_R_MALLOC_FAILURE) { - BIO_printf(out, "RSA key error: %s\n", - ERR_reason_error_string(err)); - ERR_get_error(); /* remove err from error stack */ - } + BIO_printf(bio_err, "RSA key not ok\n"); + ERR_print_errors(bio_err); } else if (r == -1) { ERR_print_errors(bio_err); goto end; |