TianoCore EDK2 master
|
#include <Uefi.h>
#include <Protocol/HiiConfigAccess.h>
#include <Protocol/HiiConfigRouting.h>
#include <Protocol/SimpleFileSystem.h>
#include <Protocol/BlockIo.h>
#include <Protocol/DevicePath.h>
#include <Protocol/DebugPort.h>
#include <Protocol/LoadFile.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiHiiServicesLib.h>
#include <Library/UefiLib.h>
#include <Library/HiiLib.h>
#include <Library/DevicePathLib.h>
#include <Library/PrintLib.h>
#include <Library/PlatformSecureLib.h>
#include <Library/BaseCryptLib.h>
#include <Library/FileExplorerLib.h>
#include <Library/PeCoffLib.h>
#include <Guid/MdeModuleHii.h>
#include <Guid/AuthenticatedVariableFormat.h>
#include <Guid/FileSystemVolumeLabelInfo.h>
#include <Guid/ImageAuthentication.h>
#include <Guid/FileInfo.h>
#include <Guid/WinCertificate.h>
#include "SecureBootConfigNvData.h"
Go to the source code of this file.
Data Structures | |
struct | SECUREBOOT_MENU_OPTION |
struct | SECUREBOOT_FILE_CONTEXT |
struct | EFI_IMAGE_SECURITY_DATA_DIRECTORY |
struct | HII_VENDOR_DEVICE_PATH |
struct | SECUREBOOT_CONFIG_PRIVATE_DATA |
struct | _CPL_KEY_INFO |
struct | HASH_TABLE |
struct | WIN_CERTIFICATE_EFI_PKCS |
Macros | |
#define | MAX_CHAR 480 |
#define | TWO_BYTE_ENCODE 0x82 |
#define | BUFFER_MAX_SIZE 100 |
#define | SHA256_DIGEST_SIZE 32 |
#define | SHA384_DIGEST_SIZE 48 |
#define | SHA512_DIGEST_SIZE 64 |
#define | MAX_DIGEST_SIZE SHA512_DIGEST_SIZE |
#define | WIN_CERT_UEFI_RSA2048_SIZE 256 |
#define | WIN_CERT_UEFI_RSA3072_SIZE 384 |
#define | WIN_CERT_UEFI_RSA4096_SIZE 512 |
#define | HASHALG_SHA224 0x00000000 |
#define | HASHALG_SHA256 0x00000001 |
#define | HASHALG_SHA384 0x00000002 |
#define | HASHALG_SHA512 0x00000003 |
#define | HASHALG_RAW 0x00000004 |
#define | HASHALG_MAX 0x00000004 |
#define | CER_PUBKEY_MIN_SIZE 256 |
#define | KEY_TYPE_RSASSA 0 |
#define | SECUREBOOT_FREE_NON_NULL(Pointer) |
#define | SECUREBOOT_FREE_NON_OPCODE(Handle) |
#define | SIGNATURE_DATA_COUNTS(List) (((List)->SignatureListSize - sizeof(EFI_SIGNATURE_LIST) - (List)->SignatureHeaderSize) / (List)->SignatureSize) |
#define | SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('S', 'E', 'C', 'B') |
#define | SECUREBOOT_CONFIG_PRIVATE_FROM_THIS(a) CR (a, SECUREBOOT_CONFIG_PRIVATE_DATA, ConfigAccess, SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE) |
Typedefs | |
typedef struct _CPL_KEY_INFO | CPL_KEY_INFO |
typedef EFI_STATUS(EFIAPI * | HASH_GET_CONTEXT_SIZE) (VOID) |
typedef BOOLEAN(EFIAPI * | HASH_INIT) (IN OUT VOID *HashContext) |
typedef BOOLEAN(EFIAPI * | HASH_UPDATE) (IN OUT VOID *HashContext, IN CONST VOID *Data, IN UINTN DataLength) |
typedef BOOLEAN(EFIAPI * | HASH_FINAL) (IN OUT VOID *HashContext, OUT UINT8 *HashValue) |
Variables | |
UINT8 | SecureBootConfigBin [] |
UINT8 | SecureBootConfigDxeStrings [] |
VOID * | mStartOpCodeHandle |
VOID * | mEndOpCodeHandle |
EFI_IFR_GUID_LABEL * | mStartLabel |
EFI_IFR_GUID_LABEL * | mEndLabel |
SECUREBOOT_CONFIG_PRIVATE_DATA | mSecureBootConfigPrivateDateTemplate |
SECUREBOOT_CONFIG_PRIVATE_DATA * | gSecureBootPrivateData |
The header file of HII Config Access protocol implementation of SecureBoot configuration module.
Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file SecureBootConfigImpl.h.
#define BUFFER_MAX_SIZE 100 |
Definition at line 64 of file SecureBootConfigImpl.h.
#define CER_PUBKEY_MIN_SIZE 256 |
Definition at line 101 of file SecureBootConfigImpl.h.
#define HASHALG_MAX 0x00000004 |
Definition at line 96 of file SecureBootConfigImpl.h.
#define HASHALG_RAW 0x00000004 |
Definition at line 95 of file SecureBootConfigImpl.h.
#define HASHALG_SHA224 0x00000000 |
Definition at line 91 of file SecureBootConfigImpl.h.
#define HASHALG_SHA256 0x00000001 |
Definition at line 92 of file SecureBootConfigImpl.h.
#define HASHALG_SHA384 0x00000002 |
Definition at line 93 of file SecureBootConfigImpl.h.
#define HASHALG_SHA512 0x00000003 |
Definition at line 94 of file SecureBootConfigImpl.h.
#define KEY_TYPE_RSASSA 0 |
Definition at line 106 of file SecureBootConfigImpl.h.
#define MAX_CHAR 480 |
Definition at line 62 of file SecureBootConfigImpl.h.
#define MAX_DIGEST_SIZE SHA512_DIGEST_SIZE |
Definition at line 82 of file SecureBootConfigImpl.h.
#define SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('S', 'E', 'C', 'B') |
Definition at line 209 of file SecureBootConfigImpl.h.
#define SECUREBOOT_CONFIG_PRIVATE_FROM_THIS | ( | a | ) | CR (a, SECUREBOOT_CONFIG_PRIVATE_DATA, ConfigAccess, SECUREBOOT_CONFIG_PRIVATE_DATA_SIGNATURE) |
Definition at line 210 of file SecureBootConfigImpl.h.
#define SECUREBOOT_FREE_NON_NULL | ( | Pointer | ) |
Definition at line 137 of file SecureBootConfigImpl.h.
#define SECUREBOOT_FREE_NON_OPCODE | ( | Handle | ) |
Definition at line 145 of file SecureBootConfigImpl.h.
#define SHA256_DIGEST_SIZE 32 |
Definition at line 69 of file SecureBootConfigImpl.h.
#define SHA384_DIGEST_SIZE 48 |
Definition at line 73 of file SecureBootConfigImpl.h.
#define SHA512_DIGEST_SIZE 64 |
Definition at line 77 of file SecureBootConfigImpl.h.
#define SIGNATURE_DATA_COUNTS | ( | List | ) | (((List)->SignatureListSize - sizeof(EFI_SIGNATURE_LIST) - (List)->SignatureHeaderSize) / (List)->SignatureSize) |
Definition at line 152 of file SecureBootConfigImpl.h.
#define TWO_BYTE_ENCODE 0x82 |
Definition at line 63 of file SecureBootConfigImpl.h.
#define WIN_CERT_UEFI_RSA2048_SIZE 256 |
Definition at line 84 of file SecureBootConfigImpl.h.
#define WIN_CERT_UEFI_RSA3072_SIZE 384 |
Definition at line 85 of file SecureBootConfigImpl.h.
#define WIN_CERT_UEFI_RSA4096_SIZE 512 |
Definition at line 86 of file SecureBootConfigImpl.h.
Completes hash computation and retrieves the digest value into the specified memory. After this function has been called, the context cannot be used again.
If HashContext is NULL, then ASSERT(). If HashValue is NULL, then ASSERT().
[in,out] | HashContext | Pointer to the MD5 context |
[out] | HashValue | Pointer to a buffer that receives the HASH digest value (16 bytes). |
TRUE | HASH digest computation succeeded. |
FALSE | HASH digest computation failed. |
Definition at line 295 of file SecureBootConfigImpl.h.
typedef EFI_STATUS(EFIAPI * HASH_GET_CONTEXT_SIZE) (VOID) |
Retrieves the size, in bytes, of the context buffer required for hash operations.
Definition at line 233 of file SecureBootConfigImpl.h.
Initializes user-supplied memory pointed by HashContext as hash context for subsequent use.
If HashContext is NULL, then ASSERT().
[in,out] | HashContext | Pointer to Context being initialized. |
TRUE | HASH context initialization succeeded. |
FALSE | HASH context initialization failed. |
Definition at line 251 of file SecureBootConfigImpl.h.
typedef BOOLEAN(EFIAPI * HASH_UPDATE) (IN OUT VOID *HashContext, IN CONST VOID *Data, IN UINTN DataLength) |
Performs digest on a data buffer of the specified length. This function can be called multiple times to compute the digest of long or discontinuous data streams.
If HashContext is NULL, then ASSERT().
[in,out] | HashContext | Pointer to the MD5 context. |
[in] | Data | Pointer to the buffer containing the data to be hashed. |
[in] | DataLength | Length of Data buffer in bytes. |
TRUE | HASH data digest succeeded. |
FALSE | Invalid HASH context. After HashFinal function has been called, the HASH context cannot be reused. |
Definition at line 272 of file SecureBootConfigImpl.h.
enum CURRENT_VARIABLE_NAME |
Definition at line 176 of file SecureBootConfigImpl.h.
enum ENROLL_KEY_ERROR |
Definition at line 111 of file SecureBootConfigImpl.h.
enum IMAGE_TYPE |
Definition at line 163 of file SecureBootConfigImpl.h.
enum SIGNATURE_DELETE_TYPE |
Definition at line 183 of file SecureBootConfigImpl.h.
VOID CleanUpPage | ( | IN UINT16 | LabelId, |
IN SECUREBOOT_CONFIG_PRIVATE_DATA * | PrivateData | ||
) |
Clean up the dynamic opcode at label and form specified by both LabelId.
[in] | LabelId | It is both the Form ID and Label ID for opcode deletion. |
[in] | PrivateData | Module private data. |
Definition at line 57 of file SecureBootConfigFileExplorer.c.
VOID CloseFile | ( | IN EFI_FILE_HANDLE | FileHandle | ) |
Close an open file handle.
[in] | FileHandle | The file handle to close. |
Definition at line 95 of file SecureBootConfigMisc.c.
CHAR16 *EFIAPI DevicePathToStr | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DevPath | ) |
This function converts an input device structure to a Unicode string.
[in] | DevPath | A pointer to the device path structure. |
Converting a given device to an unicode string.
DevPath | Given device path instance |
L"?" | Converting failed. |
Definition at line 109 of file PlatDriOverrideDxe.c.
Worker function that prints an EFI_GUID into specified Buffer.
[in] | Guid | Pointer to GUID to print. |
[in] | Buffer | Buffer to print Guid into. |
[in] | BufferSize | Size of Buffer. |
Number | of characters printed. |
Definition at line 90 of file TlsAuthConfigImpl.c.
EFI_STATUS InstallSecureBootConfigForm | ( | IN OUT SECUREBOOT_CONFIG_PRIVATE_DATA * | PrivateData | ) |
This function publish the SecureBoot configuration Form.
[in,out] | PrivateData | Points to SecureBoot configuration private data. |
EFI_SUCCESS | HII Form is installed successfully. |
EFI_OUT_OF_RESOURCES | Not enough resource for HII Form installation. |
Others | Other errors as indicated. |
Definition at line 5218 of file SecureBootConfigImpl.c.
EFI_STATUS EFIAPI Int2OctStr | ( | IN CONST UINTN * | Integer, |
IN UINTN | IntSizeInWords, | ||
OUT UINT8 * | OctetString, | ||
IN UINTN | OSSizeInBytes | ||
) |
Converts a nonnegative integer to an octet string of a specified length.
[in] | Integer | Pointer to the nonnegative integer to be converted |
[in] | IntSizeInWords | Length of integer buffer in words |
[out] | OctetString | Converted octet string of the specified length |
[in] | OSSizeInBytes | Intended length of resulting octet string in bytes |
Returns:
EFI_SUCCESS | Data conversion successfully |
EFI_BUFFER_TOOL_SMALL | Buffer is too small for output string |
Convert a nonnegative integer to an octet string of a specified length.
[in] | Integer | Pointer to the nonnegative integer to be converted |
[in] | IntSizeInWords | Length of integer buffer in words |
[out] | OctetString | Converted octet string of the specified length |
[in] | OSSizeInBytes | Intended length of resulting octet string in bytes |
Returns:
EFI_SUCCESS | Data conversion successfully |
EFI_BUFFER_TOOL_SMALL | Buffer is too small for output string |
Definition at line 120 of file SecureBootConfigMisc.c.
EFI_STATUS ReadFileContent | ( | IN EFI_FILE_HANDLE | FileHandle, |
IN OUT VOID ** | BufferPtr, | ||
OUT UINTN * | FileSize, | ||
IN UINTN | AdditionAllocateSize | ||
) |
Read file content into BufferPtr, the size of the allocate buffer is *FileSize plus AdditionAllocateSize.
[in] | FileHandle | The file to be read. |
[in,out] | BufferPtr | Pointers to the pointer of allocated buffer. |
[out] | FileSize | Size of input file |
[in] | AdditionAllocateSize | Addition size the buffer need to be allocated. In case the buffer need to contain others besides the file content. |
EFI_SUCCESS | The file was read into the buffer. |
EFI_INVALID_PARAMETER | A parameter was invalid. |
EFI_OUT_OF_RESOURCES | A memory allocation failed. |
others | Unexpected error. |
Read file content into BufferPtr, the size of the allocate buffer is *FileSize plus AddtionAllocateSize.
[in] | FileHandle | The file to be read. |
[in,out] | BufferPtr | Pointers to the pointer of allocated buffer. |
[out] | FileSize | Size of input file |
[in] | AddtionAllocateSize | Addtion size the buffer need to be allocated. In case the buffer need to contain others besides the file content. |
EFI_SUCCESS | The file was read into the buffer. |
EFI_INVALID_PARAMETER | A parameter was invalid. |
EFI_OUT_OF_RESOURCES | A memory allocation failed. |
others | Unexpected error. |
Definition at line 512 of file TlsAuthConfigImpl.c.
EFI_STATUS EFIAPI SecureBootCallback | ( | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL * | This, |
IN EFI_BROWSER_ACTION | Action, | ||
IN EFI_QUESTION_ID | QuestionId, | ||
IN UINT8 | Type, | ||
IN EFI_IFR_TYPE_VALUE * | Value, | ||
OUT EFI_BROWSER_ACTION_REQUEST * | ActionRequest | ||
) |
This function processes the results of changes in configuration.
[in] | This | Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. |
[in] | Action | Specifies the type of action taken by the browser. |
[in] | QuestionId | A unique value which is sent to the original exporting driver so that it can identify the type of data to expect. |
[in] | Type | The type of value for the question. |
[in] | Value | A pointer to the data being sent to the original exporting driver. |
[out] | ActionRequest | On return, points to the action requested by the callback function. |
EFI_SUCCESS | The callback successfully handled the action. |
EFI_OUT_OF_RESOURCES | Not enough storage is available to hold the variable and its data. |
EFI_DEVICE_ERROR | The variable could not be saved. |
EFI_UNSUPPORTED | The specified Action is not supported by the callback. |
This function is called to provide results data to the driver.
[in] | This | Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. |
[in] | Action | Specifies the type of action taken by the browser. |
[in] | QuestionId | A unique value which is sent to the original exporting driver so that it can identify the type of data to expect. |
[in] | Type | The type of value for the question. |
[in] | Value | A pointer to the data being sent to the original exporting driver. |
[out] | ActionRequest | On return, points to the action requested by the callback function. |
EFI_SUCCESS | The callback successfully handled the action. |
EFI_OUT_OF_RESOURCES | Not enough storage is available to hold the variable and its data. |
EFI_DEVICE_ERROR | The variable could not be saved. |
EFI_UNSUPPORTED | The specified Action is not supported by the callback. |
Definition at line 4516 of file SecureBootConfigImpl.c.
EFI_STATUS EFIAPI SecureBootExtractConfig | ( | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL * | This, |
IN CONST EFI_STRING | Request, | ||
OUT EFI_STRING * | Progress, | ||
OUT EFI_STRING * | Results | ||
) |
This function allows a caller to extract the current configuration for one or more named elements from the target driver.
[in] | This | Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. |
[in] | Request | A null-terminated Unicode string in <ConfigRequest> format. |
[out] | Progress | On return, points to a character in the Request string. Points to the string's null terminator if request was successful. Points to the most recent '&' before the first failing name/value pair (or the beginning of the string if the failure is in the first name/value pair) if the request was not successful. |
[out] | Results | A null-terminated Unicode string in <ConfigAltResp> format which has all values filled in for the names in the Request string. String to be allocated by the called function. |
EFI_SUCCESS | The Results is filled with the requested values. |
EFI_OUT_OF_RESOURCES | Not enough memory to store the results. |
EFI_INVALID_PARAMETER | Request is illegal syntax, or unknown name. |
EFI_NOT_FOUND | Routing data doesn't match any storage in this driver. |
Definition at line 3461 of file SecureBootConfigImpl.c.
EFI_STATUS EFIAPI SecureBootRouteConfig | ( | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL * | This, |
IN CONST EFI_STRING | Configuration, | ||
OUT EFI_STRING * | Progress | ||
) |
This function processes the results of changes in configuration.
[in] | This | Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. |
[in] | Configuration | A null-terminated Unicode string in <ConfigResp> format. |
[out] | Progress | A pointer to a string filled in with the offset of the most recent '&' before the first failing name/value pair (or the beginning of the string if the failure is in the first name/value pair) or the terminating NULL if all was successful. |
EFI_SUCCESS | The Results is processed successfully. |
EFI_INVALID_PARAMETER | Configuration is NULL. |
EFI_NOT_FOUND | Routing data doesn't match any storage in this driver. |
Definition at line 3568 of file SecureBootConfigImpl.c.
VOID UninstallSecureBootConfigForm | ( | IN OUT SECUREBOOT_CONFIG_PRIVATE_DATA * | PrivateData | ) |
This function removes SecureBoot configuration Form.
[in,out] | PrivateData | Points to SecureBoot configuration private data. |
Definition at line 5322 of file SecureBootConfigImpl.c.
BOOLEAN EFIAPI UpdateDBFromFile | ( | IN EFI_DEVICE_PATH_PROTOCOL * | FilePath | ) |
Update the DB form base on the input file path info.
FilePath | Point to the file path. |
TRUE | Exit caller function. |
FALSE | Not exit caller function. |
Definition at line 236 of file SecureBootConfigFileExplorer.c.
BOOLEAN EFIAPI UpdateDBTFromFile | ( | IN EFI_DEVICE_PATH_PROTOCOL * | FilePath | ) |
Update the DBT form base on the input file path info.
FilePath | Point to the file path. |
TRUE | Exit caller function. |
FALSE | Not exit caller function. |
Definition at line 270 of file SecureBootConfigFileExplorer.c.
BOOLEAN EFIAPI UpdateDBXFromFile | ( | IN EFI_DEVICE_PATH_PROTOCOL * | FilePath | ) |
Update the DBX form base on the input file path info.
FilePath | Point to the file path. |
TRUE | Exit caller function. |
FALSE | Not exit caller function. |
Definition at line 253 of file SecureBootConfigFileExplorer.c.
BOOLEAN EFIAPI UpdateKEKFromFile | ( | IN EFI_DEVICE_PATH_PROTOCOL * | FilePath | ) |
Update the KEK form base on the input file path info.
FilePath | Point to the file path. |
TRUE | Exit caller function. |
FALSE | Not exit caller function. |
Definition at line 219 of file SecureBootConfigFileExplorer.c.
BOOLEAN EFIAPI UpdatePKFromFile | ( | IN EFI_DEVICE_PATH_PROTOCOL * | FilePath | ) |
Update the PK form base on the input file path info.
FilePath | Point to the file path. |
TRUE | Exit caller function. |
FALSE | Not exit caller function. |
Definition at line 202 of file SecureBootConfigFileExplorer.c.
|
extern |
Definition at line 113 of file SecureBootConfigImpl.c.
|
extern |
|
extern |
Definition at line 20 of file SecureBootConfigImpl.c.
|
extern |