diff --git a/crypto/Makefile b/crypto/Makefile index 26d0bccf6..4b794006b 100644 --- a/crypto/Makefile +++ b/crypto/Makefile @@ -124,8 +124,8 @@ fuzzer: fuzzer/fuzzer.o $(OBJS) $(CC) $(CFLAGS) fuzzer/fuzzer.o $(OBJS) -o fuzzer/fuzzer clean: - rm -f *.o aes/*.o chacha20poly1305/*.o ed25519-donna/*.o - rm -f tests/test_check tests/test_speed tests/test_openssl tests/libtrezor-crypto.so tests/aestst + rm -f *.o aes/*.o chacha20poly1305/*.o ed25519-donna/*.o monero/*.o + rm -f tests/*.o tests/test_check tests/test_speed tests/test_openssl tests/libtrezor-crypto.so tests/aestst rm -f tools/*.o tools/xpubaddrgen tools/mktable tools/bip39bruteforce rm -f fuzzer/*.o fuzzer/fuzzer diff --git a/crypto/aes/aestst.c b/crypto/aes/aestst.c index 9b8097c4e..90a8714a9 100644 --- a/crypto/aes/aestst.c +++ b/crypto/aes/aestst.c @@ -108,8 +108,12 @@ void cycles(volatile uint64_t *rtn) cpuid } #elif defined( __GNUC__ ) +#if defined(__aarch64__) + __asm__ __volatile__("mrs %0, cntvct_el0": "=r" (*rtn)); +#else __asm__ __volatile__("rdtsc": "=A" (*rtn)); #endif +#endif } int main(void) diff --git a/crypto/chacha20poly1305/chacha_merged.c b/crypto/chacha20poly1305/chacha_merged.c index 2ad260d60..7989f0c01 100644 --- a/crypto/chacha20poly1305/chacha_merged.c +++ b/crypto/chacha20poly1305/chacha_merged.c @@ -29,7 +29,7 @@ static const char tau[16] = "expand 16-byte k"; void ECRYPT_keysetup(ECRYPT_ctx *x,const u8 *k,u32 kbits,u32 ivbits) { (void)ivbits; - const char *constants = NULL; + const char *constants = (const char *)0; x->input[4] = U8TO32_LITTLE(k + 0); x->input[5] = U8TO32_LITTLE(k + 4); diff --git a/crypto/groestl_internal.h b/crypto/groestl_internal.h index 3fdd710f0..3c675d8ea 100644 --- a/crypto/groestl_internal.h +++ b/crypto/groestl_internal.h @@ -106,6 +106,14 @@ typedef int64_t sph_s64; #define SPH_DETECT_LITTLE_ENDIAN 1 #define SPH_DETECT_BIG_ENDIAN 0 +/* + * ARM64, little-endian. + */ +#elif defined __aarch64__ + +#define SPH_DETECT_LITTLE_ENDIAN 1 +#define SPH_DETECT_BIG_ENDIAN 0 + #endif