crypto: ecc - update ecc_gen_privkey for FIPS 186-5
authorJoachim Vandersmissen <git@jvdsn.com>
Wed, 20 Mar 2024 05:13:38 +0000 (00:13 -0500)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 2 Apr 2024 02:49:38 +0000 (10:49 +0800)
commitdbad7b6969c10b746a3d8b53c6cf6b4ec62ae5e1
tree2c906e746ebad37c247d0f12c588d8763ea5d1c0
parenteb5739a1efbc9ff216271aeea0ebe1c92e5383e5
crypto: ecc - update ecc_gen_privkey for FIPS 186-5

FIPS 186-5 [1] was released approximately 1 year ago. The most
interesting change for ecc_gen_privkey is the removal of curves with
order < 224 bits. This is minimum is now checked in step 1. It is
unlikely that there is still any benefit in generating private keys for
curves with n < 224, as those curves provide less than 112 bits of
security strength and are therefore unsafe for any modern usage.

This patch also updates the documentation for __ecc_is_key_valid and
ecc_gen_privkey to clarify which FIPS 186-5 method is being used to
generate private keys. Previous documentation mentioned that "extra
random bits" was used. However, this did not match the code. Instead,
the code currently uses (and always has used) the "rejection sampling"
("testing candidates" in FIPS 186-4) method.

[1]: https://doi.org/10.6028/NIST.FIPS.186-5

Signed-off-by: Joachim Vandersmissen <git@jvdsn.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/ecc.c