diff --git a/lib/internal.h b/lib/internal.h index 11d1fd005..eea6c75d8 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -85,6 +85,10 @@ struct volume_key *crypt_volume_key_by_id(struct volume_key *vk, int id); void crypt_volume_key_pass_safe_alloc(struct volume_key *vk, void **safe_alloc); bool crypt_volume_key_is_set(const struct volume_key *vk); +/* FIXME: temporary helpers to be removed later */ +bool crypt_volume_key_is_uploaded(const struct volume_key *vk); +void crypt_volume_key_set_uploaded(struct volume_key *vk); + struct crypt_pbkdf_type *crypt_get_pbkdf(struct crypt_device *cd); int init_pbkdf_type(struct crypt_device *cd, const struct crypt_pbkdf_type *pbkdf, diff --git a/lib/setup.c b/lib/setup.c index 9ed924905..6d6ffe263 100644 --- a/lib/setup.c +++ b/lib/setup.c @@ -7484,7 +7484,7 @@ int crypt_volume_key_load_in_keyring(struct crypt_device *cd, struct volume_key log_err(cd, _("Failed to load key in kernel keyring.")); } else { crypt_set_key_in_keyring(cd, 1); - vk->uploaded = true; + crypt_volume_key_set_uploaded(vk); } return kid < 0 ? -EINVAL : 0; @@ -7674,7 +7674,7 @@ void crypt_drop_uploaded_keyring_key(struct crypt_device *cd, struct volume_key struct volume_key *vk = vks; while (vk) { - if (vk->uploaded) + if (crypt_volume_key_is_uploaded(vk)) crypt_drop_keyring_key_by_description(cd, crypt_volume_key_description(vk), LOGON_KEY); vk = crypt_volume_key_next(vk); } diff --git a/lib/volumekey.c b/lib/volumekey.c index ccc782a45..8ed72ea1f 100644 --- a/lib/volumekey.c +++ b/lib/volumekey.c @@ -231,3 +231,15 @@ bool crypt_volume_key_is_set(const struct volume_key *vk) { return vk && vk->key; } + +bool crypt_volume_key_is_uploaded(const struct volume_key *vk) +{ + return vk && vk->uploaded; +} + +void crypt_volume_key_set_uploaded(struct volume_key *vk) +{ + assert(vk); + + vk->uploaded = true; +}