[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240612151900.895156-1-stefanb@linux.ibm.com>
Date: Wed, 12 Jun 2024 11:18:57 -0400
From: Stefan Berger <stefanb@...ux.ibm.com>
To: 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, ardb@...nel.org,
Stefan Berger <stefanb@...ux.ibm.com>
Subject: [RFC PATCH 0/3] Introduce ecc_digits_to_bytes and clean up ecdh.c
This series introduces ecc_digits_to_bytes to convert an array of digits
to bytes and uses this function and ecc_digits_from_bytes in ecdh-related
code to convert between byte arrays and digits. Using these functions is
generally better than using ecc_swap_digits. The latter cannot be used with
curves like NIST P521 since it does not properly handle curves that do not
use all bytes in the most significant digit.
It also introduces ecc_curve_get_nbytes to get the number of bytes (nbytes)
a curve needs for its coordinates. It derives this number from the nbits
parameter of a curve. Using this function is also generally better than
deriving nbytes from ndigits, which does not work correctly vor NIST P521.
None of the converted functions have been used with NIST P521 but only
with NIST P192/256/384 so far, so they work fine as they are.
Due to concerns related to constant time operations when signing with EC
private keys I am not planning to add NIST P521 support to ecdh, so the
changes in this series are primarly 'code improvements' (-> RFC).
Stefan
Stefan Berger (3):
crypto: ecc - Implement ecc_digits_to_bytes to convert digits to byte
array
crypto: ecc - Implement and use ecc_curve_get_nbytes to get curve's
nbytes
crypto: ecdh - Use functions to copy digits from and to byte arrays
crypto/ecc.c | 47 ++++++++++++++++++++++++-----------
crypto/ecdh.c | 24 +++++++++++-------
include/crypto/internal/ecc.h | 37 ++++++++++++++++++++++-----
3 files changed, 79 insertions(+), 29 deletions(-)
--
2.43.0
Powered by blists - more mailing lists