Add id member in volume_key structure.

Also adds set/get helper routines.
This commit is contained in:
Ondrej Kozina
2019-02-18 15:59:44 +01:00
committed by Milan Broz
parent fc0c857cfe
commit b0330d62e5
2 changed files with 15 additions and 0 deletions

View File

@@ -39,6 +39,7 @@ struct volume_key *crypt_alloc_volume_key(size_t keylength, const char *key)
vk->key_description = NULL;
vk->keylength = keylength;
vk->id = -1;
/* keylength 0 is valid => no key */
if (vk->keylength) {
@@ -64,6 +65,17 @@ int crypt_volume_key_set_description(struct volume_key *vk, const char *key_desc
return 0;
}
void crypt_volume_key_set_id(struct volume_key *vk, int id)
{
if (vk && id >= 0)
vk->id = id;
}
int crypt_volume_key_get_id(const struct volume_key *vk)
{
return vk ? vk->id : -1;
}
void crypt_free_volume_key(struct volume_key *vk)
{
if (vk) {