summaryrefslogtreecommitdiffstats
path: root/crypto/ec/asm
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2015-09-23 18:41:27 +0200
committerAndy Polyakov <appro@openssl.org>2015-09-25 13:34:02 +0200
commit11208dcfb9105e8afa37233185decefd45e89e17 (patch)
tree1294a09f6ed63951181da9c4a9c6b16835c80f60 /crypto/ec/asm
parente7a68985d5b734890489a9d47f82210c384e8c3a (diff)
ARMv4 assembly pack: implement support for Thumb2.
As some of ARM processors, more specifically Cortex-Mx series, are Thumb2-only, we need to support Thumb2-only builds even in assembly. Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'crypto/ec/asm')
-rwxr-xr-xcrypto/ec/asm/ecp_nistz256-armv4.pl38
1 files changed, 38 insertions, 0 deletions
diff --git a/crypto/ec/asm/ecp_nistz256-armv4.pl b/crypto/ec/asm/ecp_nistz256-armv4.pl
index b49b77ea3e..aeeb190335 100755
--- a/crypto/ec/asm/ecp_nistz256-armv4.pl
+++ b/crypto/ec/asm/ecp_nistz256-armv4.pl
@@ -45,7 +45,12 @@ $code.=<<___;
#include "arm_arch.h"
.text
+#if defined(__thumb2__) && !defined(__APPLE__)
+.syntax unified
+.thumb
+#else
.code 32
+#endif
___
########################################################################
# Convert ecp_nistz256_table.c to layout expected by ecp_nistz_gather_w7
@@ -162,6 +167,9 @@ __ecp_nistz256_mul_by_2:
adcs $a6,$a6,$a6
mov $ff,#0
adcs $a7,$a7,$a7
+#ifdef __thumb2__
+ it cs
+#endif
movcs $ff,#-1 @ $ff = carry ? -1 : 0
b .Lreduce_by_sub
@@ -213,6 +221,9 @@ __ecp_nistz256_add:
adcs $a6,$a6,$t2
mov $ff,#0
adcs $a7,$a7,$t3
+#ifdef __thumb2__
+ it cs
+#endif
movcs $ff,#-1 @ $ff = carry ? -1 : 0, "broadcast" carry
ldr lr,[sp],#4 @ pop lr
@@ -286,6 +297,9 @@ __ecp_nistz256_mul_by_3:
adcs $a6,$a6,$a6
mov $ff,#0
adcs $a7,$a7,$a7
+#ifdef __thumb2__
+ it cs
+#endif
movcs $ff,#-1 @ $ff = carry ? -1 : 0, "broadcast" carry
subs $a0,$a0,$ff @ subtract synthesized modulus, see
@@ -318,6 +332,9 @@ __ecp_nistz256_mul_by_3:
adcs $a6,$a6,$t2
mov $ff,#0
adcs $a7,$a7,$t3
+#ifdef __thumb2__
+ it cs
+#endif
movcs $ff,#-1 @ $ff = carry ? -1 : 0, "broadcast" carry
ldr lr,[sp],#4 @ pop lr
@@ -781,6 +798,9 @@ ecp_nistz256_gather_w5:
cmp $index,#0
mov $mask,#0
+#ifdef __thumb2__
+ itt ne
+#endif
subne $index,$index,#1
movne $mask,#-1
add $inp,$inp,$index,lsl#2
@@ -887,6 +907,9 @@ ecp_nistz256_gather_w7:
cmp $index,#0
mov $mask,#0
+#ifdef __thumb2__
+ itt ne
+#endif
subne $index,$index,#1
movne $mask,#-1
add $inp,$inp,$index
@@ -1180,6 +1203,9 @@ __ecp_nistz256_add_self:
adcs $a6,$a6,$a6
mov $ff,#0
adcs $a7,$a7,$a7
+#ifdef __thumb2__
+ it cs
+#endif
movcs $ff,#-1 @ $ff = carry ? -1 : 0
subs $a0,$a0,$ff @ subtract synthesized modulus
@@ -1369,6 +1395,9 @@ ecp_nistz256_point_add:
stmia r3!,{r4-r11}
ldmia $b_ptr,{r4-r11}
cmp r12,#0
+#ifdef __thumb2__
+ it ne
+#endif
movne r12,#-1
stmia r3,{r4-r11}
str r12,[sp,#32*18+8] @ !in2infty
@@ -1395,6 +1424,9 @@ ecp_nistz256_point_add:
stmia r3!,{r4-r11}
ldmia $a_ptr,{r4-r11}
cmp r12,#0
+#ifdef __thumb2__
+ it ne
+#endif
movne r12,#-1
stmia r3,{r4-r11}
str r12,[sp,#32*18+4] @ !in1infty
@@ -1636,6 +1668,9 @@ ecp_nistz256_point_add_affine:
stmia r3!,{r4-r11}
ldmia $a_ptr,{r4-r11}
cmp r12,#0
+#ifdef __thumb2__
+ it ne
+#endif
movne r12,#-1
stmia r3,{r4-r11}
str r12,[sp,#32*15+4] @ !in1infty
@@ -1661,6 +1696,9 @@ ecp_nistz256_point_add_affine:
orr r12,r12,r11
stmia r3!,{r4-r11}
cmp r12,#0
+#ifdef __thumb2__
+ it ne
+#endif
movne r12,#-1
str r12,[sp,#32*15+8] @ !in2infty