summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Library
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2008-07-09 13:33:20 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2008-07-09 13:33:20 +0000
commit5d69642deb142022293c83db9fb3739a91489fb3 (patch)
tree79b7097a27506832d1c93664b53f70bf41d1b1c4 /MdeModulePkg/Library
parentc03b1ae778b00c0190c53800c84ef02426ad29cb (diff)
downloadedk2-platforms-5d69642deb142022293c83db9fb3739a91489fb3.tar.xz
Code scrub for the Capsule, SecurityStub, and Crc32 library instance.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5441 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Library')
-rw-r--r--MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.c10
-rw-r--r--MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.c96
-rw-r--r--MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf5
-rw-r--r--MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.c6
-rw-r--r--MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.inf6
5 files changed, 62 insertions, 61 deletions
diff --git a/MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.c b/MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.c
index 1b88b3a612..66546f12f8 100644
--- a/MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.c
+++ b/MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.c
@@ -1,7 +1,7 @@
-/**@file
- Capsule Library Null instance.
+/** @file
+ Null Dxe Capsule Library instance.
-Copyright (c) 2007 Intel Corporation
+Copyright (c) 2007 - 2008 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
@@ -15,11 +15,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/CapsuleLib.h>
/**
- Those capsules supported by the firmwares.
+ Check those capsules are supported by the firmwares.
@param CapsuleHeader Point to the UEFI capsule image to be checked.
- @retval EFI_SUCESS Input capsule is supported by firmware.
@retval EFI_UNSUPPORTED Input capsule is not supported by the firmware.
**/
EFI_STATUS
@@ -36,7 +35,6 @@ SupportCapsuleImage (
@param CapsuleHeader Point to the UEFI capsule image to be processed.
- @retval EFI_SUCESS Process Capsule Image successfully.
@retval EFI_UNSUPPORTED Capsule image is not supported by the firmware.
**/
EFI_STATUS
diff --git a/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.c b/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.c
index 167f281365..99f7285108 100644
--- a/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.c
+++ b/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.c
@@ -27,6 +27,21 @@ typedef struct {
UINT32 CRC32Checksum;
} CRC32_SECTION_HEADER;
+/**
+
+ The implementation of Crc32 guided section GetInfo() to get
+ size and attribute of the guided section.
+
+ @param InputSection Buffer containing the input GUIDed section to be processed.
+ @param OutputBufferSize The size of OutputBuffer.
+ @param ScratchBufferSize The size of ScratchBuffer.
+ @param SectionAttribute The attribute of the input guided section.
+
+ @retval EFI_SUCCESS The size of destination buffer, the size of scratch buffer and
+ the attribute of the input section are successull retrieved.
+ @retval EFI_INVALID_PARAMETER The GUID in InputSection does not match this instance guid.
+
+**/
EFI_STATUS
EFIAPI
Crc32GuidedSectionGetInfo (
@@ -35,26 +50,10 @@ Crc32GuidedSectionGetInfo (
OUT UINT32 *ScratchBufferSize,
OUT UINT16 *SectionAttribute
)
-/*++
-
-Routine Description:
-
- The implementation of Crc32 guided section GetInfo().
-
-Arguments:
- InputSection Buffer containing the input GUIDed section to be processed.
- OutputBufferSize The size of OutputBuffer.
- ScratchBufferSize The size of ScratchBuffer.
- SectionAttribute The attribute of the input guided section.
-
-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, or
- The GUID in InputSection does not match this instance guid.
-
---*/
{
+ //
+ // Check whether the input guid section is recognized.
+ //
if (!CompareGuid (
&gEfiCrc32GuidedSectionExtractionProtocolGuid,
&(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
@@ -71,6 +70,20 @@ Returns:
return EFI_SUCCESS;
}
+/**
+
+ The implementation of Crc32 Guided section extraction to get the section data.
+
+ @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 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.
+
+ @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.
+
+**/
EFI_STATUS
EFIAPI
Crc32GuidedSectionHandler (
@@ -79,28 +92,6 @@ Crc32GuidedSectionHandler (
IN VOID *ScratchBuffer, OPTIONAL
OUT UINT32 *AuthenticationStatus
)
-/*++
-
-Routine Description:
-
- The implementation of Crc32 Guided section extraction.
-
-Arguments:
- InputSection Buffer containing the input GUIDed section to be processed.
- OutputBuffer OutputBuffer to point to the start of the section's contents.
- if guided data is not prcessed. Otherwise,
- OutputBuffer to contain the output data, which is allocated by the caller.
- ScratchBuffer A pointer to a caller-allocated buffer for function internal use.
- AuthenticationStatus A pointer to a caller-allocated UINT32 that indicates the
- authentication status of the output buffer.
-
-Returns:
-
- RETURN_SUCCESS - Decompression is successfull
- RETURN_INVALID_PARAMETER - The source data is corrupted, or
- The GUID in InputSection does not match this instance guid.
-
---*/
{
EFI_STATUS Status;
CRC32_SECTION_HEADER *Crc32SectionHeader;
@@ -108,12 +99,18 @@ Returns:
UINT32 OutputBufferSize;
VOID *DummyInterface;
+ //
+ // Check whether the input guid section is recognized.
+ //
if (!CompareGuid (
&gEfiCrc32GuidedSectionExtractionProtocolGuid,
&(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
return EFI_INVALID_PARAMETER;
}
-
+
+ //
+ // Init Checksum value to Zero.
+ //
Crc32Checksum = 0;
//
// Points to the Crc32 section header
@@ -134,6 +131,9 @@ Returns:
//
Status = gBS->LocateProtocol (&gEfiSecurityPolicyProtocolGuid, NULL, &DummyInterface);
if (!EFI_ERROR (Status)) {
+ //
+ // If SecurityPolicy Protocol exist, AUTH platform override bit is set.
+ //
*AuthenticationStatus |= EFI_AUTH_STATUS_PLATFORM_OVERRIDE;
} else {
//
@@ -142,9 +142,15 @@ Returns:
Status = gBS->CalculateCrc32 (*OutputBuffer, OutputBufferSize, &Crc32Checksum);
if (Status == EFI_SUCCESS) {
if (Crc32Checksum != Crc32SectionHeader->CRC32Checksum) {
+ //
+ // If Crc32 checksum is not matched, AUTH tested failed bit is set.
+ //
*AuthenticationStatus |= EFI_AUTH_STATUS_TEST_FAILED;
}
} else {
+ //
+ // If Crc32 checksum is not calculated, AUTH not tested bit is set.
+ //
*AuthenticationStatus |= EFI_AUTH_STATUS_NOT_TESTED;
}
}
@@ -152,11 +158,11 @@ Returns:
return EFI_SUCCESS;
}
-/**
+/**
Register Crc32 section handler.
-
+
@retval RETURN_SUCCESS Register successfully.
- @retval RETURN_OUT_OF_RESOURCES No enough memory to store this handler.
+ @retval RETURN_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 b5cbdcecf1..170d0bed43 100644
--- a/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
+++ b/MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
@@ -1,7 +1,7 @@
#/** @file
-# Component description file for Crc32SectionExtract library.
+# Crc32SectionExtract library instance registers Crc32 handler into ExtractGuidedSectionLib.
#
-# Copyright (c) 2006 - 2007, Intel Corporation
+# Copyright (c) 2006 - 2008, 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
@@ -19,6 +19,7 @@
FILE_GUID = 387A2490-81FC-4E7C-8E0A-3E58C30FCD0B
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
+ LIBRARY_CLASS = NULL|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
diff --git a/MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.c b/MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.c
index 5e63e1ede9..40acc57c95 100644
--- a/MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.c
+++ b/MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.c
@@ -1,5 +1,6 @@
/** @file
- Recovery Library. This library class defines a set of methods related do recovery.
+ Null Recovery Library instance.
+ This library class defines a set of methods related do recovery.
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
@@ -16,8 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
/**
Calling this function causes the system do recovery.
- @retval EFI_SUCESS Sucess to do recovery.
- @retval Others Fail to do recovery.
+ @retval EFI_UNSUPPORTED Recovery is not supported.
**/
EFI_STATUS
EFIAPI
diff --git a/MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.inf b/MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.inf
index 404eadd676..10ea0cdbea 100644
--- a/MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.inf
+++ b/MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.inf
@@ -1,6 +1,6 @@
#/** @file
#
-# Recovery for PEIM
+# Null Recovery library instance for PEIM module
#
# Copyright (c) 2006 - 2008, Intel Corporation. <BR>
# All rights reserved. This program and the accompanying materials
@@ -37,8 +37,4 @@
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
-[LibraryClasses]
- BaseLib
-
-
\ No newline at end of file