Skip to content

Commit 3e39a5c

Browse files
committed
pwdbased: add missing ForceZero for blocks, v, y.
1 parent 36328e3 commit 3e39a5c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

wolfcrypt/src/pwdbased.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,16 @@ int wc_scrypt(byte* output, const byte* passwd, int passLen,
830830
ret = wc_PBKDF2(output, passwd, passLen, blocks, (int)blocksSz, 1, dkLen,
831831
WC_SHA256);
832832
end:
833+
if (blocks != NULL) {
834+
ForceZero(blocks, blocksSz);
835+
}
836+
if (v != NULL) {
837+
ForceZero(v, ((size_t)1 << cost) * (size_t)bSz);
838+
}
839+
if (y != NULL) {
840+
ForceZero(y, (size_t)(blockSize * 128));
841+
}
842+
833843
XFREE(blocks, NULL, DYNAMIC_TYPE_TMP_BUFFER);
834844
XFREE(v, NULL, DYNAMIC_TYPE_TMP_BUFFER);
835845
XFREE(y, NULL, DYNAMIC_TYPE_TMP_BUFFER);

0 commit comments

Comments
 (0)