aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorGonglei <arei.gonglei@huawei.com>2016-09-26 17:23:21 +0800
committerDaniel P. Berrange <berrange@redhat.com>2016-10-19 10:09:24 +0100
commitf844836ddccf3dbcba142128da5dd8ee618f3e91 (patch)
tree91556d3ea8b8236cf10d16681dacf2d95dfb4232 /block
parente8ddc2eae5ccc41f0815e5c43e70cb04a7e67e2e (diff)
downloadqemu-f844836ddccf3dbcba142128da5dd8ee618f3e91.zip
qemu-f844836ddccf3dbcba142128da5dd8ee618f3e91.tar.gz
qemu-f844836ddccf3dbcba142128da5dd8ee618f3e91.tar.bz2
crypto: extend mode as a parameter in qcrypto_cipher_supports()
It can't guarantee all cipher modes are supported if one cipher algorithm is supported by a backend. Let's extend qcrypto_cipher_supports() to take both the algorithm and mode as parameters. Signed-off-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/qcow.c3
-rw-r--r--block/qcow2.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/block/qcow.c b/block/qcow.c
index 94f01b3..7540f43 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -153,7 +153,8 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
ret = -EINVAL;
goto fail;
}
- if (!qcrypto_cipher_supports(QCRYPTO_CIPHER_ALG_AES_128)) {
+ if (!qcrypto_cipher_supports(QCRYPTO_CIPHER_ALG_AES_128,
+ QCRYPTO_CIPHER_MODE_CBC)) {
error_setg(errp, "AES cipher not available");
ret = -EINVAL;
goto fail;
diff --git a/block/qcow2.c b/block/qcow2.c
index 0e53a4d..e11c7c9 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -959,7 +959,8 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
ret = -EINVAL;
goto fail;
}
- if (!qcrypto_cipher_supports(QCRYPTO_CIPHER_ALG_AES_128)) {
+ if (!qcrypto_cipher_supports(QCRYPTO_CIPHER_ALG_AES_128,
+ QCRYPTO_CIPHER_MODE_CBC)) {
error_setg(errp, "AES cipher not available");
ret = -EINVAL;
goto fail;