Skip to content

Commit

Permalink
crypto: caam - create ahash shared descriptors only once
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Iuliana Prodan authored and Herbert Xu committed Jan 11, 2019
1 parent 0f103b3 commit 9a2537d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/crypto/caam/caamhash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9a2537d

Please sign in to comment.