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