diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-02-09 08:52:02 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-02-09 08:52:02 -0800 |
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 9975a7bd246..efe77df6863 100644 --- a/crypto/api.c +++ b/crypto/api.c @@ -557,34 +557,34 @@ err: return ERR_PTR(err); } EXPORT_SYMBOL_GPL(crypto_alloc_tfm); - + /* - * crypto_free_tfm - Free crypto transform + * crypto_destroy_tfm - Free crypto transform + * @mem: Start of tfm slab * @tfm: Transform to free * - * crypto_free_tfm() frees up the transform and any associated resources, + * This function frees up the transform and any associated resources, * then drops the refcount on the associated algorithm. */ -void crypto_free_tfm(struct crypto_tfm *tfm) +void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm) { struct crypto_alg *alg; int size; - if (unlikely(!tfm)) + if (unlikely(!mem)) return; alg = tfm->__crt_alg; - size = sizeof(*tfm) + alg->cra_ctxsize; + size = ksize(mem); if (!tfm->exit && alg->cra_exit) alg->cra_exit(tfm); crypto_exit_ops(tfm); crypto_mod_put(alg); - memset(tfm, 0, size); - kfree(tfm); + memset(mem, 0, size); + kfree(mem); } - -EXPORT_SYMBOL_GPL(crypto_free_tfm); +EXPORT_SYMBOL_GPL(crypto_destroy_tfm); int crypto_has_alg(const char *name, u32 type, u32 mask) { |