Blame SOURCES/0041-tpm-Don-t-log-duplicate-identical-events.patch

d1e1c8
From 58df8d745c6516818ba6ebfa8fe826702c1621a0 Mon Sep 17 00:00:00 2001
d1e1c8
From: Chris Coulson <chris.coulson@canonical.com>
d1e1c8
Date: Thu, 26 Sep 2019 20:01:01 +0100
d1e1c8
Subject: [PATCH 41/62] tpm: Don't log duplicate identical events
d1e1c8
d1e1c8
According to the comment in tpm_measure_variable ("Don't measure something that we've already measured"), shim
d1e1c8
shouldn't measure duplicate events if they are identical, which also aligns with section 2.3.4.8 of the TCG PC
d1e1c8
Client Platform Firmware Profile Specification ("If it has been measured previously, it MUST NOT be measured
d1e1c8
again"). This is currently broken because tpm_data_measured() uses the return value of CompareGuid() incorrectly.
d1e1c8
d1e1c8
Upstream-commit-id: 103adc89ce5
d1e1c8
---
d1e1c8
 tpm.c | 2 +-
d1e1c8
 1 file changed, 1 insertion(+), 1 deletion(-)
d1e1c8
d1e1c8
diff --git a/tpm.c b/tpm.c
d1e1c8
index c0617bb479e..196b93c30f6 100644
d1e1c8
--- a/tpm.c
d1e1c8
+++ b/tpm.c
d1e1c8
@@ -241,7 +241,7 @@ static BOOLEAN tpm_data_measured(CHAR16 *VarName, EFI_GUID VendorGuid, UINTN Var
d1e1c8
 
d1e1c8
 	for (i=0; i
d1e1c8
 		if ((StrCmp (VarName, measureddata[i].VariableName) == 0) &&
d1e1c8
-		    (CompareGuid (&VendorGuid, measureddata[i].VendorGuid)) &&
d1e1c8
+		    (CompareGuid (&VendorGuid, measureddata[i].VendorGuid) == 0) &&
d1e1c8
 		    (VarSize == measureddata[i].Size) &&
d1e1c8
 		    (CompareMem (VarData, measureddata[i].Data, VarSize) == 0)) {
d1e1c8
 			return TRUE;
d1e1c8
-- 
d1e1c8
2.26.2
d1e1c8