diff options
author | Riccardo Spagni <ric@spagni.net> | 2019-03-05 12:40:06 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2019-03-05 12:40:06 +0200 |
commit | 39d7d3113bfe3655e721fa08b132d3b7fbcfb9b3 (patch) | |
tree | 01313a7ac6efed723a88e4063478539323fd556b /src/crypto/slow-hash.c | |
parent | Merge pull request #5101 (diff) | |
parent | CryptonightR: define out i386/x86_64 specific code on other archs (diff) | |
download | monero-39d7d3113bfe3655e721fa08b132d3b7fbcfb9b3.tar.xz |
Merge pull request #5231
108c625b CryptonightR: define out i386/x86_64 specific code on other archs (moneromooo-monero)
1b8757dd slow-hash: fix build on arm (moneromooo-monero)
5057eb11 cmake: ARCH_ID fixes for cross compilation (TheCharlatan)
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 |