aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/api.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2006-09-20 21:31:44 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2006-09-20 21:31:44 -0400
commit2b8c19dbdc692e81243a328725a02efb77b144a5 (patch)
treef9256d5515cc315d54971f62e0e9812d5db572ba /crypto/api.c
parent2825982d9d66ebba4b532a07391dfbb357f71c5f (diff)
[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.c10
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 @@
18#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/kmod.h> 20#include <linux/kmod.h>
21#include <linux/module.h>
21#include <linux/param.h> 22#include <linux/param.h>
22#include <linux/slab.h> 23#include <linux/slab.h>
23#include <linux/string.h> 24#include <linux/string.h>
@@ -170,6 +171,7 @@ static struct crypto_alg *crypto_alg_mod_lookup(const char *name)
170{ 171{
171 struct crypto_alg *alg; 172 struct crypto_alg *alg;
172 struct crypto_alg *larval; 173 struct crypto_alg *larval;
174 int ok;
173 175
174 alg = try_then_request_module(crypto_alg_lookup(name), name); 176 alg = try_then_request_module(crypto_alg_lookup(name), name);
175 if (alg) 177 if (alg)
@@ -179,7 +181,13 @@ static struct crypto_alg *crypto_alg_mod_lookup(const char *name)
179 if (!larval || !crypto_is_larval(larval)) 181 if (!larval || !crypto_is_larval(larval))
180 return larval; 182 return larval;
181 183
182 if (crypto_notify(CRYPTO_MSG_ALG_REQUEST, larval) == NOTIFY_STOP) 184 ok = crypto_notify(CRYPTO_MSG_ALG_REQUEST, larval);
185 if (ok == NOTIFY_DONE) {
186 request_module("cryptomgr");
187 ok = crypto_notify(CRYPTO_MSG_ALG_REQUEST, larval);
188 }
189
190 if (ok == NOTIFY_STOP)
183 alg = crypto_larval_wait(larval); 191 alg = crypto_larval_wait(larval);
184 else { 192 else {
185 crypto_mod_put(larval); 193 crypto_mod_put(larval);