mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
crypto: Introduce 'detached-header' field in QCryptoBlockInfoLUKS
When querying the LUKS disk with the qemu-img tool or other APIs, add information about whether the LUKS header is detached. Additionally, update the test case with the appropriate modification. Signed-off-by: Hyman Huang <yong.huang@smartx.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
35286daeca
commit
0bd779e27e
3 changed files with 9 additions and 0 deletions
|
@ -1271,6 +1271,7 @@ qcrypto_block_luks_open(QCryptoBlock *block,
|
|||
block->sector_size = QCRYPTO_BLOCK_LUKS_SECTOR_SIZE;
|
||||
block->payload_offset = luks->header.payload_offset_sector *
|
||||
block->sector_size;
|
||||
block->detached_header = (block->payload_offset == 0) ? true : false;
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -1895,6 +1896,7 @@ static int qcrypto_block_luks_get_info(QCryptoBlock *block,
|
|||
info->u.luks.master_key_iters = luks->header.master_key_iterations;
|
||||
info->u.luks.uuid = g_strndup((const char *)luks->header.uuid,
|
||||
sizeof(luks->header.uuid));
|
||||
info->u.luks.detached_header = block->detached_header;
|
||||
|
||||
for (i = 0; i < QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS; i++) {
|
||||
slot = g_new0(QCryptoBlockInfoLUKSSlot, 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue