aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2009-07-14 08:29:57 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2009-07-14 08:29:57 -0400
commit500b3e3c3dc8e4845b77ae81e5b7b085ab183ce6 (patch)
tree0cd5ceeab5a085ba017e535b8a232780c0850aaf /crypto
parent4dc10c0142ce0af8c20ec44dc6928ae63ad4f73a (diff)
crypto: ahash - Remove old_ahash_alg
Now that all ahash implementations have been converted to the new ahash type, we can remove old_ahash_alg and its associated support. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/ahash.c27
-rw-r--r--crypto/shash.c2
2 files changed, 0 insertions, 29 deletions
diff --git a/crypto/ahash.c b/crypto/ahash.c
index 7f599d26086a..cc824ef25830 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -175,46 +175,19 @@ static int ahash_nosetkey(struct crypto_ahash *tfm, const u8 *key,
175 return -ENOSYS; 175 return -ENOSYS;
176} 176}
177 177
178static int crypto_init_ahash_ops(struct crypto_tfm *tfm, u32 type, u32 mask)
179{
180 struct old_ahash_alg *alg = &tfm->__crt_alg->cra_ahash;
181 struct crypto_ahash *crt = __crypto_ahash_cast(tfm);
182 struct ahash_alg *nalg = crypto_ahash_alg(crt);
183
184 if (alg->digestsize > PAGE_SIZE / 8)
185 return -EINVAL;
186
187 crt->init = alg->init;
188 crt->update = alg->update;
189 crt->final = alg->final;
190 crt->digest = alg->digest;
191 crt->setkey = alg->setkey ? ahash_setkey : ahash_nosetkey;
192 crt->digestsize = alg->digestsize;
193
194 nalg->setkey = alg->setkey;
195 nalg->halg.digestsize = alg->digestsize;
196
197 return 0;
198}
199
200static int crypto_ahash_init_tfm(struct crypto_tfm *tfm) 178static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
201{ 179{
202 struct crypto_ahash *hash = __crypto_ahash_cast(tfm); 180 struct crypto_ahash *hash = __crypto_ahash_cast(tfm);
203 struct ahash_alg *alg = crypto_ahash_alg(hash); 181 struct ahash_alg *alg = crypto_ahash_alg(hash);
204 struct old_ahash_alg *oalg = crypto_old_ahash_alg(hash);
205 182
206 if (tfm->__crt_alg->cra_type != &crypto_ahash_type) 183 if (tfm->__crt_alg->cra_type != &crypto_ahash_type)
207 return crypto_init_shash_ops_async(tfm); 184 return crypto_init_shash_ops_async(tfm);
208 185
209 if (oalg->init)
210 return crypto_init_ahash_ops(tfm, 0, 0);
211
212 hash->init = alg->init; 186 hash->init = alg->init;
213 hash->update = alg->update; 187 hash->update = alg->update;
214 hash->final = alg->final; 188 hash->final = alg->final;
215 hash->digest = alg->digest; 189 hash->digest = alg->digest;
216 hash->setkey = alg->setkey ? ahash_setkey : ahash_nosetkey; 190 hash->setkey = alg->setkey ? ahash_setkey : ahash_nosetkey;
217 hash->digestsize = alg->halg.digestsize;
218 191
219 return 0; 192 return 0;
220} 193}
diff --git a/crypto/shash.c b/crypto/shash.c
index 615a5f4d9b7a..fd92c03b38fc 100644
--- a/crypto/shash.c
+++ b/crypto/shash.c
@@ -270,7 +270,6 @@ static void crypto_exit_shash_ops_async(struct crypto_tfm *tfm)
270int 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);
274 struct crypto_ahash *crt = __crypto_ahash_cast(tfm); 273 struct crypto_ahash *crt = __crypto_ahash_cast(tfm);
275 struct crypto_shash **ctx = crypto_tfm_ctx(tfm); 274 struct crypto_shash **ctx = crypto_tfm_ctx(tfm);
276 struct crypto_shash *shash; 275 struct crypto_shash *shash;
@@ -293,7 +292,6 @@ int crypto_init_shash_ops_async(struct crypto_tfm *tfm)
293 crt->digest = shash_async_digest; 292 crt->digest = shash_async_digest;
294 crt->setkey = shash_async_setkey; 293 crt->setkey = shash_async_setkey;
295 294
296 crt->digestsize = alg->digestsize;
297 crt->reqsize = sizeof(struct shash_desc) + crypto_shash_descsize(shash); 295 crt->reqsize = sizeof(struct shash_desc) + crypto_shash_descsize(shash);
298 296
299 return 0; 297 return 0;