]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Make GuidedSection library instance to follow the value of GuidedSectionExtraction...
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 18 Oct 2007 09:12:59 +0000 (09:12 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 18 Oct 2007 09:12:59 +0000 (09:12 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4165 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c
IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLibInternals.h
MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.c
MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c
MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c

index 14d549d4d6bee35da166b1f4939f4b9789b00e0c..a489288761685a082c67559075571d8a072c17d6 100644 (file)
@@ -796,6 +796,7 @@ Returns:
 \r
   RETURN_SUCCESS           - The size of destination buffer and the size of scratch buffer are successull retrieved.\r
   RETURN_INVALID_PARAMETER - The source data is corrupted\r
+                             The GUID in InputSection does not match this instance guid.\r
 \r
 --*/\r
 {\r
@@ -804,6 +805,12 @@ Returns:
   if (InputSection == NULL) {\r
     return RETURN_INVALID_PARAMETER;\r
   }\r
+\r
+  if (!CompareGuid (\r
+        &gTianoCustomDecompressGuid, \r
+        &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
+    return RETURN_INVALID_PARAMETER;\r
+  }\r
   //\r
   // Get guid attribute of guid section. \r
   //\r
@@ -846,7 +853,8 @@ Arguments:
 Returns:\r
 \r
   RETURN_SUCCESS           - Decompression is successfull\r
-  RETURN_INVALID_PARAMETER - The source data is corrupted\r
+  RETURN_INVALID_PARAMETER - The source data is corrupted, or\r
+                             The GUID in InputSection does not match this instance guid.\r
 \r
 --*/\r
 {\r
@@ -854,7 +862,14 @@ Returns:
 \r
   if (InputSection == NULL) {\r
     return RETURN_INVALID_PARAMETER;\r
-  }  \r
+  }\r
+\r
+  if (!CompareGuid (\r
+        &gTianoCustomDecompressGuid, \r
+        &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
+    return RETURN_INVALID_PARAMETER;\r
+  }\r
+\r
   //\r
   // Set Authentication to Zero.\r
   //\r
index 29995387b49835f4d58b1c66ee2a173bd2913009..c83d79ef0f925f1d2c586fe0196308b7d638310b 100644 (file)
@@ -21,6 +21,7 @@
 \r
 #include <Library/UefiDecompressLib.h>\r
 #include <Library/DebugLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
 #include <Library/ExtractGuidedSectionLib.h>\r
 \r
 //\r
index 6deb8dc6d26bbcbcfac6035628b0bea35c04fcd7..8e2cc0201f55d1a4a41d5eb3733ed7b2986a85de 100644 (file)
@@ -27,6 +27,7 @@ Abstract:
 #include <Protocol/SecurityPolicy.h>\r
 #include <Library/ExtractGuidedSectionLib.h>\r
 #include <Library/DebugLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 \r
 typedef struct {\r
@@ -57,10 +58,16 @@ Arguments:
 Returns:\r
 \r
   EFI_SUCCESS           - The size of destination buffer and the size of scratch buffer are successull retrieved.\r
-  EFI_INVALID_PARAMETER - The source data is corrupted\r
+  EFI_INVALID_PARAMETER - The source data is corrupted, or\r
+                          The GUID in InputSection does not match this instance guid.\r
 \r
 --*/\r
 {\r
+  if (!CompareGuid (\r
+        &gEfiCrc32GuidedSectionExtractionProtocolGuid, \r
+        &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
   //\r
   // Retrieve the size and attribute of the input section data.\r
   //\r
@@ -97,8 +104,9 @@ Arguments:
 \r
 Returns:\r
 \r
-  EFI_SUCCESS           - Decompression is successfull\r
-  EFI_INVALID_PARAMETER - The source data is corrupted\r
+  RETURN_SUCCESS           - Decompression is successfull\r
+  RETURN_INVALID_PARAMETER - The source data is corrupted, or\r
+                             The GUID in InputSection does not match this instance guid.\r
 \r
 --*/\r
 {\r
@@ -108,6 +116,12 @@ Returns:
   UINT32                    OutputBufferSize;\r
   VOID                      *DummyInterface;\r
 \r
+  if (!CompareGuid (\r
+        &gEfiCrc32GuidedSectionExtractionProtocolGuid, \r
+        &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
   Crc32Checksum = 0;\r
   //\r
   // Points to the Crc32 section header\r
index d5f136de4a92c2a44866440bfbcf7cd31a2af80c..b5cbdcecf1ad8ce150c4530a3506f93d471b5301 100644 (file)
@@ -41,6 +41,7 @@
   ExtractGuidedSectionLib\r
   UefiBootServicesTableLib\r
   DebugLib\r
+  BaseMemoryLib\r
 \r
 [Protocols]\r
   gEfiCrc32GuidedSectionExtractionProtocolGuid\r
index 350aec59b7ab59ddbb353e3bb132b895ea649a7e..164691389b3194c9272ecad4390af0d1a19465b3 100644 (file)
@@ -141,7 +141,7 @@ ExtractGuidedSectionRegisterHandlers (
   Get information from the guided section. This function first gets the guid value\r
   from guided section header, then match this guid in the registered extract Handler list\r
   to its corresponding getinfo Handler. \r
-  If not found, RETURN_UNSUPPORTED will be return. \r
+  If not found, RETURN_INVALID_PARAMETER will be return. \r
   If found, it will call the getinfo Handler to get the required size and attribute.\r
 \r
   It will ASSERT () if the pointer to OutputBufferSize is NULL.\r
@@ -154,8 +154,8 @@ ExtractGuidedSectionRegisterHandlers (
   @param[out] SectionAttribute      The attribute of the input guided section.\r
 
   @retval  RETURN_SUCCESS           Get the required information successfully.\r
-  @retval  RETURN_UNSUPPORTED       Guided section data is not supported.\r
-  @retval  RETURN_INVALID_PARAMETER The input data can't be parsed correctly.\r
+  @retval  RETURN_INVALID_PARAMETER The input data can't be parsed correctly. \r
+                                    The GUID in InputSection does not match any registered guid list.\r
 \r
 **/\r
 RETURN_STATUS\r
@@ -190,7 +190,7 @@ ExtractGuidedSectionGetInfo (
   // Not found, the input guided section is not supported. \r
   //\r
   if (Index == mNumberOfExtractHandler) {\r
-    return RETURN_UNSUPPORTED;\r
+    return RETURN_INVALID_PARAMETER;\r
   }\r
 \r
   //\r
@@ -208,7 +208,7 @@ ExtractGuidedSectionGetInfo (
   Extract data from the guided section. This function first gets the guid value\r
   from guided section header, then match this guid in the registered extract Handler list\r
   to its corresponding extract Handler. \r
-  If not found, RETURN_UNSUPPORTED will be return. \r
+  If not found, RETURN_INVALID_PARAMETER will be return. \r
   If found, it will call this extract Handler to get output data and AuthenticationStatus.
 \r
   It will ASSERT () if the pointer to OutputBuffer is NULL.\r
@@ -225,8 +225,8 @@ ExtractGuidedSectionGetInfo (
                             authentication status of the output buffer. 
 
   @retval  RETURN_SUCCESS           Get the output data, size and AuthenticationStatus successfully.\r
-  @retval  RETURN_UNSUPPORTED       Guided section data is not supported to be decoded.\r
-  @retval  RETURN_INVALID_PARAMETER The input data can't be parsed correctly.\r
+  @retval  RETURN_INVALID_PARAMETER The input data can't be parsed correctly. \r
+                                    The GUID in InputSection does not match any registered guid.\r
 
 **/\r
 RETURN_STATUS\r
@@ -260,7 +260,7 @@ ExtractGuidedSectionDecode (
   // Not found, the input guided section is not supported. \r
   //\r
   if (Index == mNumberOfExtractHandler) {\r
-    return RETURN_UNSUPPORTED;\r
+    return RETURN_INVALID_PARAMETER;\r
   }\r
 \r
   //\r
index 51cf29d1f422e70ed56b5c62e1bf7350b38636a3..bbe6b508727eca6cfb938edd77f0f2565cd499cd 100644 (file)
@@ -188,7 +188,7 @@ ExtractGuidedSectionRegisterHandlers (
   Get information from the guided section. This function first gets the guid value\r
   from guided section header, then match this guid in the registered extract Handler list\r
   to its corresponding getinfo Handler. \r
-  If not found, RETURN_UNSUPPORTED will be return. \r
+  If not found, RETURN_INVALID_PARAMETER will be return. \r
   If found, it will call the getinfo Handler to get the required size and attribute.\r
 \r
   It will ASSERT () if the pointer to OutputBufferSize is NULL.\r
@@ -201,8 +201,8 @@ ExtractGuidedSectionRegisterHandlers (
   @param[out] SectionAttribute      The attribute of the input guided section.\r
 
   @retval  RETURN_SUCCESS           Get the required information successfully.\r
-  @retval  RETURN_UNSUPPORTED       Guided section data is not supported.\r
-  @retval  RETURN_INVALID_PARAMETER The input data can't be parsed correctly.\r
+  @retval  RETURN_INVALID_PARAMETER The input data can't be parsed correctly. \r
+                                    The GUID in InputSection does not match any registered guid list.\r
 \r
 **/\r
 RETURN_STATUS\r
@@ -250,7 +250,7 @@ ExtractGuidedSectionGetInfo (
   // Not found, the input guided section is not supported. \r
   //\r
   if (Index == HandlerInfo->NumberOfExtractHandler) {\r
-    return RETURN_UNSUPPORTED;\r
+    return RETURN_INVALID_PARAMETER;\r
   }\r
 \r
   //\r
@@ -268,7 +268,7 @@ ExtractGuidedSectionGetInfo (
   Extract data from the guided section. This function first gets the guid value\r
   from guided section header, then match this guid in the registered extract Handler list\r
   to its corresponding extract Handler. \r
-  If not found, RETURN_UNSUPPORTED will be return. \r
+  If not found, RETURN_INVALID_PARAMETER will be return. \r
   If found, it will call this extract Handler to get output data and AuthenticationStatus.
 \r
   It will ASSERT () if the pointer to OutputBuffer is NULL.\r
@@ -285,8 +285,8 @@ ExtractGuidedSectionGetInfo (
                             authentication status of the output buffer. 
 
   @retval  RETURN_SUCCESS           Get the output data, size and AuthenticationStatus successfully.\r
-  @retval  RETURN_UNSUPPORTED       Guided section data is not supported to be decoded.\r
-  @retval  RETURN_INVALID_PARAMETER The input data can't be parsed correctly.\r
+  @retval  RETURN_INVALID_PARAMETER The input data can't be parsed correctly. \r
+                                    The GUID in InputSection does not match any registered guid list.\r
 
 **/\r
 RETURN_STATUS\r
@@ -327,7 +327,7 @@ ExtractGuidedSectionDecode (
   // Not found, the input guided section is not supported. \r
   //\r
   if (Index == HandlerInfo->NumberOfExtractHandler) {\r
-    return RETURN_UNSUPPORTED;\r
+    return RETURN_INVALID_PARAMETER;\r
   }\r
 \r
   //\r