]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
OpenSSL: Fix a memory leak in CMAC
authorJouni Malinen <quic_jouni@quicinc.com>
Wed, 27 Mar 2024 18:35:25 +0000 (20:35 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 27 Mar 2024 18:35:25 +0000 (20:35 +0200)
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: 0c61f6234fd2 ("OpenSSL: Implement CMAC using the EVP_MAC API")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/crypto/crypto_openssl.c

index 07455d91fdc23db87c6acb99d8442a1798ac5071..2d8ff60aa92dab0eb50c7b1f21dc4b5b9728fbbe 100644 (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;