summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRabin Vincent <rabinv@axis.com>2017-08-10 14:53:52 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2017-08-22 14:54:52 +0800
commit1bb32d90974ab4f5f20d6a636cef18a3bc2c97f1 (patch)
treede733a1efcfa584d39d069a85e2a200d952e71da
parent33463ce004e82a1acac0b8cffd5c7f1d247cebdd (diff)
downloadlinux-crypto-1bb32d90974ab4f5f20d6a636cef18a3bc2c97f1.tar.gz
linux-crypto-1bb32d90974ab4f5f20d6a636cef18a3bc2c97f1.zip
crypto: hash - add crypto_(un)register_ahashes()
There are already helpers to (un)register multiple normal and AEAD algos. Add one for ahashes too. Signed-off-by: Lars Persson <larper@axis.com> Signed-off-by: Rabin Vincent <rabinv@axis.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--crypto/ahash.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/crypto/ahash.c b/crypto/ahash.c
index 826cd7ab..5e8666e6 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -588,6 +588,35 @@ int crypto_unregister_ahash(struct ahash_alg *alg)
}
EXPORT_SYMBOL_GPL(crypto_unregister_ahash);
+int crypto_register_ahashes(struct ahash_alg *algs, int count)
+{
+ int i, ret;
+
+ for (i = 0; i < count; i++) {
+ ret = crypto_register_ahash(&algs[i]);
+ if (ret)
+ goto err;
+ }
+
+ return 0;
+
+err:
+ for (--i; i >= 0; --i)
+ crypto_unregister_ahash(&algs[i]);
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(crypto_register_ahashes);
+
+void crypto_unregister_ahashes(struct ahash_alg *algs, int count)
+{
+ int i;
+
+ for (i = count - 1; i >= 0; --i)
+ crypto_unregister_ahash(&algs[i]);
+}
+EXPORT_SYMBOL_GPL(crypto_unregister_ahashes);
+
int ahash_register_instance(struct crypto_template *tmpl,
struct ahash_instance *inst)
{