From patchwork Sat Jun 27 08:36:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 11629479 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 94FD914E3 for ; Sat, 27 Jun 2020 08:40:00 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 165A420B80 for ; Sat, 27 Jun 2020 08:40:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IgWMAgsk"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="V0a7lTRj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 165A420B80 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=LtsivVvgHXypRU9owLYxZeh2IjriniGRi90zQxg34XE=; b=IgWMAgskBpMYqcpu8ImpGtNMw9 Y68qF+2h+vAEXMPT/lEx5m4j2vD1548iZTj4j8QAAKgZ517tl77kcaSnulw5t0nc4V9iDrBZakl8Z SNbWzRxHw/h/NshG6LKIDPZiP02TbmYMBIlJL4h/R+r6m2yUwkufrpwXyfBmUGDbFJkWDcKOWdKin kxQ/DKRmTVO1M180Ut4aUfmhO2i0lRiJPRHimbzZsTDz70BJkiYpVehV9lL10jad2m/tP24N3v8sd KgYnppwnpGAsyX2kCyuxbb+qvsb+ZhgBs04FKkk3iP24MMx9PbXm67q7ZBoOhkdTyVr3gTIo7M72X Y2fn8hCA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jp6KG-0007fF-JM; Sat, 27 Jun 2020 08:36:40 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jp6KC-0007eo-HP; Sat, 27 Jun 2020 08:36:37 +0000 Received: from dogfood.home (lfbn-nic-1-188-42.w2-15.abo.wanadoo.fr [2.15.37.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AEEE8207FC; Sat, 27 Jun 2020 08:36:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593246995; bh=AGJG6MRW6cS+GBuTXX6phwza1LeF4svVTU7KsEF6MYI=; h=From:To:Cc:Subject:Date:From; b=V0a7lTRjEUQv8fjsdrmREWQ//7dF9YdyaOSIvGCntd9GuVSJ62WMT+FxlUURR1N6r pwc7iS6iY1yLdMX+8PdelNbEFf/urdbydvE3rINSugP05HXJO8cM+bFqTKn5yETVq6 MqCS4dGIJHmr6gmEUAjU9SAS5P0xXEeni9No7eE8= From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Subject: [PATCH v2 00/13] crypto: permit asynchronous skciphers as driver fallbacks Date: Sat, 27 Jun 2020 10:36:10 +0200 Message-Id: <20200627083623.2428333-1-ardb@kernel.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -5.2 (-----) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-5.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [198.145.29.99 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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@lists.infradead.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Tero Kristo , Pengutronix Kernel Team , Shawn Guo , "David S. Miller" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 Cc: Herbert Xu Cc: "David S. Miller" Cc: Maxime Ripard Cc: Chen-Yu Tsai Cc: Tom Lendacky Cc: Ayush Sawal Cc: Vinay Kumar Yadav Cc: Rohit Maheshwari Cc: Shawn Guo Cc: Sascha Hauer Cc: Pengutronix Kernel Team Cc: Fabio Estevam Cc: NXP Linux Team Cc: Jamie Iles Cc: Eric Biggers Cc: Tero Kristo Cc: Matthias Brugger 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(-)