mirror of https://github.com/acidanthera/audk.git
Enhance GPT measurement to be able to handle different partition entry size.
Signed-off-by: Dong Guo <guo.dong@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Yao Jiewen <jiewen.yao@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13422 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
1f728ac751
commit
2ea3b92055
|
@ -177,15 +177,15 @@ TcgMeasureGptTable (
|
|||
if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &mZeroGuid)) {
|
||||
NumberOfPartition++;
|
||||
}
|
||||
PartitionEntry++;
|
||||
PartitionEntry = (EFI_PARTITION_ENTRY *)((UINT8 *)PartitionEntry + PrimaryHeader->SizeOfPartitionEntry);
|
||||
}
|
||||
|
||||
//
|
||||
// Parepare Data for Measurement
|
||||
// Prepare Data for Measurement
|
||||
//
|
||||
EventSize = (UINT32)(sizeof (EFI_GPT_DATA) - sizeof (GptData->Partitions)
|
||||
+ NumberOfPartition * PrimaryHeader->SizeOfPartitionEntry);
|
||||
TcgEvent = (TCG_PCR_EVENT *) AllocateZeroPool (EventSize + sizeof (TCG_PCR_EVENT));
|
||||
TcgEvent = (TCG_PCR_EVENT *) AllocateZeroPool (EventSize + sizeof (TCG_PCR_EVENT_HDR));
|
||||
if (TcgEvent == NULL) {
|
||||
FreePool (PrimaryHeader);
|
||||
FreePool (EntryPtr);
|
||||
|
@ -210,13 +210,13 @@ TcgMeasureGptTable (
|
|||
for (Index = 0; Index < PrimaryHeader->NumberOfPartitionEntries; Index++) {
|
||||
if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &mZeroGuid)) {
|
||||
CopyMem (
|
||||
(UINT8 *)&GptData->Partitions + NumberOfPartition * sizeof (EFI_PARTITION_ENTRY),
|
||||
(UINT8 *)&GptData->Partitions + NumberOfPartition * PrimaryHeader->SizeOfPartitionEntry,
|
||||
(UINT8 *)PartitionEntry,
|
||||
sizeof (EFI_PARTITION_ENTRY)
|
||||
PrimaryHeader->SizeOfPartitionEntry
|
||||
);
|
||||
NumberOfPartition++;
|
||||
}
|
||||
PartitionEntry++;
|
||||
PartitionEntry =(EFI_PARTITION_ENTRY *)((UINT8 *)PartitionEntry + PrimaryHeader->SizeOfPartitionEntry);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue