aboutsummaryrefslogtreecommitdiffstats
path: root/include/crypto/algapi.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/crypto/algapi.h')
-rw-r--r--include/crypto/algapi.h44
1 files changed, 43 insertions, 1 deletions
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index cd721a7ce78f..4af72dc21202 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -112,7 +112,8 @@ struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn, u32 type,
112 112
113struct crypto_attr_type *crypto_get_attr_type(struct rtattr **tb); 113struct crypto_attr_type *crypto_get_attr_type(struct rtattr **tb);
114int crypto_check_attr_type(struct rtattr **tb, u32 type); 114int crypto_check_attr_type(struct rtattr **tb, u32 type);
115struct crypto_alg *crypto_get_attr_alg(struct rtattr **tb, u32 type, u32 mask); 115struct crypto_alg *crypto_attr_alg(struct rtattr *rta, u32 type, u32 mask);
116int crypto_attr_u32(struct rtattr *rta, u32 *num);
116struct crypto_instance *crypto_alloc_instance(const char *name, 117struct crypto_instance *crypto_alloc_instance(const char *name,
117 struct crypto_alg *alg); 118 struct crypto_alg *alg);
118 119
@@ -171,6 +172,26 @@ static inline struct aead_alg *crypto_aead_alg(struct crypto_aead *tfm)
171 return &crypto_aead_tfm(tfm)->__crt_alg->cra_aead; 172 return &crypto_aead_tfm(tfm)->__crt_alg->cra_aead;
172} 173}
173 174
175static inline void *crypto_aead_ctx(struct crypto_aead *tfm)
176{
177 return crypto_tfm_ctx(&tfm->base);
178}
179
180static inline struct crypto_instance *crypto_aead_alg_instance(
181 struct crypto_aead *aead)
182{
183 return crypto_tfm_alg_instance(&aead->base);
184}
185
186static inline struct crypto_ablkcipher *crypto_spawn_ablkcipher(
187 struct crypto_spawn *spawn)
188{
189 u32 type = CRYPTO_ALG_TYPE_BLKCIPHER;
190 u32 mask = CRYPTO_ALG_TYPE_MASK;
191
192 return __crypto_ablkcipher_cast(crypto_spawn_tfm(spawn, type, mask));
193}
194
174static inline struct crypto_blkcipher *crypto_spawn_blkcipher( 195static inline struct crypto_blkcipher *crypto_spawn_blkcipher(
175 struct crypto_spawn *spawn) 196 struct crypto_spawn *spawn)
176{ 197{
@@ -257,5 +278,26 @@ static inline int ablkcipher_tfm_in_queue(struct crypto_queue *queue,
257 return crypto_tfm_in_queue(queue, crypto_ablkcipher_tfm(tfm)); 278 return crypto_tfm_in_queue(queue, crypto_ablkcipher_tfm(tfm));
258} 279}
259 280
281static inline void *aead_request_ctx(struct aead_request *req)
282{
283 return req->__ctx;
284}
285
286static inline void aead_request_complete(struct aead_request *req, int err)
287{
288 req->base.complete(&req->base, err);
289}
290
291static inline u32 aead_request_flags(struct aead_request *req)
292{
293 return req->base.flags;
294}
295
296static inline struct crypto_alg *crypto_get_attr_alg(struct rtattr **tb,
297 u32 type, u32 mask)
298{
299 return crypto_attr_alg(tb[1], type, mask);
300}
301
260#endif /* _CRYPTO_ALGAPI_H */ 302#endif /* _CRYPTO_ALGAPI_H */
261 303