All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Flabiano Smorigo <pfsmorigo@linux.vnet.ibm.com>
To: Marcelo Cerri <marcelo.cerri@canonical.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	linux-crypto@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	George Wilson <gcwilson@us.ibm.com>,
	Claudio Carvalho <cclaudio@br.ibm.com>,
	Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>,
	joy.latten@canonical.com
Subject: Re: [PATCH] crypto: sha1-powerpc: little-endian support
Date: Mon, 26 Sep 2016 21:46:18 -0300	[thread overview]
Message-ID: <20160927004618.GA5010@dublin> (raw)
In-Reply-To: <1474659116-4689-1-git-send-email-marcelo.cerri@canonical.com>

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 <marcelo.cerri@canonical.com>
> ---
>  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 <asm/ppc_asm.h>
>  #include <asm/asm-offsets.h>
> 
> +#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

  reply	other threads:[~2016-09-27  0:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-23 19:31 [PATCH] crypto: sha1-powerpc: little-endian support Marcelo Cerri
2016-09-27  0:46 ` Paulo Flabiano Smorigo [this message]
2016-09-28 13:15 ` Marcelo Cerri
2016-09-28 13:20   ` Herbert Xu
2016-09-28 13:27     ` Marcelo Cerri
2016-10-04  6:23       ` Michael Ellerman
2016-10-04 12:07         ` Marcelo Cerri
2016-10-02 14:37 ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160927004618.GA5010@dublin \
    --to=pfsmorigo@linux.vnet.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=cclaudio@br.ibm.com \
    --cc=davem@davemloft.net \
    --cc=gcwilson@us.ibm.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=joy.latten@canonical.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=marcelo.cerri@canonical.com \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=pfsmorigo@br.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.