summaryrefslogtreecommitdiff
path: root/apps/rsa.c
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>1999-07-12 09:46:34 +0000
committerBodo Möller <bodo@openssl.org>1999-07-12 09:46:34 +0000
commit3a55fc1aaba9e70e16570c1747b6627e8092dc11 (patch)
tree53ff7567dba24a98db9334fe8627d3fc9a00be6a /apps/rsa.c
parent8735ee6f5d1c54d5ab4f8567320a1ecba7775443 (diff)
downloadopenssl-new-3a55fc1aaba9e70e16570c1747b6627e8092dc11.tar.gz
correct error handling
insert spaces in products that occur in error codes
Diffstat (limited to 'apps/rsa.c')
-rw-r--r--apps/rsa.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/apps/rsa.c b/apps/rsa.c
index 6537a24f5d..07c14e2edd 100644
--- a/apps/rsa.c
+++ b/apps/rsa.c
@@ -262,9 +262,12 @@ bad:
}
if (check)
- if (RSA_check_key(rsa))
+ {
+ int r = RSA_check_key(rsa);
+
+ if (r == 1)
BIO_printf(out,"RSA key ok\n");
- else
+ else if (r == 0)
{
long e;
@@ -276,13 +279,15 @@ bad:
BIO_printf(out, "RSA key error: %s\n", ERR_reason_error_string(e));
ERR_get_error(); /* remove e from error stack */
}
- if (e != 0)
- {
- ERR_print_errors(bio_err);
- goto end;
- }
}
-
+
+ if (r == -1 || ERR_peek_error() != 0) /* should happen only if r == -1 */
+ {
+ ERR_print_errors(bio_err);
+ goto end;
+ }
+ }
+
if (noout) goto end;
BIO_printf(bio_err,"writing RSA private key\n");
if (outformat == FORMAT_ASN1)