Blame SOURCES/0026-Remove-call-to-TPM2-get_event_log.patch

d84fc6
From cf3f99c3b1e11c8c83938784975331db5efb410f Mon Sep 17 00:00:00 2001
d84fc6
From: Matthew Garrett <mjg59@google.com>
d84fc6
Date: Tue, 11 Dec 2018 15:25:44 -0800
d84fc6
Subject: [PATCH 26/62] Remove call to TPM2 get_event_log()
d84fc6
d84fc6
Calling the TPM2 get_event_log causes the firmware to start logging
d84fc6
events to the final events table, but implementations may also continue
d84fc6
logging to the boot services event log. Any OS that wishes to
d84fc6
reconstruct the full PCR state must already look at both the final
d84fc6
events log and the boot services event log, so if this call is made
d84fc6
anywhere other than immediately before ExitBootServices() then the OS
d84fc6
must deduplicate events that occur in both, complicating things
d84fc6
immensely.
d84fc6
d84fc6
Linux already has support for copying up the boot services event log
d84fc6
across the ExitBootServices() boundary, so there's no reason to make
d84fc6
this call. Remove it.
d84fc6
d84fc6
Signed-off-by: Matthew Garrett <mjg59@google.com>
d84fc6
Upstream-commit-id: fd7c3bd920b
d84fc6
---
d84fc6
 tpm.c | 46 ----------------------------------------------
d84fc6
 1 file changed, 46 deletions(-)
d84fc6
d84fc6
diff --git a/tpm.c b/tpm.c
d84fc6
index 674e69b715f..f07362c70bb 100644
d84fc6
--- a/tpm.c
d84fc6
+++ b/tpm.c
d84fc6
@@ -70,41 +70,6 @@ static BOOLEAN tpm2_present(EFI_TCG2_BOOT_SERVICE_CAPABILITY *caps,
d84fc6
 	return FALSE;
d84fc6
 }
d84fc6
 
d84fc6
-static inline EFI_TCG2_EVENT_LOG_BITMAP
d84fc6
-tpm2_get_supported_logs(efi_tpm2_protocol_t *tpm,
d84fc6
-			EFI_TCG2_BOOT_SERVICE_CAPABILITY *caps,
d84fc6
-			BOOLEAN old_caps)
d84fc6
-{
d84fc6
-	if (old_caps)
d84fc6
-		return ((TREE_BOOT_SERVICE_CAPABILITY *)caps)->SupportedEventLogs;
d84fc6
-
d84fc6
-	return caps->SupportedEventLogs;
d84fc6
-}
d84fc6
-
d84fc6
-/*
d84fc6
- * According to TCG EFI Protocol Specification for TPM 2.0 family,
d84fc6
- * all events generated after the invocation of EFI_TCG2_GET_EVENT_LOG
d84fc6
- * shall be stored in an instance of an EFI_CONFIGURATION_TABLE aka
d84fc6
- * EFI TCG 2.0 final events table. Hence, it is necessary to trigger the
d84fc6
- * internal switch through calling get_event_log() in order to allow
d84fc6
- * to retrieve the logs from OS runtime.
d84fc6
- */
d84fc6
-static EFI_STATUS trigger_tcg2_final_events_table(efi_tpm2_protocol_t *tpm2,
d84fc6
-						  EFI_TCG2_EVENT_LOG_BITMAP supported_logs)
d84fc6
-{
d84fc6
-	EFI_TCG2_EVENT_LOG_FORMAT log_fmt;
d84fc6
-	EFI_PHYSICAL_ADDRESS start;
d84fc6
-	EFI_PHYSICAL_ADDRESS end;
d84fc6
-	BOOLEAN truncated;
d84fc6
-
d84fc6
-	if (supported_logs & EFI_TCG2_EVENT_LOG_FORMAT_TCG_2)
d84fc6
-		log_fmt = EFI_TCG2_EVENT_LOG_FORMAT_TCG_2;
d84fc6
-	else
d84fc6
-		log_fmt = EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2;
d84fc6
-
d84fc6
-	return tpm2->get_event_log(tpm2, log_fmt, &start, &end, &truncated);
d84fc6
-}
d84fc6
-
d84fc6
 static EFI_STATUS tpm_locate_protocol(efi_tpm_protocol_t **tpm,
d84fc6
 				      efi_tpm2_protocol_t **tpm2,
d84fc6
 				      BOOLEAN *old_caps_p,
d84fc6
@@ -166,17 +131,6 @@ static EFI_STATUS tpm_log_event_raw(EFI_PHYSICAL_ADDRESS buf, UINTN size,
d84fc6
 #endif
d84fc6
 	} else if (tpm2) {
d84fc6
 		EFI_TCG2_EVENT *event;
d84fc6
-		EFI_TCG2_EVENT_LOG_BITMAP supported_logs;
d84fc6
-
d84fc6
-		supported_logs = tpm2_get_supported_logs(tpm2, &caps, old_caps);
d84fc6
-
d84fc6
-		efi_status = trigger_tcg2_final_events_table(tpm2,
d84fc6
-							     supported_logs);
d84fc6
-		if (EFI_ERROR(efi_status)) {
d84fc6
-			perror(L"Unable to trigger tcg2 final events table: %r\n",
d84fc6
-			       efi_status);
d84fc6
-			return efi_status;
d84fc6
-		}
d84fc6
 
d84fc6
 		event = AllocatePool(sizeof(*event) + logsize);
d84fc6
 		if (!event) {
d84fc6
-- 
d84fc6
2.26.2
d84fc6