From: Iuliana Prodan Date: Fri, 21 Dec 2018 15:59:09 +0000 (+0200) Subject: crypto: caam - create ahash shared descriptors only once X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=9a2537d0ebc984bab4f3ff5012dacf42b0ac70a2;p=openwrt%2Fstaging%2Fblogic.git crypto: caam - create ahash shared descriptors only once For keyed hash algorithms, shared descriptors are currently generated twice: -at tfm initialization time, in cra_init() callback -in setkey() callback Since it's mandatory to call setkey() for keyed algorithms, drop the generation in cra_init(). Signed-off-by: Iuliana Prodan Signed-off-by: Horia Geantă Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c index 17e86e4a6428..4b88af5bea26 100644 --- a/drivers/crypto/caam/caamhash.c +++ b/drivers/crypto/caam/caamhash.c @@ -1725,7 +1725,12 @@ static int caam_hash_cra_init(struct crypto_tfm *tfm) crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm), sizeof(struct caam_hash_state)); - return ahash_set_sh_desc(ahash); + + /* + * For keyed hash algorithms shared descriptors + * will be created later in setkey() callback + */ + return alg->setkey ? 0 : ahash_set_sh_desc(ahash); } static void caam_hash_cra_exit(struct crypto_tfm *tfm)