]> git.proxmox.com Git - mirror_edk2.git/blob - SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootDefaultKeysDxe.c
f51d5243b7e8772423d0c4783b0b7932476d609a
[mirror_edk2.git] / SecurityPkg / VariableAuthenticated / SecureBootDefaultKeysDxe / SecureBootDefaultKeysDxe.c
1 /** @file
2 This driver init default Secure Boot variables
3
4 Copyright (c) 2021, ARM Ltd. All rights reserved.<BR>
5 Copyright (c) 2021, Semihalf All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9 #include <Guid/AuthenticatedVariableFormat.h>
10 #include <Guid/ImageAuthentication.h>
11 #include <Library/BaseLib.h>
12 #include <Library/BaseMemoryLib.h>
13 #include <Library/DebugLib.h>
14 #include <Library/MemoryAllocationLib.h>
15 #include <Library/UefiBootServicesTableLib.h>
16 #include <Library/UefiRuntimeServicesTableLib.h>
17 #include <Library/SecureBootVariableLib.h>
18 #include <Library/SecureBootVariableProvisionLib.h>
19
20 /**
21 The entry point for SecureBootDefaultKeys driver.
22
23 @param[in] ImageHandle The image handle of the driver.
24 @param[in] SystemTable The system table.
25
26 @retval EFI_ALREADY_STARTED The driver already exists in system.
27 @retval EFI_OUT_OF_RESOURCES Fail to execute entry point due to lack of resources.
28 @retval EFI_SUCCESS All the related protocols are installed on the driver.
29 @retval Others Fail to get the SecureBootEnable variable.
30
31 **/
32 EFI_STATUS
33 EFIAPI
34 SecureBootDefaultKeysEntryPoint (
35 IN EFI_HANDLE ImageHandle,
36 IN EFI_SYSTEM_TABLE *SystemTable
37 )
38 {
39 EFI_STATUS Status;
40
41 Status = SecureBootInitPKDefault ();
42 if (EFI_ERROR (Status)) {
43 DEBUG((DEBUG_ERROR, "%a: Cannot initialize PKDefault: %r\n", __FUNCTION__, Status));
44 return Status;
45 }
46
47 Status = SecureBootInitKEKDefault ();
48 if (EFI_ERROR (Status)) {
49 DEBUG ((DEBUG_ERROR, "%a: Cannot initialize KEKDefault: %r\n", __FUNCTION__, Status));
50 return Status;
51 }
52 Status = SecureBootInitDbDefault ();
53 if (EFI_ERROR (Status)) {
54 DEBUG ((DEBUG_ERROR, "%a: Cannot initialize dbDefault: %r\n", __FUNCTION__, Status));
55 return Status;
56 }
57
58 Status = SecureBootInitDbtDefault ();
59 if (EFI_ERROR (Status)) {
60 DEBUG ((DEBUG_INFO, "%a: dbtDefault not initialized\n", __FUNCTION__));
61 }
62
63 Status = SecureBootInitDbxDefault ();
64 if (EFI_ERROR (Status)) {
65 DEBUG ((DEBUG_INFO, "%a: dbxDefault not initialized\n", __FUNCTION__));
66 }
67
68 return Status;
69 }