[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 042/100] block: add ability to set a prefix for opt n
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 042/100] block: add ability to set a prefix for opt names |
Date: |
Fri, 7 Jul 2017 19:07:57 +0200 |
From: "Daniel P. Berrange" <address@hidden>
When integrating the crypto support with qcow/qcow2, we don't
want to use the bare LUKS option names "hash-alg", "key-secret",
etc. We need to namespace them to match the nested QAPI schema.
e.g. "encrypt.hash-alg", "encrypt.key-secret"
so that they don't clash with any general qcow options at a later
date.
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
Signed-off-by: Daniel P. Berrange <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
block/crypto.c | 16 ++++++++--------
block/crypto.h | 40 ++++++++++++++++++++--------------------
2 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/block/crypto.c b/block/crypto.c
index ea40ba4..9df1e5d 100644
--- a/block/crypto.c
+++ b/block/crypto.c
@@ -129,7 +129,7 @@ static QemuOptsList block_crypto_runtime_opts_luks = {
.name = "crypto",
.head = QTAILQ_HEAD_INITIALIZER(block_crypto_runtime_opts_luks.head),
.desc = {
- BLOCK_CRYPTO_OPT_DEF_LUKS_KEY_SECRET,
+ BLOCK_CRYPTO_OPT_DEF_LUKS_KEY_SECRET(""),
{ /* end of list */ }
},
};
@@ -144,13 +144,13 @@ static QemuOptsList block_crypto_create_opts_luks = {
.type = QEMU_OPT_SIZE,
.help = "Virtual disk size"
},
- BLOCK_CRYPTO_OPT_DEF_LUKS_KEY_SECRET,
- BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_ALG,
- BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_MODE,
- BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_ALG,
- BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_HASH_ALG,
- BLOCK_CRYPTO_OPT_DEF_LUKS_HASH_ALG,
- BLOCK_CRYPTO_OPT_DEF_LUKS_ITER_TIME,
+ BLOCK_CRYPTO_OPT_DEF_LUKS_KEY_SECRET(""),
+ BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_ALG(""),
+ BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_MODE(""),
+ BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_ALG(""),
+ BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_HASH_ALG(""),
+ BLOCK_CRYPTO_OPT_DEF_LUKS_HASH_ALG(""),
+ BLOCK_CRYPTO_OPT_DEF_LUKS_ITER_TIME(""),
{ /* end of list */ }
},
};
diff --git a/block/crypto.h b/block/crypto.h
index c0e9b54..3430dcd 100644
--- a/block/crypto.h
+++ b/block/crypto.h
@@ -29,51 +29,51 @@
#define BLOCK_CRYPTO_OPT_LUKS_HASH_ALG "hash-alg"
#define BLOCK_CRYPTO_OPT_LUKS_ITER_TIME "iter-time"
-#define BLOCK_CRYPTO_OPT_DEF_LUKS_KEY_SECRET \
+#define BLOCK_CRYPTO_OPT_DEF_LUKS_KEY_SECRET(prefix) \
{ \
- .name = BLOCK_CRYPTO_OPT_LUKS_KEY_SECRET, \
+ .name = prefix BLOCK_CRYPTO_OPT_LUKS_KEY_SECRET, \
.type = QEMU_OPT_STRING, \
.help = "ID of the secret that provides the keyslot passphrase", \
}
-#define BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_ALG \
+#define BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_ALG(prefix) \
{ \
- .name = BLOCK_CRYPTO_OPT_LUKS_CIPHER_ALG, \
+ .name = prefix BLOCK_CRYPTO_OPT_LUKS_CIPHER_ALG, \
.type = QEMU_OPT_STRING, \
.help = "Name of encryption cipher algorithm", \
}
-#define BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_MODE \
- { \
- .name = BLOCK_CRYPTO_OPT_LUKS_CIPHER_MODE, \
- .type = QEMU_OPT_STRING, \
- .help = "Name of encryption cipher mode", \
+#define BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_MODE(prefix) \
+ { \
+ .name = prefix BLOCK_CRYPTO_OPT_LUKS_CIPHER_MODE, \
+ .type = QEMU_OPT_STRING, \
+ .help = "Name of encryption cipher mode", \
}
-#define BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_ALG \
- { \
- .name = BLOCK_CRYPTO_OPT_LUKS_IVGEN_ALG, \
- .type = QEMU_OPT_STRING, \
- .help = "Name of IV generator algorithm", \
+#define BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_ALG(prefix) \
+ { \
+ .name = prefix BLOCK_CRYPTO_OPT_LUKS_IVGEN_ALG, \
+ .type = QEMU_OPT_STRING, \
+ .help = "Name of IV generator algorithm", \
}
-#define BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_HASH_ALG \
+#define BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_HASH_ALG(prefix) \
{ \
- .name = BLOCK_CRYPTO_OPT_LUKS_IVGEN_HASH_ALG, \
+ .name = prefix BLOCK_CRYPTO_OPT_LUKS_IVGEN_HASH_ALG, \
.type = QEMU_OPT_STRING, \
.help = "Name of IV generator hash algorithm", \
}
-#define BLOCK_CRYPTO_OPT_DEF_LUKS_HASH_ALG \
+#define BLOCK_CRYPTO_OPT_DEF_LUKS_HASH_ALG(prefix) \
{ \
- .name = BLOCK_CRYPTO_OPT_LUKS_HASH_ALG, \
+ .name = prefix BLOCK_CRYPTO_OPT_LUKS_HASH_ALG, \
.type = QEMU_OPT_STRING, \
.help = "Name of encryption hash algorithm", \
}
-#define BLOCK_CRYPTO_OPT_DEF_LUKS_ITER_TIME \
+#define BLOCK_CRYPTO_OPT_DEF_LUKS_ITER_TIME(prefix) \
{ \
- .name = BLOCK_CRYPTO_OPT_LUKS_ITER_TIME, \
+ .name = prefix BLOCK_CRYPTO_OPT_LUKS_ITER_TIME, \
.type = QEMU_OPT_NUMBER, \
.help = "Time to spend in PBKDF in milliseconds", \
}
--
1.8.3.1
- [Qemu-block] [PULL 032/100] mirror: Switch mirror_iteration() to byte-based, (continued)
- [Qemu-block] [PULL 032/100] mirror: Switch mirror_iteration() to byte-based, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 033/100] block: Drop unused bdrv_round_sectors_to_clusters(), Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 034/100] backup: Switch BackupBlockJob to byte-based, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 037/100] backup: Switch backup_run() to byte-based, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 035/100] backup: Switch block_backup.h to byte-based, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 036/100] backup: Switch backup_do_cow() to byte-based, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 039/100] block: Minimize raw use of bds->total_sectors, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 040/100] block: Make bdrv_is_allocated_above() byte-based, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 038/100] block: Make bdrv_is_allocated() byte-based, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 044/100] qcow: require image size to be > 1 for new images, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 042/100] block: add ability to set a prefix for opt names,
Kevin Wolf <=
- [Qemu-block] [PULL 043/100] qcow: document another weakness of qcow AES encryption, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 046/100] iotests: skip 048 with qcow which doesn't support resize, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 041/100] block: expose crypto option names / defs to other drivers, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 045/100] iotests: skip 042 with qcow which dosn't support zero sized images, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 049/100] qcow: convert QCow to use QCryptoBlock for encryption, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 047/100] block: deprecate "encryption=on" in favor of "encrypt.format=aes", Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 052/100] qcow2: extend specification to cover LUKS encryption, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 050/100] qcow2: make qcow2_encrypt_sectors encrypt in place, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 055/100] iotests: enable tests 134 and 158 to work with qcow (v1), Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 054/100] qcow2: add iotests to cover LUKS encryption support, Kevin Wolf, 2017/07/07