diff options
Diffstat (limited to 'include/crypto/algapi.h')
-rw-r--r-- | include/crypto/algapi.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h index 726a765e5ec6..fda1759ffe2d 100644 --- a/include/crypto/algapi.h +++ b/include/crypto/algapi.h | |||
@@ -111,6 +111,12 @@ void crypto_drop_spawn(struct crypto_spawn *spawn); | |||
111 | struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn, u32 type, | 111 | struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn, u32 type, |
112 | u32 mask); | 112 | u32 mask); |
113 | 113 | ||
114 | static inline void crypto_set_spawn(struct crypto_spawn *spawn, | ||
115 | struct crypto_instance *inst) | ||
116 | { | ||
117 | spawn->inst = inst; | ||
118 | } | ||
119 | |||
114 | struct crypto_attr_type *crypto_get_attr_type(struct rtattr **tb); | 120 | struct crypto_attr_type *crypto_get_attr_type(struct rtattr **tb); |
115 | int crypto_check_attr_type(struct rtattr **tb, u32 type); | 121 | int crypto_check_attr_type(struct rtattr **tb, u32 type); |
116 | const char *crypto_attr_alg_name(struct rtattr *rta); | 122 | const char *crypto_attr_alg_name(struct rtattr *rta); |
@@ -195,10 +201,9 @@ static inline struct crypto_instance *crypto_aead_alg_instance( | |||
195 | static inline struct crypto_ablkcipher *crypto_spawn_ablkcipher( | 201 | static inline struct crypto_ablkcipher *crypto_spawn_ablkcipher( |
196 | struct crypto_spawn *spawn) | 202 | struct crypto_spawn *spawn) |
197 | { | 203 | { |
198 | u32 type = CRYPTO_ALG_TYPE_BLKCIPHER; | 204 | return __crypto_ablkcipher_cast( |
199 | u32 mask = CRYPTO_ALG_TYPE_BLKCIPHER_MASK; | 205 | crypto_spawn_tfm(spawn, crypto_skcipher_type(0), |
200 | 206 | crypto_skcipher_mask(0))); | |
201 | return __crypto_ablkcipher_cast(crypto_spawn_tfm(spawn, type, mask)); | ||
202 | } | 207 | } |
203 | 208 | ||
204 | static inline struct crypto_blkcipher *crypto_spawn_blkcipher( | 209 | static inline struct crypto_blkcipher *crypto_spawn_blkcipher( |
@@ -308,5 +313,14 @@ static inline struct crypto_alg *crypto_get_attr_alg(struct rtattr **tb, | |||
308 | return crypto_attr_alg(tb[1], type, mask); | 313 | return crypto_attr_alg(tb[1], type, mask); |
309 | } | 314 | } |
310 | 315 | ||
316 | /* | ||
317 | * Returns CRYPTO_ALG_ASYNC if type/mask requires the use of sync algorithms. | ||
318 | * Otherwise returns zero. | ||
319 | */ | ||
320 | static inline int crypto_requires_sync(u32 type, u32 mask) | ||
321 | { | ||
322 | return (type ^ CRYPTO_ALG_ASYNC) & mask & CRYPTO_ALG_ASYNC; | ||
323 | } | ||
324 | |||
311 | #endif /* _CRYPTO_ALGAPI_H */ | 325 | #endif /* _CRYPTO_ALGAPI_H */ |
312 | 326 | ||