diff mbox series

crypto: sun8i-ss - remove redundant memzero_explicit()

Message ID 20200827074023.15565-1-efremov@linux.com (mailing list archive)
State Superseded
Delegated to: Herbert Xu
Headers show
Series crypto: sun8i-ss - remove redundant memzero_explicit() | expand

Commit Message

Denis Efremov (Oracle) Aug. 27, 2020, 7:40 a.m. UTC
Remove redundant memzero_explicit() in sun8i_ss_cipher() before calling
kfree_sensitive(). kfree_sensitive() will zero the memory with
memzero_explicit().

Signed-off-by: Denis Efremov <efremov@linux.com>
---
 drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Corentin Labbe Aug. 27, 2020, 8:03 a.m. UTC | #1
On Thu, Aug 27, 2020 at 10:40:23AM +0300, Denis Efremov wrote:
> Remove redundant memzero_explicit() in sun8i_ss_cipher() before calling
> kfree_sensitive(). kfree_sensitive() will zero the memory with
> memzero_explicit().
> 
> Signed-off-by: Denis Efremov <efremov@linux.com>
> ---
>  drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c
> index deb8b39a86db..ed2a69f82e1c 100644
> --- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c
> +++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c
> @@ -248,7 +248,6 @@ static int sun8i_ss_cipher(struct skcipher_request *areq)
>  			offset = areq->cryptlen - ivsize;
>  			if (rctx->op_dir & SS_DECRYPTION) {
>  				memcpy(areq->iv, backup_iv, ivsize);
> -				memzero_explicit(backup_iv, ivsize);
>  				kfree_sensitive(backup_iv);
>  			} else {
>  				scatterwalk_map_and_copy(areq->iv, areq->dst, offset,
> -- 
> 2.26.2
> 

Hello

Could you add:
Fixes: 453431a54934 ("mm, treewide: rename kzfree() to kfree_sensitive()")

Regards
Denis Efremov (Oracle) Aug. 27, 2020, 12:12 p.m. UTC | #2
On 8/27/20 11:03 AM, Corentin Labbe wrote:
> Could you add:
> Fixes: 453431a54934 ("mm, treewide: rename kzfree() to kfree_sensitive()")

I doubt this change deserves fixes tag, since this is just a cleanup.
Anyway, I will send v2 with it.

Thanks,
Denis
diff mbox series

Patch

diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c
index deb8b39a86db..ed2a69f82e1c 100644
--- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c
+++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c
@@ -248,7 +248,6 @@  static int sun8i_ss_cipher(struct skcipher_request *areq)
 			offset = areq->cryptlen - ivsize;
 			if (rctx->op_dir & SS_DECRYPTION) {
 				memcpy(areq->iv, backup_iv, ivsize);
-				memzero_explicit(backup_iv, ivsize);
 				kfree_sensitive(backup_iv);
 			} else {
 				scatterwalk_map_and_copy(areq->iv, areq->dst, offset,