X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/d716ca2fc1062c3c7f67cb52b0799df32adf6b0d..46c65fed6c1d0d1075a4a253145db44f7b916250:/armsrc/crapto1.c diff --git a/armsrc/crapto1.c b/armsrc/crapto1.c index c0a7fc32..2fdeb924 100644 --- a/armsrc/crapto1.c +++ b/armsrc/crapto1.c @@ -34,6 +34,7 @@ static void __attribute__((constructor)) fill_lut() static void quicksort(uint32_t* const start, uint32_t* const stop) { uint32_t *it = start + 1, *rit = stop; + uint32_t tmp; if(it > rit) return; @@ -43,13 +44,19 @@ static void quicksort(uint32_t* const start, uint32_t* const stop) ++it; else if(*rit > *start) --rit; - else - *it ^= ( (*it ^= *rit ), *rit ^= *it); + else { + tmp = *it; + *it = *rit; + *rit = tmp; + } if(*rit >= *start) --rit; - if(rit != start) - *rit ^= ( (*rit ^= *start), *start ^= *rit); + if(rit != start) { + tmp = *rit; + *rit = *start; + *start = tmp; + } quicksort(start, rit - 1); quicksort(rit + 1, stop); @@ -319,9 +326,12 @@ uint8_t lfsr_rollback_bit(struct Crypto1State *s, uint32_t in, int fb) { int out; uint8_t ret; + uint32_t tmp; s->odd &= 0xffffff; - s->odd ^= (s->odd ^= s->even, s->even ^= s->odd); + tmp = s->odd; + s->odd = s->even; + s->even = tmp; out = s->even & 1; out ^= LF_POLY_EVEN & (s->even >>= 1); @@ -440,7 +450,7 @@ check_pfx_parity(uint32_t prefix, uint32_t rresp, uint8_t parities[8][8], } return sl + good; -} +} /** lfsr_common_prefix