Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp764426pxb; Thu, 21 Apr 2022 09:49:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySYBT2iyUzy2V6d+3QHykOvaSR/t/VIj0mdWFe9olbgTiey8i+ohRhXlMT6RIqT9v4h/oj X-Received: by 2002:a05:6a00:80b:b0:50a:9293:cd5a with SMTP id m11-20020a056a00080b00b0050a9293cd5amr525548pfk.15.1650559744634; Thu, 21 Apr 2022 09:49:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650559744; cv=none; d=google.com; s=arc-20160816; b=e3OcI7po9sHeMdMp7sgJuwqfCPD6hth4N0oyZuOfUM9CWDmCNzVxnaqiPdAJmheFFf DVGB2ZoQ1WMfQ2Yi4Xp0nPNuD4QDI0cO7GULGg9TfsfWngvCDgLx5tp9Tl2Mk7TB179n 0a6al6Z7QWN3+vBZyGcVMOziNJKTkkWPk3lbCCLZYc/XNKT8ApqOZqzMc/S8LOOgRw7j mMf6aTfqmcDY/HN9Kc0jIxj+ZrIQDuYjARMj8D0WRzewVii5WT8opJq0VihTr2Z/FoDN 0h46m0JpRGm0d3fM27UfET/4bFgiA3JNNOHAbG/g14uPPc6BWErvV10NsbFMUnOhGh1F 8GFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=ZMyNpN70CHO+zqzp94avZsxFNeKQGZTlLTGQj60dooc=; b=Gi5wMteM6l9qBKxB4WdeamTW2yrhZre0NFhxxM6GGc3zfSgUJbWwh6/45NRvZZFsBJ 7OXAdlqxc+UjmyhwF2GtjW6XKf8r+yIW0pTpArSMampieB6qLjB9o08/JBILVBvNNsvu eJ1w7IIMuROKNXlQduemL3teOlvnyrjbIxmEKX6Vjl85p49kR1MVv3mBzwSuk/j9Gdpb SH9cLvZ/5GpAUbk3/dlRexJegK10ylNCIDY4U5WTdPdricFSDK7xGOUWGHhnfxXeQtWk sIbybo/N4RJ3bPZ6EyVzcDw/soq27jUWbmWe8nY8PqZ4G8ozvj8ao7ZSNrKiNKvrH+yW 3HRg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j28-20020a633c1c000000b003aa5e43f975si6158193pga.654.2022.04.21.09.48.47; Thu, 21 Apr 2022 09:49:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344421AbiDUNtT convert rfc822-to-8bit (ORCPT + 99 others); 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 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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