diff options
author | Matt Caswell <matt@openssl.org> | 2022-09-29 12:08:49 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2022-10-03 15:01:12 +0100 |
commit | f817a7439eaa705429cf699dd0485e665b0ffc49 (patch) | |
tree | 3a565012d449d707affffd711ae912446f4715f1 /crypto/evp | |
parent | 25d47cccf203c3b71171e78865e48ea061a039a8 (diff) |
Ensure we call the cleanup() function when cleaning an EVP_CIPHER_CTX
In some circumstances we were not calling the cleanup() function to
remove cipher specific data from an EVP_CIPHER_CTX.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19300)
Diffstat (limited to 'crypto/evp')
-rw-r--r-- | crypto/evp/evp_enc.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c index c1f5d2ca54..77dc815dd9 100644 --- a/crypto/evp/evp_enc.c +++ b/crypto/evp/evp_enc.c @@ -159,6 +159,8 @@ static int evp_cipher_init_internal(EVP_CIPHER_CTX *ctx, * (legacy code) */ if (cipher != NULL && ctx->cipher != NULL) { + if (ctx->cipher->cleanup != NULL && !ctx->cipher->cleanup(ctx)) + return 0; OPENSSL_clear_free(ctx->cipher_data, ctx->cipher->ctx_size); ctx->cipher_data = NULL; } |