]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/Include: Add FmpAuthenticationLib header.
authorJiewen Yao <jiewen.yao@intel.com>
Wed, 21 Sep 2016 01:27:10 +0000 (09:27 +0800)
committerJiewen Yao <jiewen.yao@intel.com>
Tue, 8 Nov 2016 14:36:48 +0000 (22:36 +0800)
This library is used to authenticate a UEFI defined FMP Capsule.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
MdeModulePkg/Include/Library/FmpAuthenticationLib.h [new file with mode: 0644]

diff --git a/MdeModulePkg/Include/Library/FmpAuthenticationLib.h b/MdeModulePkg/Include/Library/FmpAuthenticationLib.h
new file mode 100644 (file)
index 0000000..2910c91
--- /dev/null
@@ -0,0 +1,66 @@
+/** @file\r
+  FMP capsule authenitcation Library.\r
+\r
+Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+\r
+#ifndef __FMP_AUTHENTICATION_LIB_H__\r
+#define __FMP_AUTHENTICATION_LIB_H__\r
+\r
+#include <Protocol/FirmwareManagement.h>\r
+\r
+/**\r
+  The function is used to do the authentication for FMP capsule based upon\r
+  EFI_FIRMWARE_IMAGE_AUTHENTICATION.\r
+\r
+  The FMP capsule image should start with EFI_FIRMWARE_IMAGE_AUTHENTICATION,\r
+  followed by the payload.\r
+\r
+  If the return status is RETURN_SUCCESS, the caller may continue the rest\r
+  FMP update process.\r
+  If the return status is NOT RETURN_SUCCESS, the caller should stop the FMP\r
+  update process and convert the return status to LastAttemptStatus\r
+  to indicate that FMP update fails.\r
+  The LastAttemptStatus can be got from ESRT table or via\r
+  EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetImageInfo().\r
+\r
+  Caution: This function may receive untrusted input.\r
+\r
+  @param[in]  Image                   Points to an FMP authentication image, started from EFI_FIRMWARE_IMAGE_AUTHENTICATION.\r
+  @param[in]  ImageSize               Size of the authentication image in bytes.\r
+  @param[in]  PublicKeyData           The public key data used to validate the signature.\r
+  @param[in]  PublicKeyDataLength     The length of the public key data.\r
+\r
+  @retval RETURN_SUCCESS            Authentication pass.\r
+                                    The LastAttemptStatus should be LAST_ATTEMPT_STATUS_SUCCESS.\r
+  @retval RETURN_SECURITY_VIOLATION Authentication fail.\r
+                                    The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_AUTH_ERROR.\r
+  @retval RETURN_INVALID_PARAMETER  The image is in an invalid format.\r
+                                    The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT.\r
+  @retval RETURN_UNSUPPORTED        No Authentication handler associated with CertType.\r
+                                    The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT.\r
+  @retval RETURN_UNSUPPORTED        Image or ImageSize is invalid.\r
+                                    The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT.\r
+  @retval RETURN_OUT_OF_RESOURCES   No Authentication handler associated with CertType.\r
+                                    The LastAttemptStatus should be LAST_ATTEMPT_STATUS_ERROR_INSUFFICIENT_RESOURCES.\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+AuthenticateFmpImage (\r
+  IN EFI_FIRMWARE_IMAGE_AUTHENTICATION  *Image,\r
+  IN UINTN                              ImageSize,\r
+  IN CONST UINT8                        *PublicKeyData,\r
+  IN UINTN                              PublicKeyDataLength\r
+  );\r
+\r
+#endif\r
+\r