RFC Introduce ecc_digits_to_bytes and clean up ecdh.c
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest3 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | crypto: ecc - Implement ecc_digits_to_bytes to convert digits to byte arraycrypto/ include/ | +35 | 0 replies | |
| 2/3 | crypto: ecc - Implement and use ecc_curve_get_nbytes to get curve's nbytescrypto/ crypto/ include/ | +20 | 0 replies | |
| 3/3 | crypto: ecdh - Use functions to copy digits from and to byte arrayscrypto/ crypto/ include/ | +24 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [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(-)
Signature · 1 line
2.43.0