aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/algapi.c
diff options
context:
space:
mode:
authorLukas Wunner <lukas@wunner.de>2025-04-07 21:32:42 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2025-04-16 15:16:21 +0800
commit6b7f9397c98c72902f9364056413c73fe6dee1d8 (patch)
treef2b0c7b7989bb46cec0a8f242a3b7b8ba0ba8d3e /crypto/algapi.c
parentcrypto: ecdsa - Fix enc/dec size reported by KEYCTL_PKEY_QUERY (diff)
downloadlinux-6b7f9397c98c72902f9364056413c73fe6dee1d8.tar.gz
linux-6b7f9397c98c72902f9364056413c73fe6dee1d8.zip
crypto: ecdsa - Fix NIST P521 key size reported by KEYCTL_PKEY_QUERY
When user space issues a KEYCTL_PKEY_QUERY system call for a NIST P521 key, the key_size is incorrectly reported as 528 bits instead of 521. That's because the key size obtained through crypto_sig_keysize() is in bytes and software_key_query() multiplies by 8 to yield the size in bits. The underlying assumption is that the key size is always a multiple of 8. With the recent addition of NIST P521, that's no longer the case. Fix by returning the key_size in bits from crypto_sig_keysize() and adjusting the calculations in software_key_query(). The ->key_size() callbacks of sig_alg algorithms now return the size in bits, whereas the ->digest_size() and ->max_size() callbacks return the size in bytes. This matches with the units in struct keyctl_pkey_query. Fixes: a7d45ba77d3d ("crypto: ecdsa - Register NIST P521 and extend test suite") Signed-off-by: Lukas Wunner <lukas@wunner.de> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Reviewed-by: Ignat Korchagin <ignat@cloudflare.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/algapi.c')
0 files changed, 0 insertions, 0 deletions