diff options
author | Hyman Huang <yong.huang@smartx.com> | 2024-01-30 13:37:24 +0800 |
---|---|---|
committer | Daniel P. Berrangé <berrange@redhat.com> | 2024-02-09 12:50:37 +0000 |
commit | 0bd779e27ee7c737fdaee2e52e6d1c5951375177 (patch) | |
tree | 718ed448aaaf6343804b27fbe72bf2cb1cb339bc /crypto | |
parent | 35286daeca43444aa1a9c7a36ffc499877eb6668 (diff) |
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>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/block-luks.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/crypto/block-luks.c b/crypto/block-luks.c index ab52c9dce1..3ee928fb5a 100644 --- a/crypto/block-luks.c +++ b/crypto/block-luks.c @@ -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); |