X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=SecurityPkg%2FLibrary%2FDxeTpmMeasureBootLib%2FDxeTpmMeasureBootLib.c;h=52bf582d82e033fcdc5aa138e2209cff4e80fa84;hp=cd48a1a9773a66251b524f6ce07a549f706716d2;hb=965268ea6df485d78b982d00270bd4ce7f673820;hpb=dd4c164c81f222efd5cf9c689aba9f3a92f74521 diff --git a/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c b/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c index cd48a1a977..52bf582d82 100644 --- a/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c +++ b/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c @@ -15,7 +15,7 @@ TcgMeasureGptTable() function will receive untrusted GPT partition table, and parse partition data carefully. -Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2016, 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 @@ -34,7 +34,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include -#include #include #include @@ -53,7 +52,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. BOOLEAN mMeasureGptTableFlag = FALSE; UINTN mMeasureGptCount = 0; VOID *mFileBuffer; -UINTN mImageSize; +UINTN mTpmImageSize; // // Measured FV handle cache // @@ -95,11 +94,11 @@ DxeTpmMeasureBootLibImageRead ( } EndPosition = FileOffset + *ReadSize; - if (EndPosition > mImageSize) { - *ReadSize = (UINT32)(mImageSize - FileOffset); + if (EndPosition > mTpmImageSize) { + *ReadSize = (UINT32)(mTpmImageSize - FileOffset); } - if (FileOffset >= mImageSize) { + if (FileOffset >= mTpmImageSize) { *ReadSize = 0; } @@ -202,7 +201,7 @@ TcgMeasureGptTable ( PartitionEntry = (EFI_PARTITION_ENTRY *)EntryPtr; NumberOfPartition = 0; for (Index = 0; Index < PrimaryHeader->NumberOfPartitionEntries; Index++) { - if (!CompareGuid (&PartitionEntry->PartitionTypeGUID, &gZeroGuid)) { + if (!IsZeroGuid (&PartitionEntry->PartitionTypeGUID)) { NumberOfPartition++; } PartitionEntry = (EFI_PARTITION_ENTRY *)((UINT8 *)PartitionEntry + PrimaryHeader->SizeOfPartitionEntry); @@ -236,7 +235,7 @@ TcgMeasureGptTable ( 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, @@ -279,6 +278,9 @@ TcgMeasureGptTable ( PE/COFF image is external input, so this function will validate its data structure within this image buffer before use. + Notes: PE/COFF image has been checked by BasePeCoffLib PeCoffLoaderGetImageInfo() in + its caller function DxeTpmMeasureBootHandler(). + @param[in] TcgProtocol Pointer to the located TCG protocol instance. @param[in] ImageAddress Start address of image buffer. @param[in] ImageSize Image size @@ -908,7 +910,7 @@ DxeTpmMeasureBootHandler ( goto Finish; } - mImageSize = FileSize; + mTpmImageSize = FileSize; mFileBuffer = FileBuffer; //