]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg: add RpmcLib and VariableKeyLib public headers
authorJian J Wang <jian.j.wang@intel.com>
Thu, 12 Mar 2020 05:40:24 +0000 (13:40 +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

RpmcLib.h and VariableKeyLib.h are header files required to access RPMC
device and Key generator from platform. They will be used to ensure the
integrity and confidentiality of NV variables.

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: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
SecurityPkg/Include/Library/RpmcLib.h [new file with mode: 0644]
SecurityPkg/Include/Library/VariableKeyLib.h [new file with mode: 0644]
SecurityPkg/SecurityPkg.dec

diff --git a/SecurityPkg/Include/Library/RpmcLib.h b/SecurityPkg/Include/Library/RpmcLib.h
new file mode 100644 (file)
index 0000000..5882bfa
--- /dev/null
@@ -0,0 +1,43 @@
+/** @file\r
+  Public definitions for the Replay Protected Monotonic Counter (RPMC) Library.\r
+\r
+Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef _RPMC_LIB_H_\r
+#define _RPMC_LIB_H_\r
+\r
+#include <Uefi/UefiBaseType.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
+/**\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
+#endif\r
+\r
diff --git a/SecurityPkg/Include/Library/VariableKeyLib.h b/SecurityPkg/Include/Library/VariableKeyLib.h
new file mode 100644 (file)
index 0000000..c805e2d
--- /dev/null
@@ -0,0 +1,60 @@
+/** @file\r
+  Public definitions for Variable Key Library.\r
+\r
+Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef _VARIABLE_KEY_LIB_H_\r
+#define _VARIABLE_KEY_LIB_H_\r
+\r
+#include <Uefi/UefiBaseType.h>\r
+\r
+/**\r
+  Retrieves the key for integrity and/or confidentiality of variables.\r
+\r
+  @param[out]     VariableKey         A pointer to pointer for the variable key buffer.\r
+  @param[in,out]  VariableKeySize     The size in bytes of the variable key.\r
+\r
+  @retval       EFI_SUCCESS             The variable key was returned.\r
+  @retval       EFI_DEVICE_ERROR        An error occurred while attempting to get the variable key.\r
+  @retval       EFI_ACCESS_DENIED       The function was invoked after locking the key interface.\r
+  @retval       EFI_UNSUPPORTED         The variable key is not supported in the current boot configuration.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+GetVariableKey (\r
+      OUT VOID    **VariableKey,\r
+  IN  OUT UINTN   *VariableKeySize\r
+  );\r
+\r
+/**\r
+  Regenerates the variable key.\r
+\r
+  @retval       EFI_SUCCESS             The variable key was regenerated successfully.\r
+  @retval       EFI_DEVICE_ERROR        An error occurred while attempting to regenerate the key.\r
+  @retval       EFI_ACCESS_DENIED       The function was invoked after locking the key interface.\r
+  @retval       EFI_UNSUPPORTED         Key regeneration is not supported in the current boot configuration.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+RegenerateVariableKey (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Locks the regenerate key interface.\r
+\r
+  @retval       EFI_SUCCESS             The key interface was locked successfully.\r
+  @retval       EFI_UNSUPPORTED         Locking the key interface is not supported in the current boot configuration.\r
+  @retval       Others                  An error occurred while attempting to lock the key interface.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+LockVariableKeyInterface (\r
+  VOID\r
+  );\r
+\r
+#endif\r
+\r
index 5335cc53973a4f54c0d64dcde1eeea4324dce930..2cdfb02cc5a2a336613c7b01bc0ab01b36b81d47 100644 (file)
   #\r
   TcgStorageOpalLib|Include/Library/TcgStorageOpalLib.h\r
 \r
+  ## @libraryclass  Provides interfaces to access RPMC device.\r
+  #\r
+  RpmcLib|Include/Library/RpmcLib.h\r
+\r
+  ## @libraryclass  Provides interfaces to access variable root key.\r
+  #\r
+  VariableKeyLib|Include/Library/VariableKeyLib.h\r
+\r
 [Guids]\r
   ## Security package token space guid.\r
   # Include/Guid/SecurityPkgTokenSpace.h\r