Skip to content

Commit 0ee9828

Browse files
committed
OvmfPkg/IntelTdx: Enable vTPM in IntelTdxX64
In IntelTdxX64, vTPM needs to be detected at runtime, that requires the vTPM featuer must be enabled by default. Signed-off-by: Min Xu <[email protected]> Signed-off-by: Ceping Sun <[email protected]>
1 parent c0cab50 commit 0ee9828

File tree

2 files changed

+58
-4
lines changed

2 files changed

+58
-4
lines changed

OvmfPkg/IntelTdx/IntelTdxX64.dsc

+49-2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
#
3737
DEFINE BUILD_SHELL = TRUE
3838

39+
#
40+
# vTPM Should be enabled
41+
#
42+
DEFINE TPM2_ENABLE = TRUE
43+
DEFINE VTPM_ENABLE = TRUE
44+
3945
#
4046
# Device drivers
4147
#
@@ -90,6 +96,13 @@
9096
INTEL:*_*_*_CC_FLAGS = /D TDX_PEI_LESS_BOOT
9197
GCC:*_*_*_CC_FLAGS = -D TDX_PEI_LESS_BOOT
9298

99+
#
100+
# Add VTPM_FEATURE_ENABLED
101+
#
102+
MSFT:*_*_*_CC_FLAGS = /D VTPM_FEATURE_ENABLED
103+
INTEL:*_*_*_CC_FLAGS = /D VTPM_FEATURE_ENABLED
104+
GCC:*_*_*_CC_FLAGS = -D VTPM_FEATURE_ENABLED
105+
93106
[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
94107
GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
95108
XCODE:*_*_*_DLINK_FLAGS = -seg1addr 0x1000 -segalign 0x1000
@@ -183,7 +196,7 @@
183196
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
184197

185198
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
186-
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
199+
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
187200
RngLib|MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
188201

189202
!if $(SECURE_BOOT_ENABLE) == TRUE
@@ -217,6 +230,7 @@
217230
TdxLib|MdePkg/Library/TdxLib/TdxLib.inf
218231
TdxMailboxLib|OvmfPkg/Library/TdxMailboxLib/TdxMailboxLib.inf
219232
PlatformInitLib|OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf
233+
PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
220234

221235
[LibraryClasses.common.SEC]
222236
TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.inf
@@ -526,6 +540,11 @@
526540

527541
gEfiMdePkgTokenSpaceGuid.PcdFSBClock|1000000000
528542

543+
gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
544+
545+
# Support SHA256 SHA384 SHA512
546+
gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask|0
547+
529548
################################################################################
530549
#
531550
# Components Section - list of all EDK II Modules needed by this Platform.
@@ -541,7 +560,12 @@
541560
<LibraryClasses>
542561
NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
543562
NULL|OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelperLib.inf
544-
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SecCryptLib.inf
563+
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
564+
MemEncryptTdxLib|OvmfPkg/Library/BaseMemEncryptTdxLib/SecBaseMemEncryptTdxLib.inf
565+
Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
566+
Tpm2DeviceLib|OvmfPkg/Tcg/Tpm2DeviceLibVTpmTd/Tpm2DeviceLibVTpmTdSec.inf
567+
!include ../VmmSpdmLibs.dsc.inc
568+
VmmSpdmVTpmCommunicatorLib|OvmfPkg/Library/VmmSpdmVTpm/VmmSpdmVTpmCommunicatorLibSecPei.inf
545569
}
546570

547571
#
@@ -753,6 +777,11 @@
753777
OvmfPkg/IoMmuDxe/IoMmuDxe.inf
754778

755779
OvmfPkg/TdxDxe/TdxDxe.inf
780+
OvmfPkg/Tcg/VmmSpdmTunnel/VmmSpdmTunnelDxe.inf {
781+
<LibraryClasses>
782+
!include ../VmmSpdmLibs.dsc.inc
783+
VmmSpdmVTpmCommunicatorLib|OvmfPkg/Library/VmmSpdmVTpm/VmmSpdmVTpmCommunicatorLibDxe.inf
784+
}
756785

757786
#
758787
# Variable driver stack (non-SMM)
@@ -776,3 +805,21 @@
776805
HashLib|SecurityPkg/Library/HashLibTdx/HashLibTdx.inf
777806
NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
778807
}
808+
809+
#
810+
# TCG2 Measurement Protocol
811+
#
812+
SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf {
813+
<LibraryClasses>
814+
Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
815+
Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
816+
Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterDxe.inf
817+
NULL|OvmfPkg/Tcg/Tpm2DeviceLibVTpmTd/Tpm2InstanceLibVTpmTd.inf
818+
!include ../VmmSpdmLibs.dsc.inc
819+
HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf
820+
NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
821+
NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
822+
NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
823+
NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
824+
NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
825+
}

OvmfPkg/IntelTdx/IntelTdxX64.fdf

+9-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
################################################################################
1212

1313
[Defines]
14-
!include OvmfPkg/Include/Fdf/OvmfPkgDefines.fdf.inc
14+
!include OvmfPkg/Include/Fdf/OvmfPkgIntelDefines.fdf.inc
1515

1616
#
1717
# Build the variable store and the firmware code as one unified flash device
@@ -173,6 +173,7 @@ APRIORI DXE {
173173
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
174174
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
175175
INF OvmfPkg/TdxDxe/TdxDxe.inf
176+
INF OvmfPkg/Tcg/VmmSpdmTunnel/VmmSpdmTunnelDxe.inf
176177
INF OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
177178
}
178179

@@ -240,7 +241,8 @@ INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
240241
INF OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
241242

242243
INF FatPkg/EnhancedFatDxe/Fat.inf
243-
INF OvmfPkg/TdxDxe/TdxDxe.inf
244+
INF OvmfPkg/TdxDxe/TdxDxe.inf
245+
INF OvmfPkg/Tcg/VmmSpdmTunnel/VmmSpdmTunnelDxe.inf
244246

245247
INF OvmfPkg/IoMmuDxe/IoMmuDxe.inf
246248

@@ -257,6 +259,11 @@ INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
257259
#
258260
INF SecurityPkg/Tcg/TdTcg2Dxe/TdTcg2Dxe.inf
259261

262+
#
263+
# EFI_TCG2_PROTOCOL
264+
#
265+
INF SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
266+
260267
################################################################################
261268

262269
[FV.NCCFV]

0 commit comments

Comments
 (0)