char *type;
char *device;
- struct luks_masterkey *volume_key;
+ struct volume_key *volume_key;
uint64_t timeout;
uint64_t iteration_time;
int tries;
unsigned int flags,
int keyIndex)
{
- struct luks_masterkey *mk;
+ struct volume_key *vk;
crypt_keyslot_info ki;
int openedIndex;
char *password = NULL;
openedIndex = LUKS_open_key_with_hdr(cd->device, CRYPT_ANY_SLOT,
password, passwordLen,
- &cd->hdr, &mk, cd);
+ &cd->hdr, &vk, cd);
if (ki == CRYPT_SLOT_ACTIVE)
LUKS_keyslot_set(&cd->hdr, keyIndex, 1);
- LUKS_dealloc_masterkey(mk);
+ crypt_free_volume_key(vk);
safe_free(password);
if (openedIndex < 0)
unsigned int flags,
char *message)
{
- struct luks_masterkey *mk;
+ struct volume_key *vk;
char *password = NULL;
unsigned int passwordLen;
int keyIndex;
return -EINVAL;
keyIndex = LUKS_open_key_with_hdr(cd->device, CRYPT_ANY_SLOT, password,
- passwordLen, &cd->hdr, &mk, cd);
- LUKS_dealloc_masterkey(mk);
+ passwordLen, &cd->hdr, &vk, cd);
+ crypt_free_volume_key(vk);
safe_free(password);
return keyIndex;
return r;
}
-static int open_from_hdr_and_mk(struct crypt_device *cd,
- struct luks_masterkey *mk,
+static int open_from_hdr_and_vk(struct crypt_device *cd,
+ struct volume_key *vk,
const char *name,
uint32_t flags)
{
else
r = dm_create_device(name, cd->device, cipher, cd->type,
no_uuid ? NULL : crypt_get_uuid(cd),
- size, 0, offset, mk->keyLength, mk->key,
+ size, 0, offset, vk->keylength, vk->key,
read_only, 0);
free(cipher);
return r;
}
static int volume_key_by_terminal_passphrase(struct crypt_device *cd, int keyslot,
- struct luks_masterkey **mk)
+ struct volume_key **vk)
{
char *prompt = NULL, *passphrase_read = NULL;
unsigned int passphrase_size_read;
if(asprintf(&prompt, _("Enter passphrase for %s: "), cd->device) < 0)
return -ENOMEM;
- *mk = NULL;
+ *vk = NULL;
do {
- if (*mk)
- LUKS_dealloc_masterkey(*mk);
- *mk = NULL;
+ if (*vk)
+ crypt_free_volume_key(*vk);
+ *vk = NULL;
key_from_terminal(cd, prompt, &passphrase_read,
&passphrase_size_read, 0);
}
r = LUKS_open_key_with_hdr(cd->device, keyslot, passphrase_read,
- passphrase_size_read, &cd->hdr, mk, cd);
+ passphrase_size_read, &cd->hdr, vk, cd);
safe_free(passphrase_read);
passphrase_read = NULL;
} while (r == -EPERM && (--tries > 0));
- if (r < 0 && *mk) {
- LUKS_dealloc_masterkey(*mk);
- *mk = NULL;
+ if (r < 0 && *vk) {
+ crypt_free_volume_key(*vk);
+ *vk = NULL;
}
free(prompt);
const char *cipher,
const char *cipher_mode,
const char *uuid,
+ size_t volume_key_size,
struct crypt_params_plain *params)
{
if (!cipher || !cipher_mode) {
return -EINVAL;
}
- if (cd->volume_key->keyLength > 1024) {
+ if (volume_key_size > 1024) {
log_err(cd, _("Invalid key size.\n"));
return -EINVAL;
}
+ cd->volume_key = crypt_alloc_volume_key(volume_key_size, NULL);
+ if (!cd->volume_key)
+ return -ENOMEM;
+
cd->plain_cipher = strdup(cipher);
cd->plain_cipher_mode = strdup(cipher_mode);
const char *cipher,
const char *cipher_mode,
const char *uuid,
+ const char *volume_key,
+ size_t volume_key_size,
struct crypt_params_luks1 *params)
{
int r;
return -EINVAL;
}
+ if (volume_key)
+ cd->volume_key = crypt_alloc_volume_key(volume_key_size,
+ volume_key);
+ else
+ cd->volume_key = crypt_generate_volume_key(volume_key_size);
+
+ if(!cd->volume_key)
+ return -ENOMEM;
+
if (params && params->data_alignment)
required_alignment = params->data_alignment * SECTOR_SIZE;
else
return -ENOSYS;
}
- if (volume_key)
- cd->volume_key = LUKS_alloc_masterkey(volume_key_size,
- volume_key);
- else
- cd->volume_key = LUKS_generate_masterkey(volume_key_size);
-
- if(!cd->volume_key)
- return -ENOMEM;
-
if (isPLAIN(type))
r = _crypt_format_plain(cd, cipher, cipher_mode,
- uuid, params);
+ uuid, volume_key_size, params);
else if (isLUKS(type))
r = _crypt_format_luks1(cd, cipher, cipher_mode,
- uuid, params);
+ uuid, volume_key, volume_key_size, params);
else {
/* FIXME: allow plugins here? */
log_err(cd, _("Unknown crypt device type %s requested.\n"), type);
r = -ENOMEM;
if (r < 0) {
- LUKS_dealloc_masterkey(cd->volume_key);
+ crypt_free_volume_key(cd->volume_key);
cd->volume_key = NULL;
}
dm_exit();
if (cd->volume_key)
- LUKS_dealloc_masterkey(cd->volume_key);
+ crypt_free_volume_key(cd->volume_key);
free(cd->device);
free(cd->type);
const char *passphrase,
size_t passphrase_size)
{
- struct luks_masterkey *mk = NULL;
+ struct volume_key *vk = NULL;
int r, suspended = 0;
log_dbg("Resuming volume %s.", name);
if (passphrase) {
r = LUKS_open_key_with_hdr(cd->device, keyslot, passphrase,
- passphrase_size, &cd->hdr, &mk, cd);
+ passphrase_size, &cd->hdr, &vk, cd);
} else
- r = volume_key_by_terminal_passphrase(cd, keyslot, &mk);
+ r = volume_key_by_terminal_passphrase(cd, keyslot, &vk);
if (r >= 0) {
keyslot = r;
- r = dm_resume_and_reinstate_key(name, mk->keyLength, mk->key);
+ r = dm_resume_and_reinstate_key(name, vk->keylength, vk->key);
if (r == -ENOTSUP)
log_err(cd, "Resume is not supported for device %s.\n", name);
else if (r)
} else
r = keyslot;
out:
- LUKS_dealloc_masterkey(mk);
+ crypt_free_volume_key(vk);
return r < 0 ? r : keyslot;
}
const char *keyfile,
size_t keyfile_size)
{
- struct luks_masterkey *mk = NULL;
+ struct volume_key *vk = NULL;
char *passphrase_read = NULL;
unsigned int passphrase_size_read;
int r, suspended = 0;
r = -EINVAL;
else {
r = LUKS_open_key_with_hdr(cd->device, keyslot, passphrase_read,
- passphrase_size_read, &cd->hdr, &mk, cd);
+ passphrase_size_read, &cd->hdr, &vk, cd);
safe_free(passphrase_read);
}
if (r >= 0) {
keyslot = r;
- r = dm_resume_and_reinstate_key(name, mk->keyLength, mk->key);
+ r = dm_resume_and_reinstate_key(name, vk->keylength, vk->key);
if (r)
log_err(cd, "Error during resuming device %s.\n", name);
} else
r = keyslot;
out:
- LUKS_dealloc_masterkey(mk);
+ crypt_free_volume_key(vk);
return r < 0 ? r : keyslot;
}
const char *new_passphrase, // NULL -> terminal
size_t new_passphrase_size)
{
- struct luks_masterkey *mk = NULL;
+ struct volume_key *vk = NULL;
char *password = NULL, *new_password = NULL;
unsigned int passwordLen, new_passwordLen;
int r;
if (!LUKS_keyslot_active_count(&cd->hdr)) {
/* No slots used, try to use pre-generated key in header */
if (cd->volume_key) {
- mk = LUKS_alloc_masterkey(cd->volume_key->keyLength, cd->volume_key->key);
- r = mk ? 0 : -ENOMEM;
+ vk = crypt_alloc_volume_key(cd->volume_key->keylength, cd->volume_key->key);
+ r = vk ? 0 : -ENOMEM;
} else {
log_err(cd, _("Cannot add key slot, all slots disabled and no volume key provided.\n"));
return -EINVAL;
} else if (passphrase) {
/* Passphrase provided, use it to unlock existing keyslot */
r = LUKS_open_key_with_hdr(cd->device, CRYPT_ANY_SLOT, passphrase,
- passphrase_size, &cd->hdr, &mk, cd);
+ passphrase_size, &cd->hdr, &vk, cd);
} else {
/* Passphrase not provided, ask first and use it to unlock existing keyslot */
key_from_terminal(cd, _("Enter any passphrase: "),
}
r = LUKS_open_key_with_hdr(cd->device, CRYPT_ANY_SLOT, password,
- passwordLen, &cd->hdr, &mk, cd);
+ passwordLen, &cd->hdr, &vk, cd);
safe_free(password);
}
}
r = LUKS_set_key(cd->device, keyslot, new_password, new_passwordLen,
- &cd->hdr, mk, cd->iteration_time, &cd->PBKDF2_per_sec, cd);
+ &cd->hdr, vk, cd->iteration_time, &cd->PBKDF2_per_sec, cd);
if(r < 0) goto out;
r = 0;
out:
if (!new_passphrase)
safe_free(new_password);
- LUKS_dealloc_masterkey(mk);
+ crypt_free_volume_key(vk);
return r ?: keyslot;
}
const char *new_keyfile,
size_t new_keyfile_size)
{
- struct luks_masterkey *mk=NULL;
+ struct volume_key *vk=NULL;
char *password=NULL; unsigned int passwordLen;
char *new_password = NULL; unsigned int new_passwordLen;
int r;
if (!LUKS_keyslot_active_count(&cd->hdr)) {
/* No slots used, try to use pre-generated key in header */
if (cd->volume_key) {
- mk = LUKS_alloc_masterkey(cd->volume_key->keyLength, cd->volume_key->key);
- r = mk ? 0 : -ENOMEM;
+ vk = crypt_alloc_volume_key(cd->volume_key->keylength, cd->volume_key->key);
+ r = vk ? 0 : -ENOMEM;
} else {
log_err(cd, _("Cannot add key slot, all slots disabled and no volume key provided.\n"));
return -EINVAL;
return -EINVAL;
r = LUKS_open_key_with_hdr(cd->device, CRYPT_ANY_SLOT, password, passwordLen,
- &cd->hdr, &mk, cd);
+ &cd->hdr, &vk, cd);
safe_free(password);
}
}
r = LUKS_set_key(cd->device, keyslot, new_password, new_passwordLen,
- &cd->hdr, mk, cd->iteration_time, &cd->PBKDF2_per_sec, cd);
+ &cd->hdr, vk, cd->iteration_time, &cd->PBKDF2_per_sec, cd);
out:
safe_free(new_password);
- LUKS_dealloc_masterkey(mk);
+ crypt_free_volume_key(vk);
return r < 0 ? r : keyslot;
}
const char *passphrase,
size_t passphrase_size)
{
- struct luks_masterkey *mk = NULL;
+ struct volume_key *vk = NULL;
int r = -EINVAL;
char *new_password = NULL; unsigned int new_passwordLen;
}
if (volume_key)
- mk = LUKS_alloc_masterkey(volume_key_size, volume_key);
+ vk = crypt_alloc_volume_key(volume_key_size, volume_key);
else if (cd->volume_key)
- mk = LUKS_alloc_masterkey(cd->volume_key->keyLength, cd->volume_key->key);
+ vk = crypt_alloc_volume_key(cd->volume_key->keylength, cd->volume_key->key);
- if (!mk)
+ if (!vk)
return -ENOMEM;
- r = LUKS_verify_master_key(&cd->hdr, mk);
+ r = LUKS_verify_volume_key(&cd->hdr, vk);
if (r < 0) {
log_err(cd, _("Volume key does not match the volume.\n"));
goto out;
}
r = LUKS_set_key(cd->device, keyslot, passphrase, passphrase_size,
- &cd->hdr, mk, cd->iteration_time, &cd->PBKDF2_per_sec, cd);
+ &cd->hdr, vk, cd->iteration_time, &cd->PBKDF2_per_sec, cd);
out:
if (new_password)
safe_free(new_password);
- LUKS_dealloc_masterkey(mk);
+ crypt_free_volume_key(vk);
return r ?: keyslot;
}
uint32_t flags)
{
crypt_status_info ci;
- struct luks_masterkey *mk = NULL;
+ struct volume_key *vk = NULL;
char *prompt = NULL;
int r;
if (isPLAIN(cd->type))
return create_device_helper(cd, name, cd->plain_hdr.hash,
cd->plain_cipher, cd->plain_cipher_mode, NULL, passphrase, passphrase_size,
- cd->volume_key->keyLength, 0, cd->plain_hdr.skip,
+ cd->volume_key->keylength, 0, cd->plain_hdr.skip,
cd->plain_hdr.offset, cd->plain_uuid, flags & CRYPT_ACTIVATE_READONLY, 0, 0);
if (name) {
/* provided passphrase, do not retry */
if (passphrase) {
r = LUKS_open_key_with_hdr(cd->device, keyslot, passphrase,
- passphrase_size, &cd->hdr, &mk, cd);
+ passphrase_size, &cd->hdr, &vk, cd);
} else
- r = volume_key_by_terminal_passphrase(cd, keyslot, &mk);
+ r = volume_key_by_terminal_passphrase(cd, keyslot, &vk);
if (r >= 0) {
keyslot = r;
if (name)
- r = open_from_hdr_and_mk(cd, mk, name, flags);
+ r = open_from_hdr_and_vk(cd, vk, name, flags);
}
- LUKS_dealloc_masterkey(mk);
+ crypt_free_volume_key(vk);
free(prompt);
return r < 0 ? r : keyslot;
uint32_t flags)
{
crypt_status_info ci;
- struct luks_masterkey *mk = NULL;
+ struct volume_key *vk = NULL;
char *passphrase_read = NULL;
unsigned int passphrase_size_read;
int r;
r = -EINVAL;
else {
r = LUKS_open_key_with_hdr(cd->device, keyslot, passphrase_read,
- passphrase_size_read, &cd->hdr, &mk, cd);
+ passphrase_size_read, &cd->hdr, &vk, cd);
safe_free(passphrase_read);
}
if (r >= 0) {
keyslot = r;
if (name)
- r = open_from_hdr_and_mk(cd, mk, name, flags);
+ r = open_from_hdr_and_vk(cd, vk, name, flags);
}
- LUKS_dealloc_masterkey(mk);
+ crypt_free_volume_key(vk);
return r < 0 ? r : keyslot;
}
uint32_t flags)
{
crypt_status_info ci;
- struct luks_masterkey *mk;
+ struct volume_key *vk;
int r;
log_dbg("Activating volume %s by volume key.", name);
if (isPLAIN(cd->type))
return create_device_helper(cd, name, NULL,
cd->plain_cipher, cd->plain_cipher_mode, NULL, volume_key, volume_key_size,
- cd->volume_key->keyLength, 0, cd->plain_hdr.skip,
+ cd->volume_key->keylength, 0, cd->plain_hdr.skip,
cd->plain_hdr.offset, cd->plain_uuid, flags & CRYPT_ACTIVATE_READONLY, 0, 0);
if (!isLUKS(cd->type)) {
}
}
- mk = LUKS_alloc_masterkey(volume_key_size, volume_key);
- if (!mk)
+ vk = crypt_alloc_volume_key(volume_key_size, volume_key);
+ if (!vk)
return -ENOMEM;
- r = LUKS_verify_master_key(&cd->hdr, mk);
+ r = LUKS_verify_volume_key(&cd->hdr, vk);
if (r == -EPERM)
log_err(cd, _("Volume key does not match the volume.\n"));
if (!r && name)
- r = open_from_hdr_and_mk(cd, mk, name, flags);
+ r = open_from_hdr_and_vk(cd, vk, name, flags);
- LUKS_dealloc_masterkey(mk);
+ crypt_free_volume_key(vk);
return r;
}
const char *passphrase,
size_t passphrase_size)
{
- struct luks_masterkey *mk;
+ struct volume_key *vk;
char *processed_key = NULL;
int r, key_len;
if (isLUKS(cd->type)) {
r = LUKS_open_key_with_hdr(cd->device, keyslot, passphrase,
- passphrase_size, &cd->hdr, &mk, cd);
+ passphrase_size, &cd->hdr, &vk, cd);
if (r >= 0) {
- memcpy(volume_key, mk->key, mk->keyLength);
- *volume_key_size = mk->keyLength;
+ memcpy(volume_key, vk->key, vk->keylength);
+ *volume_key_size = vk->keylength;
}
- LUKS_dealloc_masterkey(mk);
+ crypt_free_volume_key(vk);
return r;
}
const char *volume_key,
size_t volume_key_size)
{
- struct luks_masterkey *mk;
+ struct volume_key *vk;
int r;
if (!isLUKS(cd->type)) {
return -EINVAL;
}
- mk = LUKS_alloc_masterkey(volume_key_size, volume_key);
- if (!mk)
+ vk = crypt_alloc_volume_key(volume_key_size, volume_key);
+ if (!vk)
return -ENOMEM;
- r = LUKS_verify_master_key(&cd->hdr, mk);
+ r = LUKS_verify_volume_key(&cd->hdr, vk);
if (r == -EPERM)
log_err(cd, _("Volume key does not match the volume.\n"));
- LUKS_dealloc_masterkey(mk);
+ crypt_free_volume_key(vk);
return r;
}
int crypt_get_volume_key_size(struct crypt_device *cd)
{
if (isPLAIN(cd->type))
- return cd->volume_key->keyLength;
+ return cd->volume_key->keylength;
if (isLUKS(cd->type))
return cd->hdr.keyBytes;
return div_round_up(x, m) * m;
}
-struct luks_masterkey *LUKS_alloc_masterkey(int keylength, const char *key)
-{
- struct luks_masterkey *mk=malloc(sizeof(*mk) + keylength);
- if(NULL == mk) return NULL;
- mk->keyLength=keylength;
- if (key)
- memcpy(&mk->key, key, keylength);
- return mk;
-}
-
-void LUKS_dealloc_masterkey(struct luks_masterkey *mk)
-{
- if(NULL != mk) {
- memset(mk->key,0,mk->keyLength);
- mk->keyLength=0;
- free(mk);
- }
-}
-
-struct luks_masterkey *LUKS_generate_masterkey(int keylength)
-{
- struct luks_masterkey *mk=LUKS_alloc_masterkey(keylength, NULL);
- if(NULL == mk) return NULL;
-
- int r = getRandom(mk->key,keylength);
- if(r < 0) {
- LUKS_dealloc_masterkey(mk);
- return NULL;
- }
- return mk;
-}
-
int LUKS_hdr_backup(
const char *backup_file,
const char *device,
}
int LUKS_generate_phdr(struct luks_phdr *header,
- const struct luks_masterkey *mk,
+ const struct volume_key *vk,
const char *cipherName, const char *cipherMode, const char *hashSpec,
const char *uuid, unsigned int stripes,
unsigned int alignPayload,
struct crypt_device *ctx)
{
unsigned int i=0;
- unsigned int blocksPerStripeSet = div_round_up(mk->keyLength*stripes,SECTOR_SIZE);
+ unsigned int blocksPerStripeSet = div_round_up(vk->keylength*stripes,SECTOR_SIZE);
int r;
char luksMagic[] = LUKS_MAGIC;
uuid_t partitionUuid;
strncpy(header->cipherMode,cipherMode,LUKS_CIPHERMODE_L);
strncpy(header->hashSpec,hashSpec,LUKS_HASHSPEC_L);
- header->keyBytes=mk->keyLength;
+ header->keyBytes=vk->keylength;
LUKS_fix_header_compatible(header);
header->mkDigestIterations = at_least((uint32_t)(*PBKDF2_per_sec/1024) * iteration_time_ms,
LUKS_MKD_ITERATIONS_MIN);
- r = PBKDF2_HMAC(header->hashSpec,mk->key,mk->keyLength,
+ r = PBKDF2_HMAC(header->hashSpec,vk->key,vk->keylength,
header->mkDigestSalt,LUKS_SALTSIZE,
header->mkDigestIterations,
header->mkDigest,LUKS_DIGESTSIZE);
int LUKS_set_key(const char *device, unsigned int keyIndex,
const char *password, size_t passwordLen,
- struct luks_phdr *hdr, struct luks_masterkey *mk,
+ struct luks_phdr *hdr, struct volume_key *vk,
uint32_t iteration_time_ms,
uint64_t *PBKDF2_per_sec,
struct crypt_device *ctx)
r = getRandom(hdr->keyblock[keyIndex].passwordSalt, LUKS_SALTSIZE);
if(r < 0) return r;
-// assert((mk->keyLength % TWOFISH_BLOCKSIZE) == 0); FIXME
+// assert((vk->keylength % TWOFISH_BLOCKSIZE) == 0); FIXME
r = PBKDF2_HMAC(hdr->hashSpec, password,passwordLen,
hdr->keyblock[keyIndex].passwordSalt,LUKS_SALTSIZE,
if(r < 0) return r;
/*
- * AF splitting, the masterkey stored in mk->key is splitted to AfMK
+ * AF splitting, the masterkey stored in vk->key is splitted to AfMK
*/
- AFEKSize = hdr->keyblock[keyIndex].stripes*mk->keyLength;
+ AFEKSize = hdr->keyblock[keyIndex].stripes*vk->keylength;
AfKey = (char *)malloc(AFEKSize);
if(AfKey == NULL) return -ENOMEM;
log_dbg("Using hash %s for AF in key slot %d, %d stripes",
hdr->hashSpec, keyIndex, hdr->keyblock[keyIndex].stripes);
- r = AF_split(mk->key,AfKey,mk->keyLength,hdr->keyblock[keyIndex].stripes,hdr->hashSpec);
+ r = AF_split(vk->key,AfKey,vk->keylength,hdr->keyblock[keyIndex].stripes,hdr->hashSpec);
if(r < 0) goto out;
log_dbg("Updating key slot %d [0x%04x] area on device %s.", keyIndex,
return r;
}
-/* Check whether a master key is invalid. */
-int LUKS_verify_master_key(const struct luks_phdr *hdr,
- const struct luks_masterkey *mk)
+/* Check whether a volume key is invalid. */
+int LUKS_verify_volume_key(const struct luks_phdr *hdr,
+ const struct volume_key *vk)
{
char checkHashBuf[LUKS_DIGESTSIZE];
- if (PBKDF2_HMAC(hdr->hashSpec, mk->key, mk->keyLength,
+ if (PBKDF2_HMAC(hdr->hashSpec, vk->key, vk->keylength,
hdr->mkDigestSalt, LUKS_SALTSIZE,
hdr->mkDigestIterations, checkHashBuf,
LUKS_DIGESTSIZE) < 0)
const char *password,
size_t passwordLen,
struct luks_phdr *hdr,
- struct luks_masterkey *mk,
+ struct volume_key *vk,
struct crypt_device *ctx)
{
crypt_keyslot_info ki = LUKS_keyslot_info(hdr, keyIndex);
if (ki < CRYPT_SLOT_ACTIVE)
return -ENOENT;
- // assert((mk->keyLength % TWOFISH_BLOCKSIZE) == 0); FIXME
+ // assert((vk->keylength % TWOFISH_BLOCKSIZE) == 0); FIXME
- AFEKSize = hdr->keyblock[keyIndex].stripes*mk->keyLength;
+ AFEKSize = hdr->keyblock[keyIndex].stripes*vk->keylength;
AfKey = (char *)malloc(AFEKSize);
if(AfKey == NULL) return -ENOMEM;
goto out;
}
- r = AF_merge(AfKey,mk->key,mk->keyLength,hdr->keyblock[keyIndex].stripes,hdr->hashSpec);
+ r = AF_merge(AfKey,vk->key,vk->keylength,hdr->keyblock[keyIndex].stripes,hdr->hashSpec);
if(r < 0) goto out;
- r = LUKS_verify_master_key(hdr, mk);
+ r = LUKS_verify_volume_key(hdr, vk);
if (r >= 0)
log_verbose(ctx, _("Key slot %d unlocked.\n"), keyIndex);
out:
const char *password,
size_t passwordLen,
struct luks_phdr *hdr,
- struct luks_masterkey **mk,
+ struct volume_key **vk,
struct crypt_device *ctx)
{
unsigned int i;
int r;
- *mk = LUKS_alloc_masterkey(hdr->keyBytes, NULL);
+ *vk = crypt_alloc_volume_key(hdr->keyBytes, NULL);
if (keyIndex >= 0)
- return LUKS_open_key(device, keyIndex, password, passwordLen, hdr, *mk, ctx);
+ return LUKS_open_key(device, keyIndex, password, passwordLen, hdr, *vk, ctx);
for(i = 0; i < LUKS_NUMKEYS; i++) {
- r = LUKS_open_key(device, i, password, passwordLen, hdr, *mk, ctx);
+ r = LUKS_open_key(device, i, password, passwordLen, hdr, *vk, ctx);
if(r == 0)
return i;