1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
/** @file
Extract Guided Section Library class
Copyright (c) 2007, 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
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
ExtractGuidedSectionLib.h
**/
#ifndef __EXTRACT_GUIDED_SECTION_H__
#define __EXTRACT_GUIDED_SECTION_H__
/**
Get information Handler for the input guided section data.
It will ASSERT () if the pointer to OutputBufferSize is NULL.
It will ASSERT () if the pointer to ScratchBufferSize is NULL.
It will ASSERT () if the pointer to SectionAttribute is NULL.
@param[in] InputSection Buffer containing the input GUIDed section to be processed.
@param[out] OutputBufferSize The size of OutputBuffer.
@param[out] ScratchBufferSize The size of ScratchBuffer.
@param[out] SectionAttribute The attribute of the input guided section.
@retval RETURN_SUCCESS Get the required information successfully.
@retval RETURN_INVALID_PARAMETER The input data can't be parsed correctly.
**/
typedef
RETURN_STATUS
(EFIAPI *EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER)(
IN CONST VOID *InputSection,
OUT UINT32 *OutputBufferSize,
OUT UINT32 *ScratchBufferSize,
OUT UINT16 *SectionAttribute
);
/**
Extract data Handler for one specific guided section.
It will ASSERT () if the pointer to OutputBuffer is NULL.
It will ASSERT () if the pointer to AuthenticationStatus is NULL.
@param[in] InputSection Buffer containing the input GUIDed section to be processed.
@param[out] 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.
@param[out] ScratchBuffer A pointer to a caller-allocated buffer for function internal use.
@param[out] AuthenticationStatus
A pointer to a caller-allocated UINT32 that indicates the
authentication status of the output buffer.
@retval RETURN_SUCCESS Get the output data and AuthenticationStatus successfully.
@retval RETURN_INVALID_PARAMETER The input data can't be parsed correctly.
**/
typedef
RETURN_STATUS
(EFIAPI *EXTRACT_GUIDED_SECTION_DECODE_HANDLER)(
IN CONST VOID *InputSection,
OUT VOID **OutputBuffer,
IN VOID *ScratchBuffer, OPTIONAL
OUT UINT32 *AuthenticationStatus
);
/**
Register Guided Section Extract and GetInfo Handler.
@param[in] SectionGuid The guid matches this Extraction Handler.
@param[in] GetInfoHandler Handler to get info from guided section.
@param[in] DecodeHandler Handler to extract guided section.
@retval RETURN_SUCCESS Register Guided Section Extract Handler successfully.
@retval RETURN_OUT_OF_RESOURCES Resource is not enough to register new Handler.
@retval RETURN_INVALID_PARAMETER Input pointer to Guid value is not valid.
**/
RETURN_STATUS
EFIAPI
ExtractGuidedSectionRegisterHandlers (
IN CONST GUID *SectionGuid,
IN EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER GetInfoHandler,
IN EXTRACT_GUIDED_SECTION_DECODE_HANDLER DecodeHandler
);
/**
Get the supported exract guided section Handler guid table, which is maintained
by library. The caller can directly get this guid table pointer
without responsibility to allocate or free this table buffer.
It will ASSERT () if ExtractHandlerGuidTable = NULL.
@param[in, out] ExtractHandlerGuidTable The extract Handler guid pointer list.
@retval return the number of the supported extract guided Handler.
**/
UINTN
EFIAPI
ExtractGuidedSectionGetGuidList (
IN OUT GUID **ExtractHandlerGuidTable
);
/**
Get information from the guided section. This function first gets the guid value
from guided section header, then match this guid in the registered extract Handler list
to its corresponding getinfo Handler.
If not found, RETURN_UNSUPPORTED will be return.
If found, it will call the getinfo Handler to get the required size and attribute.
It will ASSERT () if the pointer to OutputBufferSize is NULL.
It will ASSERT () if the pointer to ScratchBufferSize is NULL.
It will ASSERT () if the pointer to SectionAttribute is NULL.
@param[in] InputSection Buffer containing the input GUIDed section to be processed.
@param[out] OutputBufferSize The size of OutputBuffer.
@param[out] ScratchBufferSize The size of ScratchBuffer.
@param[out] SectionAttribute The attribute of the input guided section.
@retval RETURN_SUCCESS Get the required information successfully.
@retval RETURN_UNSUPPORTED Guided section data is not supported.
@retval RETURN_INVALID_PARAMETER The input data can't be parsed correctly.
**/
RETURN_STATUS
EFIAPI
ExtractGuidedSectionGetInfo (
IN CONST VOID *InputSection,
OUT UINT32 *OutputBufferSize,
OUT UINT32 *ScratchBufferSize,
OUT UINT16 *SectionAttribute
);
/**
Extract data from the guided section. This function first gets the guid value
from guided section header, then match this guid in the registered extract Handler list
to its corresponding extract Handler.
If not found, RETURN_UNSUPPORTED will be return.
If found, it will call this extract Handler to get output data and AuthenticationStatus.
It will ASSERT () if the pointer to OutputBuffer is NULL.
It will ASSERT () if the pointer to AuthenticationStatus is NULL.
@param[in] InputSection Buffer containing the input GUIDed section to be processed.
@param[out] OutputBuffer OutputBuffer to point the start of the section's contents
if guided data is not required prcessing. Otherwise,
OutputBuffer to contain the output data, which is
allocated by the caller.
@param[out] ScratchBuffer A pointer to a caller-allocated buffer for function internal use.
@param[out] AuthenticationStatus
A pointer to a caller-allocated UINT32 that indicates the
authentication status of the output buffer.
@retval RETURN_SUCCESS Get the output data and AuthenticationStatus successfully.
@retval RETURN_UNSUPPORTED Guided section data is not supported to be decoded.
@retval RETURN_INVALID_PARAMETER The input data can't be parsed correctly.
**/
RETURN_STATUS
EFIAPI
ExtractGuidedSectionDecode (
IN CONST VOID *InputSection,
OUT VOID **OutputBuffer,
OUT VOID *ScratchBuffer, OPTIONAL
OUT UINT32 *AuthenticationStatus
);
#endif
|