All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL for-2.9 0/2] cryptodev patches 20170323
@ 2017-03-23  9:39 Gonglei
  2017-03-23  9:39 ` [Qemu-devel] [PULL for-2.9 1/2] cryptodev: setiv only when really need Gonglei
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gonglei @ 2017-03-23  9:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Gonglei

The following changes since commit 55a19ad8b2d0797e3a8fe90ab99a9bb713824059:

  Update version for v2.9.0-rc1 release (2017-03-21 17:13:29 +0000)

are available in the git repository at:

  https://github.com/gongleiarei/qemu.git tags/cryptodev-next-20170323

for you to fetch changes up to b7bad50ae81efeb180609eeecdb086ebc7536ed7:

  cryptodev: fix asserting single queue (2017-03-23 17:22:01 +0800)

----------------------------------------------------------------
cryptodev fixes

----------------------------------------------------------------

Halil Pasic (1):
  cryptodev: fix asserting single queue

Longpeng(Mike) (1):
  cryptodev: setiv only when really need

 backends/cryptodev-builtin.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

-- 
1.7.12.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL for-2.9 1/2] cryptodev: setiv only when really need
  2017-03-23  9:39 [Qemu-devel] [PULL for-2.9 0/2] cryptodev patches 20170323 Gonglei
@ 2017-03-23  9:39 ` Gonglei
  2017-03-23  9:39 ` [Qemu-devel] [PULL for-2.9 2/2] cryptodev: fix asserting single queue Gonglei
  2017-03-23 14:50 ` [Qemu-devel] [PULL for-2.9 0/2] cryptodev patches 20170323 Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Gonglei @ 2017-03-23  9:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Longpeng(Mike), Gonglei

From: "Longpeng(Mike)" <longpeng2@huawei.com>

ECB mode cipher doesn't need IV, if we setiv for it then qemu
crypto API would report "Expected IV size 0 not **", so we should
setiv only when the cipher algos really need.

Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
 backends/cryptodev-builtin.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c
index 82a068e..b24a299 100644
--- a/backends/cryptodev-builtin.c
+++ b/backends/cryptodev-builtin.c
@@ -320,10 +320,12 @@ static int cryptodev_builtin_sym_operation(
 
     sess = builtin->sessions[op_info->session_id];
 
-    ret = qcrypto_cipher_setiv(sess->cipher, op_info->iv,
-                               op_info->iv_len, errp);
-    if (ret < 0) {
-        return -VIRTIO_CRYPTO_ERR;
+    if (op_info->iv_len > 0) {
+        ret = qcrypto_cipher_setiv(sess->cipher, op_info->iv,
+                                   op_info->iv_len, errp);
+        if (ret < 0) {
+            return -VIRTIO_CRYPTO_ERR;
+        }
     }
 
     if (sess->direction == VIRTIO_CRYPTO_OP_ENCRYPT) {
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL for-2.9 2/2] cryptodev: fix asserting single queue
  2017-03-23  9:39 [Qemu-devel] [PULL for-2.9 0/2] cryptodev patches 20170323 Gonglei
  2017-03-23  9:39 ` [Qemu-devel] [PULL for-2.9 1/2] cryptodev: setiv only when really need Gonglei
@ 2017-03-23  9:39 ` Gonglei
  2017-03-23 14:50 ` [Qemu-devel] [PULL for-2.9 0/2] cryptodev patches 20170323 Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Gonglei @ 2017-03-23  9:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Halil Pasic, Gonglei

From: Halil Pasic <pasic@linux.vnet.ibm.com>

We already check for queues == 1 in cryptodev_builtin_init and when that
is not true raise an error. But before that error is reported the
assertion in cryptodev_builtin_cleanup kicks in (because object is being
finalized and freed).

Let's remove assert(queues == 1) form cryptodev_builtin_cleanup as it
does only harm and no good.

Reported-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
 backends/cryptodev-builtin.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c
index b24a299..657c0ba 100644
--- a/backends/cryptodev-builtin.c
+++ b/backends/cryptodev-builtin.c
@@ -361,8 +361,6 @@ static void cryptodev_builtin_cleanup(
         }
     }
 
-    assert(queues == 1);
-
     for (i = 0; i < queues; i++) {
         cc = backend->conf.peers.ccs[i];
         if (cc) {
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PULL for-2.9 0/2] cryptodev patches 20170323
  2017-03-23  9:39 [Qemu-devel] [PULL for-2.9 0/2] cryptodev patches 20170323 Gonglei
  2017-03-23  9:39 ` [Qemu-devel] [PULL for-2.9 1/2] cryptodev: setiv only when really need Gonglei
  2017-03-23  9:39 ` [Qemu-devel] [PULL for-2.9 2/2] cryptodev: fix asserting single queue Gonglei
@ 2017-03-23 14:50 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2017-03-23 14:50 UTC (permalink / raw)
  To: Gonglei; +Cc: QEMU Developers

On 23 March 2017 at 09:39, Gonglei <arei.gonglei@huawei.com> wrote:
> The following changes since commit 55a19ad8b2d0797e3a8fe90ab99a9bb713824059:
>
>   Update version for v2.9.0-rc1 release (2017-03-21 17:13:29 +0000)
>
> are available in the git repository at:
>
>   https://github.com/gongleiarei/qemu.git tags/cryptodev-next-20170323
>
> for you to fetch changes up to b7bad50ae81efeb180609eeecdb086ebc7536ed7:
>
>   cryptodev: fix asserting single queue (2017-03-23 17:22:01 +0800)
>
> ----------------------------------------------------------------
> cryptodev fixes
>
> ----------------------------------------------------------------

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-23 14:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-23  9:39 [Qemu-devel] [PULL for-2.9 0/2] cryptodev patches 20170323 Gonglei
2017-03-23  9:39 ` [Qemu-devel] [PULL for-2.9 1/2] cryptodev: setiv only when really need Gonglei
2017-03-23  9:39 ` [Qemu-devel] [PULL for-2.9 2/2] cryptodev: fix asserting single queue Gonglei
2017-03-23 14:50 ` [Qemu-devel] [PULL for-2.9 0/2] cryptodev patches 20170323 Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.