Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3535683ybt; Tue, 30 Jun 2020 05:28:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxf1/9rQtQuXWxPIKIeSoK0NQKKGO7W6MtacEuruAQdz7ug/6v2FAsDDqjAMfPsNbUydz6w X-Received: by 2002:a50:9306:: with SMTP id m6mr22680914eda.216.1593520080397; Tue, 30 Jun 2020 05:28:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593520080; cv=none; d=google.com; s=arc-20160816; b=GIRk5u9VxTR2nPHgs65kXCo/mJGS/IqjK7JF0rh6/Ng7B1OzIN551kX+sXekmtkkMk 0jzIwcAhD0KmoqNDtt7+bn1R0BYSLAIC/ViUw7398uxBqWZNGjnRmGLn5X2V6u6tudkk o0Bh9g20ZbAgDTXbQS4z573GBY2YiyBwPPV4yomw+XNcEBgPdkC8D/7ayybEpFl7Fdb6 c2XLvE4dvL3+O1qf6txTFVyHbpNi0hbGp0fIq1lTWSgY0bZw8zCN3HNpmENbzXpP0yov bDxCphp3e1HaTVsw+jG2T55Tux3pFQBh44S4jSXczz04Xor9WfeQe7tVMi4xlUrUb5Y7 2khA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=uTt2gwEG7GxB+xMlxyKiCjnojbx3FlQAxvLhqpNPUAo=; b=IF7IITVaEe6wC/ew+YL+2IApxsVDM4T7RwZ8t8uSRXFMI3DAMBSXIit8UeSZG0tvDV 2oDzwZoE6VALRTlDcvJ/P3z1ejVya4m2TbF+nwFHiNSDAmAc6orayQQxipHj+n4ysDQg 3wcHTlDpb3YtpcqY8jkzrg+sznVxeMj3DxbUJzhWj4oPnxtRJhvTZsWLZ+RIqmlxY+5k p1dIfAjMNw6smSkcjiWMTsglgjKd3JTOjTgr/7PIUPKxGa75rnOMZTZD2tbvqJa04b8T 87d/0rAsnyL76ti0vCAlCFmbm0OV18fWiRQTGkiQzsKBBA3UVwxB3nwygqgPFoDEmdGO qgPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="c/NMnukP"; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c94si2075005edf.589.2020.06.30.05.27.37; Tue, 30 Jun 2020 05:28:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="c/NMnukP"; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733279AbgF3MTR (ORCPT + 99 others); Tue, 30 Jun 2020 08:19:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:36180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732509AbgF3MTQ (ORCPT ); Tue, 30 Jun 2020 08:19:16 -0400 Received: from e123331-lin.nice.arm.com (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 BBECD2073E; Tue, 30 Jun 2020 12:19:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593519555; bh=7FKHULCCULaOiUURzKxKvV6oWbzaknNY7Gka8ciepag=; h=From:To:Cc:Subject:Date:From; b=c/NMnukPxHsCZE25js/9S3k1NTHqFKRi26tx0+rBapeqCVAuu4sYks3XREu83a4uA CvuLLuS1KuMiimMwNnNyvGdMubrQBvh6NRCve0hxo786nfT1WffPOx12eOuWqjgmpU X75741Muu8rsPYRm+99CN+PGx6YlVBCTHKeMajzA= From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: Ard Biesheuvel , Corentin Labbe , Herbert Xu , "David S. Miller" , Maxime Ripard , Chen-Yu Tsai , Tom Lendacky , Ayush Sawal , Vinay Kumar Yadav , Rohit Maheshwari , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Jamie Iles , Eric Biggers , Tero Kristo , Matthias Brugger Subject: [PATCH v3 00/13] crypto: permit asynchronous skciphers as driver fallbacks Date: Tue, 30 Jun 2020 14:18:54 +0200 Message-Id: <20200630121907.24274-1-ardb@kernel.org> X-Mailer: git-send-email 2.17.1 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.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 and CCP were tested on actual hardware - the others are build tested only. v3: - disregard the fallback skcipher_request when taking the request context size for TFMs that don't need the fallback at all (picoxcell, qce) - fix error handling in fallback skcipher allocation and remove pointless memset()s (qce) 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 +- .../allwinner/sun4i-ss/sun4i-ss-cipher.c | 46 ++++----- drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h | 3 +- .../allwinner/sun8i-ce/sun8i-ce-cipher.c | 41 ++++---- drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h | 3 +- .../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 | 38 ++++---- drivers/crypto/qce/cipher.h | 3 +- drivers/crypto/qce/skcipher.c | 42 ++++---- drivers/crypto/sahara.c | 96 +++++++++---------- 22 files changed, 265 insertions(+), 315 deletions(-) -- 2.17.1