From 0a8f7ade76ff3eede486027eaa638181e6bed3b8 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 18 Feb 2020 12:03:17 +0100 Subject: tpm: Include information about PE/COFF images in the TPM Event Log The "TCG PC Client Specific Platform Firmware Profile Specification" says that when measuring a PE/COFF image, the TCG_PCR_EVENT2 structure Event field MUST contain a UEFI_IMAGE_LOAD_EVENT structure. Currently an empty UEFI_IMAGE_LOAD_EVENT structure is passed so users only have the hash of the PE/COFF image, but not information such the file path of the binary. Signed-off-by: Javier Martinez Canillas Upstream-commit-id: c252b9ee94c --- shim.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'shim.c') diff --git a/shim.c b/shim.c index a4f7769b..b35b0ad9 100644 --- a/shim.c +++ b/shim.c @@ -1274,7 +1274,9 @@ static EFI_STATUS handle_image (void *data, unsigned int datasize, #ifdef REQUIRE_TPM efi_status = #endif - tpm_log_pe((EFI_PHYSICAL_ADDRESS)(UINTN)data, datasize, sha1hash, 4); + tpm_log_pe((EFI_PHYSICAL_ADDRESS)(UINTN)data, datasize, + (EFI_PHYSICAL_ADDRESS)(UINTN)context.ImageAddress, + li->FilePath, sha1hash, 4); #ifdef REQUIRE_TPM if (efi_status != EFI_SUCCESS) { return efi_status; @@ -1788,7 +1790,8 @@ EFI_STATUS shim_verify (void *buffer, UINT32 size) #ifdef REQUIRE_TPM efi_status = #endif - tpm_log_pe((EFI_PHYSICAL_ADDRESS)(UINTN)buffer, size, sha1hash, 4); + tpm_log_pe((EFI_PHYSICAL_ADDRESS)(UINTN)buffer, size, 0, NULL, + sha1hash, 4); #ifdef REQUIRE_TPM if (EFI_ERROR(efi_status)) goto done; -- cgit v1.2.3