--- /dev/null
+/** @file\r
+ TdxHelperLib header file\r
+\r
+ Copyright (c) 2021 - 2023, Intel Corporation. All rights reserved.<BR>\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef TDX_HELPER_LIB_H\r
+#define TDX_HELPER_LIB_H\r
+\r
+#include <PiPei.h>\r
+\r
+/**\r
+ In Tdx guest, some information need to be passed from host VMM to guest\r
+ firmware. For example, the memory resource, etc. These information are\r
+ prepared by host VMM and put in TdHob which is described in TdxMetadata.\r
+ TDVF processes the TdHob to accept memories.\r
+\r
+ @retval EFI_SUCCESS Successfully process the TdHob\r
+ @retval Others Other error as indicated\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+TdxHelperProcessTdHob (\r
+ VOID\r
+ );\r
+\r
+/**\r
+ In Tdx guest, TdHob is passed from host VMM to guest firmware and it contains\r
+ the information of the memory resource. From the security perspective before\r
+ it is consumed, it should be measured and extended.\r
+ *\r
+ * @retval EFI_SUCCESS Successfully measure the TdHob\r
+ * @retval Others Other error as indicated\r
+ */\r
+EFI_STATUS\r
+EFIAPI\r
+TdxHelperMeasureTdHob (\r
+ VOID\r
+ );\r
+\r
+/**\r
+ * In Tdx guest, Configuration FV (CFV) is treated as external input because it\r
+ * may contain the data provided by VMM. From the sucurity perspective Cfv image\r
+ * should be measured before it is consumed.\r
+ *\r
+ * @retval EFI_SUCCESS Successfully measure the CFV image\r
+ * @retval Others Other error as indicated\r
+ */\r
+EFI_STATUS\r
+EFIAPI\r
+TdxHelperMeasureCfvImage (\r
+ VOID\r
+ );\r
+\r
+/**\r
+ Build the GuidHob for tdx measurements which were done in SEC phase.\r
+ The measurement values are stored in WorkArea.\r
+\r
+ @retval EFI_SUCCESS The GuidHob is built successfully\r
+ @retval Others Other errors as indicated\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+TdxHelperBuildGuidHobForTdxMeasurement (\r
+ VOID\r
+ );\r
+\r
+#endif\r
--- /dev/null
+## @file\r
+# TdxHelperLib NULL instance\r
+#\r
+# Copyright (c) 2021 - 2023, Intel Corporation. All rights reserved.<BR>\r
+#\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+##\r
+\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = TdxHelperLibNull\r
+ FILE_GUID = 853603b2-53ea-463d-93e6-35d09a79e358\r
+ MODULE_TYPE = BASE\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = TdxHelperLib\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = X64\r
+#\r
+\r
+[Sources]\r
+ TdxHelperNull.c\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ OvmfPkg/OvmfPkg.dec\r
+\r
+[LibraryClasses]\r
+ BaseLib\r
--- /dev/null
+/** @file\r
+ NULL instance of TdxHelperLib\r
+\r
+ Copyright (c) 2022 - 2023, Intel Corporation. All rights reserved.<BR>\r
+\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include <Base.h>\r
+#include <PiPei.h>\r
+\r
+/**\r
+ In Tdx guest, some information need to be passed from host VMM to guest\r
+ firmware. For example, the memory resource, etc. These information are\r
+ prepared by host VMM and put in TdHob which is described in TdxMetadata.\r
+ TDVF processes the TdHob to accept memories.\r
+\r
+ @retval EFI_SUCCESS Successfully process the TdHob\r
+ @retval Others Other error as indicated\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+TdxHelperProcessTdHob (\r
+ VOID\r
+ )\r
+{\r
+ return EFI_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+ In Tdx guest, TdHob is passed from host VMM to guest firmware and it contains\r
+ the information of the memory resource. From the security perspective before\r
+ it is consumed, it should be measured and extended.\r
+ *\r
+ * @retval EFI_SUCCESS Successfully measure the TdHob\r
+ * @retval Others Other error as indicated\r
+ */\r
+EFI_STATUS\r
+EFIAPI\r
+TdxHelperMeasureTdHob (\r
+ VOID\r
+ )\r
+{\r
+ return EFI_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+ * In Tdx guest, Configuration FV (CFV) is treated as external input because it\r
+ * may contain the data provided by VMM. From the sucurity perspective Cfv image\r
+ * should be measured before it is consumed.\r
+ *\r
+ * @retval EFI_SUCCESS Successfully measure the CFV image\r
+ * @retval Others Other error as indicated\r
+ */\r
+EFI_STATUS\r
+EFIAPI\r
+TdxHelperMeasureCfvImage (\r
+ VOID\r
+ )\r
+{\r
+ return EFI_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+ Build the GuidHob for tdx measurements which were done in SEC phase.\r
+ The measurement values are stored in WorkArea.\r
+\r
+ @retval EFI_SUCCESS The GuidHob is built successfully\r
+ @retval Others Other errors as indicated\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+TdxHelperBuildGuidHobForTdxMeasurement (\r
+ VOID\r
+ )\r
+{\r
+ return EFI_UNSUPPORTED;\r
+}\r
#\r
SerializeVariablesLib|Include/Library/SerializeVariablesLib.h\r
\r
+ ## @libraryclass TdxHelper\r
+ #\r
+ TdxHelperLib|Include/Library/TdxHelperLib.h\r
+\r
## @libraryclass Declares utility functions for virtio device drivers.\r
VirtioLib|Include/Library/VirtioLib.h\r
\r