summary refs log tree commit diff stats
path: root/hw
diff options
context:
space:
mode:
authorGonglei <arei.gonglei@huawei.com>2016-10-28 16:33:29 +0800
committerMichael S. Tsirkin <mst@redhat.com>2016-11-01 19:21:08 +0200
commitd6634ac09abf20d890fd094773f125ee0ff0b1cb (patch)
tree1d7a92f2a248141b8404d5a7eaf67c1c40ea9f6c /hw
parent04b9b37edda85964cca033a48dcc0298036782f2 (diff)
downloadfocaccia-qemu-d6634ac09abf20d890fd094773f125ee0ff0b1cb.tar.gz
focaccia-qemu-d6634ac09abf20d890fd094773f125ee0ff0b1cb.zip
cryptodev: introduce an unified wrapper for crypto operation
We use an opaque point to the VirtIOCryptoReq which
can support different packets based on different
algorithms.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/virtio/virtio-crypto.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
index 454384fa7d..c160aa4f15 100644
--- a/hw/virtio/virtio-crypto.c
+++ b/hw/virtio/virtio-crypto.c
@@ -634,15 +634,15 @@ virtio_crypto_handle_request(VirtIOCryptoReq *request)
             /* Set request's parameter */
             request->flags = CRYPTODEV_BACKEND_ALG_SYM;
             request->u.sym_op_info = sym_op_info;
-            ret = cryptodev_backend_sym_operation(vcrypto->cryptodev,
-                                    sym_op_info, queue_index, &local_err);
+            ret = cryptodev_backend_crypto_operation(vcrypto->cryptodev,
+                                    request, queue_index, &local_err);
             if (ret < 0) {
-                status = VIRTIO_CRYPTO_ERR;
+                status = -ret;
                 if (local_err) {
                     error_report_err(local_err);
                 }
-            } else { /* ret >= 0 */
-                status = VIRTIO_CRYPTO_OK;
+            } else { /* ret == VIRTIO_CRYPTO_OK */
+                status = ret;
             }
             virtio_crypto_req_complete(request, status);
             virtio_crypto_free_request(request);