diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-02-21 19:14:19 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-03-05 10:24:24 +0000 |
commit | 1b8757dddcba80d15962b149f9f158b1b5bf8b56 (patch) | |
tree | d9c696f2931ffc20943f61b325eb5226c4ca77fa /src/crypto/slow-hash.c | |
parent | cmake: ARCH_ID fixes for cross compilation (diff) | |
download | monero-1b8757dddcba80d15962b149f9f158b1b5bf8b56.tar.xz |
slow-hash: fix build on arm
Diffstat (limited to 'src/crypto/slow-hash.c')
-rw-r--r-- | src/crypto/slow-hash.c | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/src/crypto/slow-hash.c b/src/crypto/slow-hash.c index 2a8ddb59c..6bdc1b28c 100644 --- a/src/crypto/slow-hash.c +++ b/src/crypto/slow-hash.c @@ -65,6 +65,31 @@ static void local_abort(const char *msg) #endif } +volatile int use_v4_jit_flag = -1; + +static inline int use_v4_jit(void) +{ +#if defined(__x86_64__) + + if (use_v4_jit_flag != -1) + return use_v4_jit_flag; + + const char *env = getenv("MONERO_USE_CNV4_JIT"); + if (!env) { + use_v4_jit_flag = 0; + } + else if (!strcmp(env, "0") || !strcmp(env, "no")) { + use_v4_jit_flag = 0; + } + else { + use_v4_jit_flag = 1; + } + return use_v4_jit_flag; +#else + return 0; +#endif +} + #define VARIANT1_1(p) \ do if (variant == 1) \ { \ @@ -494,31 +519,6 @@ STATIC INLINE int force_software_aes(void) return use; } -volatile int use_v4_jit_flag = -1; - -STATIC INLINE int use_v4_jit(void) -{ -#if defined(__x86_64__) - - if (use_v4_jit_flag != -1) - return use_v4_jit_flag; - - const char *env = getenv("MONERO_USE_CNV4_JIT"); - if (!env) { - use_v4_jit_flag = 0; - } - else if (!strcmp(env, "0") || !strcmp(env, "no")) { - use_v4_jit_flag = 0; - } - else { - use_v4_jit_flag = 1; - } - return use_v4_jit_flag; -#else - return 0; -#endif -} - STATIC INLINE int check_aes_hw(void) { int cpuid_results[4]; @@ -1029,6 +1029,8 @@ void slow_hash_free_state(void) #define U64(x) ((uint64_t *) (x)) +#define hp_jitfunc ((v4_random_math_JIT_func)NULL) + STATIC INLINE void xor64(uint64_t *a, const uint64_t b) { *a ^= b; @@ -1574,6 +1576,8 @@ void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int #else // Portable implementation as a fallback +#define hp_jitfunc ((v4_random_math_JIT_func)NULL) + void slow_hash_allocate_state(void) { // Do nothing, this is just to maintain compatibility with the upgraded slow-hash.c |