[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[v3 04/10] crypto: Introduce creation option and structure for detached
From: |
Hyman Huang |
Subject: |
[v3 04/10] crypto: Introduce creation option and structure for detached LUKS header |
Date: |
Mon, 25 Dec 2023 13:26:54 +0800 |
Introduce 'header' field in BlockdevCreateOptionsLUKS to support
detached LUKS header creation. Meanwhile, introduce header-related
field in QCryptoBlock.
Signed-off-by: Hyman Huang <yong.huang@smartx.com>
---
crypto/blockpriv.h | 3 +++
qapi/block-core.json | 3 +++
qapi/crypto.json | 5 ++++-
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/crypto/blockpriv.h b/crypto/blockpriv.h
index 3c7ccea504..6289aea961 100644
--- a/crypto/blockpriv.h
+++ b/crypto/blockpriv.h
@@ -42,6 +42,9 @@ struct QCryptoBlock {
size_t niv;
uint64_t payload_offset; /* In bytes */
uint64_t sector_size; /* In bytes */
+
+ bool detached_header; /* True if disk has a detached LUKS header */
+ uint64_t detached_header_size; /* LUKS header size plus key slot size */
};
struct QCryptoBlockDriver {
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 9ac256c489..8aec179926 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -4948,6 +4948,8 @@
# @file: Node to create the image format on, mandatory except when
# 'preallocation' is not requested
#
+# @header: Detached LUKS header node to format. (since 9.0)
+#
# @size: Size of the virtual disk in bytes
#
# @preallocation: Preallocation mode for the new image (since: 4.2)
@@ -4958,6 +4960,7 @@
{ 'struct': 'BlockdevCreateOptionsLUKS',
'base': 'QCryptoBlockCreateOptionsLUKS',
'data': { '*file': 'BlockdevRef',
+ '*header': 'BlockdevRef',
'size': 'size',
'*preallocation': 'PreallocMode' } }
diff --git a/qapi/crypto.json b/qapi/crypto.json
index fd3d46ebd1..6b4e86cb81 100644
--- a/qapi/crypto.json
+++ b/qapi/crypto.json
@@ -195,10 +195,13 @@
# decryption key. Mandatory except when probing image for
# metadata only.
#
+# @detached-header: if true, disk has detached LUKS header.
+#
# Since: 2.6
##
{ 'struct': 'QCryptoBlockOptionsLUKS',
- 'data': { '*key-secret': 'str' }}
+ 'data': { '*key-secret': 'str',
+ '*detached-header': 'bool' }}
##
# @QCryptoBlockCreateOptionsLUKS:
--
2.39.1
- [v3 00/10] Support generic Luks encryption, Hyman Huang, 2023/12/25
- [v3 01/10] crypto: Introduce option and structure for detached LUKS header, Hyman Huang, 2023/12/25
- [v3 02/10] crypto: Support generic LUKS encryption, Hyman Huang, 2023/12/25
- [v3 03/10] qapi: Make parameter 'file' optional for BlockdevCreateOptionsLUKS, Hyman Huang, 2023/12/25
- [v3 04/10] crypto: Introduce creation option and structure for detached LUKS header,
Hyman Huang <=
- [v3 05/10] crypto: Mark the payload_offset_sector invalid for detached LUKS header, Hyman Huang, 2023/12/25
- [v3 06/10] block: Support detached LUKS header creation using blockdev-create, Hyman Huang, 2023/12/25
- [v3 07/10] block: Support detached LUKS header creation using qemu-img, Hyman Huang, 2023/12/25
- [v3 08/10] crypto: Introduce 'detached-header' field in QCryptoBlockInfoLUKS, Hyman Huang, 2023/12/25
- [v3 09/10] tests: Add detached LUKS header case, Hyman Huang, 2023/12/25
- [v3 10/10] MAINTAINERS: Add section "Detached LUKS header", Hyman Huang, 2023/12/25