From patchwork Mon Dec 23 14:47:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raymond Mao X-Patchwork-Id: 853067 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp3432382wrq; Mon, 23 Dec 2024 06:48:18 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWyR3E8bjxMnlX6f8+f5znhrqOdgOY+CErG6VjB5iqMy+BdFOhHMvGjohMZ7KzkAUxf4B2ikQ==@linaro.org X-Google-Smtp-Source: AGHT+IFsa1ffI+DO1GtQ1EhXtf8ZWBFLLZu2+Mn83E18TxGHVsfSEYi5br4mUKZUdEUwoqF5mJdZ X-Received: by 2002:a17:907:d0c:b0:aab:c78c:a7ed with SMTP id a640c23a62f3a-aac33661a71mr1151882066b.49.1734965298630; Mon, 23 Dec 2024 06:48:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734965298; cv=none; d=google.com; s=arc-20240605; b=WPF9H7fnJTsdWOme5C6xHPl9LnXB0O9lf/z2ImDwifSHvtyIjrA5zb6t71hPwK8w7s t+KTGmoK7i3aBLI09bjIk8ritHFiOEo9aRQgtdmXkAvVy5dVSqXlwaV/bN3zr0oJvAej xeEER20zkqXqHss1o44wpewQJ+pGKEaroY5xHGZGsQ1jpr/56Ip5Ls8Qva0iV+62izVu 9PTb6AgV9U4pNGwUJyU4ONMROSGKmPXDwhT86kKdR5pNQtf9Yno0HidS7VSUUl+f6ljE xPU61p8VywFkmJdzrRHabe/vqqTl3ZVp36QWiw8Hjii44HJ9w4XdADIpUrTKCcKwDmIT DCnw== 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=5sjv0G7m7DKrqwz/Yw3WQTPDxOB+R90hxSTRlMzp80A=; fh=MXFne/3XAK7RUtsOf/Btx/lXhXwtjQKdDpJclDZA50k=; b=VyLt3wkHfEDJRrq1tneKaYqHdhZnP+SYgh8Vqpjs1uHpr3YyagmyqdPvZpw9v63L9+ 6drNSTKOzzLiwSj1CY7sQ/CGvVlyc+P1Y3dH6v0llTUH6ERjGDXDTnSfely5B1FzfXUA s1W7UDUFMRnAKlAETsZDhL9j3x9GfMslUcdMHHCD3XSMxnFY8UcAqN0D3AxEKFb06W2M TdSl83Ta1urvQ3/YciyyOjgytXfHdAZJtkNOAmxRV6ApD0yGr2c5FTd1mZhoGCEvf3om Ame9x93utNH0QOfySN+KQhHt3kCjC9dgkNnaAl2eDi1g8iKAJJ/g8qU57mZH1dcgYUlC EdUg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TDDgTL09; 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=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. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-aac0e7f5635si576468466b.40.2024.12.23.06.48.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Dec 2024 06:48:18 -0800 (PST) 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=@linaro.org header.s=google header.b=TDDgTL09; 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=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 DD67C80711; Mon, 23 Dec 2024 15:48:12 +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="TDDgTL09"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A796F806D4; Mon, 23 Dec 2024 15:48:12 +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-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) (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 75D958073F for ; Mon, 23 Dec 2024 15:48:10 +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-qk1-x731.google.com with SMTP id af79cd13be357-7b6e4d38185so345522485a.0 for ; Mon, 23 Dec 2024 06:48:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734965289; x=1735570089; 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=5sjv0G7m7DKrqwz/Yw3WQTPDxOB+R90hxSTRlMzp80A=; b=TDDgTL09IA3pNSu58092CABh+Wie4YOiU6QqVZg6UDQim/zDkc+bMJMhyQf0OzgkJc vRQ0q2T+oZKJfyPZrVLUK96MpOneT5Uu3tMdCbykW02I/WNJnkZLeqVIaXWkYzwPxrsU U+afuZQH9FYCJ4+qtj5PyQwd843W30tQMULn3GPEAu95lACQXlciLqBOgo2gdBJrDonF INURFMKtf7snTXpRTKw6x+sf1bQY/WwmR/wFtNRZTpHJGMq3ABTndpY72CMnQC0lwujP AeYnWePmVyqKAPOyWfeA1pbq9SkHeOLT3BIQUij4lTXoZgIbMaB43wJ1XuojmxZ74Ca/ VP7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734965289; x=1735570089; 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=5sjv0G7m7DKrqwz/Yw3WQTPDxOB+R90hxSTRlMzp80A=; b=VahJROYB/HF2B/jb9Dmnfe27NghdmvOY1vzU7Nd5/MBp0ZYztvCA5tRcVKdL5TrBs+ HibXEbtVVAbkStZysNBorlkwqWrQK4XBy8KtH/tlWmTef4OdjoHNCAwEppsP12sDsGip G4/m94cD7AmB/rcM09OnPp4PNEHrpK2cM9HL302hdDefPXvazP2MglnljyZF2namKUzN h30o3ClP8hNpxs2908t8we4kMfUkOIS8TuBcmhMxFrhKlLwLaGgV+5Nb1nIFGnNTWX08 tkD94+M052lXLNsYxu+grCnnQKzzwcC3IDmevLMiCbSUwRxyUzWvHqntAAv5oh0MWlO9 pnMw== X-Gm-Message-State: AOJu0Yz4M2ilngZY6FosYKXa5H4syTI+DzP1s2avWbOuiyltiYVdSE1w FE/lEFh1VPh4Pp8nvHycQ/AYOcdofwLeT1gv47SSB5P4m5b+vpX+zMfjo2T7hd/Im84KMqtQlPK W X-Gm-Gg: ASbGnctyVEgPVTmKMaJK/tlswckmBAd6U2Sz7PcnIArICpD3rwAAXwX6Ff6M3Ikpuhl +9lvtsFWa5o9zLJ5uypd5oTnSmHUOGw9tr3pdHmMtltgjBymy1Mum+M3fVkq/wV5Pfyv6iVCf2+ JmazMElHSVcDT9k+ez1FLLZGm6P/jty0Vrc8zvN1CArZyjTD+pMATqHKpEIT4NeUfeda/ybCjLA 9gi9gXAhU/FdnUWiRyImm5/qT345iVsUQvUDOBibjbsWjYMoZVeQlMB3QOO19+Z/r7GP8QUeHU2 JMBplVXnyoRrU2/Ci+fuYCYCqo8lCNWJ+YnEvJEgLcFyQVuqQhnO0/I= X-Received: by 2002:a05:6214:dac:b0:6d8:9124:8799 with SMTP id 6a1803df08f44-6dd2331f006mr244819506d6.5.1734965289187; Mon, 23 Dec 2024 06:48:09 -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-6dd181bb519sm44243246d6.83.2024.12.23.06.48.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Dec 2024 06:48:08 -0800 (PST) From: Raymond Mao To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Raymond Mao , Tom Rini , Heinrich Schuchardt , Simon Glass , Tim Harvey , Eddie James , Masahisa Kojima Subject: [PATCH 03/11] tpm: Rename tpm2_allow_extend() Date: Mon, 23 Dec 2024 06:47:25 -0800 Message-Id: <20241223144737.554992-4-raymond.mao@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241223144737.554992-1-raymond.mao@linaro.org> References: <20241223144737.554992-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 --- 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;