TianoCore EDK2 master
Loading...
Searching...
No Matches
GuidedSectionExtraction.c
Go to the documentation of this file.
1
12
46RETURN_STATUS
47EFIAPI
49 IN CONST VOID *InputSection,
50 OUT UINT32 *OutputBufferSize,
51 OUT UINT32 *ScratchBufferSize,
52 OUT UINT16 *SectionAttribute
53 )
54{
55 ASSERT (InputSection != NULL);
56 ASSERT (OutputBufferSize != NULL);
57 ASSERT (ScratchBufferSize != NULL);
58 ASSERT (SectionAttribute != NULL);
59
60 if (IS_SECTION2 (InputSection)) {
61 if (!CompareGuid (
62 &gBrotliCustomDecompressGuid,
63 &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid)
64 ))
65 {
67 }
68
69 *SectionAttribute = ((EFI_GUID_DEFINED_SECTION2 *)InputSection)->Attributes;
70
72 (UINT8 *)InputSection + ((EFI_GUID_DEFINED_SECTION2 *)InputSection)->DataOffset,
73 SECTION2_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION2 *)InputSection)->DataOffset,
74 OutputBufferSize,
75 ScratchBufferSize
76 );
77 } else {
78 if (!CompareGuid (
79 &gBrotliCustomDecompressGuid,
80 &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid)
81 ))
82 {
84 }
85
86 *SectionAttribute = ((EFI_GUID_DEFINED_SECTION *)InputSection)->Attributes;
87
89 (UINT8 *)InputSection + ((EFI_GUID_DEFINED_SECTION *)InputSection)->DataOffset,
90 SECTION_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION *)InputSection)->DataOffset,
91 OutputBufferSize,
92 ScratchBufferSize
93 );
94 }
95}
96
129RETURN_STATUS
130EFIAPI
132 IN CONST VOID *InputSection,
133 OUT VOID **OutputBuffer,
134 OUT VOID *ScratchBuffer OPTIONAL,
135 OUT UINT32 *AuthenticationStatus
136 )
137{
138 ASSERT (OutputBuffer != NULL);
139 ASSERT (InputSection != NULL);
140
141 if (IS_SECTION2 (InputSection)) {
142 if (!CompareGuid (
143 &gBrotliCustomDecompressGuid,
144 &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid)
145 ))
146 {
148 }
149
150 //
151 // Authentication is set to Zero, which may be ignored.
152 //
153 *AuthenticationStatus = 0;
154
155 return BrotliUefiDecompress (
156 (UINT8 *)InputSection + ((EFI_GUID_DEFINED_SECTION2 *)InputSection)->DataOffset,
157 SECTION2_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION2 *)InputSection)->DataOffset,
158 *OutputBuffer,
159 ScratchBuffer
160 );
161 } else {
162 if (!CompareGuid (
163 &gBrotliCustomDecompressGuid,
164 &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid)
165 ))
166 {
168 }
169
170 //
171 // Authentication is set to Zero, which may be ignored.
172 //
173 *AuthenticationStatus = 0;
174
175 return BrotliUefiDecompress (
176 (UINT8 *)InputSection + ((EFI_GUID_DEFINED_SECTION *)InputSection)->DataOffset,
177 SECTION_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION *)InputSection)->DataOffset,
178 *OutputBuffer,
179 ScratchBuffer
180 );
181 }
182}
183
191EFIAPI
193 VOID
194 )
195{
197 &gBrotliCustomDecompressGuid,
200 );
201}
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
Definition: MemLibGuid.c:73
RETURN_STATUS EFIAPI BrotliGuidedSectionGetInfo(IN CONST VOID *InputSection, OUT UINT32 *OutputBufferSize, OUT UINT32 *ScratchBufferSize, OUT UINT16 *SectionAttribute)
EFI_STATUS EFIAPI BrotliDecompressLibConstructor(VOID)
RETURN_STATUS EFIAPI BrotliGuidedSectionExtraction(IN CONST VOID *InputSection, OUT VOID **OutputBuffer, OUT VOID *ScratchBuffer OPTIONAL, OUT UINT32 *AuthenticationStatus)
EFI_STATUS EFIAPI BrotliUefiDecompressGetInfo(IN CONST VOID *Source, IN UINT32 SourceSize, OUT UINT32 *DestinationSize, OUT UINT32 *ScratchSize)
EFI_STATUS EFIAPI BrotliUefiDecompress(IN CONST VOID *Source, IN UINTN SourceSize, IN OUT VOID *Destination, IN OUT VOID *Scratch)
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define RETURN_INVALID_PARAMETER
Definition: Base.h:1076
#define SECTION_SIZE(SectionHeaderPtr)
RETURN_STATUS EFIAPI ExtractGuidedSectionRegisterHandlers(IN CONST GUID *SectionGuid, IN EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER GetInfoHandler, IN EXTRACT_GUIDED_SECTION_DECODE_HANDLER DecodeHandler)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29