[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC v1 3/9] cryptodev: add missing op_code for symmertric
From: |
Gonglei |
Subject: |
[Qemu-devel] [RFC v1 3/9] cryptodev: add missing op_code for symmertric crypto |
Date: |
Mon, 8 May 2017 19:38:18 +0800 |
We need the op_code to identify which of crypto
operations for stateless crypto operation.
Let's add it.
Signed-off-by: Gonglei <address@hidden>
---
backends/cryptodev-builtin.c | 7 +++++++
include/sysemu/cryptodev.h | 3 +++
2 files changed, 10 insertions(+)
diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c
index abc2655..1e72985 100644
--- a/backends/cryptodev-builtin.c
+++ b/backends/cryptodev-builtin.c
@@ -334,6 +334,13 @@ static int cryptodev_builtin_sym_operation(
return -VIRTIO_CRYPTO_NOTSUPP;
}
+ if (op_info->op_code != VIRTIO_CRYPTO_CIPHER_ENCRYPT &&
+ op_info->op_code != VIRTIO_CRYPTO_CIPHER_DECRYPT) {
+ error_setg(errp,
+ "Unsupported op code: %u", op_info->op_code);
+ return -VIRTIO_CRYPTO_NOTSUPP;
+ }
+
sess = builtin->sessions[op_info->session_id];
if (op_info->iv_len > 0) {
diff --git a/include/sysemu/cryptodev.h b/include/sysemu/cryptodev.h
index be507f7..d75f2e7 100644
--- a/include/sysemu/cryptodev.h
+++ b/include/sysemu/cryptodev.h
@@ -103,6 +103,7 @@ typedef struct CryptoDevBackendSymSessionInfo {
*
* @session_id: session index which was previously
* created by cryptodev_backend_sym_create_session()
+ * @op_code: operation code (refer to virtio_crypto.h)
* @aad_len: byte length of additional authenticated data
* @iv_len: byte length of initialization vector or counter
* @src_len: byte length of source data
@@ -129,6 +130,8 @@ typedef struct CryptoDevBackendSymSessionInfo {
*/
typedef struct CryptoDevBackendSymOpInfo {
uint64_t session_id;
+ /* corresponding with virtio crypto spec */
+ uint32_t op_code;
uint32_t aad_len;
uint32_t iv_len;
uint32_t src_len;
--
1.8.3.1
[Qemu-devel] [RFC v1 5/9] virtio-crypto: update header file, Gonglei, 2017/05/08
[Qemu-devel] [RFC v1 3/9] cryptodev: add missing op_code for symmertric crypto,
Gonglei <=
[Qemu-devel] [RFC v1 9/9] qtest: emulate virtio crypto as a legacy device for experiment, Gonglei, 2017/05/08
[Qemu-devel] [RFC v1 8/9] virtio-crypto: add host feature bits support, Gonglei, 2017/05/08
[Qemu-devel] [RFC v1 7/9] virtio-crypto: add stateless crypto request handler, Gonglei, 2017/05/08
[Qemu-devel] [RFC v1 1/9] cryptodev: introduce stateless sym operation stuff, Gonglei, 2017/05/08
[Qemu-devel] [RFC v1 2/9] cryptodev: extract one util function, Gonglei, 2017/05/08
[Qemu-devel] [RFC v1 4/9] cryptodev-builtin: realize stateless operation function, Gonglei, 2017/05/08