diff options
-rw-r--r-- | crypto/ahash.c | 1 | ||||
-rw-r--r-- | crypto/authenc.c | 27 | ||||
-rw-r--r-- | crypto/md5.c | 1 | ||||
-rw-r--r-- | kernel/padata.c | 8 |
4 files changed, 23 insertions, 14 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, |
diff --git a/kernel/padata.c b/kernel/padata.c index 6f9bcb8313d6..93caf65ff57c 100644 --- a/kernel/padata.c +++ b/kernel/padata.c | |||
@@ -642,6 +642,9 @@ struct padata_instance *padata_alloc(const struct cpumask *cpumask, | |||
642 | if (!pd) | 642 | if (!pd) |
643 | goto err_free_inst; | 643 | goto err_free_inst; |
644 | 644 | ||
645 | if (!alloc_cpumask_var(&pinst->cpumask, GFP_KERNEL)) | ||
646 | goto err_free_pd; | ||
647 | |||
645 | rcu_assign_pointer(pinst->pd, pd); | 648 | rcu_assign_pointer(pinst->pd, pd); |
646 | 649 | ||
647 | pinst->wq = wq; | 650 | pinst->wq = wq; |
@@ -654,12 +657,14 @@ struct padata_instance *padata_alloc(const struct cpumask *cpumask, | |||
654 | pinst->cpu_notifier.priority = 0; | 657 | pinst->cpu_notifier.priority = 0; |
655 | err = register_hotcpu_notifier(&pinst->cpu_notifier); | 658 | err = register_hotcpu_notifier(&pinst->cpu_notifier); |
656 | if (err) | 659 | if (err) |
657 | goto err_free_pd; | 660 | goto err_free_cpumask; |
658 | 661 | ||
659 | mutex_init(&pinst->lock); | 662 | mutex_init(&pinst->lock); |
660 | 663 | ||
661 | return pinst; | 664 | return pinst; |
662 | 665 | ||
666 | err_free_cpumask: | ||
667 | free_cpumask_var(pinst->cpumask); | ||
663 | err_free_pd: | 668 | err_free_pd: |
664 | padata_free_pd(pd); | 669 | padata_free_pd(pd); |
665 | err_free_inst: | 670 | err_free_inst: |
@@ -685,6 +690,7 @@ void padata_free(struct padata_instance *pinst) | |||
685 | 690 | ||
686 | unregister_hotcpu_notifier(&pinst->cpu_notifier); | 691 | unregister_hotcpu_notifier(&pinst->cpu_notifier); |
687 | padata_free_pd(pinst->pd); | 692 | padata_free_pd(pinst->pd); |
693 | free_cpumask_var(pinst->cpumask); | ||
688 | kfree(pinst); | 694 | kfree(pinst); |
689 | } | 695 | } |
690 | EXPORT_SYMBOL(padata_free); | 696 | EXPORT_SYMBOL(padata_free); |