summaryrefslogtreecommitdiff
path: root/crypto/algapi.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2006-09-21 11:35:17 +1000
committerHerbert Xu <herbert@gondor.apana.org.au>2006-09-21 11:35:17 +1000
commit94f5ac23199d14d3b2cf56c1a0bd2891f1ac5f2d (patch)
tree8028f552e45a3f519f5e022a86c43d7d27a02a8d /crypto/algapi.c
parent0d0f3a296d9eb5ed0c5276573880aab3cb4c3f64 (diff)
downloadlinux-crypto-94f5ac23199d14d3b2cf56c1a0bd2891f1ac5f2d.tar.gz
linux-crypto-94f5ac23199d14d3b2cf56c1a0bd2891f1ac5f2d.zip
[CRYPTO] api: Allow algorithm lookup by type
This patch also adds the infrastructure to pick an algorithm based on their type. For example, this allows you to select the encryption algorithm "aes", instead of any algorithm registered under the name "aes". For now this is only accessible internally. Eventually it will be made available through crypto_alloc_tfm. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'crypto/algapi.c')
-rw-r--r--crypto/algapi.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c
index f0df85fc..acea2506 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -21,12 +21,12 @@
static LIST_HEAD(crypto_template_list);
-void crypto_larval_error(const char *name)
+void crypto_larval_error(const char *name, u32 type, u32 mask)
{
struct crypto_alg *alg;
down_read(&crypto_alg_sem);
- alg = __crypto_alg_lookup(name);
+ alg = __crypto_alg_lookup(name, type, mask);
up_read(&crypto_alg_sem);
if (alg) {
@@ -87,6 +87,8 @@ static int __crypto_register_alg(struct crypto_alg *alg)
!strcmp(alg->cra_driver_name, q->cra_name))) {
struct crypto_larval *larval = (void *)q;
+ if ((q->cra_flags ^ alg->cra_flags) & larval->mask)
+ continue;
if (!crypto_mod_get(alg))
continue;
larval->adult = alg;