Explicitly disallow capi format for LUKS2 keyslot encryption

NO functional change as it fails in IV check anyway, but the
code should not reach this funtion at all.
This commit is contained in:
Milan Broz
2025-05-29 10:32:35 +02:00
parent c3414b8221
commit 5b3ff3c0a7

View File

@@ -168,6 +168,13 @@ int LUKS2_keyslot_cipher_incompatible(struct crypt_device *cd, const char *ciphe
if (!cipher_spec || crypt_is_cipher_null(cipher_spec))
return 1;
/*
* Do not allow capi format for keyslots
* Note: It always failed in ivsize check later anyway.
*/
if (!strncmp(cipher_spec, "capi:", 5))
return 1;
if (crypt_parse_name_and_mode(cipher_spec, cipher, NULL, cipher_mode) < 0)
return 1;