Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp347524ybt; Wed, 8 Jul 2020 01:13:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwy5UknK7JZBE4oCvu3GLFeJ/wITMqjlnawoS0ktEYfCclMu9PxNWQJX/34hnZh8KkLd2Dq X-Received: by 2002:a17:906:8392:: with SMTP id p18mr53713852ejx.24.1594196003317; Wed, 08 Jul 2020 01:13:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594196003; cv=none; d=google.com; s=arc-20160816; b=VSo1aiOKUVjvxRXnTEJHB/DhSWcz7OQUT/8MH73lwJYoGU6h9fh/KM+l+ZbjG3pw8E mc1mg48qVBf91Ev2QvxUjtgJs+GWLC3dgGhG5GTDx7IPOIkmM6lJu3tpzIPLYbDUVi4E /EnqUY4Ms03RX1rQJm3f4EGGHLEcsL4WtNIeg+trGECbUVj6YRA1JvYaaYwgJBNs3Nnj SCUuZu/4JAPyJT5Ya28JaUYUmzA9MNA4JU+5NAPD0K1oHSsk1TOCm7HBWqpUL7bhFcGn gYqz23wVkRykNLGconrHMNp+VExVBCtsw4ygwJHm9qeKN4gHPiQyn7p26XOIPNrf+Hay UWFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=z6+nuHAx7L8u/EGJ0fxzxH9P5Mn+J7bZgvUQH6/6JiE=; b=Bx5Tw6vPHe+nMArozm06RGnrPhSV3+j2IWP6tjVyOhLejDmCGXPBnhsqQrePL9ahst JRiASwcNydr5ZaZQZugryuP017ss6W+PCP9TDaz8PHCxka3wo5q1wrNjPG3IrqK4mM9R iJqMsw3XPdZSwG6projIjjuqdLZB2hxFRlvIHabvQE91QF9qDVHVfh/MfAEa4uRxyq7W Y6daETEe+EwThtlvGrRbtlP+imVkHu6vbEyd1wfvWREGRdvUJWoaOk9gcZ2hWOuYWyqq ZBfJk3nIP38Z12Q7dG3QVM32mD45vfzyJ9NqcXS/edeb7F3qXrkiSbd0zoBNf4N9QP9L p5FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="LOnG/4u/"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b15si16998464edx.0.2020.07.08.01.12.45; Wed, 08 Jul 2020 01:13:23 -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=@gmail.com header.s=20161025 header.b="LOnG/4u/"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727950AbgGHHxl (ORCPT + 99 others); Wed, 8 Jul 2020 03:53:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726286AbgGHHxk (ORCPT ); Wed, 8 Jul 2020 03:53:40 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4220C08C5DC; Wed, 8 Jul 2020 00:53:39 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id z2so25540746wrp.2; Wed, 08 Jul 2020 00:53:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=z6+nuHAx7L8u/EGJ0fxzxH9P5Mn+J7bZgvUQH6/6JiE=; b=LOnG/4u/IfXDoZja+V359IRXUa777GMUh6ivYJbbH4q3X71H9TB+D6+zxVOIKeAXOE ysQynx6nYq1xfJZoWqOewlbDJ5HQFNvj3RoGGpPjcLqsdwC0MLehdixEZXIKMzcq448I ugQptdLNzyLveI+oqu/19JPhvmlUMTSYVcSjBbswKNMchb5dnwjx6NzGdH4I2jFZ8AHb SNz1Fcr3xkGONcAew1Rv2NS+JP4OnXpc4ch+v0wznqQELoUbiXnfLGSqUwz5lMgcMGMv CN0rjhB+xsaK1LbugknbJn3rSDAg8qm3XoGBDAaijqJAR6QW2rrZhLG0X97m0MhYeTcv h0fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=z6+nuHAx7L8u/EGJ0fxzxH9P5Mn+J7bZgvUQH6/6JiE=; b=Pew59TPA/Yz9m+Pw5JWgTuob3/3cr4GLWx74BkQtiz6depOe1/lf4Kwphi18d2J0S4 F/KBUnisSqrrexxdp9AGxxXj79jNkFtwmsOHX3lbwjmo8MmwNq6luqUThx5qNI8vV5PA CprqkL/ffW33JoVvfEwBBv/fvAju30HQbAdwDu1+9LMiAz0wKsOKZorIzPlO69umgKVP q6qzv5OXt76gcjR+2g/hKLe6zE6E7YN6D2KjYJfzEtXkKWXuQIntHp/BCNBidc5SL6xs 1HRhiYwIVv/I1Pm8e8yOLJE/eGlRGiB4EPQGSLop/qwtSHVYdJgjxv0kAG9pUvBzW+G/ GVpA== X-Gm-Message-State: AOAM530MqJEAZ3FJ8ZXSC6cY1Ff6YUr9HM8rXXwo0SPdgK3ElWzvW4/8 rgLrVQk50WFptfQisBVVNLI= X-Received: by 2002:a5d:66ca:: with SMTP id k10mr46352817wrw.244.1594194818597; Wed, 08 Jul 2020 00:53:38 -0700 (PDT) Received: from Red ([2a01:cb1d:3d5:a100:2e56:dcff:fed2:c6d6]) by smtp.googlemail.com with ESMTPSA id u1sm5597306wrb.78.2020.07.08.00.53.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2020 00:53:37 -0700 (PDT) Date: Wed, 8 Jul 2020 09:53:36 +0200 From: Corentin Labbe To: Ard Biesheuvel Cc: linux-crypto@vger.kernel.org, Corentin Labbe , Herbert Xu , "David S. Miller" , Maxime Ripard , Chen-Yu Tsai , Tom Lendacky , John Allen , 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 , Horia =?utf-8?Q?Geant=C4=83?= , linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-amlogic@lists.infradead.org Subject: Re: [PATCH v4 05/13] crypto: sun8i-ce - permit asynchronous skcipher as fallback Message-ID: <20200708075336.GB19609@Red> References: <20200707063203.5018-1-ardb@kernel.org> <20200707063203.5018-6-ardb@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200707063203.5018-6-ardb@kernel.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Tue, Jul 07, 2020 at 09:31:55AM +0300, Ard Biesheuvel wrote: > Even though the sun8i-ce driver implements asynchronous versions of > ecb(aes) and cbc(aes), the fallbacks it allocates are required to be > synchronous. Given that SIMD based software implementations are usually > asynchronous as well, even though they rarely complete asynchronously > (this typically only happens in cases where the request was made from > softirq context, while SIMD was already in use in the task context that > it interrupted), these implementations are disregarded, and either the > generic C version or another table based version implemented in assembler > is selected instead. > > Since falling back to synchronous AES is not only a performance issue, but > potentially a security issue as well (due to the fact that table based AES > is not time invariant), let's fix this, by allocating an ordinary skcipher > as the fallback, and invoke it with the completion routine that was given > to the outer request. > > Signed-off-by: Ard Biesheuvel > Acked-by: Corentin Labbe > --- > drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c | 41 ++++++++++---------- > drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h | 8 ++-- > 2 files changed, 25 insertions(+), 24 deletions(-) > I finally took the time to rebase all my hash/xrng serie on top of this change and test this patch. Tested-by: Corentin Labbe Tested-on: sun50i-h6-pine-h64 Tested-on: sun8i-h3-orangepi-pc