summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2019-08-05 13:37:05 +0100
committerMatt Caswell <matt@openssl.org>2019-08-07 11:40:32 +0100
commit7f612b1f04ee0cf72d6af292a76f43dd74e88af9 (patch)
treeab313fbc6d9969295913c9f2c0dc1489eac04028 /crypto
parente9c116ebcbaf6a0d089a2f8d615eee5be69ab66a (diff)
Don't set ctx->cipher until after a successful fetch
If an implict EVP_CIPHER_fetch fails then ctx->cipher should not be set otherwise strange things will happen when trying to free the ctx. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/9531)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/evp/evp_enc.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c
index 87c7bb0995..31e15a63c2 100644
--- a/crypto/evp/evp_enc.c
+++ b/crypto/evp/evp_enc.c
@@ -197,9 +197,7 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
ctx->flags = flags;
}
- if (cipher != NULL)
- ctx->cipher = cipher;
- else
+ if (cipher == NULL)
cipher = ctx->cipher;
if (cipher->prov == NULL) {