From patchwork Tue Dec 24 16:01:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raymond Mao X-Patchwork-Id: 853199 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp3982232wrq; Tue, 24 Dec 2024 08:01:54 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWJb9D/5dric+rgDSCbNxi7Xh+KP04ryvR3zoGu/o7a+NKBklTIIXU3i1qw1EQZHW703h0z8A==@linaro.org X-Google-Smtp-Source: AGHT+IGZdwuh2Bk+KkAdOdfIAl9a7ky0d7m7X1mardrJ5IuXbYVe1J1rzeUSfDzOXtBQF9b4KTvP X-Received: by 2002:a17:907:1c85:b0:aa6:29dc:11b with SMTP id a640c23a62f3a-aac3342c7f4mr1730729266b.16.1735056114116; Tue, 24 Dec 2024 08:01:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735056114; cv=none; d=google.com; s=arc-20240605; b=Xl1zaRzH66xGq6gFmFSMpyAP/P64Z+6Oz4MwKPMbjb+Rau27IJjOc4f8cp8n5BONm8 yDgRLH3H4CyHdPEZf+f8IUvCF9Q90GGKCF5+sKOiSJ8XdKla7Z4NFhRcxKAN0yxObFRo 4A1LQ1Db2v+1ADNQ6scOfbRn4EU4c2EyS6YZi3E7E9KqwaDh3pCKqll/GJh2nIo1YpM/ A2I89H8ZJWs/1hx77PPLBWmfJ/kqfFm/DvgfaTm19Y3G//ebVP63g6o3ONNvKQcWvs1D m3NoR1C7bKHreifMnxlu/8b1WKBvWXFJaH9bzNs/YSimWIfsjMOgOkPR5cwQceHyCxkt BbQQ== 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=MMB/fCH/nFRLbnvFwEAo1abjqNq75/1uJY+UdEeSwAM=; fh=JwI1T3Njxx0vlNnAg5N5jQGYex21sQ2C4f5jT2UIKcY=; b=G1MuY9bZb9o/r0brXonpDPYURzJ46PD8n9Dj0HUIoNWlUg0iQDMzmswep2W9hYCRUv 7SphAMIWSsHp7wH9fokT9+cfPqA7rpvjctj1eniZ8CsgyRYREZOIE8mCGtFuk3Yg9IP+ 908qh4UPYPnpdzyz5QpZxKRzB9PcYQbQPykFz5PrtF2xi881zttDChniB4rhHyEvL6n2 8KplYnW8UjVQ2mK3mdbttJhqxgzvzRGo031g0lOFflrjYGdZ0xw/XLb4PSOkV/pHUihm gqbZBRqRRAmWKa+8r06R+80ncRFbDLxiERzoombjzcBL0YLD+NzxXRzQA7utUigxL/tH uM2Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O99Fc+qC; 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-aac0f0c8aa8si716211466b.831.2024.12.24.08.01.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Dec 2024 08:01:54 -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=O99Fc+qC; 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 1D3B6807A7; Tue, 24 Dec 2024 17:01:47 +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="O99Fc+qC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6617A807DE; Tue, 24 Dec 2024 17:01:45 +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-xf32.google.com (mail-qv1-xf32.google.com [IPv6:2607:f8b0:4864:20::f32]) (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 2FBBB801F5 for ; Tue, 24 Dec 2024 17:01:43 +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-xf32.google.com with SMTP id 6a1803df08f44-6d8edad9932so35056616d6.0 for ; Tue, 24 Dec 2024 08:01:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735056102; x=1735660902; 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=MMB/fCH/nFRLbnvFwEAo1abjqNq75/1uJY+UdEeSwAM=; b=O99Fc+qCfAnSkwnZOl4QxpKHXcn/r17+OnWy9sYowtR18qNUQ3iM5oOT+MVbL8hs3g Vo/bD6Z6mgz7FXnQtTDtOzZwcvWZF6Y0xqnJ/huMeKzrWvOTsD8xYnHroz5lWC4+ExmJ 10+PcflVVxmc34NvhC8N7549lRu+RJt2zH6tfD6wihYle0gSmaHj4vYmuI1aa4UooBBZ B/SLucI7Ruq8jkcYwCze0Ms+k13ag9zpp60Blu0PE+bdCs89CkxVWVqDzj9LXWJxMiNQ 3l+g3RKGRCQ/JDlztlkVwJdq1VixW5F0e44PoBf1FlsXddUBA1t954+iHVbOspW3mosF yHLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735056102; x=1735660902; 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=MMB/fCH/nFRLbnvFwEAo1abjqNq75/1uJY+UdEeSwAM=; b=WaH1nn3Fwb9ZoiPCtMLosN8AQmqVaTf+44QuhTHzZdzISAy2sFAoDuCPgii2uh+n2p wmBv4vNN1p0wceUxlbTPagMQbe7qWV0YTIkRbilOs4kMJHuv9fXUUHtMMFD+qp79xQkW r/7NUETTN/X5X2Nm3elmjw1PGgqr7+NY19cM5RPSnRw6P+59Z96pxE1HYOcKxJMV69f6 W7Q0Ie5yjt8adTGsudeus0kNI6oFuHAsF/xxzNF0JgIPsIdHJHZCIfbw6Eb3Gubfo6gZ td5G30lyEKzhcOohS8BuOUCbs2kesG8vNii4IDDDKrWkRvRgvjjoe7vDya+oXFiX+3Ts latA== X-Gm-Message-State: AOJu0YwjmpD/xiokwsSnVXzRG7XOvfIwy1U5VGzLXRYF9LSHL7845wXD +d1Efw/0Q/K92UWPTHOWfu/b7sdEaAaai1X3ZL7aZCWsilTkM873lv2mw6e5NZzHzDu4ogh5Ism 5 X-Gm-Gg: ASbGncsCXgu9v4hDPv9Hw++P47IwEUorOLgav1BSicD/RkdPtMWSCisXAGksUzwTl6C g+k2vw1+JoFpph5yZUZn/6TYATw+ChjUY6BmZkp30bkFQFUj27I63yZ87U7kiRq3l4nsLpRyDQS fHavzV9643q05Vzx/F27nPSVXS2I/qyYr65mnGQOFX1mir9bztLGrwBm8+G/Ns/AM/Phf1P2T0n /aveOE+kiK1QQDAkmJCLR1UP8MBdf2R9XRVrax82vYJpNySlUbpagJlnihERlwW4BueRbLQceZ6 Vl/Mvr4VjgsmDiyIkk1aKA0eWwDBS8q01xC+PtJv0korYayD4D2Lu9w= X-Received: by 2002:a05:6214:767:b0:6d8:96a6:ec22 with SMTP id 6a1803df08f44-6dd2335741dmr305361346d6.23.1735056101803; Tue, 24 Dec 2024 08:01:41 -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.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Dec 2024 08:01:41 -0800 (PST) From: Raymond Mao To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Raymond Mao , Tom Rini , Heinrich Schuchardt , Tim Harvey , Simon Glass , Eddie James , Masahisa Kojima Subject: [PATCH v2 02/11] tpm: Rename tpm2_is_active_pcr() Date: Tue, 24 Dec 2024 08:01:04 -0800 Message-Id: <20241224160118.675977-3-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 This function is checking for active PCR banks, so rename it to something that's easier to read and closer to what the function does. Signed-off-by: Ilias Apalodimas Signed-off-by: Raymond Mao --- Changes in v2 - None. include/tpm-v2.h | 6 +++--- lib/tpm-v2.c | 4 ++-- lib/tpm_tcg2.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/tpm-v2.h b/include/tpm-v2.h index 4fd19c52fd..8c43f4fd9b 100644 --- a/include/tpm-v2.h +++ b/include/tpm-v2.h @@ -740,12 +740,12 @@ u16 tpm2_algorithm_to_len(enum tpm2_algorithms algo); bool tpm2_allow_extend(struct udevice *dev); /** - * tpm2_is_active_pcr() - check the pcr_select. If at least one of the PCRs - * supports the algorithm add it on the active ones + * tpm2_is_active_bank() - check the pcr_select. If at least one of the PCRs + * supports the algorithm add it on the active ones * * @selection: PCR selection structure * Return: True if the algorithm is active */ -bool tpm2_is_active_pcr(struct tpms_pcr_selection *selection); +bool tpm2_is_active_bank(struct tpms_pcr_selection *selection); #endif /* __TPM_V2_H */ diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c index ad2b5ab0c3..cb636414de 100644 --- a/lib/tpm-v2.c +++ b/lib/tpm-v2.c @@ -847,7 +847,7 @@ u32 tpm2_enable_nvcommits(struct udevice *dev, uint vendor_cmd, return 0; } -bool tpm2_is_active_pcr(struct tpms_pcr_selection *selection) +bool tpm2_is_active_bank(struct tpms_pcr_selection *selection) { int i; @@ -907,7 +907,7 @@ bool tpm2_allow_extend(struct udevice *dev) return false; for (i = 0; i < pcrs.count; i++) { - if (tpm2_is_active_pcr(&pcrs.selection[i]) && + if (tpm2_is_active_bank(&pcrs.selection[i]) && !tpm2_algorithm_to_len(pcrs.selection[i].hash)) return false; } diff --git a/lib/tpm_tcg2.c b/lib/tpm_tcg2.c index 7f868cc883..edbe5f3aaf 100644 --- a/lib/tpm_tcg2.c +++ b/lib/tpm_tcg2.c @@ -43,7 +43,7 @@ int tcg2_get_pcr_info(struct udevice *dev, u32 *supported_pcr, u32 *active_pcr, if (hash_mask) { *supported_pcr |= hash_mask; - if (tpm2_is_active_pcr(&pcrs.selection[i])) + if (tpm2_is_active_bank(&pcrs.selection[i])) *active_pcr |= hash_mask; } else { printf("%s: unknown algorithm %x\n", __func__,