aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKurt Roeckx <kurt@roeckx.be>2017-10-29 15:13:43 +0100
committerKurt Roeckx <kurt@roeckx.be>2017-10-30 22:50:17 +0100
commitffd23209933ea0ad5543f15ca6303d63d8dac826 (patch)
tree372c5ccd5269a28486c3c7702e8dfb771c28238a
parent79204b9cd7bbaaf524de9bc83d96e2d320d7538c (diff)
downloadopenssl-ffd23209933ea0ad5543f15ca6303d63d8dac826.tar.gz
Only reset the ctx when a cipher is given
This restores the 1.0.2 behaviour Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Benjamin Kaduk <bkaduk@akamai.com> GH: #4613
-rw-r--r--crypto/evp/evp_enc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c
index d353084a9a..f89cff6f60 100644
--- a/crypto/evp/evp_enc.c
+++ b/crypto/evp/evp_enc.c
@@ -50,7 +50,8 @@ void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx)
int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
const unsigned char *key, const unsigned char *iv, int enc)
{
- EVP_CIPHER_CTX_reset(ctx);
+ if (cipher != NULL)
+ EVP_CIPHER_CTX_reset(ctx);
return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, enc);
}