mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
integrity: Detect PI/DIF capable devices in inline mode.
And print better error if not.
This commit is contained in:
12
lib/setup.c
12
lib/setup.c
@@ -3068,6 +3068,7 @@ int crypt_format_inline(struct crypt_device *cd,
|
||||
void *params)
|
||||
{
|
||||
const struct crypt_params_integrity *iparams;
|
||||
uint32_t device_tag_size;
|
||||
struct device *idevice;
|
||||
size_t sector_size, required_sector_size;
|
||||
int r;
|
||||
@@ -3113,6 +3114,17 @@ int crypt_format_inline(struct crypt_device *cd,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!device_is_nop_dif(crypt_metadata_device(cd), &device_tag_size)) {
|
||||
log_err(cd, _("Device %s does not provide inline integrity data fields."), mdata_device_path(cd));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (device_tag_size < iparams->tag_size) {
|
||||
log_err(cd, _("Inline tag size %" PRIu32 " [bytes] is larger than %" PRIu32 " provided by device %s."),
|
||||
iparams->tag_size, device_tag_size, mdata_device_path(cd));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (isINTEGRITY(type))
|
||||
r = _crypt_format_integrity(cd, uuid, params, volume_key, volume_key_size, true);
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user