Zero out the aead in wc_ChaCha20Poly1305_Encrypt/Decrypt before freeing it.

Fixes F-4023.
This commit is contained in:
Kareem
2026-06-12 12:21:02 -07:00
parent c677768375
commit 511f6e1bf0
+2
View File
@@ -75,6 +75,7 @@ int wc_ChaCha20Poly1305_Encrypt(
if (ret == 0)
ret = wc_ChaCha20Poly1305_Final(aead, outAuthTag);
ForceZero(aead, sizeof(ChaChaPoly_Aead));
WC_FREE_VAR_EX(aead, NULL, DYNAMIC_TYPE_TMP_BUFFER);
return ret;
@@ -123,6 +124,7 @@ int wc_ChaCha20Poly1305_Decrypt(
/* zero plaintext on error */
ForceZero(outPlaintext, inCiphertextLen);
}
ForceZero(aead, sizeof(ChaChaPoly_Aead));
WC_FREE_VAR_EX(aead, NULL, DYNAMIC_TYPE_TMP_BUFFER);
return ret;