From: Ard Biesheuvel <ard.biesheuvel@linaro.org> To: linux-crypto@vger.kernel.org Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>, Herbert Xu <herbert@gondor.apana.org.au>, "David S. Miller" <davem@davemloft.net>, Eric Biggers <ebiggers@google.com>, linux-arm-kernel@lists.infradead.org, "Michael S. Tsirkin" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>, Gonglei <arei.gonglei@huawei.com>, virtualization@lists.linux-foundation.org Subject: [PATCH 01/25] crypto: virtio - implement missing support for output IVs Date: Mon, 14 Oct 2019 14:18:46 +0200 [thread overview] Message-ID: <20191014121910.7264-2-ard.biesheuvel@linaro.org> (raw) In-Reply-To: <20191014121910.7264-1-ard.biesheuvel@linaro.org> In order to allow for CBC to be chained, which is something that the CTS template relies upon, implementations of CBC need to pass the IV to be used for subsequent invocations via the IV buffer. This was not implemented yet for virtio-crypto so implement it now. Fixes: dbaf0624ffa5 ("crypto: add virtio-crypto driver") Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Jason Wang <jasowang@redhat.com> Cc: Gonglei <arei.gonglei@huawei.com> Cc: virtualization@lists.linux-foundation.org Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> --- drivers/crypto/virtio/virtio_crypto_algs.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/crypto/virtio/virtio_crypto_algs.c b/drivers/crypto/virtio/virtio_crypto_algs.c index 42d19205166b..65ec10800137 100644 --- a/drivers/crypto/virtio/virtio_crypto_algs.c +++ b/drivers/crypto/virtio/virtio_crypto_algs.c @@ -437,6 +437,11 @@ __virtio_crypto_ablkcipher_do_req(struct virtio_crypto_sym_request *vc_sym_req, goto free; } memcpy(iv, req->info, ivsize); + if (!vc_sym_req->encrypt) + scatterwalk_map_and_copy(req->info, req->src, + req->nbytes - AES_BLOCK_SIZE, + AES_BLOCK_SIZE, 0); + sg_init_one(&iv_sg, iv, ivsize); sgs[num_out++] = &iv_sg; vc_sym_req->iv = iv; @@ -563,6 +568,10 @@ static void virtio_crypto_ablkcipher_finalize_req( struct ablkcipher_request *req, int err) { + if (vc_sym_req->encrypt) + scatterwalk_map_and_copy(req->info, req->dst, + req->nbytes - AES_BLOCK_SIZE, + AES_BLOCK_SIZE, 0); crypto_finalize_ablkcipher_request(vc_sym_req->base.dataq->engine, req, err); kzfree(vc_sym_req->iv); -- 2.20.1
WARNING: multiple messages have this Message-ID (diff)
From: Ard Biesheuvel <ard.biesheuvel@linaro.org> To: linux-crypto@vger.kernel.org Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>, Herbert Xu <herbert@gondor.apana.org.au>, "Michael S. Tsirkin" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>, Eric Biggers <ebiggers@google.com>, virtualization@lists.linux-foundation.org, Gonglei <arei.gonglei@huawei.com>, "David S. Miller" <davem@davemloft.net>, linux-arm-kernel@lists.infradead.org Subject: [PATCH 01/25] crypto: virtio - implement missing support for output IVs Date: Mon, 14 Oct 2019 14:18:46 +0200 [thread overview] Message-ID: <20191014121910.7264-2-ard.biesheuvel@linaro.org> (raw) In-Reply-To: <20191014121910.7264-1-ard.biesheuvel@linaro.org> In order to allow for CBC to be chained, which is something that the CTS template relies upon, implementations of CBC need to pass the IV to be used for subsequent invocations via the IV buffer. This was not implemented yet for virtio-crypto so implement it now. Fixes: dbaf0624ffa5 ("crypto: add virtio-crypto driver") Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Jason Wang <jasowang@redhat.com> Cc: Gonglei <arei.gonglei@huawei.com> Cc: virtualization@lists.linux-foundation.org Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> --- drivers/crypto/virtio/virtio_crypto_algs.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/crypto/virtio/virtio_crypto_algs.c b/drivers/crypto/virtio/virtio_crypto_algs.c index 42d19205166b..65ec10800137 100644 --- a/drivers/crypto/virtio/virtio_crypto_algs.c +++ b/drivers/crypto/virtio/virtio_crypto_algs.c @@ -437,6 +437,11 @@ __virtio_crypto_ablkcipher_do_req(struct virtio_crypto_sym_request *vc_sym_req, goto free; } memcpy(iv, req->info, ivsize); + if (!vc_sym_req->encrypt) + scatterwalk_map_and_copy(req->info, req->src, + req->nbytes - AES_BLOCK_SIZE, + AES_BLOCK_SIZE, 0); + sg_init_one(&iv_sg, iv, ivsize); sgs[num_out++] = &iv_sg; vc_sym_req->iv = iv; @@ -563,6 +568,10 @@ static void virtio_crypto_ablkcipher_finalize_req( struct ablkcipher_request *req, int err) { + if (vc_sym_req->encrypt) + scatterwalk_map_and_copy(req->info, req->dst, + req->nbytes - AES_BLOCK_SIZE, + AES_BLOCK_SIZE, 0); crypto_finalize_ablkcipher_request(vc_sym_req->base.dataq->engine, req, err); kzfree(vc_sym_req->iv); -- 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-10-14 12:19 UTC|newest] Thread overview: 102+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-10-14 12:18 [PATCH 00/25] crypto: convert h/w accelerator driver to skcipher API Ard Biesheuvel 2019-10-14 12:18 ` Ard Biesheuvel 2019-10-14 12:18 ` [PATCH 01/25] crypto: virtio - implement missing support for output IVs Ard Biesheuvel 2019-10-14 12:18 ` Ard Biesheuvel [this message] 2019-10-14 12:18 ` Ard Biesheuvel 2019-10-14 12:18 ` [PATCH 02/25] crypto: virtio - deal with unsupported input sizes Ard Biesheuvel 2019-10-14 12:18 ` Ard Biesheuvel 2019-10-14 12:18 ` Ard Biesheuvel 2019-10-14 12:18 ` [PATCH 03/25] crypto: virtio - switch to skcipher API Ard Biesheuvel 2019-10-14 12:18 ` Ard Biesheuvel 2019-10-14 12:18 ` Ard Biesheuvel 2019-10-14 12:18 ` [PATCH 04/25] crypto: ccp - switch from ablkcipher to skcipher Ard Biesheuvel 2019-10-14 12:18 ` Ard Biesheuvel 2019-10-18 14:15 ` Hook, Gary 2019-10-18 14:15 ` Hook, Gary 2019-10-21 11:54 ` Ard Biesheuvel 2019-10-21 11:54 ` Ard Biesheuvel 2019-10-14 12:18 ` [PATCH 05/25] crypto: omap - switch to skcipher API Ard Biesheuvel 2019-10-14 12:18 ` Ard Biesheuvel 2019-10-14 12:18 ` Ard Biesheuvel 2019-10-15 17:28 ` Tony Lindgren 2019-10-15 17:28 ` Tony Lindgren 2019-10-15 17:28 ` Tony Lindgren 2019-10-17 10:25 ` Tero Kristo 2019-10-17 10:25 ` Tero Kristo 2019-10-17 10:25 ` Tero Kristo 2019-10-17 10:45 ` Ard Biesheuvel 2019-10-17 10:45 ` Ard Biesheuvel 2019-10-17 10:45 ` Ard Biesheuvel 2019-10-17 11:25 ` Tero Kristo 2019-10-17 11:25 ` Tero Kristo 2019-10-17 11:25 ` Tero Kristo 2019-10-17 11:56 ` Ard Biesheuvel 2019-10-17 11:56 ` Ard Biesheuvel 2019-10-17 11:56 ` Ard Biesheuvel 2019-10-17 12:07 ` Tero Kristo 2019-10-17 12:07 ` Tero Kristo 2019-10-17 12:07 ` Tero Kristo 2019-10-14 12:18 ` [PATCH 06/25] crypto: ux500 " Ard Biesheuvel 2019-10-14 12:18 ` Ard Biesheuvel 2019-10-16 13:01 ` Linus Walleij 2019-10-16 13:01 ` Linus Walleij 2019-10-14 12:18 ` [PATCH 07/25] crypto: s5p " Ard Biesheuvel 2019-10-14 12:18 ` Ard Biesheuvel 2019-10-14 12:18 ` Ard Biesheuvel 2019-10-17 15:18 ` Kamil Konieczny 2019-10-17 15:18 ` Kamil Konieczny 2019-10-17 15:28 ` Ard Biesheuvel 2019-10-17 15:28 ` Ard Biesheuvel 2019-10-21 10:05 ` Krzysztof Kozlowski 2019-10-21 10:05 ` Krzysztof Kozlowski 2019-10-21 12:00 ` Ard Biesheuvel 2019-10-21 12:00 ` Ard Biesheuvel 2019-10-14 12:18 ` [PATCH 08/25] crypto: atmel-aes " Ard Biesheuvel 2019-10-14 12:18 ` Ard Biesheuvel 2019-10-15 10:17 ` Tudor.Ambarus 2019-10-15 10:17 ` Tudor.Ambarus 2019-10-15 10:31 ` Ard Biesheuvel 2019-10-15 10:31 ` Ard Biesheuvel 2019-10-14 12:18 ` [PATCH 09/25] crypto: atmel-tdes " Ard Biesheuvel 2019-10-14 12:18 ` Ard Biesheuvel 2019-10-14 12:18 ` [PATCH 10/25] crypto: bcm-spu " Ard Biesheuvel 2019-10-14 12:18 ` Ard Biesheuvel 2019-10-14 12:18 ` [PATCH 11/25] crypto: nitrox - remove cra_type reference to ablkcipher Ard Biesheuvel 2019-10-14 12:18 ` Ard Biesheuvel 2019-10-14 12:18 ` [PATCH 12/25] crypto: cavium/cpt - switch to skcipher API Ard Biesheuvel 2019-10-14 12:18 ` Ard Biesheuvel 2019-10-14 12:18 ` [PATCH 13/25] crypto: chelsio " Ard Biesheuvel 2019-10-14 12:18 ` Ard Biesheuvel 2019-10-14 12:18 ` [PATCH 14/25] crypto: hifn " Ard Biesheuvel 2019-10-14 12:18 ` Ard Biesheuvel 2019-10-14 12:19 ` [PATCH 15/25] crypto: ixp4xx " Ard Biesheuvel 2019-10-14 12:19 ` Ard Biesheuvel 2019-10-16 13:02 ` Linus Walleij 2019-10-16 13:02 ` Linus Walleij 2019-10-14 12:19 ` [PATCH 16/25] crypto: mxs " Ard Biesheuvel 2019-10-14 12:19 ` Ard Biesheuvel 2019-10-14 13:01 ` Shawn Guo 2019-10-14 13:01 ` Shawn Guo 2019-10-16 15:59 ` Horia Geanta 2019-10-16 15:59 ` Horia Geanta 2019-10-14 12:19 ` [PATCH 17/25] crypto: mediatek " Ard Biesheuvel 2019-10-14 12:19 ` Ard Biesheuvel 2019-10-14 12:19 ` Ard Biesheuvel 2019-10-14 12:19 ` [PATCH 18/25] crypto: picoxcell " Ard Biesheuvel 2019-10-14 12:19 ` Ard Biesheuvel 2019-10-14 12:19 ` [PATCH 19/25] crypto: sahara " Ard Biesheuvel 2019-10-14 12:19 ` Ard Biesheuvel 2019-10-14 12:19 ` [PATCH 20/25] crypto: stm32 " Ard Biesheuvel 2019-10-14 12:19 ` Ard Biesheuvel 2019-10-14 12:19 ` [PATCH 21/25] crypto: rockchip " Ard Biesheuvel 2019-10-14 12:19 ` Ard Biesheuvel 2019-10-14 12:19 ` [PATCH 22/25] crypto: qce " Ard Biesheuvel 2019-10-14 12:19 ` Ard Biesheuvel 2019-10-14 12:19 ` [PATCH 23/25] crypto: niagara2 " Ard Biesheuvel 2019-10-14 12:19 ` Ard Biesheuvel 2019-10-14 18:08 ` David Miller 2019-10-14 18:08 ` David Miller 2019-10-14 12:19 ` [PATCH 24/25] crypto: talitos " Ard Biesheuvel 2019-10-14 12:19 ` Ard Biesheuvel 2019-10-14 12:19 ` [PATCH 25/25] crypto: qat " Ard Biesheuvel 2019-10-14 12:19 ` Ard Biesheuvel
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20191014121910.7264-2-ard.biesheuvel@linaro.org \ --to=ard.biesheuvel@linaro.org \ --cc=arei.gonglei@huawei.com \ --cc=davem@davemloft.net \ --cc=ebiggers@google.com \ --cc=herbert@gondor.apana.org.au \ --cc=jasowang@redhat.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-crypto@vger.kernel.org \ --cc=mst@redhat.com \ --cc=virtualization@lists.linux-foundation.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.