summaryrefslogtreecommitdiff
path: root/crypto/algapi.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2016-01-23 13:51:01 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2018-06-28 14:24:29 -0700
commit4cbda579cd3d67e4f2097bd790ffcd28eef40c7b (patch)
tree999aec9e3b9ad661f7b79a3327c66b9348d2e0bd /crypto/algapi.c
parentb24dcaae875314079dd4fe65ce231fd9b0bf58be (diff)
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 59bf491fe3d8..c63f06a8b76a 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -988,6 +988,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();