MdeModulePkg/FmpAuthenticationLibNull: Add NULL instance FMP.
authorJiewen Yao <jiewen.yao@intel.com>
Wed, 21 Sep 2016 01:46:32 +0000 (09:46 +0800)
committerJiewen Yao <jiewen.yao@intel.com>
Tue, 8 Nov 2016 14:36:55 +0000 (22:36 +0800)
Add NULL instance to pass build.

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/Library/FmpAuthenticationLibNull/FmpAuthenticationLibNull.c [new file with mode: 0644]
MdeModulePkg/Library/FmpAuthenticationLibNull/FmpAuthenticationLibNull.inf [new file with mode: 0644]
MdeModulePkg/Library/FmpAuthenticationLibNull/FmpAuthenticationLibNull.uni [new file with mode: 0644]

diff --git a/MdeModulePkg/Library/FmpAuthenticationLibNull/FmpAuthenticationLibNull.c b/MdeModulePkg/Library/FmpAuthenticationLibNull/FmpAuthenticationLibNull.c
new file mode 100644 (file)
index 0000000..02ff504
--- /dev/null
@@ -0,0 +1,66 @@
+/** @file\r
+  NULL FMP authentication 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
+#include <Uefi.h>\r
+\r
+#include <Library/DebugLib.h>\r
+#include <Library/FmpAuthenticationLib.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
+  ASSERT(FALSE);\r
+  return RETURN_UNSUPPORTED;\r
+}\r
diff --git a/MdeModulePkg/Library/FmpAuthenticationLibNull/FmpAuthenticationLibNull.inf b/MdeModulePkg/Library/FmpAuthenticationLibNull/FmpAuthenticationLibNull.inf
new file mode 100644 (file)
index 0000000..f9b87ca
--- /dev/null
@@ -0,0 +1,40 @@
+## @file\r
+# FmpAuthentication Library\r
+#\r
+# NULL Instance of FmpAuthentication Library.\r
+#\r
+# Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+#\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
+#  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
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = FmpAuthenticationLibNull\r
+  MODULE_UNI_FILE                = FmpAuthenticationLibNull.uni\r
+  FILE_GUID                      = 5011522C-7B0E-4ACB-8E30-9B1D133CF2E0\r
+  MODULE_TYPE                    = BASE\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = FmpAuthenticationLib\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources]\r
+  FmpAuthenticationLibNull.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  MdeModulePkg/MdeModulePkg.dec\r
+\r
+[LibraryClasses]\r
+  DebugLib\r
diff --git a/MdeModulePkg/Library/FmpAuthenticationLibNull/FmpAuthenticationLibNull.uni b/MdeModulePkg/Library/FmpAuthenticationLibNull/FmpAuthenticationLibNull.uni
new file mode 100644 (file)
index 0000000..69fd6e1
--- /dev/null
@@ -0,0 +1,22 @@
+// /** @file\r
+// FmpAuthentication Library\r
+//\r
+// NULL Instance of FmpAuthentication Library.\r
+//\r
+// Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+//\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
+#string STR_MODULE_ABSTRACT             #language en-US "FmpAuthentication Library"\r
+\r
+#string STR_MODULE_DESCRIPTION          #language en-US "NULL Instance of FmpAuthentication Library."\r
+\r