SecurityPkg: add null version of RpmcLib
authorJian J Wang <jian.j.wang@intel.com>
Thu, 12 Mar 2020 05:42:40 +0000 (13:42 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 27 Mar 2020 16:41:05 +0000 (16:41 +0000)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2594

Add null version of RpmcLib instance. The full version should be provided
by platform which supports RPMC device.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Nishant C Mistry <nishant.c.mistry@intel.com>
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
SecurityPkg/Library/RpmcLibNull/RpmcLibNull.c [new file with mode: 0644]
SecurityPkg/Library/RpmcLibNull/RpmcLibNull.inf [new file with mode: 0644]
SecurityPkg/SecurityPkg.dsc

diff --git a/SecurityPkg/Library/RpmcLibNull/RpmcLibNull.c b/SecurityPkg/Library/RpmcLibNull/RpmcLibNull.c
new file mode 100644 (file)
index 0000000..e1dd09e
--- /dev/null
@@ -0,0 +1,47 @@
+/** @file\r
+  NULL RpmcLib instance for build purpose.\r
+\r
+Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include <Library/DebugLib.h>\r
+#include <Library/RpmcLib.h>\r
+\r
+/**\r
+  Requests the monotonic counter from the designated RPMC counter.\r
+\r
+  @param[out]   CounterValue            A pointer to a buffer to store the RPMC value.\r
+\r
+  @retval       EFI_SUCCESS             The operation completed successfully.\r
+  @retval       EFI_DEVICE_ERROR        A device error occurred while attempting to update the counter.\r
+  @retval       EFI_UNSUPPORTED         The operation is un-supported.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+RequestMonotonicCounter (\r
+  OUT UINT32  *CounterValue\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return EFI_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+  Increments the monotonic counter in the SPI flash device by 1.\r
+\r
+  @retval       EFI_SUCCESS             The operation completed successfully.\r
+  @retval       EFI_DEVICE_ERROR        A device error occurred while attempting to update the counter.\r
+  @retval       EFI_UNSUPPORTED         The operation is un-supported.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+IncrementMonotonicCounter (\r
+  VOID\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return EFI_UNSUPPORTED;\r
+}\r
+\r
diff --git a/SecurityPkg/Library/RpmcLibNull/RpmcLibNull.inf b/SecurityPkg/Library/RpmcLibNull/RpmcLibNull.inf
new file mode 100644 (file)
index 0000000..500edfa
--- /dev/null
@@ -0,0 +1,33 @@
+## @file\r
+#  Provides Null version of RpmcLib for build purpose.\r
+#\r
+#  Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>\r
+#  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+##\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010029\r
+  BASE_NAME                      = RpmcLibNull\r
+  FILE_GUID                      = FAE0BA22-92E2-4334-8F0F-96AFF9BAE360\r
+  MODULE_TYPE                    = BASE\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = RpmcLib\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 Arm AArch64\r
+#\r
+\r
+[Sources]\r
+  RpmcLibNull.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  SecurityPkg/SecurityPkg.dec\r
+\r
+[LibraryClasses]\r
+  BaseLib\r
+  DebugLib\r
+\r
index a2eeadd..97e0e7e 100644 (file)
@@ -64,6 +64,7 @@
   TcgStorageCoreLib|SecurityPkg/Library/TcgStorageCoreLib/TcgStorageCoreLib.inf\r
   TcgStorageOpalLib|SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalLib.inf\r
   ResetSystemLib|MdeModulePkg/Library/BaseResetSystemLibNull/BaseResetSystemLibNull.inf\r
+  RpmcLib|SecurityPkg/Library/RpmcLibNull/RpmcLibNull.inf\r
 \r
 [LibraryClasses.ARM]\r
   #\r
   SecurityPkg/Library/TcgStorageCoreLib/TcgStorageCoreLib.inf\r
   SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalLib.inf\r
 \r
+  #\r
+  # Variable Confidentiality & Integrity\r
+  #\r
+  SecurityPkg/Library/RpmcLibNull/RpmcLibNull.inf\r
+\r
   #\r
   # Other\r
   #\r