Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1979653rwi; Thu, 3 Nov 2022 11:10:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4TpC1To6DOi5lqAc27RlJz5a4ZCUUARmMe2wPwuZXJSOEFh8QWW4matNArowPFHXCWFA+I X-Received: by 2002:a17:902:e74a:b0:187:2039:5754 with SMTP id p10-20020a170902e74a00b0018720395754mr23128199plf.103.1667499015800; Thu, 03 Nov 2022 11:10:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667499015; cv=none; d=google.com; s=arc-20160816; b=R95FE9HuBz0aUwFP0MGrcZqOQmUGzXSrvbGh+RPbVkVVS5LJkXqGW7NRdPKDark/e4 lY2aUS1fYMWCoctiDWhKywxIJs75jd8yXyBv1Ar6UG73DOZUncjojsy6SMXfoMi4xJBu QlbdjbpkpjkD1VFP+mwbL37TXESi9KMQddM1yZyuXFH+SeV3AzH5pbEYwf4RDc1BF68O azgcMg+gD3HJxaziBeHTLFp7NBLaF7z45l8vsVCOJExSt62/FcI3xn53BIXYxgI29/8B ZXN2P4hbaDfB92ffVaEUnUJrbTvahiRB9KrrDB0/vV7npV01hiWw+nbajNxEDo+NDACJ xp1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WfQ8/CAL4S026DtWAnZscysHYhGEE1wVieDh82Tdr08=; b=M6Bhm9cDK8aBQudiNFhBgkwJpgNKzebchJrrbv8is9Ru5c2amsUPG6qDKieR+4gC1U A6tn5Eip9TP+swqZs17ZoWPh5nelcYyFVglQupreXd30OCWxM/1+D5z4Fi62CEWn1w4G Qa71doZUimUR4BxHRJkCjGSU78n0WZby8NluGNXIkZn+5kzcYArqpQlDSGblvSdKB1Ee +eRF6tfP7CENchROPwPDgT0Oy2otlwSUWlL9m68N8U1kATPDHHTV7k3W8g3agmz2x5fb SU4wYJ6RqPx3qWtIT09kEZqKdb6MEXV4G/luX5FEBCNEb8k4y063iH3eVzMFeR8yXh6G j/Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=I18iC2yK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j64-20020a638043000000b0045769b0c418si506996pgd.89.2022.11.03.11.09.45; Thu, 03 Nov 2022 11:10:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=I18iC2yK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230089AbiKCSEZ (ORCPT + 99 others); Thu, 3 Nov 2022 14:04:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231167AbiKCSEA (ORCPT ); Thu, 3 Nov 2022 14:04:00 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76F2E23392 for ; Thu, 3 Nov 2022 11:01:40 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id b11so2403798pjp.2 for ; Thu, 03 Nov 2022 11:01:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; 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=WfQ8/CAL4S026DtWAnZscysHYhGEE1wVieDh82Tdr08=; b=I18iC2yKrg6+LAoc5oeMqbZb2+EuFmwElNbhB+mUlPs0W89QCjCZPKV2w4PrgavOFa kFnCeYud6UfFP8OvHBqunAtTVF/rbF13qqrG9H3qMTi1Ygmz7MlR/y2vna8amHhP4LOY rbOH9iNj9wvWvP8Uegka7N+SJm0ekA0q8PY+M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=WfQ8/CAL4S026DtWAnZscysHYhGEE1wVieDh82Tdr08=; b=jULVamKATN6Kdtp4dLpdZ9cczacAa/y6yCkS77DJ7Cmbjpnt2rOJEf2HwAYv22a11f aJqIcKNlEYLlk7JgCzTOVrS/nJLTlz6YKDcwTz9CItUfFCmq6F4KrkYJO1lDsoqlxid1 qi8n5w2O6Q0fo8FNQjzJj6yHqitOq2pDCMF7P+EvCEPguI1vg0vjHBMth0hlzgQLIHsb Z/CBl5g1mNidXtKpUX+zinmZ9ezwkhQf4JjxP+R8T/oxhrjwHBRVPBQb26c6U6gjeG2v sTTX5dMIFvgDSECiXJWN2H7EdTgYo964h39ADqPoWSNDJWnMs8Stnkn8A67KgCed1BM7 i8IQ== X-Gm-Message-State: ACrzQf0PB2BVchOkOPflvAbiXI4BXB0+5Ynzw/qo3sJbZcOkLYCg+xNA 9IaJRIKe/vp52GU6R1cVoXtZZhtt833h7TLG X-Received: by 2002:a17:90a:f484:b0:213:d200:e956 with SMTP id bx4-20020a17090af48400b00213d200e956mr25810351pjb.40.1667498500047; Thu, 03 Nov 2022 11:01:40 -0700 (PDT) Received: from evgreen-glaptop.lan ([98.45.28.95]) by smtp.gmail.com with ESMTPSA id t12-20020a1709027fcc00b00177fb862a87sm1000277plb.20.2022.11.03.11.01.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 11:01:39 -0700 (PDT) From: Evan Green To: linux-kernel@vger.kernel.org Cc: corbet@lwn.net, linux-pm@vger.kernel.org, rjw@rjwysocki.net, gwendal@chromium.org, apronin@chromium.org, Pavel Machek , Kees Cook , Matthew Garrett , linux-integrity@vger.kernel.org, jejb@linux.ibm.com, zohar@linux.ibm.com, dlunev@google.com, Eric Biggers , Ben Boeckel , jarkko@kernel.org, Evan Green , Jason Gunthorpe , Peter Huewe Subject: [PATCH v4 02/11] tpm: Export and rename tpm2_find_and_validate_cc() Date: Thu, 3 Nov 2022 11:01:10 -0700 Message-Id: <20221103105558.v4.2.I7bbedcf5efd3f1c72c32d6002faed086c5ed31c7@changeid> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <20221103180120.752659-1-evgreen@chromium.org> References: <20221103180120.752659-1-evgreen@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Export tpm_find_and_validate_cc() since it will be needed by an upcoming change allowing access to certain PCRs to be restricted to the kernel. In order to export it consistently, and because it's a tpm2-only function, rename it to tpm2_find_and_validate_cc(). Signed-off-by: Evan Green --- (no changes since v3) Changes in v3: - Split find_and_validate_cc() export to its own patch (Jarkko) - Rename tpm_find_and_validate_cc() to tpm2_find_and_validate_cc(). drivers/char/tpm/tpm.h | 3 +++ drivers/char/tpm/tpm2-space.c | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index 24ee4e1cc452a0..f1e0f490176f01 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h @@ -231,6 +231,9 @@ int tpm2_find_cc(struct tpm_chip *chip, u32 cc); int tpm2_init_space(struct tpm_space *space, unsigned int buf_size); void tpm2_del_space(struct tpm_chip *chip, struct tpm_space *space); void tpm2_flush_space(struct tpm_chip *chip); +int tpm2_find_and_validate_cc(struct tpm_chip *chip, + struct tpm_space *space, + const void *cmd, size_t len); int tpm2_prepare_space(struct tpm_chip *chip, struct tpm_space *space, u8 *cmd, size_t cmdsiz); int tpm2_commit_space(struct tpm_chip *chip, struct tpm_space *space, void *buf, diff --git a/drivers/char/tpm/tpm2-space.c b/drivers/char/tpm/tpm2-space.c index ffb35f0154c16c..ca34cc006e7f8d 100644 --- a/drivers/char/tpm/tpm2-space.c +++ b/drivers/char/tpm/tpm2-space.c @@ -262,9 +262,9 @@ static int tpm2_map_command(struct tpm_chip *chip, u32 cc, u8 *cmd) return 0; } -static int tpm_find_and_validate_cc(struct tpm_chip *chip, - struct tpm_space *space, - const void *cmd, size_t len) +int tpm2_find_and_validate_cc(struct tpm_chip *chip, + struct tpm_space *space, + const void *cmd, size_t len) { const struct tpm_header *header = (const void *)cmd; int i; @@ -306,7 +306,7 @@ int tpm2_prepare_space(struct tpm_chip *chip, struct tpm_space *space, u8 *cmd, if (!space) return 0; - cc = tpm_find_and_validate_cc(chip, space, cmd, cmdsiz); + cc = tpm2_find_and_validate_cc(chip, space, cmd, cmdsiz); if (cc < 0) return cc; -- 2.38.1.431.g37b22c650d-goog