From: Lars Persson <lars.persson@axis.com>
To: herbert@gondor.apana.org.au, davem@davemloft.net,
robh+dt@kernel.org, mark.rutland@arm.com,
linux-crypto@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Rabin Vincent <rabinv@axis.com>, Lars Persson <larper@axis.com>
Subject: [PATCH v2 2/4] crypto: add crypto_(un)register_ahashes()
Date: Mon, 24 Jul 2017 09:07:30 +0200 [thread overview]
Message-ID: <5244eea458d4e85d69bc9e44d33873f2cdd086ca.1500879613.git.larper@axis.com> (raw)
In-Reply-To: <cover.1500879613.git.larper@axis.com>
In-Reply-To: <cover.1500879613.git.larper@axis.com>
From: Rabin Vincent <rabinv@axis.com>
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>
---
crypto/ahash.c | 29 +++++++++++++++++++++++++++++
include/crypto/internal/hash.h | 2 ++
2 files changed, 31 insertions(+)
diff --git a/crypto/ahash.c b/crypto/ahash.c
index 826cd7ab4d4a..5e8666e6ccae 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)
{
diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h
index f6d9af3efa45..f0b44c16e88f 100644
--- a/include/crypto/internal/hash.h
+++ b/include/crypto/internal/hash.h
@@ -76,6 +76,8 @@ static inline int crypto_ahash_walk_last(struct crypto_hash_walk *walk)
int crypto_register_ahash(struct ahash_alg *alg);
int crypto_unregister_ahash(struct ahash_alg *alg);
+int crypto_register_ahashes(struct ahash_alg *algs, int count);
+void crypto_unregister_ahashes(struct ahash_alg *algs, int count);
int ahash_register_instance(struct crypto_template *tmpl,
struct ahash_instance *inst);
void ahash_free_instance(struct crypto_instance *inst);
--
2.11.0
next prev parent reply other threads:[~2017-07-24 7:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-24 7:07 [PATCH v2 0/4] crypto: add driver for Axis ARTPEC crypto accelerator Lars Persson
2017-07-24 7:07 ` [PATCH v2 1/4] dt-bindings: crypto: add ARTPEC crypto Lars Persson
2017-08-03 16:47 ` Rob Herring
2017-07-24 7:07 ` Lars Persson [this message]
2017-08-03 6:26 ` [PATCH v2 2/4] crypto: add crypto_(un)register_ahashes() Herbert Xu
2017-07-24 7:07 ` [PATCH v2 3/4] crypto: axis: add ARTPEC-6/7 crypto accelerator driver Lars Persson
2017-08-03 6:26 ` Herbert Xu
2017-07-24 7:07 ` [PATCH v2 4/4] MAINTAINERS: Add ARTPEC crypto maintainer Lars Persson
2017-08-03 6:26 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5244eea458d4e85d69bc9e44d33873f2cdd086ca.1500879613.git.larper@axis.com \
--to=lars.persson@axis.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=larper@axis.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=rabinv@axis.com \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome