lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Tue, 16 Nov 2021 19:34:43 +0800
From:   Sandy Harris <sandyinchina@...il.com>
To:     LKML <linux-kernel@...r.kernel.org>,
        Linux Crypto Mailing List <linux-crypto@...r.kernel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: [PATCH 5/8] Replace memset() with memzero_explicit()

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

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

diff --git a/crypto/shash.c b/crypto/shash.c
index 0a0a50cb694f..f07d06f5da71 100644
--- a/crypto/shash.c
+++ b/crypto/shash.c
@@ -112,7 +112,7 @@ static int shash_update_unaligned(struct
shash_desc *desc, const u8 *data,

     memcpy(buf, data, unaligned_len);
     err = shash->update(desc, buf, unaligned_len);
-    memset(buf, 0, unaligned_len);
+    memzero_explicit(buf, unaligned_len);

     return err ?:
            shash->update(desc, data + unaligned_len, len - unaligned_len);
@@ -156,7 +156,7 @@ static int shash_final_unaligned(struct shash_desc
*desc, u8 *out)
     memcpy(out, buf, ds);

 out:
-    memset(buf, 0, ds);
+    memzero_explicit(buf, ds);
     return err;
 }

-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ