summaryrefslogtreecommitdiffstats
path: root/lib/crypto
diff options
context:
space:
mode:
authorArvind Sankar <nivedita@alum.mit.edu>2020-10-25 15:31:16 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2020-10-30 07:35:03 +0100
commit7a4295f6c9d54e082474667e552a227606b4a085 (patch)
treeda2fb5872e4168587e56f48db779edb216286d5c /lib/crypto
parentcrypto: hash - Use memzero_explicit() for clearing state (diff)
downloadlinux-7a4295f6c9d54e082474667e552a227606b4a085.tar.xz
linux-7a4295f6c9d54e082474667e552a227606b4a085.zip
crypto: lib/sha256 - Don't clear temporary variables
The assignments to clear a through h and t1/t2 are optimized out by the compiler because they are unused after the assignments. Clearing individual scalar variables is unlikely to be useful, as they may have been assigned to registers, and even if stack spilling was required, there may be compiler-generated temporaries that are impossible to clear in any case. So drop the clearing of a through h and t1/t2. Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu> Reviewed-by: Eric Biggers <ebiggers@google.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'lib/crypto')
-rw-r--r--lib/crypto/sha256.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/lib/crypto/sha256.c b/lib/crypto/sha256.c
index d43bc39ab05e..099cd11f83c1 100644
--- a/lib/crypto/sha256.c
+++ b/lib/crypto/sha256.c
@@ -202,7 +202,6 @@ static void sha256_transform(u32 *state, const u8 *input)
state[4] += e; state[5] += f; state[6] += g; state[7] += h;
/* clear any sensitive info... */
- a = b = c = d = e = f = g = h = t1 = t2 = 0;
memzero_explicit(W, 64 * sizeof(u32));
}