]> git.proxmox.com Git - mirror_edk2.git/blob - NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigImpl.h
ArmPkg: only attempt buildin MmCommunicationDxe for AArch64
[mirror_edk2.git] / NetworkPkg / TlsAuthConfigDxe / TlsAuthConfigImpl.h
1 /** @file
2 Header file of Miscellaneous Routines for TlsAuthConfigDxe driver.
3
4 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #ifndef __TLS_AUTH_CONFIG_IMPL_H__
11 #define __TLS_AUTH_CONFIG_IMPL_H__
12
13 #include <Uefi.h>
14
15 #include <Protocol/HiiConfigAccess.h>
16 #include <Protocol/SimpleFileSystem.h>
17 #include <Protocol/HiiPopup.h>
18
19 //
20 // Libraries
21 //
22 #include <Library/UefiBootServicesTableLib.h>
23 #include <Library/UefiRuntimeServicesTableLib.h>
24 #include <Library/MemoryAllocationLib.h>
25 #include <Library/BaseMemoryLib.h>
26 #include <Library/BaseLib.h>
27 #include <Library/UefiLib.h>
28 #include <Library/DebugLib.h>
29 #include <Library/DevicePathLib.h>
30 #include <Library/HiiLib.h>
31 #include <Library/UefiHiiServicesLib.h>
32 #include <Library/FileExplorerLib.h>
33 #include <Library/PrintLib.h>
34
35 #include <Guid/MdeModuleHii.h>
36 #include <Guid/ImageAuthentication.h>
37 #include <Guid/TlsAuthentication.h>
38
39
40 //
41 // Include files with function prototypes
42 //
43 #include "TlsAuthConfigNvData.h"
44
45 extern UINT8 TlsAuthConfigDxeStrings[];
46 extern UINT8 TlsAuthConfigVfrBin[];
47
48 #define TLS_AUTH_CONFIG_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('T', 'A', 'C', 'D')
49 #define TLS_AUTH_CONFIG_PRIVATE_FROM_THIS(a) CR (a, TLS_AUTH_CONFIG_PRIVATE_DATA, ConfigAccess, TLS_AUTH_CONFIG_PRIVATE_DATA_SIGNATURE)
50
51 #define TLS_AUTH_CONFIG_VAR_BASE_ATTR (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS)
52
53 typedef struct _TLS_AUTH_CONFIG_PRIVATE_DATA TLS_AUTH_CONFIG_PRIVATE_DATA;
54 typedef struct _TLS_AUTH_CONFIG_FILE_CONTEXT TLS_AUTH_CONFIG_FILE_CONTEXT;
55
56 ///
57 /// HII specific Vendor Device Path definition.
58 ///
59 typedef struct {
60 VENDOR_DEVICE_PATH VendorDevicePath;
61 EFI_DEVICE_PATH_PROTOCOL End;
62 } HII_VENDOR_DEVICE_PATH;
63
64 struct _TLS_AUTH_CONFIG_FILE_CONTEXT {
65 EFI_FILE_HANDLE FHandle;
66 UINT16 *FileName;
67 };
68
69 struct _TLS_AUTH_CONFIG_PRIVATE_DATA {
70 UINTN Signature;
71
72 EFI_HANDLE DriverHandle;
73 EFI_HII_HANDLE RegisteredHandle;
74 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
75 TLS_AUTH_CONFIG_IFR_NVDATA TlsAuthConfigNvData;
76
77 TLS_AUTH_CONFIG_FILE_CONTEXT *FileContext;
78
79 EFI_GUID *CertGuid;
80 };
81
82 /**
83 Unload the configuration form, this includes: delete all the configuration
84 entries, uninstall the form callback protocol, and free the resources used.
85 The form will only be unload completely when both IP4 and IP6 stack are stopped.
86
87 @param[in] Private Pointer to the driver private data.
88
89 @retval EFI_SUCCESS The configuration form is unloaded.
90 @retval Others Failed to unload the form.
91
92 **/
93 EFI_STATUS
94 TlsAuthConfigFormUnload (
95 IN TLS_AUTH_CONFIG_PRIVATE_DATA *Private
96 );
97
98 /**
99 Initialize the configuration form.
100
101 @param[in] Private Pointer to the driver private data.
102
103 @retval EFI_SUCCESS The configuration form is initialized.
104 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
105
106 **/
107 EFI_STATUS
108 TlsAuthConfigFormInit (
109 IN TLS_AUTH_CONFIG_PRIVATE_DATA *Private
110 );
111
112 /**
113
114 This function allows the caller to request the current
115 configuration for one or more named elements. The resulting
116 string is in <ConfigAltResp> format. Any and all alternative
117 configuration strings shall also be appended to the end of the
118 current configuration string. If they are, they must appear
119 after the current configuration. They must contain the same
120 routing (GUID, NAME, PATH) as the current configuration string.
121 They must have an additional description indicating the type of
122 alternative configuration the string represents,
123 "ALTCFG=<StringToken>". That <StringToken> (when
124 converted from Hex UNICODE to binary) is a reference to a
125 string in the associated string pack.
126
127 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
128
129 @param Request A null-terminated Unicode string in
130 <ConfigRequest> format. Note that this
131 includes the routing information as well as
132 the configurable name / value pairs. It is
133 invalid for this string to be in
134 <MultiConfigRequest> format.
135 If a NULL is passed in for the Request field,
136 all of the settings being abstracted by this function
137 will be returned in the Results field. In addition,
138 if a ConfigHdr is passed in with no request elements,
139 all of the settings being abstracted for that particular
140 ConfigHdr reference will be returned in the Results Field.
141
142 @param Progress On return, points to a character in the
143 Request string. Points to the string's null
144 terminator if request was successful. Points
145 to the most recent "&" before the first
146 failing name / value pair (or the beginning
147 of the string if the failure is in the first
148 name / value pair) if the request was not
149 successful.
150
151 @param Results A null-terminated Unicode string in
152 <MultiConfigAltResp> format which has all values
153 filled in for the names in the Request string.
154 String to be allocated by the called function.
155
156 @retval EFI_SUCCESS The Results string is filled with the
157 values corresponding to all requested
158 names.
159
160 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the
161 parts of the results that must be
162 stored awaiting possible future
163 protocols.
164
165 @retval EFI_NOT_FOUND Routing data doesn't match any
166 known driver. Progress set to the
167 first character in the routing header.
168 Note: There is no requirement that the
169 driver validate the routing data. It
170 must skip the <ConfigHdr> in order to
171 process the names.
172
173 @retval EFI_INVALID_PARAMETER Illegal syntax. Progress set
174 to most recent "&" before the
175 error or the beginning of the
176 string.
177
178 @retval EFI_INVALID_PARAMETER Unknown name. Progress points
179 to the & before the name in
180 question.
181
182 **/
183 EFI_STATUS
184 EFIAPI
185 TlsAuthConfigAccessExtractConfig (
186 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
187 IN CONST EFI_STRING Request,
188 OUT EFI_STRING *Progress,
189 OUT EFI_STRING *Results
190 );
191
192 /**
193
194 This function applies changes in a driver's configuration.
195 Input is a Configuration, which has the routing data for this
196 driver followed by name / value configuration pairs. The driver
197 must apply those pairs to its configurable storage. If the
198 driver's configuration is stored in a linear block of data
199 and the driver's name / value pairs are in <BlockConfig>
200 format, it may use the ConfigToBlock helper function (above) to
201 simplify the job.
202
203 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
204
205 @param Configuration A null-terminated Unicode string in
206 <ConfigString> format.
207
208 @param Progress A pointer to a string filled in with the
209 offset of the most recent '&' before the
210 first failing name / value pair (or the
211 beginning of the string if the failure
212 is in the first name / value pair) or
213 the terminating NULL if all was
214 successful.
215
216 @retval EFI_SUCCESS The results have been distributed or are
217 awaiting distribution.
218
219 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the
220 parts of the results that must be
221 stored awaiting possible future
222 protocols.
223
224 @retval EFI_INVALID_PARAMETERS Passing in a NULL for the
225 Results parameter would result
226 in this type of error.
227
228 @retval EFI_NOT_FOUND Target for the specified routing data
229 was not found
230
231 **/
232 EFI_STATUS
233 EFIAPI
234 TlsAuthConfigAccessRouteConfig (
235 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
236 IN CONST EFI_STRING Configuration,
237 OUT EFI_STRING *Progress
238 );
239
240 /**
241
242 This function is called to provide results data to the driver.
243 This data consists of a unique key that is used to identify
244 which data is either being passed back or being asked for.
245
246 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
247 @param Action Specifies the type of action taken by the browser.
248 @param QuestionId A unique value which is sent to the original
249 exporting driver so that it can identify the type
250 of data to expect. The format of the data tends to
251 vary based on the opcode that generated the callback.
252 @param Type The type of value for the question.
253 @param Value A pointer to the data being sent to the original
254 exporting driver.
255 @param ActionRequest On return, points to the action requested by the
256 callback function.
257
258 @retval EFI_SUCCESS The callback successfully handled the action.
259 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the
260 variable and its data.
261 @retval EFI_DEVICE_ERROR The variable could not be saved.
262 @retval EFI_UNSUPPORTED The specified Action is not supported by the
263 callback.
264 **/
265 EFI_STATUS
266 EFIAPI
267 TlsAuthConfigAccessCallback (
268 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
269 IN EFI_BROWSER_ACTION Action,
270 IN EFI_QUESTION_ID QuestionId,
271 IN UINT8 Type,
272 IN OUT EFI_IFR_TYPE_VALUE *Value,
273 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
274 );
275
276 #endif
277