]>
Commit | Line | Data |
---|---|---|
8c71ec8f | 1 | /** @file\r |
2 | The header file of HII Config Access protocol implementation of SecureBoot\r | |
3 | configuration module.\r | |
4 | \r | |
5 | Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>\r | |
6 | This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #ifndef __SECUREBOOT_CONFIG_IMPL_H__\r | |
17 | #define __SECUREBOOT_CONFIG_IMPL_H__\r | |
18 | \r | |
19 | #include <Uefi.h>\r | |
20 | \r | |
21 | #include <Protocol/HiiConfigAccess.h>\r | |
22 | #include <Protocol/HiiConfigRouting.h>\r | |
23 | #include <Protocol/SimpleFileSystem.h>\r | |
24 | #include <Protocol/BlockIo.h>\r | |
25 | #include <Protocol/DevicePath.h>\r | |
26 | #include <Protocol/DevicePathToText.h>\r | |
27 | #include <Protocol/DebugPort.h>\r | |
28 | #include <Protocol/LoadFile.h>\r | |
29 | \r | |
30 | #include <Library/BaseLib.h>\r | |
31 | #include <Library/BaseMemoryLib.h>\r | |
32 | #include <Library/DebugLib.h>\r | |
33 | #include <Library/MemoryAllocationLib.h>\r | |
34 | #include <Library/UefiBootServicesTableLib.h>\r | |
35 | #include <Library/UefiRuntimeServicesTableLib.h>\r | |
36 | #include <Library/UefiHiiServicesLib.h>\r | |
37 | #include <Library/UefiLib.h>\r | |
38 | #include <Library/HiiLib.h>\r | |
39 | #include <Library/DevicePathLib.h>\r | |
40 | #include <Library/PrintLib.h>\r | |
41 | #include <Library/PlatformSecureLib.h>\r | |
42 | #include <Library/BaseCryptLib.h>\r | |
43 | #include <Guid/MdeModuleHii.h>\r | |
44 | #include <Guid/AuthenticatedVariableFormat.h>\r | |
45 | #include <Guid/FileSystemVolumeLabelInfo.h>\r | |
46 | #include <Guid/ImageAuthentication.h>\r | |
47 | #include <Guid/FileInfo.h>\r | |
48 | \r | |
49 | #include "SecureBootConfigNvData.h"\r | |
50 | \r | |
51 | //\r | |
52 | // Tool generated IFR binary data and String package data\r | |
53 | //\r | |
54 | extern UINT8 SecureBootConfigBin[];\r | |
55 | extern UINT8 SecureBootConfigDxeStrings[];\r | |
56 | \r | |
57 | //\r | |
58 | // Shared IFR form update data\r | |
59 | //\r | |
60 | extern VOID *mStartOpCodeHandle;\r | |
61 | extern VOID *mEndOpCodeHandle;\r | |
62 | extern EFI_IFR_GUID_LABEL *mStartLabel;\r | |
63 | extern EFI_IFR_GUID_LABEL *mEndLabel;\r | |
64 | \r | |
65 | #define MAX_CHAR 480\r | |
66 | #define TWO_BYTE_ENCODE 0x82\r | |
67 | \r | |
68 | //\r | |
69 | // SHA-1 digest size in bytes.\r | |
70 | //\r | |
71 | #define SHA1_DIGEST_SIZE 20\r | |
72 | //\r | |
73 | // SHA-256 digest size in bytes\r | |
74 | //\r | |
75 | #define SHA256_DIGEST_SIZE 32\r | |
76 | //\r | |
77 | // Set max digest size as SHA256 Output (32 bytes) by far\r | |
78 | //\r | |
79 | #define MAX_DIGEST_SIZE SHA256_DIGEST_SIZE\r | |
80 | \r | |
81 | #define WIN_CERT_UEFI_RSA2048_SIZE 256\r | |
82 | \r | |
83 | //\r | |
84 | // Support hash types\r | |
85 | //\r | |
86 | #define HASHALG_SHA1 0x00000000\r | |
87 | #define HASHALG_SHA224 0x00000001\r | |
88 | #define HASHALG_SHA256 0x00000002\r | |
89 | #define HASHALG_SHA384 0x00000003\r | |
90 | #define HASHALG_SHA512 0x00000004\r | |
91 | #define HASHALG_MAX 0x00000005\r | |
92 | \r | |
93 | \r | |
94 | #define SECUREBOOT_MENU_OPTION_SIGNATURE SIGNATURE_32 ('S', 'b', 'M', 'u')\r | |
95 | #define SECUREBOOT_MENU_ENTRY_SIGNATURE SIGNATURE_32 ('S', 'b', 'M', 'r')\r | |
96 | \r | |
97 | typedef struct {\r | |
98 | EFI_DEVICE_PATH_PROTOCOL Header;\r | |
99 | EFI_GUID Guid;\r | |
100 | UINT8 VendorDefinedData[1];\r | |
101 | } VENDOR_DEVICE_PATH_WITH_DATA;\r | |
102 | \r | |
103 | typedef struct {\r | |
104 | EFI_DEVICE_PATH_PROTOCOL Header;\r | |
105 | UINT16 NetworkProtocol;\r | |
106 | UINT16 LoginOption;\r | |
107 | UINT64 Lun;\r | |
108 | UINT16 TargetPortalGroupTag;\r | |
109 | CHAR16 TargetName[1];\r | |
110 | } ISCSI_DEVICE_PATH_WITH_NAME;\r | |
111 | \r | |
112 | typedef enum _FILE_EXPLORER_DISPLAY_CONTEXT {\r | |
113 | FileExplorerDisplayFileSystem,\r | |
114 | FileExplorerDisplayDirectory,\r | |
115 | FileExplorerDisplayUnknown\r | |
116 | } FILE_EXPLORER_DISPLAY_CONTEXT;\r | |
117 | \r | |
118 | typedef enum _FILE_EXPLORER_STATE {\r | |
119 | FileExplorerStateInActive = 0,\r | |
120 | FileExplorerStateEnrollPkFile,\r | |
121 | FileExplorerStateEnrollKekFile,\r | |
122 | FileExplorerStateEnrollSignatureFileToDb,\r | |
123 | FileExplorerStateEnrollSignatureFileToDbx,\r | |
124 | FileExplorerStateUnknown\r | |
125 | } FILE_EXPLORER_STATE;\r | |
126 | \r | |
127 | typedef struct {\r | |
128 | CHAR16 *Str;\r | |
129 | UINTN Len;\r | |
130 | UINTN Maxlen;\r | |
131 | } POOL_PRINT;\r | |
132 | \r | |
133 | typedef\r | |
134 | VOID\r | |
135 | (*DEV_PATH_FUNCTION) (\r | |
136 | IN OUT POOL_PRINT *Str,\r | |
137 | IN VOID *DevPath\r | |
138 | );\r | |
139 | \r | |
140 | typedef struct {\r | |
141 | UINT8 Type;\r | |
142 | UINT8 SubType;\r | |
143 | DEV_PATH_FUNCTION Function;\r | |
144 | } DEVICE_PATH_STRING_TABLE;\r | |
145 | \r | |
146 | typedef struct {\r | |
147 | UINTN Signature;\r | |
148 | LIST_ENTRY Head;\r | |
149 | UINTN MenuNumber;\r | |
150 | } SECUREBOOT_MENU_OPTION;\r | |
151 | \r | |
152 | extern SECUREBOOT_MENU_OPTION FsOptionMenu;\r | |
153 | extern SECUREBOOT_MENU_OPTION DirectoryMenu;\r | |
154 | \r | |
155 | typedef struct {\r | |
156 | UINTN Signature;\r | |
157 | LIST_ENTRY Link;\r | |
158 | UINTN OptionNumber;\r | |
159 | UINT16 *DisplayString;\r | |
160 | UINT16 *HelpString;\r | |
161 | EFI_STRING_ID DisplayStringToken;\r | |
162 | EFI_STRING_ID HelpStringToken;\r | |
163 | VOID *FileContext;\r | |
164 | } SECUREBOOT_MENU_ENTRY;\r | |
165 | \r | |
166 | typedef struct {\r | |
167 | EFI_HANDLE Handle;\r | |
168 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r | |
169 | EFI_FILE_HANDLE FHandle;\r | |
170 | UINT16 *FileName;\r | |
171 | EFI_FILE_SYSTEM_VOLUME_LABEL *Info;\r | |
172 | \r | |
173 | BOOLEAN IsRoot;\r | |
174 | BOOLEAN IsDir;\r | |
175 | BOOLEAN IsRemovableMedia;\r | |
176 | BOOLEAN IsLoadFile;\r | |
177 | BOOLEAN IsBootLegacy;\r | |
178 | } SECUREBOOT_FILE_CONTEXT;\r | |
179 | \r | |
180 | \r | |
181 | //\r | |
182 | // We define another format of 5th directory entry: security directory\r | |
183 | //\r | |
184 | typedef struct {\r | |
185 | UINT32 Offset; // Offset of certificate\r | |
186 | UINT32 SizeOfCert; // size of certificate appended\r | |
187 | } EFI_IMAGE_SECURITY_DATA_DIRECTORY;\r | |
188 | \r | |
189 | typedef enum{\r | |
190 | ImageType_IA32,\r | |
191 | ImageType_X64\r | |
192 | } IMAGE_TYPE;\r | |
193 | \r | |
194 | ///\r | |
195 | /// HII specific Vendor Device Path definition.\r | |
196 | ///\r | |
197 | typedef struct {\r | |
198 | VENDOR_DEVICE_PATH VendorDevicePath;\r | |
199 | EFI_DEVICE_PATH_PROTOCOL End;\r | |
200 | } HII_VENDOR_DEVICE_PATH;\r | |
201 | \r | |
202 | typedef struct {\r | |
203 | UINTN Signature;\r | |
204 | \r | |
205 | EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;\r | |
206 | EFI_HII_HANDLE HiiHandle;\r | |
207 | EFI_HANDLE DriverHandle;\r | |
208 | \r | |
209 | FILE_EXPLORER_STATE FeCurrentState;\r | |
210 | FILE_EXPLORER_DISPLAY_CONTEXT FeDisplayContext;\r | |
211 | \r | |
212 | SECUREBOOT_MENU_ENTRY *MenuEntry;\r | |
213 | SECUREBOOT_FILE_CONTEXT *FileContext;\r | |
214 | \r | |
215 | EFI_GUID *SignatureGUID;\r | |
216 | } SECUREBOOT_CONFIG_PRIVATE_DATA;\r | |
217 | \r | |
218 | extern SECUREBOOT_CONFIG_PRIVATE_DATA mSecureBootConfigPrivateDateTemplate;\r | |
219 | \r | |
220 | #define SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('S', 'E', 'C', 'B')\r | |
221 | #define SECUREBOOT_CONFIG_PRIVATE_FROM_THIS(a) CR (a, SECUREBOOT_CONFIG_PRIVATE_DATA, ConfigAccess, SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE)\r | |
222 | \r | |
223 | //\r | |
224 | // Cryptograhpic Key Information\r | |
225 | //\r | |
226 | #pragma pack(1)\r | |
227 | typedef struct _CPL_KEY_INFO {\r | |
228 | UINT32 KeyLengthInBits; // Key Length In Bits\r | |
229 | UINT32 BlockSize; // Operation Block Size in Bytes\r | |
230 | UINT32 CipherBlockSize; // Output Cipher Block Size in Bytes\r | |
231 | UINT32 KeyType; // Key Type\r | |
232 | UINT32 CipherMode; // Cipher Mode for Symmetric Algorithm\r | |
233 | UINT32 Flags; // Additional Key Property Flags\r | |
234 | } CPL_KEY_INFO;\r | |
235 | #pragma pack()\r | |
236 | \r | |
237 | \r | |
238 | /**\r | |
239 | Retrieves the size, in bytes, of the context buffer required for hash operations.\r | |
240 | \r | |
241 | @return The size, in bytes, of the context buffer required for hash operations.\r | |
242 | \r | |
243 | **/\r | |
244 | typedef\r | |
245 | EFI_STATUS\r | |
246 | (EFIAPI *HASH_GET_CONTEXT_SIZE)(\r | |
247 | VOID\r | |
248 | );\r | |
249 | \r | |
250 | /**\r | |
251 | Initializes user-supplied memory pointed by HashContext as hash context for\r | |
252 | subsequent use.\r | |
253 | \r | |
254 | If HashContext is NULL, then ASSERT().\r | |
255 | \r | |
256 | @param[in, out] HashContext Pointer to Context being initialized.\r | |
257 | \r | |
258 | @retval TRUE HASH context initialization succeeded.\r | |
259 | @retval FALSE HASH context initialization failed.\r | |
260 | \r | |
261 | **/\r | |
262 | typedef\r | |
263 | BOOLEAN\r | |
264 | (EFIAPI *HASH_INIT)(\r | |
265 | IN OUT VOID *HashContext\r | |
266 | );\r | |
267 | \r | |
268 | \r | |
269 | /**\r | |
270 | Performs digest on a data buffer of the specified length. This function can\r | |
271 | be called multiple times to compute the digest of long or discontinuous data streams.\r | |
272 | \r | |
273 | If HashContext is NULL, then ASSERT().\r | |
274 | \r | |
275 | @param[in, out] HashContext Pointer to the MD5 context.\r | |
276 | @param[in] Data Pointer to the buffer containing the data to be hashed.\r | |
277 | @param[in] DataLength Length of Data buffer in bytes.\r | |
278 | \r | |
279 | @retval TRUE HASH data digest succeeded.\r | |
280 | @retval FALSE Invalid HASH context. After HashFinal function has been called, the\r | |
281 | HASH context cannot be reused.\r | |
282 | \r | |
283 | **/\r | |
284 | typedef\r | |
285 | BOOLEAN\r | |
286 | (EFIAPI *HASH_UPDATE)(\r | |
287 | IN OUT VOID *HashContext,\r | |
288 | IN CONST VOID *Data,\r | |
289 | IN UINTN DataLength\r | |
290 | );\r | |
291 | \r | |
292 | /**\r | |
293 | Completes hash computation and retrieves the digest value into the specified\r | |
294 | memory. After this function has been called, the context cannot be used again.\r | |
295 | \r | |
296 | If HashContext is NULL, then ASSERT().\r | |
297 | If HashValue is NULL, then ASSERT().\r | |
298 | \r | |
299 | @param[in, out] HashContext Pointer to the MD5 context\r | |
300 | @param[out] HashValue Pointer to a buffer that receives the HASH digest\r | |
301 | value (16 bytes).\r | |
302 | \r | |
303 | @retval TRUE HASH digest computation succeeded.\r | |
304 | @retval FALSE HASH digest computation failed.\r | |
305 | \r | |
306 | **/\r | |
307 | typedef\r | |
308 | BOOLEAN\r | |
309 | (EFIAPI *HASH_FINAL)(\r | |
310 | IN OUT VOID *HashContext,\r | |
311 | OUT UINT8 *HashValue\r | |
312 | );\r | |
313 | \r | |
314 | //\r | |
315 | // Hash Algorithm Table\r | |
316 | //\r | |
317 | typedef struct {\r | |
318 | CHAR16 *Name; ///< Name for Hash Algorithm\r | |
319 | UINTN DigestLength; ///< Digest Length\r | |
320 | UINT8 *OidValue; ///< Hash Algorithm OID ASN.1 Value \r | |
321 | UINTN OidLength; ///< Length of Hash OID Value\r | |
322 | HASH_GET_CONTEXT_SIZE GetContextSize; ///< Pointer to Hash GetContentSize function\r | |
323 | HASH_INIT HashInit; ///< Pointer to Hash Init function\r | |
324 | HASH_UPDATE HashUpdate; ///< Pointer to Hash Update function\r | |
325 | HASH_FINAL HashFinal; ///< Pointer to Hash Final function\r | |
326 | } HASH_TABLE;\r | |
327 | \r | |
328 | typedef struct {\r | |
329 | WIN_CERTIFICATE Hdr;\r | |
330 | UINT8 CertData[1];\r | |
331 | } WIN_CERTIFICATE_EFI_PKCS;\r | |
332 | \r | |
333 | \r | |
334 | /**\r | |
335 | This function publish the SecureBoot configuration Form.\r | |
336 | \r | |
337 | @param[in, out] PrivateData Points to SecureBoot configuration private data.\r | |
338 | \r | |
339 | @retval EFI_SUCCESS HII Form is installed successfully.\r | |
340 | @retval EFI_OUT_OF_RESOURCES Not enough resource for HII Form installation.\r | |
341 | @retval Others Other errors as indicated.\r | |
342 | \r | |
343 | **/\r | |
344 | EFI_STATUS\r | |
345 | InstallSecureBootConfigForm (\r | |
346 | IN OUT SECUREBOOT_CONFIG_PRIVATE_DATA *PrivateData\r | |
347 | );\r | |
348 | \r | |
349 | \r | |
350 | /**\r | |
351 | This function removes SecureBoot configuration Form.\r | |
352 | \r | |
353 | @param[in, out] PrivateData Points to SecureBoot configuration private data.\r | |
354 | \r | |
355 | **/\r | |
356 | VOID\r | |
357 | UninstallSecureBootConfigForm (\r | |
358 | IN OUT SECUREBOOT_CONFIG_PRIVATE_DATA *PrivateData\r | |
359 | );\r | |
360 | \r | |
361 | \r | |
362 | /**\r | |
363 | This function allows a caller to extract the current configuration for one\r | |
364 | or more named elements from the target driver.\r | |
365 | \r | |
366 | @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r | |
367 | @param[in] Request A null-terminated Unicode string in\r | |
368 | <ConfigRequest> format.\r | |
369 | @param[out] Progress On return, points to a character in the Request\r | |
370 | string. Points to the string's null terminator if\r | |
371 | request was successful. Points to the most recent\r | |
372 | '&' before the first failing name/value pair (or\r | |
373 | the beginning of the string if the failure is in\r | |
374 | the first name/value pair) if the request was not\r | |
375 | successful.\r | |
376 | @param[out] Results A null-terminated Unicode string in\r | |
377 | <ConfigAltResp> format which has all values filled\r | |
378 | in for the names in the Request string. String to\r | |
379 | be allocated by the called function.\r | |
380 | \r | |
381 | @retval EFI_SUCCESS The Results is filled with the requested values.\r | |
382 | @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.\r | |
383 | @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.\r | |
384 | @retval EFI_NOT_FOUND Routing data doesn't match any storage in this\r | |
385 | driver.\r | |
386 | \r | |
387 | **/\r | |
388 | EFI_STATUS\r | |
389 | EFIAPI\r | |
390 | SecureBootExtractConfig (\r | |
391 | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r | |
392 | IN CONST EFI_STRING Request,\r | |
393 | OUT EFI_STRING *Progress,\r | |
394 | OUT EFI_STRING *Results\r | |
395 | );\r | |
396 | \r | |
397 | \r | |
398 | /**\r | |
399 | This function processes the results of changes in configuration.\r | |
400 | \r | |
401 | @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r | |
402 | @param[in] Configuration A null-terminated Unicode string in <ConfigResp>\r | |
403 | format.\r | |
404 | @param[out] Progress A pointer to a string filled in with the offset of\r | |
405 | the most recent '&' before the first failing\r | |
406 | name/value pair (or the beginning of the string if\r | |
407 | the failure is in the first name/value pair) or\r | |
408 | the terminating NULL if all was successful.\r | |
409 | \r | |
410 | @retval EFI_SUCCESS The Results is processed successfully.\r | |
411 | @retval EFI_INVALID_PARAMETER Configuration is NULL.\r | |
412 | @retval EFI_NOT_FOUND Routing data doesn't match any storage in this\r | |
413 | driver.\r | |
414 | \r | |
415 | **/\r | |
416 | EFI_STATUS\r | |
417 | EFIAPI\r | |
418 | SecureBootRouteConfig (\r | |
419 | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r | |
420 | IN CONST EFI_STRING Configuration,\r | |
421 | OUT EFI_STRING *Progress\r | |
422 | );\r | |
423 | \r | |
424 | \r | |
425 | /**\r | |
426 | This function processes the results of changes in configuration.\r | |
427 | \r | |
428 | @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r | |
429 | @param[in] Action Specifies the type of action taken by the browser.\r | |
430 | @param[in] QuestionId A unique value which is sent to the original\r | |
431 | exporting driver so that it can identify the type\r | |
432 | of data to expect.\r | |
433 | @param[in] Type The type of value for the question.\r | |
434 | @param[in] Value A pointer to the data being sent to the original\r | |
435 | exporting driver.\r | |
436 | @param[out] ActionRequest On return, points to the action requested by the\r | |
437 | callback function.\r | |
438 | \r | |
439 | @retval EFI_SUCCESS The callback successfully handled the action.\r | |
440 | @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the\r | |
441 | variable and its data.\r | |
442 | @retval EFI_DEVICE_ERROR The variable could not be saved.\r | |
443 | @retval EFI_UNSUPPORTED The specified Action is not supported by the\r | |
444 | callback.\r | |
445 | \r | |
446 | **/\r | |
447 | EFI_STATUS\r | |
448 | EFIAPI\r | |
449 | SecureBootCallback (\r | |
450 | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r | |
451 | IN EFI_BROWSER_ACTION Action,\r | |
452 | IN EFI_QUESTION_ID QuestionId,\r | |
453 | IN UINT8 Type,\r | |
454 | IN EFI_IFR_TYPE_VALUE *Value,\r | |
455 | OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r | |
456 | );\r | |
457 | \r | |
458 | \r | |
459 | /**\r | |
460 | This function converts an input device structure to a Unicode string.\r | |
461 | \r | |
462 | @param[in] DevPath A pointer to the device path structure.\r | |
463 | \r | |
464 | @return A new allocated Unicode string that represents the device path.\r | |
465 | \r | |
466 | **/\r | |
467 | CHAR16 *\r | |
468 | EFIAPI\r | |
469 | DevicePathToStr (\r | |
470 | IN EFI_DEVICE_PATH_PROTOCOL *DevPath\r | |
471 | );\r | |
472 | \r | |
473 | \r | |
474 | /**\r | |
475 | Clean up the dynamic opcode at label and form specified by both LabelId. \r | |
476 | \r | |
477 | @param[in] LabelId It is both the Form ID and Label ID for opcode deletion.\r | |
478 | @param[in] PrivateData Module private data.\r | |
479 | \r | |
480 | **/\r | |
481 | VOID\r | |
482 | CleanUpPage (\r | |
483 | IN UINT16 LabelId,\r | |
484 | IN SECUREBOOT_CONFIG_PRIVATE_DATA *PrivateData\r | |
485 | );\r | |
486 | \r | |
487 | \r | |
488 | /**\r | |
489 | Update the file explorer page with the refreshed file system.\r | |
490 | \r | |
491 | @param[in] PrivateData Module private data.\r | |
492 | @param[in] KeyValue Key value to identify the type of data to expect.\r | |
493 | \r | |
494 | @retval TRUE Inform the caller to create a callback packet to exit file explorer.\r | |
495 | @retval FALSE Indicate that there is no need to exit file explorer.\r | |
496 | \r | |
497 | **/\r | |
498 | BOOLEAN\r | |
499 | UpdateFileExplorer (\r | |
500 | IN SECUREBOOT_CONFIG_PRIVATE_DATA *PrivateData,\r | |
501 | IN UINT16 KeyValue\r | |
502 | );\r | |
503 | \r | |
504 | \r | |
505 | /**\r | |
506 | Free resources allocated in Allocate Rountine.\r | |
507 | \r | |
508 | @param[in, out] MenuOption Menu to be freed\r | |
509 | \r | |
510 | **/\r | |
511 | VOID\r | |
512 | FreeMenu (\r | |
513 | IN OUT SECUREBOOT_MENU_OPTION *MenuOption\r | |
514 | );\r | |
515 | \r | |
516 | \r | |
517 | /**\r | |
518 | Read file content into BufferPtr, the size of the allocate buffer \r | |
519 | is *FileSize plus AddtionAllocateSize.\r | |
520 | \r | |
521 | @param[in] FileHandle The file to be read.\r | |
522 | @param[in, out] BufferPtr Pointers to the pointer of allocated buffer.\r | |
523 | @param[out] FileSize Size of input file\r | |
524 | @param[in] AddtionAllocateSize Addtion size the buffer need to be allocated. \r | |
525 | In case the buffer need to contain others besides the file content.\r | |
526 | \r | |
527 | @retval EFI_SUCCESS The file was read into the buffer.\r | |
528 | @retval EFI_INVALID_PARAMETER A parameter was invalid.\r | |
529 | @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r | |
530 | @retval others Unexpected error.\r | |
531 | \r | |
532 | **/\r | |
533 | EFI_STATUS\r | |
534 | ReadFileContent (\r | |
535 | IN EFI_FILE_HANDLE FileHandle,\r | |
536 | IN OUT VOID **BufferPtr,\r | |
537 | OUT UINTN *FileSize,\r | |
538 | IN UINTN AddtionAllocateSize\r | |
539 | );\r | |
540 | \r | |
541 | \r | |
542 | /**\r | |
543 | Close an open file handle.\r | |
544 | \r | |
545 | @param[in] FileHandle The file handle to close.\r | |
546 | \r | |
547 | **/\r | |
548 | VOID\r | |
549 | CloseFile (\r | |
550 | IN EFI_FILE_HANDLE FileHandle\r | |
551 | );\r | |
552 | \r | |
553 | \r | |
554 | /**\r | |
555 | Converts a nonnegative integer to an octet string of a specified length.\r | |
556 | \r | |
557 | @param[in] Integer Pointer to the nonnegative integer to be converted\r | |
558 | @param[in] IntSizeInWords Length of integer buffer in words\r | |
559 | @param[out] OctetString Converted octet string of the specified length \r | |
560 | @param[in] OSSizeInBytes Intended length of resulting octet string in bytes\r | |
561 | \r | |
562 | Returns:\r | |
563 | \r | |
564 | @retval EFI_SUCCESS Data conversion successfully\r | |
565 | @retval EFI_BUFFER_TOOL_SMALL Buffer is too small for output string\r | |
566 | \r | |
567 | **/\r | |
568 | EFI_STATUS\r | |
569 | EFIAPI\r | |
570 | Int2OctStr (\r | |
571 | IN CONST UINTN *Integer,\r | |
572 | IN UINTN IntSizeInWords,\r | |
573 | OUT UINT8 *OctetString,\r | |
574 | IN UINTN OSSizeInBytes\r | |
575 | );\r | |
576 | \r | |
577 | \r | |
578 | /**\r | |
579 | Convert a String to Guid Value.\r | |
580 | \r | |
581 | @param[in] Str Specifies the String to be converted.\r | |
582 | @param[in] StrLen Number of Unicode Characters of String (exclusive \0)\r | |
583 | @param[out] Guid Return the result Guid value.\r | |
584 | \r | |
585 | @retval EFI_SUCCESS The operation is finished successfully.\r | |
586 | @retval EFI_NOT_FOUND Invalid string.\r | |
587 | \r | |
588 | **/\r | |
589 | EFI_STATUS\r | |
590 | StringToGuid (\r | |
591 | IN CHAR16 *Str, \r | |
592 | IN UINTN StrLen, \r | |
593 | OUT EFI_GUID *Guid\r | |
594 | );\r | |
595 | \r | |
596 | \r | |
597 | /**\r | |
598 | Worker function that prints an EFI_GUID into specified Buffer.\r | |
599 | \r | |
600 | @param[in] Guid Pointer to GUID to print.\r | |
601 | @param[in] Buffer Buffer to print Guid into.\r | |
602 | @param[in] BufferSize Size of Buffer.\r | |
603 | \r | |
604 | @retval Number of characters printed.\r | |
605 | \r | |
606 | **/\r | |
607 | UINTN\r | |
608 | GuidToString (\r | |
609 | IN EFI_GUID *Guid,\r | |
610 | IN CHAR16 *Buffer,\r | |
611 | IN UINTN BufferSize\r | |
612 | );\r | |
613 | \r | |
614 | #endif\r |