summaryrefslogtreecommitdiff
path: root/crypto/internal.h
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2006-09-21 11:39:29 +1000
committerHerbert Xu <herbert@gondor.apana.org.au>2006-09-21 11:39:29 +1000
commit6bfd48096ff8ecabf955958b51ddfa7988eb0a14 (patch)
tree813799f00d8402348ba6817953b1c631541be66c /crypto/internal.h
parent492e2b63eb10c28f4f0b694264d74a8755cd1be0 (diff)
downloadlinux-3.10-6bfd48096ff8ecabf955958b51ddfa7988eb0a14.tar.gz
linux-3.10-6bfd48096ff8ecabf955958b51ddfa7988eb0a14.tar.bz2
linux-3.10-6bfd48096ff8ecabf955958b51ddfa7988eb0a14.zip
[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.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/crypto/internal.h b/crypto/internal.h
index c08d93bdadc..03c00b0e6b6 100644
--- a/crypto/internal.h
+++ b/crypto/internal.h
@@ -142,12 +142,21 @@ void crypto_exit_compress_ops(struct crypto_tfm *tfm);
void crypto_larval_error(const char *name, u32 type, u32 mask);
+void crypto_shoot_alg(struct crypto_alg *alg);
+struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 flags);
+
int crypto_register_instance(struct crypto_template *tmpl,
struct crypto_instance *inst);
int crypto_register_notifier(struct notifier_block *nb);
int crypto_unregister_notifier(struct notifier_block *nb);
+static inline void crypto_alg_put(struct crypto_alg *alg)
+{
+ if (atomic_dec_and_test(&alg->cra_refcnt) && alg->cra_destroy)
+ alg->cra_destroy(alg);
+}
+
static inline int crypto_tmpl_get(struct crypto_template *tmpl)
{
return try_module_get(tmpl->module);
@@ -163,6 +172,16 @@ static inline int crypto_is_larval(struct crypto_alg *alg)
return alg->cra_flags & CRYPTO_ALG_LARVAL;
}
+static inline int crypto_is_dead(struct crypto_alg *alg)
+{
+ return alg->cra_flags & CRYPTO_ALG_DEAD;
+}
+
+static inline int crypto_is_moribund(struct crypto_alg *alg)
+{
+ return alg->cra_flags & (CRYPTO_ALG_DEAD | CRYPTO_ALG_DYING);
+}
+
static inline int crypto_notify(unsigned long val, void *v)
{
return blocking_notifier_call_chain(&crypto_chain, val, v);