Skip to content

Commit 1bec71d

Browse files
onikombroz
authored andcommitted
Add temporary helpers to indicate uploaded volume key.
To be removed later when we add clear implementation to hide access to volume key uploaded attribute.
1 parent 9e0bced commit 1bec71d

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

lib/internal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ struct volume_key *crypt_volume_key_by_id(struct volume_key *vk, int id);
8585
void crypt_volume_key_pass_safe_alloc(struct volume_key *vk, void **safe_alloc);
8686
bool crypt_volume_key_is_set(const struct volume_key *vk);
8787

88+
/* FIXME: temporary helpers to be removed later */
89+
bool crypt_volume_key_is_uploaded(const struct volume_key *vk);
90+
void crypt_volume_key_set_uploaded(struct volume_key *vk);
91+
8892
struct crypt_pbkdf_type *crypt_get_pbkdf(struct crypt_device *cd);
8993
int init_pbkdf_type(struct crypt_device *cd,
9094
const struct crypt_pbkdf_type *pbkdf,

lib/setup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7484,7 +7484,7 @@ int crypt_volume_key_load_in_keyring(struct crypt_device *cd, struct volume_key
74847484
log_err(cd, _("Failed to load key in kernel keyring."));
74857485
} else {
74867486
crypt_set_key_in_keyring(cd, 1);
7487-
vk->uploaded = true;
7487+
crypt_volume_key_set_uploaded(vk);
74887488
}
74897489

74907490
return kid < 0 ? -EINVAL : 0;
@@ -7674,7 +7674,7 @@ void crypt_drop_uploaded_keyring_key(struct crypt_device *cd, struct volume_key
76747674
struct volume_key *vk = vks;
76757675

76767676
while (vk) {
7677-
if (vk->uploaded)
7677+
if (crypt_volume_key_is_uploaded(vk))
76787678
crypt_drop_keyring_key_by_description(cd, crypt_volume_key_description(vk), LOGON_KEY);
76797679
vk = crypt_volume_key_next(vk);
76807680
}

lib/volumekey.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,15 @@ bool crypt_volume_key_is_set(const struct volume_key *vk)
231231
{
232232
return vk && vk->key;
233233
}
234+
235+
bool crypt_volume_key_is_uploaded(const struct volume_key *vk)
236+
{
237+
return vk && vk->uploaded;
238+
}
239+
240+
void crypt_volume_key_set_uploaded(struct volume_key *vk)
241+
{
242+
assert(vk);
243+
244+
vk->uploaded = true;
245+
}

0 commit comments

Comments
 (0)