Blame SOURCES/cryptsetup-2.0.4-allow-explicit-LUKS2-repair.patch

ad2d76
From 4b3b6b07ad42ebab346f0fe343aab2a14cd5a9da Mon Sep 17 00:00:00 2001
ad2d76
From: Ondrej Kozina <okozina@redhat.com>
ad2d76
Date: Mon, 9 Jul 2018 17:18:17 +0200
ad2d76
Subject: [PATCH 4/6] Allow explicit LUKS2 repair.
ad2d76
ad2d76
Also moves FIXME comment lower to LUKS2 code with note that currently it's
ad2d76
safe to do crypt_repair on LUKS2 format without paying attention to LUKS2
ad2d76
requirements.
ad2d76
---
ad2d76
 lib/setup.c | 11 +++++++++--
ad2d76
 1 file changed, 9 insertions(+), 2 deletions(-)
ad2d76
ad2d76
diff --git a/lib/setup.c b/lib/setup.c
ad2d76
index a9b2eba..952fa0e 100644
ad2d76
--- a/lib/setup.c
ad2d76
+++ b/lib/setup.c
ad2d76
@@ -768,6 +768,14 @@ static int _crypt_load_luks(struct crypt_device *cd, const char *requested_type,
ad2d76
 			return -EINVAL;
ad2d76
 		}
ad2d76
 
ad2d76
+		/*
ad2d76
+		 * Current LUKS2 repair just overrides blkid probes
ad2d76
+		 * and perform auto-recovery if possible. This is safe
ad2d76
+		 * unless future LUKS2 repair code do something more
ad2d76
+		 * sophisticated. In such case we would need to check
ad2d76
+		 * for LUKS2 requirements and decide if it's safe to
ad2d76
+		 * perform repair.
ad2d76
+		 */
ad2d76
 		r =  _crypt_load_luks2(cd, cd->type != NULL, repair);
ad2d76
 	} else
ad2d76
 		r = -EINVAL;
ad2d76
@@ -2023,8 +2031,7 @@ int crypt_repair(struct crypt_device *cd,
ad2d76
 	if (!crypt_metadata_device(cd))
ad2d76
 		return -EINVAL;
ad2d76
 
ad2d76
-	/* FIXME LUKS2 (if so it also must respect LUKS2 requirements) */
ad2d76
-	if (requested_type && !isLUKS1(requested_type))
ad2d76
+	if (requested_type && !isLUKS(requested_type))
ad2d76
 		return -EINVAL;
ad2d76
 
ad2d76
 	/* Load with repair */
ad2d76
-- 
ad2d76
1.8.3.1
ad2d76