]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/Include/Library/SecureBootVariableLib.h
SecurityPkg: SecureBootVariableLib: Updated signature list creator
[mirror_edk2.git] / SecurityPkg / Include / Library / SecureBootVariableLib.h
CommitLineData
bb806a6e
GB
1/** @file\r
2 Provides a helper functions for creating variable authenticated\r
3 payloads, signature lists related to secure boot keys.\r
4\r
5Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>\r
6(C) Copyright 2018 Hewlett Packard Enterprise Development LP<BR>\r
7Copyright (c) 2021, ARM Ltd. All rights reserved.<BR>\r
8Copyright (c) 2021, Semihalf All rights reserved.<BR>\r
56c717aa 9Copyright (c) Microsoft Corporation.\r
bb806a6e
GB
10SPDX-License-Identifier: BSD-2-Clause-Patent\r
11\r
12**/\r
13\r
14#ifndef SECURE_BOOT_VARIABLE_LIB_H_\r
15#define SECURE_BOOT_VARIABLE_LIB_H_\r
16\r
17/**\r
18 Set the platform secure boot mode into "Custom" or "Standard" mode.\r
19\r
20 @param[in] SecureBootMode New secure boot mode: STANDARD_SECURE_BOOT_MODE or\r
21 CUSTOM_SECURE_BOOT_MODE.\r
22\r
23 @return EFI_SUCCESS The platform has switched to the special mode successfully.\r
24 @return other Fail to operate the secure boot mode.\r
25\r
26--*/\r
27EFI_STATUS\r
56c717aa 28EFIAPI\r
bb806a6e
GB
29SetSecureBootMode (\r
30 IN UINT8 SecureBootMode\r
c411b485 31 );\r
bb806a6e
GB
32\r
33/**\r
34 Fetches the value of SetupMode variable.\r
35\r
36 @param[out] SetupMode Pointer to UINT8 for SetupMode output\r
37\r
38 @retval other Error codes from GetVariable.\r
39--*/\r
40EFI_STATUS\r
41EFIAPI\r
42GetSetupMode (\r
c411b485
MK
43 OUT UINT8 *SetupMode\r
44 );\r
bb806a6e
GB
45\r
46/**\r
6de7c084 47 Create a EFI Signature List with data supplied from input argument.\r
48 The input certificates from KeyInfo parameter should be DER-encoded\r
49 format.\r
bb806a6e 50\r
bb806a6e 51 @param[out] SigListsSize A pointer to size of signature list\r
6de7c084 52 @param[out] SigListOut A pointer to a callee-allocated buffer with signature lists\r
53 @param[in] KeyInfoCount The number of certificate pointer and size pairs inside KeyInfo.\r
54 @param[in] KeyInfo A pointer to all certificates, in the format of DER-encoded,\r
55 to be concatenated into signature lists.\r
bb806a6e 56\r
6de7c084 57 @retval EFI_SUCCESS Created signature list from payload successfully.\r
bb806a6e 58 @retval EFI_NOT_FOUND Section with key has not been found.\r
6de7c084 59 @retval EFI_INVALID_PARAMETER Embedded key has a wrong format or input pointers are NULL.\r
bb806a6e
GB
60 @retval Others Unexpected error happens.\r
61\r
62--*/\r
63EFI_STATUS\r
6de7c084 64EFIAPI\r
65SecureBootCreateDataFromInput (\r
66 OUT UINTN *SigListsSize,\r
67 OUT EFI_SIGNATURE_LIST **SigListOut,\r
68 IN UINTN KeyInfoCount,\r
69 IN CONST SECURE_BOOT_CERTIFICATE_INFO *KeyInfo\r
c411b485 70 );\r
bb806a6e
GB
71\r
72/**\r
73 Create a time based data payload by concatenating the EFI_VARIABLE_AUTHENTICATION_2\r
74 descriptor with the input data. NO authentication is required in this function.\r
75\r
76 @param[in, out] DataSize On input, the size of Data buffer in bytes.\r
77 On output, the size of data returned in Data\r
78 buffer in bytes.\r
79 @param[in, out] Data On input, Pointer to data buffer to be wrapped or\r
80 pointer to NULL to wrap an empty payload.\r
81 On output, Pointer to the new payload date buffer allocated from pool,\r
82 it's caller's responsibility to free the memory when finish using it.\r
56c717aa 83 @param[in] Time Pointer to time information to created time based payload.\r
bb806a6e
GB
84\r
85 @retval EFI_SUCCESS Create time based payload successfully.\r
86 @retval EFI_OUT_OF_RESOURCES There are not enough memory resources to create time based payload.\r
87 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
88 @retval Others Unexpected error happens.\r
89\r
90--*/\r
91EFI_STATUS\r
56c717aa 92EFIAPI\r
bb806a6e 93CreateTimeBasedPayload (\r
56c717aa
KQ
94 IN OUT UINTN *DataSize,\r
95 IN OUT UINT8 **Data,\r
96 IN EFI_TIME *Time\r
c411b485 97 );\r
bb806a6e
GB
98\r
99/**\r
100 Clears the content of the 'db' variable.\r
101\r
102 @retval EFI_OUT_OF_RESOURCES If memory allocation for EFI_VARIABLE_AUTHENTICATION_2 fails\r
103 while VendorGuid is NULL.\r
104 @retval other Errors from GetVariable2(), GetTime() and SetVariable()\r
105--*/\r
106EFI_STATUS\r
107EFIAPI\r
108DeleteDb (\r
109 VOID\r
c411b485 110 );\r
bb806a6e
GB
111\r
112/**\r
113 Clears the content of the 'dbx' variable.\r
114\r
115 @retval EFI_OUT_OF_RESOURCES If memory allocation for EFI_VARIABLE_AUTHENTICATION_2 fails\r
116 while VendorGuid is NULL.\r
117 @retval other Errors from GetVariable2(), GetTime() and SetVariable()\r
118--*/\r
119EFI_STATUS\r
120EFIAPI\r
121DeleteDbx (\r
122 VOID\r
c411b485 123 );\r
bb806a6e
GB
124\r
125/**\r
126 Clears the content of the 'dbt' variable.\r
127\r
128 @retval EFI_OUT_OF_RESOURCES If memory allocation for EFI_VARIABLE_AUTHENTICATION_2 fails\r
129 while VendorGuid is NULL.\r
130 @retval other Errors from GetVariable2(), GetTime() and SetVariable()\r
131--*/\r
132EFI_STATUS\r
133EFIAPI\r
134DeleteDbt (\r
135 VOID\r
c411b485 136 );\r
bb806a6e
GB
137\r
138/**\r
139 Clears the content of the 'KEK' variable.\r
140\r
141 @retval EFI_OUT_OF_RESOURCES If memory allocation for EFI_VARIABLE_AUTHENTICATION_2 fails\r
142 while VendorGuid is NULL.\r
143 @retval other Errors from GetVariable2(), GetTime() and SetVariable()\r
144--*/\r
145EFI_STATUS\r
146EFIAPI\r
147DeleteKEK (\r
148 VOID\r
c411b485 149 );\r
bb806a6e
GB
150\r
151/**\r
152 Clears the content of the 'PK' variable.\r
153\r
154 @retval EFI_OUT_OF_RESOURCES If memory allocation for EFI_VARIABLE_AUTHENTICATION_2 fails\r
155 while VendorGuid is NULL.\r
156 @retval other Errors from GetVariable2(), GetTime() and SetVariable()\r
157--*/\r
158EFI_STATUS\r
159EFIAPI\r
160DeletePlatformKey (\r
161 VOID\r
c411b485
MK
162 );\r
163\r
bb806a6e 164#endif\r