From patchwork Thu Jan 13 23:54:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 532485 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F072AC4332F for ; Thu, 13 Jan 2022 23:56:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235807AbiAMX4d (ORCPT ); Thu, 13 Jan 2022 18:56:33 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50072 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238256AbiAMX4c (ORCPT ); Thu, 13 Jan 2022 18:56:32 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 70BDE61D0E; Thu, 13 Jan 2022 23:56:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8C32C36AF3; Thu, 13 Jan 2022 23:56:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642118191; bh=OYwT1/oic13UOKNCipi3UaLYBkRKybjJlJF3WtRhuG4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RvWoRghf90qh2LA7WNHy1/8tcMzHX8zcw/Gmsa/qP/q8lePpPoEW9GtFkmjQW9bd5 JFAotM4xGK02KKcpmZAJ0fKSUm5hMcoAEvNtILJJbvljTSXpZ6yk1i0CZ3ctTiygpu tP2mzFLJdsViO3WAQhkfl6bckXDCDLpM72JAa1EdwgBKX42bI4WznUgtSlcMUBzKa8 xtOh0FXxUQrp2KC0m2VfNWN5Nauo9v1U4fzanbtNrTQmuHfgHD5Fezy+tUAhu5ubFa NuxucdotQX2gwrucH5fRRPepv27AY5ta6rRX18OYpb4ke5KGKRDUFuNX4F4/x/DW3F 7vuiOnsp1SN9A== From: Eric Biggers To: keyrings@vger.kernel.org, David Howells , Jarkko Sakkinen Cc: Denis Kenzior , Marcel Holtmann , James Morris , linux-crypto@vger.kernel.org Subject: [PATCH 3/3] KEYS: asym_tpm: rename derive_pub_key() Date: Thu, 13 Jan 2022 15:54:40 -0800 Message-Id: <20220113235440.90439-4-ebiggers@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220113235440.90439-1-ebiggers@kernel.org> References: <20220113235440.90439-1-ebiggers@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Eric Biggers derive_pub_key() doesn't actually derive a key; it just formats one. Rename it accordingly. Signed-off-by: Eric Biggers --- crypto/asymmetric_keys/asym_tpm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crypto/asymmetric_keys/asym_tpm.c b/crypto/asymmetric_keys/asym_tpm.c index 2e365a221fbe..d2e0036d34a5 100644 --- a/crypto/asymmetric_keys/asym_tpm.c +++ b/crypto/asymmetric_keys/asym_tpm.c @@ -336,7 +336,7 @@ static inline uint8_t *encode_tag_length(uint8_t *buf, uint8_t tag, return buf + 3; } -static uint32_t derive_pub_key(const void *pub_key, uint32_t len, uint8_t *buf) +static uint32_t format_pub_key(const void *pub_key, uint32_t len, uint8_t *buf) { uint8_t *cur = buf; uint32_t n_len = definite_length(len) + 1 + len + 1; @@ -409,7 +409,7 @@ static int tpm_key_query(const struct kernel_pkey_params *params, if (IS_ERR(tfm)) return PTR_ERR(tfm); - der_pub_key_len = derive_pub_key(tk->pub_key, tk->pub_key_len, + der_pub_key_len = format_pub_key(tk->pub_key, tk->pub_key_len, der_pub_key); ret = crypto_akcipher_set_pub_key(tfm, der_pub_key, der_pub_key_len); @@ -463,7 +463,7 @@ static int tpm_key_encrypt(struct tpm_key *tk, if (IS_ERR(tfm)) return PTR_ERR(tfm); - der_pub_key_len = derive_pub_key(tk->pub_key, tk->pub_key_len, + der_pub_key_len = format_pub_key(tk->pub_key, tk->pub_key_len, der_pub_key); ret = crypto_akcipher_set_pub_key(tfm, der_pub_key, der_pub_key_len); @@ -758,7 +758,7 @@ static int tpm_key_verify_signature(const struct key *key, if (IS_ERR(tfm)) return PTR_ERR(tfm); - der_pub_key_len = derive_pub_key(tk->pub_key, tk->pub_key_len, + der_pub_key_len = format_pub_key(tk->pub_key, tk->pub_key_len, der_pub_key); ret = crypto_akcipher_set_pub_key(tfm, der_pub_key, der_pub_key_len);