diff options
author | Ondrej Kozina <okozina@redhat.com> | 2024-01-23 12:08:42 +0100 |
---|---|---|
committer | Ondrej Kozina <okozina@redhat.com> | 2024-01-23 12:08:43 +0100 |
commit | cbc7253400d6b63dc275b09b2de484c1258ead93 (patch) | |
tree | cecc3cbe6e07334e852c671bbf8bbf33ffaf8a83 | |
parent | 35ec935cc21bb9963b15d24923b410d0426035dd (diff) | |
download | cryptsetup-cbc7253400d6b63dc275b09b2de484c1258ead93.tar.gz |
Unify error code for missing key description.
Use -ESRCH for similar error code as with
crypt_activate_by_keyslot_context. Here it's not
confliciting with previous use for the very code but
let's make it easier and use same code for similar case.
-rw-r--r-- | lib/libcryptsetup.h | 2 | ||||
-rw-r--r-- | lib/setup.c | 2 | ||||
-rw-r--r-- | tests/api-test-2.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/lib/libcryptsetup.h b/lib/libcryptsetup.h index 5a8de999..598b1f96 100644 --- a/lib/libcryptsetup.h +++ b/lib/libcryptsetup.h @@ -3120,7 +3120,7 @@ void crypt_safe_memzero(void *data, size_t size); * devices that are in re-encryption and have two volume keys at the same time * (old and new). You can set the @e old_key_description to NULL, * but if you supply number of keys less than required, the function will - * return -EAGAIN. In that case you need to call the function again and set + * return -ESRCH. In that case you need to call the function again and set * the missing key description. When supplying just one key description, make * sure to supply it in the @e key_description. * diff --git a/lib/setup.c b/lib/setup.c index ed77dc14..d462f0ae 100644 --- a/lib/setup.c +++ b/lib/setup.c @@ -7835,7 +7835,7 @@ int crypt_set_keyring_to_link(struct crypt_device *cd, const char *key_descripti user_descriptions_count = (key_description ? 1 : 0) + (old_key_description ? 1 : 0); if (user_descriptions_count != 0 && vks_count > user_descriptions_count) - return -EAGAIN; + return -ESRCH; if (keyring_to_link_vk) { id = keyring_find_keyring_id_by_name(keyring_to_link_vk); diff --git a/tests/api-test-2.c b/tests/api-test-2.c index 29cdb987..c70a80ce 100644 --- a/tests/api-test-2.c +++ b/tests/api-test-2.c @@ -5537,7 +5537,7 @@ static void KeyslotContextAndKeyringLink(void) // key names have to be specified starting from the first EQ_(crypt_set_keyring_to_link(cd, NULL, TEST_KEY_VK_USER, "user", keyring_in_user_str_id), -EINVAL); - EQ_(crypt_set_keyring_to_link(cd, TEST_KEY_VK_USER, NULL, "user", keyring_in_user_str_id), -EAGAIN); + EQ_(crypt_set_keyring_to_link(cd, TEST_KEY_VK_USER, NULL, "user", keyring_in_user_str_id), -ESRCH); EQ_(crypt_set_keyring_to_link(cd, TEST_KEY_VK_USER, TEST_KEY_VK_USER2, "user", keyring_in_user_str_id), 0); EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, PASSPHRASE, strlen(PASSPHRASE), 0), 0); |