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