summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.ibm.com>2024-04-04 10:18:52 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2024-04-12 15:07:52 +0800
commit7dce726ea85ed82d6e70840e3ac68fa13225a3ff (patch)
tree7faac57e924d5ec33f36a48d18426a1a865b41ac
parentbf6dee7b3ce35bb8f1002a1833f42057e0983052 (diff)
downloadlinux-crypto-7dce726ea85ed82d6e70840e3ac68fa13225a3ff.tar.gz
linux-crypto-7dce726ea85ed82d6e70840e3ac68fa13225a3ff.zip
crypto: ecdsa - Replace ndigits with nbits where precision is needed
Replace the usage of ndigits with nbits where precise space calculations are needed, such as in ecdsa_max_size where the length of a coordinate is determined. 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>
-rw-r--r--crypto/ecdsa.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/ecdsa.c b/crypto/ecdsa.c
index 9b84ab50..75d3eea8 100644
--- a/crypto/ecdsa.c
+++ b/crypto/ecdsa.c
@@ -266,7 +266,7 @@ static unsigned int ecdsa_max_size(struct crypto_akcipher *tfm)
{
struct ecc_ctx *ctx = akcipher_tfm_ctx(tfm);
- return ctx->pub_key.ndigits << ECC_DIGITS_TO_BYTES_SHIFT;
+ return DIV_ROUND_UP(ctx->curve->nbits, 8);
}
static int ecdsa_nist_p384_init_tfm(struct crypto_akcipher *tfm)