aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-03-05 13:47:57 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-05 13:47:57 -0500
commit586fac13f8685bf9dfb32e1ee98bfb14f0dd0061 (patch)
tree6fe7df764a4298a15967139b8f2c69f88d5e22fc /crypto
parent1f63b9c15b17d5af360c180f5c71537e954d5d3b (diff)
parent74781387822cd7a549123ae2b35862bf802689be (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: padata: Allocate the cpumask for the padata instance crypto: authenc - Move saved IV in front of the ablkcipher request crypto: hash - Fix handling of unaligned buffers crypto: authenc - Use correct ahash complete functions crypto: md5 - Set statesize
Diffstat (limited to 'crypto')
-rw-r--r--crypto/ahash.c1
-rw-r--r--crypto/authenc.c27
-rw-r--r--crypto/md5.c1
3 files changed, 16 insertions, 13 deletions
diff --git a/crypto/ahash.c b/crypto/ahash.c
index 33a4ff45f842..b8c59b889c6e 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -78,7 +78,6 @@ int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err)
78 walk->data -= walk->offset; 78 walk->data -= walk->offset;
79 79
80 if (nbytes && walk->offset & alignmask && !err) { 80 if (nbytes && walk->offset & alignmask && !err) {
81 walk->offset += alignmask - 1;
82 walk->offset = ALIGN(walk->offset, alignmask + 1); 81 walk->offset = ALIGN(walk->offset, alignmask + 1);
83 walk->data += walk->offset; 82 walk->data += walk->offset;
84 83
diff --git a/crypto/authenc.c b/crypto/authenc.c
index 18870906ea06..2bb7348d8d55 100644
--- a/crypto/authenc.c
+++ b/crypto/authenc.c
@@ -386,11 +386,13 @@ static int crypto_authenc_encrypt(struct aead_request *req)
386{ 386{
387 struct crypto_aead *authenc = crypto_aead_reqtfm(req); 387 struct crypto_aead *authenc = crypto_aead_reqtfm(req);
388 struct crypto_authenc_ctx *ctx = crypto_aead_ctx(authenc); 388 struct crypto_authenc_ctx *ctx = crypto_aead_ctx(authenc);
389 struct ablkcipher_request *abreq = aead_request_ctx(req); 389 struct authenc_request_ctx *areq_ctx = aead_request_ctx(req);
390 struct crypto_ablkcipher *enc = ctx->enc; 390 struct crypto_ablkcipher *enc = ctx->enc;
391 struct scatterlist *dst = req->dst; 391 struct scatterlist *dst = req->dst;
392 unsigned int cryptlen = req->cryptlen; 392 unsigned int cryptlen = req->cryptlen;
393 u8 *iv = (u8 *)(abreq + 1) + crypto_ablkcipher_reqsize(enc); 393 struct ablkcipher_request *abreq = (void *)(areq_ctx->tail
394 + ctx->reqoff);
395 u8 *iv = (u8 *)abreq - crypto_ablkcipher_ivsize(enc);
394 int err; 396 int err;
395 397
396 ablkcipher_request_set_tfm(abreq, enc); 398 ablkcipher_request_set_tfm(abreq, enc);
@@ -454,7 +456,7 @@ static int crypto_authenc_verify(struct aead_request *req,
454 unsigned int authsize; 456 unsigned int authsize;
455 457
456 areq_ctx->complete = authenc_verify_ahash_done; 458 areq_ctx->complete = authenc_verify_ahash_done;
457 areq_ctx->complete = authenc_verify_ahash_update_done; 459 areq_ctx->update_complete = authenc_verify_ahash_update_done;
458 460
459 ohash = authenc_ahash_fn(req, CRYPTO_TFM_REQ_MAY_SLEEP); 461 ohash = authenc_ahash_fn(req, CRYPTO_TFM_REQ_MAY_SLEEP);
460 if (IS_ERR(ohash)) 462 if (IS_ERR(ohash))
@@ -546,10 +548,6 @@ static int crypto_authenc_init_tfm(struct crypto_tfm *tfm)
546 if (IS_ERR(auth)) 548 if (IS_ERR(auth))
547 return PTR_ERR(auth); 549 return PTR_ERR(auth);
548 550
549 ctx->reqoff = ALIGN(2 * crypto_ahash_digestsize(auth) +
550 crypto_ahash_alignmask(auth),
551 crypto_ahash_alignmask(auth) + 1);
552
553 enc = crypto_spawn_skcipher(&ictx->enc); 551 enc = crypto_spawn_skcipher(&ictx->enc);
554 err = PTR_ERR(enc); 552 err = PTR_ERR(enc);
555 if (IS_ERR(enc)) 553 if (IS_ERR(enc))
@@ -558,13 +556,18 @@ static int crypto_authenc_init_tfm(struct crypto_tfm *tfm)
558 ctx->auth = auth; 556 ctx->auth = auth;
559 ctx->enc = enc; 557 ctx->enc = enc;
560 558
561 tfm->crt_aead.reqsize = max_t(unsigned int, 559 ctx->reqoff = ALIGN(2 * crypto_ahash_digestsize(auth) +
562 crypto_ahash_reqsize(auth) + ctx->reqoff + 560 crypto_ahash_alignmask(auth),
563 sizeof(struct authenc_request_ctx) + 561 crypto_ahash_alignmask(auth) + 1) +
562 crypto_ablkcipher_ivsize(enc);
563
564 tfm->crt_aead.reqsize = sizeof(struct authenc_request_ctx) +
565 ctx->reqoff +
566 max_t(unsigned int,
567 crypto_ahash_reqsize(auth) +
564 sizeof(struct ahash_request), 568 sizeof(struct ahash_request),
565 sizeof(struct skcipher_givcrypt_request) + 569 sizeof(struct skcipher_givcrypt_request) +
566 crypto_ablkcipher_reqsize(enc) + 570 crypto_ablkcipher_reqsize(enc));
567 crypto_ablkcipher_ivsize(enc));
568 571
569 return 0; 572 return 0;
570 573
diff --git a/crypto/md5.c b/crypto/md5.c
index 9fda213a592e..30efc7dad891 100644
--- a/crypto/md5.c
+++ b/crypto/md5.c
@@ -234,6 +234,7 @@ static struct shash_alg alg = {
234 .export = md5_export, 234 .export = md5_export,
235 .import = md5_import, 235 .import = md5_import,
236 .descsize = sizeof(struct md5_state), 236 .descsize = sizeof(struct md5_state),
237 .statesize = sizeof(struct md5_state),
237 .base = { 238 .base = {
238 .cra_name = "md5", 239 .cra_name = "md5",
239 .cra_flags = CRYPTO_ALG_TYPE_SHASH, 240 .cra_flags = CRYPTO_ALG_TYPE_SHASH,