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>
This commit is contained in:
Jiewen Yao 2019-12-31 09:47:11 +08:00 committed by mergify[bot]
parent 166830d8f7
commit 40801ac995
2 changed files with 39 additions and 5 deletions

View File

@ -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
);

View File

@ -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