64 NewCertInfo = CertInfo;
66 if (NewCertInfo ==
NULL) {
67 Status = EFI_OUT_OF_RESOURCES;
70 CertInfo = NewCertInfo;
84 DEBUG ((DEBUG_ERROR,
"%a: Invalid key format: %d\n", __func__, KeyIndex));
90 Status = EFI_INVALID_PARAMETER;
94 CertInfo[KeyIndex].Data = Buffer;
95 CertInfo[KeyIndex].DataSize = Size;
104 if (Status == EFI_NOT_FOUND) {
110 if (EFI_ERROR (Status)) {
115 Status = EFI_NOT_FOUND;
121 if (EFI_ERROR (Status)) {
127 for (Index = 0; Index < KeyIndex; Index++) {
128 FreePool ((VOID *)CertInfo[Index].Data);
151 IN CHAR16 *VariableName,
152 IN CHAR16 *DefaultName,
163 Status =
GetVariable2 (DefaultName, &gEfiGlobalVariableGuid, &Data, &DataSize);
164 if (EFI_ERROR (Status)) {
165 DEBUG ((DEBUG_ERROR,
"error: GetVariable (\"%s): %r\n", DefaultName, Status));
201 return EFI_UNSUPPORTED;
204 if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
214 if (EFI_ERROR (Status)) {
219 Status =
gRT->SetVariable (
221 &gEfiGlobalVariableGuid,
222 EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,
226 if (EFI_ERROR (Status)) {
258 return EFI_UNSUPPORTED;
261 if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
271 if (EFI_ERROR (Status)) {
276 Status =
gRT->SetVariable (
278 &gEfiGlobalVariableGuid,
279 EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,
283 if (EFI_ERROR (Status)) {
312 return EFI_UNSUPPORTED;
315 if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
322 if (EFI_ERROR (Status)) {
326 Status =
gRT->SetVariable (
328 &gEfiGlobalVariableGuid,
329 EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,
333 if (EFI_ERROR (Status)) {
365 return EFI_UNSUPPORTED;
368 if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
378 if (EFI_ERROR (Status)) {
383 Status =
gRT->SetVariable (
385 &gEfiGlobalVariableGuid,
386 EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,
390 if (EFI_ERROR (Status)) {
422 return EFI_UNSUPPORTED;
425 if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
435 if (EFI_ERROR (Status)) {
439 Status =
gRT->SetVariable (
441 &gEfiGlobalVariableGuid,
442 EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,
446 if (EFI_ERROR (Status)) {
473 &gEfiImageSecurityDatabaseGuid
497 &gEfiImageSecurityDatabaseGuid
521 &gEfiImageSecurityDatabaseGuid
545 &gEfiGlobalVariableGuid
569 &gEfiGlobalVariableGuid
BOOLEAN EFIAPI RsaGetPublicKeyFromX509(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT VOID **RsaContext)
EFI_STATUS EFIAPI GetSectionFromAnyFv(IN CONST EFI_GUID *NameGuid, IN EFI_SECTION_TYPE SectionType, IN UINTN SectionInstance, OUT VOID **Buffer, OUT UINTN *Size)
VOID *EFIAPI ReallocatePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define EFI_DBX_DEFAULT_VARIABLE_NAME
#define EFI_DBT_DEFAULT_VARIABLE_NAME
#define EFI_KEY_EXCHANGE_KEY_NAME
#define EFI_KEK_DEFAULT_VARIABLE_NAME
#define EFI_PK_DEFAULT_VARIABLE_NAME
#define EFI_DB_DEFAULT_VARIABLE_NAME
#define EFI_PLATFORM_KEY_NAME
#define EFI_IMAGE_SECURITY_DATABASE2
#define EFI_IMAGE_SECURITY_DATABASE1
#define EFI_IMAGE_SECURITY_DATABASE
EFI_RUNTIME_SERVICES * gRT
#define DEBUG(Expression)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_STATUS EFIAPI SecureBootCreateDataFromInput(OUT UINTN *SigListsSize, OUT EFI_SIGNATURE_LIST **SigListOut, IN UINTN KeyInfoCount, IN CONST SECURE_BOOT_CERTIFICATE_INFO *KeyInfo)
EFI_STATUS EFIAPI EnrollFromInput(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN UINTN DataSize, IN VOID *Data)
STATIC EFI_STATUS EnrollFromDefault(IN CHAR16 *VariableName, IN CHAR16 *DefaultName, IN EFI_GUID *VendorGuid)
EFI_STATUS SecureBootInitDbxDefault(IN VOID)
EFI_STATUS SecureBootInitDbDefault(IN VOID)
STATIC EFI_STATUS SecureBootFetchData(IN EFI_GUID *KeyFileGuid, OUT UINTN *SigListsSize, OUT EFI_SIGNATURE_LIST **SigListOut)
EFI_STATUS SecureBootInitDbtDefault(IN VOID)
EFI_STATUS EFIAPI EnrollPKFromDefault(VOID)
EFI_STATUS SecureBootInitKEKDefault(IN VOID)
EFI_STATUS EFIAPI EnrollKEKFromDefault(VOID)
EFI_STATUS SecureBootInitPKDefault(IN VOID)
EFI_STATUS EFIAPI EnrollDbFromDefault(VOID)
EFI_STATUS EFIAPI EnrollDbtFromDefault(VOID)
EFI_STATUS EFIAPI EnrollDbxFromDefault(VOID)
EFI_STATUS EFIAPI GetVariable2(IN CONST CHAR16 *Name, IN CONST EFI_GUID *Guid, OUT VOID **Value, OUT UINTN *Size OPTIONAL)