Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp346830ybt; Mon, 6 Jul 2020 10:43:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyE2M9QNv4snTvrLUSNvQWfqutxGmdCPpunbKqu9xE7wzJekW1P9q4k2T3pUDwWwt5tKUWF X-Received: by 2002:a05:6402:1ca6:: with SMTP id cz6mr38155387edb.171.1594057380502; Mon, 06 Jul 2020 10:43:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594057380; cv=none; d=google.com; s=arc-20160816; b=z8EJDxUrlXEhOfTXnzmcvLcJoGfC01ZwjuHA3SAcREn3meAvBQPQpVffJVd8D0d9qF bGAMNMGbyVbqwZ2MlnXi9+nBdZ3uglgFCEwj8Bf28N8lPLAHAAlGBJFIgaMbeckMzs9Q gvoS3xeIsZBBWRWljDSCA1Q5Y3V6OGGCvcIU93+0GBsG7/RiBSHMASG/SnTppjym2ATP izTwaQ7NUSXZY9w/EeAQQl3QmH+iCWCJRJeKfc22zU/4CQ5gm83ikcrT/JiWn9E6vd1e +0P7zCb5g6LuGi23Zx/STNtzxll+tPDCyqgxreW9n/DJdefnf0Xrx8qi1nSCKOWdVJS2 +Pzg== 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=Gqv534YkUnFYr+r76ikVWT2HQqldNaFcBABCuVprGcY=; b=nTVgDTsS3ymp+Gx1pTFq+t21QAGhlr1NXHj/Oqb3wZJkcgr9S6iOqzn3v/BucezV9Y 7MbXgTOBNIgdSwPuqE/gW1GiREAtsZIw3PSllstI9ejwJcpvbjDdS5Rhz8E1Waq2ZWUj 5xLdfh8OLRC+mq21geNK2ZgydZHSP9Ot2gjF4zWFFlNhKlE0slV9cXQaJGu9ZqktB8yK eR4FbbuW7rxXIjqrNkoH8n7SKLBQnYlYVHu9hfE/PkZXsDNLcm1RqEu6BpLjuyFJE4vM qK7IVr0+G8x6TQBbbtn3wBmoJR88l1pfgc1oy0maf8ohRRDXwbxXP66aqKf8MAYam7qH YYnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tnW2RfcR; 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 dt12si18862674ejc.46.2020.07.06.10.42.36; Mon, 06 Jul 2020 10:43: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=@gmail.com header.s=20161025 header.b=tnW2RfcR; 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 S1729632AbgGFRme (ORCPT + 99 others); Mon, 6 Jul 2020 13:42:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729550AbgGFRme (ORCPT ); Mon, 6 Jul 2020 13:42:34 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEC6EC061755 for ; Mon, 6 Jul 2020 10:42:33 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id f139so43013453wmf.5 for ; Mon, 06 Jul 2020 10:42:33 -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=Gqv534YkUnFYr+r76ikVWT2HQqldNaFcBABCuVprGcY=; b=tnW2RfcR+axpdw5n+7fO1pcgng20fbUD8mUrH4ZQdXO870r1WqOnLHuIQMtDFhOK+R wbGI9EBXY6tclQ9Nq9Ce+uGmjEare9S6vlfHr8hFoPtPA2afIEitoEdNYiJkmWayTNlT ba+OTYSW2GafPl8p6JK7qq8Ft+nvQaAH+gNza/zH12RT6sfY0RjU3S69AuYWgAwJlhhP p/FmwPhl5zXBlHyObmvNiP7Yy8cs5pzO1K3F5mDHqFtRfghrsyyJ8uQOa0PuuG9cv3Pf p0wbbMeS7LK9xikZxpbBvQAyBxfmWL4ddEbVvOoplv2vn9ayVVEuyDO9ZhZ5WsEbTgH4 n7hA== 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=Gqv534YkUnFYr+r76ikVWT2HQqldNaFcBABCuVprGcY=; b=M5iwYxNkX18QbRlRxr43HUDyxsVq0+zTsTT+YUxWUhyiiwWQtqVc1Fu2GnDeJNPnKU aIWMbfpbIq3P7Vv/qJULFT8pFSsnwvj2/5YF2SWlMwcUxwwQZdoRqoGYk+IzE5Cszr6k nV8VBKKp1dgk0/JZoo+r62n0M8vzTJb2CJKyuXTdP63Xv3mxQjybCfdikr63fSlXOA7y DW9WxbnYj9HX51YFD41PHxq+qg78wPr5oZsVzeshfpoUEWnvGfGYLr1D2ohq1p1XiDD+ qqVvq5Zi3h2Nma47wudzKPoVwQnOCGgY/Y3ET+xx4OkTkkLOmyhcXGGypJ7fWPvZFl+9 NJnw== X-Gm-Message-State: AOAM533SZzc5nLgagX0HqG3rmVWp1g6G0ubZK1hNS4ttqj7MtacJCskc +fU8KKqOV4XviHfnQClZalE= X-Received: by 2002:a1c:e910:: with SMTP id q16mr300505wmc.188.1594057352701; Mon, 06 Jul 2020 10:42:32 -0700 (PDT) Received: from Red ([2a01:cb1d:3d5:a100:2e56:dcff:fed2:c6d6]) by smtp.googlemail.com with ESMTPSA id n16sm167704wmc.40.2020.07.06.10.42.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2020 10:42:32 -0700 (PDT) Date: Mon, 6 Jul 2020 19:42:30 +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 02/13] crypto: amlogic-gxl - permit async skcipher as fallback Message-ID: <20200706174230.GB29043@Red> References: <20200630121907.24274-1-ardb@kernel.org> <20200630121907.24274-3-ardb@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200630121907.24274-3-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:56PM +0200, Ard Biesheuvel wrote: > Even though the amlogic-gxl 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/amlogic/amlogic-gxl-cipher.c | 27 ++++++++++---------- > drivers/crypto/amlogic/amlogic-gxl.h | 3 ++- > 2 files changed, 15 insertions(+), 15 deletions(-) > Tested-by: Corentin Labbe