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