]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - client/nonce2key/crapto1.c
Merge pull request #31 from dnet/patch-1
[proxmark3-svn] / client / nonce2key / crapto1.c
index c509581cfe75ea69e91097191b0b61fe4bb641a9..61215420ff604ec464d40afd450998f0d0fada20 100644 (file)
@@ -95,32 +95,6 @@ static void bucket_sort_intersect(uint32_t* const estart, uint32_t* const estop,
                }\r
 }\r
 \r
-\r
-static void quicksort(uint32_t* const start, uint32_t* const stop)\r
-{\r
-       uint32_t *it = start + 1, *rit = stop;\r
-\r
-       if(it > rit)\r
-               return;\r
-\r
-       while(it < rit)\r
-               if(*it <= *start)\r
-                       ++it;\r
-               else if(*rit > *start)\r
-                       --rit;\r
-               else\r
-                       *it ^= (*it ^= *rit, *rit ^= *it);\r
-\r
-       if(*rit >= *start)\r
-               --rit;\r
-       if(rit != start)\r
-               *rit ^= (*rit ^= *start, *start ^= *rit);\r
-\r
-       quicksort(start, rit - 1);\r
-       quicksort(rit + 1, stop);\r
-}\r
-\r
-\r
 /** binsearch\r
  * Binary search for the first occurence of *stop's MSB in sorted [start,stop]\r
  */\r
@@ -570,8 +544,14 @@ lfsr_common_prefix(uint32_t pfx, uint32_t rr, uint8_t ks[8], uint8_t par[8][8],
 \r
        statelist = malloc((sizeof *statelist) << 21);  //how large should be? \r
        if(!statelist || !odd || !even)\r
+       {\r
+                               free(statelist);\r
+                               free(odd);\r
+                               free(even);\r
                 return 0;\r
 \r
+       }\r
+\r
        s = statelist;\r
        for(o = odd; *o != -1; ++o)\r
                for(e = even; *e != -1; ++e)\r
Impressum, Datenschutz