diff --git a/crypto1_bs_crack.c b/crypto1_bs_crack.c index 5ffe016..12b537d 100644 --- a/crypto1_bs_crack.c +++ b/crypto1_bs_crack.c @@ -123,6 +123,13 @@ inline uint64_t crack_states_bitsliced(uint32_t **task){ #ifdef EXACT_COUNT bucket_states_tested += bucket_size[block_idx]; +#ifdef ONLINE_COUNT + __sync_fetch_and_add(&total_states_tested, bucket_size[block_idx]); +#endif +#else +#ifdef ONLINE_COUNT + __sync_fetch_and_add(&total_states_tested, MAX_BITSLICES); +#endif #endif // pre-compute first keystream and feedback bit vectors const bitslice_value_t ksb = crypto1_bs_f20(state_p); @@ -215,6 +222,8 @@ out: for(size_t block_idx = 0; block_idx < bitsliced_blocks; ++block_idx){ free(bitsliced_even_states[block_idx]-ROLLBACK_SIZE); } +#ifndef ONLINE_COUNT __sync_fetch_and_add(&total_states_tested, bucket_states_tested); +#endif return key; } diff --git a/libnfc_crypto1_crack.c b/libnfc_crypto1_crack.c index 255694c..053b6dd 100644 --- a/libnfc_crypto1_crack.c +++ b/libnfc_crypto1_crack.c @@ -292,6 +292,7 @@ POSSIBILITY OF SUCH DAMAGES. #include #include +#define ONLINE_COUNT #include "crypto1_bs_crack.h" extern uint64_t * crypto1_create(uint64_t key);