mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-19 06:40:08 +01:00
Fix LUKS1 repair to repair wrong ECB mode.
1) Crypsetup repair should try to call crypt_repair() even if crypt_load is ok - it has no validate system unlike LUKS2 and some errors cannot be hard load errors. 2) Move ECB fix to repair code, do not try magic on load that no longer works. And do not use ECB :) Fixes: #664
This commit is contained in:
@@ -1235,7 +1235,11 @@ static int action_luksRepair(void)
|
||||
crypt_set_log_callback(cd, quiet_log, &log_parms);
|
||||
r = crypt_load(cd, luksType(device_type), NULL);
|
||||
crypt_set_log_callback(cd, tool_log, &log_parms);
|
||||
if (r == 0) {
|
||||
if (r == 0 && isLUKS2(crypt_get_type(cd))) {
|
||||
/*
|
||||
* LUKS2 triggers autorepair in crypt_load() above
|
||||
* LUKS1 need to call crypt_repair() even if crypt_load() is ok
|
||||
*/
|
||||
log_verbose(_("No known problems detected for LUKS header."));
|
||||
goto out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user