From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.359.1682526265179436575 for ; Wed, 26 Apr 2023 09:24:25 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=M3MQ8lnB; spf=pass (domain: redhat.com, ip: 170.10.129.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682526264; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ez00aGtlXXKVHoqWxuXReytHRBUTuCvLSBWZP5PJEms=; b=M3MQ8lnBibt+w+y0EallUI89up8ggQTPO03pSXysJKCFAoZmssNkcIy7fEhsh1nlUfSH8x 5MybVgiTOrWw36eTfZresP2U7RctqpI1iCzSD1hmwfV6ywYmaG6PWlADPJqK/CVoDU7mDF 1VN8mWhdt8a4AlxPPr3edSdgpf77tvk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-213-dmkk8ftnOy-h88_GJ_oZ_A-1; Wed, 26 Apr 2023 12:24:18 -0400 X-MC-Unique: dmkk8ftnOy-h88_GJ_oZ_A-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 605DB855422; Wed, 26 Apr 2023 16:24:12 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.158]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1E1DA40C6E67; Wed, 26 Apr 2023 16:24:12 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 994EA1800635; Wed, 26 Apr 2023 18:24:05 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Jian J Wang , Pawel Polawski , Oliver Steffen , Jiewen Yao , Gerd Hoffmann Subject: [PATCH 2/2] SecurityPkg: add TIS sanity check (tpm12) Date: Wed, 26 Apr 2023 18:24:05 +0200 Message-Id: <20230426162405.653953-3-kraxel@redhat.com> In-Reply-To: <20230426162405.653953-1-kraxel@redhat.com> References: <20230426162405.653953-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 --- 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