Commit 3749f8ca authored by David S. Miller's avatar David S. Miller

[CRYPTO]: Zero out tfm before freeing in crypto_free_tfm().

Based upon discussions with Ulrich Kuehn
(ukuehn@acm.org)
Signed-off-by: default avatarJames Morris <jmorris@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b7ba1003
......@@ -155,8 +155,12 @@ struct crypto_tfm *crypto_alloc_tfm(const char *name, u32 flags)
void crypto_free_tfm(struct crypto_tfm *tfm)
{
struct crypto_alg *alg = tfm->__crt_alg;
int size = sizeof(*tfm) + alg->cra_ctxsize;
crypto_exit_ops(tfm);
crypto_alg_put(tfm->__crt_alg);
crypto_alg_put(alg);
memset(tfm, 0, size);
kfree(tfm);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment