Linux-Amlogic Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2 00/13] crypto: permit asynchronous skciphers as driver fallbacks
@ 2020-06-27  8:36 Ard Biesheuvel
  2020-06-27  8:36 ` [PATCH v2 01/13] crypto: amlogic-gxl - default to build as module Ard Biesheuvel
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: Ard Biesheuvel @ 2020-06-27  8:36 UTC (permalink / raw)
  To: linux-crypto
  Cc: Eric Biggers, Corentin Labbe, Ayush Sawal, Jamie Iles,
	Fabio Estevam, Ard Biesheuvel, Herbert Xu, Rohit Maheshwari,
	Chen-Yu Tsai, NXP Linux Team, Tom Lendacky, Sascha Hauer,
	Vinay Kumar Yadav, Maxime Ripard, Matthias Brugger,
	linux-amlogic, linux-omap, linux-arm-kernel, Tero Kristo,
	Pengutronix Kernel Team, Shawn Guo, David S. Miller

The drivers for crypto accelerators in drivers/crypto all implement skciphers
of an asynchronous nature, given that they are backed by hardware DMA that
completes asynchronously wrt the execution flow.

However, in many cases, any fallbacks they allocate are limited to the
synchronous variety, which rules out the use of SIMD implementations of
AES in ECB, CBC and XTS modes, given that they are usually built on top
of the asynchronous SIMD helper, which queues requests for asynchronous
completion if they are issued from a context that does not permit the use
of the SIMD register file.

This may result in sub-optimal AES implementations to be selected as
fallbacks, or even less secure ones if the only synchronous alternative
is table based, and therefore not time invariant.

So switch all these cases over to the asynchronous API, by moving the
subrequest into the skcipher request context, and permitting it to
complete asynchronously via the caller provided completion function.

Patch #1 is not related, but touches the same driver as #2 so it is
included anyway. Patch #13 removes another sync skcipher allocation by
switching to the AES library interface.

Only OMAP was tested on actual hardware - the others are build tested only.

v2:
- address issue found by build robot in patch #7
- add patch #13
- rebase onto cryptodev/master

Cc: Corentin Labbe <clabbe.montjoie@gmail.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Ayush Sawal <ayush.sawal@chelsio.com>
Cc: Vinay Kumar Yadav <vinay.yadav@chelsio.com>
Cc: Rohit Maheshwari <rohitm@chelsio.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: Jamie Iles <jamie@jamieiles.com>
Cc: Eric Biggers <ebiggers@google.com>
Cc: Tero Kristo <t-kristo@ti.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>

Ard Biesheuvel (13):
  crypto: amlogic-gxl - default to build as module
  crypto: amlogic-gxl - permit async skcipher as fallback
  crypto: omap-aes - permit asynchronous skcipher as fallback
  crypto: sun4i - permit asynchronous skcipher as fallback
  crypto: sun8i-ce - permit asynchronous skcipher as fallback
  crypto: sun8i-ss - permit asynchronous skcipher as fallback
  crypto: ccp - permit asynchronous skcipher as fallback
  crypto: chelsio - permit asynchronous skcipher as fallback
  crypto: mxs-dcp - permit asynchronous skcipher as fallback
  crypto: picoxcell - permit asynchronous skcipher as fallback
  crypto: qce - permit asynchronous skcipher as fallback
  crypto: sahara - permit asynchronous skcipher as fallback
  crypto: mediatek - use AES library for GCM key derivation

 drivers/crypto/Kconfig                              |  3 +-
 drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c | 46 +++++-----
 drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h        |  3 +-
 drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c | 41 ++++-----
 drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h        |  3 +-
 drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c | 39 ++++----
 drivers/crypto/allwinner/sun8i-ss/sun8i-ss.h        |  3 +-
 drivers/crypto/amlogic/Kconfig                      |  2 +-
 drivers/crypto/amlogic/amlogic-gxl-cipher.c         | 27 +++---
 drivers/crypto/amlogic/amlogic-gxl.h                |  3 +-
 drivers/crypto/ccp/ccp-crypto-aes-xts.c             | 33 ++++---
 drivers/crypto/ccp/ccp-crypto.h                     |  4 +-
 drivers/crypto/chelsio/chcr_algo.c                  | 57 +++++-------
 drivers/crypto/chelsio/chcr_crypto.h                |  3 +-
 drivers/crypto/mediatek/mtk-aes.c                   | 63 ++-----------
 drivers/crypto/mxs-dcp.c                            | 33 +++----
 drivers/crypto/omap-aes.c                           | 35 ++++---
 drivers/crypto/omap-aes.h                           |  3 +-
 drivers/crypto/picoxcell_crypto.c                   | 34 ++++---
 drivers/crypto/qce/cipher.h                         |  3 +-
 drivers/crypto/qce/skcipher.c                       | 27 +++---
 drivers/crypto/sahara.c                             | 96 +++++++++-----------
 22 files changed, 254 insertions(+), 307 deletions(-)

-- 
2.27.0


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, back to index

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-27  8:36 [PATCH v2 00/13] crypto: permit asynchronous skciphers as driver fallbacks Ard Biesheuvel
2020-06-27  8:36 ` [PATCH v2 01/13] crypto: amlogic-gxl - default to build as module Ard Biesheuvel
2020-06-27  8:36 ` [PATCH v2 02/13] crypto: amlogic-gxl - permit async skcipher as fallback Ard Biesheuvel
2020-06-27  8:36 ` [PATCH v2 03/13] crypto: omap-aes - permit asynchronous " Ard Biesheuvel
2020-06-27  8:36 ` [PATCH v2 04/13] crypto: sun4i " Ard Biesheuvel
2020-06-27  8:36 ` [PATCH v2 05/13] crypto: sun8i-ce " Ard Biesheuvel
2020-06-27  8:36 ` [PATCH v2 06/13] crypto: sun8i-ss " Ard Biesheuvel
2020-06-27  8:36 ` [PATCH v2 07/13] crypto: ccp " Ard Biesheuvel
2020-06-27  8:36 ` [PATCH v2 08/13] crypto: chelsio " Ard Biesheuvel
2020-06-27  8:36 ` [PATCH v2 09/13] crypto: mxs-dcp " Ard Biesheuvel
2020-06-27  8:36 ` [PATCH v2 10/13] crypto: picoxcell " Ard Biesheuvel
2020-06-27  8:36 ` [PATCH v2 11/13] crypto: qce " Ard Biesheuvel
2020-06-27  8:36 ` [PATCH v2 12/13] crypto: sahara " Ard Biesheuvel
2020-06-27  8:36 ` [PATCH v2 13/13] crypto: mediatek - use AES library for GCM key derivation Ard Biesheuvel

Linux-Amlogic Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-amlogic/0 linux-amlogic/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-amlogic linux-amlogic/ https://lore.kernel.org/linux-amlogic \
		linux-amlogic@lists.infradead.org
	public-inbox-index linux-amlogic

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-amlogic


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git