From nobody Sun Apr 28 20:33:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490262157583677.0385429925714; Thu, 23 Mar 2017 02:42:37 -0700 (PDT) Received: from localhost ([::1]:55175 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqzGO-0003DN-9p for importer@patchew.org; Thu, 23 Mar 2017 05:42:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqzEX-00026H-1v for qemu-devel@nongnu.org; Thu, 23 Mar 2017 05:40:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqzET-0003sC-Uo for qemu-devel@nongnu.org; Thu, 23 Mar 2017 05:40:41 -0400 Received: from [45.249.212.187] (port=3009 helo=dggrg01-dlp.huawei.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1cqzET-0003bF-5s for qemu-devel@nongnu.org; Thu, 23 Mar 2017 05:40:37 -0400 Received: from 172.30.72.57 (EHLO DGGEML404-HUB.china.huawei.com) ([172.30.72.57]) by dggrg01-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id ALG18856; Thu, 23 Mar 2017 17:39:36 +0800 (CST) Received: from localhost (10.177.18.62) by DGGEML404-HUB.china.huawei.com (10.3.17.39) with Microsoft SMTP Server id 14.3.301.0; Thu, 23 Mar 2017 17:39:25 +0800 From: Gonglei To: Date: Thu, 23 Mar 2017 17:39:10 +0800 Message-ID: <1490261951-21352-2-git-send-email-arei.gonglei@huawei.com> X-Mailer: git-send-email 2.8.2.windows.1 In-Reply-To: <1490261951-21352-1-git-send-email-arei.gonglei@huawei.com> References: <1490261951-21352-1-git-send-email-arei.gonglei@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.18.62] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.58D397D9.01FE, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: a70ec665f3cee45479c46822e7e8c4e8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 45.249.212.187 Subject: [Qemu-devel] [PULL for-2.9 1/2] cryptodev: setiv only when really need X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, "Longpeng\(Mike\)" , Gonglei Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Longpeng(Mike)" 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) Signed-off-by: Gonglei --- 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( =20 sess =3D builtin->sessions[op_info->session_id]; =20 - ret =3D 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 =3D qcrypto_cipher_setiv(sess->cipher, op_info->iv, + op_info->iv_len, errp); + if (ret < 0) { + return -VIRTIO_CRYPTO_ERR; + } } =20 if (sess->direction =3D=3D VIRTIO_CRYPTO_OP_ENCRYPT) { --=20 1.7.12.4 From nobody Sun Apr 28 20:33:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490262095190875.4113462686291; Thu, 23 Mar 2017 02:41:35 -0700 (PDT) Received: from localhost ([::1]:55170 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqzFN-0002Wh-N1 for importer@patchew.org; Thu, 23 Mar 2017 05:41:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56321) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqzEI-0001xN-OG for qemu-devel@nongnu.org; Thu, 23 Mar 2017 05:40:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqzEF-0003qC-LN for qemu-devel@nongnu.org; Thu, 23 Mar 2017 05:40:26 -0400 Received: from [45.249.212.187] (port=3010 helo=dggrg01-dlp.huawei.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1cqzEF-0003cX-6q for qemu-devel@nongnu.org; Thu, 23 Mar 2017 05:40:23 -0400 Received: from 172.30.72.57 (EHLO DGGEML404-HUB.china.huawei.com) ([172.30.72.57]) by dggrg01-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id ALG18854; Thu, 23 Mar 2017 17:39:36 +0800 (CST) Received: from localhost (10.177.18.62) by DGGEML404-HUB.china.huawei.com (10.3.17.39) with Microsoft SMTP Server id 14.3.301.0; Thu, 23 Mar 2017 17:39:25 +0800 From: Gonglei To: Date: Thu, 23 Mar 2017 17:39:11 +0800 Message-ID: <1490261951-21352-3-git-send-email-arei.gonglei@huawei.com> X-Mailer: git-send-email 2.8.2.windows.1 In-Reply-To: <1490261951-21352-1-git-send-email-arei.gonglei@huawei.com> References: <1490261951-21352-1-git-send-email-arei.gonglei@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.18.62] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090202.58D397D9.0167, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: e053a407fe024072fe69deb7dae275a3 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 45.249.212.187 Subject: [Qemu-devel] [PULL for-2.9 2/2] cryptodev: fix asserting single queue X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Halil Pasic , Gonglei Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Halil Pasic We already check for queues =3D=3D 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 =3D=3D 1) form cryptodev_builtin_cleanup as it does only harm and no good. Reported-by: Boris Fiuczynski Signed-off-by: Halil Pasic Reviewed-by: Eric Blake Signed-off-by: Gonglei --- 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( } } =20 - assert(queues =3D=3D 1); - for (i =3D 0; i < queues; i++) { cc =3D backend->conf.peers.ccs[i]; if (cc) { --=20 1.7.12.4