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