F-13530 - Guard the encrypted salt zeroization against a NULL buffer

pull/604/head
Aidan Garske 2026-09-10 11:35:17 -07:00
parent 022fe8409d
commit d679f5bec5
1 changed files with 6 additions and 0 deletions

View File

@ -10596,7 +10596,13 @@ static TPM_RC FwCmd_StartAuthSession(FWTPM_CTX* ctx, TPM2_Packet* cmd,
FwFreeSession(sess);
}
TPM2_ForceZero(salt, sizeof(salt));
#ifdef WOLFTPM_SMALL_STACK
if (encSalt != NULL) {
TPM2_ForceZero(encSalt, FWTPM_MAX_PUB_BUF);
}
#else
TPM2_ForceZero(encSalt, FWTPM_MAX_PUB_BUF);
#endif
FWTPM_FREE_BUF(encSalt);
return rc;
}