From 109e9a6156b2c9540fd4b1b6ce17ac5be1fa03c4 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Sun, 4 Jan 2009 03:20:55 +0000 Subject: Code scrub for the following drivers and librarys. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7172 6f19259b-4bc3-4df7-8a09-765794883524 --- .../DxeCrc32GuidedSectionExtractLib.c | 32 ++++++++++++++-------- .../DxeCrc32GuidedSectionExtractLib.inf | 10 ++++--- 2 files changed, 26 insertions(+), 16 deletions(-) (limited to 'MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib') diff --git a/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.c b/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.c index e664428d0e..b87af37a91 100644 --- a/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.c +++ b/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.c @@ -1,7 +1,8 @@ /** @file - Implements CRC32 guided section handler to parse CRC32 encapsulation section, - extract data and authenticate 32 bit CRC value. + This library registers CRC32 guided section handler + to parse CRC32 encapsulation section and extract raw data. + It uses UEFI boot service CalculateCrc32 to authenticate 32 bit CRC value. Copyright (c) 2007 - 2008, Intel Corporation All rights reserved. This program and the accompanying materials @@ -24,15 +25,19 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define EFI_SECITON_SIZE_MASK 0x00ffffff +/// +/// CRC32 Guided Section header +/// typedef struct { - EFI_GUID_DEFINED_SECTION GuidedSectionHeader; - UINT32 CRC32Checksum; + EFI_GUID_DEFINED_SECTION GuidedSectionHeader; ///< EFI guided section header + UINT32 CRC32Checksum; ///< 32bit CRC check sum } CRC32_SECTION_HEADER; /** - The implementation of Crc32 guided section GetInfo() to get - size and attribute of the guided section. + GetInfo gets raw data size and attribute of the input guided section. + It first checks whether the input guid section is supported. + If not, EFI_INVALID_PARAMETER will return. @param InputSection Buffer containing the input GUIDed section to be processed. @param OutputBufferSize The size of OutputBuffer. @@ -74,13 +79,16 @@ Crc32GuidedSectionGetInfo ( /** - The implementation of Crc32 Guided section extraction to get the section data. + Extraction handler tries to extract raw data from the input guided section. + It also does authentication check for 32bit CRC value in the input guided section. + It first checks whether the input guid section is supported. + If not, EFI_INVALID_PARAMETER will return. @param InputSection Buffer containing the input GUIDed section to be processed. - @param OutputBuffer to contain the output data, which is allocated by the caller. + @param OutputBuffer Buffer to contain the output raw data allocated by the caller. @param ScratchBuffer A pointer to a caller-allocated buffer for function internal use. @param AuthenticationStatus A pointer to a caller-allocated UINT32 that indicates the - authentication status of the output buffer. + authentication status of the output buffer. @retval EFI_SUCCESS Section Data and Auth Status is extracted successfully. @retval EFI_INVALID_PARAMETER The GUID in InputSection does not match this instance guid. @@ -161,13 +169,13 @@ Crc32GuidedSectionHandler ( } /** - Register Crc32 section handler. + Register the handler to extract CRC32 guided section. @param ImageHandle ImageHandle of the loaded driver. @param SystemTable Pointer to the EFI System Table. - @retval RETURN_SUCCESS Register successfully. - @retval RETURN_OUT_OF_RESOURCES No enough memory to register this handler. + @retval EFI_SUCCESS Register successfully. + @retval EFI_OUT_OF_RESOURCES No enough memory to register this handler. **/ EFI_STATUS EFIAPI diff --git a/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf b/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf index 360ee66540..f13098f8d3 100644 --- a/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf +++ b/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf @@ -1,5 +1,8 @@ #/** @file -# Crc32SectionExtract library instance registers Crc32 handler into ExtractGuidedSectionLib. +# This library doesn't produce any library class. In its constructor function, +# it uses ExtractGuidedSectionLib service to registers CRC32 guided section handler +# that parses CRC32 encapsulation section and extracts raw data. +# It uses UEFI boot service CalculateCrc32 to authenticate 32 bit CRC value. # # Copyright (c) 2006 - 2008, Intel Corporation # @@ -10,7 +13,6 @@ # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # -# #**/ [Defines] @@ -43,6 +45,6 @@ BaseMemoryLib [Protocols] - gEfiCrc32GuidedSectionExtractionProtocolGuid - gEfiSecurityPolicyProtocolGuid + gEfiCrc32GuidedSectionExtractionProtocolGuid # ALWAYS CONSUMED used as Guid, not protocol service + gEfiSecurityPolicyProtocolGuid # ALWAYS CONSUMED \ No newline at end of file -- cgit v1.2.3