1 | /** @file
|
---|
2 | NULL FMP authentication library.
|
---|
3 |
|
---|
4 | Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
---|
5 | This program and the accompanying materials
|
---|
6 | are licensed and made available under the terms and conditions of the BSD License
|
---|
7 | which accompanies this distribution. The full text of the license may be found at
|
---|
8 | http://opensource.org/licenses/bsd-license.php.
|
---|
9 |
|
---|
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
---|
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
---|
12 |
|
---|
13 | **/
|
---|
14 |
|
---|
15 | #include <Uefi.h>
|
---|
16 |
|
---|
17 | #include <Library/DebugLib.h>
|
---|
18 | #include <Library/FmpAuthenticationLib.h>
|
---|
19 |
|
---|
20 | /**
|
---|
21 | The function is used to do the authentication for FMP capsule based upon
|
---|
22 | EFI_FIRMWARE_IMAGE_AUTHENTICATION.
|
---|
23 |
|
---|
24 | The FMP capsule image should start with EFI_FIRMWARE_IMAGE_AUTHENTICATION,
|
---|
25 | followed by the payload.
|
---|
26 |
|
---|
27 | If the return status is RETURN_SUCCESS, the caller may continue the rest
|
---|
28 | FMP update process.
|
---|
29 | If the return status is NOT RETURN_SUCCESS, the caller should stop the FMP
|
---|
30 | update process and convert the return status to LastAttemptStatus
|
---|
31 | to indicate that FMP update fails.
|
---|
32 | The LastAttemptStatus can be got from ESRT table or via
|
---|
33 | EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetImageInfo().
|
---|
34 |
|
---|
35 | Caution: This function may receive untrusted input.
|
---|
36 |
|
---|
37 | @param[in] Image Points to an FMP authentication image, started from EFI_FIRMWARE_IMAGE_AUTHENTICATION.
|
---|
38 | @param[in] ImageSize Size of the authentication image in bytes.
|
---|
39 | @param[in] PublicKeyData The public key data used to validate the signature.
|
---|
40 | @param[in] PublicKeyDataLength The length of the public key data.
|
---|
41 |
|
---|
42 | @retval RETURN_SUCCESS Authentication pass.
|
---|
43 | The LastAttemptStatus should be LAST_ATTEMPT_STATUS_SUCCESS.
|
---|
44 | @retval RETURN_SECURITY_VIOLATION Authentication fail.
|
---|
45 | The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_AUTH_ERROR.
|
---|
46 | @retval RETURN_INVALID_PARAMETER The image is in an invalid format.
|
---|
47 | The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT.
|
---|
48 | @retval RETURN_UNSUPPORTED No Authentication handler associated with CertType.
|
---|
49 | The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT.
|
---|
50 | @retval RETURN_UNSUPPORTED Image or ImageSize is invalid.
|
---|
51 | The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT.
|
---|
52 | @retval RETURN_OUT_OF_RESOURCES No Authentication handler associated with CertType.
|
---|
53 | The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INSUFFICIENT_RESOURCES.
|
---|
54 | **/
|
---|
55 | RETURN_STATUS
|
---|
56 | EFIAPI
|
---|
57 | AuthenticateFmpImage (
|
---|
58 | IN EFI_FIRMWARE_IMAGE_AUTHENTICATION *Image,
|
---|
59 | IN UINTN ImageSize,
|
---|
60 | IN CONST UINT8 *PublicKeyData,
|
---|
61 | IN UINTN PublicKeyDataLength
|
---|
62 | )
|
---|
63 | {
|
---|
64 | ASSERT(FALSE);
|
---|
65 | return RETURN_UNSUPPORTED;
|
---|
66 | }
|
---|