[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <CZX6K8KC480D.12UJ5ZTZZU55K@kernel.org>
Date: Mon, 18 Mar 2024 23:06:22 +0200
From: "Jarkko Sakkinen" <jarkko@...nel.org>
To: "Stefan Berger" <stefanb@...ux.vnet.ibm.com>,
<keyrings@...r.kernel.org>, <linux-crypto@...r.kernel.org>,
<herbert@...dor.apana.org.au>, <davem@...emloft.net>
Cc: <linux-kernel@...r.kernel.org>, <saulo.alessandre@....jus.br>,
<lukas@...ner.de>, <bbhushan2@...vell.com>, "Stefan Berger"
<stefanb@...ux.ibm.com>
Subject: Re: [PATCH v6 09/13] crypto: ecdsa - Replace ndigits with nbits
where precision is needed
On Tue Mar 12, 2024 at 8:36 PM EET, Stefan Berger wrote:
> From: Stefan Berger <stefanb@...ux.ibm.com>
>
> Replace the usage of ndigits with nbits where more precise space
> calculations are needed, such as in ecdsa_max_size where the length of a
> coordinate is determined.
What does "more precise" mean?
>
> Signed-off-by: Stefan Berger <stefanb@...ux.ibm.com>
> Tested-by: Lukas Wunner <lukas@...ner.de>
> ---
> 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_akcipher *tfm)
> {
> struct ecc_ctx *ctx = akcipher_tfm_ctx(tfm);
>
> - return ctx->pub_key.ndigits << ECC_DIGITS_TO_BYTES_SHIFT;
> + return DIV_ROUND_UP(ctx->curve->nbits, 8);
> }
>
> static int ecdsa_nist_p384_init_tfm(struct crypto_akcipher *tfm)
BR, Jarkko
Powered by blists - more mailing lists