-/*++\r
-\r
-Copyright (c) 2006, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-Module Name:\r
-\r
- CoreSectionExtraction.c\r
- \r
-Abstract:\r
-\r
+/**@file\r
Section Extraction Protocol implementation.\r
\r
Stream database is implemented as a linked list of section streams,\r
\r
3) A support protocol is not found, and the data is not available to be read\r
without it. This results in EFI_PROTOCOL_ERROR.\r
- \r
---*/\r
+ \r
+Copyright (c) 2006 - 2007, Intel Corporation \r
+All rights reserved. This program and the accompanying materials \r
+are licensed and made available under the terms and conditions of the BSD License \r
+which accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
+ \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+**/\r
\r
#include <DxeMain.h>\r
\r
IN CORE_SECTION_CHILD_NODE *ChildNode\r
);\r
\r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-OpenSectionStream (\r
- IN EFI_SECTION_EXTRACTION_PROTOCOL *This,\r
- IN UINTN SectionStreamLength,\r
- IN VOID *SectionStream,\r
- OUT UINTN *SectionStreamHandle\r
- );\r
- \r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-GetSection (\r
- IN EFI_SECTION_EXTRACTION_PROTOCOL *This,\r
- IN UINTN SectionStreamHandle,\r
- IN EFI_SECTION_TYPE *SectionType,\r
- IN EFI_GUID *SectionDefinitionGuid,\r
- IN UINTN SectionInstance,\r
- IN VOID **Buffer,\r
- IN OUT UINTN *BufferSize,\r
- OUT UINT32 *AuthenticationStatus\r
- );\r
- \r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-CloseSectionStream (\r
- IN EFI_SECTION_EXTRACTION_PROTOCOL *This,\r
- IN UINTN StreamHandleToClose\r
- );\r
- \r
STATIC\r
EFI_STATUS\r
FindStreamNode (\r
);\r
\r
EFI_STATUS\r
+EFIAPI\r
CustomGuidedSectionExtract (\r
- IN CONST EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL *This,\r
+ IN CONST EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL *This,\r
IN CONST VOID *InputSection,\r
OUT VOID **OutputBuffer,\r
OUT UINTN *OutputSize,\r
\r
EFI_HANDLE mSectionExtractionHandle = NULL;\r
\r
-EFI_SECTION_EXTRACTION_PROTOCOL mSectionExtraction = { \r
- OpenSectionStream, \r
- GetSection, \r
- CloseSectionStream\r
-};\r
-\r
EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL mCustomGuidedSectionExtractionProtocol = {\r
CustomGuidedSectionExtract\r
};\r
EFI_GUID *ExtractHandlerGuidTable;\r
UINTN ExtractHandlerNumber;\r
\r
- //\r
- // Install SEP to a new handle\r
- //\r
- Status = CoreInstallProtocolInterface (\r
- &mSectionExtractionHandle,\r
- &gEfiSectionExtractionProtocolGuid,\r
- EFI_NATIVE_INTERFACE,\r
- &mSectionExtraction\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
//\r
// Get custom extract guided section method guid list \r
//\r
ExtractHandlerNumber = ExtractGuidedSectionGetGuidList (&ExtractHandlerGuidTable);\r
-\r
+ \r
+ Status = EFI_SUCCESS;\r
//\r
// Install custom guided extraction protocol \r
//\r
return Status;\r
}\r
\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
OpenSectionStream (\r
- IN EFI_SECTION_EXTRACTION_PROTOCOL *This,\r
IN UINTN SectionStreamLength,\r
IN VOID *SectionStream,\r
OUT UINTN *SectionStreamHandle\r
);\r
}\r
\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
GetSection (\r
- IN EFI_SECTION_EXTRACTION_PROTOCOL *This,\r
IN UINTN SectionStreamHandle,\r
IN EFI_SECTION_TYPE *SectionType,\r
IN EFI_GUID *SectionDefinitionGuid,\r
SEP member function. Retrieves requested section from section stream.\r
\r
Arguments: \r
- This: Pointer to SEP instance.\r
SectionStreamHandle: The section stream from which to extract the requested\r
section.\r
SectionType: A pointer to the type of section to search for.\r
}\r
\r
\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
CloseSectionStream (\r
- IN EFI_SECTION_EXTRACTION_PROTOCOL *This,\r
IN UINTN StreamHandleToClose\r
)\r
/*++\r
//\r
// OR in the parent stream's aggregate status.\r
//\r
- AuthenticationStatus |= Stream->AuthenticationStatus & EFI_AGGREGATE_AUTH_STATUS_ALL;\r
+ AuthenticationStatus |= Stream->AuthenticationStatus & EFI_AUTH_STATUS_ALL;\r
} else {\r
//\r
// since there's no authentication data contributed by the section,\r
// Figure out the proper authentication status\r
//\r
AuthenticationStatus = Stream->AuthenticationStatus;\r
- if (GuidedHeader->Attributes & EFI_GUIDED_SECTION_AUTH_STATUS_VALID) {\r
- //\r
- // The local status of the new stream is contained in \r
- // AuthenticaionStatus. This value needs to be ORed into the\r
- // Aggregate bits also...\r
- //\r
- \r
- //\r
- // Clear out and initialize the local status\r
- //\r
- AuthenticationStatus &= ~EFI_LOCAL_AUTH_STATUS_ALL;\r
- AuthenticationStatus |= EFI_LOCAL_AUTH_STATUS_IMAGE_SIGNED | EFI_LOCAL_AUTH_STATUS_NOT_TESTED;\r
- //\r
- // OR local status into aggregate status\r
- //\r
- AuthenticationStatus |= AuthenticationStatus >> 16;\r
- }\r
\r
SectionLength = SECTION_SIZE (GuidedHeader);\r
Status = OpenSectionStreamEx (\r
}\r
}\r
\r
- if ((AuthenticationStatus & EFI_LOCAL_AUTH_STATUS_ALL) == \r
- (EFI_LOCAL_AUTH_STATUS_IMAGE_SIGNED | EFI_LOCAL_AUTH_STATUS_NOT_TESTED)) {\r
- //\r
- // Need to register for RPN for when the required GUIDed extraction\r
- // protocol becomes available. This will enable us to refresh the\r
- // AuthenticationStatus cached in the Stream if it's ever requested\r
- // again.\r
- //\r
- CreateGuidedExtractionRpnEvent (Stream, Node);\r
- }\r
- \r
break;\r
\r
default:\r
\r
Context = RpnContext;\r
\r
- Status = CloseSectionStream (&mSectionExtraction, Context->ChildNode->EncapsulatedStreamHandle);\r
+ Status = CloseSectionStream (Context->ChildNode->EncapsulatedStreamHandle);\r
if (!EFI_ERROR (Status)) {\r
//\r
// The stream closed successfully, so re-open the stream with correct AuthenticationStatus\r
//\r
// OR in the parent stream's aggregagate status.\r
//\r
- AuthenticationStatus |= Context->ParentStream->AuthenticationStatus & EFI_AGGREGATE_AUTH_STATUS_ALL;\r
+ AuthenticationStatus |= Context->ParentStream->AuthenticationStatus & EFI_AUTH_STATUS_ALL;\r
Status = OpenSectionStreamEx (\r
NewStreamBufferSize,\r
NewStreamBuffer,\r
// If it's an encapsulating section, we close the resulting section stream.\r
// CloseSectionStream will free all memory associated with the stream.\r
//\r
- CloseSectionStream (&mSectionExtraction, ChildNode->EncapsulatedStreamHandle);\r
+ CloseSectionStream (ChildNode->EncapsulatedStreamHandle);\r
}\r
//\r
// Last, free the child node itself\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
CustomGuidedSectionExtract (\r
IN CONST EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL *This,\r
IN CONST VOID *InputSection,\r