* [RFC PATCH v1 0/4] OvmfPkg: Disable the TPM 2 platform hierarchy
@ 2021-09-13 20:57 Stefan Berger
2021-09-13 20:57 ` [RFC PATCH v1 1/4] OvmfPkg/TPM PPI: Connect default consoles for user interaction Stefan Berger
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Stefan Berger @ 2021-09-13 20:57 UTC (permalink / raw)
To: devel
Cc: mhaeuser, spbrogan, marcandre.lureau, kraxel, jiewen.yao,
Stefan Berger
This series of patches adds support for disabling the TPM 2 platform
hierarchy to Ovmf. To be able to do this we have to handle TPM 2
physical presence interface (PPI) opcodes before the TPM 2 platform
hierarchy is disabled otherwise TPM 2 commands that are sent due to the
PPI opcodes may fail if the platform hierarchy is already disabled.
Therefore, we need to invoke the handler function
Tcg2PhysicalPresenceLibProcessRequest from within
PlatformBootManagerBeforeConsole. Since handling of PPI opcodes may require
interaction with the user, we also move PlatformInitializeConsole
to before the handling of PPI codes so that the keyboard is available
when needed. The PPI handling code will activate the default consoles
only if it requires user interaction.
The question to answer at this point is whether the rearragement of
functions is correct or what an alternative should look like. There
are other BdsPlatform files that may need similar changes in a later
revision of this series.
Regards,
Stefan
Stefan Berger (4):
OvmfPkg/TPM PPI: Connect default consoles for user interaction
OvmfPkg: Handle TPM 2 physical presence codes much earlier
OvmfPkg: Reference new Tcg2PlatformDxe in the build system for
compilation
OvmfPkg: Reference new Tcg2PlatformPei in the build system
OvmfPkg/AmdSev/AmdSevX64.dsc | 8 ++++++++
OvmfPkg/AmdSev/AmdSevX64.fdf | 2 ++
.../PlatformBootManagerLib/BdsPlatform.c | 17 +++++++++--------
.../DxeTcg2PhysicalPresenceLib.c | 4 ++++
OvmfPkg/OvmfPkgIa32.dsc | 8 ++++++++
OvmfPkg/OvmfPkgIa32.fdf | 2 ++
OvmfPkg/OvmfPkgIa32X64.dsc | 8 ++++++++
OvmfPkg/OvmfPkgIa32X64.fdf | 2 ++
OvmfPkg/OvmfPkgX64.dsc | 8 ++++++++
OvmfPkg/OvmfPkgX64.fdf | 2 ++
10 files changed, 53 insertions(+), 8 deletions(-)
--
2.31.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [RFC PATCH v1 1/4] OvmfPkg/TPM PPI: Connect default consoles for user interaction
2021-09-13 20:57 [RFC PATCH v1 0/4] OvmfPkg: Disable the TPM 2 platform hierarchy Stefan Berger
@ 2021-09-13 20:57 ` Stefan Berger
2021-09-13 20:57 ` [RFC PATCH v1 2/4] OvmfPkg: Handle TPM 2 physical presence codes much earlier Stefan Berger
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Stefan Berger @ 2021-09-13 20:57 UTC (permalink / raw)
To: devel
Cc: mhaeuser, spbrogan, marcandre.lureau, kraxel, jiewen.yao,
Stefan Berger, Stefan Berger
Activate the default console when user interaction is required for
the processing of TPM 2 physical presence interface opcodes.
Background:
TPM 2 physical presence interface (PPI) opcodes need to be handled before
the TPM 2 platform hierarchy is disabled. Due to this requirement we will
move the function call to handle the PPI opcodes into
PlatformBootManagerBeforeConsole() which runs before the initialization
of the consoles. However, since for interaction with the user we need
the console to be available, activate it now before displaying any message
to the user.
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
.../Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.c b/OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.c
index 00d76ba2c2..8834a71eff 100644
--- a/OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.c
+++ b/OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.c
@@ -32,6 +32,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/UefiBootManagerLib.h>
#include <Library/Tcg2PhysicalPresenceLib.h>
@@ -591,6 +592,9 @@ Tcg2UserConfirm (
return FALSE;
}
+ // Console for user interaction
+ EfiBootManagerConnectAllDefaultConsoles ();
+
if (TpmPpCommand < TCG2_PHYSICAL_PRESENCE_STORAGE_MANAGEMENT_BEGIN) {
if (CautionKey) {
TmpStr1 = Tcg2PhysicalPresenceGetStringById (STRING_TOKEN (TPM_CAUTION_KEY));
--
2.31.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [RFC PATCH v1 2/4] OvmfPkg: Handle TPM 2 physical presence codes much earlier
2021-09-13 20:57 [RFC PATCH v1 0/4] OvmfPkg: Disable the TPM 2 platform hierarchy Stefan Berger
2021-09-13 20:57 ` [RFC PATCH v1 1/4] OvmfPkg/TPM PPI: Connect default consoles for user interaction Stefan Berger
@ 2021-09-13 20:57 ` Stefan Berger
2021-09-13 20:57 ` [RFC PATCH v1 3/4] OvmfPkg: Reference new Tcg2PlatformDxe in the build system for compilation Stefan Berger
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Stefan Berger @ 2021-09-13 20:57 UTC (permalink / raw)
To: devel
Cc: mhaeuser, spbrogan, marcandre.lureau, kraxel, jiewen.yao,
Stefan Berger, Stefan Berger
Handle the TPM 2 physical presence interface (PPI) opcodes in
PlatformBootManagerBeforeConsole() before the TPM 2 platform hierarchy
is disabled. Since the handling of the PPI opcodes may require inter-
action with the user, initialize the keyboard before handling PPI codes.
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
.../PlatformBootManagerLib/BdsPlatform.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 71f63b2448..5c1603ac19 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -387,8 +387,17 @@ PlatformBootManagerBeforeConsole (
SaveS3BootScript ();
}
+ PlatformInitializeConsole (
+ XenDetected() ? gXenPlatformConsole : gPlatformConsole);
+
+ //
+ // Process TPM PPI request; this may require keyboard input
+ //
+ Tcg2PhysicalPresenceLibProcessRequest (NULL);
+
//
// Prevent further changes to LockBoxes or SMRAM.
+ // Any TPM 2 Physical Presence Interface opcode must be handled before.
//
Handle = NULL;
Status = gBS->InstallProtocolInterface (&Handle,
@@ -402,9 +411,6 @@ PlatformBootManagerBeforeConsole (
//
EfiBootManagerDispatchDeferredImages ();
- PlatformInitializeConsole (
- XenDetected() ? gXenPlatformConsole : gPlatformConsole);
-
FrontPageTimeout = GetFrontPageTimeoutFromQemu ();
PcdStatus = PcdSet16S (PcdPlatformBootTimeOut, FrontPageTimeout);
ASSERT_RETURN_ERROR (PcdStatus);
@@ -1511,11 +1517,6 @@ PlatformBootManagerAfterConsole (
//
PciAcpiInitialization ();
- //
- // Process TPM PPI request
- //
- Tcg2PhysicalPresenceLibProcessRequest (NULL);
-
//
// Process QEMU's -kernel command line option
//
--
2.31.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [RFC PATCH v1 3/4] OvmfPkg: Reference new Tcg2PlatformDxe in the build system for compilation
2021-09-13 20:57 [RFC PATCH v1 0/4] OvmfPkg: Disable the TPM 2 platform hierarchy Stefan Berger
2021-09-13 20:57 ` [RFC PATCH v1 1/4] OvmfPkg/TPM PPI: Connect default consoles for user interaction Stefan Berger
2021-09-13 20:57 ` [RFC PATCH v1 2/4] OvmfPkg: Handle TPM 2 physical presence codes much earlier Stefan Berger
@ 2021-09-13 20:57 ` Stefan Berger
2021-09-13 20:57 ` [RFC PATCH v1 4/4] OvmfPkg: Reference new Tcg2PlatformPei in the build system Stefan Berger
2021-09-14 2:18 ` [RFC PATCH v1 0/4] OvmfPkg: Disable the TPM 2 platform hierarchy Yao, Jiewen
4 siblings, 0 replies; 7+ messages in thread
From: Stefan Berger @ 2021-09-13 20:57 UTC (permalink / raw)
To: devel
Cc: mhaeuser, spbrogan, marcandre.lureau, kraxel, jiewen.yao,
Stefan Berger, Stefan Berger
Compile the Tcg2PlatformDxe related code now.
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
OvmfPkg/AmdSev/AmdSevX64.dsc | 4 ++++
OvmfPkg/AmdSev/AmdSevX64.fdf | 1 +
OvmfPkg/OvmfPkgIa32.dsc | 4 ++++
OvmfPkg/OvmfPkgIa32.fdf | 1 +
OvmfPkg/OvmfPkgIa32X64.dsc | 4 ++++
OvmfPkg/OvmfPkgIa32X64.fdf | 1 +
OvmfPkg/OvmfPkgX64.dsc | 4 ++++
OvmfPkg/OvmfPkgX64.fdf | 1 +
8 files changed, 20 insertions(+)
diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index e6cd10b759..3079f4b503 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -851,4 +851,8 @@
<LibraryClasses>
Tpm12DeviceLib|SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12DeviceLibDTpm.inf
}
+ SecurityPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.inf {
+ <LibraryClasses>
+ TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.inf
+ }
!endif
diff --git a/OvmfPkg/AmdSev/AmdSevX64.fdf b/OvmfPkg/AmdSev/AmdSevX64.fdf
index 0a89749700..a9f675303f 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.fdf
+++ b/OvmfPkg/AmdSev/AmdSevX64.fdf
@@ -313,6 +313,7 @@ INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
!if $(TPM_ENABLE) == TRUE
INF SecurityPkg/Tcg/TcgDxe/TcgDxe.inf
INF SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
+INF SecurityPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.inf
!if $(TPM_CONFIG_ENABLE) == TRUE
INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
!endif
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index d1d92c97ba..923a012f0c 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -1034,6 +1034,10 @@
<LibraryClasses>
Tpm12DeviceLib|SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12DeviceLibDTpm.inf
}
+ SecurityPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.inf {
+ <LibraryClasses>
+ TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.inf
+ }
!endif
!if $(LOAD_X64_ON_IA32_ENABLE) == TRUE
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index 04b41445ca..bb3b53626e 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -363,6 +363,7 @@ INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
!if $(TPM_ENABLE) == TRUE
INF SecurityPkg/Tcg/TcgDxe/TcgDxe.inf
INF SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
+INF SecurityPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.inf
!if $(TPM_CONFIG_ENABLE) == TRUE
INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
!endif
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index a467ab7090..b907b36973 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -1049,4 +1049,8 @@
<LibraryClasses>
Tpm12DeviceLib|SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12DeviceLibDTpm.inf
}
+ SecurityPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.inf {
+ <LibraryClasses>
+ TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.inf
+ }
!endif
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index 02fd8f0c41..030638ae78 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -370,6 +370,7 @@ INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
!if $(TPM_ENABLE) == TRUE
INF SecurityPkg/Tcg/TcgDxe/TcgDxe.inf
INF SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
+INF SecurityPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.inf
!if $(TPM_CONFIG_ENABLE) == TRUE
INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
!endif
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index e56b83d95e..8aca437a9b 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -1047,4 +1047,8 @@
<LibraryClasses>
Tpm12DeviceLib|SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12DeviceLibDTpm.inf
}
+ SecurityPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.inf {
+ <LibraryClasses>
+ TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.inf
+ }
!endif
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index 23936242e7..888363ff9d 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -389,6 +389,7 @@ INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
!if $(TPM_ENABLE) == TRUE
INF SecurityPkg/Tcg/TcgDxe/TcgDxe.inf
INF SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
+INF SecurityPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.inf
!if $(TPM_CONFIG_ENABLE) == TRUE
INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
!endif
--
2.31.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [RFC PATCH v1 4/4] OvmfPkg: Reference new Tcg2PlatformPei in the build system
2021-09-13 20:57 [RFC PATCH v1 0/4] OvmfPkg: Disable the TPM 2 platform hierarchy Stefan Berger
` (2 preceding siblings ...)
2021-09-13 20:57 ` [RFC PATCH v1 3/4] OvmfPkg: Reference new Tcg2PlatformDxe in the build system for compilation Stefan Berger
@ 2021-09-13 20:57 ` Stefan Berger
2021-09-14 2:18 ` [RFC PATCH v1 0/4] OvmfPkg: Disable the TPM 2 platform hierarchy Yao, Jiewen
4 siblings, 0 replies; 7+ messages in thread
From: Stefan Berger @ 2021-09-13 20:57 UTC (permalink / raw)
To: devel
Cc: mhaeuser, spbrogan, marcandre.lureau, kraxel, jiewen.yao,
Stefan Berger, Stefan Berger
Compile the Tcg2PlatformPei related code now to support TPM 2 platform
hierachy disablement if the TPM state cannot be resumed upon S3 resume.
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
OvmfPkg/AmdSev/AmdSevX64.dsc | 4 ++++
OvmfPkg/AmdSev/AmdSevX64.fdf | 1 +
OvmfPkg/OvmfPkgIa32.dsc | 4 ++++
OvmfPkg/OvmfPkgIa32.fdf | 1 +
OvmfPkg/OvmfPkgIa32X64.dsc | 4 ++++
OvmfPkg/OvmfPkgIa32X64.fdf | 1 +
OvmfPkg/OvmfPkgX64.dsc | 4 ++++
OvmfPkg/OvmfPkgX64.fdf | 1 +
8 files changed, 20 insertions(+)
diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index 3079f4b503..5ee5445116 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -637,6 +637,10 @@
NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
}
+ SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf {
+ <LibraryClasses>
+ TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.inf
+ }
!endif
#
diff --git a/OvmfPkg/AmdSev/AmdSevX64.fdf b/OvmfPkg/AmdSev/AmdSevX64.fdf
index a9f675303f..542722ac6b 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.fdf
+++ b/OvmfPkg/AmdSev/AmdSevX64.fdf
@@ -154,6 +154,7 @@ INF OvmfPkg/Tcg/TpmMmioSevDecryptPei/TpmMmioSevDecryptPei.inf
INF OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
INF SecurityPkg/Tcg/TcgPei/TcgPei.inf
INF SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf
+INF SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf
!endif
################################################################################
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 923a012f0c..6a5be97c05 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -717,6 +717,10 @@
NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
}
+ SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf {
+ <LibraryClasses>
+ TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.inf
+ }
!endif
#
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index bb3b53626e..775ea2d710 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -166,6 +166,7 @@ INF OvmfPkg/Tcg/TpmMmioSevDecryptPei/TpmMmioSevDecryptPei.inf
INF OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
INF SecurityPkg/Tcg/TcgPei/TcgPei.inf
INF SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf
+INF SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf
!endif
################################################################################
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index b907b36973..71227d1b70 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -730,6 +730,10 @@
NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
}
+ SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf {
+ <LibraryClasses>
+ TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.inf
+ }
!endif
[Components.X64]
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index 030638ae78..245ca94044 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -166,6 +166,7 @@ INF OvmfPkg/Tcg/TpmMmioSevDecryptPei/TpmMmioSevDecryptPei.inf
INF OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
INF SecurityPkg/Tcg/TcgPei/TcgPei.inf
INF SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf
+INF SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf
!endif
################################################################################
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 8aca437a9b..52f7598cf1 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -729,6 +729,10 @@
NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
}
+ SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf {
+ <LibraryClasses>
+ TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.inf
+ }
!endif
#
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index 888363ff9d..b6cc3cabdd 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -185,6 +185,7 @@ INF OvmfPkg/Tcg/TpmMmioSevDecryptPei/TpmMmioSevDecryptPei.inf
INF OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
INF SecurityPkg/Tcg/TcgPei/TcgPei.inf
INF SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf
+INF SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf
!endif
################################################################################
--
2.31.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [RFC PATCH v1 0/4] OvmfPkg: Disable the TPM 2 platform hierarchy
2021-09-13 20:57 [RFC PATCH v1 0/4] OvmfPkg: Disable the TPM 2 platform hierarchy Stefan Berger
` (3 preceding siblings ...)
2021-09-13 20:57 ` [RFC PATCH v1 4/4] OvmfPkg: Reference new Tcg2PlatformPei in the build system Stefan Berger
@ 2021-09-14 2:18 ` Yao, Jiewen
2021-09-14 13:33 ` Stefan Berger
4 siblings, 1 reply; 7+ messages in thread
From: Yao, Jiewen @ 2021-09-14 2:18 UTC (permalink / raw)
To: Stefan Berger, devel@edk2.groups.io
Cc: mhaeuser@posteo.de, spbrogan@outlook.com,
marcandre.lureau@redhat.com, kraxel@redhat.com
Hi Stefan
I recommend we add some comment in the code on the "trusted console" definition.
[Patch 1]
+ // Console for user interaction
// We need connect all trusted console for TCG PP. Here we treat all console in OVMF to be trusted console.
+ EfiBootManagerConnectAllDefaultConsoles ();
[Patch 2]
// We need connect all trusted console for TCG PP. Here we treat all console in OVMF to be trusted console.
+ PlatformInitializeConsole (
+ XenDetected() ? gXenPlatformConsole : gPlatformConsole);
With that change, Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
> -----Original Message-----
> From: Stefan Berger <stefanb@linux.vnet.ibm.com>
> Sent: Tuesday, September 14, 2021 4:57 AM
> To: devel@edk2.groups.io
> Cc: mhaeuser@posteo.de; spbrogan@outlook.com;
> marcandre.lureau@redhat.com; kraxel@redhat.com; Yao, Jiewen
> <jiewen.yao@intel.com>; Stefan Berger <stefanb@linux.vnet.ibm.com>
> Subject: [RFC PATCH v1 0/4] OvmfPkg: Disable the TPM 2 platform hierarchy
>
> This series of patches adds support for disabling the TPM 2 platform
> hierarchy to Ovmf. To be able to do this we have to handle TPM 2
> physical presence interface (PPI) opcodes before the TPM 2 platform
> hierarchy is disabled otherwise TPM 2 commands that are sent due to the
> PPI opcodes may fail if the platform hierarchy is already disabled.
> Therefore, we need to invoke the handler function
> Tcg2PhysicalPresenceLibProcessRequest from within
> PlatformBootManagerBeforeConsole. Since handling of PPI opcodes may
> require
> interaction with the user, we also move PlatformInitializeConsole
> to before the handling of PPI codes so that the keyboard is available
> when needed. The PPI handling code will activate the default consoles
> only if it requires user interaction.
>
> The question to answer at this point is whether the rearragement of
> functions is correct or what an alternative should look like. There
> are other BdsPlatform files that may need similar changes in a later
> revision of this series.
>
> Regards,
> Stefan
>
> Stefan Berger (4):
> OvmfPkg/TPM PPI: Connect default consoles for user interaction
> OvmfPkg: Handle TPM 2 physical presence codes much earlier
> OvmfPkg: Reference new Tcg2PlatformDxe in the build system for
> compilation
> OvmfPkg: Reference new Tcg2PlatformPei in the build system
>
> OvmfPkg/AmdSev/AmdSevX64.dsc | 8 ++++++++
> OvmfPkg/AmdSev/AmdSevX64.fdf | 2 ++
> .../PlatformBootManagerLib/BdsPlatform.c | 17 +++++++++--------
> .../DxeTcg2PhysicalPresenceLib.c | 4 ++++
> OvmfPkg/OvmfPkgIa32.dsc | 8 ++++++++
> OvmfPkg/OvmfPkgIa32.fdf | 2 ++
> OvmfPkg/OvmfPkgIa32X64.dsc | 8 ++++++++
> OvmfPkg/OvmfPkgIa32X64.fdf | 2 ++
> OvmfPkg/OvmfPkgX64.dsc | 8 ++++++++
> OvmfPkg/OvmfPkgX64.fdf | 2 ++
> 10 files changed, 53 insertions(+), 8 deletions(-)
>
> --
> 2.31.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC PATCH v1 0/4] OvmfPkg: Disable the TPM 2 platform hierarchy
2021-09-14 2:18 ` [RFC PATCH v1 0/4] OvmfPkg: Disable the TPM 2 platform hierarchy Yao, Jiewen
@ 2021-09-14 13:33 ` Stefan Berger
0 siblings, 0 replies; 7+ messages in thread
From: Stefan Berger @ 2021-09-14 13:33 UTC (permalink / raw)
To: Yao, Jiewen, devel@edk2.groups.io, sami.mujawar, ardb+tianocore,
leif
Cc: marcandre.lureau@redhat.com, kraxel@redhat.com
On 9/13/21 10:18 PM, Yao, Jiewen wrote:
> Hi Stefan
> I recommend we add some comment in the code on the "trusted console" definition.
>
> [Patch 1]
> + // Console for user interaction
> // We need connect all trusted console for TCG PP. Here we treat all console in OVMF to be trusted console.
> + EfiBootManagerConnectAllDefaultConsoles ();
>
>
> [Patch 2]
> // We need connect all trusted console for TCG PP. Here we treat all console in OVMF to be trusted console.
> + PlatformInitializeConsole (
> + XenDetected() ? gXenPlatformConsole : gPlatformConsole);
>
> With that change, Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Thanks.
I'll post v2 once the tests have run through.
I am also cc'ing ArmVirtPkg maintainers now since we'll need to think
about how to do this on ARM for the TPM 2 platform hierarchy
disablement. The relevant code we just added is here:
https://github.com/tianocore/edk2/tree/master/SecurityPkg/Tcg/Tcg2PlatformDxe
https://github.com/tianocore/edk2/tree/master/SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib
The function we need to have invoked [ConfigureTpmPlatformHierarchy ()]
one way or another is here:
https://github.com/tianocore/edk2/blob/master/SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLib/PeiDxeTpmPlatformHierarchyLib.c#L241
On x86 this function is called via gEfiDxeSmmReadyToLockProtocolGuid
which was registered/subscribed to in the entrypoint function of
Tcg2PlaformDxe here:
https://github.com/tianocore/edk2/blob/master/SecurityPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.c#L66
As far as I know there's no SMM mode on ARM. So what's the best way of
doing this? Should we call the function ConfigureTpmPlatformHierarchy ()
directly from some point in ArmVirtPkg?
[
https://github.com/tianocore/edk2/blob/master/SecurityPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.c#L49
]
Or should ARM also have/emulate a 'gEfiDxeSmmReadyToLockProtocolGuid'
even though it doesn't have an SMM mode?
Regards,
Stefan
>
>
>
>> -----Original Message-----
>> From: Stefan Berger <stefanb@linux.vnet.ibm.com>
>> Sent: Tuesday, September 14, 2021 4:57 AM
>> To: devel@edk2.groups.io
>> Cc: mhaeuser@posteo.de; spbrogan@outlook.com;
>> marcandre.lureau@redhat.com; kraxel@redhat.com; Yao, Jiewen
>> <jiewen.yao@intel.com>; Stefan Berger <stefanb@linux.vnet.ibm.com>
>> Subject: [RFC PATCH v1 0/4] OvmfPkg: Disable the TPM 2 platform hierarchy
>>
>> This series of patches adds support for disabling the TPM 2 platform
>> hierarchy to Ovmf. To be able to do this we have to handle TPM 2
>> physical presence interface (PPI) opcodes before the TPM 2 platform
>> hierarchy is disabled otherwise TPM 2 commands that are sent due to the
>> PPI opcodes may fail if the platform hierarchy is already disabled.
>> Therefore, we need to invoke the handler function
>> Tcg2PhysicalPresenceLibProcessRequest from within
>> PlatformBootManagerBeforeConsole. Since handling of PPI opcodes may
>> require
>> interaction with the user, we also move PlatformInitializeConsole
>> to before the handling of PPI codes so that the keyboard is available
>> when needed. The PPI handling code will activate the default consoles
>> only if it requires user interaction.
>>
>> The question to answer at this point is whether the rearragement of
>> functions is correct or what an alternative should look like. There
>> are other BdsPlatform files that may need similar changes in a later
>> revision of this series.
>>
>> Regards,
>> Stefan
>>
>> Stefan Berger (4):
>> OvmfPkg/TPM PPI: Connect default consoles for user interaction
>> OvmfPkg: Handle TPM 2 physical presence codes much earlier
>> OvmfPkg: Reference new Tcg2PlatformDxe in the build system for
>> compilation
>> OvmfPkg: Reference new Tcg2PlatformPei in the build system
>>
>> OvmfPkg/AmdSev/AmdSevX64.dsc | 8 ++++++++
>> OvmfPkg/AmdSev/AmdSevX64.fdf | 2 ++
>> .../PlatformBootManagerLib/BdsPlatform.c | 17 +++++++++--------
>> .../DxeTcg2PhysicalPresenceLib.c | 4 ++++
>> OvmfPkg/OvmfPkgIa32.dsc | 8 ++++++++
>> OvmfPkg/OvmfPkgIa32.fdf | 2 ++
>> OvmfPkg/OvmfPkgIa32X64.dsc | 8 ++++++++
>> OvmfPkg/OvmfPkgIa32X64.fdf | 2 ++
>> OvmfPkg/OvmfPkgX64.dsc | 8 ++++++++
>> OvmfPkg/OvmfPkgX64.fdf | 2 ++
>> 10 files changed, 53 insertions(+), 8 deletions(-)
>>
>> --
>> 2.31.1
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-09-14 13:33 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-13 20:57 [RFC PATCH v1 0/4] OvmfPkg: Disable the TPM 2 platform hierarchy Stefan Berger
2021-09-13 20:57 ` [RFC PATCH v1 1/4] OvmfPkg/TPM PPI: Connect default consoles for user interaction Stefan Berger
2021-09-13 20:57 ` [RFC PATCH v1 2/4] OvmfPkg: Handle TPM 2 physical presence codes much earlier Stefan Berger
2021-09-13 20:57 ` [RFC PATCH v1 3/4] OvmfPkg: Reference new Tcg2PlatformDxe in the build system for compilation Stefan Berger
2021-09-13 20:57 ` [RFC PATCH v1 4/4] OvmfPkg: Reference new Tcg2PlatformPei in the build system Stefan Berger
2021-09-14 2:18 ` [RFC PATCH v1 0/4] OvmfPkg: Disable the TPM 2 platform hierarchy Yao, Jiewen
2021-09-14 13:33 ` Stefan Berger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox