diff --git a/lib/bitlk/bitlk.c b/lib/bitlk/bitlk.c index c3c01e4a..c09eff30 100644 --- a/lib/bitlk/bitlk.c +++ b/lib/bitlk/bitlk.c @@ -1431,24 +1431,15 @@ out: int BITLK_activate_by_volume_key(struct crypt_device *cd, const char *name, - const char *volume_key, - size_t volume_key_size, + struct volume_key *vk, const struct bitlk_metadata *params, uint32_t flags) { - int r = 0; - struct volume_key *open_fvek_key = NULL; + int r; r = _activate_check(cd, params); if (r) return r; - open_fvek_key = crypt_alloc_volume_key(volume_key_size, volume_key); - if (!open_fvek_key) - return -ENOMEM; - - r = _activate(cd, name, open_fvek_key, params, flags); - - crypt_free_volume_key(open_fvek_key); - return r; + return _activate(cd, name, vk, params, flags); } diff --git a/lib/bitlk/bitlk.h b/lib/bitlk/bitlk.h index f1756832..82a89d94 100644 --- a/lib/bitlk/bitlk.h +++ b/lib/bitlk/bitlk.h @@ -124,8 +124,7 @@ int BITLK_activate_by_passphrase(struct crypt_device *cd, int BITLK_activate_by_volume_key(struct crypt_device *cd, const char *name, - const char *volume_key, - size_t volume_key_size, + struct volume_key *vk, const struct bitlk_metadata *params, uint32_t flags); diff --git a/lib/setup.c b/lib/setup.c index 8784a4d8..6c89781e 100644 --- a/lib/setup.c +++ b/lib/setup.c @@ -5623,8 +5623,7 @@ static int _activate_by_volume_key(struct crypt_device *cd, cd->u.integrity.sb_flags); } else if (isBITLK(cd->type)) { assert(!external_key); - r = BITLK_activate_by_volume_key(cd, name, vk->key, vk->keylength, - &cd->u.bitlk.params, flags); + r = BITLK_activate_by_volume_key(cd, name, vk, &cd->u.bitlk.params, flags); } else if (isFVAULT2(cd->type)) { assert(!external_key); assert(crypt_volume_key_get_id(vk) == KEY_VERIFIED);