crypto: ecdsa - Convert byte arrays with key coordinates to digits
authorStefan Berger <stefanb@linux.ibm.com>
Thu, 4 Apr 2024 14:18:45 +0000 (10:18 -0400)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 12 Apr 2024 07:07:51 +0000 (15:07 +0800)
commitd67c96fb97b5811e15c881d5cb72e293faa5f8e1
tree4ad18dc03d5e111c8e8baf10d6d86347fa0235db
parent526d23fc2dd03a749297f5ef5edcbfb8c492dcfd
crypto: ecdsa - Convert byte arrays with key coordinates to digits

For NIST P192/256/384 the public key's x and y parameters could be copied
directly from a given array since both parameters filled 'ndigits' of
digits (a 'digit' is a u64). For support of NIST P521 the key parameters
need to have leading zeros prepended to the most significant digit since
only 2 bytes of the most significant digit are provided.

Therefore, implement ecc_digits_from_bytes to convert a byte array into an
array of digits and use this function in ecdsa_set_pub_key where an input
byte array needs to be converted into digits.

Suggested-by: Lukas Wunner <lukas@wunner.de>
Tested-by: Lukas Wunner <lukas@wunner.de>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/ecdsa.c
include/crypto/internal/ecc.h