diff --git a/crypto1_bs.c b/crypto1_bs.c index 2fc7963..2bb1194 100644 --- a/crypto1_bs.c +++ b/crypto1_bs.c @@ -23,6 +23,11 @@ THE SOFTWARE. */ #include "crypto1_bs.h" +#include +#define __STDC_FORMAT_MACROS +#define llx PRIx64 +#define lli PRIi64 +#define lu PRIu32 // The following functions use this global or thread-local state // It is sized to fit exactly KEYSTREAM_SIZE more states next to the initial state @@ -109,7 +114,7 @@ void crypto1_bs_print_states(bitslice_t bitsliced_states[]){ state_t values[MAX_BITSLICES]; crypto1_bs_convert_states(bitsliced_states, values); for(slice_idx = 0; slice_idx < MAX_BITSLICES; slice_idx++){ - printf("State %03lu: %012lx\n", slice_idx, values[slice_idx].value); + printf("State %03zu: %012"llx"\n", slice_idx, values[slice_idx].value); } } diff --git a/solve_bs.c b/solve_bs.c index bffaabc..864269c 100644 --- a/solve_bs.c +++ b/solve_bs.c @@ -8,6 +8,11 @@ #include "craptev1.h" #include "crypto1_bs.h" #include "crypto1_bs_crack.h" +#include +#define __STDC_FORMAT_MACROS +#define llx PRIx64 +#define lli PRIi64 +#define lu PRIu32 // linked from .so / .c files by bla extern uint64_t *readnonces(char* fname); @@ -70,14 +75,14 @@ int main(int argc, char* argv[]){ total_states_tested = 0; keys_found = 0; - printf("Starting %lu threads to test %lu states\n", thread_count, total_states); + printf("Starting %zu threads to test %zu states\n", thread_count, total_states); for(i = 0; i < thread_count; i++){ pthread_create(&threads[i], NULL, crack_states_thread, (void*) i); } for(i = 0; i < thread_count; i++){ pthread_join(threads[i], 0); } - printf("Tested %lu states\n", total_states_tested); + printf("Tested %zu states\n", total_states_tested); craptev1_destroy_space(space); return 0; diff --git a/solve_piwi.c b/solve_piwi.c index ea21c3b..9902468 100644 --- a/solve_piwi.c +++ b/solve_piwi.c @@ -5,6 +5,11 @@ #include #include #include "craptev1.h" +#include +#define __STDC_FORMAT_MACROS +#define llx PRIx64 +#define lli PRIi64 +#define lu PRIu32 #define rev32(word) (((word & 0xff) << 24) | (((word >> 8) & 0xff) << 16) | (((word >> 16) & 0xff) << 8) | (((word >> 24) & 0xff))) @@ -50,7 +55,7 @@ void* crack_states_thread(void* x){ states_tested = total_states - craptev1_sizeof_space(space+j*5); printf("Cracking... %6.02f%%\n", (100.0*states_tested/(total_states))); if(key != -1){ - printf("Found key: %012lx\n", key); + printf("Found key: %012"llx"\n", key); exit(0); } } @@ -68,7 +73,7 @@ int main(int argc, char* argv[]){ thread_count = get_nprocs_conf(); pthread_t threads[thread_count]; - printf("Starting %lu threads to test %lu states\n", thread_count, total_states); + printf("Starting %zu threads to test %zu states\n", thread_count, total_states); size_t i; states_tested = 0; for(i = 0; i < thread_count; i++){ @@ -77,7 +82,7 @@ int main(int argc, char* argv[]){ for(i = 0; i < thread_count; i++){ pthread_join(threads[i], 0); } - printf("Tested %lu states\n", states_tested); + printf("Tested %zu states\n", states_tested); craptev1_destroy_space(space); return 0; diff --git a/solve_piwi_bs.c b/solve_piwi_bs.c index aea81b3..69acd83 100644 --- a/solve_piwi_bs.c +++ b/solve_piwi_bs.c @@ -8,6 +8,11 @@ #include "craptev1.h" #include "crypto1_bs.h" #include "crypto1_bs_crack.h" +#include +#define __STDC_FORMAT_MACROS +#define llx PRIx64 +#define lli PRIi64 +#define lu PRIu32 uint64_t split(uint8_t p){ return (((p & 0x8) >>3 )| ((p & 0x4) >> 2) << 8 | ((p & 0x2) >> 1) << 16 | (p & 0x1) << 24 ); @@ -46,7 +51,7 @@ void* crack_states_thread(void* x){ for(j = thread_id; space[j * 5]; j += thread_count) { const uint64_t key = crack_states_bitsliced(space + j * 5); if(key != -1){ - printf("Found key: %012lx\n", key); + printf("Found key: %012"llx"\n", key); __sync_fetch_and_add(&keys_found, 1); break; } else if(keys_found){ @@ -94,14 +99,14 @@ int main(int argc, char* argv[]){ total_states_tested = 0; keys_found = 0; - printf("Starting %lu threads to test %lu states\n", thread_count, total_states); + printf("Starting %zu threads to test %zu states\n", thread_count, total_states); for(i = 0; i < thread_count; i++){ pthread_create(&threads[i], NULL, crack_states_thread, (void*) i); } for(i = 0; i < thread_count; i++){ pthread_join(threads[i], 0); } - printf("Tested %lu states\n", total_states_tested); + printf("Tested %zu states\n", total_states_tested); craptev1_destroy_space(space); return 0;