diff options
author | Jiewen Yao <jiewen.yao@intel.com> | 2019-12-31 09:47:11 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2020-01-06 06:23:19 +0000 |
commit | 40801ac995c2153331eb3ea1ad658556849d3bae (patch) | |
tree | dc358a2012846518ba2713361b916210c5a7176f | |
parent | 166830d8f7cad21886f7bf4c65a3dcc66b530be5 (diff) | |
download | edk2-40801ac995c2153331eb3ea1ad658556849d3bae.tar.gz edk2-40801ac995c2153331eb3ea1ad658556849d3bae.tar.bz2 edk2-40801ac995c2153331eb3ea1ad658556849d3bae.zip |
MdeModulePkg/Smbios: Add TCG PFP rev 105 support.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2439
Report EV_EFI_HANDOFF_TABLES2 if the platform chooses PFP >= 105.
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
-rw-r--r-- | MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.c | 38 | ||||
-rw-r--r-- | MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.inf | 6 |
2 files changed, 39 insertions, 5 deletions
diff --git a/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.c b/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.c index 5ec2aca095..1050c9b17b 100644 --- a/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.c +++ b/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.c @@ -1,7 +1,7 @@ /** @file
This driver measures SMBIOS table to TPM.
-Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -20,6 +20,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
+#include <Library/PcdLib.h>
#include <Library/TpmMeasurementLib.h>
#define FIELD_SIZE_OF(TYPE, Field) ((UINTN)sizeof(((TYPE *)0)->Field))
@@ -108,6 +109,18 @@ SMBIOS_FILTER_STRUCT mSmbiosFilterStandardTableBlackList[] = { EFI_SMBIOS_PROTOCOL *mSmbios;
UINTN mMaxLen;
+#pragma pack (1)
+
+#define SMBIOS_HANDOFF_TABLE_DESC "SmbiosTable"
+typedef struct {
+ UINT8 TableDescriptionSize;
+ UINT8 TableDescription[sizeof(SMBIOS_HANDOFF_TABLE_DESC)];
+ UINT64 NumberOfTables;
+ EFI_CONFIGURATION_TABLE TableEntry[1];
+} SMBIOS_HANDOFF_TABLE_POINTERS2;
+
+#pragma pack ()
+
/**
This function dump raw data.
@@ -460,6 +473,10 @@ MeasureSmbiosTable ( {
EFI_STATUS Status;
EFI_HANDOFF_TABLE_POINTERS HandoffTables;
+ SMBIOS_HANDOFF_TABLE_POINTERS2 SmbiosHandoffTables2;
+ UINT32 EventType;
+ VOID *EventLog;
+ UINT32 EventLogSize;
SMBIOS_TABLE_ENTRY_POINT *SmbiosTable;
SMBIOS_TABLE_3_0_ENTRY_POINT *Smbios3Table;
VOID *SmbiosTableAddress;
@@ -569,11 +586,24 @@ MeasureSmbiosTable ( CopyGuid (&(HandoffTables.TableEntry[0].VendorGuid), &gEfiSmbiosTableGuid);
HandoffTables.TableEntry[0].VendorTable = SmbiosTable;
}
+ EventType = EV_EFI_HANDOFF_TABLES;
+ EventLog = &HandoffTables;
+ EventLogSize = sizeof (HandoffTables);
+
+ if (PcdGet32(PcdTcgPfpMeasurementRevision) >= TCG_EfiSpecIDEventStruct_SPEC_ERRATA_TPM2_REV_105) {
+ SmbiosHandoffTables2.TableDescriptionSize = sizeof(SmbiosHandoffTables2.TableDescription);
+ CopyMem (SmbiosHandoffTables2.TableDescription, SMBIOS_HANDOFF_TABLE_DESC, sizeof(SmbiosHandoffTables2.TableDescription));
+ SmbiosHandoffTables2.NumberOfTables = HandoffTables.NumberOfTables;
+ CopyMem (&(SmbiosHandoffTables2.TableEntry[0]), &(HandoffTables.TableEntry[0]), sizeof(SmbiosHandoffTables2.TableEntry[0]));
+ EventType = EV_EFI_HANDOFF_TABLES2;
+ EventLog = &SmbiosHandoffTables2;
+ EventLogSize = sizeof (SmbiosHandoffTables2);
+ }
Status = TpmMeasureAndLogData (
1, // PCRIndex
- EV_EFI_HANDOFF_TABLES, // EventType
- &HandoffTables, // EventLog
- sizeof (HandoffTables), // LogLen
+ EventType, // EventType
+ EventLog, // EventLog
+ EventLogSize, // LogLen
TableAddress, // HashData
TableLength // HashDataLen
);
diff --git a/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.inf b/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.inf index a074044c84..7537bfb519 100644 --- a/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.inf +++ b/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.inf @@ -11,7 +11,7 @@ #
# A platform may use its own policy to filter some fields in SMBIOS table.
#
-# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -48,6 +48,7 @@ UefiLib
UefiDriverEntryPoint
DebugLib
+ PcdLib
TpmMeasurementLib
[Protocols]
@@ -57,6 +58,9 @@ gEfiSmbiosTableGuid ## SOMETIMES_CONSUMES ## SystemTable
gEfiSmbios3TableGuid ## SOMETIMES_CONSUMES ## SystemTable
+[Pcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdTcgPfpMeasurementRevision ## CONSUMES
+
[Depex]
gEfiSmbiosProtocolGuid
|