Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp542302lqg; Fri, 1 Mar 2024 12:56:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVH/7yspJ1z4ZuEWsyq2/GkRk2DSWWgrT5IYXX/SKuM+VkppKzZR/B48//WVcJyjsPUV2EENlubUBbDgA89fw3bchOMAfAHn/v+3uGoPw== X-Google-Smtp-Source: AGHT+IGqqslOEfSycjD1ao/QWLYcbhLfZtSrMT0mjeF0SvW9tk80BnsNP/j/idPZYrQaRsZM/keK X-Received: by 2002:a17:906:b792:b0:a3e:eb81:ab5b with SMTP id dt18-20020a170906b79200b00a3eeb81ab5bmr2043244ejb.54.1709326605705; Fri, 01 Mar 2024 12:56:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709326605; cv=pass; d=google.com; s=arc-20160816; b=KW0OboPzsl2YrcqnzTHzeaeAs+qamy+G4jSTTZQxD5HSS76j1OcH8IkwNnAQ04Xae6 7OPS0/dYd2tOp5AUBg2zSvvPMboR17x2/Pp98Rw6ahggfxHLP0JzkOHqvD5IfHXHtUGN cvpVD16wYTJ+1g3xdMmZLwqhYJatTQppGIbQWeUsrh0psiivO1OscoFGVMB4bHHB5ekS mYYC73x8OTChwzOedFUah4/s5osv08ieV/8xUzZoCmy8YEdgp7yYpjqoXJM1kOQOswCH PDNzwE9Ld3eJzeiCVt+Dd8j21upF8ies3ra66iFAaudY0N+aKsWIZRIBoiydouCjL7eL 5qdg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=w66qFD0hyzK3RpBgWyXlYnLnPnXRc9622pppfCmqvbU=; fh=1Bd8vgONiT+C6nsho5mn8/cpmGNbfWiUUy4UCJnl17c=; b=uMl239BKr2UGqFxKtGY80+QbTMRM3KCTOADzkvgONqOoC/KI0HdYMLb/R5vDOAFIkM DgZfC3ryiT8PGtC3OkFWVMHM3lhbU8FmXzQZ4FAdZ+E09w4+vv5TomkjxIBsGku2mo6W gnU4AhN77nIaUc1GQNpNwW6CkWzSQafUFT1PX4iwBdEiCZOaUgZPY6kT/Mpg4sSdcKdk eSs7ZjNkmXyWW/4Si1ybX7QxuCm8rpAuaq1A1UunsRWAWidHJtCw8b15OxgCE4ZhG4Jx R5VpTetffC+faLlrbOSL0qJFSpBNto1rKwliAeTg7mVba2cFb3hDWeb2kcjQoy2f9aaU vMkw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BGuF872W; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-89120-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89120-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f8-20020a170906ef0800b00a381de492a6si1849101ejs.969.2024.03.01.12.56.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 12:56:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89120-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BGuF872W; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-89120-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89120-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8D9BA1F292FC for ; Fri, 1 Mar 2024 20:50:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 177E3537F6; Fri, 1 Mar 2024 20:50:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BGuF872W" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35E434778B; Fri, 1 Mar 2024 20:50:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709326234; cv=none; b=k7ygv6fQQRK2/ts9fj0KuxTiXwXp3N9FQkDiXjJXp+6L+nis78+fcKBlUNdaahlwS3IC678y+pGEV34CGsvXOcIg28GA5BglD4dJWdY0VWBcNjglxFbUrnL2a/f7kEkbKNHcin4UtW2oV5NMIW6dy30Zd+EKNx3OmCJXeN2YqcY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709326234; c=relaxed/simple; bh=xiRQIQKWzL8HL+E4B306OoPqqut4uAJB06QRhmBx0Xg=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=ZlAVUzd7RaGW6xp23lwNsFP1Th/IkApfaGy0e1kAjPg4xp1lDS4ubzZ5BiO91nRU5q9fwcdSPUmOrivVL0YPE9Q1PJuXEJ0r0rQ6/T4+JyMW768CvYZdSmIKGTnUZpu1dc/R2Zd+skYTgyVLwfuo+13ItweX2iVJGH3j4fDwa5k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BGuF872W; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16FF3C43394; Fri, 1 Mar 2024 20:50:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709326233; bh=xiRQIQKWzL8HL+E4B306OoPqqut4uAJB06QRhmBx0Xg=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=BGuF872WTUt6SdMMWkfMzQAWp44BAozagiJDNIoUR+2q+898RRu71HaF4LrquvJEz PLzU8WVLr9s4TeWZeImZmF3J24B+3VuJhAaSGiJ3MvGDd0bhTyWKledaKF3LmJMI6F 4gCOfGNT8p50dhLjIbvp2vu2B3ucnf+qH6OHUm8jImBoodVlqUzpWj/wJ3OfgPGsfY vWt7vonqVCAYwK16iCXQO7C7bUua8QHXqpmEiDYK7RmMua/y/5K7cNv3vyP54JOkoP ZayfIZzJW6zyFUn8IxY8dHqnO0qysliap3XZlUSO0zfka8Ir2qC3VUTKLOQTVTS4Io Yk88IxNNuXIRA== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 01 Mar 2024 22:50:30 +0200 Message-Id: Cc: , , Subject: Re: [PATCH v4 09/12] crypto: ecdsa - Rename keylen to bufsize where necessary From: "Jarkko Sakkinen" To: "Stefan Berger" , , , , X-Mailer: aerc 0.15.2 References: <20240301022007.344948-1-stefanb@linux.ibm.com> <20240301022007.344948-10-stefanb@linux.ibm.com> <90606a3c-1384-407b-8270-dd76dccc700b@linux.ibm.com> In-Reply-To: <90606a3c-1384-407b-8270-dd76dccc700b@linux.ibm.com> On Fri Mar 1, 2024 at 10:47 PM EET, Stefan Berger wrote: > > > On 3/1/24 15:41, Jarkko Sakkinen wrote: > > On Fri Mar 1, 2024 at 4:20 AM EET, Stefan Berger wrote: > >> In some cases the name keylen does not reflect the purpose of the vari= able > >> anymore once NIST P521 is used but it is the size of the buffer. There= - > >> for, rename keylen to bufsize where appropriate. > >> > >> Signed-off-by: Stefan Berger > >> --- > >> crypto/ecdsa.c | 12 ++++++------ > >> 1 file changed, 6 insertions(+), 6 deletions(-) > >> > >> diff --git a/crypto/ecdsa.c b/crypto/ecdsa.c > >> index 4daefb40c37a..4e847b59622a 100644 > >> --- a/crypto/ecdsa.c > >> +++ b/crypto/ecdsa.c > >> @@ -35,8 +35,8 @@ struct ecdsa_signature_ctx { > >> static int ecdsa_get_signature_rs(u64 *dest, size_t hdrlen, unsigned= char tag, > >> const void *value, size_t vlen, unsigned int ndigits) > >> { > >> - size_t keylen =3D ndigits * sizeof(u64); > >> - ssize_t diff =3D vlen - keylen; > >> + size_t bufsize =3D ndigits * sizeof(u64); > >=20 > > why not just "* 8"? using sizeof here makes this function only unreadab= le. > > 'unreadable' is a 'strong' word ... so what is the gain when writing sizeof(u64)? BR, Jarkko