From patchwork Thu Oct 12 14:45:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 732476 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1006329wrv; Thu, 12 Oct 2023 08:11:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IENHBJv+u6Er3UUgB/Wje71BE9AtCWjv3AqOFskc6w7mdnngzlcG7SHjKs9sTrznuh1HT48 X-Received: by 2002:a5d:4c50:0:b0:31c:8880:5d0f with SMTP id n16-20020a5d4c50000000b0031c88805d0fmr20734411wrt.11.1697123476238; Thu, 12 Oct 2023 08:11:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697123476; cv=none; d=google.com; s=arc-20160816; b=0lrqHPvowntQUWOEyTD+6xUY9sqPl+VdB3JRkfdl7zNGNB0k1dY6+dPyrl+WP5xQGt L9To9PpG64DjqXtAkoo/HTJNereeslJgxdeyasYSzua9IlSYF7J+Na0ctgFdhy6S2UNk Wz5t4Rbi58MNlr9UzAbqabPB9b/0kABr0oedihevK+e7csI60m7Uyl7S4uAz99esYDm/ CWZTT3wgHS9RPZTlOi+i3+iLBrz1Nkua6GdwneJ4qp3YcTeeJTYq+Jw1JLfKYmi53fDU NTqOd4Q9V//kBbmNC7JI2Cj8R6GaSOtFUGN/z0rnfKEXrffWpzBAqQsT54gjc3G4fdXJ DJjw== 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=9hT0jbAPiF0n7ZljUlwqFgAhHgdleI2rqCcY++Dk79c=; fh=qcf+K3XeiyfpFyw7S8c/vz0d3RpzBuRq8YjpHxV3oDc=; b=VgzKeSX58dlv0ag01I0Ced6hDklsyNsMrttVjooDq5uleFR4g3inIdH5wta2VYqQFW b5iiqssOhVRsm3sbxn2ndXJJWUNHd5q9WNeIFysdAqexpkY/2TPzqnMEe7ZqS0hz+He/ N0x9QGJdeFzSNU+h97/8wjojiCMO3QV+oBb6EVUs5eu1aNfQf+n9Qgqbap4bBMgIEP+n zUrEuj3/4AXqY/LQ1c0qddq0fSLApoWJHnkxcK1ObXg8sYbTX1AWiKqrwFcwhl0W573w CR/ZCxkRD61U+8F528tGCl0/G/zTERjtL3y+FZevls25nNdXg3Qzw5diajb+go3nuw7I Zqow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=A9aAHjr3; 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 d3-20020adfe843000000b003267b46904asi1918604wrn.619.2023.10.12.08.11.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 08:11:16 -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=A9aAHjr3; 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 60C5E86D33; Thu, 12 Oct 2023 17:09:42 +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="A9aAHjr3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4E38A86B1B; Thu, 12 Oct 2023 17:08:45 +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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H4,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 BBABD86A9F for ; Thu, 12 Oct 2023 17:08:28 +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 (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39CF6DXB025503; Thu, 12 Oct 2023 15:08:21 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=9hT0jbAPiF0n7ZljUlwqFgAhHgdleI2rqCcY++Dk79c=; b=A9aAHjr30fLujKRkLUx+ndQzxk1hyiy8RNQE9DguNPmR1gtsyp3D3mHqV5BB72K97eHB CWeA8XO10FCXgglAcnAjtqHHA+TD0dYHsFEXEEvBLqXWb799lGxhmjaF4rUi+A3uhMPh 1vvCPdi1oBECTuzhbBNJHLcQuKhAy1NeQvdJFJ8s9bmk3HSMMMRgdZw/k+OVfJpielpF RjFApZNxn+phWwDkW+7b5sM5Mi09en4jdnxuLIrBM2QYnCoK02r2nUgAjuPd4wH79kiS nNspYz05Fjvf6APsCX3fKsLW5beOoxK8KHr9AoPjDnNzcPNdfxpJDuH5qt382cSG1wXi xg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tpk0yrbv9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Oct 2023 15:08:17 +0000 Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 39CF6WIh028663; Thu, 12 Oct 2023 15:08:12 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tpk0yrba4-9 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Oct 2023 15:08:12 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 39CBr5ev024461; Thu, 12 Oct 2023 14:45:54 GMT Received: from smtprelay05.wdc07v.mail.ibm.com ([172.16.1.72]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3tkhnt0f67-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Oct 2023 14:45:54 +0000 Received: from smtpav04.dal12v.mail.ibm.com (smtpav04.dal12v.mail.ibm.com [10.241.53.103]) by smtprelay05.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 39CEjrpI24314598 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Oct 2023 14:45:53 GMT Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 34DAB58052; Thu, 12 Oct 2023 14:45:53 +0000 (GMT) Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 05FDF58056; Thu, 12 Oct 2023 14:45:53 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.148.23]) by smtpav04.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 12 Oct 2023 14:45:52 +0000 (GMT) From: Eddie James To: u-boot@lists.denx.de Cc: ilias.apalodimas@linaro.org, sjg@chromium.org, xypron.glpk@gmx.de, eajames@linux.ibm.com Subject: [PATCH v12 7/8] efi_loader: fix EFI_ENTRY point on get_active_pcr_banks Date: Thu, 12 Oct 2023 09:45:50 -0500 Message-Id: <20231012144551.679551-8-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231012144551.679551-1-eajames@linux.ibm.com> References: <20231012144551.679551-1-eajames@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: -be2og25qwugyKybErokffgwkSx_EsGP X-Proofpoint-ORIG-GUID: Ytlg97AWjqfkYkNTdGs4r_RYP5xUwfcX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-12_05,2023-10-12_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 phishscore=0 adultscore=0 malwarescore=0 impostorscore=0 clxscore=1015 suspectscore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310120125 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 7ada536568..dae1b166c8 100644 --- a/lib/efi_loader/efi_tcg2.c +++ b/lib/efi_loader/efi_tcg2.c @@ -949,16 +949,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 Thu Oct 12 14:45:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 732477 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1010989wrv; Thu, 12 Oct 2023 08:19:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFUtZ5+BIa7Kk1L9DtgjQhm4ymI4axjIOpRjAvbwabHwi5x4xb1hU3Gqunwqo3MzfMBUE/j X-Received: by 2002:a5d:58e4:0:b0:32d:8e54:29f7 with SMTP id f4-20020a5d58e4000000b0032d8e5429f7mr1939638wrd.64.1697123982812; Thu, 12 Oct 2023 08:19:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697123982; cv=none; d=google.com; s=arc-20160816; b=tQoUCpYifUQWgpIBi52H58AbjNbs7arTW1qDid3lfhtRd+ftAT0wfd0y1h1GI2ShTR +U61SMkHxvNZXfnVWc6ZVS1NhcxCAvodwLaTO/P3k8IUXZQuFrZ0Ozao4rfjd1SUk4oi vMemcEJMVA2ZB8Mb457zr1Kxt0V9XeXquaHtLgoZfp12XGvOnGKVPHugmJ/v3rG8qakX SA0yivQODy+8BuJiWYLxWAC22LkB/N9qn+dyvNIQN1w9Dfp4SM6Aibmhe5q5BYLDE85h I6Mb0TMJpIl4s/75CdjGLGOm4HoNo0Ifhf2GrN0T4YU0u7YigGKSq6DCf4QESjW7VtS3 SR6A== 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=9ofSYSCEOjtlae9Kix7hxiopmr3DTmymhm67aDPzdck=; fh=qcf+K3XeiyfpFyw7S8c/vz0d3RpzBuRq8YjpHxV3oDc=; b=hLFKjbPcWlvqpo4S4jOrmNrq8wOJKLJxKCqKJ7utYXl3Os/w1GHCZ6TEeBgPkCXY7z pDIJtjrS/Tl2Ql6ENXtavgxOGVG3AcWcwCvFP+oy58F8xkaphRB5T89WoQmJ5s/PF7bz I7ybjWj9YikaBFvxAVqoNGbfiFJL0d5cBac/e+0kO/qVD4S/GMdYfc2muIWAFImPADEZ vPeJfN0JoY625+G60aSESfTAbwTciS5USGnegOe+lE2EQMxQAnu59ZJOqwMohJZNe3Z8 dAkgwaiRwi660bML8T5pZhb/AyD4RYIZQ1+cuoes4UiAzKSDpIwpbTEnAf9MxLcFO/dK ETgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=sOT1QYAE; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id f10-20020a5d50ca000000b003176fea0c60si7046483wrt.617.2023.10.12.08.19.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 08:19:42 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=sOT1QYAE; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 68AE886A9F; Thu, 12 Oct 2023 17:19:40 +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="sOT1QYAE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A3E4686A6B; Thu, 12 Oct 2023 17:19:34 +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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 AEED286DD9 for ; Thu, 12 Oct 2023 17:19:31 +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 (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39CFFSBN022843; Thu, 12 Oct 2023 15:19:29 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=9ofSYSCEOjtlae9Kix7hxiopmr3DTmymhm67aDPzdck=; b=sOT1QYAEgJO8ZJzvDJLyRoHaMUi7YRzK/JJgihmRi00e6FShzcbW3/tHmCc6bAH4O8ga sBMszYXjzWcFbd22ejVRotj89Zj+pcCkjaA3VKNeugNz8xRPaXeK1ee4K6m1+zTXDeuu 6XbSPy13Xm7dTRytkyneYu1RZDUZsSE9SU2wqj9byYQ4P6BYqxHZES+PcyDsNXw44FV0 4DaKj9R0mobsJu0lnK6iGe/ak8bz+JcoInsFiyQQ19hyGxJiucvudbzw5hP69URmkrZb ZaY9FcZlGfw9AWUqtA2/oIlYUU1CohZCJAb5oAU2JEFv/M5PiLcqevNJibOz2MM/0uqf RA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tpk9fr50y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Oct 2023 15:19:28 +0000 Received: from m0353723.ppops.net (m0353723.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 39CFFk2Y023448; Thu, 12 Oct 2023 15:19:28 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tpk9fr2wx-11 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Oct 2023 15:19:27 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 39CCc1BI025907; Thu, 12 Oct 2023 14:45:54 GMT Received: from smtprelay05.wdc07v.mail.ibm.com ([172.16.1.72]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3tkjnnr43b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Oct 2023 14:45:54 +0000 Received: from smtpav04.dal12v.mail.ibm.com (smtpav04.dal12v.mail.ibm.com [10.241.53.103]) by smtprelay05.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 39CEjrV823855752 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Oct 2023 14:45:53 GMT Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 617DA58063; Thu, 12 Oct 2023 14:45:53 +0000 (GMT) Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3CCF25805A; Thu, 12 Oct 2023 14:45:53 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.148.23]) by smtpav04.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 12 Oct 2023 14:45:53 +0000 (GMT) From: Eddie James To: u-boot@lists.denx.de Cc: ilias.apalodimas@linaro.org, sjg@chromium.org, xypron.glpk@gmx.de, eajames@linux.ibm.com Subject: [PATCH v12 8/8] test: use a non system PCR for testing PCR extend Date: Thu, 12 Oct 2023 09:45:51 -0500 Message-Id: <20231012144551.679551-9-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231012144551.679551-1-eajames@linux.ibm.com> References: <20231012144551.679551-1-eajames@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: pxdHLgcxeTKbzZHSpnT-3Wly_mF2MdRX X-Proofpoint-ORIG-GUID: _dY247u5vbqhyFzudaddLKVw4Oo5RdyM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-12_05,2023-10-12_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 mlxlogscore=999 priorityscore=1501 lowpriorityscore=0 suspectscore=0 bulkscore=0 mlxscore=0 phishscore=0 malwarescore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310120126 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 c2579fa02c..47392b87a9 100644 --- a/test/py/tests/test_tpm2.py +++ b/test/py/tests/test_tpm2.py @@ -239,7 +239,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) @@ -247,7 +247,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') @@ -257,7 +257,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') @@ -275,19 +275,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 @@ -297,11 +297,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