]>
Commit | Line | Data |
---|---|---|
e5b31668 JY |
1 | /** @file\r |
2 | FMP capsule authenitcation Library.\r | |
3 | \r | |
4 | Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r | |
5 | 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 | |
13 | **/\r | |
14 | \r | |
15 | \r | |
16 | #ifndef __FMP_AUTHENTICATION_LIB_H__\r | |
17 | #define __FMP_AUTHENTICATION_LIB_H__\r | |
18 | \r | |
19 | #include <Protocol/FirmwareManagement.h>\r | |
20 | \r | |
21 | /**\r | |
22 | The function is used to do the authentication for FMP capsule based upon\r | |
23 | EFI_FIRMWARE_IMAGE_AUTHENTICATION.\r | |
24 | \r | |
25 | The FMP capsule image should start with EFI_FIRMWARE_IMAGE_AUTHENTICATION,\r | |
26 | followed by the payload.\r | |
27 | \r | |
28 | If the return status is RETURN_SUCCESS, the caller may continue the rest\r | |
29 | FMP update process.\r | |
30 | If the return status is NOT RETURN_SUCCESS, the caller should stop the FMP\r | |
31 | update process and convert the return status to LastAttemptStatus\r | |
32 | to indicate that FMP update fails.\r | |
33 | The LastAttemptStatus can be got from ESRT table or via\r | |
34 | EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetImageInfo().\r | |
35 | \r | |
36 | Caution: This function may receive untrusted input.\r | |
37 | \r | |
38 | @param[in] Image Points to an FMP authentication image, started from EFI_FIRMWARE_IMAGE_AUTHENTICATION.\r | |
39 | @param[in] ImageSize Size of the authentication image in bytes.\r | |
40 | @param[in] PublicKeyData The public key data used to validate the signature.\r | |
41 | @param[in] PublicKeyDataLength The length of the public key data.\r | |
42 | \r | |
43 | @retval RETURN_SUCCESS Authentication pass.\r | |
44 | The LastAttemptStatus should be LAST_ATTEMPT_STATUS_SUCCESS.\r | |
45 | @retval RETURN_SECURITY_VIOLATION Authentication fail.\r | |
46 | The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_AUTH_ERROR.\r | |
47 | @retval RETURN_INVALID_PARAMETER The image is in an invalid format.\r | |
48 | The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT.\r | |
49 | @retval RETURN_UNSUPPORTED No Authentication handler associated with CertType.\r | |
50 | The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT.\r | |
51 | @retval RETURN_UNSUPPORTED Image or ImageSize is invalid.\r | |
52 | The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT.\r | |
53 | @retval RETURN_OUT_OF_RESOURCES No Authentication handler associated with CertType.\r | |
54 | The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INSUFFICIENT_RESOURCES.\r | |
55 | **/\r | |
56 | RETURN_STATUS\r | |
57 | EFIAPI\r | |
58 | AuthenticateFmpImage (\r | |
59 | IN EFI_FIRMWARE_IMAGE_AUTHENTICATION *Image,\r | |
60 | IN UINTN ImageSize,\r | |
61 | IN CONST UINT8 *PublicKeyData,\r | |
62 | IN UINTN PublicKeyDataLength\r | |
63 | );\r | |
64 | \r | |
65 | #endif\r | |
66 | \r |