From patchwork Mon Aug 7 19:25:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 711148 Delivered-To: patch@linaro.org Received: by 2002:a05:6359:d30:b0:129:c516:61db with SMTP id gp48csp1737061rwb; Mon, 7 Aug 2023 12:26:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEm5/yHNh69XxpuhLVb094t1SHPyfQ9rZy5bNObau8KWDMlj5VZeAH8MpPuSvauDfzCDyIR X-Received: by 2002:adf:f644:0:b0:317:f11e:82d9 with SMTP id x4-20020adff644000000b00317f11e82d9mr1580288wrp.3.1691436392162; Mon, 07 Aug 2023 12:26:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691436392; cv=none; d=google.com; s=arc-20160816; b=gb1dXmaHks+vVntzgyVc4QD13/AwspWNPuQlWlTmp053RVpkkkMC1QE1u7nDrN75s8 oHzqKbyF0M1cZ/HC3aOtHq72UxiXx0c2o0AVVJew0UroQ+poIqJqcawgOTJf4chzyWYh 5xdU6apyrXy9HtCt8r7GP04Cypwr0gxs5in0gHxiQTR4qoq2tTWRW6HoKgx5hXP1hICR r/S0stxwuxqo/fVmkTT0lVE+BygN7P50bQEJWrkn73+SKo3w1Xt1SyRl682ijlQYZ/Ya AjPYeB9hDDVAszjXXjS6j6gmn/R8VeBU5Ib+lkJhkDkNt61cZ+QFXXV9zxKfF9jGfJfn 4QjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2PQle38MQviB/hclp2UI4YKllVhX2PhhDgVqXuBl8Bo=; fh=x3v0/GoXJuL1oFKziP5cRNs3+Fqz1zxSh3t+0A/5jr0=; b=yXDySXAHffkK99QvzcjgEx9Mhp3VhH02uIPDgha6haVKTLbqv9djzTwIpEs5ZLkqkw vh4+uIP7N8Y4wyLvnW8tgsjlM4hcQ727L72u4v33+7TZcQaQj6bUz06PrweTJoGzdr4O 5++acfRJA7bq1VfxRO4sm8J1+n7P1FreSjwwYe1ccAsdtTz3xrn0uooS1kTebcPqgGmj H372piZgX5CMnmjkWGFT8x+VezNwu+yRE2sT7TVuIgNdGa1Zm1vqEE3Xb7nwYiXs+8DC JRjfXlri1AqAc/+uIU8NRjzpaauy9e41BTgqG2g5MO7DHgRs1SaPfCtJI+PznzAFFnz+ 6nyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=VrQquEk2; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id t18-20020a5d5352000000b00317c63f35f3si3871499wrv.246.2023.08.07.12.26.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 12:26:32 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=VrQquEk2; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 68F4D807C4; Mon, 7 Aug 2023 21:26:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.b="VrQquEk2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BF80E807B6; Mon, 7 Aug 2023 21:26:00 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9BA7D807B6 for ; Mon, 7 Aug 2023 21:25:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=eajames@linux.ibm.com Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 377JGXxt030587; Mon, 7 Aug 2023 19:25:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=2PQle38MQviB/hclp2UI4YKllVhX2PhhDgVqXuBl8Bo=; b=VrQquEk2gE2e17+8PywJ4JCI7Az3TDgUO5vfvisW62Isv8v8MWc9CBiOGEsxBarFYchd bp+h0EUUnJQHnEOANUCpYMCLbj4EUWLY94NrDw1rYuKQGURmZeYRs87xC+p5kxI3bFl3 1t39dACdQ18JSqwCVSvotFQ2prpsl8or8XlO43IOvocaHe7senGI4yi6NXC/T/7Al6FL ztOzGxvLXN/YsFn+GQLEVmuwPJ6/G1lU8H0GV7YBpKTNaObJh/U3iIjk63WPyQumhFdx utuGYai6mFoIyerMVUj1/D1u+0dECu1KHX1xyyvf0uKi7R2feGZPutiFayRBeFNmZj0x UA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3sb6mbg71u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Aug 2023 19:25:46 +0000 Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 377JGpw3030934; Mon, 7 Aug 2023 19:25:46 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3sb6mbg71d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Aug 2023 19:25:46 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 377HmbRl015377; Mon, 7 Aug 2023 19:25:45 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([172.16.1.4]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3sb3f2hh83-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Aug 2023 19:25:45 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 377JPiwK39322108 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 7 Aug 2023 19:25:44 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B4ED35803F; Mon, 7 Aug 2023 19:25:44 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 74D3E58061; Mon, 7 Aug 2023 19:25:44 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.130.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 7 Aug 2023 19:25:44 +0000 (GMT) From: Eddie James To: u-boot@lists.denx.de Cc: ilias.apalodimas@linaro.org, sjg@chromium.org, xypron.glpk@gmx.de, joel@jms.id.au, eajames@linux.ibm.com Subject: [PATCH v11 7/8] efi_loader: fix EFI_ENTRY point on get_active_pcr_banks Date: Mon, 7 Aug 2023 14:25:41 -0500 Message-Id: <20230807192542.90526-8-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230807192542.90526-1-eajames@linux.ibm.com> References: <20230807192542.90526-1-eajames@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 0U1y20ygtN5hu-yqor-zw6K0D3-G_1a1 X-Proofpoint-GUID: wB8cFkzU1ADDdtM3SKmQ-lxNj63nOAD2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-07_21,2023-08-03_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 priorityscore=1501 adultscore=0 clxscore=1015 mlxscore=0 bulkscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 impostorscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308070174 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Ilias Apalodimas efi_tcg2_get_active_pcr_banks doesn't immediately call the EFI_ENTRY() wrapper once it enters the function. Move the call a few lines above to cover the error cases properly as well. Signed-off-by: Ilias Apalodimas --- lib/efi_loader/efi_tcg2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c index 5f0f4b5dd2..829bae7436 100644 --- a/lib/efi_loader/efi_tcg2.c +++ b/lib/efi_loader/efi_tcg2.c @@ -718,16 +718,16 @@ efi_tcg2_get_active_pcr_banks(struct efi_tcg2_protocol *this, struct udevice *dev; efi_status_t ret; + EFI_ENTRY("%p, %p", this, active_pcr_banks); + if (!this || !active_pcr_banks) { ret = EFI_INVALID_PARAMETER; goto out; } - ret = tcg2_platform_get_tpm2(&dev); if (ret != EFI_SUCCESS) goto out; - EFI_ENTRY("%p, %p", this, active_pcr_banks); ret = tcg2_get_active_pcr_banks(dev, active_pcr_banks); out: From patchwork Mon Aug 7 19:25:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 711149 Delivered-To: patch@linaro.org Received: by 2002:a05:6359:d30:b0:129:c516:61db with SMTP id gp48csp1737255rwb; Mon, 7 Aug 2023 12:27:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFxXC5pfho5liXpP6fbKZPCzzlKqwZva61/dNeGSR0oAwdudmLwCUhoTBxvRIaTUg2Mc9Sv X-Received: by 2002:a5d:634c:0:b0:317:67bf:3387 with SMTP id b12-20020a5d634c000000b0031767bf3387mr6665375wrw.60.1691436421745; Mon, 07 Aug 2023 12:27:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691436421; cv=none; d=google.com; s=arc-20160816; b=r7qBAPIZSq5K1cvcRWQyvq1h8NBsLDVpc/WtEEqg2XxBRSjacqjNcLAoBoZyI2AZfN OuuvJl179uq/hqNFVibFLUNXVLZo/yELSWX0UFyE4v1WWOagrHTntKfUhVxA9HL5UHG5 3M4xHPQueFBZ4c+3s3ONeVh08aRIicdenFceqthbdNBnS3v7nak2Qoh/GCXv21eJcRqj Xq3QFW7v4e6WfmxsuMjb14V7aJ71UyitLAhz5hmjomN4pTv/awWaYBxxkkytWWFdOegW nyFLYupnwl6isdMQJuWAbljUsIvihHWjDddS6F080pSbHFSi2/DdTQYRSQxRrCA9H3lB lUXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZGZSOud+SzjyrBE9wz95oFuy76SFS6aoYHBywGxiWcw=; fh=x3v0/GoXJuL1oFKziP5cRNs3+Fqz1zxSh3t+0A/5jr0=; b=iAwTYVqthVOkDGKrfpWDnnfqR0TnyJK1tZLBGyDLkT7sUBJdFwzbAdAbJNMHwYSxih j9jHjtU1cadnKNb9FYrdmREKTWQGnABqVOVenx4WYTJSZxt3sRTw+bIe7t7I4dHrhys5 BnD682fpl0urXktJI0PHyvdx6VNW1qRkyRhMEIVQHYbbJ/UweRN54RSpdnzst2Kl5Lfr AYqPGQWSl/s6cETe4wtD+f/xY7h16WjsgmGpOmlNZ8oMxdbU7PPU+LnyDU9R373H+F33 xN+CK8I1uAOdqEqkSQlds85Vsr7aj1xOOwlyzRk9FaI6JLTP1pWCoRgUEHmlSP24qzZ6 nZHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=ao6hvcOf; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id d8-20020adff848000000b00317752a13besi3934815wrq.408.2023.08.07.12.27.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 12:27:01 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=ao6hvcOf; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3817D846FB; Mon, 7 Aug 2023 21:26:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.b="ao6hvcOf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3C89D807B3; Mon, 7 Aug 2023 21:26:02 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A7619807C9 for ; Mon, 7 Aug 2023 21:25:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=eajames@linux.ibm.com Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 377JFvWR028820; Mon, 7 Aug 2023 19:25:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=ZGZSOud+SzjyrBE9wz95oFuy76SFS6aoYHBywGxiWcw=; b=ao6hvcOfrkFJH5AP9nbPNBymKLPIVrqqlqjE+fLRqffwbZdbV3a8YyuH3p1/LuNMVzR6 ajWz7JP/Q8loT2AWK6fIF2/BVU31ZV1QGdS1eSv9PujafwmbeD9i2hc8NQmS45BW0kDT 0jb5/129icCUT7mG2hdsqBpcLgdsUeZjVXmi8GMXZwRDqPHj6iVDCs52jRGOjHqrzxIm 2TERH7XpjhJNkumA+Mxpp+M7E0my6CJ2hVqN8BlxRxjSCGWEQ8tF8yGZqyGpP6tVghKd jpUINajPc8qtieZIlZBWb0SdiJr8fQLJDtcdNMPgu8hvaOsrmVzpUYWFItCdyeikNdqe EA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3sb6m1g96h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Aug 2023 19:25:46 +0000 Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 377JPb48026375; Mon, 7 Aug 2023 19:25:46 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3sb6m1g964-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Aug 2023 19:25:46 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 377IFMrS001777; Mon, 7 Aug 2023 19:25:45 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([172.16.1.5]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3sa3f1fd3b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Aug 2023 19:25:45 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 377JPj4k61014290 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 7 Aug 2023 19:25:45 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F2E195805A; Mon, 7 Aug 2023 19:25:44 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BF0B758060; Mon, 7 Aug 2023 19:25:44 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.130.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 7 Aug 2023 19:25:44 +0000 (GMT) From: Eddie James To: u-boot@lists.denx.de Cc: ilias.apalodimas@linaro.org, sjg@chromium.org, xypron.glpk@gmx.de, joel@jms.id.au, eajames@linux.ibm.com Subject: [PATCH v11 8/8] test: use a non system PCR for testing PCR extend Date: Mon, 7 Aug 2023 14:25:42 -0500 Message-Id: <20230807192542.90526-9-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230807192542.90526-1-eajames@linux.ibm.com> References: <20230807192542.90526-1-eajames@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: D-8zLf2509XUwdVFkV3VclBd_MuQ11ql X-Proofpoint-ORIG-GUID: Fgsb6fKr-KaCbiB7TQlH-FKvRMJ2FouO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-07_21,2023-08-03_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 clxscore=1015 malwarescore=0 priorityscore=1501 phishscore=0 mlxlogscore=999 mlxscore=0 impostorscore=0 spamscore=0 suspectscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308070174 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Ilias Apalodimas We currently use PCR 0 for testing the PCR read/extend functionality in our selftests. How ever those PCRs are defined by the TCG spec for platform use. For example if the tests run *after* the efi subsystem initialization, which extends PCRs 0 & 7 it will give a false positive. So let's switch over to a PCR which is more suitable and is defined for OS use. It's worth noting that we are using PCR10 here, since PCR9 is used internally by U-Boot if we choose to measure the loaded DTB Reviewed-by: Simon Glass Signed-off-by: Ilias Apalodimas --- test/py/tests/test_tpm2.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/py/tests/test_tpm2.py b/test/py/tests/test_tpm2.py index fce689cd99..8cd3046285 100644 --- a/test/py/tests/test_tpm2.py +++ b/test/py/tests/test_tpm2.py @@ -236,7 +236,7 @@ def test_tpm2_dam_parameters(u_boot_console): def test_tpm2_pcr_read(u_boot_console): """Execute a TPM2_PCR_Read command. - Perform a PCR read of the 0th PCR. Must be zero. + Perform a PCR read of the 10th PCR. Must be zero. """ if is_sandbox(u_boot_console): tpm2_sandbox_init(u_boot_console) @@ -244,7 +244,7 @@ def test_tpm2_pcr_read(u_boot_console): force_init(u_boot_console) ram = u_boot_utils.find_ram_base(u_boot_console) - read_pcr = u_boot_console.run_command('tpm2 pcr_read 0 0x%x' % ram) + read_pcr = u_boot_console.run_command('tpm2 pcr_read 10 0x%x' % ram) output = u_boot_console.run_command('echo $?') assert output.endswith('0') @@ -254,7 +254,7 @@ def test_tpm2_pcr_read(u_boot_console): updates = int(re.findall(r'\d+', str)[0]) # Check the output value - assert 'PCR #0 content' in read_pcr + assert 'PCR #10 content' in read_pcr assert '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' in read_pcr @pytest.mark.buildconfigspec('cmd_tpm_v2') @@ -272,19 +272,19 @@ def test_tpm2_pcr_extend(u_boot_console): force_init(u_boot_console) ram = u_boot_utils.find_ram_base(u_boot_console) - read_pcr = u_boot_console.run_command('tpm2 pcr_read 0 0x%x' % (ram + 0x20)) + read_pcr = u_boot_console.run_command('tpm2 pcr_read 10 0x%x' % (ram + 0x20)) output = u_boot_console.run_command('echo $?') assert output.endswith('0') str = re.findall(r'\d+ known updates', read_pcr)[0] updates = int(re.findall(r'\d+', str)[0]) - u_boot_console.run_command('tpm2 pcr_extend 0 0x%x' % ram) + u_boot_console.run_command('tpm2 pcr_extend 10 0x%x' % ram) output = u_boot_console.run_command('echo $?') assert output.endswith('0') # Read the value back into a different place so we can still use 'ram' as # our zero bytes - read_pcr = u_boot_console.run_command('tpm2 pcr_read 0 0x%x' % (ram + 0x20)) + read_pcr = u_boot_console.run_command('tpm2 pcr_read 10 0x%x' % (ram + 0x20)) output = u_boot_console.run_command('echo $?') assert output.endswith('0') assert 'f5 a5 fd 42 d1 6a 20 30 27 98 ef 6e d3 09 97 9b' in read_pcr @@ -294,11 +294,11 @@ def test_tpm2_pcr_extend(u_boot_console): new_updates = int(re.findall(r'\d+', str)[0]) assert (updates + 1) == new_updates - u_boot_console.run_command('tpm2 pcr_extend 0 0x%x' % ram) + u_boot_console.run_command('tpm2 pcr_extend 10 0x%x' % ram) output = u_boot_console.run_command('echo $?') assert output.endswith('0') - read_pcr = u_boot_console.run_command('tpm2 pcr_read 0 0x%x' % (ram + 0x20)) + read_pcr = u_boot_console.run_command('tpm2 pcr_read 10 0x%x' % (ram + 0x20)) output = u_boot_console.run_command('echo $?') assert output.endswith('0') assert '7a 05 01 f5 95 7b df 9c b3 a8 ff 49 66 f0 22 65' in read_pcr