summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/caam/caamhash.c
diff options
context:
space:
mode:
authorIuliana Prodan <Iuliana.Prodan@nxp.com>2018-12-21 17:59:09 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2019-01-11 14:16:56 +0800
commit9a2537d0ebc984bab4f3ff5012dacf42b0ac70a2 (patch)
treeb2c9c57a491b64b7a67da796b002b0d13df01d61 /drivers/crypto/caam/caamhash.c
parent0f103b37282f48e2221aca955985550b7eabc98b (diff)
downloadlinux-9a2537d0ebc984bab4f3ff5012dacf42b0ac70a2.tar.bz2
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>
Diffstat (limited to 'drivers/crypto/caam/caamhash.c')
-rw-r--r--drivers/crypto/caam/caamhash.c7
1 files changed, 6 insertions, 1 deletions
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)