]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
crypto: caam - create ahash shared descriptors only once
authorIuliana Prodan <Iuliana.Prodan@nxp.com>
Fri, 21 Dec 2018 15:59:09 +0000 (17:59 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 11 Jan 2019 06:16:56 +0000 (14:16 +0800)
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>
drivers/crypto/caam/caamhash.c

index 17e86e4a6428baa4c119cf8d9dc69c3305e0253e..4b88af5bea26ee360b1d0a8ab731d53d3a4f26f2 100644 (file)
@@ -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)