summaryrefslogtreecommitdiffstats
path: root/crypto/algapi.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2016-01-23 06:51:01 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2016-01-25 15:42:12 +0100
commitf2aefdab5dff83d3c801449051be1ba72c7e933a (patch)
tree167102bb66295086a223e47d4d4fc7a6ad3de3eb /crypto/algapi.c
parentcrypto: skcipher - Add helper to zero stack request (diff)
downloadlinux-f2aefdab5dff83d3c801449051be1ba72c7e933a.tar.xz
linux-f2aefdab5dff83d3c801449051be1ba72c7e933a.zip
crypto: api - Add crypto_type_has_alg helper
This patch adds the helper crypto_type_has_alg which is meant to replace crypto_has_alg for new-style crypto types. Rather than hard-coding type/mask information they're now retrieved from the crypto_type object. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/algapi.c')
-rw-r--r--crypto/algapi.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c
index 7be76aa31579..731255a6104f 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -987,6 +987,21 @@ unsigned int crypto_alg_extsize(struct crypto_alg *alg)
}
EXPORT_SYMBOL_GPL(crypto_alg_extsize);
+int crypto_type_has_alg(const char *name, const struct crypto_type *frontend,
+ u32 type, u32 mask)
+{
+ int ret = 0;
+ struct crypto_alg *alg = crypto_find_alg(name, frontend, type, mask);
+
+ if (!IS_ERR(alg)) {
+ crypto_mod_put(alg);
+ ret = 1;
+ }
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(crypto_type_has_alg);
+
static int __init crypto_algapi_init(void)
{
crypto_init_proc();