dm integrity: fail early if required HMAC key is not available
authorMilan Broz <gmazyland@gmail.com>
Tue, 13 Feb 2018 13:50:50 +0000 (14:50 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Nov 2018 13:52:42 +0000 (14:52 +0100)
commit4fbd26a1484c5819208b87e54d35515fd678a140
treeb4e71fa4f720aa4dfefcdb85c12e99b6b0f12fb6
parentaa2a0c23c9b7e6fb17db4c77cbe0967512f5d274
dm integrity: fail early if required HMAC key is not available

[ Upstream commit e16b4f99f0f79682a7efe191a8ce694d87ca9fc8 ]

Since crypto API commit 9fa68f62004 ("crypto: hash - prevent using keyed
hashes without setting key") dm-integrity cannot use keyed algorithms
without the key being set.

The dm-integrity recognizes this too late (during use of HMAC), so it
allows creation and formatting of superblock, but the device is in fact
unusable.

Fix it by detecting the key requirement in integrity table constructor.

Signed-off-by: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/dm-integrity.c