summaryrefslogtreecommitdiffstats
path: root/crypto/bn/asm
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2007-06-29 13:10:19 +0000
committerAndy Polyakov <appro@openssl.org>2007-06-29 13:10:19 +0000
commit673c55a2fe62000a0b7f0345ed16d91e1d28427a (patch)
tree4d66d3c8d0ff183a54b404a1a3c4f35d29deb334 /crypto/bn/asm
parent949ce10e8855f660971debe1b7b5842a84554006 (diff)
Latest bn_mont.c modification broke ECDSA test. I've got math wrong, which
is fixed now.
Diffstat (limited to 'crypto/bn/asm')
-rw-r--r--crypto/bn/asm/alpha-mont.pl2
-rw-r--r--crypto/bn/asm/armv4-mont.pl3
-rw-r--r--crypto/bn/asm/mips3-mont.pl3
-rw-r--r--crypto/bn/asm/ppc-mont.pl2
-rw-r--r--crypto/bn/asm/s390x-mont.pl6
-rw-r--r--crypto/bn/asm/sparcv9-mont.pl5
-rwxr-xr-xcrypto/bn/asm/sparcv9a-mont.pl6
-rw-r--r--crypto/bn/asm/via-mont.pl7
-rwxr-xr-xcrypto/bn/asm/x86-mont.pl3
-rwxr-xr-xcrypto/bn/asm/x86_64-mont.pl5
10 files changed, 3 insertions, 39 deletions
diff --git a/crypto/bn/asm/alpha-mont.pl b/crypto/bn/asm/alpha-mont.pl
index 09f53a3622..7a2cc3173b 100644
--- a/crypto/bn/asm/alpha-mont.pl
+++ b/crypto/bn/asm/alpha-mont.pl
@@ -262,8 +262,6 @@ bn_mul_mont:
mov $rp,$bp # put rp aside
mov sp,$tp
mov sp,$ap
- srl $nj,62,AT # boundary condition...
- beq AT,.Lcopy # ... is met
mov 0,$hi0 # clear borrow bit
.align 4
diff --git a/crypto/bn/asm/armv4-mont.pl b/crypto/bn/asm/armv4-mont.pl
index 3561ea2d61..47fbd387e4 100644
--- a/crypto/bn/asm/armv4-mont.pl
+++ b/crypto/bn/asm/armv4-mont.pl
@@ -163,9 +163,6 @@ bn_mul_mont:
mov $ap,$tp @ "borrow" $ap
sub $np,$np,$aj @ "rewind" $np to &np[0]
- movs $tj,$nj,lsr#30 @ boundary condition...
- beq .Lcopy @ ... is met
-
subs $tj,$tj,$tj @ "clear" carry flag
.Lsub: ldr $tj,[$tp],#4
ldr $nj,[$np],#4
diff --git a/crypto/bn/asm/mips3-mont.pl b/crypto/bn/asm/mips3-mont.pl
index e3c05acb03..8f9156e02a 100644
--- a/crypto/bn/asm/mips3-mont.pl
+++ b/crypto/bn/asm/mips3-mont.pl
@@ -270,9 +270,6 @@ bn_mul_mont:
PTR_ADD $tj,sp,$num # &tp[num]
move $tp,sp
move $ap,sp
-
- dsrl AT,$nj,62 # boundary condition...
- beqz AT,.Lcopy # ... is met
li $hi0,0 # clear borrow bit
.align 4
diff --git a/crypto/bn/asm/ppc-mont.pl b/crypto/bn/asm/ppc-mont.pl
index b69809a97e..6028edca22 100644
--- a/crypto/bn/asm/ppc-mont.pl
+++ b/crypto/bn/asm/ppc-mont.pl
@@ -267,13 +267,11 @@ Linner:
addi $i,$i,$BNSZ
ble- Louter
- $SHRI. $nj,$nj,$BITS-2 ; check boundary condition
addi $num,$num,2 ; restore $num
subfc $j,$j,$j ; j=0 and "clear" XER[CA]
addi $tp,$sp,$FRAME
addi $ap,$sp,$FRAME
mtctr $num
- beq Lcopy ; boundary condition is met
.align 4
Lsub: $LDX $tj,$tp,$j
diff --git a/crypto/bn/asm/s390x-mont.pl b/crypto/bn/asm/s390x-mont.pl
index 224d5ba668..d5505f93c3 100644
--- a/crypto/bn/asm/s390x-mont.pl
+++ b/crypto/bn/asm/s390x-mont.pl
@@ -183,12 +183,6 @@ $code.=<<___;
la $ap,8($fp)
lgr $j,$num
- #lg $nhi,-8($np) # buggy assembler
- lghi $count,-8 # buggy assembler
- lg $nhi,0($count,$np) # buggy assembler
- srag $nhi,$nhi,62 # boundary condition...
- jz .Lcopy # ... is met
-
lcgr $count,$num
sra $count,3 # incidentally clears "borrow"
.Lsub: lg $alo,0($j,$ap)
diff --git a/crypto/bn/asm/sparcv9-mont.pl b/crypto/bn/asm/sparcv9-mont.pl
index 2870812c15..b8fb1e8a25 100644
--- a/crypto/bn/asm/sparcv9-mont.pl
+++ b/crypto/bn/asm/sparcv9-mont.pl
@@ -257,11 +257,6 @@ $fname:
add $rp,$num,$rp
mov $tp,$ap
sub %g0,$num,%o7 ! k=-num
-
- srl $npj,30,%o0 ! boundary condition...
- brz,pn %o0,.Lcopy ! ... is met
- nop
-
ba .Lsub
subcc %g0,%g0,%g0 ! clear %icc.c
.align 16
diff --git a/crypto/bn/asm/sparcv9a-mont.pl b/crypto/bn/asm/sparcv9a-mont.pl
index 034792e298..a14205f2f0 100755
--- a/crypto/bn/asm/sparcv9a-mont.pl
+++ b/crypto/bn/asm/sparcv9a-mont.pl
@@ -798,15 +798,11 @@ $fname:
bnz %icc,.Louter
nop
- ld [$np-4],%o1
- subcc %g0,%g0,%g0 ! clear %icc.c
add $tp,8,$tp ! adjust tp to point at the end
- srl %o1,30,%o1 ! boundary condition...
orn %g0,%g0,%g4
- brz,pn %o1,.Lcopy ! ... is met
sub %g0,$num,%o7 ! n=-num
ba .Lsub
- nop
+ subcc %g0,%g0,%g0 ! clear %icc.c
.align 32
.Lsub:
diff --git a/crypto/bn/asm/via-mont.pl b/crypto/bn/asm/via-mont.pl
index ce3cd61eb3..c046a514c8 100644
--- a/crypto/bn/asm/via-mont.pl
+++ b/crypto/bn/asm/via-mont.pl
@@ -187,17 +187,12 @@ $sp=&DWP(28,"esp");
&data_byte(0xf3,0x0f,0xa6,0xc0);# rep montmul
&mov ("ecx","ebp");
- &xor ("edx","edx"); # i=0
&lea ("esi",&DWP(64,"esp")); # tp
# edi still points at the end of padded np copy...
- &mov ("eax",&DWP(-4-$pad,"edi")); # np[num-1]
&neg ("ebp");
&lea ("ebp",&DWP(-$pad,"edi","ebp",4)); # so just "rewind"
&mov ("edi",$rp); # restore rp
-
- &shr ("eax",30); # boundary condition...
- &jz (&label("copy")); # ... is met
- &xor ("edx","edx"); # clear CF
+ &xor ("edx","edx"); # i=0 and clear CF
&set_label("sub",8);
&mov ("eax",&DWP(0,"esi","edx",4));
diff --git a/crypto/bn/asm/x86-mont.pl b/crypto/bn/asm/x86-mont.pl
index 2ed76aac62..5cd3cd2ed5 100755
--- a/crypto/bn/asm/x86-mont.pl
+++ b/crypto/bn/asm/x86-mont.pl
@@ -554,9 +554,6 @@ $sbit=$num;
&mov ($np,$_np); # load modulus pointer
&mov ($rp,$_rp); # load result pointer
&lea ($tp,&DWP($frame,"esp")); # [$ap and $bp are zapped]
- &mov ("eax",&DWP(0,$np,$num,4)); # np[num-1]
- &shr ("eax",30); # check for boundary condition
- &jz (&label("copy"));
&mov ("eax",&DWP(0,$tp)); # tp[0]
&mov ($j,$num); # j=num-1
diff --git a/crypto/bn/asm/x86_64-mont.pl b/crypto/bn/asm/x86_64-mont.pl
index 68bec49cbc..6b33c7e9ea 100755
--- a/crypto/bn/asm/x86_64-mont.pl
+++ b/crypto/bn/asm/x86_64-mont.pl
@@ -167,11 +167,8 @@ bn_mul_mont:
cmp $num,$i
jl .Louter
- mov -8($np,$num,8),%rax # np[num-1]
lea (%rsp),$ap # borrow ap for tp
- shr \$62,%rax # check for boundary condition
lea -1($num),$j # j=num-1
- jz .Lcopy
mov ($ap),%rax # tp[0]
xor $i,$i # i=0 and clear CF!
@@ -198,7 +195,7 @@ bn_mul_mont:
mov $i,(%rsp,$j,8) # zap temporary vector
dec $j
jge .Lcopy
-
+
mov 8(%rsp,$num,8),%rsp # restore %rsp
mov \$1,%rax
pop %r15