diff options
author | Viktor Dukhovni <openssl-users@dukhovni.org> | 2016-02-02 00:37:41 -0500 |
---|---|---|
committer | Viktor Dukhovni <openssl-users@dukhovni.org> | 2016-02-02 23:24:12 -0500 |
commit | 0c20802c6a6008b28bfb0eac67d69f536edc60a7 (patch) | |
tree | 4791be792befcf693011fd98dfd0ec6bd54b9c16 /apps/rsautl.c | |
parent | 43d6702de97d2d5b5b825ffea772b9f55635688c (diff) |
Fix pkeyutl/rsautl empty encrypt-input/decrypt-output handling
Also fix option processing in pkeyutl to allow use of (formerly)
"out-of-order" switches that were needless implementation limitations.
Handle documented "ENGINE" form with -keyform and -peerform.
Better handling of OPENSSL_NO_ENGINE and OPENSSL_NO_RSA.
RT2018
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'apps/rsautl.c')
-rw-r--r-- | apps/rsautl.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/apps/rsautl.c b/apps/rsautl.c index 5d6bdc0242..b576ca0b76 100644 --- a/apps/rsautl.c +++ b/apps/rsautl.c @@ -87,7 +87,7 @@ OPTIONS rsautl_options[] = { {"in", OPT_IN, '<', "Input file"}, {"out", OPT_OUT, '>', "Output file"}, {"inkey", OPT_INKEY, '<', "Input key"}, - {"keyform", OPT_KEYFORM, 'F', "Private key format - default PEM"}, + {"keyform", OPT_KEYFORM, 'E', "Private key format - default PEM"}, {"pubin", OPT_PUBIN, '-', "Input is an RSA public"}, {"certin", OPT_CERTIN, '-', "Input is a cert carrying an RSA public key"}, {"ssl", OPT_SSL, '-', "Use SSL v2 padding"}, @@ -137,7 +137,7 @@ int rsautl_main(int argc, char **argv) ret = 0; goto end; case OPT_KEYFORM: - if (!opt_format(opt_arg(), OPT_FMT_PEMDER, &keyformat)) + if (!opt_format(opt_arg(), OPT_FMT_PDE, &keyformat)) goto opthelp; break; case OPT_IN: @@ -262,7 +262,7 @@ int rsautl_main(int argc, char **argv) /* Read the input data */ rsa_inlen = BIO_read(in, rsa_in, keysize * 2); - if (rsa_inlen <= 0) { + if (rsa_inlen < 0) { BIO_printf(bio_err, "Error reading input Data\n"); goto end; } @@ -294,10 +294,9 @@ int rsautl_main(int argc, char **argv) rsa_outlen = RSA_private_decrypt(rsa_inlen, rsa_in, rsa_out, rsa, pad); break; - } - if (rsa_outlen <= 0) { + if (rsa_outlen < 0) { BIO_printf(bio_err, "RSA operation error\n"); ERR_print_errors(bio_err); goto end; |