Skip to content

Commit 3736352

Browse files
authored
Merge pull request #9888 from philljj/fix_f_383
pwdbased: add missing ForceZero for blocks, v, y.
2 parents 8f485a5 + 7726f5c commit 3736352

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)