fix(crypto): fix build on clang/arm64

poc/andrew-t1-keyboard
Pavol Rusnak 3 years ago
parent acf7294ca2
commit 78be2c9cac

@ -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

@ -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)

@ -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);

@ -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

Loading…
Cancel
Save