X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/b19bd5d6898f929de30e9110e011204a6c5622ad..ca4714cd23338a762c45839d1b3010988b7612a7:/client/nonce2key/crapto1.c?ds=sidebyside diff --git a/client/nonce2key/crapto1.c b/client/nonce2key/crapto1.c index c509581c..61215420 100644 --- a/client/nonce2key/crapto1.c +++ b/client/nonce2key/crapto1.c @@ -95,32 +95,6 @@ static void bucket_sort_intersect(uint32_t* const estart, uint32_t* const estop, } } - -static void quicksort(uint32_t* const start, uint32_t* const stop) -{ - uint32_t *it = start + 1, *rit = stop; - - if(it > rit) - return; - - while(it < rit) - if(*it <= *start) - ++it; - else if(*rit > *start) - --rit; - else - *it ^= (*it ^= *rit, *rit ^= *it); - - if(*rit >= *start) - --rit; - if(rit != start) - *rit ^= (*rit ^= *start, *start ^= *rit); - - quicksort(start, rit - 1); - quicksort(rit + 1, stop); -} - - /** binsearch * Binary search for the first occurence of *stop's MSB in sorted [start,stop] */ @@ -570,8 +544,14 @@ lfsr_common_prefix(uint32_t pfx, uint32_t rr, uint8_t ks[8], uint8_t par[8][8], statelist = malloc((sizeof *statelist) << 21); //how large should be? if(!statelist || !odd || !even) + { + free(statelist); + free(odd); + free(even); return 0; + } + s = statelist; for(o = odd; *o != -1; ++o) for(e = even; *e != -1; ++e)