crypto: ecrdsa - Fix signature size calculation

JIRA: https://redhat.atlassian.net/browse/RHEL-186630

commit b9cbf6916e0a6899bc67ee574993b7f24d3f606b
Author: Lukas Wunner <lukas@wunner.de>
Date:   Tue Sep 10 16:30:29 2024 +0200

    crypto: ecrdsa - Fix signature size calculation

    software_key_query() returns the curve size as maximum signature size
    for ecrdsa.  However it should return twice as much.

    It's only the maximum signature size that seems to be off.  The maximum
    digest size is likewise set to the curve size, but that's correct as it
    matches the checks in ecrdsa_set_pub_key() and ecrdsa_verify().

    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Thomas Huth
2026-06-30 16:01:00 +02:00
parent 55c7f91c8e
commit 57e37ff9e7
+8
View File
@@ -252,6 +252,13 @@ static unsigned int ecrdsa_key_size(struct crypto_sig *tfm)
return ctx->pub_key.ndigits * sizeof(u64);
}
static unsigned int ecrdsa_max_size(struct crypto_sig *tfm)
{
struct ecrdsa_ctx *ctx = crypto_sig_ctx(tfm);
return 2 * ctx->pub_key.ndigits * sizeof(u64);
}
static void ecrdsa_exit_tfm(struct crypto_sig *tfm)
{
}
@@ -260,6 +267,7 @@ static struct sig_alg ecrdsa_alg = {
.verify = ecrdsa_verify,
.set_pub_key = ecrdsa_set_pub_key,
.key_size = ecrdsa_key_size,
.max_size = ecrdsa_max_size,
.exit = ecrdsa_exit_tfm,
.base = {
.cra_name = "ecrdsa",