diff options
author | Viktor Dukhovni <openssl-users@dukhovni.org> | 2016-02-01 23:37:42 -0500 |
---|---|---|
committer | Viktor Dukhovni <openssl-users@dukhovni.org> | 2016-02-02 12:41:33 -0500 |
commit | 5df0bde60ebf2718d5aef18c4a9fdfd230928981 (patch) | |
tree | 443df2f90bc1ac3a45a927e5d7330daf4b2f1aea /apps/apps.c | |
parent | a2bab12a331b6764804913d08e2e472c9e5d13ae (diff) | |
download | openssl-5df0bde60ebf2718d5aef18c4a9fdfd230928981.tar.gz |
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.
RT2018
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'apps/apps.c')
-rw-r--r-- | apps/apps.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/apps.c b/apps/apps.c index 2e778054ca..b1dd97038f 100644 --- a/apps/apps.c +++ b/apps/apps.c @@ -2442,7 +2442,11 @@ int bio_to_mem(unsigned char **out, int maxlen, BIO *in) else len = 1024; len = BIO_read(in, tbuf, len); - if (len <= 0) + if (len < 0) { + BIO_free(mem); + return -1; + } + if (len == 0) break; if (BIO_write(mem, tbuf, len) != len) { BIO_free(mem); @@ -2459,7 +2463,7 @@ int bio_to_mem(unsigned char **out, int maxlen, BIO *in) return ret; } -int pkey_ctrl_string(EVP_PKEY_CTX *ctx, char *value) +int pkey_ctrl_string(EVP_PKEY_CTX *ctx, const char *value) { int rv; char *stmp, *vtmp = NULL; |