]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
crypto: atmel-ecc - drop dead code in atmel_ecdh_max_size
authorThorsten Blum <thorsten.blum@linux.dev>
Tue, 2 Jun 2026 22:25:19 +0000 (00:25 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 12 Jun 2026 01:56:45 +0000 (09:56 +0800)
atmel_ecdh_init_tfm() always allocates ctx->fallback, so it is never
NULL in atmel_ecdh_max_size(). Remove the dead code and return
crypto_kpp_maxsize() directly.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/atmel-ecc.c

index 0ca02995a1de40582c86878193faeb35e4abc5e2..9da9dd6585dfc6ec978d0664972f750eb2ce89f5 100644 (file)
@@ -284,15 +284,7 @@ static unsigned int atmel_ecdh_max_size(struct crypto_kpp *tfm)
 {
        struct atmel_ecdh_ctx *ctx = kpp_tfm_ctx(tfm);
 
-       if (ctx->fallback)
-               return crypto_kpp_maxsize(ctx->fallback);
-
-       /*
-        * The device only supports NIST P256 ECC keys. The public key size will
-        * always be the same. Use a macro for the key size to avoid unnecessary
-        * computations.
-        */
-       return ATMEL_ECC_PUBKEY_SIZE;
+       return crypto_kpp_maxsize(ctx->fallback);
 }
 
 static struct kpp_alg atmel_ecdh_nist_p256 = {