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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMj1kXE618YtdrCg7BRqiD2K4S2x1S7L7gZgS+25WUNM+Q8TFw@mail.gmail.com>
Date:   Mon, 26 Oct 2020 08:59:07 +0100
From:   Ard Biesheuvel <ardb@...nel.org>
To:     Arvind Sankar <nivedita@...m.mit.edu>
Cc:     Herbert Xu <herbert@...dor.apana.org.au>,
        "David S. Miller" <davem@...emloft.net>,
        "linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
        Eric Biggers <ebiggers@...nel.org>,
        David Laight <David.Laight@...lab.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Eric Biggers <ebiggers@...gle.com>
Subject: Re: [PATCH v4 1/6] crypto: lib/sha256 - Use memzero_explicit() for
 clearing state

On Sun, 25 Oct 2020 at 15:31, Arvind Sankar <nivedita@...m.mit.edu> wrote:
>
> Without the barrier_data() inside memzero_explicit(), the compiler may
> optimize away the state-clearing if it can tell that the state is not
> used afterwards. At least in lib/crypto/sha256.c:__sha256_final(), the
> function can get inlined into sha256(), in which case the memset is
> optimized away.
>
> Signed-off-by: Arvind Sankar <nivedita@...m.mit.edu>
> Reviewed-by: Eric Biggers <ebiggers@...gle.com>

Acked-by: Ard Biesheuvel <ardb@...nel.org>

> ---
>  lib/crypto/sha256.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/crypto/sha256.c b/lib/crypto/sha256.c
> index 2321f6cb322f..d43bc39ab05e 100644
> --- a/lib/crypto/sha256.c
> +++ b/lib/crypto/sha256.c
> @@ -265,7 +265,7 @@ static void __sha256_final(struct sha256_state *sctx, u8 *out, int digest_words)
>                 put_unaligned_be32(sctx->state[i], &dst[i]);
>
>         /* Zeroize sensitive information. */
> -       memset(sctx, 0, sizeof(*sctx));
> +       memzero_explicit(sctx, sizeof(*sctx));
>  }
>
>  void sha256_final(struct sha256_state *sctx, u8 *out)
> --
> 2.26.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ