mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Fix activation of LUKS2 with capi format cipher and kernel crypt name.
While activation of internal cipher algorithms (like aes-generic) is disallowed, some old LUKS2 images can still use it. Check the cipher in activate call, but allow to load LUKS2 metadata. This can allow to add repair code easily and also allow luksDump. Also fix segfault in reencrypt code for such a header. Fixes: #820
This commit is contained in:
@@ -2605,6 +2605,11 @@ int LUKS2_activate(struct crypt_device *cd,
|
||||
if ((r = LUKS2_unmet_requirements(cd, hdr, 0, 0)))
|
||||
return r;
|
||||
|
||||
/* Check that cipher is in compatible format */
|
||||
if (!crypt_get_cipher(cd)) {
|
||||
log_err(cd, _("No known cipher specification pattern detected in LUKS2 header."));
|
||||
return -EINVAL;
|
||||
}
|
||||
r = dm_crypt_target_set(&dmd.segment, 0, dmd.size, crypt_data_device(cd),
|
||||
vk, crypt_get_cipher_spec(cd), crypt_get_iv_offset(cd),
|
||||
crypt_get_data_offset(cd), crypt_get_integrity(cd) ?: "none",
|
||||
|
||||
Reference in New Issue
Block a user