Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / include / crypto / internal / skcipher.h
blobd03e8b7b245768e544e229e31b390bbf74231574
1 /*
2 * Symmetric key ciphers.
3 *
4 * Copyright (c) 2007 Herbert Xu <herbert@gondor.apana.org.au>
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.
13 #ifndef _CRYPTO_INTERNAL_SKCIPHER_H
14 #define _CRYPTO_INTERNAL_SKCIPHER_H
16 #include <crypto/algapi.h>
17 #include <crypto/skcipher.h>
18 <<<<<<< HEAD:include/crypto/internal/skcipher.h
19 =======
20 #include <linux/init.h>
21 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:include/crypto/internal/skcipher.h
22 #include <linux/types.h>
24 struct rtattr;
26 struct crypto_skcipher_spawn {
27 struct crypto_spawn base;
30 extern const struct crypto_type crypto_givcipher_type;
32 static inline void crypto_set_skcipher_spawn(
33 struct crypto_skcipher_spawn *spawn, struct crypto_instance *inst)
35 crypto_set_spawn(&spawn->base, inst);
38 int crypto_grab_skcipher(struct crypto_skcipher_spawn *spawn, const char *name,
39 u32 type, u32 mask);
41 static inline void crypto_drop_skcipher(struct crypto_skcipher_spawn *spawn)
43 crypto_drop_spawn(&spawn->base);
46 static inline struct crypto_alg *crypto_skcipher_spawn_alg(
47 struct crypto_skcipher_spawn *spawn)
49 return spawn->base.alg;
52 static inline struct crypto_ablkcipher *crypto_spawn_skcipher(
53 struct crypto_skcipher_spawn *spawn)
55 return __crypto_ablkcipher_cast(
56 crypto_spawn_tfm(&spawn->base, crypto_skcipher_type(0),
57 crypto_skcipher_mask(0)));
60 int skcipher_null_givencrypt(struct skcipher_givcrypt_request *req);
61 int skcipher_null_givdecrypt(struct skcipher_givcrypt_request *req);
62 const char *crypto_default_geniv(const struct crypto_alg *alg);
64 struct crypto_instance *skcipher_geniv_alloc(struct crypto_template *tmpl,
65 struct rtattr **tb, u32 type,
66 u32 mask);
67 void skcipher_geniv_free(struct crypto_instance *inst);
68 int skcipher_geniv_init(struct crypto_tfm *tfm);
69 void skcipher_geniv_exit(struct crypto_tfm *tfm);
71 <<<<<<< HEAD:include/crypto/internal/skcipher.h
72 =======
73 int __init eseqiv_module_init(void);
74 void __exit eseqiv_module_exit(void);
75 int __init chainiv_module_init(void);
76 void chainiv_module_exit(void);
78 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:include/crypto/internal/skcipher.h
79 static inline struct crypto_ablkcipher *skcipher_geniv_cipher(
80 struct crypto_ablkcipher *geniv)
82 return crypto_ablkcipher_crt(geniv)->base;
85 static inline int skcipher_enqueue_givcrypt(
86 struct crypto_queue *queue, struct skcipher_givcrypt_request *request)
88 return ablkcipher_enqueue_request(queue, &request->creq);
91 static inline struct skcipher_givcrypt_request *skcipher_dequeue_givcrypt(
92 struct crypto_queue *queue)
94 return container_of(ablkcipher_dequeue_request(queue),
95 struct skcipher_givcrypt_request, creq);
98 static inline void *skcipher_givcrypt_reqctx(
99 struct skcipher_givcrypt_request *req)
101 return ablkcipher_request_ctx(&req->creq);
104 static inline void ablkcipher_request_complete(struct ablkcipher_request *req,
105 int err)
107 req->base.complete(&req->base, err);
110 static inline void skcipher_givcrypt_complete(
111 struct skcipher_givcrypt_request *req, int err)
113 ablkcipher_request_complete(&req->creq, err);
116 static inline u32 ablkcipher_request_flags(struct ablkcipher_request *req)
118 return req->base.flags;
121 #endif /* _CRYPTO_INTERNAL_SKCIPHER_H */