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.351.1682526258299005709 for ; Wed, 26 Apr 2023 09:24:18 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bA5xgkEk; 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=1682526257; 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=tNbQjgJaBOLKlhhnHaZbtb2oIemazxomwxcA3TzWAaU=; b=bA5xgkEkSxYJJicI1G2XYLbyim/prX1GJkTohIwOiCUtyZPXgSN629rmgNpkDDui+Q1Poz P0g33q0xI7IjAFHplxqkL7WtKcj+E8YsJzB1WRPZ2RePsvGn696Eun3OrykuqUk/v84soV izngxKhQzutaaNIBOw8P4FRdlJr3N2c= 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-251-68boEypaNG60VU2FPSzXow-1; Wed, 26 Apr 2023 12:24:13 -0400 X-MC-Unique: 68boEypaNG60VU2FPSzXow-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A4BE0A0F385; Wed, 26 Apr 2023 16:24:08 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.158]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 61C66492B03; Wed, 26 Apr 2023 16:24:07 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 93D891800634; 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 1/2] SecurityPkg: add TIS sanity check (tpm2) Date: Wed, 26 Apr 2023 18:24:04 +0200 Message-Id: <20230426162405.653953-2-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.10 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 Tpm2PtpInterfaceTis in case it matches, Tpm2PtpInterfaceMax otherwise. Signed-off-by: Gerd Hoffmann --- 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