add tpm probe fixes

This commit is contained in:
Gerd Hoffmann 2023-04-27 07:22:51 +02:00
parent 8c2a84686d
commit fab5bd4c1d
3 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,35 @@
From cb0ffbcd86756a47696b6e24e19552d2bcc4238a Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Wed, 26 Apr 2023 14:37:13 +0200
Subject: [PATCH 14/16] SecurityPkg: add TIS sanity check (tpm2)
The code blindly assumes a TIS interface is present in case both CRB and
FIFO checks fail. Check the InterfaceType for TIS instead and only
return Tpm2PtpInterfaceTis in case it matches, Tpm2PtpInterfaceMax
otherwise.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
index 1f9ac5ab5a30..eac9f0e29941 100644
--- a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
+++ b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
@@ -464,7 +464,11 @@ Tpm2GetPtpInterface (
return Tpm2PtpInterfaceFifo;
}
- return Tpm2PtpInterfaceTis;
+ if (InterfaceId.Bits.InterfaceType == PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_TIS) {
+ return Tpm2PtpInterfaceTis;
+ }
+
+ return Tpm2PtpInterfaceMax;
}
/**
--
2.40.0

View File

@ -0,0 +1,34 @@
From 54ae30cea7731b9949b7e503401f732f1e95e930 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Wed, 26 Apr 2023 14:38:34 +0200
Subject: [PATCH 15/16] SecurityPkg: add TIS sanity check (tpm12)
The code blindly assumes a TIS interface is present in case both CRB and
FIFO checks fail. Check the InterfaceType for TIS instead and only
return PtpInterfaceTis in case it matches, PtpInterfaceMax otherwise.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c b/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c
index 51f43591287a..d2b79a274084 100644
--- a/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c
+++ b/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c
@@ -91,7 +91,11 @@ Tpm12GetPtpInterface (
return PtpInterfaceFifo;
}
- return PtpInterfaceTis;
+ if (InterfaceId.Bits.InterfaceType == PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_TIS) {
+ return PtpInterfaceTis;
+ }
+
+ return PtpInterfaceMax;
}
/**
--
2.40.0

View File

@ -96,6 +96,8 @@ Patch0010: 0010-OvmfPkg-silence-EFI_D_VERBOSE-0x00400000-in-NvmExpre.patch
Patch0011: 0011-CryptoPkg-OpensslLib-list-RHEL8-specific-OpenSSL-fil.patch
Patch0012: 0012-OvmfPkg-QemuKernelLoaderFsDxe-suppress-error-on-no-k.patch
Patch0013: 0013-SecurityPkg-Tcg2Dxe-suppress-error-on-no-swtpm-in-si.patch
Patch0014: 0014-SecurityPkg-add-TIS-sanity-check-tpm2.patch
Patch0015: 0015-SecurityPkg-add-TIS-sanity-check-tpm12.patch
# python3-devel and libuuid-devel are required for building tools.