From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756692AbcI0Aqm (ORCPT ); Mon, 26 Sep 2016 20:46:42 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:53175 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756404AbcI0Aqf (ORCPT ); Mon, 26 Sep 2016 20:46:35 -0400 Date: Mon, 26 Sep 2016 21:46:18 -0300 From: Paulo Flabiano Smorigo To: Marcelo Cerri Cc: Herbert Xu , "David S. Miller" , linux-crypto@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , George Wilson , Claudio Carvalho , Paulo Flabiano Smorigo , joy.latten@canonical.com Subject: Re: [PATCH] crypto: sha1-powerpc: little-endian support References: <1474659116-4689-1-git-send-email-marcelo.cerri@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1474659116-4689-1-git-send-email-marcelo.cerri@canonical.com> User-Agent: Mutt/1.7.0 (2016-08-17) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16092700-0024-0000-0000-0000010E2C37 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16092700-0025-0000-0000-000015BF7C7F Message-Id: <20160927004618.GA5010@dublin> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-09-26_11:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609020000 definitions=main-1609270013 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fri, Sep 23, 2016 at 04:31:56PM -0300, Marcelo Cerri wrote: > The driver does not handle endianness properly when loading the input > data. Indeed. I tested in both endianesses and it's working fine. Thanks! Herbert, can we go ahead with this fix? > > Signed-off-by: Marcelo Cerri > --- > arch/powerpc/crypto/sha1-powerpc-asm.S | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/crypto/sha1-powerpc-asm.S b/arch/powerpc/crypto/sha1-powerpc-asm.S > index 125e165..82ddc9b 100644 > --- a/arch/powerpc/crypto/sha1-powerpc-asm.S > +++ b/arch/powerpc/crypto/sha1-powerpc-asm.S > @@ -7,6 +7,15 @@ > #include > #include > > +#ifdef __BIG_ENDIAN__ > +#define LWZ(rt, d, ra) \ > + lwz rt,d(ra) > +#else > +#define LWZ(rt, d, ra) \ > + li rt,d; \ > + lwbrx rt,rt,ra > +#endif > + > /* > * We roll the registers for T, A, B, C, D, E around on each > * iteration; T on iteration t is A on iteration t+1, and so on. > @@ -23,7 +32,7 @@ > #define W(t) (((t)%16)+16) > > #define LOADW(t) \ > - lwz W(t),(t)*4(r4) > + LWZ(W(t),(t)*4,r4) > > #define STEPD0_LOAD(t) \ > andc r0,RD(t),RB(t); \ > @@ -33,7 +42,7 @@ > add r0,RE(t),r15; \ > add RT(t),RT(t),r6; \ > add r14,r0,W(t); \ > - lwz W((t)+4),((t)+4)*4(r4); \ > + LWZ(W((t)+4),((t)+4)*4,r4); \ > rotlwi RB(t),RB(t),30; \ > add RT(t),RT(t),r14 > > -- > 2.7.4 > -- Paulo Flabiano Smorigo IBM Linux Technology Center