Fall-back TPM2 measurement if it fails with PE_COFF_IMAGE flag

Signed-off-by: Tamas K Lengyel <lengyelt@ainfosec.com>
This commit is contained in:
Tamas K Lengyel 2017-11-08 15:44:56 -07:00 committed by Peter Jones
parent ba06a4362d
commit 571bfc95a6

7
tpm.c
View File

@ -195,12 +195,15 @@ static EFI_STATUS tpm_log_event_raw(EFI_PHYSICAL_ADDRESS buf, UINTN size,
CopyMem(event->Event, (VOID *)log, logsize);
if (hash) {
/* TPM 2 systems will generate the appropriate hash
themselves if we pass PE_COFF_IMAGE
themselves if we pass PE_COFF_IMAGE. In case that
fails we fall back to measuring without it.
*/
status = uefi_call_wrapper(tpm2->hash_log_extend_event,
5, tpm2, PE_COFF_IMAGE, buf,
(UINT64) size, event);
} else {
}
if (!hash || EFI_ERROR(status)) {
status = uefi_call_wrapper(tpm2->hash_log_extend_event,
5, tpm2, 0, buf,
(UINT64) size, event);