Hi,
In fact, there was another bug in little endian mode: a typo with tmp2.
Please find the patch correcting them.
Vincent

On Tue, Oct 19, 2010 at 10:24 AM, Andy Polyakov <ap...@openssl.org> wrote:

> > - the MIPS plateform I use is indeed little endian.
> > I will take a look to your question tomorrow.
> > I may not have seen the bug since I didn't made test with sha512 up to
> > now (only for bn_xxx/aes/sha1/sha256).
>
> The below remark is about sha256 code! For now sha512-mips.pl module can
> generate sha512 code only for MIPS64, something you can not test on your
> platform [right?]. But the $MSB assignment affects *both* sha256 and
> sha512 codes, so that bug should have emerged in sha256 test on your
> platform. A.
>
> >     Vincent,
> >
> >     > As I don't have access to little-endian MIPS,
> >
> >     In other words my understanding is that *your* MIPS platform is
> >     little-endian, isn't it? I noticed something that has to be a bug in
> >     sha512-mips.pl, which would fail sha256 test
> >     on little-endian MIPS32
> >     platform. Specifically $MSB assignment should read
> >
> >     $MSB = $big_endian ? 0 : ($SZ-1);
> >
> >     The test *could* have passed, because test is performed on aligned
> >     data... Does it make sense to you? A.
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> Development Mailing List                       openssl-dev@openssl.org
> Automated List Manager                           majord...@openssl.org
>
--- ../openssl/crypto/sha/asm/sha512-mips.pl	2010-10-02 14:43:04.000000000 +0200
+++ crypto/sha/asm/sha512-mips.pl	2010-10-20 01:11:37.783820130 +0200
@@ -127,7 +128,7 @@
 	andi	$tmp1,0xFF00
 	sll	$tmp2,$tmp2,8
 	or	@X[0],$tmp0
-	or	$tmp1,$t2
+	or	$tmp1,$tmp2
 	or	@X[0],$tmp1
 ___
 $code.=<<___;
@@ -214,7 +216,7 @@
 $FRAMESIZE=16*$SZ+16*$SZREG;
 $SAVED_REGS_MASK = ($flavour =~ /nubi/i) ? 0xc0fff008 : 0xc0ff0000;
 $pf = ($flavour =~ /nubi/i) ? $t0 : $t2;
-$MSB = 0;
+$MSB = $big_endian ? 0 : ($SZ-1);
 $LSB = ($SZ-1)&~$MSB;
 
 $code.=<<___;

Reply via email to