Validate LUKS2 keyslot json before opening it.

This commit is contained in:
Ondrej Kozina
2018-03-20 17:00:10 +01:00
committed by Milan Broz
parent 7bee66fe36
commit 1e2ad19d68

View File

@@ -220,6 +220,12 @@ static int LUKS2_open_and_verify(struct crypt_device *cd,
if (!(h = LUKS2_keyslot_handler(cd, keyslot)))
return -ENOENT;
r = h->validate(cd, keyslot);
if (r) {
log_dbg("Keyslot %d validation failed.", keyslot);
return r;
}
r = LUKS2_keyslot_for_segment(hdr, keyslot, segment);
if (r) {
if (r == -ENOENT)