summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-03-23 13:43:32 +0000
committerPeter Maydell <peter.maydell@linaro.org>2017-03-23 13:43:32 +0000
commitb79fbb2d70524548abfb8482bd1e5713b5f7dcdc (patch)
tree39865bd8f02e344beb153569fc2666d69b9f08e2
parentd81d857f4421d205395d55200425daa6591c28a5 (diff)
parentb7bad50ae81efeb180609eeecdb086ebc7536ed7 (diff)
downloadfocaccia-qemu-b79fbb2d70524548abfb8482bd1e5713b5f7dcdc.tar.gz
focaccia-qemu-b79fbb2d70524548abfb8482bd1e5713b5f7dcdc.zip
Merge remote-tracking branch 'remotes/gonglei/tags/cryptodev-next-20170323' into staging
cryptodev fixes

# gpg: Signature made Thu 23 Mar 2017 09:22:44 GMT
# gpg:                using RSA key 0x2ED7FDE9063C864D
# gpg: Good signature from "Gonglei <arei.gonglei@huawei.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 3EF1 8E53 3459 E6D1 963A  3C05 2ED7 FDE9 063C 864D

* remotes/gonglei/tags/cryptodev-next-20170323:
  cryptodev: fix asserting single queue
  cryptodev: setiv only when really need

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--backends/cryptodev-builtin.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c
index 82a068e792..657c0ba2f3 100644
--- a/backends/cryptodev-builtin.c
+++ b/backends/cryptodev-builtin.c
@@ -320,10 +320,12 @@ static int cryptodev_builtin_sym_operation(
 
     sess = builtin->sessions[op_info->session_id];
 
-    ret = qcrypto_cipher_setiv(sess->cipher, op_info->iv,
-                               op_info->iv_len, errp);
-    if (ret < 0) {
-        return -VIRTIO_CRYPTO_ERR;
+    if (op_info->iv_len > 0) {
+        ret = qcrypto_cipher_setiv(sess->cipher, op_info->iv,
+                                   op_info->iv_len, errp);
+        if (ret < 0) {
+            return -VIRTIO_CRYPTO_ERR;
+        }
     }
 
     if (sess->direction == VIRTIO_CRYPTO_OP_ENCRYPT) {
@@ -359,8 +361,6 @@ static void cryptodev_builtin_cleanup(
         }
     }
 
-    assert(queues == 1);
-
     for (i = 0; i < queues; i++) {
         cc = backend->conf.peers.ccs[i];
         if (cc) {