X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;ds=sidebyside;f=SecurityPkg%2FLibrary%2FDxeTpm2MeasureBootLib%2FDxeTpm2MeasureBootLib.c;h=f0e95e5ec01e3d28e15ba15ba535e704824ae08b;hb=fc70522ffea725cb23b6366c1a2611312e38accb;hp=a5d7fe5fa8f7a9e7bfdaf5e3cb257167b3939588;hpb=5c61c5cfc82c9d4757043c2c0ffccaf561893a5c;p=mirror_edk2.git diff --git a/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c b/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c index a5d7fe5fa8..f0e95e5ec0 100644 --- a/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c +++ b/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c @@ -9,33 +9,27 @@ DxeTpm2MeasureBootLibImageRead() function will make sure the PE/COFF image content read is within the image buffer. - TrEEMeasurePeImage() function will accept untrusted PE/COFF image and validate its + Tcg2MeasurePeImage() function will accept untrusted PE/COFF image and validate its data structure within this image buffer before use. - TrEEMeasureGptTable() function will receive untrusted GPT partition table, and parse + Tcg2MeasureGptTable() function will receive untrusted GPT partition table, and parse partition data carefully. -Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
+(C) Copyright 2015 Hewlett Packard Enterprise Development LP
+SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include -#include +#include #include #include #include #include #include -#include #include #include @@ -51,15 +45,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // // Flag to check GPT partition. It only need be measured once. // -BOOLEAN mTrEEMeasureGptTableFlag = FALSE; -UINTN mTrEEMeasureGptCount = 0; -VOID *mTrEEFileBuffer; -UINTN mTrEEImageSize; +BOOLEAN mTcg2MeasureGptTableFlag = FALSE; +UINTN mTcg2MeasureGptCount = 0; +VOID *mTcg2FileBuffer; +UINTN mTcg2ImageSize; // // Measured FV handle cache // -EFI_HANDLE mTrEECacheMeasuredHandle = NULL; -MEASURED_HOB_DATA *mTrEEMeasuredHobData = NULL; +EFI_HANDLE mTcg2CacheMeasuredHandle = NULL; +MEASURED_HOB_DATA *mTcg2MeasuredHobData = NULL; /** Reads contents of a PE/COFF image in memory buffer. @@ -70,11 +64,11 @@ MEASURED_HOB_DATA *mTrEEMeasuredHobData = NULL; @param FileHandle Pointer to the file handle to read the PE/COFF image. @param FileOffset Offset into the PE/COFF image to begin the read operation. - @param ReadSize On input, the size in bytes of the requested read operation. + @param ReadSize On input, the size in bytes of the requested read operation. On output, the number of bytes actually read. @param Buffer Output buffer that contains the data read from the PE/COFF image. - - @retval EFI_SUCCESS The specified portion of the PE/COFF image was read and the size + + @retval EFI_SUCCESS The specified portion of the PE/COFF image was read and the size **/ EFI_STATUS EFIAPI @@ -96,11 +90,11 @@ DxeTpm2MeasureBootLibImageRead ( } EndPosition = FileOffset + *ReadSize; - if (EndPosition > mTrEEImageSize) { - *ReadSize = (UINT32)(mTrEEImageSize - FileOffset); + if (EndPosition > mTcg2ImageSize) { + *ReadSize = (UINT32)(mTcg2ImageSize - FileOffset); } - if (FileOffset >= mTrEEImageSize) { + if (FileOffset >= mTcg2ImageSize) { *ReadSize = 0; } @@ -115,7 +109,7 @@ DxeTpm2MeasureBootLibImageRead ( Caution: This function may receive untrusted input. The GPT partition table is external input, so this function should parse partition data carefully. - @param TreeProtocol Pointer to the located TREE protocol instance. + @param Tcg2Protocol Pointer to the located TCG2 protocol instance. @param GptHandle Handle that GPT partition was installed. @retval EFI_SUCCESS Successfully measure GPT table. @@ -126,8 +120,8 @@ DxeTpm2MeasureBootLibImageRead ( **/ EFI_STATUS EFIAPI -TrEEMeasureGptTable ( - IN EFI_TREE_PROTOCOL *TreeProtocol, +Tcg2MeasureGptTable ( + IN EFI_TCG2_PROTOCOL *Tcg2Protocol, IN EFI_HANDLE GptHandle ) { @@ -139,11 +133,11 @@ TrEEMeasureGptTable ( UINT8 *EntryPtr; UINTN NumberOfPartition; UINT32 Index; - TrEE_EVENT *TreeEvent; + EFI_TCG2_EVENT *Tcg2Event; EFI_GPT_DATA *GptData; UINT32 EventSize; - if (mTrEEMeasureGptCount > 0) { + if (mTcg2MeasureGptCount > 0) { return EFI_SUCCESS; } @@ -157,11 +151,11 @@ TrEEMeasureGptTable ( } // // Read the EFI Partition Table Header - // + // PrimaryHeader = (EFI_PARTITION_TABLE_HEADER *) AllocatePool (BlockIo->Media->BlockSize); if (PrimaryHeader == NULL) { return EFI_OUT_OF_RESOURCES; - } + } Status = DiskIo->ReadDisk ( DiskIo, BlockIo->Media->MediaId, @@ -173,7 +167,7 @@ TrEEMeasureGptTable ( DEBUG ((EFI_D_ERROR, "Failed to Read Partition Table Header!\n")); FreePool (PrimaryHeader); return EFI_DEVICE_ERROR; - } + } // // Read the partition entry. // @@ -194,41 +188,41 @@ TrEEMeasureGptTable ( FreePool (EntryPtr); return EFI_DEVICE_ERROR; } - + // // Count the valid partition // PartitionEntry = (EFI_PARTITION_ENTRY *)EntryPtr; NumberOfPartition = 0; for (Index = 0; Index < PrimaryHeader->NumberOfPartitionEntries; Index++) { - if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &gZeroGuid)) { - NumberOfPartition++; + if (!IsZeroGuid (&PartitionEntry->PartitionTypeGUID)) { + NumberOfPartition++; } PartitionEntry = (EFI_PARTITION_ENTRY *)((UINT8 *)PartitionEntry + PrimaryHeader->SizeOfPartitionEntry); } // // Prepare Data for Measurement - // - EventSize = (UINT32)(sizeof (EFI_GPT_DATA) - sizeof (GptData->Partitions) + // + EventSize = (UINT32)(sizeof (EFI_GPT_DATA) - sizeof (GptData->Partitions) + NumberOfPartition * PrimaryHeader->SizeOfPartitionEntry); - TreeEvent = (TrEE_EVENT *) AllocateZeroPool (EventSize + sizeof (TrEE_EVENT) - sizeof(TreeEvent->Event)); - if (TreeEvent == NULL) { + Tcg2Event = (EFI_TCG2_EVENT *) AllocateZeroPool (EventSize + sizeof (EFI_TCG2_EVENT) - sizeof(Tcg2Event->Event)); + if (Tcg2Event == NULL) { FreePool (PrimaryHeader); FreePool (EntryPtr); return EFI_OUT_OF_RESOURCES; } - TreeEvent->Size = EventSize + sizeof (TrEE_EVENT) - sizeof(TreeEvent->Event); - TreeEvent->Header.HeaderSize = sizeof(TrEE_EVENT_HEADER); - TreeEvent->Header.HeaderVersion = TREE_EVENT_HEADER_VERSION; - TreeEvent->Header.PCRIndex = 5; - TreeEvent->Header.EventType = EV_EFI_GPT_EVENT; - GptData = (EFI_GPT_DATA *) TreeEvent->Event; + Tcg2Event->Size = EventSize + sizeof (EFI_TCG2_EVENT) - sizeof(Tcg2Event->Event); + Tcg2Event->Header.HeaderSize = sizeof(EFI_TCG2_EVENT_HEADER); + Tcg2Event->Header.HeaderVersion = EFI_TCG2_EVENT_HEADER_VERSION; + Tcg2Event->Header.PCRIndex = 5; + Tcg2Event->Header.EventType = EV_EFI_GPT_EVENT; + GptData = (EFI_GPT_DATA *) Tcg2Event->Event; // // Copy the EFI_PARTITION_TABLE_HEADER and NumberOfPartition - // + // CopyMem ((UINT8 *)GptData, (UINT8*)PrimaryHeader, sizeof (EFI_PARTITION_TABLE_HEADER)); GptData->NumberOfPartitions = NumberOfPartition; // @@ -237,7 +231,7 @@ TrEEMeasureGptTable ( PartitionEntry = (EFI_PARTITION_ENTRY*)EntryPtr; NumberOfPartition = 0; for (Index = 0; Index < PrimaryHeader->NumberOfPartitionEntries; Index++) { - if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &gZeroGuid)) { + if (!IsZeroGuid (&PartitionEntry->PartitionTypeGUID)) { CopyMem ( (UINT8 *)&GptData->Partitions + NumberOfPartition * PrimaryHeader->SizeOfPartitionEntry, (UINT8 *)PartitionEntry, @@ -251,20 +245,20 @@ TrEEMeasureGptTable ( // // Measure the GPT data // - Status = TreeProtocol->HashLogExtendEvent ( - TreeProtocol, + Status = Tcg2Protocol->HashLogExtendEvent ( + Tcg2Protocol, 0, (EFI_PHYSICAL_ADDRESS) (UINTN) (VOID *) GptData, (UINT64) EventSize, - TreeEvent + Tcg2Event ); if (!EFI_ERROR (Status)) { - mTrEEMeasureGptCount++; + mTcg2MeasureGptCount++; } FreePool (PrimaryHeader); FreePool (EntryPtr); - FreePool (TreeEvent); + FreePool (Tcg2Event); return Status; } @@ -277,7 +271,7 @@ TrEEMeasureGptTable ( PE/COFF image is external input, so this function will validate its data structure within this image buffer before use. - @param[in] TreeProtocol Pointer to the located TREE protocol instance. + @param[in] Tcg2Protocol Pointer to the located TCG2 protocol instance. @param[in] ImageAddress Start address of image buffer. @param[in] ImageSize Image size @param[in] LinkTimeBase Address that the image is loaded into memory. @@ -286,14 +280,14 @@ TrEEMeasureGptTable ( @retval EFI_SUCCESS Successfully measure image. @retval EFI_OUT_OF_RESOURCES No enough resource to measure image. - @retval EFI_UNSUPPORTED ImageType is unsupported or PE image is mal-format. + @retval EFI_UNSUPPORTED ImageType is unsupported or PE image is mal-format. @retval other error value **/ EFI_STATUS EFIAPI -TrEEMeasurePeImage ( - IN EFI_TREE_PROTOCOL *TreeProtocol, +Tcg2MeasurePeImage ( + IN EFI_TCG2_PROTOCOL *Tcg2Protocol, IN EFI_PHYSICAL_ADDRESS ImageAddress, IN UINTN ImageSize, IN UINTN LinkTimeBase, @@ -302,7 +296,7 @@ TrEEMeasurePeImage ( ) { EFI_STATUS Status; - TrEE_EVENT *TreeEvent; + EFI_TCG2_EVENT *Tcg2Event; EFI_IMAGE_LOAD_EVENT *ImageLoad; UINT32 FilePathSize; UINT32 EventSize; @@ -315,33 +309,33 @@ TrEEMeasurePeImage ( // Determine destination PCR by BootPolicy // EventSize = sizeof (*ImageLoad) - sizeof (ImageLoad->DevicePath) + FilePathSize; - TreeEvent = AllocateZeroPool (EventSize + sizeof (TrEE_EVENT) - sizeof(TreeEvent->Event)); - if (TreeEvent == NULL) { + Tcg2Event = AllocateZeroPool (EventSize + sizeof (EFI_TCG2_EVENT) - sizeof(Tcg2Event->Event)); + if (Tcg2Event == NULL) { return EFI_OUT_OF_RESOURCES; } - TreeEvent->Size = EventSize + sizeof (TrEE_EVENT) - sizeof(TreeEvent->Event); - TreeEvent->Header.HeaderSize = sizeof(TrEE_EVENT_HEADER); - TreeEvent->Header.HeaderVersion = TREE_EVENT_HEADER_VERSION; - ImageLoad = (EFI_IMAGE_LOAD_EVENT *) TreeEvent->Event; + Tcg2Event->Size = EventSize + sizeof (EFI_TCG2_EVENT) - sizeof(Tcg2Event->Event); + Tcg2Event->Header.HeaderSize = sizeof(EFI_TCG2_EVENT_HEADER); + Tcg2Event->Header.HeaderVersion = EFI_TCG2_EVENT_HEADER_VERSION; + ImageLoad = (EFI_IMAGE_LOAD_EVENT *) Tcg2Event->Event; switch (ImageType) { case EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION: - TreeEvent->Header.EventType = EV_EFI_BOOT_SERVICES_APPLICATION; - TreeEvent->Header.PCRIndex = 4; + Tcg2Event->Header.EventType = EV_EFI_BOOT_SERVICES_APPLICATION; + Tcg2Event->Header.PCRIndex = 4; break; case EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER: - TreeEvent->Header.EventType = EV_EFI_BOOT_SERVICES_DRIVER; - TreeEvent->Header.PCRIndex = 2; + Tcg2Event->Header.EventType = EV_EFI_BOOT_SERVICES_DRIVER; + Tcg2Event->Header.PCRIndex = 2; break; case EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER: - TreeEvent->Header.EventType = EV_EFI_RUNTIME_SERVICES_DRIVER; - TreeEvent->Header.PCRIndex = 2; + Tcg2Event->Header.EventType = EV_EFI_RUNTIME_SERVICES_DRIVER; + Tcg2Event->Header.PCRIndex = 2; break; default: DEBUG (( EFI_D_ERROR, - "TrEEMeasurePeImage: Unknown subsystem type %d", + "Tcg2MeasurePeImage: Unknown subsystem type %d", ImageType )); goto Finish; @@ -358,50 +352,50 @@ TrEEMeasurePeImage ( // // Log the PE data // - Status = TreeProtocol->HashLogExtendEvent ( - TreeProtocol, + Status = Tcg2Protocol->HashLogExtendEvent ( + Tcg2Protocol, PE_COFF_IMAGE, ImageAddress, ImageSize, - TreeEvent + Tcg2Event ); if (Status == EFI_VOLUME_FULL) { // // Volume full here means the image is hashed and its result is extended to PCR. - // But the event log cann't be saved since log area is full. + // But the event log can't be saved since log area is full. // Just return EFI_SUCCESS in order not to block the image load. // Status = EFI_SUCCESS; } Finish: - FreePool (TreeEvent); + FreePool (Tcg2Event); return Status; } /** - The security handler is used to abstract platform-specific policy - from the DXE core response to an attempt to use a file that returns a - given status for the authentication check from the section extraction protocol. + The security handler is used to abstract platform-specific policy + from the DXE core response to an attempt to use a file that returns a + given status for the authentication check from the section extraction protocol. - The possible responses in a given SAP implementation may include locking - flash upon failure to authenticate, attestation logging for all signed drivers, - and other exception operations. The File parameter allows for possible logging + The possible responses in a given SAP implementation may include locking + flash upon failure to authenticate, attestation logging for all signed drivers, + and other exception operations. The File parameter allows for possible logging within the SAP of the driver. - If File is NULL, then EFI_INVALID_PARAMETER is returned. + If File is NULL, then EFI_ACCESS_DENIED is returned. - If the file specified by File with an authentication status specified by + If the file specified by File with an authentication status specified by AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned. - If the file specified by File with an authentication status specified by - AuthenticationStatus is not safe for the DXE Core to use under any circumstances, + If the file specified by File with an authentication status specified by + AuthenticationStatus is not safe for the DXE Core to use under any circumstances, then EFI_ACCESS_DENIED is returned. - If the file specified by File with an authentication status specified by - AuthenticationStatus is not safe for the DXE Core to use right now, but it - might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is + If the file specified by File with an authentication status specified by + AuthenticationStatus is not safe for the DXE Core to use right now, but it + might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is returned. @param[in] AuthenticationStatus This is the authentication status returned @@ -428,9 +422,9 @@ DxeTpm2MeasureBootHandler ( IN BOOLEAN BootPolicy ) { - EFI_TREE_PROTOCOL *TreeProtocol; + EFI_TCG2_PROTOCOL *Tcg2Protocol; EFI_STATUS Status; - TREE_BOOT_SERVICE_CAPABILITY ProtocolCapability; + EFI_TCG2_BOOT_SERVICE_CAPABILITY ProtocolCapability; EFI_DEVICE_PATH_PROTOCOL *DevicePathNode; EFI_DEVICE_PATH_PROTOCOL *OrigDevicePathNode; EFI_HANDLE Handle; @@ -441,26 +435,33 @@ DxeTpm2MeasureBootHandler ( EFI_PHYSICAL_ADDRESS FvAddress; UINT32 Index; - Status = gBS->LocateProtocol (&gEfiTrEEProtocolGuid, NULL, (VOID **) &TreeProtocol); + // + // Check for invalid parameters. + // + if (File == NULL) { + return EFI_ACCESS_DENIED; + } + + Status = gBS->LocateProtocol (&gEfiTcg2ProtocolGuid, NULL, (VOID **) &Tcg2Protocol); if (EFI_ERROR (Status)) { // - // TrEE protocol is not installed. So, TPM2 is not present. + // Tcg2 protocol is not installed. So, TPM2 is not present. // Don't do any measurement, and directly return EFI_SUCCESS. // - DEBUG ((EFI_D_INFO, "DxeTpm2MeasureBootHandler - TrEE - %r\n", Status)); + DEBUG ((EFI_D_VERBOSE, "DxeTpm2MeasureBootHandler - Tcg2 - %r\n", Status)); return EFI_SUCCESS; } ProtocolCapability.Size = (UINT8) sizeof (ProtocolCapability); - Status = TreeProtocol->GetCapability ( - TreeProtocol, + Status = Tcg2Protocol->GetCapability ( + Tcg2Protocol, &ProtocolCapability ); - if (EFI_ERROR (Status) || (!ProtocolCapability.TrEEPresentFlag)) { + if (EFI_ERROR (Status) || (!ProtocolCapability.TPMPresentFlag)) { // // TPM device doesn't work or activate. // - DEBUG ((EFI_D_ERROR, "DxeTpm2MeasureBootHandler (%r) - TrEEPresentFlag - %x\n", Status, ProtocolCapability.TrEEPresentFlag)); + DEBUG ((EFI_D_ERROR, "DxeTpm2MeasureBootHandler (%r) - TPMPresentFlag - %x\n", Status, ProtocolCapability.TPMPresentFlag)); return EFI_SUCCESS; } @@ -468,16 +469,16 @@ DxeTpm2MeasureBootHandler ( // Copy File Device Path // OrigDevicePathNode = DuplicateDevicePath (File); - + // // 1. Check whether this device path support BlockIo protocol. // Is so, this device path may be a GPT device path. // DevicePathNode = OrigDevicePathNode; Status = gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &DevicePathNode, &Handle); - if (!EFI_ERROR (Status) && !mTrEEMeasureGptTableFlag) { + if (!EFI_ERROR (Status) && !mTcg2MeasureGptTableFlag) { // - // Find the gpt partion on the given devicepath + // Find the gpt partition on the given devicepath // DevicePathNode = OrigDevicePathNode; ASSERT (DevicePathNode != NULL); @@ -489,8 +490,8 @@ DxeTpm2MeasureBootHandler ( DevicePathSubType (DevicePathNode) == MEDIA_HARDDRIVE_DP) { // // Check whether it is a gpt partition or not - // - if (((HARDDRIVE_DEVICE_PATH *) DevicePathNode)->MBRType == MBR_TYPE_EFI_PARTITION_TABLE_HEADER && + // + if (((HARDDRIVE_DEVICE_PATH *) DevicePathNode)->MBRType == MBR_TYPE_EFI_PARTITION_TABLE_HEADER && ((HARDDRIVE_DEVICE_PATH *) DevicePathNode)->SignatureType == SIGNATURE_TYPE_GUID) { // @@ -508,13 +509,13 @@ DxeTpm2MeasureBootHandler ( // // Measure GPT disk. // - Status = TrEEMeasureGptTable (TreeProtocol, Handle); - DEBUG ((EFI_D_INFO, "DxeTpm2MeasureBootHandler - TrEEMeasureGptTable - %r\n", Status)); + Status = Tcg2MeasureGptTable (Tcg2Protocol, Handle); + DEBUG ((EFI_D_INFO, "DxeTpm2MeasureBootHandler - Tcg2MeasureGptTable - %r\n", Status)); if (!EFI_ERROR (Status)) { // // GPT disk check done. // - mTrEEMeasureGptTableFlag = TRUE; + mTcg2MeasureGptTableFlag = TRUE; } } FreePool (OrigDevicePathNode); @@ -526,7 +527,7 @@ DxeTpm2MeasureBootHandler ( DevicePathNode = NextDevicePathNode (DevicePathNode); } } - + // // 2. Measure PE image. // @@ -547,20 +548,20 @@ DxeTpm2MeasureBootHandler ( } // // The PE image from unmeasured Firmware volume need be measured - // The PE image from measured Firmware volume will be mearsured according to policy below. + // The PE image from measured Firmware volume will be measured according to policy below. // If it is driver, do not measure // If it is application, still measure. // ApplicationRequired = TRUE; - if (mTrEECacheMeasuredHandle != Handle && mTrEEMeasuredHobData != NULL) { + if (mTcg2CacheMeasuredHandle != Handle && mTcg2MeasuredHobData != NULL) { // // Search for Root FV of this PE image // TempHandle = Handle; do { Status = gBS->HandleProtocol( - TempHandle, + TempHandle, &gEfiFirmwareVolumeBlockProtocolGuid, (VOID**)&FvbProtocol ); @@ -577,12 +578,12 @@ DxeTpm2MeasureBootHandler ( ApplicationRequired = FALSE; - for (Index = 0; Index < mTrEEMeasuredHobData->Num; Index++) { - if(mTrEEMeasuredHobData->MeasuredFvBuf[Index].BlobBase == FvAddress) { + for (Index = 0; Index < mTcg2MeasuredHobData->Num; Index++) { + if(mTcg2MeasuredHobData->MeasuredFvBuf[Index].BlobBase == FvAddress) { // // Cache measured FV for next measurement // - mTrEECacheMeasuredHandle = Handle; + mTcg2CacheMeasuredHandle = Handle; ApplicationRequired = TRUE; break; } @@ -598,8 +599,8 @@ DxeTpm2MeasureBootHandler ( goto Finish; } - mTrEEImageSize = FileSize; - mTrEEFileBuffer = FileBuffer; + mTcg2ImageSize = FileSize; + mTcg2FileBuffer = FileBuffer; // // Measure PE Image @@ -619,16 +620,16 @@ DxeTpm2MeasureBootHandler ( // goto Finish; } - + // // Measure only application if Application flag is set // Measure drivers and applications if Application flag is not set // - if ((!ApplicationRequired) || - (ApplicationRequired && ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION)) { + if ((!ApplicationRequired) || + (ApplicationRequired && ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION)) { // // Print the image path to be measured. - // + // DEBUG_CODE_BEGIN (); CHAR16 *ToText; ToText = ConvertDevicePathToText ( @@ -645,15 +646,15 @@ DxeTpm2MeasureBootHandler ( // // Measure PE image into TPM log. // - Status = TrEEMeasurePeImage ( - TreeProtocol, - (EFI_PHYSICAL_ADDRESS) (UINTN) FileBuffer, - FileSize, - (UINTN) ImageContext.ImageAddress, - ImageContext.ImageType, + Status = Tcg2MeasurePeImage ( + Tcg2Protocol, + (EFI_PHYSICAL_ADDRESS) (UINTN) FileBuffer, + FileSize, + (UINTN) ImageContext.ImageAddress, + ImageContext.ImageType, DevicePathNode ); - DEBUG ((EFI_D_INFO, "DxeTpm2MeasureBootHandler - TrEEMeasurePeImage - %r\n", Status)); + DEBUG ((EFI_D_INFO, "DxeTpm2MeasureBootHandler - Tcg2MeasurePeImage - %r\n", Status)); } // @@ -692,7 +693,7 @@ DxeTpm2MeasureBootLibConstructor ( GuidHob = GetFirstGuidHob (&gMeasuredFvHobGuid); if (GuidHob != NULL) { - mTrEEMeasuredHobData = GET_GUID_HOB_DATA (GuidHob); + mTcg2MeasuredHobData = GET_GUID_HOB_DATA (GuidHob); } return RegisterSecurity2Handler (