Skip to content

Commit 9a2537d

Browse files
iuliana-prodanherbertx
authored andcommitted
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 <iuliana.prodan@nxp.com> Signed-off-by: Horia Geantă <horia.geanta@nxp.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 0f103b3 commit 9a2537d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/crypto/caam/caamhash.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,12 @@ static int caam_hash_cra_init(struct crypto_tfm *tfm)
17251725

17261726
crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
17271727
sizeof(struct caam_hash_state));
1728-
return ahash_set_sh_desc(ahash);
1728+
1729+
/*
1730+
* For keyed hash algorithms shared descriptors
1731+
* will be created later in setkey() callback
1732+
*/
1733+
return alg->setkey ? 0 : ahash_set_sh_desc(ahash);
17291734
}
17301735

17311736
static void caam_hash_cra_exit(struct crypto_tfm *tfm)

0 commit comments

Comments
 (0)