diff --git a/lib/libdevmapper.c b/lib/libdevmapper.c index 7a6ee3dc..99e111dc 100644 --- a/lib/libdevmapper.c +++ b/lib/libdevmapper.c @@ -129,6 +129,9 @@ static void _dm_set_crypt_compat(const char *dm_version, unsigned crypt_maj, if (crypt_maj >= 1 && crypt_min >= 11) _dm_crypt_flags |= DM_DISCARDS_SUPPORTED; + //if (crypt_maj >= 1 && crypt_min >= 13) + // _dm_crypt_flags |= DM_TCW_SUPPORTED; + /* Repeat test if dm-crypt is not present */ if (crypt_maj > 0) _dm_crypt_checked = 1; diff --git a/lib/tcrypt/tcrypt.c b/lib/tcrypt/tcrypt.c index e9e77092..70c627f6 100644 --- a/lib/tcrypt/tcrypt.c +++ b/lib/tcrypt/tcrypt.c @@ -655,6 +655,7 @@ int TCRYPT_activate(struct crypt_device *cd, struct device *device = NULL, *part_device = NULL; unsigned int i; int r; + uint32_t req_flags; struct tcrypt_algs *algs; enum devcheck device_check; struct crypt_dm_active_device dmd = { @@ -684,6 +685,11 @@ int TCRYPT_activate(struct crypt_device *cd, return -ENOTSUP; } + if (strstr(params->mode, "-tcw")) + req_flags = DM_TCW_SUPPORTED; + else + req_flags = DM_PLAIN64_SUPPORTED; + algs = TCRYPT_get_algs(params->cipher, params->mode); if (!algs) return -EINVAL; @@ -763,8 +769,8 @@ int TCRYPT_activate(struct crypt_device *cd, break; } - if (r < 0 && !(dm_flags() & DM_PLAIN64_SUPPORTED)) { - log_err(cd, _("Kernel doesn't support plain64 IV.\n")); + if (r < 0 && !(dm_flags() & req_flags)) { + log_err(cd, _("Kernel doesn't support TCRYPT compatible mapping.\n")); r = -ENOTSUP; } diff --git a/lib/utils_dm.h b/lib/utils_dm.h index 63e972bd..09be046b 100644 --- a/lib/utils_dm.h +++ b/lib/utils_dm.h @@ -39,6 +39,7 @@ struct device; #define DM_PLAIN64_SUPPORTED (1 << 3) /* plain64 IV */ #define DM_DISCARDS_SUPPORTED (1 << 4) /* discards/TRIM option is supported */ #define DM_VERITY_SUPPORTED (1 << 5) /* dm-verity target supported */ +#define DM_TCW_SUPPORTED (1 << 6) /* tcw (TCRYPT CBC with whitening) */ uint32_t dm_flags(void); #define DM_ACTIVE_DEVICE (1 << 0)