diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-02-09 11:52:02 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-02-09 11:52:02 -0500 |
commit | d7c41b616518457e3bfece12e3f59f15d7450eeb (patch) | |
tree | 0c4031ec93d59176d5ce1aa4a296be5a0784f14f /crypto/api.c | |
parent | a8e807f7607ab633de7be4e2f4c350923cc2cb63 (diff) | |
parent | 4f3e797ad07d52d34983354a77b365dfcd48c1b4 (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:
crypto: scatterwalk - Avoid flush_dcache_page on slab pages
crypto: shash - Fix tfm destruction
crypto: api - Fix zeroing on free
crypto: shash - Fix module refcount
crypto: api - Fix algorithm test race that broke aead initialisation
Diffstat (limited to 'crypto/api.c')
-rw-r--r-- | crypto/api.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/crypto/api.c b/crypto/api.c index 9975a7bd246c..efe77df6863f 100644 --- a/crypto/api.c +++ b/crypto/api.c | |||
@@ -557,34 +557,34 @@ err: | |||
557 | return ERR_PTR(err); | 557 | return ERR_PTR(err); |
558 | } | 558 | } |
559 | EXPORT_SYMBOL_GPL(crypto_alloc_tfm); | 559 | EXPORT_SYMBOL_GPL(crypto_alloc_tfm); |
560 | 560 | ||
561 | /* | 561 | /* |
562 | * crypto_free_tfm - Free crypto transform | 562 | * crypto_destroy_tfm - Free crypto transform |
563 | * @mem: Start of tfm slab | ||
563 | * @tfm: Transform to free | 564 | * @tfm: Transform to free |
564 | * | 565 | * |
565 | * crypto_free_tfm() frees up the transform and any associated resources, | 566 | * This function frees up the transform and any associated resources, |
566 | * then drops the refcount on the associated algorithm. | 567 | * then drops the refcount on the associated algorithm. |
567 | */ | 568 | */ |
568 | void crypto_free_tfm(struct crypto_tfm *tfm) | 569 | void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm) |
569 | { | 570 | { |
570 | struct crypto_alg *alg; | 571 | struct crypto_alg *alg; |
571 | int size; | 572 | int size; |
572 | 573 | ||
573 | if (unlikely(!tfm)) | 574 | if (unlikely(!mem)) |
574 | return; | 575 | return; |
575 | 576 | ||
576 | alg = tfm->__crt_alg; | 577 | alg = tfm->__crt_alg; |
577 | size = sizeof(*tfm) + alg->cra_ctxsize; | 578 | size = ksize(mem); |
578 | 579 | ||
579 | if (!tfm->exit && alg->cra_exit) | 580 | if (!tfm->exit && alg->cra_exit) |
580 | alg->cra_exit(tfm); | 581 | alg->cra_exit(tfm); |
581 | crypto_exit_ops(tfm); | 582 | crypto_exit_ops(tfm); |
582 | crypto_mod_put(alg); | 583 | crypto_mod_put(alg); |
583 | memset(tfm, 0, size); | 584 | memset(mem, 0, size); |
584 | kfree(tfm); | 585 | kfree(mem); |
585 | } | 586 | } |
586 | 587 | EXPORT_SYMBOL_GPL(crypto_destroy_tfm); | |
587 | EXPORT_SYMBOL_GPL(crypto_free_tfm); | ||
588 | 588 | ||
589 | int crypto_has_alg(const char *name, u32 type, u32 mask) | 589 | int crypto_has_alg(const char *name, u32 type, u32 mask) |
590 | { | 590 | { |