OpenSSL: Use a correct EVP_CIPHER_CTX freeing function on an error path

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>
This commit is contained in:
Jouni Malinen 2022-04-09 20:42:36 +03:00
parent 658296ea5b
commit 7e4984d9ca

View 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);