Message ID | 20230725162457.156429-2-berrange@redhat.com |
---|---|
State | New |
Headers | show |
Series | [PULL,1/2] crypto: Always initialize splitkeylen | expand |
diff --git a/crypto/block-luks.c b/crypto/block-luks.c index 5688783ab1..2f59c3a625 100644 --- a/crypto/block-luks.c +++ b/crypto/block-luks.c @@ -706,14 +706,14 @@ qcrypto_block_luks_store_key(QCryptoBlock *block, assert(slot_idx < QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS); slot = &luks->header.key_slots[slot_idx]; + splitkeylen = luks->header.master_key_len * slot->stripes; + if (qcrypto_random_bytes(slot->salt, QCRYPTO_BLOCK_LUKS_SALT_LEN, errp) < 0) { goto cleanup; } - splitkeylen = luks->header.master_key_len * slot->stripes; - /* * Determine how many iterations are required to * hash the user password while consuming 1 second of compute