OpenSSL: Fix a memory leak in CMAC

The OpenSSL 3.0 (or newer) version of omac1_aes_vector() did not free
the EVP_MAC. This resulted in a memory leak that shows up in a bit
strange way in valgrind reports and because of that, was not caught
during automated testing.

Fixes: 0c61f6234f ("OpenSSL: Implement CMAC using the EVP_MAC API")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2024-03-27 20:35:25 +02:00 committed by Jouni Malinen
parent 4bc61b6577
commit a9bc6e89df

View file

@ -1835,6 +1835,7 @@ int omac1_aes_vector(const u8 *key, size_t key_len, size_t num_elem,
ret = 0;
fail:
EVP_MAC_CTX_free(ctx);
EVP_MAC_free(emac);
return ret;
#else /* OpenSSL version >= 3.0 */
CMAC_CTX *ctx;