From: David Sterba <dsterba@suse.cz>
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Thomas Gleixner <tglx@linutronix.de>,
dborkman@redhat.com, herbert@gondor.apana.org.au,
kernel-janitors@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, linux-kernel@vger.kernel.org,
Julia Lawall <julia@diku.dk>
Subject: Re: [PATCH 1/8] purgatory/sha256: replace memset by memzero_explicit
Date: Mon, 1 Dec 2014 16:20:48 +0100 [thread overview]
Message-ID: <20141201152047.GG12140@twin.jikos.cz> (raw)
In-Reply-To: <1417366774-32412-2-git-send-email-Julia.Lawall@lip6.fr>
On Sun, Nov 30, 2014 at 05:59:27PM +0100, Julia Lawall wrote:
> @@ -205,7 +205,7 @@ static void sha256_transform(u32 *state, const u8 *input)
>
> /* clear any sensitive info... */
> a = b = c = d = e = f = g = h = t1 = t2 = 0;
All of these get optimized away.
How to clear them effectively is another question. Setting them one by
one casting to volatile would generate 10 instructions. Although this
might be quick as there are no dependencies, the function
sha256_transform is called repeatedly and the small overhead may add up.
Other attempts to fix it require restructuring the code so all the
variables are eg. stored in an array that gets cleared in one go. Here
the indirect access could be hidden into the macros (e0, e1, s0, s1).
> - memset(W, 0, 64 * sizeof(u32));
> + memzero_explicit(W, 64 * sizeof(u32));
next prev parent reply other threads:[~2014-12-01 15:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-30 16:59 [PATCH 0/8] " Julia Lawall
2014-11-30 16:59 ` [PATCH 1/8] purgatory/sha256: " Julia Lawall
2014-12-01 15:20 ` David Sterba [this message]
2014-11-30 16:59 ` [PATCH 2/8] sparc64: " Julia Lawall
2014-11-30 16:59 ` [PATCH 3/8] crypto: " Julia Lawall
2014-11-30 16:59 ` [PATCH 4/8] cifs: " Julia Lawall
2014-11-30 16:59 ` [PATCH 5/8] dm: " Julia Lawall
2014-11-30 16:59 ` [PATCH 6/8] crypto: " Julia Lawall
2014-11-30 16:59 ` [PATCH 7/8] " Julia Lawall
2014-11-30 16:59 ` [PATCH 8/8] wusb: " Julia Lawall
2014-12-03 0:14 ` Greg Kroah-Hartman
2014-12-03 0:18 ` Daniel Borkmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141201152047.GG12140@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=Julia.Lawall@lip6.fr \
--cc=dborkman@redhat.com \
--cc=herbert@gondor.apana.org.au \
--cc=hpa@zytor.com \
--cc=julia@diku.dk \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®