Commit ba42fa77 authored by Denis Efremov's avatar Denis Efremov Committed by Herbert Xu

crypto: amlogic - use kfree_sensitive()

Use kfree_sensitive() instead of open-coding it.
Signed-off-by: default avatarDenis Efremov <efremov@linux.com>
Tested-by: default avatarCorentin Labbe <clabbe@baylibre.com>
Acked-by: default avatarCorentin Labbe <clabbe@baylibre.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 57059185
...@@ -340,10 +340,7 @@ void meson_cipher_exit(struct crypto_tfm *tfm) ...@@ -340,10 +340,7 @@ void meson_cipher_exit(struct crypto_tfm *tfm)
{ {
struct meson_cipher_tfm_ctx *op = crypto_tfm_ctx(tfm); struct meson_cipher_tfm_ctx *op = crypto_tfm_ctx(tfm);
if (op->key) { kfree_sensitive(op->key);
memzero_explicit(op->key, op->keylen);
kfree(op->key);
}
crypto_free_skcipher(op->fallback_tfm); crypto_free_skcipher(op->fallback_tfm);
} }
...@@ -367,10 +364,7 @@ int meson_aes_setkey(struct crypto_skcipher *tfm, const u8 *key, ...@@ -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); dev_dbg(mc->dev, "ERROR: Invalid keylen %u\n", keylen);
return -EINVAL; return -EINVAL;
} }
if (op->key) { kfree_sensitive(op->key);
memzero_explicit(op->key, op->keylen);
kfree(op->key);
}
op->keylen = keylen; op->keylen = keylen;
op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA); op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA);
if (!op->key) if (!op->key)
......
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