Merge pull request #93 from angelsl/android

Fixes for compiling on Android

Thanks!  Great that it compiles w hardnested on Android now! Really wow!
This commit is contained in:
Iceman 2017-03-29 22:35:37 +02:00 committed by GitHub
commit 48bb16e840
4 changed files with 13 additions and 5 deletions

View file

@ -1431,7 +1431,7 @@ static const uint64_t crack_states_bitsliced(statelist_t *p){
#endif
if ( !lstate_p ) {
__sync_fetch_and_add(&total_states_tested, bucket_states_tested);
__atomic_fetch_add(&total_states_tested, bucket_states_tested, __ATOMIC_SEQ_CST);
return key;
}
@ -1618,7 +1618,7 @@ out:
#endif
}
__sync_fetch_and_add(&total_states_tested, bucket_states_tested);
__atomic_fetch_add(&total_states_tested, bucket_states_tested, __ATOMIC_SEQ_CST);
return key;
}
@ -1636,8 +1636,8 @@ static void* crack_states_thread(void* x){
if (keys_found) break;
else if(key != -1) {
if (TestIfKeyExists(key)) {
__sync_fetch_and_add(&keys_found, 1);
__sync_fetch_and_add(&foundkey, key);
__atomic_fetch_add(&keys_found, 1, __ATOMIC_SEQ_CST);
__atomic_fetch_add(&foundkey, key, __ATOMIC_SEQ_CST);
printf("*");
fflush(stdout);
break;

View file

@ -534,9 +534,11 @@ void xor(unsigned char * dst, unsigned char * src, size_t len) {
int32_t le24toh (uint8_t data[3]) {
return (data[2] << 16) | (data[1] << 8) | data[0];
}
#ifndef ANDROID
uint32_t le32toh (uint8_t *data) {
return (uint32_t)( (data[3]<<24) | (data[2]<<16) | (data[1]<<8) | data[0]);
}
#endif
// Pack a bitarray into a uint32_t.
uint32_t PackBits(uint8_t start, uint8_t len, uint8_t* bits) {

View file

@ -31,6 +31,10 @@
#include <windows.h>
#endif
#ifdef ANDROID
#include <endian.h>
#endif
#ifndef BITMASK
# define BITMASK(X) (1 << (X))
@ -146,7 +150,9 @@ extern void wiegand_add_parity(uint8_t *target, uint8_t *source, uint8_t length)
extern void xor(unsigned char * dst, unsigned char * src, size_t len);
extern int32_t le24toh (uint8_t data[3]);
#ifndef ANDROID
extern uint32_t le32toh (uint8_t *data);
#endif
extern uint32_t PackBits(uint8_t start, uint8_t len, uint8_t* bits);
extern void rol(uint8_t *data, const size_t len);
extern uint32_t SwapBits(uint32_t value, int nrbits);

View file

@ -199,7 +199,7 @@ static void buffreplace (LexState *ls, char from, char to) {
#if ANDROID
#define getlocaldecpoint() '.'
#define getlocaledecpoint() '.'
#elif !defined(getlocaledecpoint)
#define getlocaledecpoint() (localeconv()->decimal_point[0])
#endif