Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp617938lqp; Thu, 21 Mar 2024 10:19:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVRwcfLdN92lizcAZbxExa5SqXd16ifBu3vWhVsot3g5vYaO+wOS9GkTKIn3iWDttkDF19+cludOXIQ9514Ne5NJs06yPxxSTflMx8UxA== X-Google-Smtp-Source: AGHT+IHQsvK9uhKb0PdsyX0kKXdz59WcI2EspV/q3IDXQkX+169d77a6tjtC33B5Yyf09VFSihpE X-Received: by 2002:a05:622a:4cf:b0:431:1e1a:7c93 with SMTP id q15-20020a05622a04cf00b004311e1a7c93mr2638359qtx.68.1711041569336; Thu, 21 Mar 2024 10:19:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711041569; cv=pass; d=google.com; s=arc-20160816; b=EPuPG4eBnHmUBmMrayE9TucWPzTeIlLoeMFjrINuVw7ncO0KHS6Sr82D0Ov5oC65YV uy9wFMPjQbludTKRRaVNGUqbOb4n6Z+mqfBe/dBz+xNevkkUvwhxJmTSkP0K5QaLWIex ZhVW7Oh2/ijYqmiqjzG5lFl06AVpNGask5MuLOKrX33jCrMZL4JP6sYcLZop/RlOunof RPrLW1K4lXPWxIDyVIiQq8M388ktQ1LgOH7hzqJIbXSbccUHKt/ugUEFzYG1SiAfcoai vGQ4eoApaR2NUaMWdHhvDdEHT34AFE8w/1tbfJrjYiSXkX0831JF05nxcR+bLkicV8Li dq5g== 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=I1Qn9/O11mj53M/bzXEoR+Rn64nz2JlMhADnkKlzBUI=; fh=nR2nS9yvo8rBLcqBTWdVdTZMSYf1MQu9UGN1RA8/poQ=; b=L0UE6LAYziokR6I1wVYMMSuZXkfgvcjeuQAAU8yJbo7XpZc2MmeuZqE8N2qE24FBFA hzELJFbGuC+kOd+LjdkrsPeeEIFURZy4tsKIInikxrdtPPtwdmkWtMvjTpd9NHDS8L32 TIGXcxTWj+byFuq2hrGkES8jLz8Ef74TLNZCoMlum9S88ImsqchP73dmDf0H8Mjpexdt Lb3fj5iLH59SMvTcuQLRX0cyiXZhY2SmNv2mtTJMb5vh+4YNgOEz3vVRAnEsVD/lJ6U8 GYgaFxX8NfrUZbUrhBEXS3SeR5R0UoSDkzVQjOWlreeIIDXaGrO6E3KfnBGrqAfhgF3Y L54A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IOv9vGLj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-2811-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2811-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id o13-20020a05622a044d00b0042edf0fdcfbsi143488qtx.362.2024.03.21.10.19.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 10:19:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-2811-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IOv9vGLj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-2811-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2811-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id DD4721C218EF for ; Thu, 21 Mar 2024 17:19:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 07B431EA95; Thu, 21 Mar 2024 17:19:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IOv9vGLj" X-Original-To: linux-crypto@vger.kernel.org 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 B07CB79E0; Thu, 21 Mar 2024 17:19:23 +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=1711041563; cv=none; b=MfrdG3sYGnQ889QkONiuwD79wwt3pl/OhZwgQ2EgzgjEmKu5l1cupXlm3752IXfrDzwdvI2JmU7KKy3jonBgZyx4sVbhZ0JKfHUW4/Fr3pzKTo/gDM97IhE7XN/s/ulV5hcDwixIP4ycuNDvIeBljmd3tQbcWnvB+XRDXlF74VI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711041563; c=relaxed/simple; bh=e9QuUBFXFc8Wyy/GNM5FNS29OFCC+SFfSjmFYLP2fno=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=ja+ftCZrqcwycM5LI5yz+PyZw+CtorD0Ilqv+OV35zycWK45sHB2zCeoTyVS2Dq/Mbs4KL0hQaBAJKO42Hbqso6fiBYPxVeBeUKHJxWUjPBdkLdJuC3U6VrdYQP5o1R4v81h9EDyKrZ37k6A0kdgwmfh2ab2JC0t6O9Sno3XUIo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IOv9vGLj; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB0F0C433F1; Thu, 21 Mar 2024 17:19:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711041563; bh=e9QuUBFXFc8Wyy/GNM5FNS29OFCC+SFfSjmFYLP2fno=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=IOv9vGLjMeR3MvY8Vzj+ClFKnODJDn5UeWSa1KBet3xlZjuno6nHcjjUrFh+H8zWw 7u6RXZoZ+WaoPGhIYpJYvEoEQSY4Dqcl3uvX/0a1VC2kLcnx0cWPOeF5VzGhMQuURC Iu0RzdP3Sm1PdLJblarYt01eS7GoyZ4LZVcdT6yXvN1W7pXO369OvKhr8uE5TmnyEX //fMstz3YdK1LddLowxS7HyuVQHwn8gLc+BGpHoJUnt9pF0hORKJDaYG/B1Bz2CmKW zsNb8ybdYzk3SyOXmMzw705og+oDk7mJNpJvNAttV3T9WZuVnrl0oRd2YIb9HyO+jb 9s3Z7Vi5Uvwqw== Precedence: bulk X-Mailing-List: linux-crypto@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: Thu, 21 Mar 2024 19:19:20 +0200 Message-Id: Cc: , , , Subject: Re: [PATCH v7 09/13] crypto: ecdsa - Replace ndigits with nbits where precision is needed From: "Jarkko Sakkinen" To: "Stefan Berger" , , , , X-Mailer: aerc 0.17.0 References: <20240320114725.1644921-1-stefanb@linux.ibm.com> <20240320114725.1644921-10-stefanb@linux.ibm.com> In-Reply-To: <20240320114725.1644921-10-stefanb@linux.ibm.com> On Wed Mar 20, 2024 at 1:47 PM EET, Stefan Berger wrote: > Replace the usage of ndigits with nbits where precise space calculations > are needed, such as in ecdsa_max_size where the length of a coordinate is > determined. > > Signed-off-by: Stefan Berger > Tested-by: Lukas Wunner > --- > crypto/ecdsa.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/crypto/ecdsa.c b/crypto/ecdsa.c > index 1814f009f971..4daefb40c37a 100644 > --- a/crypto/ecdsa.c > +++ b/crypto/ecdsa.c > @@ -266,7 +266,7 @@ static unsigned int ecdsa_max_size(struct crypto_akci= pher *tfm) > { > struct ecc_ctx *ctx =3D akcipher_tfm_ctx(tfm); > =20 > - return ctx->pub_key.ndigits << ECC_DIGITS_TO_BYTES_SHIFT; > + return DIV_ROUND_UP(ctx->curve->nbits, 8); > } > =20 > static int ecdsa_nist_p384_init_tfm(struct crypto_akcipher *tfm) Reviewed-by: Jarkko Sakkinen BR, Jarkko