linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/8] Replace memset() with memzero_explicit()
@ 2021-11-16 11:25 Sandy Harris
  2021-11-16 11:49 ` Greg Kroah-Hartman
  2021-11-16 11:50 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 6+ messages in thread
From: Sandy Harris @ 2021-11-16 11:25 UTC (permalink / raw)
  To: LKML, Linux Crypto Mailing List, David S. Miller, Herbert Xu,
	Greg Kroah-Hartman

Replace memset(address,0,bytes) which may be optimised away
with memzero_explicit(address,bytes) which resists
such optimisation

---
 crypto/des_generic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/crypto/des_generic.c b/crypto/des_generic.c
index c85354a5e94c..105a32e7afea 100644
--- a/crypto/des_generic.c
+++ b/crypto/des_generic.c
@@ -30,7 +30,7 @@ static int des_setkey(struct crypto_tfm *tfm, const u8 *key,
             err = 0;
     }
     if (err)
-        memset(dctx, 0, sizeof(*dctx));
+        memzero_explicit(dctx, sizeof(*dctx));
     return err;
 }

@@ -62,7 +62,7 @@ static int des3_ede_setkey(struct crypto_tfm *tfm,
const u8 *key,
             err = 0;
     }
     if (err)
-        memset(dctx, 0, sizeof(*dctx));
+        memzero_explicit(dctx, sizeof(*dctx));
     return err;
 }

--

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-11-17  6:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16 11:25 [PATCH 1/8] Replace memset() with memzero_explicit() Sandy Harris
2021-11-16 11:49 ` Greg Kroah-Hartman
2021-11-16 11:50 ` Greg Kroah-Hartman
2021-11-16 12:52   ` Greg Kroah-Hartman
2021-11-17  3:08   ` Sandy Harris
2021-11-17  6:01     ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).