mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-13 20:00:08 +01:00
Simplify fvault activation by volume key.
This commit is contained in:
committed by
Milan Broz
parent
652835a1f8
commit
7db83f8fb3
@@ -1022,25 +1022,13 @@ int FVAULT2_activate_by_passphrase(
|
|||||||
int FVAULT2_activate_by_volume_key(
|
int FVAULT2_activate_by_volume_key(
|
||||||
struct crypt_device *cd,
|
struct crypt_device *cd,
|
||||||
const char *name,
|
const char *name,
|
||||||
const char *key,
|
struct volume_key *vk,
|
||||||
size_t key_size,
|
|
||||||
const struct fvault2_params *params,
|
const struct fvault2_params *params,
|
||||||
uint32_t flags)
|
uint32_t flags)
|
||||||
{
|
{
|
||||||
int r = 0;
|
assert(vk && vk->keylength == FVAULT2_XTS_KEY_SIZE);
|
||||||
struct volume_key *vol_key = NULL;
|
|
||||||
|
|
||||||
if (key_size != FVAULT2_XTS_KEY_SIZE)
|
return _activate(cd, name, vk, params, flags);
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
vol_key = crypt_alloc_volume_key(FVAULT2_XTS_KEY_SIZE, key);
|
|
||||||
if (vol_key == NULL)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
r = _activate(cd, name, vol_key, params, flags);
|
|
||||||
|
|
||||||
crypt_free_volume_key(vol_key);
|
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t FVAULT2_volume_key_size(void)
|
size_t FVAULT2_volume_key_size(void)
|
||||||
|
|||||||
@@ -59,8 +59,7 @@ int FVAULT2_activate_by_passphrase(
|
|||||||
int FVAULT2_activate_by_volume_key(
|
int FVAULT2_activate_by_volume_key(
|
||||||
struct crypt_device *cd,
|
struct crypt_device *cd,
|
||||||
const char *name,
|
const char *name,
|
||||||
const char *key,
|
struct volume_key *vk,
|
||||||
size_t key_size,
|
|
||||||
const struct fvault2_params *params,
|
const struct fvault2_params *params,
|
||||||
uint32_t flags);
|
uint32_t flags);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user