mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-13 03:40:05 +01:00
Allow explicit LUKS2 repair.
Also moves FIXME comment lower to LUKS2 code with note that currently it's safe to do crypt_repair on LUKS2 format without paying attention to LUKS2 requirements.
This commit is contained in:
committed by
Milan Broz
parent
289c9ecf5d
commit
9de5dc932b
11
lib/setup.c
11
lib/setup.c
@@ -768,6 +768,14 @@ static int _crypt_load_luks(struct crypt_device *cd, const char *requested_type,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Current LUKS2 repair just overrides blkid probes
|
||||||
|
* and perform auto-recovery if possible. This is safe
|
||||||
|
* unless future LUKS2 repair code do something more
|
||||||
|
* sophisticated. In such case we would need to check
|
||||||
|
* for LUKS2 requirements and decide if it's safe to
|
||||||
|
* perform repair.
|
||||||
|
*/
|
||||||
r = _crypt_load_luks2(cd, cd->type != NULL, repair);
|
r = _crypt_load_luks2(cd, cd->type != NULL, repair);
|
||||||
} else
|
} else
|
||||||
r = -EINVAL;
|
r = -EINVAL;
|
||||||
@@ -2023,8 +2031,7 @@ int crypt_repair(struct crypt_device *cd,
|
|||||||
if (!crypt_metadata_device(cd))
|
if (!crypt_metadata_device(cd))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* FIXME LUKS2 (if so it also must respect LUKS2 requirements) */
|
if (requested_type && !isLUKS(requested_type))
|
||||||
if (requested_type && !isLUKS1(requested_type))
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* Load with repair */
|
/* Load with repair */
|
||||||
|
|||||||
Reference in New Issue
Block a user