UINT32 CRC32Checksum;\r
} CRC32_SECTION_HEADER;\r
\r
+/**\r
+\r
+ The implementation of Crc32 guided section GetInfo() to get \r
+ size and attribute of the guided section.\r
+\r
+ @param InputSection Buffer containing the input GUIDed section to be processed.\r
+ @param OutputBufferSize The size of OutputBuffer.\r
+ @param ScratchBufferSize The size of ScratchBuffer.\r
+ @param SectionAttribute The attribute of the input guided section.\r
+\r
+ @retval EFI_SUCCESS The size of destination buffer, the size of scratch buffer and \r
+ the attribute of the input section are successull retrieved.\r
+ @retval EFI_INVALID_PARAMETER The GUID in InputSection does not match this instance guid.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
Crc32GuidedSectionGetInfo (\r
OUT UINT32 *ScratchBufferSize,\r
OUT UINT16 *SectionAttribute\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- The implementation of Crc32 guided section GetInfo().\r
-\r
-Arguments:\r
- InputSection Buffer containing the input GUIDed section to be processed. \r
- OutputBufferSize The size of OutputBuffer.\r
- ScratchBufferSize The size of ScratchBuffer.\r
- SectionAttribute The attribute of the input guided section.\r
-\r
-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, or\r
- The GUID in InputSection does not match this instance guid.\r
-\r
---*/\r
{\r
+ //\r
+ // Check whether the input guid section is recognized.\r
+ //\r
if (!CompareGuid (\r
&gEfiCrc32GuidedSectionExtractionProtocolGuid, \r
&(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+\r
+ The implementation of Crc32 Guided section extraction to get the section data.\r
+\r
+ @param InputSection Buffer containing the input GUIDed section to be processed.\r
+ @param OutputBuffer to contain the output data, which is allocated by the caller.\r
+ @param ScratchBuffer A pointer to a caller-allocated buffer for function internal use.\r
+ @param AuthenticationStatus A pointer to a caller-allocated UINT32 that indicates the\r
+ authentication status of the output buffer.\r
+\r
+ @retval EFI_SUCCESS Section Data and Auth Status is extracted successfully.\r
+ @retval EFI_INVALID_PARAMETER The GUID in InputSection does not match this instance guid.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
Crc32GuidedSectionHandler (\r
IN VOID *ScratchBuffer, OPTIONAL\r
OUT UINT32 *AuthenticationStatus\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- The implementation of Crc32 Guided section extraction.\r
-\r
-Arguments:\r
- InputSection Buffer containing the input GUIDed section to be processed. \r
- OutputBuffer OutputBuffer to point to the start of the section's contents.\r
- if guided data is not prcessed. Otherwise,\r
- OutputBuffer to contain the output data, which is allocated by the caller.\r
- ScratchBuffer A pointer to a caller-allocated buffer for function internal use. \r
- AuthenticationStatus A pointer to a caller-allocated UINT32 that indicates the\r
- authentication status of the output buffer.
-\r
-Returns:\r
-\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
EFI_STATUS Status;\r
CRC32_SECTION_HEADER *Crc32SectionHeader;\r
UINT32 OutputBufferSize;\r
VOID *DummyInterface;\r
\r
+ //\r
+ // Check whether the input guid section is recognized.\r
+ //\r
if (!CompareGuid (\r
&gEfiCrc32GuidedSectionExtractionProtocolGuid, \r
&(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
return EFI_INVALID_PARAMETER;\r
}\r
-\r
+ \r
+ //\r
+ // Init Checksum value to Zero.\r
+ //\r
Crc32Checksum = 0;\r
//\r
// Points to the Crc32 section header\r
//\r
Status = gBS->LocateProtocol (&gEfiSecurityPolicyProtocolGuid, NULL, &DummyInterface);\r
if (!EFI_ERROR (Status)) {\r
+ //\r
+ // If SecurityPolicy Protocol exist, AUTH platform override bit is set.\r
+ //\r
*AuthenticationStatus |= EFI_AUTH_STATUS_PLATFORM_OVERRIDE;\r
} else {\r
//\r
Status = gBS->CalculateCrc32 (*OutputBuffer, OutputBufferSize, &Crc32Checksum);\r
if (Status == EFI_SUCCESS) {\r
if (Crc32Checksum != Crc32SectionHeader->CRC32Checksum) {\r
+ //\r
+ // If Crc32 checksum is not matched, AUTH tested failed bit is set.\r
+ //\r
*AuthenticationStatus |= EFI_AUTH_STATUS_TEST_FAILED;\r
}\r
} else {\r
+ //\r
+ // If Crc32 checksum is not calculated, AUTH not tested bit is set.\r
+ //\r
*AuthenticationStatus |= EFI_AUTH_STATUS_NOT_TESTED;\r
}\r
}\r
return EFI_SUCCESS;\r
}\r
\r
-/**
+/**\r
Register Crc32 section handler.\r
-
+\r
@retval RETURN_SUCCESS Register successfully.\r
- @retval RETURN_OUT_OF_RESOURCES No enough memory to store this handler.
+ @retval RETURN_OUT_OF_RESOURCES No enough memory to register this handler.\r
**/\r
EFI_STATUS\r
EFIAPI\r