Fix reencryption to fail properly for unknown cipher.

crypt_get_cipher and crypt_get_cipher mode can return NULL,
check it in advance.
This commit is contained in:
Milan Broz
2023-06-26 13:25:59 +02:00
parent 10847d7100
commit 1f01eea60e

View File

@@ -419,6 +419,12 @@ static bool luks2_reencrypt_eligible(struct crypt_device *cd)
return false;
}
/* Check that cipher is in compatible format */
if (!crypt_get_cipher(cd)) {
log_err(_("No known cipher specification pattern detected in LUKS2 header."));
return false;
}
return true;
}