diff options
author | Gonglei <arei.gonglei@huawei.com> | 2016-10-28 16:33:21 +0800 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2016-10-30 20:06:22 +0200 |
commit | 9e4f86a84ea2abfd85c46829310d9bdd563648e1 (patch) | |
tree | 13eea8d7abe7f67f5b9490d4cbc351d01ecabde6 /backends/cryptodev.c | |
parent | d0ee7a135fe499dd900bdca4d70efc2beaa6ef9c (diff) | |
download | qemu-9e4f86a84ea2abfd85c46829310d9bdd563648e1.zip qemu-9e4f86a84ea2abfd85c46829310d9bdd563648e1.tar.gz qemu-9e4f86a84ea2abfd85c46829310d9bdd563648e1.tar.bz2 |
cryptodev: add symmetric algorithm operation stuff
This patch adds session operation and crypto operation
stuff in the cryptodev backend, including function
pointers and corresponding structures.
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 'backends/cryptodev.c')
-rw-r--r-- | backends/cryptodev.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/backends/cryptodev.c b/backends/cryptodev.c index e8582cd..47521cf 100644 --- a/backends/cryptodev.c +++ b/backends/cryptodev.c @@ -75,6 +75,51 @@ void cryptodev_backend_cleanup( backend->ready = false; } +int64_t cryptodev_backend_sym_create_session( + CryptoDevBackend *backend, + CryptoDevBackendSymSessionInfo *sess_info, + uint32_t queue_index, Error **errp) +{ + CryptoDevBackendClass *bc = + CRYPTODEV_BACKEND_GET_CLASS(backend); + + if (bc->create_session) { + return bc->create_session(backend, sess_info, queue_index, errp); + } + + return -1; +} + +int cryptodev_backend_sym_close_session( + CryptoDevBackend *backend, + uint64_t session_id, + uint32_t queue_index, Error **errp) +{ + CryptoDevBackendClass *bc = + CRYPTODEV_BACKEND_GET_CLASS(backend); + + if (bc->close_session) { + return bc->close_session(backend, session_id, queue_index, errp); + } + + return -1; +} + +int cryptodev_backend_sym_operation( + CryptoDevBackend *backend, + CryptoDevBackendSymOpInfo *op_info, + uint32_t queue_index, Error **errp) +{ + CryptoDevBackendClass *bc = + CRYPTODEV_BACKEND_GET_CLASS(backend); + + if (bc->do_sym_op) { + return bc->do_sym_op(backend, op_info, queue_index, errp); + } + + return -1; +} + static void cryptodev_backend_get_queues(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) |