From: Kurt Roeckx Date: Sun, 29 Oct 2017 14:13:43 +0000 (+0100) Subject: Only reset the ctx when a cipher is given X-Git-Tag: OpenSSL_1_1_1-pre1~496 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ffd23209933ea0ad5543f15ca6303d63d8dac826;p=oweals%2Fopenssl.git Only reset the ctx when a cipher is given This restores the 1.0.2 behaviour Reviewed-by: Rich Salz Reviewed-by: Benjamin Kaduk GH: #4613 --- 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); }