[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f2addf5602254e2c81b52c30cb2c8180@huawei.com>
Date: Fri, 6 May 2022 09:28:01 +0000
From: "Gonglei (Arei)" <arei.gonglei@...wei.com>
To: zhenwei pi <pizhenwei@...edance.com>,
"mst@...hat.com" <mst@...hat.com>
CC: "jasowang@...hat.com" <jasowang@...hat.com>,
"herbert@...dor.apana.org.au" <herbert@...dor.apana.org.au>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"virtualization@...ts.linux-foundation.org"
<virtualization@...ts.linux-foundation.org>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
"helei.sig11@...edance.com" <helei.sig11@...edance.com>,
"davem@...emloft.net" <davem@...emloft.net>
Subject: RE: [PATCH v5 4/5] virtio-crypto: adjust dst_len at ops callback
> -----Original Message-----
> From: zhenwei pi [mailto:pizhenwei@...edance.com]
> Sent: Thursday, May 5, 2022 5:24 PM
> To: Gonglei (Arei) <arei.gonglei@...wei.com>; mst@...hat.com
> Cc: jasowang@...hat.com; herbert@...dor.apana.org.au;
> linux-kernel@...r.kernel.org; virtualization@...ts.linux-foundation.org;
> linux-crypto@...r.kernel.org; helei.sig11@...edance.com;
> pizhenwei@...edance.com; davem@...emloft.net
> Subject: [PATCH v5 4/5] virtio-crypto: adjust dst_len at ops callback
>
> From: lei he <helei.sig11@...edance.com>
>
> 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.
>
> Cc: Michael S. Tsirkin <mst@...hat.com>
> Cc: Jason Wang <jasowang@...hat.com>
> Cc: Gonglei <arei.gonglei@...wei.com>
> Signed-off-by: lei he <helei.sig11@...edance.com>
> Signed-off-by: zhenwei pi <pizhenwei@...edance.com>
> ---
> drivers/crypto/virtio/virtio_crypto_akcipher_algs.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
Reviewed-by: Gonglei <arei.gonglei@...wei.com>
Regards,
-Gonglei
> diff --git a/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c
> b/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c
> index 382ccec9ab12..2a60d0525cde 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);
> sg_copy_from_buffer(akcipher_req->dst,
> sg_nents(akcipher_req->dst),
> vc_akcipher_req->dst_buf, akcipher_req->dst_len);
> + }
> virtio_crypto_akcipher_finalize_req(vc_akcipher_req, akcipher_req,
> error); }
>
> --
> 2.20.1
Powered by blists - more mailing lists