From patchwork Tue Dec 24 16:01:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raymond Mao X-Patchwork-Id: 853200 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp3982343wrq; Tue, 24 Dec 2024 08:02:04 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXw7rwAcZAOn9Q0Y8Litf8GBh8fFPx+Gkg5fHaGRTYwMFyEudPaM3efRNhA2L8lmJyiFMphIQ==@linaro.org X-Google-Smtp-Source: AGHT+IFkF76pT1KWT04M9bqvsmmu5sCM+4fvgcLW80KORJCCnBtKVOGw+slWN3JzC2/JYL57uUHi X-Received: by 2002:a17:907:1c21:b0:aa6:88b3:ba4e with SMTP id a640c23a62f3a-aac33415dd6mr1826605666b.36.1735056124385; Tue, 24 Dec 2024 08:02:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735056124; cv=none; d=google.com; s=arc-20240605; b=U9VM0fKA0zsqYyqrT84ywtFk9rkvA1tc3C+/VlK/v8OD59ftnQmJMmWW7ah2AVvM5g n/uW8HL2AJcGb4Nq+5JbXP1gcrIeHi3RDCwhLtIBpHaeih8dKNCUctwNSvm7pSbopegX owr8b9BSjniQXlFdbgK6oUa+t7T+t2pf5bT/l1XiGQID0dWGB57RRpNHqu+Gf6V5RJFc yFUTjE7zpXs9nvXN04RqpRT4wBqyYo/6xNZvxMmNXGp9JN+rKFStKq0bJ14LNwTPLoZL 7dw0y/DnMDbvzVkXnmcOTTxEICnIB8jcIHnUIDtY9I4+Bb6644eeaI38G8yxa1ASWP8l QukQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=2v44yJMOddWJK/ZNBTpR7f3UP3dJnUL4WcwKStHPLvI=; fh=FbKFTC1qYMAD+RQvZ2xhe3F2GCUPpkB6HLUJw8ZR8RU=; b=NhQ7tPqXfvYfbIpjyl+hzPAvCgUjPpsu9UcK7kfOBHM6RyhGq5rIoS9OG5ZCieR3GU DoXg0ewvlY2eJqNhd1K1gN0ho+f1N2wlcusatOW1d1EHkDilQePQcjCzbcXffCQwsgcw M/TEGC5oRDIh3C+b9BCjx+ByVQ3dZUxVXuOAXfsgBi++vDjRuXi69WkKfrZlo6p6b2la 5Ex5zPe1WVk53gNcvlGklUxvAMLPUQUGjbtqhCsMi6v+eu+ERwKM0s1BEgiLzlKau3MV 41Z1iLB7pmy1BSQenDq6/UVpCca2XlqewNH2GvXa2PwVthxQrRHhTYdqjqgTcHb9Ubs7 WgpQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zb3mkwJO; 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=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org 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 a640c23a62f3a-aac0f082545si688848266b.653.2024.12.24.08.02.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Dec 2024 08:02:04 -0800 (PST) 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=@linaro.org header.s=google header.b=zb3mkwJO; 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=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 760C2807DE; Tue, 24 Dec 2024 17:01:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="zb3mkwJO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DA5D5807DE; Tue, 24 Dec 2024 17:01:52 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-qv1-xf35.google.com (mail-qv1-xf35.google.com [IPv6:2607:f8b0:4864:20::f35]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 88666801F5 for ; Tue, 24 Dec 2024 17:01:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=raymond.mao@linaro.org Received: by mail-qv1-xf35.google.com with SMTP id 6a1803df08f44-6d8e8cb8605so27455176d6.0 for ; Tue, 24 Dec 2024 08:01:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735056109; x=1735660909; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2v44yJMOddWJK/ZNBTpR7f3UP3dJnUL4WcwKStHPLvI=; b=zb3mkwJOLCCGYXppjhKTr/WSCp8PiMfqwhG2aNXqsqo2gy96YsD2hCJkFQjVTm5iV+ 61TOdJmdAnN0GQUAnRuC2uV8TjL3m84HixHLOfMUxxA2WgNybLgeQkewvnh4Hv15mthl P6Q9HYkBK2NlWym01Zl5j3sp7ZH47tMlPhcA3+2OEVLmgvO+hJSntnpL+DkFqLc75uGe rchBISHZHBPP7KZ6Mf79bQsHitKxFbxSxclcHqGOLg+JQju5h04gMlVlhIFk3Y2nboxh ax14NdtSiZWIslJZoKBw+nHXMZ+m0YHFzSoFOtHgMy43TvvHoXR2KNcnjKDxpJEtFWdk Dnig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735056109; x=1735660909; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2v44yJMOddWJK/ZNBTpR7f3UP3dJnUL4WcwKStHPLvI=; b=edZ84bnHmJ77PUx36kWUnvwMr6n+5L38AYiru5qch7c70dZEdR/x+RSe/KjkWw3b6B cAlxmCJRagZfmghbyR40dnHgQi675dRRmduCeI3sTFBfXa0XBg2ft9pHSaYYtPsSX4+z GJ6hxJhx8747wf3Q2Sot7RvuA2rR97728rd1wETUkU8ikJWiXuUcsA+ZT6NeYstAy4QP sjJfMkWITaqCNsD47hpGAZ4eqzmsSj0nNhEjPMY0Y0vApFBwBj65Pwm9YYMIX1QT0Z0g GRzjXhZs07INyCAkcQ1eUtCoQhL7CP/MSXJxq0Kiy0jb9eI8ovvYp/T6zZd6Ehfn2amc 3h2Q== X-Gm-Message-State: AOJu0YwyWMKqXTjIRMtOguZp4uuTVtFA/3/MZgdz81blX7tZJnfzup/+ txMxriIFLGVsO3up1D+0u/7U/3H17CqXtczf2ZBi+5KsKcmSAPuGHZPDHIB41EG3jtkMk/Nj0dM b X-Gm-Gg: ASbGncvIBx9CJ6KikdcTrV5LvPBDC3GpPCVcnIb4JNONa/UUzSsJlxXXhOtCDfB0YqA UZTHHjt95XIAEdY9jHqsKh1BmoOzBVwXph6rrx7ppGbjQCC1u6q0I7Oq9SwHtcW/EpyOk7UKWcQ kbC45lZqmuS8VBXdQLgxGWPzSPKcP6KJ7XR0yaUE0e/O3CficLVFE7Qy8no6177CEzj29lTXudc EJiAGPX89WfTwVltedAHmcY8TgF/a75LCyyoFVVXjGqPlXAtWgE82/yccVR4c+RApH6M1yh7wLK 6JkO83T6i7FTHcO1bGHA++OpRigqmUloLTgCjB2Xr5BxHHs0v14KPE4= X-Received: by 2002:a05:6214:4290:b0:6d4:1a42:8efa with SMTP id 6a1803df08f44-6dd230cbcabmr271865426d6.0.1735056109284; Tue, 24 Dec 2024 08:01:49 -0800 (PST) Received: from ubuntu.localdomain (pool-174-114-184-37.cpe.net.cable.rogers.com. [174.114.184.37]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6dd181d432asm53840816d6.110.2024.12.24.08.01.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Dec 2024 08:01:48 -0800 (PST) From: Raymond Mao To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Raymond Mao , Tom Rini , Heinrich Schuchardt , Tim Harvey , Simon Glass , Masahisa Kojima Subject: [PATCH v2 03/11] tpm: Rename tpm2_allow_extend() Date: Tue, 24 Dec 2024 08:01:05 -0800 Message-Id: <20241224160118.675977-4-raymond.mao@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241224160118.675977-1-raymond.mao@linaro.org> References: <20241224160118.675977-1-raymond.mao@linaro.org> MIME-Version: 1.0 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 When that function was introduced we were only using it to check if extending a PCR was allowed, so the name made sense. A few patches ago we used that function to reason about the EventLog creation and general usage of PCRs , so let's rename it to something more generic that makes more sense in all contexts. Signed-off-by: Ilias Apalodimas Signed-off-by: Raymond Mao --- Changes in v2 - None. include/tpm-v2.h | 5 +++-- lib/tpm-v2.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/tpm-v2.h b/include/tpm-v2.h index 8c43f4fd9b..87b2c614ad 100644 --- a/include/tpm-v2.h +++ b/include/tpm-v2.h @@ -732,12 +732,13 @@ u16 tpm2_algorithm_to_len(enum tpm2_algorithms algo); */ /** - * tpm2_allow_extend() - Check if extending PCRs is allowed and safe + * tpm2_check_active_banks() - Check if the active PCR banks are supported by + * our configuration * * @dev: TPM device * Return: true if allowed */ -bool tpm2_allow_extend(struct udevice *dev); +bool tpm2_check_active_banks(struct udevice *dev); /** * tpm2_is_active_bank() - check the pcr_select. If at least one of the PCRs diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c index cb636414de..0edb0aa90c 100644 --- a/lib/tpm-v2.c +++ b/lib/tpm-v2.c @@ -197,7 +197,7 @@ u32 tpm2_pcr_extend(struct udevice *dev, u32 index, u32 algorithm, if (!digest) return -EINVAL; - if (!tpm2_allow_extend(dev)) { + if (!tpm2_check_active_banks(dev)) { log_err("Cannot extend PCRs if all the TPM enabled algorithms are not supported\n"); return -EINVAL; } @@ -896,7 +896,7 @@ u16 tpm2_algorithm_to_len(enum tpm2_algorithms algo) return 0; } -bool tpm2_allow_extend(struct udevice *dev) +bool tpm2_check_active_banks(struct udevice *dev) { struct tpml_pcr_selection pcrs; size_t i;