qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

crypto: add mode check in qcrypto_cipher_new() for cipher-builtin

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>

authored by

Gonglei and committed by
Daniel P. Berrange
77cf26cd 3c28292f

+11
+11
crypto/cipher-builtin.c
··· 433 433 { 434 434 QCryptoCipher *cipher; 435 435 436 + switch (mode) { 437 + case QCRYPTO_CIPHER_MODE_ECB: 438 + case QCRYPTO_CIPHER_MODE_CBC: 439 + case QCRYPTO_CIPHER_MODE_XTS: 440 + break; 441 + default: 442 + error_setg(errp, "Unsupported cipher mode %s", 443 + QCryptoCipherMode_lookup[mode]); 444 + return NULL; 445 + } 446 + 436 447 cipher = g_new0(QCryptoCipher, 1); 437 448 cipher->alg = alg; 438 449 cipher->mode = mode;