]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/crapto1.c
FIX; the "L" optional parameter for swapping endianess on used authentication key...
[proxmark3-svn] / armsrc / crapto1.c
index 9d491d1271ff1fdcda05b5ae980e1530f8d00ccc..2fdeb924241ee0ac30bd631027286c4711c25771 100644 (file)
@@ -34,6 +34,7 @@ static void __attribute__((constructor)) fill_lut()
 static void quicksort(uint32_t* const start, uint32_t* const stop)\r
 {\r
        uint32_t *it = start + 1, *rit = stop;\r
+       uint32_t tmp;\r
 \r
        if(it > rit)\r
                return;\r
@@ -43,13 +44,19 @@ static void quicksort(uint32_t* const start, uint32_t* const stop)
                        ++it;\r
                else if(*rit > *start)\r
                        --rit;\r
-               else\r
-                       *it ^= (*it ^= *rit, *rit ^= *it);\r
+               else {\r
+                       tmp = *it;\r
+                       *it = *rit;\r
+                       *rit = tmp;\r
+               }\r
 \r
        if(*rit >= *start)\r
                --rit;\r
-       if(rit != start)\r
-               *rit ^= (*rit ^= *start, *start ^= *rit);\r
+       if(rit != start) {\r
+               tmp = *rit;\r
+               *rit = *start;\r
+               *start = tmp;\r
+       }\r
 \r
        quicksort(start, rit - 1);\r
        quicksort(rit + 1, stop);\r
@@ -319,9 +326,12 @@ uint8_t lfsr_rollback_bit(struct Crypto1State *s, uint32_t in, int fb)
 {\r
        int out;\r
        uint8_t ret;\r
+       uint32_t tmp;\r
 \r
        s->odd &= 0xffffff;\r
-       s->odd ^= (s->odd ^= s->even, s->even ^= s->odd);\r
+       tmp = s->odd;\r
+       s->odd = s->even;\r
+       s->even = tmp;\r
 \r
        out = s->even & 1;\r
        out ^= LF_POLY_EVEN & (s->even >>= 1);\r
@@ -440,7 +450,7 @@ check_pfx_parity(uint32_t prefix, uint32_t rresp, uint8_t parities[8][8],
        }\r
 \r
        return sl + good;\r
-} \r
+}\r
 \r
 \r
 /** lfsr_common_prefix\r
@@ -454,7 +464,7 @@ lfsr_common_prefix(uint32_t pfx, uint32_t rr, uint8_t ks[8], uint8_t par[8][8])
 \r
        odd = lfsr_prefix_ks(ks, 1);\r
        even = lfsr_prefix_ks(ks, 0);\r
-\r
+       \r
        s = statelist = malloc((sizeof *statelist) << 20);\r
        if(!s || !odd || !even) {\r
                free(statelist);\r
Impressum, Datenschutz