From 9e4f86a84ea2abfd85c46829310d9bdd563648e1 Mon Sep 17 00:00:00 2001 From: Gonglei Date: Fri, 28 Oct 2016 16:33:21 +0800 Subject: 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 Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- backends/cryptodev.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'backends/cryptodev.c') 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) -- cgit v1.1