]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
OpenSSL: Use a correct EVP_CIPHER_CTX freeing function on an error path
authorJouni Malinen <j@w1.fi>
Sat, 9 Apr 2022 17:42:36 +0000 (20:42 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 9 Apr 2022 17:42:36 +0000 (20:42 +0300)
aes_encrypt_init() used incorrect function to free the EVP_CIPHER_CTX
allocated within this function. Fix that to use the OpenSSL function for
freeing the context.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/crypto/crypto_openssl.c

index 4b4b57d07717f28b20763fbdf944e8bf03ed9197..1795c73f98df145d02adccdbe93045adc6e99e04 100644 (file)
@@ -412,7 +412,7 @@ void * aes_encrypt_init(const u8 *key, size_t len)
        if (ctx == NULL)
                return NULL;
        if (EVP_EncryptInit_ex(ctx, type, NULL, key, NULL) != 1) {
-               os_free(ctx);
+               EVP_CIPHER_CTX_free(ctx);
                return NULL;
        }
        EVP_CIPHER_CTX_set_padding(ctx, 0);