From be6fc170ffec79d1d3a2c418243beb66f96316f0 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 28 Sep 2018 02:00:18 +0200 Subject: 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 --- src/crypto/zinc/poly1305/poly1305-mips64.S | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/crypto/zinc/poly1305') 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 -- cgit v1.2.3-59-g8ed1b