mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-13 20:00:08 +01:00
Add check for FEC support in kernel dm-verity.
This commit is contained in:
@@ -165,9 +165,12 @@ static void _dm_set_verity_compat(const char *dm_version, unsigned verity_maj,
|
||||
* ignore_corruption, restart_on corruption is available since 1.2 (kernel 4.1)
|
||||
* ignore_zero_blocks since 1.3 (kernel 4.5)
|
||||
* (but some dm-verity targets 1.2 don't support it)
|
||||
* FEC is added in 1.3 as well.
|
||||
*/
|
||||
if (_dm_satisfies_version(1, 3, verity_maj, verity_min))
|
||||
if (_dm_satisfies_version(1, 3, verity_maj, verity_min)) {
|
||||
_dm_crypt_flags |= DM_VERITY_ON_CORRUPTION_SUPPORTED;
|
||||
_dm_crypt_flags |= DM_VERITY_FEC_SUPPORTED;
|
||||
}
|
||||
|
||||
log_dbg("Detected dm-verity version %i.%i.%i.",
|
||||
verity_maj, verity_min, verity_patch);
|
||||
@@ -743,6 +746,10 @@ int dm_create_device(struct crypt_device *cd, const char *name,
|
||||
!(dm_flags() & DM_VERITY_ON_CORRUPTION_SUPPORTED))
|
||||
log_err(cd, _("Requested dm-verity data corruption handling options are not supported.\n"));
|
||||
|
||||
if (r == -EINVAL && dmd->target == DM_VERITY && dmd->u.verity.fec_device &&
|
||||
!(dm_flags() & DM_VERITY_FEC_SUPPORTED))
|
||||
log_err(cd, _("Requested dm-verity FEC options are not supported.\n"));
|
||||
|
||||
crypt_safe_free(table_params);
|
||||
dm_exit_context();
|
||||
return r;
|
||||
|
||||
@@ -43,6 +43,7 @@ struct device;
|
||||
#define DM_SAME_CPU_CRYPT_SUPPORTED (1 << 7) /* same_cpu_crypt */
|
||||
#define DM_SUBMIT_FROM_CRYPT_CPUS_SUPPORTED (1 << 8) /* submit_from_crypt_cpus */
|
||||
#define DM_VERITY_ON_CORRUPTION_SUPPORTED (1 << 9) /* ignore/restart_on_corruption, ignore_zero_block */
|
||||
#define DM_VERITY_FEC_SUPPORTED (1 << 10) /* Forward Error Correction (FEC) */
|
||||
|
||||
uint32_t dm_flags(void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user