summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorGonglei2016-09-26 11:23:21 +0200
committerDaniel P. Berrange2016-10-19 11:09:24 +0200
commitf844836ddccf3dbcba142128da5dd8ee618f3e91 (patch)
tree91556d3ea8b8236cf10d16681dacf2d95dfb4232 /block
parentMerge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-request' into st... (diff)
downloadqemu-f844836ddccf3dbcba142128da5dd8ee618f3e91.tar.gz
qemu-f844836ddccf3dbcba142128da5dd8ee618f3e91.tar.xz
qemu-f844836ddccf3dbcba142128da5dd8ee618f3e91.zip
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 94f01b3d0c..7540f43f46 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 0e53a4d666..e11c7c9d16 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;