2 The library instance provides security service of TPM2 measure boot.
4 Caution: This file requires additional review when modified.
5 This library will have external input - PE/COFF image and GPT partition.
6 This external input must be validated carefully to avoid security issue like
7 buffer overflow, integer overflow.
9 DxeTpm2MeasureBootLibImageRead() function will make sure the PE/COFF image content
10 read is within the image buffer.
12 Tcg2MeasurePeImage() function will accept untrusted PE/COFF image and validate its
13 data structure within this image buffer before use.
15 Tcg2MeasureGptTable() function will receive untrusted GPT partition table, and parse
16 partition data carefully.
18 Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
19 (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
20 SPDX-License-Identifier: BSD-2-Clause-Patent
26 #include <Protocol/Tcg2Protocol.h>
27 #include <Protocol/BlockIo.h>
28 #include <Protocol/DiskIo.h>
29 #include <Protocol/DevicePathToText.h>
30 #include <Protocol/FirmwareVolumeBlock.h>
32 #include <Guid/MeasuredFvHob.h>
34 #include <Library/BaseLib.h>
35 #include <Library/DebugLib.h>
36 #include <Library/BaseMemoryLib.h>
37 #include <Library/MemoryAllocationLib.h>
38 #include <Library/DevicePathLib.h>
39 #include <Library/UefiBootServicesTableLib.h>
40 #include <Library/BaseCryptLib.h>
41 #include <Library/PeCoffLib.h>
42 #include <Library/SecurityManagementLib.h>
43 #include <Library/HobLib.h>
46 // Flag to check GPT partition. It only need be measured once.
48 BOOLEAN mTcg2MeasureGptTableFlag
= FALSE
;
49 UINTN mTcg2MeasureGptCount
= 0;
50 VOID
*mTcg2FileBuffer
;
53 // Measured FV handle cache
55 EFI_HANDLE mTcg2CacheMeasuredHandle
= NULL
;
56 MEASURED_HOB_DATA
*mTcg2MeasuredHobData
= NULL
;
59 Reads contents of a PE/COFF image in memory buffer.
61 Caution: This function may receive untrusted input.
62 PE/COFF image is external input, so this function will make sure the PE/COFF image content
63 read is within the image buffer.
65 @param FileHandle Pointer to the file handle to read the PE/COFF image.
66 @param FileOffset Offset into the PE/COFF image to begin the read operation.
67 @param ReadSize On input, the size in bytes of the requested read operation.
68 On output, the number of bytes actually read.
69 @param Buffer Output buffer that contains the data read from the PE/COFF image.
71 @retval EFI_SUCCESS The specified portion of the PE/COFF image was read and the size
75 DxeTpm2MeasureBootLibImageRead (
78 IN OUT UINTN
*ReadSize
,
84 if ((FileHandle
== NULL
) || (ReadSize
== NULL
) || (Buffer
== NULL
)) {
85 return EFI_INVALID_PARAMETER
;
88 if (MAX_ADDRESS
- FileOffset
< *ReadSize
) {
89 return EFI_INVALID_PARAMETER
;
92 EndPosition
= FileOffset
+ *ReadSize
;
93 if (EndPosition
> mTcg2ImageSize
) {
94 *ReadSize
= (UINT32
)(mTcg2ImageSize
- FileOffset
);
97 if (FileOffset
>= mTcg2ImageSize
) {
101 CopyMem (Buffer
, (UINT8
*)((UINTN
)FileHandle
+ FileOffset
), *ReadSize
);
107 Measure GPT table data into TPM log.
109 Caution: This function may receive untrusted input.
110 The GPT partition table is external input, so this function should parse partition data carefully.
112 @param Tcg2Protocol Pointer to the located TCG2 protocol instance.
113 @param GptHandle Handle that GPT partition was installed.
115 @retval EFI_SUCCESS Successfully measure GPT table.
116 @retval EFI_UNSUPPORTED Not support GPT table on the given handle.
117 @retval EFI_DEVICE_ERROR Can't get GPT table because device error.
118 @retval EFI_OUT_OF_RESOURCES No enough resource to measure GPT table.
119 @retval other error value
123 Tcg2MeasureGptTable (
124 IN EFI_TCG2_PROTOCOL
*Tcg2Protocol
,
125 IN EFI_HANDLE GptHandle
129 EFI_BLOCK_IO_PROTOCOL
*BlockIo
;
130 EFI_DISK_IO_PROTOCOL
*DiskIo
;
131 EFI_PARTITION_TABLE_HEADER
*PrimaryHeader
;
132 EFI_PARTITION_ENTRY
*PartitionEntry
;
134 UINTN NumberOfPartition
;
136 EFI_TCG2_EVENT
*Tcg2Event
;
137 EFI_GPT_DATA
*GptData
;
140 if (mTcg2MeasureGptCount
> 0) {
144 Status
= gBS
->HandleProtocol (GptHandle
, &gEfiBlockIoProtocolGuid
, (VOID
**)&BlockIo
);
145 if (EFI_ERROR (Status
)) {
146 return EFI_UNSUPPORTED
;
149 Status
= gBS
->HandleProtocol (GptHandle
, &gEfiDiskIoProtocolGuid
, (VOID
**)&DiskIo
);
150 if (EFI_ERROR (Status
)) {
151 return EFI_UNSUPPORTED
;
155 // Read the EFI Partition Table Header
157 PrimaryHeader
= (EFI_PARTITION_TABLE_HEADER
*)AllocatePool (BlockIo
->Media
->BlockSize
);
158 if (PrimaryHeader
== NULL
) {
159 return EFI_OUT_OF_RESOURCES
;
162 Status
= DiskIo
->ReadDisk (
164 BlockIo
->Media
->MediaId
,
165 1 * BlockIo
->Media
->BlockSize
,
166 BlockIo
->Media
->BlockSize
,
167 (UINT8
*)PrimaryHeader
169 if (EFI_ERROR (Status
)) {
170 DEBUG ((DEBUG_ERROR
, "Failed to Read Partition Table Header!\n"));
171 FreePool (PrimaryHeader
);
172 return EFI_DEVICE_ERROR
;
176 // Read the partition entry.
178 EntryPtr
= (UINT8
*)AllocatePool (PrimaryHeader
->NumberOfPartitionEntries
* PrimaryHeader
->SizeOfPartitionEntry
);
179 if (EntryPtr
== NULL
) {
180 FreePool (PrimaryHeader
);
181 return EFI_OUT_OF_RESOURCES
;
184 Status
= DiskIo
->ReadDisk (
186 BlockIo
->Media
->MediaId
,
187 MultU64x32 (PrimaryHeader
->PartitionEntryLBA
, BlockIo
->Media
->BlockSize
),
188 PrimaryHeader
->NumberOfPartitionEntries
* PrimaryHeader
->SizeOfPartitionEntry
,
191 if (EFI_ERROR (Status
)) {
192 FreePool (PrimaryHeader
);
194 return EFI_DEVICE_ERROR
;
198 // Count the valid partition
200 PartitionEntry
= (EFI_PARTITION_ENTRY
*)EntryPtr
;
201 NumberOfPartition
= 0;
202 for (Index
= 0; Index
< PrimaryHeader
->NumberOfPartitionEntries
; Index
++) {
203 if (!IsZeroGuid (&PartitionEntry
->PartitionTypeGUID
)) {
207 PartitionEntry
= (EFI_PARTITION_ENTRY
*)((UINT8
*)PartitionEntry
+ PrimaryHeader
->SizeOfPartitionEntry
);
211 // Prepare Data for Measurement
213 EventSize
= (UINT32
)(sizeof (EFI_GPT_DATA
) - sizeof (GptData
->Partitions
)
214 + NumberOfPartition
* PrimaryHeader
->SizeOfPartitionEntry
);
215 Tcg2Event
= (EFI_TCG2_EVENT
*)AllocateZeroPool (EventSize
+ sizeof (EFI_TCG2_EVENT
) - sizeof (Tcg2Event
->Event
));
216 if (Tcg2Event
== NULL
) {
217 FreePool (PrimaryHeader
);
219 return EFI_OUT_OF_RESOURCES
;
222 Tcg2Event
->Size
= EventSize
+ sizeof (EFI_TCG2_EVENT
) - sizeof (Tcg2Event
->Event
);
223 Tcg2Event
->Header
.HeaderSize
= sizeof (EFI_TCG2_EVENT_HEADER
);
224 Tcg2Event
->Header
.HeaderVersion
= EFI_TCG2_EVENT_HEADER_VERSION
;
225 Tcg2Event
->Header
.PCRIndex
= 5;
226 Tcg2Event
->Header
.EventType
= EV_EFI_GPT_EVENT
;
227 GptData
= (EFI_GPT_DATA
*)Tcg2Event
->Event
;
230 // Copy the EFI_PARTITION_TABLE_HEADER and NumberOfPartition
232 CopyMem ((UINT8
*)GptData
, (UINT8
*)PrimaryHeader
, sizeof (EFI_PARTITION_TABLE_HEADER
));
233 GptData
->NumberOfPartitions
= NumberOfPartition
;
235 // Copy the valid partition entry
237 PartitionEntry
= (EFI_PARTITION_ENTRY
*)EntryPtr
;
238 NumberOfPartition
= 0;
239 for (Index
= 0; Index
< PrimaryHeader
->NumberOfPartitionEntries
; Index
++) {
240 if (!IsZeroGuid (&PartitionEntry
->PartitionTypeGUID
)) {
242 (UINT8
*)&GptData
->Partitions
+ NumberOfPartition
* PrimaryHeader
->SizeOfPartitionEntry
,
243 (UINT8
*)PartitionEntry
,
244 PrimaryHeader
->SizeOfPartitionEntry
249 PartitionEntry
= (EFI_PARTITION_ENTRY
*)((UINT8
*)PartitionEntry
+ PrimaryHeader
->SizeOfPartitionEntry
);
253 // Measure the GPT data
255 Status
= Tcg2Protocol
->HashLogExtendEvent (
258 (EFI_PHYSICAL_ADDRESS
)(UINTN
)(VOID
*)GptData
,
262 if (!EFI_ERROR (Status
)) {
263 mTcg2MeasureGptCount
++;
266 FreePool (PrimaryHeader
);
268 FreePool (Tcg2Event
);
274 Measure PE image into TPM log based on the authenticode image hashing in
275 PE/COFF Specification 8.0 Appendix A.
277 Caution: This function may receive untrusted input.
278 PE/COFF image is external input, so this function will validate its data structure
279 within this image buffer before use.
281 @param[in] Tcg2Protocol Pointer to the located TCG2 protocol instance.
282 @param[in] ImageAddress Start address of image buffer.
283 @param[in] ImageSize Image size
284 @param[in] LinkTimeBase Address that the image is loaded into memory.
285 @param[in] ImageType Image subsystem type.
286 @param[in] FilePath File path is corresponding to the input image.
288 @retval EFI_SUCCESS Successfully measure image.
289 @retval EFI_OUT_OF_RESOURCES No enough resource to measure image.
290 @retval EFI_UNSUPPORTED ImageType is unsupported or PE image is mal-format.
291 @retval other error value
297 IN EFI_TCG2_PROTOCOL
*Tcg2Protocol
,
298 IN EFI_PHYSICAL_ADDRESS ImageAddress
,
300 IN UINTN LinkTimeBase
,
302 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
306 EFI_TCG2_EVENT
*Tcg2Event
;
307 EFI_IMAGE_LOAD_EVENT
*ImageLoad
;
311 Status
= EFI_UNSUPPORTED
;
313 FilePathSize
= (UINT32
)GetDevicePathSize (FilePath
);
316 // Determine destination PCR by BootPolicy
318 EventSize
= sizeof (*ImageLoad
) - sizeof (ImageLoad
->DevicePath
) + FilePathSize
;
319 Tcg2Event
= AllocateZeroPool (EventSize
+ sizeof (EFI_TCG2_EVENT
) - sizeof (Tcg2Event
->Event
));
320 if (Tcg2Event
== NULL
) {
321 return EFI_OUT_OF_RESOURCES
;
324 Tcg2Event
->Size
= EventSize
+ sizeof (EFI_TCG2_EVENT
) - sizeof (Tcg2Event
->Event
);
325 Tcg2Event
->Header
.HeaderSize
= sizeof (EFI_TCG2_EVENT_HEADER
);
326 Tcg2Event
->Header
.HeaderVersion
= EFI_TCG2_EVENT_HEADER_VERSION
;
327 ImageLoad
= (EFI_IMAGE_LOAD_EVENT
*)Tcg2Event
->Event
;
330 case EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION
:
331 Tcg2Event
->Header
.EventType
= EV_EFI_BOOT_SERVICES_APPLICATION
;
332 Tcg2Event
->Header
.PCRIndex
= 4;
334 case EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER
:
335 Tcg2Event
->Header
.EventType
= EV_EFI_BOOT_SERVICES_DRIVER
;
336 Tcg2Event
->Header
.PCRIndex
= 2;
338 case EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER
:
339 Tcg2Event
->Header
.EventType
= EV_EFI_RUNTIME_SERVICES_DRIVER
;
340 Tcg2Event
->Header
.PCRIndex
= 2;
345 "Tcg2MeasurePeImage: Unknown subsystem type %d",
351 ImageLoad
->ImageLocationInMemory
= ImageAddress
;
352 ImageLoad
->ImageLengthInMemory
= ImageSize
;
353 ImageLoad
->ImageLinkTimeAddress
= LinkTimeBase
;
354 ImageLoad
->LengthOfDevicePath
= FilePathSize
;
355 if ((FilePath
!= NULL
) && (FilePathSize
!= 0)) {
356 CopyMem (ImageLoad
->DevicePath
, FilePath
, FilePathSize
);
362 Status
= Tcg2Protocol
->HashLogExtendEvent (
369 if (Status
== EFI_VOLUME_FULL
) {
371 // Volume full here means the image is hashed and its result is extended to PCR.
372 // But the event log can't be saved since log area is full.
373 // Just return EFI_SUCCESS in order not to block the image load.
375 Status
= EFI_SUCCESS
;
379 FreePool (Tcg2Event
);
385 The security handler is used to abstract platform-specific policy
386 from the DXE core response to an attempt to use a file that returns a
387 given status for the authentication check from the section extraction protocol.
389 The possible responses in a given SAP implementation may include locking
390 flash upon failure to authenticate, attestation logging for all signed drivers,
391 and other exception operations. The File parameter allows for possible logging
392 within the SAP of the driver.
394 If the file specified by File with an authentication status specified by
395 AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned.
397 If the file specified by File with an authentication status specified by
398 AuthenticationStatus is not safe for the DXE Core to use under any circumstances,
399 then EFI_ACCESS_DENIED is returned.
401 If the file specified by File with an authentication status specified by
402 AuthenticationStatus is not safe for the DXE Core to use right now, but it
403 might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is
406 If check image specified by FileBuffer and File is NULL meanwhile, return EFI_ACCESS_DENIED.
408 @param[in] AuthenticationStatus This is the authentication status returned
409 from the securitymeasurement services for the
411 @param[in] File This is a pointer to the device path of the file that is
412 being dispatched. This will optionally be used for logging.
413 @param[in] FileBuffer File buffer matches the input file device path.
414 @param[in] FileSize Size of File buffer matches the input file device path.
415 @param[in] BootPolicy A boot policy that was used to call LoadImage() UEFI service.
417 @retval EFI_SUCCESS The file specified by DevicePath and non-NULL
418 FileBuffer did authenticate, and the platform policy dictates
419 that the DXE Foundation may use the file.
420 @retval other error value
424 DxeTpm2MeasureBootHandler (
425 IN UINT32 AuthenticationStatus
,
426 IN CONST EFI_DEVICE_PATH_PROTOCOL
*File OPTIONAL
,
429 IN BOOLEAN BootPolicy
432 EFI_TCG2_PROTOCOL
*Tcg2Protocol
;
434 EFI_TCG2_BOOT_SERVICE_CAPABILITY ProtocolCapability
;
435 EFI_DEVICE_PATH_PROTOCOL
*DevicePathNode
;
436 EFI_DEVICE_PATH_PROTOCOL
*OrigDevicePathNode
;
438 EFI_HANDLE TempHandle
;
439 BOOLEAN ApplicationRequired
;
440 PE_COFF_LOADER_IMAGE_CONTEXT ImageContext
;
441 EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*FvbProtocol
;
442 EFI_PHYSICAL_ADDRESS FvAddress
;
445 Status
= gBS
->LocateProtocol (&gEfiTcg2ProtocolGuid
, NULL
, (VOID
**)&Tcg2Protocol
);
446 if (EFI_ERROR (Status
)) {
448 // Tcg2 protocol is not installed. So, TPM2 is not present.
449 // Don't do any measurement, and directly return EFI_SUCCESS.
451 DEBUG ((DEBUG_VERBOSE
, "DxeTpm2MeasureBootHandler - Tcg2 - %r\n", Status
));
455 ProtocolCapability
.Size
= (UINT8
)sizeof (ProtocolCapability
);
456 Status
= Tcg2Protocol
->GetCapability (
460 if (EFI_ERROR (Status
) || (!ProtocolCapability
.TPMPresentFlag
)) {
462 // TPM device doesn't work or activate.
464 DEBUG ((DEBUG_ERROR
, "DxeTpm2MeasureBootHandler (%r) - TPMPresentFlag - %x\n", Status
, ProtocolCapability
.TPMPresentFlag
));
469 // Copy File Device Path
471 OrigDevicePathNode
= DuplicateDevicePath (File
);
474 // 1. Check whether this device path support BlockIo protocol.
475 // Is so, this device path may be a GPT device path.
477 DevicePathNode
= OrigDevicePathNode
;
478 Status
= gBS
->LocateDevicePath (&gEfiBlockIoProtocolGuid
, &DevicePathNode
, &Handle
);
479 if (!EFI_ERROR (Status
) && !mTcg2MeasureGptTableFlag
) {
481 // Find the gpt partition on the given devicepath
483 DevicePathNode
= OrigDevicePathNode
;
484 ASSERT (DevicePathNode
!= NULL
);
485 while (!IsDevicePathEnd (DevicePathNode
)) {
487 // Find the Gpt partition
489 if ((DevicePathType (DevicePathNode
) == MEDIA_DEVICE_PATH
) &&
490 (DevicePathSubType (DevicePathNode
) == MEDIA_HARDDRIVE_DP
))
493 // Check whether it is a gpt partition or not
495 if ((((HARDDRIVE_DEVICE_PATH
*)DevicePathNode
)->MBRType
== MBR_TYPE_EFI_PARTITION_TABLE_HEADER
) &&
496 (((HARDDRIVE_DEVICE_PATH
*)DevicePathNode
)->SignatureType
== SIGNATURE_TYPE_GUID
))
499 // Change the partition device path to its parent device path (disk) and get the handle.
501 DevicePathNode
->Type
= END_DEVICE_PATH_TYPE
;
502 DevicePathNode
->SubType
= END_ENTIRE_DEVICE_PATH_SUBTYPE
;
503 DevicePathNode
= OrigDevicePathNode
;
504 Status
= gBS
->LocateDevicePath (
505 &gEfiDiskIoProtocolGuid
,
509 if (!EFI_ERROR (Status
)) {
513 Status
= Tcg2MeasureGptTable (Tcg2Protocol
, Handle
);
514 DEBUG ((DEBUG_INFO
, "DxeTpm2MeasureBootHandler - Tcg2MeasureGptTable - %r\n", Status
));
515 if (!EFI_ERROR (Status
)) {
517 // GPT disk check done.
519 mTcg2MeasureGptTableFlag
= TRUE
;
523 FreePool (OrigDevicePathNode
);
524 OrigDevicePathNode
= DuplicateDevicePath (File
);
525 ASSERT (OrigDevicePathNode
!= NULL
);
530 DevicePathNode
= NextDevicePathNode (DevicePathNode
);
535 // 2. Measure PE image.
537 ApplicationRequired
= FALSE
;
540 // Check whether this device path support FVB protocol.
542 DevicePathNode
= OrigDevicePathNode
;
543 Status
= gBS
->LocateDevicePath (&gEfiFirmwareVolumeBlockProtocolGuid
, &DevicePathNode
, &Handle
);
544 if (!EFI_ERROR (Status
)) {
546 // Don't check FV image, and directly return EFI_SUCCESS.
547 // It can be extended to the specific FV authentication according to the different requirement.
549 if (IsDevicePathEnd (DevicePathNode
)) {
554 // The PE image from unmeasured Firmware volume need be measured
555 // The PE image from measured Firmware volume will be measured according to policy below.
556 // If it is driver, do not measure
557 // If it is application, still measure.
559 ApplicationRequired
= TRUE
;
561 if ((mTcg2CacheMeasuredHandle
!= Handle
) && (mTcg2MeasuredHobData
!= NULL
)) {
563 // Search for Root FV of this PE image
567 Status
= gBS
->HandleProtocol (
569 &gEfiFirmwareVolumeBlockProtocolGuid
,
570 (VOID
**)&FvbProtocol
572 TempHandle
= FvbProtocol
->ParentHandle
;
573 } while (!EFI_ERROR (Status
) && FvbProtocol
->ParentHandle
!= NULL
);
576 // Search in measured FV Hob
578 Status
= FvbProtocol
->GetPhysicalAddress (FvbProtocol
, &FvAddress
);
579 if (EFI_ERROR (Status
)) {
583 ApplicationRequired
= FALSE
;
585 for (Index
= 0; Index
< mTcg2MeasuredHobData
->Num
; Index
++) {
586 if (mTcg2MeasuredHobData
->MeasuredFvBuf
[Index
].BlobBase
== FvAddress
) {
588 // Cache measured FV for next measurement
590 mTcg2CacheMeasuredHandle
= Handle
;
591 ApplicationRequired
= TRUE
;
599 // File is not found.
601 if (FileBuffer
== NULL
) {
602 Status
= EFI_SECURITY_VIOLATION
;
606 mTcg2ImageSize
= FileSize
;
607 mTcg2FileBuffer
= FileBuffer
;
612 DevicePathNode
= OrigDevicePathNode
;
613 ZeroMem (&ImageContext
, sizeof (ImageContext
));
614 ImageContext
.Handle
= (VOID
*)FileBuffer
;
615 ImageContext
.ImageRead
= (PE_COFF_LOADER_READ_FILE
)DxeTpm2MeasureBootLibImageRead
;
618 // Get information about the image being loaded
620 Status
= PeCoffLoaderGetImageInfo (&ImageContext
);
621 if (EFI_ERROR (Status
)) {
623 // Check for invalid parameters.
626 Status
= EFI_ACCESS_DENIED
;
630 // The information can't be got from the invalid PeImage
636 // Measure only application if Application flag is set
637 // Measure drivers and applications if Application flag is not set
639 if ((!ApplicationRequired
) ||
640 (ApplicationRequired
&& (ImageContext
.ImageType
== EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION
)))
643 // Print the image path to be measured.
647 ToText
= ConvertDevicePathToText (
652 if (ToText
!= NULL
) {
653 DEBUG ((DEBUG_INFO
, "The measured image path is %s.\n", ToText
));
660 // Measure PE image into TPM log.
662 Status
= Tcg2MeasurePeImage (
664 (EFI_PHYSICAL_ADDRESS
)(UINTN
)FileBuffer
,
666 (UINTN
)ImageContext
.ImageAddress
,
667 ImageContext
.ImageType
,
670 DEBUG ((DEBUG_INFO
, "DxeTpm2MeasureBootHandler - Tcg2MeasurePeImage - %r\n", Status
));
674 // Done, free the allocated resource.
677 if (OrigDevicePathNode
!= NULL
) {
678 FreePool (OrigDevicePathNode
);
681 DEBUG ((DEBUG_INFO
, "DxeTpm2MeasureBootHandler - %r\n", Status
));
687 Register the security handler to provide TPM measure boot service.
689 @param ImageHandle ImageHandle of the loaded driver.
690 @param SystemTable Pointer to the EFI System Table.
692 @retval EFI_SUCCESS Register successfully.
693 @retval EFI_OUT_OF_RESOURCES No enough memory to register this handler.
697 DxeTpm2MeasureBootLibConstructor (
698 IN EFI_HANDLE ImageHandle
,
699 IN EFI_SYSTEM_TABLE
*SystemTable
702 EFI_HOB_GUID_TYPE
*GuidHob
;
706 GuidHob
= GetFirstGuidHob (&gMeasuredFvHobGuid
);
708 if (GuidHob
!= NULL
) {
709 mTcg2MeasuredHobData
= GET_GUID_HOB_DATA (GuidHob
);
712 return RegisterSecurity2Handler (
713 DxeTpm2MeasureBootHandler
,
714 EFI_AUTH_OPERATION_MEASURE_IMAGE
| EFI_AUTH_OPERATION_IMAGE_REQUIRED