]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: lib/sha256 - Use memzero_explicit() for clearing state
authorArvind Sankar <nivedita@alum.mit.edu>
Sun, 25 Oct 2020 14:31:14 +0000 (10:31 -0400)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 30 Oct 2020 06:35:03 +0000 (17:35 +1100)
commitc7a25264078cb0969441c69f8310514c1eb7de82
tree09fd538f8085ed4d5f944eaa50eaabb6177fa9e9
parentdb482001dfcfd69a8315c407b3319f7a9c59b61b
crypto: lib/sha256 - Use memzero_explicit() for clearing state

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@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>
lib/crypto/sha256.c