mirror of
https://github.com/mii443/qemu.git
synced 2025-12-03 02:58:29 +00: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:
committed by
Daniel P. Berrangé
parent
35286daeca
commit
0bd779e27e
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user