Skip to content

Commit 61731ca

Browse files
committed
Zeroize PolicySign key buffer before free
F/2278
1 parent 877ffea commit 61731ca

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tools/tpm/policy_sign.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,10 @@ static int PolicySign(int alg, const char* keyFile, byte* hash, word32 hashSz,
159159
rc = BAD_FUNC_ARG;
160160
}
161161

162-
XFREE(buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
162+
if (buf != NULL) {
163+
wc_ForceZero(buf, bufSz);
164+
XFREE(buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
165+
}
163166
wc_FreeRng(&rng);
164167

165168
if (rc != 0) {

0 commit comments

Comments
 (0)