diff options
Diffstat (limited to 'crypto/internal.h')
-rw-r--r-- | crypto/internal.h | 37 |
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. */ | ||
31 | enum { | ||
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 | |||
28 | struct crypto_instance; | 39 | struct crypto_instance; |
29 | struct crypto_template; | 40 | struct crypto_template; |
30 | 41 | ||
42 | struct crypto_larval { | ||
43 | struct crypto_alg alg; | ||
44 | struct crypto_alg *adult; | ||
45 | struct completion completion; | ||
46 | }; | ||
47 | |||
31 | extern struct list_head crypto_alg_list; | 48 | extern struct list_head crypto_alg_list; |
32 | extern struct rw_semaphore crypto_alg_sem; | 49 | extern struct rw_semaphore crypto_alg_sem; |
50 | extern struct blocking_notifier_head crypto_chain; | ||
33 | 51 | ||
34 | extern enum km_type crypto_km_types[]; | 52 | extern 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 | ||
125 | struct crypto_alg *crypto_mod_get(struct crypto_alg *alg); | ||
126 | void crypto_mod_put(struct crypto_alg *alg); | ||
127 | struct crypto_alg *__crypto_alg_lookup(const char *name); | ||
128 | |||
107 | int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags); | 129 | int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags); |
108 | int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags); | 130 | int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags); |
109 | int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags); | 131 | int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags); |
@@ -116,9 +138,14 @@ void crypto_exit_digest_ops(struct crypto_tfm *tfm); | |||
116 | void crypto_exit_cipher_ops(struct crypto_tfm *tfm); | 138 | void crypto_exit_cipher_ops(struct crypto_tfm *tfm); |
117 | void crypto_exit_compress_ops(struct crypto_tfm *tfm); | 139 | void crypto_exit_compress_ops(struct crypto_tfm *tfm); |
118 | 140 | ||
141 | void crypto_larval_error(const char *name); | ||
142 | |||
119 | int crypto_register_instance(struct crypto_template *tmpl, | 143 | int crypto_register_instance(struct crypto_template *tmpl, |
120 | struct crypto_instance *inst); | 144 | struct crypto_instance *inst); |
121 | 145 | ||
146 | int crypto_register_notifier(struct notifier_block *nb); | ||
147 | int crypto_unregister_notifier(struct notifier_block *nb); | ||
148 | |||
122 | static inline int crypto_tmpl_get(struct crypto_template *tmpl) | 149 | static 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 | ||
159 | static inline int crypto_is_larval(struct crypto_alg *alg) | ||
160 | { | ||
161 | return alg->cra_flags & CRYPTO_ALG_LARVAL; | ||
162 | } | ||
163 | |||
164 | static 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 | ||