From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81980C433F5 for ; Thu, 21 Apr 2022 13:46:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344421AbiDUNtT convert rfc822-to-8bit (ORCPT ); Thu, 21 Apr 2022 09:49:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237031AbiDUNtT (ORCPT ); Thu, 21 Apr 2022 09:49:19 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06F5B30F7C; Thu, 21 Apr 2022 06:46:29 -0700 (PDT) Received: from kwepemi500013.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Kkf2g3HgzzhXXd; Thu, 21 Apr 2022 21:46:19 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by kwepemi500013.china.huawei.com (7.221.188.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 21 Apr 2022 21:46:26 +0800 Received: from dggpemm500006.china.huawei.com ([7.185.36.236]) by dggpemm500006.china.huawei.com ([7.185.36.236]) with mapi id 15.01.2375.024; Thu, 21 Apr 2022 21:46:26 +0800 From: "Gonglei (Arei)" To: zhenwei pi , "mst@redhat.com" CC: "jasowang@redhat.com" , "herbert@gondor.apana.org.au" , "linux-kernel@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "linux-crypto@vger.kernel.org" , "helei.sig11@bytedance.com" , "davem@davemloft.net" Subject: RE: [PATCH v3 4/5] virtio-crypto: adjust dst_len at ops callback Thread-Topic: [PATCH v3 4/5] virtio-crypto: adjust dst_len at ops callback Thread-Index: AQHYVWzCHH3d5qDstUGT+mENWfA3Lqz6YBsQ Date: Thu, 21 Apr 2022 13:46:26 +0000 Message-ID: <4edf9c3d37f1435a8a6701a7429a3aba@huawei.com> References: <20220421104016.453458-1-pizhenwei@bytedance.com> <20220421104016.453458-5-pizhenwei@bytedance.com> In-Reply-To: <20220421104016.453458-5-pizhenwei@bytedance.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.174.149.11] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org > -----Original Message----- > From: zhenwei pi [mailto:pizhenwei@bytedance.com] > Sent: Thursday, April 21, 2022 6:40 PM > To: Gonglei (Arei) ; mst@redhat.com > Cc: jasowang@redhat.com; herbert@gondor.apana.org.au; > linux-kernel@vger.kernel.org; virtualization@lists.linux-foundation.org; > linux-crypto@vger.kernel.org; helei.sig11@bytedance.com; > davem@davemloft.net; zhenwei pi > Subject: [PATCH v3 4/5] virtio-crypto: adjust dst_len at ops callback > > From: lei he > > For some akcipher operations(eg, decryption of pkcs1pad(rsa)), the length of > returned result maybe less than akcipher_req->dst_len, we need to recalculate > the actual dst_len through the virt-queue protocol. > OK ... > Cc: Michael S. Tsirkin > Cc: Jason Wang > Cc: Gonglei > Signed-off-by: lei he > Signed-off-by: zhenwei pi > --- > drivers/crypto/virtio/virtio_crypto_akcipher_algs.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c > b/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c > index 9561bc2df62b..82db86e088c2 100644 > --- a/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c > +++ b/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c > @@ -90,9 +90,12 @@ static void > virtio_crypto_dataq_akcipher_callback(struct virtio_crypto_request * > } > > akcipher_req = vc_akcipher_req->akcipher_req; > - if (vc_akcipher_req->opcode != VIRTIO_CRYPTO_AKCIPHER_VERIFY) > + if (vc_akcipher_req->opcode != VIRTIO_CRYPTO_AKCIPHER_VERIFY) { > + /* actuall length maybe less than dst buffer */ > + akcipher_req->dst_len = len - sizeof(vc_req->status); ...but why minus sizeof(vc_req->status)? Regards, -Gonglei From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CC71FC433EF for ; Thu, 21 Apr 2022 13:46:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 5FD9741885; Thu, 21 Apr 2022 13:46:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gF7PKscS4JPD; Thu, 21 Apr 2022 13:46:37 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id A3E55415D2; Thu, 21 Apr 2022 13:46:36 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 81834C0033; Thu, 21 Apr 2022 13:46:36 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id B138EC002C for ; Thu, 21 Apr 2022 13:46:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id AD27260E33 for ; Thu, 21 Apr 2022 13:46:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pAv_MQV_R-p4 for ; Thu, 21 Apr 2022 13:46:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by smtp3.osuosl.org (Postfix) with ESMTPS id BD60E60AF4 for ; Thu, 21 Apr 2022 13:46:31 +0000 (UTC) Received: from kwepemi500013.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Kkf2g3HgzzhXXd; Thu, 21 Apr 2022 21:46:19 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by kwepemi500013.china.huawei.com (7.221.188.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 21 Apr 2022 21:46:26 +0800 Received: from dggpemm500006.china.huawei.com ([7.185.36.236]) by dggpemm500006.china.huawei.com ([7.185.36.236]) with mapi id 15.01.2375.024; Thu, 21 Apr 2022 21:46:26 +0800 To: zhenwei pi , "mst@redhat.com" Subject: RE: [PATCH v3 4/5] virtio-crypto: adjust dst_len at ops callback Thread-Topic: [PATCH v3 4/5] virtio-crypto: adjust dst_len at ops callback Thread-Index: AQHYVWzCHH3d5qDstUGT+mENWfA3Lqz6YBsQ Date: Thu, 21 Apr 2022 13:46:26 +0000 Message-ID: <4edf9c3d37f1435a8a6701a7429a3aba@huawei.com> References: <20220421104016.453458-1-pizhenwei@bytedance.com> <20220421104016.453458-5-pizhenwei@bytedance.com> In-Reply-To: <20220421104016.453458-5-pizhenwei@bytedance.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.174.149.11] MIME-Version: 1.0 X-CFilter-Loop: Reflected Cc: "helei.sig11@bytedance.com" , "linux-kernel@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "linux-crypto@vger.kernel.org" , "davem@davemloft.net" , "herbert@gondor.apana.org.au" X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Gonglei \(Arei\) via Virtualization" Reply-To: "Gonglei \(Arei\)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" > -----Original Message----- > From: zhenwei pi [mailto:pizhenwei@bytedance.com] > Sent: Thursday, April 21, 2022 6:40 PM > To: Gonglei (Arei) ; mst@redhat.com > Cc: jasowang@redhat.com; herbert@gondor.apana.org.au; > linux-kernel@vger.kernel.org; virtualization@lists.linux-foundation.org; > linux-crypto@vger.kernel.org; helei.sig11@bytedance.com; > davem@davemloft.net; zhenwei pi > Subject: [PATCH v3 4/5] virtio-crypto: adjust dst_len at ops callback > > From: lei he > > For some akcipher operations(eg, decryption of pkcs1pad(rsa)), the length of > returned result maybe less than akcipher_req->dst_len, we need to recalculate > the actual dst_len through the virt-queue protocol. > OK ... > Cc: Michael S. Tsirkin > Cc: Jason Wang > Cc: Gonglei > Signed-off-by: lei he > Signed-off-by: zhenwei pi > --- > drivers/crypto/virtio/virtio_crypto_akcipher_algs.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c > b/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c > index 9561bc2df62b..82db86e088c2 100644 > --- a/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c > +++ b/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c > @@ -90,9 +90,12 @@ static void > virtio_crypto_dataq_akcipher_callback(struct virtio_crypto_request * > } > > akcipher_req = vc_akcipher_req->akcipher_req; > - if (vc_akcipher_req->opcode != VIRTIO_CRYPTO_AKCIPHER_VERIFY) > + if (vc_akcipher_req->opcode != VIRTIO_CRYPTO_AKCIPHER_VERIFY) { > + /* actuall length maybe less than dst buffer */ > + akcipher_req->dst_len = len - sizeof(vc_req->status); ...but why minus sizeof(vc_req->status)? Regards, -Gonglei _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization