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

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