crypto: amlogic - use kfree_sensitive()
PATCH 1/1 crypto: amlogic - use kfree_sensitive()
Use kfree_sensitive() instead of open-coding it.
Signed-off-by Denis Efremov <[email protected]>
--- drivers/crypto/amlogic/amlogic-gxl-cipher.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/crypto/amlogic/amlogic-gxl-cipher.c +2 -4
@@ -341,8 +341,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); }
@@ -368,8 +367,7 @@ int meson_aes_setkey(struct crypto_skcipher *tfm, const u8 *key,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 );
Signature · 1 line
2.26.2
Quoted 23 lines · Denis Efremov
Use
kfree_sensitive()instead of open-coding it.Signed-off-by Denis Efremov <[email protected]>--- drivers/crypto/amlogic/amlogic-gxl-cipher.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/crypto/amlogic/amlogic-gxl-cipher.c +1
-2@@ -341,8 +341,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); }
drivers/crypto/amlogic/amlogic-gxl-cipher.c int meson_aes_setkey(struct crypto_skcipher *tfm, const u8 *key, · line 373
Quoted 9 lines
drivers/crypto/amlogic/amlogic-gxl-cipher.c +1
-2@@ -368,8 +367,7 @@ int meson_aes_setkey(struct crypto_skcipher *tfm, const u8 *key,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 );
So the {} are no longer necessary.
Same for the "if (op->key)" test since kfree handle NULL.
Thanks