diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2006-09-21 11:31:44 +1000 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2006-09-21 11:31:44 +1000 |
commit | 2b8c19dbdc692e81243a328725a02efb77b144a5 (patch) | |
tree | f9256d5515cc315d54971f62e0e9812d5db572ba /crypto/api.c | |
parent | 2825982d9d66ebba4b532a07391dfbb357f71c5f (diff) | |
download | linux-2b8c19dbdc692e81243a328725a02efb77b144a5.tar.gz linux-2b8c19dbdc692e81243a328725a02efb77b144a5.tar.bz2 linux-2b8c19dbdc692e81243a328725a02efb77b144a5.zip |
[CRYPTO] api: Add cryptomgr
The cryptomgr module is a simple manager of crypto algorithm instances.
It ensures that parameterised algorithms of the type tmpl(alg) (e.g.,
cbc(aes)) are always created.
This is meant to satisfy the needs for most users. For more complex
cases such as deeper combinations or multiple parameters, a netlink
module will be created which allows arbitrary expressions to be parsed
in user-space.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'crypto/api.c')
-rw-r--r-- | crypto/api.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/crypto/api.c b/crypto/api.c index 5a0d6a17cfd7..67cd6f87b74a 100644 --- a/crypto/api.c +++ b/crypto/api.c @@ -18,6 +18,7 @@ #include <linux/errno.h> #include <linux/kernel.h> #include <linux/kmod.h> +#include <linux/module.h> #include <linux/param.h> #include <linux/slab.h> #include <linux/string.h> @@ -170,6 +171,7 @@ static struct crypto_alg *crypto_alg_mod_lookup(const char *name) { struct crypto_alg *alg; struct crypto_alg *larval; + int ok; alg = try_then_request_module(crypto_alg_lookup(name), name); if (alg) @@ -179,7 +181,13 @@ static struct crypto_alg *crypto_alg_mod_lookup(const char *name) if (!larval || !crypto_is_larval(larval)) return larval; - if (crypto_notify(CRYPTO_MSG_ALG_REQUEST, larval) == NOTIFY_STOP) + ok = crypto_notify(CRYPTO_MSG_ALG_REQUEST, larval); + if (ok == NOTIFY_DONE) { + request_module("cryptomgr"); + ok = crypto_notify(CRYPTO_MSG_ALG_REQUEST, larval); + } + + if (ok == NOTIFY_STOP) alg = crypto_larval_wait(larval); else { crypto_mod_put(larval); |