projects
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3c28292
)
crypto: add mode check in qcrypto_cipher_new() for cipher-builtin
author
Gonglei
<arei.gonglei@huawei.com>
Mon, 26 Sep 2016 09:23:23 +0000
(17:23 +0800)
committer
Daniel P. Berrange
<berrange@redhat.com>
Wed, 19 Oct 2016 09:09:24 +0000
(10:09 +0100)
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
crypto/cipher-builtin.c
patch
|
blob
|
history
diff --git
a/crypto/cipher-builtin.c
b/crypto/cipher-builtin.c
index fd59a9e4618167e40260b35556f382afdc0b3369..b4bc2b9ca6bc0e969ca5384d1e8d1f0ef7afa96d 100644
(file)
--- a/
crypto/cipher-builtin.c
+++ b/
crypto/cipher-builtin.c
@@
-433,6
+433,17
@@
QCryptoCipher *qcrypto_cipher_new(QCryptoCipherAlgorithm alg,
{
QCryptoCipher *cipher;
+ switch (mode) {
+ case QCRYPTO_CIPHER_MODE_ECB:
+ case QCRYPTO_CIPHER_MODE_CBC:
+ case QCRYPTO_CIPHER_MODE_XTS:
+ break;
+ default:
+ error_setg(errp, "Unsupported cipher mode %s",
+ QCryptoCipherMode_lookup[mode]);
+ return NULL;
+ }
+
cipher = g_new0(QCryptoCipher, 1);
cipher->alg = alg;
cipher->mode = mode;