From 1dae37b163e1e08e719ac06fa86b3414b4ddfb2b Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Mon, 30 Oct 2023 11:56:48 +0000 Subject: automatic import of edk2 --- ...-Tcg-Import-Tcg2PlatformPei-from-edk2-pla.patch | 191 +++++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 0017-SecurityPkg-Tcg-Import-Tcg2PlatformPei-from-edk2-pla.patch (limited to '0017-SecurityPkg-Tcg-Import-Tcg2PlatformPei-from-edk2-pla.patch') diff --git a/0017-SecurityPkg-Tcg-Import-Tcg2PlatformPei-from-edk2-pla.patch b/0017-SecurityPkg-Tcg-Import-Tcg2PlatformPei-from-edk2-pla.patch new file mode 100644 index 0000000..38acd0e --- /dev/null +++ b/0017-SecurityPkg-Tcg-Import-Tcg2PlatformPei-from-edk2-pla.patch @@ -0,0 +1,191 @@ +From ede5db34ee1e35c16cf016b974046b1c499c19a6 Mon Sep 17 00:00:00 2001 +From: Stefan Berger +Date: Mon, 13 Sep 2021 22:21:03 +0800 +Subject: [PATCH 6/8] SecurityPkg/Tcg: Import Tcg2PlatformPei from + edk2-platforms + +Import Tcg2PlatformPei from edk2-platforms without any modifications. + +Signed-off-by: Stefan Berger +Reviewed-by: Jiewen Yao +--- + .../Tcg/Tcg2PlatformPei/Tcg2PlatformPei.c | 107 ++++++++++++++++++ + .../Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf | 52 +++++++++ + 2 files changed, 159 insertions(+) + create mode 100644 SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.c + create mode 100644 SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf + +diff --git a/SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.c b/SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.c +new file mode 100644 +index 0000000000..66ec75ad0e +--- /dev/null ++++ b/SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.c +@@ -0,0 +1,107 @@ ++/** @file ++ ++Copyright (c) 2017, Intel Corporation. All rights reserved.
++Copyright (c) Microsoft Corporation.
++SPDX-License-Identifier: BSD-2-Clause-Patent ++ ++**/ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#define MAX_NEW_AUTHORIZATION_SIZE SHA512_DIGEST_SIZE ++ ++/** ++ This function handles PlatformInit task at the end of PEI ++ ++ @param[in] PeiServices Pointer to PEI Services Table. ++ @param[in] NotifyDesc Pointer to the descriptor for the Notification event that ++ caused this function to execute. ++ @param[in] Ppi Pointer to the PPI data associated with this function. ++ ++ @retval EFI_SUCCESS The function completes successfully ++ @retval others ++**/ ++EFI_STATUS ++EFIAPI ++PlatformInitEndOfPei ( ++ IN CONST EFI_PEI_SERVICES **PeiServices, ++ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, ++ IN VOID *Ppi ++ ) ++{ ++ VOID *TcgEventLog; ++ ++ // ++ // Try to get TcgEventLog in S3 to see if S3 error is reported. ++ // ++ TcgEventLog = GetFirstGuidHob(&gTcgEventEntryHobGuid); ++ if (TcgEventLog == NULL) { ++ TcgEventLog = GetFirstGuidHob(&gTcgEvent2EntryHobGuid); ++ } ++ ++ if (TcgEventLog == NULL) { ++ // ++ // no S3 error reported ++ // ++ return EFI_SUCCESS; ++ } ++ ++ // ++ // If there is S3 error on TPM_SU_STATE and success on TPM_SU_CLEAR, ++ // configure the TPM Platform Hierarchy. ++ // ++ ConfigureTpmPlatformHierarchy (); ++ ++ return EFI_SUCCESS; ++} ++ ++static EFI_PEI_NOTIFY_DESCRIPTOR mEndOfPeiNotifyList = { ++ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), ++ &gEfiEndOfPeiSignalPpiGuid, ++ (EFI_PEIM_NOTIFY_ENTRY_POINT)PlatformInitEndOfPei ++}; ++ ++/** ++ Main entry ++ ++ @param[in] FileHandle Handle of the file being invoked. ++ @param[in] PeiServices Pointer to PEI Services table. ++ ++ @retval EFI_SUCCESS Install function successfully. ++ ++**/ ++EFI_STATUS ++EFIAPI ++Tcg2PlatformPeiEntryPoint ( ++ IN EFI_PEI_FILE_HANDLE FileHandle, ++ IN CONST EFI_PEI_SERVICES **PeiServices ++ ) ++{ ++ EFI_STATUS Status; ++ EFI_BOOT_MODE BootMode; ++ ++ Status = PeiServicesGetBootMode (&BootMode); ++ ASSERT_EFI_ERROR(Status); ++ ++ if (BootMode != BOOT_ON_S3_RESUME) { ++ return EFI_SUCCESS; ++ } ++ ++ // ++ // Performing PlatformInitEndOfPei after EndOfPei PPI produced ++ // ++ Status = PeiServicesNotifyPpi (&mEndOfPeiNotifyList); ++ ++ return Status; ++} +diff --git a/SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf b/SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf +new file mode 100644 +index 0000000000..579f09b940 +--- /dev/null ++++ b/SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf +@@ -0,0 +1,52 @@ ++### @file ++# ++# Copyright (c) 2017, Intel Corporation. All rights reserved.
++# ++# SPDX-License-Identifier: BSD-2-Clause-Patent ++# ++### ++ ++[Defines] ++ INF_VERSION = 0x00010017 ++ BASE_NAME = Tcg2PlatformPei ++ FILE_GUID = 47727552-A54B-4A84-8CC1-BFF23E239636 ++ VERSION_STRING = 1.0 ++ MODULE_TYPE = PEIM ++ ENTRY_POINT = Tcg2PlatformPeiEntryPoint ++ ++# ++# The following information is for reference only and not required by the build tools. ++# ++# VALID_ARCHITECTURES = IA32 X64 IPF EBC ++# ++ ++[LibraryClasses] ++ PcdLib ++ BaseMemoryLib ++ MemoryAllocationLib ++ PeiServicesLib ++ PeimEntryPoint ++ DebugLib ++ Tpm2DeviceLib ++ Tpm2CommandLib ++ TpmPlatformHierarchyLib ++ RngLib ++ ++[Packages] ++ MdePkg/MdePkg.dec ++ SecurityPkg/SecurityPkg.dec ++ MinPlatformPkg/MinPlatformPkg.dec ++ ++[Sources] ++ Tcg2PlatformPei.c ++ ++[Guids] ++ gTcgEventEntryHobGuid ++ gTcgEvent2EntryHobGuid ++ ++[Ppis] ++ gEfiEndOfPeiSignalPpiGuid ++ ++[Depex] ++ gEfiTpmDeviceSelectedGuid ++ +-- +2.27.0 + -- cgit v1.2.3