X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/8130eba4d127d1093f55334998f25230f0731a92..01c78dabc3c80c89ad6ff623bb66f5b3c6067e67:/armsrc/crapto1.c?ds=sidebyside diff --git a/armsrc/crapto1.c b/armsrc/crapto1.c index 627cce4f..fcfd0b4d 100644 --- a/armsrc/crapto1.c +++ b/armsrc/crapto1.c @@ -24,9 +24,9 @@ static uint8_t filterlut[1 << 20]; static void __attribute__((constructor)) fill_lut() { - uint32_t i; - for(i = 0; i < 1 << 20; ++i) - filterlut[i] = filter(i); + uint32_t i; + for(i = 0; i < 1 << 20; ++i) + filterlut[i] = filter(i); } #define filter(x) (filterlut[(x) & 0xfffff]) #endif @@ -509,7 +509,6 @@ static struct Crypto1State* check_pfx_parity(uint32_t prefix, uint32_t rresp, ui * It returns a zero terminated list of possible cipher states after the * tag nonce was fed in */ - struct Crypto1State* lfsr_common_prefix(uint32_t pfx, uint32_t rr, uint8_t ks[8], uint8_t par[8][8]) { struct Crypto1State *statelist, *s; @@ -521,9 +520,8 @@ struct Crypto1State* lfsr_common_prefix(uint32_t pfx, uint32_t rr, uint8_t ks[8] s = statelist = malloc((sizeof *statelist) << 21); if(!s || !odd || !even) { free(statelist); - free(odd); - free(even); - return 0; + statelist = 0; + goto out; } for(o = odd; *o + 1; ++o) @@ -535,7 +533,7 @@ struct Crypto1State* lfsr_common_prefix(uint32_t pfx, uint32_t rr, uint8_t ks[8] } s->odd = s->even = 0; - +out: free(odd); free(even); return statelist;