From: Gerd Hoffmann Date: Wed, 26 Apr 2023 16:24:05 +0000 (+0800) Subject: SecurityPkg: add TIS sanity check (tpm12) X-Git-Tag: edk2-stable202305~85 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=d6b42ed7ed1b0c4584097f0d76798cff74c96379;p=ovmf.git 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 Reviewed-by: Jiewen Yao --- diff --git a/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c b/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c index 51f4359128..d2b79a2740 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; } /**