SecurityPkg: Tcg2Smm: Make TCG2 PP version configurable

Make TCG2 PP version configurable to meet different request. Current default version is 1.3.
http://www.trustedcomputinggroup.org/physical-presence-interface_1-30_0-52/

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
This commit is contained in:
Zhang, Chao B 2016-06-08 15:35:16 +08:00
parent 988715a3a7
commit cd64301398
5 changed files with 54 additions and 3 deletions

View File

@ -299,6 +299,10 @@
# @ValidList 0x80000003 | 0x010D0000
gEfiSecurityPkgTokenSpaceGuid.PcdStatusCodeSubClassTpmDevice|0x010D0000|UINT32|0x00000007
## Null-terminated string of the Version of Physical Presence interface supported by platform.
# @Prompt Version of Physical Presence interface supported by platform.
gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|"1.3"|VOID*|0x00000008
[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
## Indicates the presence or absence of the platform operator during firmware booting.
# If platform operator is not physical presence during boot. TPM will be locked and the TPM commands

View File

@ -250,6 +250,41 @@ AssignOpRegion (
return (VOID *) (UINTN) MemoryAddress;
}
/**
Patch version string of Physical Presence interface supported by platform. The initial string tag in TPM
ACPI table is "$PV".
@param[in, out] Table The TPM item in ACPI table.
@param[in] PPVer Version string of Physical Presence interface supported by platform.
@return The allocated address for the found region.
**/
EFI_STATUS
UpdatePPVersion (
EFI_ACPI_DESCRIPTION_HEADER *Table,
CHAR8 *PPVer
)
{
EFI_STATUS Status;
UINT8 *DataPtr;
//
// Patch some pointers for the ASL code before loading the SSDT.
//
for (DataPtr = (UINT8 *)(Table + 1);
DataPtr <= (UINT8 *) ((UINT8 *) Table + Table->Length - PHYSICAL_PRESENCE_VERSION_SIZE);
DataPtr += 1) {
if (AsciiStrCmp(DataPtr, PHYSICAL_PRESENCE_VERSION_TAG) == 0) {
Status = AsciiStrCpyS(DataPtr, PHYSICAL_PRESENCE_VERSION_SIZE, PPVer);
DEBUG((EFI_D_INFO, "TPM2 Physical Presence Interface Version update status 0x%x\n", Status));
return Status;
}
}
return EFI_NOT_FOUND;
}
/**
Initialize and publish TPM items in ACPI table.
@ -277,6 +312,11 @@ PublishAcpiTable (
);
ASSERT_EFI_ERROR (Status);
//
// Update Table version before measuring it to PCR
//
Status = UpdatePPVersion(Table, (CHAR8 *)PcdGetPtr(PcdTcgPhysicalPresenceInterfaceVer));
ASSERT_EFI_ERROR (Status);
//
// Measure to PCR[0] with event EV_POST_CODE ACPI DATA
@ -297,7 +337,7 @@ PublishAcpiTable (
ASSERT (mTcgNvs != NULL);
//
// Publish the TPM ACPI table
// Publish the TPM ACPI table. Table is re-checksumed.
//
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTable);
ASSERT_EFI_ERROR (Status);

View File

@ -87,4 +87,10 @@ typedef struct {
#define MOR_REQUEST_SUCCESS 0
#define MOR_REQUEST_GENERAL_FAILURE 1
//
// Physical Presence Interface Version supported by Platform
//
#define PHYSICAL_PRESENCE_VERSION_TAG "$PV"
#define PHYSICAL_PRESENCE_VERSION_SIZE 4
#endif // __TCG_SMM_H__

View File

@ -72,6 +72,7 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId ## SOMETIMES_CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision ## SOMETIMES_CONSUMES
gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress ## CONSUMES
gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer ## CONSUMES
[Depex]
gEfiAcpiTableProtocolGuid AND

View File

@ -2,7 +2,7 @@
The TPM2 definition block in ACPI table for TCG2 physical presence
and MemoryClear.
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
(c)Copyright 2016 HP Development Company, L.P.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@ -188,7 +188,7 @@ DefinitionBlock (
//
// a) Get Physical Presence Interface Version
//
Return ("1.3")
Return ("$PV")
}
Case (2)
{