From dba0ba5a07b30bbba0fa20578111c03377c6c08a Mon Sep 17 00:00:00 2001 From: Kareem Date: Mon, 15 Jun 2026 10:14:03 -0700 Subject: [PATCH] Code review feedback --- wolfcrypt/src/chacha20_poly1305.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/chacha20_poly1305.c b/wolfcrypt/src/chacha20_poly1305.c index f3ebb52ff9..2a8228adf4 100644 --- a/wolfcrypt/src/chacha20_poly1305.c +++ b/wolfcrypt/src/chacha20_poly1305.c @@ -74,8 +74,10 @@ int wc_ChaCha20Poly1305_Encrypt( inPlaintextLen); if (ret == 0) ret = wc_ChaCha20Poly1305_Final(aead, outAuthTag); - - ForceZero(aead, sizeof(ChaChaPoly_Aead)); + #ifdef WOLFSSL_SMALL_STACK + if (aead != NULL) + #endif + ForceZero(aead, sizeof(ChaChaPoly_Aead)); WC_FREE_VAR_EX(aead, NULL, DYNAMIC_TYPE_TMP_BUFFER); return ret;