aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/internal.h
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2006-08-06 07:23:26 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2006-09-20 21:17:13 -0400
commit2825982d9d66ebba4b532a07391dfbb357f71c5f (patch)
tree3789b26b593d081ff8eedc7e528c2b9b49a94dc2 /crypto/internal.h
parent4cc7720cd165273b08a72b4193146dffee58e34b (diff)
[CRYPTO] api: Added event notification
This patch adds a notifier chain for algorithm/template registration events. This will be used to register compound algorithms such as cbc(aes). In future this will also be passed onto user-space through netlink. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'crypto/internal.h')
-rw-r--r--crypto/internal.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/crypto/internal.h b/crypto/internal.h
index c3ab4a950f30..3a08d25fba45 100644
--- a/crypto/internal.h
+++ b/crypto/internal.h
@@ -14,6 +14,7 @@
14#define _CRYPTO_INTERNAL_H 14#define _CRYPTO_INTERNAL_H
15 15
16#include <crypto/algapi.h> 16#include <crypto/algapi.h>
17#include <linux/completion.h>
17#include <linux/mm.h> 18#include <linux/mm.h>
18#include <linux/highmem.h> 19#include <linux/highmem.h>
19#include <linux/interrupt.h> 20#include <linux/interrupt.h>
@@ -21,15 +22,32 @@
21#include <linux/list.h> 22#include <linux/list.h>
22#include <linux/module.h> 23#include <linux/module.h>
23#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/notifier.h>
24#include <linux/rwsem.h> 26#include <linux/rwsem.h>
25#include <linux/slab.h> 27#include <linux/slab.h>
26#include <asm/kmap_types.h> 28#include <asm/kmap_types.h>
27 29
30/* Crypto notification events. */
31enum {
32 CRYPTO_MSG_ALG_REQUEST,
33 CRYPTO_MSG_ALG_REGISTER,
34 CRYPTO_MSG_ALG_UNREGISTER,
35 CRYPTO_MSG_TMPL_REGISTER,
36 CRYPTO_MSG_TMPL_UNREGISTER,
37};
38
28struct crypto_instance; 39struct crypto_instance;
29struct crypto_template; 40struct crypto_template;
30 41
42struct crypto_larval {
43 struct crypto_alg alg;
44 struct crypto_alg *adult;
45 struct completion completion;
46};
47
31extern struct list_head crypto_alg_list; 48extern struct list_head crypto_alg_list;
32extern struct rw_semaphore crypto_alg_sem; 49extern struct rw_semaphore crypto_alg_sem;
50extern struct blocking_notifier_head crypto_chain;
33 51
34extern enum km_type crypto_km_types[]; 52extern enum km_type crypto_km_types[];
35 53
@@ -104,6 +122,10 @@ static inline unsigned int crypto_compress_ctxsize(struct crypto_alg *alg,
104 return alg->cra_ctxsize; 122 return alg->cra_ctxsize;
105} 123}
106 124
125struct crypto_alg *crypto_mod_get(struct crypto_alg *alg);
126void crypto_mod_put(struct crypto_alg *alg);
127struct crypto_alg *__crypto_alg_lookup(const char *name);
128
107int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags); 129int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags);
108int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags); 130int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags);
109int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags); 131int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags);
@@ -116,9 +138,14 @@ void crypto_exit_digest_ops(struct crypto_tfm *tfm);
116void crypto_exit_cipher_ops(struct crypto_tfm *tfm); 138void crypto_exit_cipher_ops(struct crypto_tfm *tfm);
117void crypto_exit_compress_ops(struct crypto_tfm *tfm); 139void crypto_exit_compress_ops(struct crypto_tfm *tfm);
118 140
141void crypto_larval_error(const char *name);
142
119int crypto_register_instance(struct crypto_template *tmpl, 143int crypto_register_instance(struct crypto_template *tmpl,
120 struct crypto_instance *inst); 144 struct crypto_instance *inst);
121 145
146int crypto_register_notifier(struct notifier_block *nb);
147int crypto_unregister_notifier(struct notifier_block *nb);
148
122static inline int crypto_tmpl_get(struct crypto_template *tmpl) 149static inline int crypto_tmpl_get(struct crypto_template *tmpl)
123{ 150{
124 return try_module_get(tmpl->module); 151 return try_module_get(tmpl->module);
@@ -129,5 +156,15 @@ static inline void crypto_tmpl_put(struct crypto_template *tmpl)
129 module_put(tmpl->module); 156 module_put(tmpl->module);
130} 157}
131 158
159static inline int crypto_is_larval(struct crypto_alg *alg)
160{
161 return alg->cra_flags & CRYPTO_ALG_LARVAL;
162}
163
164static inline int crypto_notify(unsigned long val, void *v)
165{
166 return blocking_notifier_call_chain(&crypto_chain, val, v);
167}
168
132#endif /* _CRYPTO_INTERNAL_H */ 169#endif /* _CRYPTO_INTERNAL_H */
133 170