Skip to content

Commit b7ec41d

Browse files
horiagherbertx
authored andcommitted
crypto: caam/qi2 - 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(). This is similar to the change in caamhash (caam/jr top-level library) commit 9a2537d ("crypto: caam - create ahash shared descriptors only once") Signed-off-by: Horia Geantă <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent d9f2d01 commit b7ec41d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/crypto/caam/caamalg_qi2.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4500,7 +4500,11 @@ static int caam_hash_cra_init(struct crypto_tfm *tfm)
45004500
crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
45014501
sizeof(struct caam_hash_state));
45024502

4503-
return ahash_set_sh_desc(ahash);
4503+
/*
4504+
* For keyed hash algorithms shared descriptors
4505+
* will be created later in setkey() callback
4506+
*/
4507+
return alg->setkey ? 0 : ahash_set_sh_desc(ahash);
45044508
}
45054509

45064510
static void caam_hash_cra_exit(struct crypto_tfm *tfm)

0 commit comments

Comments
 (0)