All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/8] Replace memset() with memzero_explicit()
@ 2021-11-16 11:30 Sandy Harris
  0 siblings, 0 replies; only message in thread
From: Sandy Harris @ 2021-11-16 11:30 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/dh.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/dh.c b/crypto/dh.c
index cd4f32092e5c..ff7dc65b3b41 100644
--- a/crypto/dh.c
+++ b/crypto/dh.c
@@ -25,7 +25,7 @@ static void dh_clear_ctx(struct dh_ctx *ctx)
     mpi_free(ctx->q);
     mpi_free(ctx->g);
     mpi_free(ctx->xa);
-    memset(ctx, 0, sizeof(*ctx));
+    memzero_explicit(ctx, sizeof(*ctx));
 }

 /*
-- 
2.25.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-16 11:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16 11:30 [PATCH 3/8] Replace memset() with memzero_explicit() Sandy Harris

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.