summaryrefslogtreecommitdiffstats
path: root/crypto/evp
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:51:40 +0100
commit5a3d24ad5af3a2fee1d5381bda5329c07b6328d8 (patch)
tree3719e2fb1f345829767c3244539e2e622bf872cf /crypto/evp
parent257a03ccb5f395a23bbf63b6fcdd024081b114c7 (diff)
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 (cherry picked from commit ffd23209933ea0ad5543f15ca6303d63d8dac826)
Diffstat (limited to 'crypto/evp')
-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 f829e8dccd..5ea14cd1cd 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);
}