qcrypto-luks: pass keyslot index rather that pointer to the keyslot
Another minor refactoring Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
1ddd52e4b5
commit
7e60a6f53d
@ -410,7 +410,7 @@ qcrypto_block_luks_essiv_cipher(QCryptoCipherAlgorithm cipher,
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
qcrypto_block_luks_load_key(QCryptoBlock *block,
|
qcrypto_block_luks_load_key(QCryptoBlock *block,
|
||||||
QCryptoBlockLUKSKeySlot *slot,
|
size_t slot_idx,
|
||||||
const char *password,
|
const char *password,
|
||||||
QCryptoCipherAlgorithm cipheralg,
|
QCryptoCipherAlgorithm cipheralg,
|
||||||
QCryptoCipherMode ciphermode,
|
QCryptoCipherMode ciphermode,
|
||||||
@ -424,6 +424,7 @@ qcrypto_block_luks_load_key(QCryptoBlock *block,
|
|||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
QCryptoBlockLUKS *luks = block->opaque;
|
QCryptoBlockLUKS *luks = block->opaque;
|
||||||
|
const QCryptoBlockLUKSKeySlot *slot = &luks->header.key_slots[slot_idx];
|
||||||
g_autofree uint8_t *splitkey = NULL;
|
g_autofree uint8_t *splitkey = NULL;
|
||||||
size_t splitkeylen;
|
size_t splitkeylen;
|
||||||
g_autofree uint8_t *possiblekey = NULL;
|
g_autofree uint8_t *possiblekey = NULL;
|
||||||
@ -580,13 +581,12 @@ qcrypto_block_luks_find_key(QCryptoBlock *block,
|
|||||||
void *opaque,
|
void *opaque,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
QCryptoBlockLUKS *luks = block->opaque;
|
|
||||||
size_t i;
|
size_t i;
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
for (i = 0; i < QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS; i++) {
|
for (i = 0; i < QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS; i++) {
|
||||||
rv = qcrypto_block_luks_load_key(block,
|
rv = qcrypto_block_luks_load_key(block,
|
||||||
&luks->header.key_slots[i],
|
i,
|
||||||
password,
|
password,
|
||||||
cipheralg,
|
cipheralg,
|
||||||
ciphermode,
|
ciphermode,
|
||||||
|
Loading…
Reference in New Issue
Block a user