[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZGc0UdrY9Suaxdjq@gondor.apana.org.au>
Date: Fri, 19 May 2023 16:33:21 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: yangmengfei1394@...tium.com.cn
Cc: davem@...emloft.net, linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org, yangmengfei1394@...tium.com.cn
Subject: Re: [PATCH] Crypto: Fix one bug when use kernel ecdsa algorithm
yangmengfei1394@...tium.com.cn wrote:
>
> diff --git a/include/crypto/akcipher.h b/include/crypto/akcipher.h
> index f35fd653e4e5..a68f0e23bf89 100644
> --- a/include/crypto/akcipher.h
> +++ b/include/crypto/akcipher.h
> @@ -459,7 +459,9 @@ static inline int crypto_akcipher_set_priv_key(struct crypto_akcipher *tfm,
> unsigned int keylen)
> {
> struct akcipher_alg *alg = crypto_akcipher_alg(tfm);
> -
> - return alg->set_priv_key(tfm, key, keylen);
> + if (likely(alg->set_priv_key != NULL))
> + return alg->set_priv_key(tfm, key, keylen);
> + else
> + return -EPERM;
> }
> #endif
Instead of doing this, we should move the code that sets the
default functions from crypto_register_akcipher into
akcipher_prepare_alg.
Thanks,
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists