aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/crypto/zinc/poly1305
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
commitbe6fc170ffec79d1d3a2c418243beb66f96316f0 (patch)
treed2e2f4754233730ac172b7d2c7067eecfcfd5e1b /src/crypto/zinc/poly1305
parentblake2s: rename arch function and use slicker le32 helper (diff)
downloadwireguard-monolithic-historical-be6fc170ffec79d1d3a2c418243beb66f96316f0.tar.xz
wireguard-monolithic-historical-be6fc170ffec79d1d3a2c418243beb66f96316f0.zip
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>
Diffstat (limited to 'src/crypto/zinc/poly1305')
-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