mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Replace code for missing key error in API.
While trying to activate device in LUKS2 reencryption we originally used -ENOKEY error code for case where one or more volume keys could not be unlocked or were not provided direclty by (CRYPT_KC_TYPE_KEY or CRYPT_KC_TYPE_VK_KEYRING) keyslot contexts. We missed the fact the error code was already previously used for signaling case when dm subsystem could not load device table due to key in kernel keyring could not be read from kernel. It's propagated by libdevmapper. For it we replace -ENOKEY with -ESRCH for signaling the missing keyslot context or volume key for devices in LUKS2 reencryption.
This commit is contained in:
@@ -5598,8 +5598,8 @@ static void KeyslotContextAndKeyringLink(void)
|
||||
OK_(crypt_keyslot_context_init_by_vk_in_keyring(cd, TEST_KEY_VK_USER_NAME , &kc));
|
||||
OK_(crypt_keyslot_context_init_by_vk_in_keyring(cd, TEST_KEY_VK_USER2_NAME, &kc2));
|
||||
|
||||
EQ_(crypt_activate_by_keyslot_context(cd, NULL, CRYPT_ANY_SLOT, kc, CRYPT_ANY_SLOT, NULL, 0), -ENOKEY);
|
||||
EQ_(crypt_activate_by_keyslot_context(cd, NULL, CRYPT_ANY_SLOT, kc2, CRYPT_ANY_SLOT, NULL, 0), -ENOKEY);
|
||||
EQ_(crypt_activate_by_keyslot_context(cd, NULL, CRYPT_ANY_SLOT, kc, CRYPT_ANY_SLOT, NULL, 0), -ESRCH);
|
||||
EQ_(crypt_activate_by_keyslot_context(cd, NULL, CRYPT_ANY_SLOT, kc2, CRYPT_ANY_SLOT, NULL, 0), -ESRCH);
|
||||
EQ_(crypt_activate_by_keyslot_context(cd, NULL, CRYPT_ANY_SLOT, NULL, CRYPT_ANY_SLOT, kc, 0), -EINVAL);
|
||||
EQ_(crypt_activate_by_keyslot_context(cd, NULL, CRYPT_ANY_SLOT, NULL, CRYPT_ANY_SLOT, kc2, 0), -EINVAL);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user