From: "Longpeng(Mike)" <longpeng2@huawei.com>
To: arei.gonglei@huawei.com, pasic@linux.vnet.ibm.com
Cc: weidong.huang@huawei.com, wangxinxin.wang@huawei.com,
jianjay.zhou@huawei.com, qemu-devel@nongnu.org,
"Longpeng(Mike)" <longpeng2@huawei.com>
Subject: [Qemu-devel] [RFC 06/10] cryptodev: add stateless mode cipher support
Date: Mon, 6 Nov 2017 14:56:58 +0800 [thread overview]
Message-ID: <1509951422-20060-7-git-send-email-longpeng2@huawei.com> (raw)
In-Reply-To: <1509951422-20060-1-git-send-email-longpeng2@huawei.com>
Adds stateless mode cipher support.
Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
---
backends/cryptodev.c | 21 +++++++++++++++++++++
include/hw/virtio/virtio-crypto.h | 1 +
include/sysemu/cryptodev.h | 18 ++++++++++++++++++
3 files changed, 40 insertions(+)
diff --git a/backends/cryptodev.c b/backends/cryptodev.c
index 67edfa5..e06ab12 100644
--- a/backends/cryptodev.c
+++ b/backends/cryptodev.c
@@ -120,6 +120,21 @@ static int cryptodev_backend_sym_operation(
return -VIRTIO_CRYPTO_ERR;
}
+static int cryptodev_backend_sym_stateless_operation(
+ CryptoDevBackend *backend,
+ CryptoDevBackendSymStatelessInfo *op_info,
+ uint32_t queue_index, Error **errp)
+{
+ CryptoDevBackendClass *bc =
+ CRYPTODEV_BACKEND_GET_CLASS(backend);
+
+ if (bc->do_sym_stateless_op) {
+ return bc->do_sym_stateless_op(backend, op_info, queue_index, errp);
+ }
+
+ return -VIRTIO_CRYPTO_ERR;
+}
+
int cryptodev_backend_crypto_operation(
CryptoDevBackend *backend,
void *opaque,
@@ -133,6 +148,12 @@ int cryptodev_backend_crypto_operation(
return cryptodev_backend_sym_operation(backend,
op_info, queue_index, errp);
+ } else if (req->flags == CRYPTODEV_BACKEND_ALG_SYM_STATELESS) {
+ CryptoDevBackendSymStatelessInfo *op_info;
+ op_info = req->u.sym_stateless_info;
+
+ return cryptodev_backend_sym_stateless_operation(backend,
+ op_info, queue_index, errp);
} else {
error_setg(errp, "Unsupported cryptodev alg type: %" PRIu32 "",
req->flags);
diff --git a/include/hw/virtio/virtio-crypto.h b/include/hw/virtio/virtio-crypto.h
index a00a0bf..465ad20 100644
--- a/include/hw/virtio/virtio-crypto.h
+++ b/include/hw/virtio/virtio-crypto.h
@@ -73,6 +73,7 @@ typedef struct VirtIOCryptoReq {
struct VirtIOCrypto *vcrypto;
union {
CryptoDevBackendSymOpInfo *sym_op_info;
+ CryptoDevBackendSymStatelessInfo *sym_stateless_info;
} u;
} VirtIOCryptoReq;
diff --git a/include/sysemu/cryptodev.h b/include/sysemu/cryptodev.h
index a9d0d1e..aa2fcd8 100644
--- a/include/sysemu/cryptodev.h
+++ b/include/sysemu/cryptodev.h
@@ -58,6 +58,7 @@ typedef struct CryptoDevBackend CryptoDevBackend;
enum CryptoDevBackendAlgType {
CRYPTODEV_BACKEND_ALG_SYM,
+ CRYPTODEV_BACKEND_ALG_SYM_STATELESS,
CRYPTODEV_BACKEND_ALG__MAX,
};
@@ -146,6 +147,20 @@ typedef struct CryptoDevBackendSymOpInfo {
uint8_t data[0];
} CryptoDevBackendSymOpInfo;
+/**
+ * CryptoDevBackendSymStatelessInfo:
+ *
+ * @session_info: session information, see above
+ * CryptoDevBackendSymSessionInfo
+ * @op_info: crypto operation information, see above
+ * CryptoDevBackendSymOpInfo, @session_id is ignored
+ *
+ **/
+typedef struct CryptoDevBackendSymStatelessInfo {
+ CryptoDevBackendSymSessionInfo session_info;
+ CryptoDevBackendSymOpInfo op_info;
+} CryptoDevBackendSymStatelessInfo;
+
typedef struct CryptoDevBackendClass {
ObjectClass parent_class;
@@ -161,6 +176,9 @@ typedef struct CryptoDevBackendClass {
int (*do_sym_op)(CryptoDevBackend *backend,
CryptoDevBackendSymOpInfo *op_info,
uint32_t queue_index, Error **errp);
+ int (*do_sym_stateless_op)(CryptoDevBackend *backend,
+ CryptoDevBackendSymStatelessInfo *op_info,
+ uint32_t queue_index, Error **errp);
} CryptoDevBackendClass;
--
1.8.3.1
next prev parent reply other threads:[~2017-11-06 6:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-06 6:56 [Qemu-devel] [RFC 00/10] virtio-crypto: add multiplexing mode support Longpeng(Mike)
2017-11-06 6:56 ` [Qemu-devel] [RFC 01/10] virtio-crypto: remove virtio_crypto_op_ctrl_req structure Longpeng(Mike)
2017-11-06 6:56 ` [Qemu-devel] [RFC 02/10] virtio-crypto: add session creation logic for mux mode Longpeng(Mike)
2017-11-06 6:56 ` [Qemu-devel] [RFC 03/10] virtio-crypto: remove queue_id field in ctrl header Longpeng(Mike)
2017-11-06 6:56 ` [Qemu-devel] [RFC 04/10] virtio-crypto: remove virtio_crypto_op_data_req structure Longpeng(Mike)
2017-11-06 6:56 ` [Qemu-devel] [RFC 05/10] virtio-crypto: add dataq operation logic for mux mode Longpeng(Mike)
2017-11-06 6:56 ` Longpeng(Mike) [this message]
2017-11-06 6:56 ` [Qemu-devel] [RFC 07/10] virtio-crypto: add stateless crypto request handler Longpeng(Mike)
2017-11-06 6:57 ` [Qemu-devel] [RFC 08/10] cryptodev: extract one util function Longpeng(Mike)
2017-11-06 6:57 ` [Qemu-devel] [RFC 09/10] cryptodev-builtin: add stateless cipher support Longpeng(Mike)
2017-11-06 6:57 ` [Qemu-devel] [RFC 10/10] virtio-crypto: add host feature bits support Longpeng(Mike)
2017-11-06 7:57 ` [Qemu-devel] [RFC 00/10] virtio-crypto: add multiplexing mode support no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1509951422-20060-7-git-send-email-longpeng2@huawei.com \
--to=longpeng2@huawei.com \
--cc=arei.gonglei@huawei.com \
--cc=jianjay.zhou@huawei.com \
--cc=pasic@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=wangxinxin.wang@huawei.com \
--cc=weidong.huang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).