VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   55 Tags
author: Herbert Xu <herbert@gondor.apana.org.au> 2020-08-18 18:25:34 +1000 committer: Herbert Xu <herbert@gondor.apana.org.au> 2020-08-28 16:58:28 +1000 commit: e73d340db6448013ac219d105654d2b9868a8dd2 parent: 6779d0e6b0fe193ab3010ea201782ca6f75a3862
Commit Summary:
crypto: ahash - Add init_tfm/exit_tfm
Diffstat:
1 file changed, 10 insertions, 1 deletion
diff --git a/crypto/ahash.c b/crypto/ahash.c
index d84ad925dfc9..c2ca631a111f 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -444,6 +444,14 @@ static int ahash_def_finup(struct ahash_request *req)
 	return ahash_def_finup_finish1(req, err);
 }
 
+static void crypto_ahash_exit_tfm(struct crypto_tfm *tfm)
+{
+	struct crypto_ahash *hash = __crypto_ahash_cast(tfm);
+	struct ahash_alg *alg = crypto_ahash_alg(hash);
+
+	alg->exit_tfm(hash);
+}
+
 static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
 {
 	struct crypto_ahash *hash = __crypto_ahash_cast(tfm);
@@ -467,7 +475,10 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
 		ahash_set_needkey(hash);
 	}
 
-	return 0;
+	if (alg->exit_tfm)
+		tfm->exit = crypto_ahash_exit_tfm;
+
+	return alg->init_tfm ? alg->init_tfm(hash) : 0;
 }
 
 static unsigned int crypto_ahash_extsize(struct crypto_alg *alg)