提交 c82feeec 编写于 作者: O Ondrej Kozina 提交者: Mike Snitzer

dm crypt: rewrite (wipe) key in crypto layer using random data

The message "key wipe" used to wipe real key stored in crypto layer by
rewriting it with zeroes.  Since commit 28856a9e ("crypto: xts -
consolidate sanity check for keys") this no longer works in FIPS mode
for XTS.

While running in FIPS mode the crypto key part has to differ from the
tweak key.

Fixes: 28856a9e ("crypto: xts - consolidate sanity check for keys")
Cc: stable@vger.kernel.org
Signed-off-by: NOndrej Kozina <okozina@redhat.com>
Signed-off-by: NMike Snitzer <snitzer@redhat.com>
上级 06eb061f
...@@ -2152,12 +2152,16 @@ static int crypt_set_key(struct crypt_config *cc, char *key) ...@@ -2152,12 +2152,16 @@ static int crypt_set_key(struct crypt_config *cc, char *key)
static int crypt_wipe_key(struct crypt_config *cc) static int crypt_wipe_key(struct crypt_config *cc)
{ {
int r;
clear_bit(DM_CRYPT_KEY_VALID, &cc->flags); clear_bit(DM_CRYPT_KEY_VALID, &cc->flags);
memset(&cc->key, 0, cc->key_size * sizeof(u8)); get_random_bytes(&cc->key, cc->key_size);
kzfree(cc->key_string); kzfree(cc->key_string);
cc->key_string = NULL; cc->key_string = NULL;
r = crypt_setkey(cc);
memset(&cc->key, 0, cc->key_size * sizeof(u8));
return crypt_setkey(cc); return r;
} }
static void crypt_dtr(struct dm_target *ti) static void crypt_dtr(struct dm_target *ti)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册