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