aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2009-07-14 00:28:26 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2009-07-14 03:54:07 -0400
commit88056ec346ccf41f63dbc7080b24b5fd19d1358d (patch)
treeb78a82cbce49183e587ab8a1a5a5922611468361
parent2ca33da1dea3ba53d1425226a6bac073c5e8568c (diff)
crypto: ahash - Convert to new style algorithms
This patch converts crypto_ahash to the new style. The old ahash algorithm type is retained until the existing ahash implementations are also converted. All ahash users will automatically get the new crypto_ahash type. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--crypto/ahash.c82
-rw-r--r--crypto/shash.c8
-rw-r--r--include/crypto/hash.h109
-rw-r--r--include/crypto/internal/hash.h11
-rw-r--r--include/linux/crypto.h29
5 files changed, 148 insertions, 91 deletions
diff --git a/crypto/ahash.c b/crypto/ahash.c
index f3476374f764..838519386215 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -24,6 +24,12 @@
24 24
25#include "internal.h" 25#include "internal.h"
26 26
27static inline struct ahash_alg *crypto_ahash_alg(struct crypto_ahash *hash)
28{
29 return container_of(crypto_hash_alg_common(hash), struct ahash_alg,
30 halg);
31}
32
27static int hash_walk_next(struct crypto_hash_walk *walk) 33static int hash_walk_next(struct crypto_hash_walk *walk)
28{ 34{
29 unsigned int alignmask = walk->alignmask; 35 unsigned int alignmask = walk->alignmask;
@@ -169,30 +175,11 @@ static int ahash_nosetkey(struct crypto_ahash *tfm, const u8 *key,
169 return -ENOSYS; 175 return -ENOSYS;
170} 176}
171 177
172int crypto_ahash_import(struct ahash_request *req, const u8 *in)
173{
174 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
175 struct ahash_alg *alg = crypto_ahash_alg(tfm);
176
177 memcpy(ahash_request_ctx(req), in, crypto_ahash_reqsize(tfm));
178
179 if (alg->reinit)
180 alg->reinit(req);
181
182 return 0;
183}
184EXPORT_SYMBOL_GPL(crypto_ahash_import);
185
186static unsigned int crypto_ahash_ctxsize(struct crypto_alg *alg, u32 type,
187 u32 mask)
188{
189 return alg->cra_ctxsize;
190}
191
192static int crypto_init_ahash_ops(struct crypto_tfm *tfm, u32 type, u32 mask) 178static int crypto_init_ahash_ops(struct crypto_tfm *tfm, u32 type, u32 mask)
193{ 179{
194 struct ahash_alg *alg = &tfm->__crt_alg->cra_ahash; 180 struct old_ahash_alg *alg = &tfm->__crt_alg->cra_ahash;
195 struct ahash_tfm *crt = &tfm->crt_ahash; 181 struct crypto_ahash *crt = __crypto_ahash_cast(tfm);
182 struct ahash_alg *nalg = crypto_ahash_alg(crt);
196 183
197 if (alg->digestsize > PAGE_SIZE / 8) 184 if (alg->digestsize > PAGE_SIZE / 8)
198 return -EINVAL; 185 return -EINVAL;
@@ -204,9 +191,42 @@ static int crypto_init_ahash_ops(struct crypto_tfm *tfm, u32 type, u32 mask)
204 crt->setkey = alg->setkey ? ahash_setkey : ahash_nosetkey; 191 crt->setkey = alg->setkey ? ahash_setkey : ahash_nosetkey;
205 crt->digestsize = alg->digestsize; 192 crt->digestsize = alg->digestsize;
206 193
194 nalg->setkey = alg->setkey;
195 nalg->halg.digestsize = alg->digestsize;
196
207 return 0; 197 return 0;
208} 198}
209 199
200static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
201{
202 struct crypto_ahash *hash = __crypto_ahash_cast(tfm);
203 struct ahash_alg *alg = crypto_ahash_alg(hash);
204 struct old_ahash_alg *oalg = crypto_old_ahash_alg(hash);
205
206 if (tfm->__crt_alg->cra_type != &crypto_ahash_type)
207 return crypto_init_shash_ops_async(tfm);
208
209 if (oalg->init)
210 return crypto_init_ahash_ops(tfm, 0, 0);
211
212 hash->init = alg->init;
213 hash->update = alg->update;
214 hash->final = alg->final;
215 hash->digest = alg->digest;
216 hash->setkey = alg->setkey ? ahash_setkey : ahash_nosetkey;
217 hash->digestsize = alg->halg.digestsize;
218
219 return 0;
220}
221
222static unsigned int crypto_ahash_extsize(struct crypto_alg *alg)
223{
224 if (alg->cra_type == &crypto_ahash_type)
225 return alg->cra_ctxsize;
226
227 return sizeof(struct crypto_shash *);
228}
229
210static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg) 230static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg)
211 __attribute__ ((unused)); 231 __attribute__ ((unused));
212static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg) 232static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg)
@@ -215,17 +235,29 @@ static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg)
215 seq_printf(m, "async : %s\n", alg->cra_flags & CRYPTO_ALG_ASYNC ? 235 seq_printf(m, "async : %s\n", alg->cra_flags & CRYPTO_ALG_ASYNC ?
216 "yes" : "no"); 236 "yes" : "no");
217 seq_printf(m, "blocksize : %u\n", alg->cra_blocksize); 237 seq_printf(m, "blocksize : %u\n", alg->cra_blocksize);
218 seq_printf(m, "digestsize : %u\n", alg->cra_ahash.digestsize); 238 seq_printf(m, "digestsize : %u\n",
239 __crypto_hash_alg_common(alg)->digestsize);
219} 240}
220 241
221const struct crypto_type crypto_ahash_type = { 242const struct crypto_type crypto_ahash_type = {
222 .ctxsize = crypto_ahash_ctxsize, 243 .extsize = crypto_ahash_extsize,
223 .init = crypto_init_ahash_ops, 244 .init_tfm = crypto_ahash_init_tfm,
224#ifdef CONFIG_PROC_FS 245#ifdef CONFIG_PROC_FS
225 .show = crypto_ahash_show, 246 .show = crypto_ahash_show,
226#endif 247#endif
248 .maskclear = ~CRYPTO_ALG_TYPE_MASK,
249 .maskset = CRYPTO_ALG_TYPE_AHASH_MASK,
250 .type = CRYPTO_ALG_TYPE_AHASH,
251 .tfmsize = offsetof(struct crypto_ahash, base),
227}; 252};
228EXPORT_SYMBOL_GPL(crypto_ahash_type); 253EXPORT_SYMBOL_GPL(crypto_ahash_type);
229 254
255struct crypto_ahash *crypto_alloc_ahash(const char *alg_name, u32 type,
256 u32 mask)
257{
258 return crypto_alloc_tfm(alg_name, &crypto_ahash_type, type, mask);
259}
260EXPORT_SYMBOL_GPL(crypto_alloc_ahash);
261
230MODULE_LICENSE("GPL"); 262MODULE_LICENSE("GPL");
231MODULE_DESCRIPTION("Asynchronous cryptographic hash type"); 263MODULE_DESCRIPTION("Asynchronous cryptographic hash type");
diff --git a/crypto/shash.c b/crypto/shash.c
index 7063e1421504..615a5f4d9b7a 100644
--- a/crypto/shash.c
+++ b/crypto/shash.c
@@ -267,11 +267,11 @@ static void crypto_exit_shash_ops_async(struct crypto_tfm *tfm)
267 crypto_free_shash(*ctx); 267 crypto_free_shash(*ctx);
268} 268}
269 269
270static int crypto_init_shash_ops_async(struct crypto_tfm *tfm) 270int crypto_init_shash_ops_async(struct crypto_tfm *tfm)
271{ 271{
272 struct crypto_alg *calg = tfm->__crt_alg; 272 struct crypto_alg *calg = tfm->__crt_alg;
273 struct shash_alg *alg = __crypto_shash_alg(calg); 273 struct shash_alg *alg = __crypto_shash_alg(calg);
274 struct ahash_tfm *crt = &tfm->crt_ahash; 274 struct crypto_ahash *crt = __crypto_ahash_cast(tfm);
275 struct crypto_shash **ctx = crypto_tfm_ctx(tfm); 275 struct crypto_shash **ctx = crypto_tfm_ctx(tfm);
276 struct crypto_shash *shash; 276 struct crypto_shash *shash;
277 277
@@ -428,8 +428,6 @@ static int crypto_init_shash_ops(struct crypto_tfm *tfm, u32 type, u32 mask)
428 switch (mask & CRYPTO_ALG_TYPE_MASK) { 428 switch (mask & CRYPTO_ALG_TYPE_MASK) {
429 case CRYPTO_ALG_TYPE_HASH_MASK: 429 case CRYPTO_ALG_TYPE_HASH_MASK:
430 return crypto_init_shash_ops_compat(tfm); 430 return crypto_init_shash_ops_compat(tfm);
431 case CRYPTO_ALG_TYPE_AHASH_MASK:
432 return crypto_init_shash_ops_async(tfm);
433 } 431 }
434 432
435 return -EINVAL; 433 return -EINVAL;
@@ -441,8 +439,6 @@ static unsigned int crypto_shash_ctxsize(struct crypto_alg *alg, u32 type,
441 switch (mask & CRYPTO_ALG_TYPE_MASK) { 439 switch (mask & CRYPTO_ALG_TYPE_MASK) {
442 case CRYPTO_ALG_TYPE_HASH_MASK: 440 case CRYPTO_ALG_TYPE_HASH_MASK:
443 return sizeof(struct shash_desc *); 441 return sizeof(struct shash_desc *);
444 case CRYPTO_ALG_TYPE_AHASH_MASK:
445 return sizeof(struct crypto_shash *);
446 } 442 }
447 443
448 return 0; 444 return 0;
diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index fcc02d978231..262861d8f0cb 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -15,6 +15,39 @@
15 15
16#include <linux/crypto.h> 16#include <linux/crypto.h>
17 17
18struct crypto_ahash;
19
20struct hash_alg_common {
21 unsigned int digestsize;
22 unsigned int statesize;
23
24 struct crypto_alg base;
25};
26
27struct ahash_request {
28 struct crypto_async_request base;
29
30 unsigned int nbytes;
31 struct scatterlist *src;
32 u8 *result;
33
34 void *__ctx[] CRYPTO_MINALIGN_ATTR;
35};
36
37struct ahash_alg {
38 int (*init)(struct ahash_request *req);
39 int (*update)(struct ahash_request *req);
40 int (*final)(struct ahash_request *req);
41 int (*finup)(struct ahash_request *req);
42 int (*digest)(struct ahash_request *req);
43 int (*export)(struct ahash_request *req, void *out);
44 int (*import)(struct ahash_request *req, const void *in);
45 int (*setkey)(struct crypto_ahash *tfm, const u8 *key,
46 unsigned int keylen);
47
48 struct hash_alg_common halg;
49};
50
18struct shash_desc { 51struct shash_desc {
19 struct crypto_shash *tfm; 52 struct crypto_shash *tfm;
20 u32 flags; 53 u32 flags;
@@ -37,6 +70,8 @@ struct shash_alg {
37 unsigned int keylen); 70 unsigned int keylen);
38 71
39 unsigned int descsize; 72 unsigned int descsize;
73
74 /* These fields must match hash_alg_common. */
40 unsigned int digestsize; 75 unsigned int digestsize;
41 unsigned int statesize; 76 unsigned int statesize;
42 77
@@ -44,6 +79,18 @@ struct shash_alg {
44}; 79};
45 80
46struct crypto_ahash { 81struct crypto_ahash {
82 int (*init)(struct ahash_request *req);
83 int (*update)(struct ahash_request *req);
84 int (*final)(struct ahash_request *req);
85 int (*finup)(struct ahash_request *req);
86 int (*digest)(struct ahash_request *req);
87 int (*export)(struct ahash_request *req, void *out);
88 int (*import)(struct ahash_request *req, const void *in);
89 int (*setkey)(struct crypto_ahash *tfm, const u8 *key,
90 unsigned int keylen);
91
92 unsigned int digestsize;
93 unsigned int reqsize;
47 struct crypto_tfm base; 94 struct crypto_tfm base;
48}; 95};
49 96
@@ -54,19 +101,11 @@ struct crypto_shash {
54 101
55static inline struct crypto_ahash *__crypto_ahash_cast(struct crypto_tfm *tfm) 102static inline struct crypto_ahash *__crypto_ahash_cast(struct crypto_tfm *tfm)
56{ 103{
57 return (struct crypto_ahash *)tfm; 104 return container_of(tfm, struct crypto_ahash, base);
58} 105}
59 106
60static inline struct crypto_ahash *crypto_alloc_ahash(const char *alg_name, 107struct crypto_ahash *crypto_alloc_ahash(const char *alg_name, u32 type,
61 u32 type, u32 mask) 108 u32 mask);
62{
63 type &= ~CRYPTO_ALG_TYPE_MASK;
64 mask &= ~CRYPTO_ALG_TYPE_MASK;
65 type |= CRYPTO_ALG_TYPE_AHASH;
66 mask |= CRYPTO_ALG_TYPE_AHASH_MASK;
67
68 return __crypto_ahash_cast(crypto_alloc_base(alg_name, type, mask));
69}
70 109
71static inline struct crypto_tfm *crypto_ahash_tfm(struct crypto_ahash *tfm) 110static inline struct crypto_tfm *crypto_ahash_tfm(struct crypto_ahash *tfm)
72{ 111{
@@ -75,7 +114,7 @@ static inline struct crypto_tfm *crypto_ahash_tfm(struct crypto_ahash *tfm)
75 114
76static inline void crypto_free_ahash(struct crypto_ahash *tfm) 115static inline void crypto_free_ahash(struct crypto_ahash *tfm)
77{ 116{
78 crypto_free_tfm(crypto_ahash_tfm(tfm)); 117 crypto_destroy_tfm(tfm, crypto_ahash_tfm(tfm));
79} 118}
80 119
81static inline unsigned int crypto_ahash_alignmask( 120static inline unsigned int crypto_ahash_alignmask(
@@ -84,14 +123,26 @@ static inline unsigned int crypto_ahash_alignmask(
84 return crypto_tfm_alg_alignmask(crypto_ahash_tfm(tfm)); 123 return crypto_tfm_alg_alignmask(crypto_ahash_tfm(tfm));
85} 124}
86 125
87static inline struct ahash_tfm *crypto_ahash_crt(struct crypto_ahash *tfm) 126static inline struct hash_alg_common *__crypto_hash_alg_common(
127 struct crypto_alg *alg)
88{ 128{
89 return &crypto_ahash_tfm(tfm)->crt_ahash; 129 return container_of(alg, struct hash_alg_common, base);
130}
131
132static inline struct hash_alg_common *crypto_hash_alg_common(
133 struct crypto_ahash *tfm)
134{
135 return __crypto_hash_alg_common(crypto_ahash_tfm(tfm)->__crt_alg);
90} 136}
91 137
92static inline unsigned int crypto_ahash_digestsize(struct crypto_ahash *tfm) 138static inline unsigned int crypto_ahash_digestsize(struct crypto_ahash *tfm)
93{ 139{
94 return crypto_ahash_crt(tfm)->digestsize; 140 return tfm->digestsize;
141}
142
143static inline unsigned int crypto_ahash_statesize(struct crypto_ahash *tfm)
144{
145 return crypto_hash_alg_common(tfm)->statesize;
95} 146}
96 147
97static inline u32 crypto_ahash_get_flags(struct crypto_ahash *tfm) 148static inline u32 crypto_ahash_get_flags(struct crypto_ahash *tfm)
@@ -117,7 +168,7 @@ static inline struct crypto_ahash *crypto_ahash_reqtfm(
117 168
118static inline unsigned int crypto_ahash_reqsize(struct crypto_ahash *tfm) 169static inline unsigned int crypto_ahash_reqsize(struct crypto_ahash *tfm)
119{ 170{
120 return crypto_ahash_crt(tfm)->reqsize; 171 return tfm->reqsize;
121} 172}
122 173
123static inline void *ahash_request_ctx(struct ahash_request *req) 174static inline void *ahash_request_ctx(struct ahash_request *req)
@@ -128,41 +179,37 @@ static inline void *ahash_request_ctx(struct ahash_request *req)
128static inline int crypto_ahash_setkey(struct crypto_ahash *tfm, 179static inline int crypto_ahash_setkey(struct crypto_ahash *tfm,
129 const u8 *key, unsigned int keylen) 180 const u8 *key, unsigned int keylen)
130{ 181{
131 struct ahash_tfm *crt = crypto_ahash_crt(tfm); 182 return tfm->setkey(tfm, key, keylen);
132
133 return crt->setkey(tfm, key, keylen);
134} 183}
135 184
136static inline int crypto_ahash_digest(struct ahash_request *req) 185static inline int crypto_ahash_digest(struct ahash_request *req)
137{ 186{
138 struct ahash_tfm *crt = crypto_ahash_crt(crypto_ahash_reqtfm(req)); 187 return crypto_ahash_reqtfm(req)->digest(req);
139 return crt->digest(req);
140} 188}
141 189
142static inline void crypto_ahash_export(struct ahash_request *req, u8 *out) 190static inline int crypto_ahash_export(struct ahash_request *req, void *out)
143{ 191{
144 memcpy(out, ahash_request_ctx(req), 192 return crypto_ahash_reqtfm(req)->export(req, out);
145 crypto_ahash_reqsize(crypto_ahash_reqtfm(req)));
146} 193}
147 194
148int crypto_ahash_import(struct ahash_request *req, const u8 *in); 195static inline int crypto_ahash_import(struct ahash_request *req, const void *in)
196{
197 return crypto_ahash_reqtfm(req)->import(req, in);
198}
149 199
150static inline int crypto_ahash_init(struct ahash_request *req) 200static inline int crypto_ahash_init(struct ahash_request *req)
151{ 201{
152 struct ahash_tfm *crt = crypto_ahash_crt(crypto_ahash_reqtfm(req)); 202 return crypto_ahash_reqtfm(req)->init(req);
153 return crt->init(req);
154} 203}
155 204
156static inline int crypto_ahash_update(struct ahash_request *req) 205static inline int crypto_ahash_update(struct ahash_request *req)
157{ 206{
158 struct ahash_tfm *crt = crypto_ahash_crt(crypto_ahash_reqtfm(req)); 207 return crypto_ahash_reqtfm(req)->update(req);
159 return crt->update(req);
160} 208}
161 209
162static inline int crypto_ahash_final(struct ahash_request *req) 210static inline int crypto_ahash_final(struct ahash_request *req)
163{ 211{
164 struct ahash_tfm *crt = crypto_ahash_crt(crypto_ahash_reqtfm(req)); 212 return crypto_ahash_reqtfm(req)->final(req);
165 return crt->final(req);
166} 213}
167 214
168static inline void ahash_request_set_tfm(struct ahash_request *req, 215static inline void ahash_request_set_tfm(struct ahash_request *req,
diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h
index 5e45818f3351..08bdffafefad 100644
--- a/include/crypto/internal/hash.h
+++ b/include/crypto/internal/hash.h
@@ -51,6 +51,9 @@ int crypto_hash_walk_first_compat(struct hash_desc *hdesc,
51 struct crypto_hash_walk *walk, 51 struct crypto_hash_walk *walk,
52 struct scatterlist *sg, unsigned int len); 52 struct scatterlist *sg, unsigned int len);
53 53
54int crypto_register_ahash(struct ahash_alg *alg);
55int crypto_unregister_ahash(struct ahash_alg *alg);
56
54int crypto_register_shash(struct shash_alg *alg); 57int crypto_register_shash(struct shash_alg *alg);
55int crypto_unregister_shash(struct shash_alg *alg); 58int crypto_unregister_shash(struct shash_alg *alg);
56int shash_register_instance(struct crypto_template *tmpl, 59int shash_register_instance(struct crypto_template *tmpl,
@@ -66,12 +69,14 @@ struct shash_alg *shash_attr_alg(struct rtattr *rta, u32 type, u32 mask);
66int shash_ahash_update(struct ahash_request *req, struct shash_desc *desc); 69int shash_ahash_update(struct ahash_request *req, struct shash_desc *desc);
67int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc); 70int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc);
68 71
72int crypto_init_shash_ops_async(struct crypto_tfm *tfm);
73
69static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm) 74static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm)
70{ 75{
71 return crypto_tfm_ctx(&tfm->base); 76 return crypto_tfm_ctx(crypto_ahash_tfm(tfm));
72} 77}
73 78
74static inline struct ahash_alg *crypto_ahash_alg( 79static inline struct old_ahash_alg *crypto_old_ahash_alg(
75 struct crypto_ahash *tfm) 80 struct crypto_ahash *tfm)
76{ 81{
77 return &crypto_ahash_tfm(tfm)->__crt_alg->cra_ahash; 82 return &crypto_ahash_tfm(tfm)->__crt_alg->cra_ahash;
@@ -80,7 +85,7 @@ static inline struct ahash_alg *crypto_ahash_alg(
80static inline void crypto_ahash_set_reqsize(struct crypto_ahash *tfm, 85static inline void crypto_ahash_set_reqsize(struct crypto_ahash *tfm,
81 unsigned int reqsize) 86 unsigned int reqsize)
82{ 87{
83 crypto_ahash_crt(tfm)->reqsize = reqsize; 88 tfm->reqsize = reqsize;
84} 89}
85 90
86static inline int ahash_enqueue_request(struct crypto_queue *queue, 91static inline int ahash_enqueue_request(struct crypto_queue *queue,
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 274f9c7da90c..9e7e9b62a3dc 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -120,6 +120,7 @@ struct crypto_rng;
120struct crypto_tfm; 120struct crypto_tfm;
121struct crypto_type; 121struct crypto_type;
122struct aead_givcrypt_request; 122struct aead_givcrypt_request;
123struct ahash_request;
123struct skcipher_givcrypt_request; 124struct skcipher_givcrypt_request;
124 125
125typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err); 126typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err);
@@ -146,16 +147,6 @@ struct ablkcipher_request {
146 void *__ctx[] CRYPTO_MINALIGN_ATTR; 147 void *__ctx[] CRYPTO_MINALIGN_ATTR;
147}; 148};
148 149
149struct ahash_request {
150 struct crypto_async_request base;
151
152 unsigned int nbytes;
153 struct scatterlist *src;
154 u8 *result;
155
156 void *__ctx[] CRYPTO_MINALIGN_ATTR;
157};
158
159/** 150/**
160 * struct aead_request - AEAD request 151 * struct aead_request - AEAD request
161 * @base: Common attributes for async crypto requests 152 * @base: Common attributes for async crypto requests
@@ -220,7 +211,7 @@ struct ablkcipher_alg {
220 unsigned int ivsize; 211 unsigned int ivsize;
221}; 212};
222 213
223struct ahash_alg { 214struct old_ahash_alg {
224 int (*init)(struct ahash_request *req); 215 int (*init)(struct ahash_request *req);
225 int (*reinit)(struct ahash_request *req); 216 int (*reinit)(struct ahash_request *req);
226 int (*update)(struct ahash_request *req); 217 int (*update)(struct ahash_request *req);
@@ -346,7 +337,7 @@ struct crypto_alg {
346 struct cipher_alg cipher; 337 struct cipher_alg cipher;
347 struct digest_alg digest; 338 struct digest_alg digest;
348 struct hash_alg hash; 339 struct hash_alg hash;
349 struct ahash_alg ahash; 340 struct old_ahash_alg ahash;
350 struct compress_alg compress; 341 struct compress_alg compress;
351 struct rng_alg rng; 342 struct rng_alg rng;
352 } cra_u; 343 } cra_u;
@@ -433,18 +424,6 @@ struct hash_tfm {
433 unsigned int digestsize; 424 unsigned int digestsize;
434}; 425};
435 426
436struct ahash_tfm {
437 int (*init)(struct ahash_request *req);
438 int (*update)(struct ahash_request *req);
439 int (*final)(struct ahash_request *req);
440 int (*digest)(struct ahash_request *req);
441 int (*setkey)(struct crypto_ahash *tfm, const u8 *key,
442 unsigned int keylen);
443
444 unsigned int digestsize;
445 unsigned int reqsize;
446};
447
448struct compress_tfm { 427struct compress_tfm {
449 int (*cot_compress)(struct crypto_tfm *tfm, 428 int (*cot_compress)(struct crypto_tfm *tfm,
450 const u8 *src, unsigned int slen, 429 const u8 *src, unsigned int slen,
@@ -465,7 +444,6 @@ struct rng_tfm {
465#define crt_blkcipher crt_u.blkcipher 444#define crt_blkcipher crt_u.blkcipher
466#define crt_cipher crt_u.cipher 445#define crt_cipher crt_u.cipher
467#define crt_hash crt_u.hash 446#define crt_hash crt_u.hash
468#define crt_ahash crt_u.ahash
469#define crt_compress crt_u.compress 447#define crt_compress crt_u.compress
470#define crt_rng crt_u.rng 448#define crt_rng crt_u.rng
471 449
@@ -479,7 +457,6 @@ struct crypto_tfm {
479 struct blkcipher_tfm blkcipher; 457 struct blkcipher_tfm blkcipher;
480 struct cipher_tfm cipher; 458 struct cipher_tfm cipher;
481 struct hash_tfm hash; 459 struct hash_tfm hash;
482 struct ahash_tfm ahash;
483 struct compress_tfm compress; 460 struct compress_tfm compress;
484 struct rng_tfm rng; 461 struct rng_tfm rng;
485 } crt_u; 462 } crt_u;