Build wallet with Android NDK

This commit is contained in:
MoroccanMalinois
2017-01-05 01:11:05 +00:00
parent dd580d7bc7
commit 80abc3bc4a
10 changed files with 103 additions and 8 deletions
+11
View File
@@ -89,3 +89,14 @@ if (ARM)
PROPERTY COMPILE_DEFINITIONS "NO_OPTIMIZED_MULTIPLY_ON_ARM")
endif()
endif()
# Because of the way Qt works on android with JNI, the code does not live in the main android thread
# So this code runs with a 1 MB default stack size.
# This will force the use of the heap for the allocation of the scratchpad
if (ANDROID)
if( BUILD_GUI_DEPS )
add_definitions(-DFORCE_USE_HEAP=1)
endif()
endif()
+3 -3
View File
@@ -39,8 +39,8 @@
#include <malloc.h>
#endif
// FreeBSD, and OpenBSD also don't need timeb.h
#if !defined(__FreeBSD__) && !defined(__OpenBSD__)
// ANDROID, FreeBSD, and OpenBSD also don't need timeb.h
#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__ANDROID__)
#include <sys/timeb.h>
#else
#include <sys/time.h>
@@ -499,7 +499,7 @@ static void oaes_get_seed( char buf[RANDSIZ + 1] )
#else
static uint32_t oaes_get_seed(void)
{
#if !defined(__FreeBSD__) && !defined(__OpenBSD__)
#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__ANDROID__)
struct timeb timer;
struct tm *gmTimer;
char * _test = NULL;
+10 -1
View File
@@ -1052,7 +1052,6 @@ STATIC INLINE void xor_blocks(uint8_t* a, const uint8_t* b)
void cn_slow_hash(const void *data, size_t length, char *hash)
{
uint8_t long_state[MEMORY];
uint8_t text[INIT_SIZE_BYTE];
uint8_t a[AES_BLOCK_SIZE];
uint8_t b[AES_BLOCK_SIZE];
@@ -1070,6 +1069,13 @@ void cn_slow_hash(const void *data, size_t length, char *hash)
hash_extra_blake, hash_extra_groestl, hash_extra_jh, hash_extra_skein
};
#ifndef FORCE_USE_HEAP
uint8_t long_state[MEMORY];
#else
uint8_t *long_state = NULL;
long_state = (uint8_t *)malloc(MEMORY);
#endif
hash_process(&state.hs, data, length);
memcpy(text, state.init, INIT_SIZE_BYTE);
@@ -1129,6 +1135,9 @@ void cn_slow_hash(const void *data, size_t length, char *hash)
memcpy(state.init, text, INIT_SIZE_BYTE);
hash_permutation(&state.hs);
extra_hashes[state.hs.b[0] & 3](&state, 200, hash);
#ifdef FORCE_USE_HEAP
free(long_state);
#endif
}
#endif /* !aarch64 || !crypto */