From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67549C5519F for ; Mon, 16 Nov 2020 15:48:02 +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 0EFC3207BC for ; Mon, 16 Nov 2020 15:48:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="dycY6Ocq"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="HFINO9fe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0EFC3207BC 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+linux-arm-kernel=archiver.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:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=AcrEsnC0odRhGJDM6cjd1ZakjkxINCVrLYK5QfzUnVU=; b=dycY6OcqFNV7RnCMfyCJMvNPi Mrdipd1oURm+foeoQnjBrgUlRIx07zBDtPC9pT+xk+nfVQASTmG423Ik9KPjvpVY/p9aBkwnWqrxH fx063UG8bwCPF3MW6ZFYxnhuPqbGKtOvmDEsDS3AcuH4w8eZ8YHgngIsMxQZhR8biBaxRRyyB6SxX 8juuZTIE/UPNi9s8gUAMc8UGF4dAH2TBEuGzewwP0Cr616+faMXLT0Hf5oOEtwebpA9fnaApP4z5t h4/iaDSPYxHcVoVvBUUzeld8xhTdebtGQxWP0Q00DQZy9fXgMbaSZNr5MxSOJ2Hpt5NcopPuR6Dh7 tXsfipGsg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kegj6-0000if-Et; Mon, 16 Nov 2020 15:47:32 +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 1kegj3-0000hp-Og for linux-arm-kernel@lists.infradead.org; Mon, 16 Nov 2020 15:47:30 +0000 Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) (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 C604022265 for ; Mon, 16 Nov 2020 15:47:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605541648; bh=sMTgzNRsrEqsRuLvdBLUUHqrR3j8TcZ0NCD0/HoI52c=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=HFINO9fes0g8e669Gilv2J80QDhMd4O4tJzWkOmSlvkSfmz7mOYDdcvaSwAvcReNx YQLN3CskCQhGVhRAbgyyZQrjyBI7wsnm2BpZZsGK2QdwLFunOALk130i8GT79+Hjw0 bJ+Z3W4jZtWR1qDfpAmvBUGOjJx20HuQUGF7dnlE= Received: by mail-oi1-f170.google.com with SMTP id d9so19262059oib.3 for ; Mon, 16 Nov 2020 07:47:28 -0800 (PST) X-Gm-Message-State: AOAM5305t/f+Qy0hHZsaCVSPP3tdkYNQkTX69OFg2yPS3q0tuEQU7kNJ w2Mbhgxy1kWotMFnykAPpeul3Zv2fK27hBWGY50= X-Google-Smtp-Source: ABdhPJwtEdUsppLCAadjjssiA4VW6Mu0wAQgb+s+CdH11TnsM2ahFBi35u8Nh6V2aCMqX1p/8Wi7ZuPnGhFDWKPXXTw= X-Received: by 2002:aca:3c54:: with SMTP id j81mr51617oia.11.1605541647968; Mon, 16 Nov 2020 07:47:27 -0800 (PST) MIME-Version: 1.0 References: <20201116135345.11834-1-clabbe@baylibre.com> <20201116135345.11834-5-clabbe@baylibre.com> In-Reply-To: <20201116135345.11834-5-clabbe@baylibre.com> From: Arnd Bergmann Date: Mon, 16 Nov 2020 16:47:11 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 4/7] crypto: sun4i-ss: handle BigEndian for cipher To: Corentin Labbe X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201116_104729_877435_E94AB0DF X-CRM114-Status: GOOD ( 20.25 ) 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: Jernej Skrabec , Herbert Xu , Arnd Bergmann , linux-sunxi , "linux-kernel@vger.kernel.org" , Maxime Ripard , Chen-Yu Tsai , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , "# 3.4.x" , David Miller , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Nov 16, 2020 at 2:53 PM Corentin Labbe wrote: > > Ciphers produce invalid results on BE. > Key and IV need to be written in LE. > > Fixes: 6298e948215f2 ("crypto: sunxi-ss - Add Allwinner Security System crypto accelerator") > Cc: > Signed-off-by: Corentin Labbe > --- > drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c > index 53478c3feca6..8f4621826330 100644 > --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c > +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c > @@ -52,13 +52,13 @@ static int noinline_for_stack sun4i_ss_opti_poll(struct skcipher_request *areq) > > spin_lock_irqsave(&ss->slock, flags); > > - for (i = 0; i < op->keylen; i += 4) > - writel(*(op->key + i / 4), ss->base + SS_KEY0 + i); > + for (i = 0; i < op->keylen / 4; i++) > + writesl(ss->base + SS_KEY0 + i * 4, &op->key[i], 1); > This looks correct, but I wonder if we should just introduce memcpy_toio32() and memcpy_fromio32() as a generic interface, as this seems to come up occasionally, and the method here (a loop around an inline function with another loop) is a bit clumsy. Arnd _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel