Commit 20c3e542 authored by Milan Broz's avatar Milan Broz Committed by Luis Henriques

dm crypt: use memzero_explicit for on-stack buffer

commit 1a71d6ff upstream.

Use memzero_explicit to cleanup sensitive data allocated on stack
to prevent the compiler from optimizing and removing memset() calls.
Signed-off-by: default avatarMilan Broz <gmazyland@gmail.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 39e0f2aa
...@@ -709,7 +709,7 @@ static int crypt_iv_tcw_whitening(struct crypt_config *cc, ...@@ -709,7 +709,7 @@ static int crypt_iv_tcw_whitening(struct crypt_config *cc,
for (i = 0; i < ((1 << SECTOR_SHIFT) / 8); i++) for (i = 0; i < ((1 << SECTOR_SHIFT) / 8); i++)
crypto_xor(data + i * 8, buf, 8); crypto_xor(data + i * 8, buf, 8);
out: out:
memset(buf, 0, sizeof(buf)); memzero_explicit(buf, sizeof(buf));
return r; return r;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment