aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorHyman Huang <yong.huang@smartx.com>2024-01-30 13:37:21 +0800
committerDaniel P. Berrangé <berrange@redhat.com>2024-02-09 12:50:37 +0000
commitd74523a3b395dc8470177dcdfa13644b98494334 (patch)
tree11ed4fb7871308c31292329814d888725d238a36 /block
parent433957bb7f99d7577601949c92f2fffa9457cd7b (diff)
downloadqemu-d74523a3b395dc8470177dcdfa13644b98494334.zip
qemu-d74523a3b395dc8470177dcdfa13644b98494334.tar.gz
qemu-d74523a3b395dc8470177dcdfa13644b98494334.tar.bz2
crypto: Modify the qcrypto_block_create to support creation flags
Expand the signature of qcrypto_block_create to enable the formation of LUKS volumes with detachable headers. To accomplish that, introduce QCryptoBlockCreateFlags to instruct the creation process to set the payload_offset_sector to 0. 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 'block')
-rw-r--r--block/crypto.c1
-rw-r--r--block/qcow.c2
-rw-r--r--block/qcow2.c2
3 files changed, 3 insertions, 2 deletions
diff --git a/block/crypto.c b/block/crypto.c
index e87dc84..1b3f879 100644
--- a/block/crypto.c
+++ b/block/crypto.c
@@ -369,6 +369,7 @@ block_crypto_co_create_generic(BlockDriverState *bs, int64_t size,
block_crypto_create_init_func,
block_crypto_create_write_func,
&data,
+ 0,
errp);
if (!crypto) {
diff --git a/block/qcow.c b/block/qcow.c
index c6d0e15..ca8e1d5 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -885,7 +885,7 @@ qcow_co_create(BlockdevCreateOptions *opts, Error **errp)
header.crypt_method = cpu_to_be32(QCOW_CRYPT_AES);
crypto = qcrypto_block_create(qcow_opts->encrypt, "encrypt.",
- NULL, NULL, NULL, errp);
+ NULL, NULL, NULL, 0, errp);
if (!crypto) {
ret = -EINVAL;
goto exit;
diff --git a/block/qcow2.c b/block/qcow2.c
index 9bee66f..204f585 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -3216,7 +3216,7 @@ qcow2_set_up_encryption(BlockDriverState *bs,
crypto = qcrypto_block_create(cryptoopts, "encrypt.",
qcow2_crypto_hdr_init_func,
qcow2_crypto_hdr_write_func,
- bs, errp);
+ bs, 0, errp);
if (!crypto) {
return -EINVAL;
}