aead.h (527c465a3c8716d93201ae34b7fc52679610596d) aead.h (149a39717dcce3b6ba15285c9fc86e4423437e05)
1/*
2 * AEAD: Authenticated Encryption with Associated Data
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)

--- 7 unchanged lines hidden (view full) ---

16#include <crypto/aead.h>
17#include <crypto/algapi.h>
18#include <linux/stddef.h>
19#include <linux/types.h>
20
21struct rtattr;
22
23struct aead_instance {
1/*
2 * AEAD: Authenticated Encryption with Associated Data
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)

--- 7 unchanged lines hidden (view full) ---

16#include <crypto/aead.h>
17#include <crypto/algapi.h>
18#include <linux/stddef.h>
19#include <linux/types.h>
20
21struct rtattr;
22
23struct aead_instance {
24 void (*free)(struct aead_instance *inst);
24 union {
25 struct {
26 char head[offsetof(struct aead_alg, base)];
27 struct crypto_instance base;
28 } s;
29 struct aead_alg alg;
30 };
31};
32
33struct crypto_aead_spawn {
34 struct crypto_spawn base;
35};
36
25 union {
26 struct {
27 char head[offsetof(struct aead_alg, base)];
28 struct crypto_instance base;
29 } s;
30 struct aead_alg alg;
31 };
32};
33
34struct crypto_aead_spawn {
35 struct crypto_spawn base;
36};
37
38struct aead_queue {
39 struct crypto_queue base;
40};
41
37extern const struct crypto_type crypto_aead_type;
38extern const struct crypto_type crypto_nivaead_type;
39
40static inline void *crypto_aead_ctx(struct crypto_aead *tfm)
41{
42 return crypto_tfm_ctx(&tfm->base);
43}
44

--- 68 unchanged lines hidden (view full) ---

113}
114
115static inline struct crypto_aead *crypto_spawn_aead(
116 struct crypto_aead_spawn *spawn)
117{
118 return crypto_spawn_tfm2(&spawn->base);
119}
120
42extern const struct crypto_type crypto_aead_type;
43extern const struct crypto_type crypto_nivaead_type;
44
45static inline void *crypto_aead_ctx(struct crypto_aead *tfm)
46{
47 return crypto_tfm_ctx(&tfm->base);
48}
49

--- 68 unchanged lines hidden (view full) ---

118}
119
120static inline struct crypto_aead *crypto_spawn_aead(
121 struct crypto_aead_spawn *spawn)
122{
123 return crypto_spawn_tfm2(&spawn->base);
124}
125
121struct aead_instance *aead_geniv_alloc(struct crypto_template *tmpl,
122 struct rtattr **tb, u32 type, u32 mask);
123void aead_geniv_free(struct aead_instance *inst);
124int aead_geniv_init(struct crypto_tfm *tfm);
125void aead_geniv_exit(struct crypto_tfm *tfm);
126
127static inline struct crypto_aead *aead_geniv_base(struct crypto_aead *geniv)
128{
129 return geniv->child;
130}
131
132static inline void *aead_givcrypt_reqctx(struct aead_givcrypt_request *req)
133{
134 return aead_request_ctx(&req->areq);

--- 17 unchanged lines hidden (view full) ---

152 alg->maxauthsize;
153}
154
155static inline unsigned int crypto_aead_maxauthsize(struct crypto_aead *aead)
156{
157 return crypto_aead_alg_maxauthsize(crypto_aead_alg(aead));
158}
159
126static inline struct crypto_aead *aead_geniv_base(struct crypto_aead *geniv)
127{
128 return geniv->child;
129}
130
131static inline void *aead_givcrypt_reqctx(struct aead_givcrypt_request *req)
132{
133 return aead_request_ctx(&req->areq);

--- 17 unchanged lines hidden (view full) ---

151 alg->maxauthsize;
152}
153
154static inline unsigned int crypto_aead_maxauthsize(struct crypto_aead *aead)
155{
156 return crypto_aead_alg_maxauthsize(crypto_aead_alg(aead));
157}
158
159static inline void aead_init_queue(struct aead_queue *queue,
160 unsigned int max_qlen)
161{
162 crypto_init_queue(&queue->base, max_qlen);
163}
164
165static inline int aead_enqueue_request(struct aead_queue *queue,
166 struct aead_request *request)
167{
168 return crypto_enqueue_request(&queue->base, &request->base);
169}
170
171static inline struct aead_request *aead_dequeue_request(
172 struct aead_queue *queue)
173{
174 struct crypto_async_request *req;
175
176 req = crypto_dequeue_request(&queue->base);
177
178 return req ? container_of(req, struct aead_request, base) : NULL;
179}
180
181static inline struct aead_request *aead_get_backlog(struct aead_queue *queue)
182{
183 struct crypto_async_request *req;
184
185 req = crypto_get_backlog(&queue->base);
186
187 return req ? container_of(req, struct aead_request, base) : NULL;
188}
189
160int crypto_register_aead(struct aead_alg *alg);
161void crypto_unregister_aead(struct aead_alg *alg);
162int crypto_register_aeads(struct aead_alg *algs, int count);
163void crypto_unregister_aeads(struct aead_alg *algs, int count);
164int aead_register_instance(struct crypto_template *tmpl,
165 struct aead_instance *inst);
166
167#endif /* _CRYPTO_INTERNAL_AEAD_H */
168
190int crypto_register_aead(struct aead_alg *alg);
191void crypto_unregister_aead(struct aead_alg *alg);
192int crypto_register_aeads(struct aead_alg *algs, int count);
193void crypto_unregister_aeads(struct aead_alg *algs, int count);
194int aead_register_instance(struct crypto_template *tmpl,
195 struct aead_instance *inst);
196
197#endif /* _CRYPTO_INTERNAL_AEAD_H */
198