diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2006-09-20 21:39:29 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2006-09-20 21:39:29 -0400 |
commit | 6bfd48096ff8ecabf955958b51ddfa7988eb0a14 (patch) | |
tree | 813799f00d8402348ba6817953b1c631541be66c /crypto/internal.h | |
parent | 492e2b63eb10c28f4f0b694264d74a8755cd1be0 (diff) |
[CRYPTO] api: Added spawns
Spawns lock a specific crypto algorithm in place. They can then be used
with crypto_spawn_tfm to allocate a tfm for that algorithm. When the base
algorithm of a spawn is deregistered, all its spawns will be automatically
removed.
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.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crypto/internal.h b/crypto/internal.h index c08d93bdadc4..03c00b0e6b60 100644 --- a/crypto/internal.h +++ b/crypto/internal.h | |||
@@ -142,12 +142,21 @@ void crypto_exit_compress_ops(struct crypto_tfm *tfm); | |||
142 | 142 | ||
143 | void crypto_larval_error(const char *name, u32 type, u32 mask); | 143 | void crypto_larval_error(const char *name, u32 type, u32 mask); |
144 | 144 | ||
145 | void crypto_shoot_alg(struct crypto_alg *alg); | ||
146 | struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 flags); | ||
147 | |||
145 | int crypto_register_instance(struct crypto_template *tmpl, | 148 | int crypto_register_instance(struct crypto_template *tmpl, |
146 | struct crypto_instance *inst); | 149 | struct crypto_instance *inst); |
147 | 150 | ||
148 | int crypto_register_notifier(struct notifier_block *nb); | 151 | int crypto_register_notifier(struct notifier_block *nb); |
149 | int crypto_unregister_notifier(struct notifier_block *nb); | 152 | int crypto_unregister_notifier(struct notifier_block *nb); |
150 | 153 | ||
154 | static inline void crypto_alg_put(struct crypto_alg *alg) | ||
155 | { | ||
156 | if (atomic_dec_and_test(&alg->cra_refcnt) && alg->cra_destroy) | ||
157 | alg->cra_destroy(alg); | ||
158 | } | ||
159 | |||
151 | static inline int crypto_tmpl_get(struct crypto_template *tmpl) | 160 | static inline int crypto_tmpl_get(struct crypto_template *tmpl) |
152 | { | 161 | { |
153 | return try_module_get(tmpl->module); | 162 | return try_module_get(tmpl->module); |
@@ -163,6 +172,16 @@ static inline int crypto_is_larval(struct crypto_alg *alg) | |||
163 | return alg->cra_flags & CRYPTO_ALG_LARVAL; | 172 | return alg->cra_flags & CRYPTO_ALG_LARVAL; |
164 | } | 173 | } |
165 | 174 | ||
175 | static inline int crypto_is_dead(struct crypto_alg *alg) | ||
176 | { | ||
177 | return alg->cra_flags & CRYPTO_ALG_DEAD; | ||
178 | } | ||
179 | |||
180 | static inline int crypto_is_moribund(struct crypto_alg *alg) | ||
181 | { | ||
182 | return alg->cra_flags & (CRYPTO_ALG_DEAD | CRYPTO_ALG_DYING); | ||
183 | } | ||
184 | |||
166 | static inline int crypto_notify(unsigned long val, void *v) | 185 | static inline int crypto_notify(unsigned long val, void *v) |
167 | { | 186 | { |
168 | return blocking_notifier_call_chain(&crypto_chain, val, v); | 187 | return blocking_notifier_call_chain(&crypto_chain, val, v); |