Fix building with -DARCH=default -DNO_AES=ON

This commit is contained in:
moneromooo-monero 2017-10-05 17:04:41 +01:00
parent a2041c9874
commit 27fdaaa409
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
2 changed files with 7 additions and 3 deletions

View File

@ -452,7 +452,11 @@ else()
option(NO_AES "Explicitly disable AES support" ${NO_AES}) option(NO_AES "Explicitly disable AES support" ${NO_AES})
if(NOT NO_AES AND NOT ARM AND NOT PPC64LE) if(NO_AES)
message(STATUS "AES support explicitly disabled")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNO_AES")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNO_AES")
elseif(NOT ARM AND NOT PPC64LE)
message(STATUS "AES support enabled") message(STATUS "AES support enabled")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes")

View File

@ -47,7 +47,7 @@
extern int aesb_single_round(const uint8_t *in, uint8_t*out, const uint8_t *expandedKey); extern int aesb_single_round(const uint8_t *in, uint8_t*out, const uint8_t *expandedKey);
extern int aesb_pseudo_round(const uint8_t *in, uint8_t *out, const uint8_t *expandedKey); extern int aesb_pseudo_round(const uint8_t *in, uint8_t *out, const uint8_t *expandedKey);
#if defined(__x86_64__) || (defined(_MSC_VER) && defined(_WIN64)) #if !defined NO_AES && (defined(__x86_64__) || (defined(_MSC_VER) && defined(_WIN64)))
// Optimised code below, uses x86-specific intrinsics, SSE2, AES-NI // Optimised code below, uses x86-specific intrinsics, SSE2, AES-NI
// Fall back to more portable code is down at the bottom // Fall back to more portable code is down at the bottom
@ -645,7 +645,7 @@ void cn_slow_hash(const void *data, size_t length, char *hash)
extra_hashes[state.hs.b[0] & 3](&state, 200, hash); extra_hashes[state.hs.b[0] & 3](&state, 200, hash);
} }
#elif defined(__arm__) || defined(__aarch64__) #elif !defined NO_AES && (defined(__arm__) || defined(__aarch64__))
void slow_hash_allocate_state(void) void slow_hash_allocate_state(void)
{ {
// Do nothing, this is just to maintain compatibility with the upgraded slow-hash.c // Do nothing, this is just to maintain compatibility with the upgraded slow-hash.c