Blame SOURCES/cryptsetup-1.7.5-fix-luksformat-in-fips-mode.patch

7cdc99
From 3c2135b36bbc52d052e4ced7c94dc4981eb07a53 Mon Sep 17 00:00:00 2001
7cdc99
From: Milan Broz <gmazyland@gmail.com>
7cdc99
Date: Fri, 21 Apr 2017 08:16:14 +0200
7cdc99
Subject: [PATCH] Fix luksFormat if running in FIPS mode on recent kernel.
7cdc99
7cdc99
Recently introduced check for weak keys for XTS mode makes
7cdc99
zeroed key for algorithm check unusable.
7cdc99
7cdc99
Use random key for the test instead.
7cdc99
---
7cdc99
 lib/luks1/keymanage.c | 8 +++++---
7cdc99
 1 file changed, 5 insertions(+), 3 deletions(-)
7cdc99
7cdc99
diff --git a/lib/luks1/keymanage.c b/lib/luks1/keymanage.c
7cdc99
index b700bab..5b1421b 100644
7cdc99
--- a/lib/luks1/keymanage.c
7cdc99
+++ b/lib/luks1/keymanage.c
7cdc99
@@ -631,9 +631,11 @@ static int LUKS_check_cipher(struct luks_phdr *hdr, struct crypt_device *ctx)
7cdc99
 	if (!empty_key)
7cdc99
 		return -ENOMEM;
7cdc99
 
7cdc99
-	r = LUKS_decrypt_from_storage(buf, sizeof(buf),
7cdc99
-				      hdr->cipherName, hdr->cipherMode,
7cdc99
-				      empty_key, 0, ctx);
7cdc99
+	/* No need to get KEY quality random but it must avoid known weak keys. */
7cdc99
+	r = crypt_random_get(ctx, empty_key->key, empty_key->keylength, CRYPT_RND_NORMAL);
7cdc99
+	if (!r)
7cdc99
+		r = LUKS_decrypt_from_storage(buf, sizeof(buf), hdr->cipherName,
7cdc99
+					      hdr->cipherMode, empty_key, 0, ctx);
7cdc99
 
7cdc99
 	crypt_free_volume_key(empty_key);
7cdc99
 	crypt_memzero(buf, sizeof(buf));
7cdc99
-- 
7cdc99
2.7.4
7cdc99