X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/480e2f239421563263d07f6d11f2c929d7f14d1f..b882b54314a484e2de70e55a5b820aa5b609a3b3:/client/nonce2key/crapto1.c diff --git a/client/nonce2key/crapto1.c b/client/nonce2key/crapto1.c index 36e21a1c..f005a9e3 100644 --- a/client/nonce2key/crapto1.c +++ b/client/nonce2key/crapto1.c @@ -158,7 +158,14 @@ struct Crypto1State* lfsr_recovery32(uint32_t ks2, uint32_t in) // allocate memory for out of place bucket_sort bucket_array_t bucket; - if ( !bucket_malloc(bucket) ) goto out; + for (uint32_t i = 0; i < 2; i++) { + for (uint32_t j = 0; j <= 0xff; j++) { + bucket[i][j].head = malloc(sizeof(uint32_t)<<14); + if (!bucket[i][j].head) { + goto out; + } + } + } // initialize statelists: add all possible states which would result into the rightmost 2 bits of the keystream for(i = 1 << 20; i >= 0; --i) { @@ -181,9 +188,11 @@ struct Crypto1State* lfsr_recovery32(uint32_t ks2, uint32_t in) recover(odd_head, odd_tail, oks, even_head, even_tail, eks, 11, statelist, in << 1, bucket); out: + for (uint32_t i = 0; i < 2; i++) + for (uint32_t j = 0; j <= 0xff; j++) + free(bucket[i][j].head); free(odd_head); free(even_head); - bucket_free(bucket); return statelist; }