Do not allow decryption on devices with unsupported parameters.

Most notably LUKS2 w/ authenticated encryption profile. OPAL restriction
will be added in later commits.
This commit is contained in:
Ondrej Kozina
2023-11-01 17:26:45 +01:00
parent b9ba5ec14d
commit 1b7211f013

View File

@@ -1465,6 +1465,8 @@ static int _decrypt(struct crypt_device **cd, enum device_status_info dev_st, co
if ((r = reencrypt_luks2_load(*cd, data_device)) < 0) if ((r = reencrypt_luks2_load(*cd, data_device)) < 0)
return r; return r;
} else if (dev_st == DEVICE_LUKS2) { } else if (dev_st == DEVICE_LUKS2) {
if (!luks2_reencrypt_eligible(*cd))
return -EINVAL;
if (!ARG_SET(OPT_HEADER_ID)) { if (!ARG_SET(OPT_HEADER_ID)) {
log_err(_("LUKS2 decryption requires --header option.")); log_err(_("LUKS2 decryption requires --header option."));
return -EINVAL; return -EINVAL;