diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2024-01-28 20:57:16 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2024-01-28 20:57:16 +0000 |
commit | 8915bf7694bc0661f023b4d99d287f6492fab594 (patch) | |
tree | 942800ffd042b7bafaa67e14f0ffeac485c5c810 /lib | |
parent | 8a7b6b6004f3eb0b6a4209b412a5371526bc7e6d (diff) |
Avoid calling EVP_CIPHER_CTX_reset() on a NULL ctx
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libcrypto/cmac/cmac.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libcrypto/cmac/cmac.c b/lib/libcrypto/cmac/cmac.c index 29f5048897f..42f630c1499 100644 --- a/lib/libcrypto/cmac/cmac.c +++ b/lib/libcrypto/cmac/cmac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmac.c,v 1.19 2024/01/28 14:55:40 joshua Exp $ */ +/* $OpenBSD: cmac.c,v 1.20 2024/01/28 20:57:15 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ @@ -131,7 +131,8 @@ LCRYPTO_ALIAS(CMAC_CTX_new); void CMAC_CTX_cleanup(CMAC_CTX *ctx) { - EVP_CIPHER_CTX_reset(ctx->cipher_ctx); + if (ctx->cipher_ctx != NULL) + EVP_CIPHER_CTX_reset(ctx->cipher_ctx); explicit_bzero(ctx->tbl, EVP_MAX_BLOCK_LENGTH); explicit_bzero(ctx->k1, EVP_MAX_BLOCK_LENGTH); explicit_bzero(ctx->k2, EVP_MAX_BLOCK_LENGTH); |