Harden LUKS2 decryption with datashift parameters.

Abort early if detached header is passed in API
by any chance.
This commit is contained in:
Ondrej Kozina
2022-06-27 15:14:14 +02:00
parent 24d498e393
commit 0ffd105cb8

View File

@@ -2734,8 +2734,12 @@ static int reencrypt_decrypt_with_datashift_init(struct crypt_device *cd,
assert(hdr);
assert(params);
assert(params->resilience);
assert(params->data_shift);
assert(vks);
if (!data_offset)
return -EINVAL;
if (params->max_hotzone_size > params->data_shift) {
log_err(cd, _("Moved segment size can not be greater than data shift value."));
return -EINVAL;