diff options
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/cipher-builtin.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/crypto/cipher-builtin.c b/crypto/cipher-builtin.c index fd59a9e461..b4bc2b9ca6 100644 --- 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; |