Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6425e7b0 authored by Milan Broz's avatar Milan Broz Committed by Greg Kroah-Hartman
Browse files

dm crypt: use memzero_explicit for on-stack buffer



commit 1a71d6ffe18c0d0f03fc8531949cc8ed41d702ee 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 avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3c737ac9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -705,7 +705,7 @@ static int crypt_iv_tcw_whitening(struct crypt_config *cc,
	for (i = 0; i < ((1 << SECTOR_SHIFT) / 8); i++)
		crypto_xor(data + i * 8, buf, 8);
out:
	memset(buf, 0, sizeof(buf));
	memzero_explicit(buf, sizeof(buf));
	return r;
}