lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <CZX5C52SJOU6.1NX669PI73TRJ@kernel.org>
Date: Mon, 18 Mar 2024 22:08:47 +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 01/13] crypto: ecc - Use
 ECC_CURVE_NIST_P192/256/384_DIGITS where possible

On Tue Mar 12, 2024 at 8:36 PM EET, Stefan Berger wrote:
> From: Stefan Berger <stefanb@...ux.ibm.com>
>
> Replace hard-coded numbers with ECC_CURVE_NIST_P192/256/384_DIGITS where
> possible.
>
> Signed-off-by: Stefan Berger <stefanb@...ux.ibm.com>
> ---
>  crypto/ecc.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/crypto/ecc.c b/crypto/ecc.c
> index f53fb4d6af99..415a2f4e7291 100644
> --- a/crypto/ecc.c
> +++ b/crypto/ecc.c
> @@ -689,7 +689,7 @@ static void vli_mmod_barrett(u64 *result, u64 *product, const u64 *mod,
>  static void vli_mmod_fast_192(u64 *result, const u64 *product,
>  			      const u64 *curve_prime, u64 *tmp)
>  {
> -	const unsigned int ndigits = 3;
> +	const unsigned int ndigits = ECC_CURVE_NIST_P192_DIGITS;
>  	int carry;
>  
>  	vli_set(result, product, ndigits);
> @@ -717,7 +717,7 @@ static void vli_mmod_fast_256(u64 *result, const u64 *product,
>  			      const u64 *curve_prime, u64 *tmp)
>  {
>  	int carry;
> -	const unsigned int ndigits = 4;
> +	const unsigned int ndigits = ECC_CURVE_NIST_P256_DIGITS;
>  
>  	/* t */
>  	vli_set(result, product, ndigits);
> @@ -800,7 +800,7 @@ static void vli_mmod_fast_384(u64 *result, const u64 *product,
>  				const u64 *curve_prime, u64 *tmp)
>  {
>  	int carry;
> -	const unsigned int ndigits = 6;
> +	const unsigned int ndigits = ECC_CURVE_NIST_P384_DIGITS;
>  
>  	/* t */
>  	vli_set(result, product, ndigits);
> @@ -932,13 +932,13 @@ static bool vli_mmod_fast(u64 *result, u64 *product,
>  	}
>  
>  	switch (ndigits) {
> -	case 3:
> +	case ECC_CURVE_NIST_P192_DIGITS:
>  		vli_mmod_fast_192(result, product, curve_prime, tmp);
>  		break;
> -	case 4:
> +	case ECC_CURVE_NIST_P256_DIGITS:
>  		vli_mmod_fast_256(result, product, curve_prime, tmp);
>  		break;
> -	case 6:
> +	case ECC_CURVE_NIST_P384_DIGITS:
>  		vli_mmod_fast_384(result, product, curve_prime, tmp);
>  		break;
>  	default:

Reviewed-by: Jarkko Sakkinen <jarkko@...nel.org>

BR, Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ