mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Support encryption with reduced device size and data shift.
The only mising bit in library is a check if reduced data size is smaller than real device size minus data shift.
This commit is contained in:
@@ -3071,7 +3071,13 @@ static int reencrypt_init(struct crypt_device *cd,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!data_size_bytes && params->mode == CRYPT_REENCRYPT_ENCRYPT &&
|
||||
if (data_size_bytes && params->mode == CRYPT_REENCRYPT_ENCRYPT &&
|
||||
move_first_segment && data_shift_bytes) {
|
||||
if (data_size_bytes > device_size_bytes - data_shift_bytes) {
|
||||
log_err(cd, _("Reduced data size is larger than real device size."));
|
||||
return -EINVAL;
|
||||
}
|
||||
} else if (!data_size_bytes && params->mode == CRYPT_REENCRYPT_ENCRYPT &&
|
||||
move_first_segment && data_shift_bytes)
|
||||
data_size_bytes = device_size_bytes - data_shift_bytes;
|
||||
else if (!data_size_bytes)
|
||||
|
||||
Reference in New Issue
Block a user