]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/Bis.h
Clean up the MdePkg.dec.
[mirror_edk2.git] / MdePkg / Include / Protocol / Bis.h
CommitLineData
d1f95000 1/** @file\r
2 This file defines the BIS protocol.\r
3\r
4 Copyright (c) 2006, Intel Corporation \r
5 All rights reserved. This program and the accompanying materials \r
6 are licensed and made available under the terms and conditions of the BSD License \r
7 which accompanies this distribution. The full text of the license may be found at \r
8 http://opensource.org/licenses/bsd-license.php \r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12\r
d1f95000 13**/\r
14\r
15#ifndef __BIS_H__\r
16#define __BIS_H__\r
17\r
18#define EFI_BIS_PROTOCOL_GUID \\r
19 { \\r
20 0x0b64aab0, 0x5429, 0x11d4, {0x98, 0x16, 0x00, 0xa0, 0xc9, 0x1f, 0xad, 0xcf } \\r
21 }\r
22\r
fd21d1aa 23//\r
24// X-Intel-BIS-ParameterSet\r
25// Attribute value\r
26// Binary Value of X-Intel-BIS-ParameterSet Attribute.\r
27// (Value is Base-64 encoded in actual signed manifest).\r
28//\r
29#define BOOT_OBJECT_AUTHORIZATION_PARMSET_GUID \\r
30 { \\r
31 0xedd35e31, 0x7b9, 0x11d2, { 0x83,0xa3,0x0,0xa0,0xc9,0x1f,0xad,0xcf } \\r
32 }\r
33\r
34\r
35\r
d1f95000 36typedef struct _EFI_BIS_PROTOCOL EFI_BIS_PROTOCOL;\r
37\r
38\r
39//\r
40// Basic types\r
41//\r
42typedef VOID *BIS_APPLICATION_HANDLE;\r
43typedef UINT16 BIS_ALG_ID;\r
44typedef UINT32 BIS_CERT_ID;\r
45\r
46//\r
47// EFI_BIS_DATA type.\r
48//\r
49// EFI_BIS_DATA instances obtained from BIS must be freed by calling Free( ).\r
50//\r
51typedef struct {\r
52 UINT32 Length; // Length of Data in 8 bit bytes.\r
53 UINT8 *Data; // 32 Bit Flat Address of data.\r
54} EFI_BIS_DATA;\r
55\r
56//\r
57// EFI_BIS_VERSION type.\r
58//\r
59typedef struct {\r
60 UINT32 Major; // BIS Interface version number.\r
61 UINT32 Minor; // Build number.\r
62} EFI_BIS_VERSION;\r
63\r
64//\r
65// ----------------------------------------------------//\r
66// Use these values to initialize EFI_BIS_VERSION.Major\r
67// and to interpret results of Initialize.\r
68// ----------------------------------------------------//\r
69//\r
70#define BIS_CURRENT_VERSION_MAJOR BIS_VERSION_1\r
71#define BIS_VERSION_1 1\r
72\r
73//\r
74// EFI_BIS_SIGNATURE_INFO type.\r
75//\r
76typedef struct {\r
77 BIS_CERT_ID CertificateID; // Truncated hash of platform Boot Object\r
78 // authorization certificate.\r
79 //\r
80 BIS_ALG_ID AlgorithmID; // A signature algorithm number.\r
81 UINT16 KeyLength; // Length of alg. keys in bits.\r
82} EFI_BIS_SIGNATURE_INFO;\r
83\r
84//\r
85// Currently defined values for EFI_BIS_SIGNATURE_INFO.AlgorithmID.\r
86// The exact numeric values come from\r
87// "Common Data Security Architecture (CDSA) Specification".\r
88//\r
89#define BIS_ALG_DSA (41) // CSSM_ALGID_DSA\r
90#define BIS_ALG_RSA_MD5 (42) // CSSM_ALGID_MD5_WITH_RSA\r
91// Currently defined values for EFI_BIS_SIGNATURE_INFO.CertificateId.\r
92//\r
93#define BIS_CERT_ID_DSA BIS_ALG_DSA // CSSM_ALGID_DSA\r
94#define BIS_CERT_ID_RSA_MD5 BIS_ALG_RSA_MD5 // CSSM_ALGID_MD5_WITH_RSA\r
95// The following is a mask value that gets applied to the truncated hash of a\r
96// platform Boot Object Authorization Certificate to create the certificateID.\r
97// A certificateID must not have any bits set to the value 1 other than bits in\r
98// this mask.\r
99//\r
100#define BIS_CERT_ID_MASK (0xFF7F7FFF)\r
101\r
102//\r
103// Macros for dealing with the EFI_BIS_DATA object obtained\r
104// from BIS_GetSignatureInfo()\r
105// BIS_GET_SIGINFO_COUNT - tells how many EFI_BIS_SIGNATURE_INFO\r
106// elements are contained in a EFI_BIS_DATA struct pointed to\r
107// by the provided EFI_BIS_DATA*.\r
108//\r
109#define BIS_GET_SIGINFO_COUNT(BisDataPtr) ((BisDataPtr)->Length / sizeof (EFI_BIS_SIGNATURE_INFO))\r
110\r
111//\r
112// BIS_GET_SIGINFO_ARRAY - produces a EFI_BIS_SIGNATURE_INFO*\r
113// from a given EFI_BIS_DATA*.\r
114//\r
115#define BIS_GET_SIGINFO_ARRAY(BisDataPtr) ((EFI_BIS_SIGNATURE_INFO *) (BisDataPtr)->Data)\r
116\r
117//\r
118// Binary Value of "X-Intel-BIS-ParameterSet" Attribute.\r
119// (Value is Base64 encoded in actual signed manifest).\r
120// {EDD35E31-07B9-11d2-83A3-00A0C91FADCF}\r
121//\r
122#define BOOT_OBJECT_AUTHORIZATION_PARMSET_GUID \\r
123 { \\r
124 0xedd35e31, 0x7b9, 0x11d2, \\r
125 { \\r
126 0x83, 0xa3, 0x0, 0xa0, 0xc9, 0x1f, 0xad, 0xcf \\r
127 } \\r
128 }\r
129\r
130//\r
131// Support old name for backward compatible\r
132//\r
133#define BOOT_OBJECT_AUTHORIZATION_PARMSET_GUIDVALUE \\r
134 BOOT_OBJECT_AUTHORIZATION_PARMSET_GUID\r
135\r
136/** \r
137 Initializes the BIS service, checking that it is compatible with the version requested by the caller.\r
138 After this call, other BIS functions may be invoked. \r
139 \r
140 @param This A pointer to the EFI_BIS_PROTOCOL object.\r
141 @param AppHandle The function writes the new BIS_APPLICATION_HANDLE if \r
142 successful, otherwise it writes NULL. The caller must eventually\r
143 destroy this handle by calling Shutdown(). \r
144 @param InterfaceVersion On input, the caller supplies the major version number of the\r
145 interface version desired. \r
146 On output, both the major and minor \r
147 version numbers are updated with the major and minor version\r
148 numbers of the interface \r
149 @param TargetAddress Indicates a network or device address of the BIS platform to connect to. \r
150\r
151 @retval EFI_SUCCESS The function completed successfully.\r
152 @retval EFI_INCOMPATIBLE_VERSION The InterfaceVersion.Major requested by the \r
153 caller was not compatible with the interface version of the\r
154 @retval EFI_UNSUPPORTED This is a local-platform implementation and \r
155 TargetAddress.Data was not NULL, or \r
156 TargetAddress.Data was any other value that was not\r
157 supported by the implementation. \r
158 @retval EFI_OUT_OF_RESOURCES The function failed due to lack of memory or other resources. \r
159 @retval EFI_DEVICE_ERROR The function encountered an unexpected internal failure.\r
160 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
161 \r
162**/ \r
163typedef\r
164EFI_STATUS\r
165(EFIAPI *EFI_BIS_INITIALIZE) (\r
166 IN EFI_BIS_PROTOCOL *This, \r
167 OUT BIS_APPLICATION_HANDLE *AppHandle, \r
168 IN OUT EFI_BIS_VERSION *InterfaceVersion, \r
169 IN EFI_BIS_DATA *TargetAddress \r
170 );\r
171\r
172/** \r
173 Frees memory structures allocated and returned by other functions in the EFI_BIS protocol. \r
174 \r
175 @param AppHandle An opaque handle that identifies the caller's instance of initialization\r
176 of the BIS service. \r
177 @param ToFree An EFI_BIS_DATA* and associated memory block to be freed.\r
178\r
179 @retval EFI_SUCCESS The function completed successfully.\r
180 @retval EFI_NO_MAPPING The AppHandle parameter is not or is no longer a valid\r
181 application instance handle associated with the EFI_BIS protocol. \r
182 @retval EFI_OUT_OF_RESOURCES The function failed due to lack of memory or other resources. \r
183 @retval EFI_INVALID_PARAMETER The ToFree parameter is not or is no longer a memory resource\r
184 associated with this AppHandle. \r
185 \r
186**/ \r
187typedef\r
188EFI_STATUS\r
189(EFIAPI *EFI_BIS_FREE) (\r
190 IN BIS_APPLICATION_HANDLE AppHandle, \r
191 IN EFI_BIS_DATA *ToFree \r
192 );\r
193\r
194/** \r
195 Shuts down an application's instance of the BIS service, invalidating the application handle. After\r
196 this call, other BIS functions may no longer be invoked using the application handle value. \r
197 \r
198 @param AppHandle An opaque handle that identifies the caller's instance of initialization\r
199 of the BIS service. \r
200\r
201 @retval EFI_SUCCESS The function completed successfully.\r
202 @retval EFI_NO_MAPPING The AppHandle parameter is not or is no longer a valid\r
203 application instance handle associated with the EFI_BIS protocol. \r
204 @retval EFI_OUT_OF_RESOURCES The function failed due to lack of memory or other resources. \r
205 @retval EFI_DEVICE_ERROR The function encountered an unexpected internal failure. \r
206 \r
207**/ \r
208typedef\r
209EFI_STATUS\r
210(EFIAPI *EFI_BIS_SHUTDOWN) (\r
211 IN BIS_APPLICATION_HANDLE AppHandle \r
212 );\r
213\r
214/** \r
215 Retrieves the certificate that has been configured as the identity of the organization designated as\r
216 the source of authorization for signatures of boot objects.\r
217 \r
218 @param AppHandle An opaque handle that identifies the caller's instance of initialization\r
219 of the BIS service. \r
220 @param Certificate The function writes an allocated EFI_BIS_DATA* containing the Boot\r
221 Object Authorization Certificate object. \r
222\r
223 @retval EFI_SUCCESS The function completed successfully.\r
224 @retval EFI_NO_MAPPING The AppHandle parameter is not or is no longer a valid\r
225 application instance handle associated with the EFI_BIS protocol. \r
226 @retval EFI_NOT_FOUND There is no Boot Object Authorization Certificate currently installed. \r
227 @retval EFI_OUT_OF_RESOURCES The function failed due to lack of memory or other resources. \r
228 @retval EFI_INVALID_PARAMETER The Certificate parameter supplied by the caller is NULL or\r
229 an invalid memory reference. \r
230 \r
231**/ \r
232typedef\r
233EFI_STATUS\r
234(EFIAPI *EFI_BIS_GET_BOOT_OBJECT_AUTHORIZATION_CERTIFICATE) (\r
235 IN BIS_APPLICATION_HANDLE AppHandle, \r
236 OUT EFI_BIS_DATA **Certificate \r
237 );\r
238\r
239/** \r
240 Verifies the integrity and authorization of the indicated data object according to the\r
241 indicated credentials. \r
242 \r
243 @param AppHandle An opaque handle that identifies the caller's instance of initialization\r
244 of the BIS service. \r
245 @param Credentials A Signed Manifest containing verification information for the indicated\r
246 data object. \r
247 @param DataObject An in-memory copy of the raw data object to be verified.\r
248 @param IsVerified The function writes TRUE if the verification succeeded, otherwise\r
249 FALSE. \r
250 \r
251 @retval EFI_SUCCESS The function completed successfully.\r
252 @retval EFI_NO_MAPPING The AppHandle parameter is not or is no longer a valid\r
253 application instance handle associated with the EFI_BIS protocol. \r
254 @retval EFI_OUT_OF_RESOURCES The function failed due to lack of memory or other resources. \r
255 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
256 @retval EFI_SECURITY_VIOLATION The signed manifest supplied as the Credentials parameter\r
257 was invalid (could not be parsed) or Platform-specific authorization failed, etc.\r
258 @retval EFI_DEVICE_ERROR An unexpected internal error occurred. \r
259 \r
260**/ \r
261typedef\r
262EFI_STATUS\r
263(EFIAPI *EFI_BIS_VERIFY_BOOT_OBJECT) (\r
264 IN BIS_APPLICATION_HANDLE AppHandle, \r
265 IN EFI_BIS_DATA *Credentials, \r
266 IN EFI_BIS_DATA *DataObject, \r
267 OUT BOOLEAN *IsVerified \r
268 );\r
269\r
270/** \r
271 Retrieves the current status of the Boot Authorization Check Flag.\r
272 \r
273 @param AppHandle An opaque handle that identifies the caller's instance of initialization\r
274 of the BIS service. \r
275 @param CheckIsRequired The function writes the value TRUE if a Boot Authorization Check is\r
276 currently required on this platform, otherwise the function writes \r
277 FALSE. \r
278 \r
279 @retval EFI_SUCCESS The function completed successfully.\r
280 @retval EFI_NO_MAPPING The AppHandle parameter is not or is no longer a valid\r
281 application instance handle associated with the EFI_BIS protocol. \r
282 @retval EFI_OUT_OF_RESOURCES The function failed due to lack of memory or other resources. \r
283 @retval EFI_INVALID_PARAMETER The CheckIsRequired parameter supplied by the caller is\r
284 NULL or an invalid memory reference. \r
285 \r
286**/ \r
287typedef\r
288EFI_STATUS\r
289(EFIAPI *EFI_BIS_GET_BOOT_OBJECT_AUTHORIZATION_CHECKFLAG) (\r
290 IN BIS_APPLICATION_HANDLE AppHandle, \r
291 OUT BOOLEAN *CheckIsRequired \r
292 );\r
293\r
294/** \r
295 Retrieves a unique token value to be included in the request credential for the next update of any\r
296 parameter in the Boot Object Authorization set \r
297 \r
298 @param AppHandle An opaque handle that identifies the caller's instance of initialization\r
299 of the BIS service. \r
300 @param UpdateToken The function writes an allocated EFI_BIS_DATA* containing the new\r
301 unique update token value. \r
302 \r
303 @retval EFI_SUCCESS The function completed successfully.\r
304 @retval EFI_NO_MAPPING The AppHandle parameter is not or is no longer a valid\r
305 application instance handle associated with the EFI_BIS protocol. \r
306 @retval EFI_OUT_OF_RESOURCES The function failed due to lack of memory or other resources. \r
307 @retval EFI_INVALID_PARAMETER The UpdateToken parameter supplied by the caller is NULL or\r
308 an invalid memory reference. \r
309 @retval EFI_DEVICE_ERROR An unexpected internal error occurred. \r
310 \r
311**/ \r
312typedef\r
313EFI_STATUS\r
314(EFIAPI *EFI_BIS_GET_BOOT_OBJECT_AUTHORIZATION_UPDATE_TOKEN) (\r
315 IN BIS_APPLICATION_HANDLE AppHandle, \r
316 OUT EFI_BIS_DATA **UpdateToken \r
317 );\r
318\r
319/** \r
320 Updates one of the configurable parameters of the Boot Object Authorization set.\r
321 \r
322 @param AppHandle An opaque handle that identifies the caller's instance of initialization\r
323 of the BIS service. \r
324 @param RequestCredential This is a Signed Manifest with embedded attributes that carry the details\r
325 of the requested update. \r
326 @param NewUpdateToken The function writes an allocated EFI_BIS_DATA* containing the new \r
327 unique update token value. \r
328 \r
329 @retval EFI_SUCCESS The function completed successfully. \r
330 @retval EFI_NO_MAPPING The AppHandle parameter is not or is no longer a valid \r
331 application instance handle associated with the EFI_BIS protocol. \r
332 @retval EFI_OUT_OF_RESOURCES The function failed due to lack of memory or other resources. \r
333 @retval EFI_INVALID_PARAMETER One or more parameters are invalid. \r
334 @retval EFI_SECURITY_VIOLATION The signed manifest supplied as the RequestCredential parameter \r
335 was invalid (could not be parsed) or Platform-specific authorization failed, etc. \r
336 @retval EFI_DEVICE_ERROR An unexpected internal error occurred. \r
337 \r
338**/ \r
339typedef\r
340EFI_STATUS\r
341(EFIAPI *EFI_BIS_UPDATE_BOOT_OBJECT_AUTHORIZATION) (\r
342 IN BIS_APPLICATION_HANDLE AppHandle, \r
343 IN EFI_BIS_DATA *RequestCredential, \r
344 OUT EFI_BIS_DATA **NewUpdateToken \r
345 );\r
346\r
347/** \r
348 Verifies the integrity and authorization of the indicated data object according to the indicated\r
349 credentials and authority certificate. \r
350 \r
351 @param AppHandle An opaque handle that identifies the caller's instance of initialization\r
352 of the BIS service. \r
353 @param Credentials A Signed Manifest containing verification information for the\r
354 indicated data object. \r
355 @param DataObject An in-memory copy of the raw data object to be verified.\r
356 @param SectionName An ASCII (not Unicode) string giving the section name in the \r
357 manifest holding the verification information (in other words,\r
358 hash value) that corresponds to DataObject. \r
359 @param AuthorityCertificate A digital certificate whose public key must match the signer's \r
360 public key which is found in the credentials. \r
361 @param IsVerified The function writes TRUE if the verification was successful.\r
362 Otherwise, the function writes FALSE. \r
363 \r
364 @retval EFI_SUCCESS The function completed successfully. \r
365 @retval EFI_NO_MAPPING The AppHandle parameter is not or is no longer a valid \r
366 application instance handle associated with the EFI_BIS protocol. \r
367 @retval EFI_OUT_OF_RESOURCES The function failed due to lack of memory or other resources. \r
368 @retval EFI_INVALID_PARAMETER One or more parameters are invalid. \r
369 @retval EFI_SECURITY_VIOLATION The Credentials.Data supplied by the caller is NULL,\r
370 or the AuthorityCertificate supplied by the caller was \r
371 invalid (could not be parsed), \r
372 or Platform-specific authorization failed, etc. \r
373 @retval EFI_DEVICE_ERROR An unexpected internal error occurred. \r
374 \r
375**/ \r
376typedef\r
377EFI_STATUS\r
378(EFIAPI *EFI_BIS_VERIFY_OBJECT_WITH_CREDENTIAL) (\r
379 IN BIS_APPLICATION_HANDLE AppHandle, \r
380 IN EFI_BIS_DATA *Credentials, \r
381 IN EFI_BIS_DATA *DataObject, \r
382 IN EFI_BIS_DATA *SectionName, \r
383 IN EFI_BIS_DATA *AuthorityCertificate, \r
384 OUT BOOLEAN *IsVerified \r
385 );\r
386\r
387/** \r
388 Retrieves a list of digital certificate identifier, digital signature algorithm, hash algorithm, and keylength\r
389 combinations that the platform supports. \r
390 \r
391 @param AppHandle An opaque handle that identifies the caller's instance of initialization\r
392 of the BIS service. \r
393 @param SignatureInfo The function writes an allocated EFI_BIS_DATA* containing the array\r
394 of EFI_BIS_SIGNATURE_INFO structures representing the supported \r
395 digital certificate identifier, algorithm, and key length combinations. \r
396 \r
397 @retval EFI_SUCCESS The function completed successfully. \r
398 @retval EFI_NO_MAPPING The AppHandle parameter is not or is no longer a valid \r
399 application instance handle associated with the EFI_BIS protocol. \r
400 @retval EFI_OUT_OF_RESOURCES The function failed due to lack of memory or other resources. \r
401 @retval EFI_INVALID_PARAMETER The SignatureInfo parameter supplied by the caller is NULL\r
402 or an invalid memory reference. \r
403 @retval EFI_DEVICE_ERROR An unexpected internal error occurred. \r
404 \r
405**/\r
406typedef\r
407EFI_STATUS\r
408(EFIAPI *EFI_BIS_GET_SIGNATURE_INFO) (\r
409 IN BIS_APPLICATION_HANDLE AppHandle, \r
410 OUT EFI_BIS_DATA **SignatureInfo \r
411 );\r
412\r
413struct _EFI_BIS_PROTOCOL {\r
414 EFI_BIS_INITIALIZE Initialize;\r
415 EFI_BIS_SHUTDOWN Shutdown;\r
416 EFI_BIS_FREE Free;\r
417 EFI_BIS_GET_BOOT_OBJECT_AUTHORIZATION_CERTIFICATE GetBootObjectAuthorizationCertificate;\r
418 EFI_BIS_GET_BOOT_OBJECT_AUTHORIZATION_CHECKFLAG GetBootObjectAuthorizationCheckFlag;\r
419 EFI_BIS_GET_BOOT_OBJECT_AUTHORIZATION_UPDATE_TOKEN GetBootObjectAuthorizationUpdateToken;\r
420 EFI_BIS_GET_SIGNATURE_INFO GetSignatureInfo;\r
421 EFI_BIS_UPDATE_BOOT_OBJECT_AUTHORIZATION UpdateBootObjectAuthorization;\r
422 EFI_BIS_VERIFY_BOOT_OBJECT VerifyBootObject;\r
423 EFI_BIS_VERIFY_OBJECT_WITH_CREDENTIAL VerifyObjectWithCredential;\r
424};\r
425\r
426extern EFI_GUID gEfiBisProtocolGuid;\r
427extern EFI_GUID gBootObjectAuthorizationParmsetGuid;\r
428\r
429#endif\r