Skip to content

Commit

Permalink
crypto: amlogic - use kfree_sensitive()
Browse files Browse the repository at this point in the history
Use kfree_sensitive() instead of open-coding it.

Signed-off-by: Denis Efremov <efremov@linux.com>
Tested-by: Corentin Labbe <clabbe@baylibre.com>
Acked-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
evdenis authored and herbertx committed Sep 4, 2020
1 parent 5705918 commit ba42fa7
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions drivers/crypto/amlogic/amlogic-gxl-cipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,7 @@ void meson_cipher_exit(struct crypto_tfm *tfm)
{
struct meson_cipher_tfm_ctx *op = crypto_tfm_ctx(tfm);

if (op->key) {
memzero_explicit(op->key, op->keylen);
kfree(op->key);
}
kfree_sensitive(op->key);
crypto_free_skcipher(op->fallback_tfm);
}

Expand All @@ -367,10 +364,7 @@ int meson_aes_setkey(struct crypto_skcipher *tfm, const u8 *key,
dev_dbg(mc->dev, "ERROR: Invalid keylen %u\n", keylen);
return -EINVAL;
}
if (op->key) {
memzero_explicit(op->key, op->keylen);
kfree(op->key);
}
kfree_sensitive(op->key);
op->keylen = keylen;
op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA);
if (!op->key)
Expand Down

0 comments on commit ba42fa7

Please sign in to comment.