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