mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-12 03:10:08 +01:00
Add id member in volume_key structure.
Also adds set/get helper routines.
This commit is contained in:
committed by
Milan Broz
parent
fc0c857cfe
commit
b0330d62e5
@@ -75,6 +75,7 @@
|
||||
struct crypt_device;
|
||||
|
||||
struct volume_key {
|
||||
int id;
|
||||
size_t keylength;
|
||||
const char *key_description;
|
||||
char key[];
|
||||
@@ -84,6 +85,8 @@ struct volume_key *crypt_alloc_volume_key(size_t keylength, const char *key);
|
||||
struct volume_key *crypt_generate_volume_key(struct crypt_device *cd, size_t keylength);
|
||||
void crypt_free_volume_key(struct volume_key *vk);
|
||||
int crypt_volume_key_set_description(struct volume_key *key, const char *key_description);
|
||||
void crypt_volume_key_set_id(struct volume_key *vk, int id);
|
||||
int crypt_volume_key_get_id(const struct volume_key *vk);
|
||||
|
||||
struct crypt_pbkdf_type *crypt_get_pbkdf(struct crypt_device *cd);
|
||||
int init_pbkdf_type(struct crypt_device *cd,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user