Do not init LUKS2 decryption for devices with data offset.

Currently LUKS2 decryption cannot perform data decryption
with data shift. Even though we can decrypt devices with
data offset > 0 in LUKS2 metadata it does not make much
sense. Such devices cannot be easily mounted after decryption
is finished due to said data offset (fs superblock is moved
typicaly by 16MiBs).
This commit is contained in:
Ondrej Kozina
2021-08-27 15:59:33 +02:00
parent f6fb530121
commit 621dcea8ee
2 changed files with 15 additions and 2 deletions

View File

@@ -3050,8 +3050,9 @@ static int action_decrypt_luks2(struct crypt_device *cd)
};
size_t passwordLen;
if (!crypt_get_metadata_device_name(cd) || crypt_header_is_detached(cd) <= 0) {
log_err(_("LUKS2 decryption is supported with detached header device only."));
if (!crypt_get_metadata_device_name(cd) || crypt_header_is_detached(cd) <= 0 ||
crypt_get_data_offset(cd) > 0) {
log_err(_("LUKS2 decryption is supported with detached header device only (with data offset set to 0)."));
return -ENOTSUP;
}