aboutsummaryrefslogtreecommitdiffstats
path: root/include/crypto/algapi.h
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-04-16 06:49:20 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2007-05-02 00:38:32 -0400
commit124b53d020622ffa24e27406f2373d5a3debd0d3 (patch)
treee1a89ac6745ce9afea6fd2ea358ebd40e60abb76 /include/crypto/algapi.h
parenta73e69965fa2647faa36caf40f4132b9c99d61fd (diff)
[CRYPTO] cryptd: Add software async crypto daemon
This patch adds the cryptd module which is a template that takes a synchronous software crypto algorithm and converts it to an asynchronous one by executing it in a kernel thread. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto/algapi.h')
-rw-r--r--include/crypto/algapi.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index 7847fc2a03f0..b2b1e6efd812 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -138,6 +138,12 @@ static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm)
138 return (void *)ALIGN(addr, align); 138 return (void *)ALIGN(addr, align);
139} 139}
140 140
141static inline struct crypto_instance *crypto_tfm_alg_instance(
142 struct crypto_tfm *tfm)
143{
144 return container_of(tfm->__crt_alg, struct crypto_instance, alg);
145}
146
141static inline void *crypto_instance_ctx(struct crypto_instance *inst) 147static inline void *crypto_instance_ctx(struct crypto_instance *inst)
142{ 148{
143 return inst->__ctx; 149 return inst->__ctx;
@@ -154,6 +160,15 @@ static inline void *crypto_ablkcipher_ctx(struct crypto_ablkcipher *tfm)
154 return crypto_tfm_ctx(&tfm->base); 160 return crypto_tfm_ctx(&tfm->base);
155} 161}
156 162
163static inline struct crypto_blkcipher *crypto_spawn_blkcipher(
164 struct crypto_spawn *spawn)
165{
166 u32 type = CRYPTO_ALG_TYPE_BLKCIPHER;
167 u32 mask = CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC;
168
169 return __crypto_blkcipher_cast(crypto_spawn_tfm(spawn, type, mask));
170}
171
157static inline void *crypto_blkcipher_ctx(struct crypto_blkcipher *tfm) 172static inline void *crypto_blkcipher_ctx(struct crypto_blkcipher *tfm)
158{ 173{
159 return crypto_tfm_ctx(&tfm->base); 174 return crypto_tfm_ctx(&tfm->base);