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=-11.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 7D67BC4727D for ; Wed, 23 Sep 2020 18:07:47 +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 EA14820791 for ; Wed, 23 Sep 2020 18:07:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="RS0sOHPZ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="ueL9XXI+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EA14820791 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com 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:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mt72F5KhbHAwHWjU3JpoXMXfnkHYewqMdLGBcbwLooI=; b=RS0sOHPZ+WrAlRc4gpzeRp/ak 7RlGUBwmkv78mbwaEtcVHGSf2l81j7ZFiwFlkAyh3pjnoAWOh0zXOca3rnjEEFcMSG4+CTHbwyCvT +i4+hr0sRorOwsixMuA2sAG08hjzzBkI+f6Nz/X03lp233mxEwAkrLRrY5zpIjYKgwWbPNmyqeedv 9uE/Ia3fSyUaULb8R+Ylzn4kDL8LeH9fePjrQhMjEaufxM7HEo0ExHXpIaZX1ZvX/SrLeKpPikZDd PbzSmRhL8zE3ncQDJKeMAjiQBgUIw39YXHNajvBnD1f66NlfP3/Dsh8kT0t3Gnxb6MaUdEn37xFnN /U9hmpVBQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kL99k-0006Ne-Dl; Wed, 23 Sep 2020 18:06:16 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kL99h-0006MW-54 for linux-arm-kernel@lists.infradead.org; Wed, 23 Sep 2020 18:06:14 +0000 Received: by mail-wm1-x342.google.com with SMTP id q9so954227wmj.2 for ; Wed, 23 Sep 2020 11:06:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=rBQqEcNI4qmQoA7TvV4cKxPn9VpIANl2GdIqii9bNbU=; b=ueL9XXI+GUUtrlNnir3mOL/bIGZr6jNjX0YvFnEppBB+t7oi2t723yNVDI4ZUdLeJt pPeQBRbm2R0RiKsD9uUrcCUGcW/svCrTyfuR2+8cWGmx7WXu0lfuJDGbNB/lE+P7CcE6 vrDbP5b1klSs3fbRQAFv4SBuSTZp66AhBw/NCzFv1EOtSvTHJx00A/+aZ1Ho0qh3Fs8+ MBrmy2t4ZKhOqI2P8MDOI78ActrU+Q9nRQ8C0TNaiBw/BkMPj6LdX7ZSRP1wADeQ4OUy aRAJ3r2mgYe4Lno0nLsE0KMOSNfN9asYiR+2Y0tqt0e9fKSMoXl9aGOk2U6h6OkOE70D RsNw== 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=rBQqEcNI4qmQoA7TvV4cKxPn9VpIANl2GdIqii9bNbU=; b=kS32n47mocX1LYDj3APr/6vihe4fVxVbQUIoUFYTCjae3yVKtqA5u4+IHrRtef0htx A4r0nGUPQsm5oJsUVNqXzFESEsUHlbZudQHOuGF6zqykjuaao4vVuL/kZYVxoujDW216 3VJItpeA54jHpDqeaWU7doI1rEmJXYVQcWriMhJoaMLvXD1LV7i44JC5Iqwh1hY7Jxdb fvmK0cX5d6NKj6sF30FFsgikhvUTrkETY+FD+63QtJTXShGYA4IePlGmRB4OTRn5y/b6 ovXn83cfL/nGsC8BhbND+m/PGQZcBg9tnS1eO5CF55LMgrPp3catBiLHqCy2KN7+L5bP dp/A== X-Gm-Message-State: AOAM5316WtFAR6TyRZOGYH+U1cLzVwmVM3DHhGgpWjNbsUqc1BtaF3Tj SmIeK4j+LsLV5J0BnZUDZE8iQrI4I65VUg== X-Google-Smtp-Source: ABdhPJytV9q3vh1dokw73NDu8zEDyQey80TL3qbLRsyGW990BMBCXndofi3MAqXrMN/rc9rF3zxoNA== X-Received: by 2002:a1c:152:: with SMTP id 79mr800490wmb.90.1600884371787; Wed, 23 Sep 2020 11:06:11 -0700 (PDT) Received: from Red ([2a01:cb1d:3d5:a100:264b:feff:fe03:2806]) by smtp.googlemail.com with ESMTPSA id o16sm541123wrp.52.2020.09.23.11.06.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2020 11:06:10 -0700 (PDT) Date: Wed, 23 Sep 2020 20:06:08 +0200 From: LABBE Corentin To: Arnd Bergmann Subject: Re: [PATCH v2 4/7] crypto: sun4i-ss: handle BigEndian for cipher Message-ID: <20200923180608.GA26666@Red> References: <1600627038-40000-1-git-send-email-clabbe@baylibre.com> <1600627038-40000-5-git-send-email-clabbe@baylibre.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200923_140613_307204_0944105B X-CRM114-Status: GOOD ( 24.43 ) 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: Herbert Xu , 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 Wed, Sep 23, 2020 at 04:00:32PM +0200, Arnd Bergmann wrote: > On Sun, Sep 20, 2020 at 8:37 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 c6c25204780d..a05889745097 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++) > > + writel(cpu_to_le32(op->key[i]), ss->base + SS_KEY0 + i * 4); > > I suspect what you actually want here is writesl() in place of the > loop. This skips the byteswap on big-endian, rather than swapping > each word twice. > > The point is that this register seems to act as a FIFO for a byte-stream > rather than a 32-bit fixed-endian register. > > Arnd Thanks, using writesl() fixes the warning, but I need to keep the loop since the register is different each time. Or does it is better to use directly __raw_writel() ? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel