summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-05-01 20:41:58 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-05-01 20:41:58 +0000
commit61de04269aadd9234b26ae3447ab26afae16fd9a (patch)
treea1b6a0ddf302503238471296c0be060844c033fb
parent8494668683c9c2cd1ed5965a6db9c41fb24ab55c (diff)
Fix include filename to get register name aliases under BSD
-rw-r--r--lib/libcrypto/bn/asm/alpha-mont.pl43
-rw-r--r--lib/libcrypto/modes/asm/ghash-alpha.pl32
-rw-r--r--lib/libcrypto/sha/asm/sha1-alpha.pl7
3 files changed, 40 insertions, 42 deletions
diff --git a/lib/libcrypto/bn/asm/alpha-mont.pl b/lib/libcrypto/bn/asm/alpha-mont.pl
index 7a2cc3173b0..41700d5bd58 100644
--- a/lib/libcrypto/bn/asm/alpha-mont.pl
+++ b/lib/libcrypto/bn/asm/alpha-mont.pl
@@ -41,8 +41,7 @@ $j="s4";
$m1="s5";
$code=<<___;
-#include <asm.h>
-#include <regdef.h>
+#include <machine/asm.h>
.text
@@ -53,15 +52,15 @@ $code=<<___;
.align 5
.ent bn_mul_mont
bn_mul_mont:
- lda sp,-40(sp)
+ lda sp,-48(sp)
stq ra,0(sp)
stq s3,8(sp)
stq s4,16(sp)
stq s5,24(sp)
stq fp,32(sp)
mov sp,fp
- .mask 0x0400f000,-40
- .frame fp,40,ra
+ .mask 0x0400f000,-48
+ .frame fp,48,ra
.prologue 0
.align 4
@@ -76,7 +75,7 @@ bn_mul_mont:
ldq $aj,8($ap)
subq sp,AT,sp
ldq $bi,0($bp) # bp[0]
- mov -4096,AT
+ lda AT,-4096(zero) # mov -4096,AT
ldq $n0,0($n0)
and sp,AT,sp
@@ -106,9 +105,9 @@ bn_mul_mont:
.align 4
.L1st:
.set noreorder
- ldq $aj,($aj)
+ ldq $aj,0($aj)
addl $j,1,$j
- ldq $nj,($nj)
+ ldq $nj,0($nj)
lda $tp,8($tp)
addq $alo,$hi0,$lo0
@@ -159,12 +158,12 @@ bn_mul_mont:
.align 4
.Louter:
s8addq $i,$bp,$bi
- ldq $hi0,($ap)
+ ldq $hi0,0($ap)
ldq $aj,8($ap)
- ldq $bi,($bi)
- ldq $hi1,($np)
+ ldq $bi,0($bi)
+ ldq $hi1,0($np)
ldq $nj,8($np)
- ldq $tj,(sp)
+ ldq $tj,0(sp)
mulq $hi0,$bi,$lo0
umulh $hi0,$bi,$hi0
@@ -195,10 +194,10 @@ bn_mul_mont:
.set noreorder
ldq $tj,8($tp) #L0
nop #U1
- ldq $aj,($aj) #L1
+ ldq $aj,0($aj) #L1
s8addq $j,$np,$nj #U0
- ldq $nj,($nj) #L0
+ ldq $nj,0($nj) #L0
nop #U1
addq $alo,$hi0,$lo0 #L1
lda $tp,8($tp)
@@ -247,7 +246,7 @@ bn_mul_mont:
addq $hi1,v0,$hi1
addq $hi1,$hi0,$lo1
- stq $j,($tp)
+ stq $j,0($tp)
cmpult $lo1,$hi0,$hi1
addq $lo1,$tj,$lo1
cmpult $lo1,$tj,AT
@@ -265,8 +264,8 @@ bn_mul_mont:
mov 0,$hi0 # clear borrow bit
.align 4
-.Lsub: ldq $lo0,($tp)
- ldq $lo1,($np)
+.Lsub: ldq $lo0,0($tp)
+ ldq $lo1,0($np)
lda $tp,8($tp)
lda $np,8($np)
subq $lo0,$lo1,$lo1 # tp[i]-np[i]
@@ -274,7 +273,7 @@ bn_mul_mont:
subq $lo1,$hi0,$lo0
cmpult $lo1,$lo0,$hi0
or $hi0,AT,$hi0
- stq $lo0,($rp)
+ stq $lo0,0($rp)
cmpult $tp,$tj,v0
lda $rp,8($rp)
bne v0,.Lsub
@@ -288,7 +287,7 @@ bn_mul_mont:
bis $bp,$ap,$ap # ap=borrow?tp:rp
.align 4
-.Lcopy: ldq $aj,($ap) # copy or in-place refresh
+.Lcopy: ldq $aj,0($ap) # copy or in-place refresh
lda $tp,8($tp)
lda $rp,8($rp)
lda $ap,8($ap)
@@ -306,11 +305,11 @@ bn_mul_mont:
ldq s4,16(sp)
ldq s5,24(sp)
ldq fp,32(sp)
- lda sp,40(sp)
+ lda sp,48(sp)
ret (ra)
.end bn_mul_mont
-.rdata
-.asciiz "Montgomery Multiplication for Alpha, CRYPTOGAMS by <appro\@openssl.org>"
+.ascii "Montgomery Multiplication for Alpha, CRYPTOGAMS by <appro\@openssl.org>"
+.align 2
___
print $code;
diff --git a/lib/libcrypto/modes/asm/ghash-alpha.pl b/lib/libcrypto/modes/asm/ghash-alpha.pl
index 6358b2750fa..b6d6ea5a62a 100644
--- a/lib/libcrypto/modes/asm/ghash-alpha.pl
+++ b/lib/libcrypto/modes/asm/ghash-alpha.pl
@@ -245,12 +245,7 @@ ___
}}
$code=<<___;
-#ifdef __linux__
-#include <asm/regdef.h>
-#else
-#include <asm.h>
-#include <regdef.h>
-#endif
+#include <machine/asm.h>
.text
@@ -266,8 +261,8 @@ gcm_gmult_4bit:
ldq $Xlo,8($Xi)
ldq $Xhi,0($Xi)
- br $rem_4bit,.Lpic1
-.Lpic1: lda $rem_4bit,rem_4bit-.Lpic1($rem_4bit)
+ bsr $t0,picmeup
+ nop
___
&loop();
@@ -341,8 +336,8 @@ gcm_ghash_4bit:
ldq $Xhi,0($Xi)
ldq $Xlo,8($Xi)
- br $rem_4bit,.Lpic2
-.Lpic2: lda $rem_4bit,rem_4bit-.Lpic2($rem_4bit)
+ bsr $t0,picmeup
+ nop
.Louter:
extql $inhi,$inp,$inhi
@@ -436,11 +431,20 @@ $code.=<<___;
.end gcm_ghash_4bit
.align 4
+.ent picmeup
+picmeup:
+ .frame sp,0,$t0
+ .prologue 0
+ br $rem_4bit,.Lpic
+.Lpic: lda $rem_4bit,12($rem_4bit)
+ ret ($t0)
+.end picmeup
+ nop
rem_4bit:
- .quad 0x0000<<48, 0x1C20<<48, 0x3840<<48, 0x2460<<48
- .quad 0x7080<<48, 0x6CA0<<48, 0x48C0<<48, 0x54E0<<48
- .quad 0xE100<<48, 0xFD20<<48, 0xD940<<48, 0xC560<<48
- .quad 0x9180<<48, 0x8DA0<<48, 0xA9C0<<48, 0xB5E0<<48
+ .long 0,0x0000<<16, 0,0x1C20<<16, 0,0x3840<<16, 0,0x2460<<16
+ .long 0,0x7080<<16, 0,0x6CA0<<16, 0,0x48C0<<16, 0,0x54E0<<16
+ .long 0,0xE100<<16, 0,0xFD20<<16, 0,0xD940<<16, 0,0xC560<<16
+ .long 0,0x9180<<16, 0,0x8DA0<<16, 0,0xA9C0<<16, 0,0xB5E0<<16
.ascii "GHASH for Alpha, CRYPTOGAMS by <appro\@openssl.org>"
.align 4
diff --git a/lib/libcrypto/sha/asm/sha1-alpha.pl b/lib/libcrypto/sha/asm/sha1-alpha.pl
index 6c4b9251fd4..44720c418c8 100644
--- a/lib/libcrypto/sha/asm/sha1-alpha.pl
+++ b/lib/libcrypto/sha/asm/sha1-alpha.pl
@@ -225,12 +225,7 @@ ___
}
$code=<<___;
-#ifdef __linux__
-#include <asm/regdef.h>
-#else
-#include <asm.h>
-#include <regdef.h>
-#endif
+#include <machine/asm.h>
.text