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