Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp460731ybt; Mon, 6 Jul 2020 13:43:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwi8IZXAniGrKvdEXUK0YtjcqJVOhl+526J0AgapLMsZMOqR+XvcTLgyrf7DyP96GA6rnrh X-Received: by 2002:a50:f058:: with SMTP id u24mr58035627edl.351.1594068201161; Mon, 06 Jul 2020 13:43:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594068201; cv=none; d=google.com; s=arc-20160816; b=LZxNlNQKtSHXBMSjTTmc3r2ls/9jzXbzfjFrPvIY+nkjYkAJJKlgAo4GutKxXo9Lse V5NjQbyFsy0qhGivGnEmXupITGNu1VXwF7HJ86nqwGmQDJfW+2l93LNZ3koOEhcnwO6k XGCkrFVtIUZ4TOyDbea9aZ1M60+gdyzlqiNbION84j9+i5CKz3wxy6HegJmncf0Z3dYm bExYf7ojn+LEndyPhN5LtADQe+/Qmcav62I3KrOWCK2AXgI0olJtC0Fo345W0oUUbEXv gqH2eAgbfQN59L6GxeBwbNSj7T1BsQ2bBmaltHo/sWRgFx5hZg+JtoDpAEajx9wm8bT5 HtoQ== 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=fvIgccMvXabmUtTKPNt+brvNtU3IWZlaL8TG8XofFmc=; b=tNG90cJ/r7kddE/ubRIeZahWr35+5Q/E6Ete5yF5LgXd/z/SvySlfbsh3BQazk/n+b q5GDiDzE30sZR1YOBDqLF4YZfHW5z0YrsyYESFQhPevNCZRQuuU1J9DeE1TCtwVYitfH mq+FDC4vUzQqlF5mqEXrW+z3/sZxDDv7zYcsWUJ4K+R+4riceDTsjRHnbIUkpH6A7991 K+fCYt9Ux2jvvJWMfyE2hqx8GzrHk5ng6r1bk/BBCKOjmzEWifRp7peTaqSXM0m1pI3n 5dMJORdXsmyORnO5KEvH3wZnsrvSpLqg/3zNA/nvAiVwQc28mWPTD6E6mUeLPRfEM0Hp FoCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="FQPoW/q6"; 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 dd7si14338079ejb.615.2020.07.06.13.42.57; Mon, 06 Jul 2020 13:43:21 -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="FQPoW/q6"; 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 S1726839AbgGFUmj (ORCPT + 99 others); Mon, 6 Jul 2020 16:42:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726280AbgGFUmj (ORCPT ); Mon, 6 Jul 2020 16:42:39 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C720C061755 for ; Mon, 6 Jul 2020 13:42:39 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id g75so40625429wme.5 for ; Mon, 06 Jul 2020 13:42: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=fvIgccMvXabmUtTKPNt+brvNtU3IWZlaL8TG8XofFmc=; b=FQPoW/q6yh/Quk/H/EP84/3m3YG88Y/36oJwgVldNFRdLewmIGKP9Xj5KnXGQGtPgu SFJpDaF2WGKCw+beknFa+9gwODjF0X+hKVuqV11cPaHC3zeR/4F7yOBXYMis3mX3QfnF rN29XPcaGsjwh5xoYynYLYqD+P6Fx1lUrii7IVerj0rqGeSxnTIaT09iexaTIi1sBK6q rKmNogo99n0ocT6zpWXyXlOJVW6+Key4xNASeF2ASbd6tlitQyy74TM+SCISLddE6mPK 5jV+nvXhYhBTJxrCuNgUTPQ3mj2bd4BFeku1CsSjlh1YVv8hoFR3hTXp5s9F6Xip+Z/C XxWw== 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=fvIgccMvXabmUtTKPNt+brvNtU3IWZlaL8TG8XofFmc=; b=ogpoefQfh+QF+XlNTJMD+DjdrjJXH1wz5CRvDkczjg6UannkgkiKmJ++1eWbPPfyFL 3ECxVnePec6qeYbcOp3RbLH8FA3GrU1xL8OaIQ3XHbjFTD4bt1hv0aYYCR436cR8zn69 cb6zEGg4RhNNKV6wsLT8cpsJLpZxxojyKIG4ZgfAkMmLTS5Zh0ouVdTJgVuRTk1CkWBq j5Yq3nMzddsQcIbwZNBHxqqrN5QAdwr+xc64NE140HGg9xDFbHSQDcZujPTqe3If8Jb2 wb5a3NxWWQgDaAU4zYfZgSoxRh1U33FcFlF/Xfil1rY4Z3d4orZf9YJCCuPxiTExqjIA W3aw== X-Gm-Message-State: AOAM533VKHguOD7Lci3ep5/vHSTaSIrnLjxIIv+DwnHn0wQCuaHjf6aH BepZSLn7cfxtiIJLWxa8RSo= X-Received: by 2002:a7b:cc17:: with SMTP id f23mr872463wmh.41.1594068157947; Mon, 06 Jul 2020 13:42:37 -0700 (PDT) Received: from Red ([2a01:cb1d:3d5:a100:2e56:dcff:fed2:c6d6]) by smtp.googlemail.com with ESMTPSA id u186sm734422wmu.10.2020.07.06.13.42.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2020 13:42:37 -0700 (PDT) Date: Mon, 6 Jul 2020 22:42:35 +0200 From: Corentin Labbe To: Ard Biesheuvel Cc: linux-crypto@vger.kernel.org, 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: Re: [PATCH v3 05/13] crypto: sun8i-ce - permit asynchronous skcipher as fallback Message-ID: <20200706204235.GB25432@Red> References: <20200630121907.24274-1-ardb@kernel.org> <20200630121907.24274-6-ardb@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200630121907.24274-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, Jun 30, 2020 at 02:18:59PM +0200, 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 > --- > drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c | 41 ++++++++++---------- > drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h | 3 +- > 2 files changed, 22 insertions(+), 22 deletions(-) > > diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h > index 0e9eac397e1b..4ac0f91e2800 100644 > --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h > +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h > @@ -187,6 +187,7 @@ struct sun8i_ce_dev { > struct sun8i_cipher_req_ctx { > u32 op_dir; > int flow; > + struct skcipher_request fallback_req; // keep at the end > }; > > /* Hello Same as sun8i-ss, it miss the kerneldoc otherwise Acked-by: Corentin Labbe