Add repair for known glitches in LUKS2 json.

This commit is contained in:
Ondrej Kozina
2018-04-19 15:50:21 +02:00
committed by Milan Broz
parent dddd30bef8
commit f6be62ac5f
5 changed files with 96 additions and 0 deletions

View File

@@ -491,6 +491,15 @@ static int validate_luks2_json_object(json_object *jobj_hdr)
}
r = LUKS2_hdr_validate(jobj_hdr);
if (r) {
log_dbg("Repairing JSON metadata.");
/* try to correct known glitches */
LUKS2_hdr_repair(jobj_hdr);
/* run validation again */
r = LUKS2_hdr_validate(jobj_hdr);
}
if (r)
log_dbg("ERROR: LUKS2 validation failed");