summaryrefslogtreecommitdiffhomepage
path: root/src/crypto/zinc
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-09-28 02:00:18 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-10-02 03:41:49 +0200
commit09e85633a7c689f8e605f5ae544b83b7940a1437 (patch)
treed6adb3b4a070c80802d817d11bebf3bb34621f8e /src/crypto/zinc
parent1eee8d7aa0740a86c6109f181689be49e58175be (diff)
poly1305-mips64: use compiler-defined macros in assembly
Andy and I agreed it's more correct to use the compiler-defined macros in assembly code, and not the project specific macros. Suggested-by: Andy Polyakov <appro@openssl.org> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/crypto/zinc')
-rw-r--r--src/crypto/zinc/poly1305/poly1305-mips64.S15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/crypto/zinc/poly1305/poly1305-mips64.S b/src/crypto/zinc/poly1305/poly1305-mips64.S
index d95d83f..272a86c 100644
--- a/src/crypto/zinc/poly1305/poly1305-mips64.S
+++ b/src/crypto/zinc/poly1305/poly1305-mips64.S
@@ -6,6 +6,11 @@
* This is based in part on Andy Polyakov's implementation from CRYPTOGAMS.
*/
+#if (defined(_MIPS_ARCH_MIPS64R3) || defined(_MIPS_ARCH_MIPS64R5) || \
+ defined(_MIPS_ARCH_MIPS64R6)) && !defined(_MIPS_ARCH_MIPS64R2)
+#define _MIPS_ARCH_MIPS64R2
+#endif
+
#ifdef __MIPSEB__
#define MSB 0
#define LSB 7
@@ -14,7 +19,7 @@
#define LSB 0
#endif
-#if defined(CONFIG_CPU_MIPS64_R6) || defined(CONFIG_CPU_MIPSR6)
+#if defined(_MIPS_ARCH_MIPS64R6)
#define dmultu(rs,rt)
#define mflo(rd,rs,rt) dmulu rd,rs,rt
#define mfhi(rd,rs,rt) dmuhu rd,rs,rt
@@ -48,7 +53,7 @@ poly1305_init_mips:
beqz $5,.Lno_key
-#if defined(CONFIG_CPU_MIPS64_R6) || defined(CONFIG_CPU_MIPSR6)
+#if defined(_MIPS_ARCH_MIPS64R6)
ld $8,0($5)
ld $9,8($5)
#else
@@ -58,7 +63,7 @@ poly1305_init_mips:
ldr $9,8+LSB($5)
#endif
#ifdef __MIPSEB__
-#if defined(CONFIG_CPU_MIPS64_R2) || defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPS64_R6) || defined(CONFIG_CPU_MIPSR6)
+#if defined(_MIPS_ARCH_MIPS64R2)
dsbh $8,$8 # byte swap
dsbh $9,$9
dshd $8,$8
@@ -152,7 +157,7 @@ poly1305_blocks_internal:
ld $17,40($4)
.Loop:
-#if defined(CONFIG_CPU_MIPS64_R6) || defined(CONFIG_CPU_MIPSR6)
+#if defined(_MIPS_ARCH_MIPS64R6)
ld $8,0($5) # load input
ld $9,8($5)
#else
@@ -164,7 +169,7 @@ poly1305_blocks_internal:
daddiu $6,-1
daddiu $5,16
#ifdef __MIPSEB__
-#if defined(CONFIG_CPU_MIPS64_R2) || defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPS64_R6) || defined(CONFIG_CPU_MIPSR6)
+#if defined(_MIPS_ARCH_MIPS64R2)
dsbh $8,$8 # byte swap
dsbh $9,$9
dshd $8,$8