SPARCv9 assembler pack update from HEAD.
authorAndy Polyakov <appro@openssl.org>
Mon, 14 Nov 2011 20:48:35 +0000 (20:48 +0000)
committerAndy Polyakov <appro@openssl.org>
Mon, 14 Nov 2011 20:48:35 +0000 (20:48 +0000)
crypto/sha/asm/sha512-sparcv9.pl
crypto/sparcv9cap.c

index ec5d78135e11439e4e529e85b952da143fd439b8..585740789e63e780cc7bb2549d120bf0d13090af 100644 (file)
@@ -305,9 +305,9 @@ $code.=<<___;
        srlx    @X[(($i+9)/2)%8],32,$tmp1       ! X[i+9]
        xor     $tmp0,$tmp2,$tmp2               ! sigma1(X[i+14])
        srl     @X[($i/2)%8],0,$tmp0
+       add     $tmp2,$tmp1,$tmp1
        add     $xi,$T1,$T1                     ! +=X[i]
        xor     $tmp0,@X[($i/2)%8],@X[($i/2)%8]
-       add     $tmp2,$T1,$T1
        add     $tmp1,$T1,$T1
 
        srl     $T1,0,$T1
@@ -318,9 +318,9 @@ ___
 $code.=<<___;
        srlx    @X[($i/2)%8],32,$tmp1           ! X[i]
        xor     $tmp0,$tmp2,$tmp2               ! sigma1(X[i+14])
-       srl     @X[($i/2)%8],0,@X[($i/2)%8]
        add     $xi,$T1,$T1                     ! +=X[i+9]
-       add     $tmp2,$T1,$T1
+       add     $tmp2,$tmp1,$tmp1
+       srl     @X[($i/2)%8],0,@X[($i/2)%8]
        add     $tmp1,$T1,$T1
 
        sllx    $T1,32,$tmp0
index ed195ab4028ce61ca3ffdfd22840fb1d86e1f271..a35976bd4d475125f4c3ecd0fa09f8c449014b18 100644 (file)
@@ -19,7 +19,8 @@ int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_U
        int bn_mul_mont_fpu(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_ULONG *np,const BN_ULONG *n0, int num);
        int bn_mul_mont_int(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_ULONG *np,const BN_ULONG *n0, int num);
 
-       if ((OPENSSL_sparcv9cap_P&(SPARCV9_PREFER_FPU|SPARCV9_VIS1)) ==
+       if (num>=8 && !(num&1) &&
+           (OPENSSL_sparcv9cap_P&(SPARCV9_PREFER_FPU|SPARCV9_VIS1)) ==
                (SPARCV9_PREFER_FPU|SPARCV9_VIS1))
                return bn_mul_mont_fpu(rp,ap,bp,np,n0,num);
        else