Skip to content

Commit 7a26416

Browse files
committed
wc_ChaCha20Poly1305_Decrypt: clear unauthed plaintext
F-452
1 parent 0b03d56 commit 7a26416

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

wolfcrypt/src/chacha20_poly1305.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ int wc_ChaCha20Poly1305_Decrypt(
119119
if (ret == 0)
120120
ret = wc_ChaCha20Poly1305_CheckTag(inAuthTag, calculatedAuthTag);
121121

122+
if (ret != 0) {
123+
/* zero plaintext on error */
124+
ForceZero(outPlaintext, inCiphertextLen);
125+
}
122126
WC_FREE_VAR_EX(aead, NULL, DYNAMIC_TYPE_TMP_BUFFER);
123127

124128
return ret;

0 commit comments

Comments
 (0)