Remove logging from keyring utilities.

Reduce bloated code in low level keyring utilities code.
Move log messages higher the library code.

Also return -ENOTSUP when code was compiled out by configure
option.
This commit is contained in:
Ondrej Kozina
2017-12-21 16:52:39 +01:00
committed by Milan Broz
parent cc76f3746f
commit 5f5ffcd48a
4 changed files with 45 additions and 113 deletions

View File

@@ -327,6 +327,8 @@ int crypt_use_keyring_for_vk(const struct crypt_device *cd);
int crypt_volume_key_load_in_keyring(struct crypt_device *cd, struct volume_key *vk);
void crypt_drop_keyring_key(struct crypt_device *cd, const char *key_description);
const char *crypt_get_key_description_by_keyslot(struct crypt_device *cd, int keyslot);
int crypt_get_passphrase_from_keyring(const char *key_description,
char **passphrase, size_t *passphrase_len);
struct luks_phdr;
int LUKS2_luks1_to_luks2(struct crypt_device *cd,

View File

@@ -41,8 +41,7 @@ static int keyring_open(struct crypt_device *cd,
json_object_object_get_ex(jobj_token, "key_description", &jobj_key);
/* TODO: if r == -ENOKEY then instantiate the key? */
if (keyring_get_passphrase(json_object_get_string(jobj_key), buffer, buffer_len))
if (crypt_get_passphrase_from_keyring(json_object_get_string(jobj_key), buffer, buffer_len))
return -EINVAL;
return 0;