mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Add the same cipher_null restriction to LUKS2 keyslot as in LUKS1.
LUKS2 keyslot cannot be created with cipher_null using standard tools, but activation of such a keyslot is allowed. As this can be confusing and create a false sense of security, let's apply the same restriction as in LUKS1 - such a keyslot is used only with an empty passphrase. This will reject activation with a real password, avoiding possible activation of insecure LUKS containers. Fixes: #954
This commit is contained in:
@@ -336,6 +336,10 @@ static int luks2_keyslot_get_key(struct crypt_device *cd,
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
/* Allow only empty passphrase with null cipher */
|
||||
if (crypt_is_cipher_null(cipher) && passwordLen)
|
||||
return -EPERM;
|
||||
|
||||
if (!json_object_object_get_ex(jobj_area, "key_size", &jobj2))
|
||||
return -EINVAL;
|
||||
keyslot_key_len = json_object_get_int(jobj2);
|
||||
|
||||
Reference in New Issue
Block a user