From e6c560aad63b09e6aaee3ccc65be462651772fe5 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Thu, 18 Oct 2007 09:12:59 +0000 Subject: Make GuidedSection library instance to follow the value of GuidedSectionExtraction protocol/PPI defined in PI spec. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4165 6f19259b-4bc3-4df7-8a09-765794883524 --- .../DxeCrc32GuidedSectionExtractLib.c | 20 +++++++++++++++++--- .../DxeCrc32GuidedSectionExtractLib.inf | 1 + 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'MdeModulePkg/Library') diff --git a/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.c b/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.c index 6deb8dc..8e2cc02 100644 --- a/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.c +++ b/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.c @@ -27,6 +27,7 @@ Abstract: #include #include #include +#include #include typedef struct { @@ -57,10 +58,16 @@ Arguments: Returns: EFI_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved. - EFI_INVALID_PARAMETER - The source data is corrupted + EFI_INVALID_PARAMETER - The source data is corrupted, or + The GUID in InputSection does not match this instance guid. --*/ { + if (!CompareGuid ( + &gEfiCrc32GuidedSectionExtractionProtocolGuid, + &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) { + return EFI_INVALID_PARAMETER; + } // // Retrieve the size and attribute of the input section data. // @@ -97,8 +104,9 @@ Arguments: Returns: - EFI_SUCCESS - Decompression is successfull - EFI_INVALID_PARAMETER - The source data is corrupted + RETURN_SUCCESS - Decompression is successfull + RETURN_INVALID_PARAMETER - The source data is corrupted, or + The GUID in InputSection does not match this instance guid. --*/ { @@ -108,6 +116,12 @@ Returns: UINT32 OutputBufferSize; VOID *DummyInterface; + if (!CompareGuid ( + &gEfiCrc32GuidedSectionExtractionProtocolGuid, + &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) { + return EFI_INVALID_PARAMETER; + } + Crc32Checksum = 0; // // Points to the Crc32 section header diff --git a/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf b/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf index d5f136d..b5cbdce 100644 --- a/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf +++ b/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf @@ -41,6 +41,7 @@ ExtractGuidedSectionLib UefiBootServicesTableLib DebugLib + BaseMemoryLib [Protocols] gEfiCrc32GuidedSectionExtractionProtocolGuid -- cgit v1.1