mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-17 22:00:07 +01:00
Check for data device and hash device area overlap in veritysetup.
Thanks Michal Virgovic for tests.
This commit is contained in:
@@ -1188,6 +1188,12 @@ static int _crypt_format_verity(struct crypt_device *cd,
|
||||
} else
|
||||
cd->u.verity.hdr.data_size = params->data_size;
|
||||
|
||||
if (device_is_identical(crypt_metadata_device(cd), crypt_data_device(cd)) &&
|
||||
(cd->u.verity.hdr.data_size * params->data_block_size) > params->hash_area_offset) {
|
||||
log_err(cd, _("Data area overlaps with hash area.\n"));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
hash_size = crypt_hash_size(params->hash_name);
|
||||
if (hash_size <= 0) {
|
||||
log_err(cd, _("Hash algorithm %s not supported.\n"),
|
||||
|
||||
Reference in New Issue
Block a user