Skip to content

Commit 001939d

Browse files
committed
Call ForceZero on sensitive buffers
1 parent c2d44b4 commit 001939d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

wolfcrypt/src/pwdbased.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,13 +550,19 @@ int wc_PKCS12_PBKDF_ex(byte* output, const byte* passwd, int passLen,
550550
#ifdef WOLFSSL_SMALL_STACK
551551
out:
552552

553+
ForceZero(Ai, WC_MAX_DIGEST_SIZE);
553554
XFREE(Ai, heap, DYNAMIC_TYPE_TMP_BUFFER);
555+
ForceZero(B, WC_MAX_BLOCK_SIZE);
554556
XFREE(B, heap, DYNAMIC_TYPE_TMP_BUFFER);
555557
XFREE(B1, heap, DYNAMIC_TYPE_TMP_BUFFER);
556558
XFREE(i1, heap, DYNAMIC_TYPE_TMP_BUFFER);
557559
XFREE(res, heap, DYNAMIC_TYPE_TMP_BUFFER);
560+
#else
561+
ForceZero(Ai, WC_MAX_DIGEST_SIZE);
562+
ForceZero(B, WC_MAX_BLOCK_SIZE);
558563
#endif
559564

565+
ForceZero(buffer, totalLen);
560566
if (dynamic)
561567
XFREE(buffer, heap, DYNAMIC_TYPE_KEY);
562568

0 commit comments

Comments
 (0)