wolfcrypt: aes: gcm: streaming api: add missing wc_AesFree()

This commit is contained in:
Marco Oliverio
2021-12-29 14:43:12 +01:00
parent 4907696ed4
commit ea5374c62d

View File

@ -9415,6 +9415,10 @@ int wc_AesGcmDecryptFinal(Aes* aes, const byte* authTag, word32 authTagSz)
} }
} }
/* reset the state */
if (ret == 0)
wc_AesFree(aes);
return ret; return ret;
} }
#endif /* HAVE_AES_DECRYPT || HAVE_AESGCM_DECRYPT */ #endif /* HAVE_AES_DECRYPT || HAVE_AESGCM_DECRYPT */
@ -10384,6 +10388,7 @@ void wc_AesFree(Aes* aes)
!defined(WOLFSSL_AESNI) !defined(WOLFSSL_AESNI)
if (aes->streamData != NULL) { if (aes->streamData != NULL) {
XFREE(aes->streamData, aes->heap, DYNAMIC_TYPE_AES); XFREE(aes->streamData, aes->heap, DYNAMIC_TYPE_AES);
aes->streamData = NULL;
} }
#endif #endif