]>
Commit | Line | Data |
---|---|---|
378f4f51 HX |
1 | /* |
2 | * Symmetric key ciphers. | |
3 | * | |
4 | * Copyright (c) 2007 Herbert Xu <herbert@gondor.apana.org.au> | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify it | |
7 | * under the terms of the GNU General Public License as published by the Free | |
8 | * Software Foundation; either version 2 of the License, or (at your option) | |
9 | * any later version. | |
10 | * | |
11 | */ | |
12 | ||
13 | #ifndef _CRYPTO_INTERNAL_SKCIPHER_H | |
14 | #define _CRYPTO_INTERNAL_SKCIPHER_H | |
15 | ||
16 | #include <crypto/algapi.h> | |
61da88e2 | 17 | #include <crypto/skcipher.h> |
ecfc4329 HX |
18 | #include <linux/types.h> |
19 | ||
20 | struct rtattr; | |
378f4f51 HX |
21 | |
22 | struct crypto_skcipher_spawn { | |
23 | struct crypto_spawn base; | |
24 | }; | |
25 | ||
61da88e2 HX |
26 | extern const struct crypto_type crypto_givcipher_type; |
27 | ||
378f4f51 HX |
28 | static inline void crypto_set_skcipher_spawn( |
29 | struct crypto_skcipher_spawn *spawn, struct crypto_instance *inst) | |
30 | { | |
31 | crypto_set_spawn(&spawn->base, inst); | |
32 | } | |
33 | ||
34 | int crypto_grab_skcipher(struct crypto_skcipher_spawn *spawn, const char *name, | |
35 | u32 type, u32 mask); | |
36 | ||
37 | static inline void crypto_drop_skcipher(struct crypto_skcipher_spawn *spawn) | |
38 | { | |
39 | crypto_drop_spawn(&spawn->base); | |
40 | } | |
41 | ||
42 | static inline struct crypto_alg *crypto_skcipher_spawn_alg( | |
43 | struct crypto_skcipher_spawn *spawn) | |
44 | { | |
45 | return spawn->base.alg; | |
46 | } | |
47 | ||
48 | static inline struct crypto_ablkcipher *crypto_spawn_skcipher( | |
49 | struct crypto_skcipher_spawn *spawn) | |
50 | { | |
51 | return __crypto_ablkcipher_cast( | |
52 | crypto_spawn_tfm(&spawn->base, crypto_skcipher_type(0), | |
53 | crypto_skcipher_mask(0))); | |
54 | } | |
55 | ||
ecfc4329 HX |
56 | const char *crypto_default_geniv(const struct crypto_alg *alg); |
57 | ||
58 | struct crypto_instance *skcipher_geniv_alloc(struct crypto_template *tmpl, | |
59 | struct rtattr **tb, u32 type, | |
60 | u32 mask); | |
61 | void skcipher_geniv_free(struct crypto_instance *inst); | |
62 | int skcipher_geniv_init(struct crypto_tfm *tfm); | |
63 | void skcipher_geniv_exit(struct crypto_tfm *tfm); | |
64 | ||
65 | static inline struct crypto_ablkcipher *skcipher_geniv_cipher( | |
66 | struct crypto_ablkcipher *geniv) | |
67 | { | |
68 | return crypto_ablkcipher_crt(geniv)->base; | |
69 | } | |
70 | ||
61da88e2 HX |
71 | static inline void *skcipher_givcrypt_reqctx( |
72 | struct skcipher_givcrypt_request *req) | |
73 | { | |
74 | return ablkcipher_request_ctx(&req->creq); | |
75 | } | |
76 | ||
378f4f51 HX |
77 | #endif /* _CRYPTO_INTERNAL_SKCIPHER_H */ |
78 |