summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/amlogic/amlogic-gxl-cipher.c
diff options
context:
space:
mode:
authorDenis Efremov <efremov@linux.com>2020-08-27 08:44:00 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2020-09-04 09:57:16 +0200
commitba42fa77efa1248eb44407bb212793548e2e32ec (patch)
tree3ab987e9bc4ac9a3d9e9c08807b5eaf39122cfcd /drivers/crypto/amlogic/amlogic-gxl-cipher.c
parentcrypto: inside-secure - use kfree_sensitive() (diff)
downloadlinux-ba42fa77efa1248eb44407bb212793548e2e32ec.tar.xz
linux-ba42fa77efa1248eb44407bb212793548e2e32ec.zip
crypto: amlogic - use kfree_sensitive()
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>
Diffstat (limited to 'drivers/crypto/amlogic/amlogic-gxl-cipher.c')
-rw-r--r--drivers/crypto/amlogic/amlogic-gxl-cipher.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/crypto/amlogic/amlogic-gxl-cipher.c b/drivers/crypto/amlogic/amlogic-gxl-cipher.c
index d93210726697..ee5998af2fe8 100644
--- a/drivers/crypto/amlogic/amlogic-gxl-cipher.c
+++ b/drivers/crypto/amlogic/amlogic-gxl-cipher.c
@@ -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);
}
@@ -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)