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

+23 -14
-1
crypto/ahash.c
··· 78 walk->data -= walk->offset; 79 80 if (nbytes && walk->offset & alignmask && !err) { 81 - walk->offset += alignmask - 1; 82 walk->offset = ALIGN(walk->offset, alignmask + 1); 83 walk->data += walk->offset; 84
··· 78 walk->data -= walk->offset; 79 80 if (nbytes && walk->offset & alignmask && !err) { 81 walk->offset = ALIGN(walk->offset, alignmask + 1); 82 walk->data += walk->offset; 83
+15 -12
crypto/authenc.c
··· 386 { 387 struct crypto_aead *authenc = crypto_aead_reqtfm(req); 388 struct crypto_authenc_ctx *ctx = crypto_aead_ctx(authenc); 389 - struct ablkcipher_request *abreq = aead_request_ctx(req); 390 struct crypto_ablkcipher *enc = ctx->enc; 391 struct scatterlist *dst = req->dst; 392 unsigned int cryptlen = req->cryptlen; 393 - u8 *iv = (u8 *)(abreq + 1) + crypto_ablkcipher_reqsize(enc); 394 int err; 395 396 ablkcipher_request_set_tfm(abreq, enc); ··· 456 unsigned int authsize; 457 458 areq_ctx->complete = authenc_verify_ahash_done; 459 - areq_ctx->complete = authenc_verify_ahash_update_done; 460 461 ohash = authenc_ahash_fn(req, CRYPTO_TFM_REQ_MAY_SLEEP); 462 if (IS_ERR(ohash)) ··· 548 if (IS_ERR(auth)) 549 return PTR_ERR(auth); 550 551 - ctx->reqoff = ALIGN(2 * crypto_ahash_digestsize(auth) + 552 - crypto_ahash_alignmask(auth), 553 - crypto_ahash_alignmask(auth) + 1); 554 - 555 enc = crypto_spawn_skcipher(&ictx->enc); 556 err = PTR_ERR(enc); 557 if (IS_ERR(enc)) ··· 556 ctx->auth = auth; 557 ctx->enc = enc; 558 559 - tfm->crt_aead.reqsize = max_t(unsigned int, 560 - crypto_ahash_reqsize(auth) + ctx->reqoff + 561 - sizeof(struct authenc_request_ctx) + 562 sizeof(struct ahash_request), 563 sizeof(struct skcipher_givcrypt_request) + 564 - crypto_ablkcipher_reqsize(enc) + 565 - crypto_ablkcipher_ivsize(enc)); 566 567 return 0; 568
··· 386 { 387 struct crypto_aead *authenc = crypto_aead_reqtfm(req); 388 struct crypto_authenc_ctx *ctx = crypto_aead_ctx(authenc); 389 + struct authenc_request_ctx *areq_ctx = aead_request_ctx(req); 390 struct crypto_ablkcipher *enc = ctx->enc; 391 struct scatterlist *dst = req->dst; 392 unsigned int cryptlen = req->cryptlen; 393 + struct ablkcipher_request *abreq = (void *)(areq_ctx->tail 394 + + ctx->reqoff); 395 + u8 *iv = (u8 *)abreq - crypto_ablkcipher_ivsize(enc); 396 int err; 397 398 ablkcipher_request_set_tfm(abreq, enc); ··· 454 unsigned int authsize; 455 456 areq_ctx->complete = authenc_verify_ahash_done; 457 + areq_ctx->update_complete = authenc_verify_ahash_update_done; 458 459 ohash = authenc_ahash_fn(req, CRYPTO_TFM_REQ_MAY_SLEEP); 460 if (IS_ERR(ohash)) ··· 546 if (IS_ERR(auth)) 547 return PTR_ERR(auth); 548 549 enc = crypto_spawn_skcipher(&ictx->enc); 550 err = PTR_ERR(enc); 551 if (IS_ERR(enc)) ··· 558 ctx->auth = auth; 559 ctx->enc = enc; 560 561 + ctx->reqoff = ALIGN(2 * crypto_ahash_digestsize(auth) + 562 + crypto_ahash_alignmask(auth), 563 + crypto_ahash_alignmask(auth) + 1) + 564 + crypto_ablkcipher_ivsize(enc); 565 + 566 + tfm->crt_aead.reqsize = sizeof(struct authenc_request_ctx) + 567 + ctx->reqoff + 568 + max_t(unsigned int, 569 + crypto_ahash_reqsize(auth) + 570 sizeof(struct ahash_request), 571 sizeof(struct skcipher_givcrypt_request) + 572 + crypto_ablkcipher_reqsize(enc)); 573 574 return 0; 575
+1
crypto/md5.c
··· 234 .export = md5_export, 235 .import = md5_import, 236 .descsize = sizeof(struct md5_state), 237 .base = { 238 .cra_name = "md5", 239 .cra_flags = CRYPTO_ALG_TYPE_SHASH,
··· 234 .export = md5_export, 235 .import = md5_import, 236 .descsize = sizeof(struct md5_state), 237 + .statesize = sizeof(struct md5_state), 238 .base = { 239 .cra_name = "md5", 240 .cra_flags = CRYPTO_ALG_TYPE_SHASH,
+7 -1
kernel/padata.c
··· 642 if (!pd) 643 goto err_free_inst; 644 645 rcu_assign_pointer(pinst->pd, pd); 646 647 pinst->wq = wq; ··· 657 pinst->cpu_notifier.priority = 0; 658 err = register_hotcpu_notifier(&pinst->cpu_notifier); 659 if (err) 660 - goto err_free_pd; 661 662 mutex_init(&pinst->lock); 663 664 return pinst; 665 666 err_free_pd: 667 padata_free_pd(pd); 668 err_free_inst: ··· 690 691 unregister_hotcpu_notifier(&pinst->cpu_notifier); 692 padata_free_pd(pinst->pd); 693 kfree(pinst); 694 } 695 EXPORT_SYMBOL(padata_free);
··· 642 if (!pd) 643 goto err_free_inst; 644 645 + if (!alloc_cpumask_var(&pinst->cpumask, GFP_KERNEL)) 646 + goto err_free_pd; 647 + 648 rcu_assign_pointer(pinst->pd, pd); 649 650 pinst->wq = wq; ··· 654 pinst->cpu_notifier.priority = 0; 655 err = register_hotcpu_notifier(&pinst->cpu_notifier); 656 if (err) 657 + goto err_free_cpumask; 658 659 mutex_init(&pinst->lock); 660 661 return pinst; 662 663 + err_free_cpumask: 664 + free_cpumask_var(pinst->cpumask); 665 err_free_pd: 666 padata_free_pd(pd); 667 err_free_inst: ··· 685 686 unregister_hotcpu_notifier(&pinst->cpu_notifier); 687 padata_free_pd(pinst->pd); 688 + free_cpumask_var(pinst->cpumask); 689 kfree(pinst); 690 } 691 EXPORT_SYMBOL(padata_free);