diff options
author | Andy Polyakov <appro@openssl.org> | 2014-06-06 21:27:18 +0200 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2014-06-06 21:27:18 +0200 |
commit | 5dcf70a1c57c2019bfad640fe14fd4a73212860a (patch) | |
tree | 0033ec72c6c8080843ceda81aa0a3b37be5f8342 /crypto/bn | |
parent | cd91fd7c32428c0deb503f19b8061e0980476876 (diff) |
ARM assembly pack: get ARMv7 instruction endianness right.
Pointer out and suggested by: Ard Biesheuvel.
Diffstat (limited to 'crypto/bn')
-rw-r--r-- | crypto/bn/asm/armv4-gf2m.pl | 3 | ||||
-rw-r--r-- | crypto/bn/asm/armv4-mont.pl | 10 |
2 files changed, 10 insertions, 3 deletions
diff --git a/crypto/bn/asm/armv4-gf2m.pl b/crypto/bn/asm/armv4-gf2m.pl index c66495040c..b781afbf89 100644 --- a/crypto/bn/asm/armv4-gf2m.pl +++ b/crypto/bn/asm/armv4-gf2m.pl @@ -202,7 +202,7 @@ bn_GF2m_mul_2x2: veor $r, $r, $t2 vst1.32 {$r}, [r0] - bx lr + ret @ bx lr .align 4 .Lialu: #endif @@ -273,6 +273,7 @@ foreach (split("\n",$code)) { s/\`([^\`]*)\`/eval $1/geo; s/\bq([0-9]+)#(lo|hi)/sprintf "d%d",2*$1+($2 eq "hi")/geo or + s/\bret\b/bx lr/go or s/\bbx\s+lr\b/.word\t0xe12fff1e/go; # make it possible to compile with -march=armv4 print $_,"\n"; diff --git a/crypto/bn/asm/armv4-mont.pl b/crypto/bn/asm/armv4-mont.pl index fe81f9b6f6..72bad8e308 100644 --- a/crypto/bn/asm/armv4-mont.pl +++ b/crypto/bn/asm/armv4-mont.pl @@ -230,9 +230,14 @@ bn_mul_mont: ldmia sp!,{r4-r12,lr} @ restore registers add sp,sp,#2*4 @ skip over {r0,r2} mov r0,#1 -.Labrt: tst lr,#1 +.Labrt: +#if __ARM_ARCH__>=5 + ret @ bx lr +#else + tst lr,#1 moveq pc,lr @ be binary compatible with V4, yet bx lr @ interoperable with Thumb ISA:-) +#endif .size bn_mul_mont,.-bn_mul_mont ___ { @@ -650,7 +655,7 @@ bn_mul8x_mont_neon: sub sp,ip,#96 vldmia sp!,{d8-d15} ldmia sp!,{r4-r11} - bx lr + ret @ bx lr .size bn_mul8x_mont_neon,.-bn_mul8x_mont_neon #endif ___ @@ -665,5 +670,6 @@ ___ $code =~ s/\`([^\`]*)\`/eval $1/gem; $code =~ s/\bbx\s+lr\b/.word\t0xe12fff1e/gm; # make it possible to compile with -march=armv4 +$code =~ s/\bret\b/bx lr/gm; print $code; close STDOUT; |