mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-20 07:10:08 +01:00
Move helper for LUKS2 auth. encryption detection.
This commit is contained in:
committed by
Milan Broz
parent
a55b0530a4
commit
ba08f02a40
@@ -234,6 +234,23 @@ static enum device_status_info load_luks(struct crypt_device **r_cd, const char
|
||||
return isLUKS2(crypt_get_type(cd)) ? DEVICE_LUKS2 : DEVICE_LUKS1;
|
||||
}
|
||||
|
||||
static bool luks2_reencrypt_eligible(struct crypt_device *cd)
|
||||
{
|
||||
uint32_t flags;
|
||||
struct crypt_params_integrity ip = { 0 };
|
||||
|
||||
if (crypt_persistent_flags_get(cd, CRYPT_FLAGS_REQUIREMENTS, &flags))
|
||||
return false;
|
||||
|
||||
/* raw integrity info is available since 2.0 */
|
||||
if (crypt_get_integrity_info(cd, &ip) || ip.tag_size) {
|
||||
log_err(_("Reencryption of device with integrity profile is not supported."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int action_encrypt_luks2(struct crypt_device **cd, const char *data_device, const char *device_name)
|
||||
{
|
||||
const char *type;
|
||||
@@ -847,23 +864,6 @@ static enum device_status_info load_luks2_by_name(struct crypt_device **r_cd, co
|
||||
return !r ? DEVICE_LUKS2 : DEVICE_LUKS2_REENCRYPT;
|
||||
}
|
||||
|
||||
static bool luks2_reencrypt_eligible(struct crypt_device *cd)
|
||||
{
|
||||
uint32_t flags;
|
||||
struct crypt_params_integrity ip = { 0 };
|
||||
|
||||
if (crypt_persistent_flags_get(cd, CRYPT_FLAGS_REQUIREMENTS, &flags))
|
||||
return false;
|
||||
|
||||
/* raw integrity info is available since 2.0 */
|
||||
if (crypt_get_integrity_info(cd, &ip) || ip.tag_size) {
|
||||
log_err(_("Reencryption of device with integrity profile is not supported."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int encrypt_luks2(int action_argc, const char **action_argv)
|
||||
{
|
||||
enum device_status_info dev_st;
|
||||
|
||||
Reference in New Issue
Block a user