OBJS = crypto1.o crapto1.o
HEADERS = crapto1.h
-EXES = nonce2key
+EXES = nonce2key nonce2key.exe
all: $(OBJS) $(EXES)
% : %.c
$(LD) $(LDFLAGS) -o $@ $(OBJS) $<
-crypto1test: libnfc $(OBJS)
- $(LD) $(LDFLAGS) -o crypto1test crypto1test.c $(OBJS)
-
clean:
rm -f $(OBJS) $(EXES)
/** check_pfx_parity\r
* helper function which eliminates possible secret states using parity bits\r
*/\r
-static struct Crypto1State*\r
-check_pfx_parity(uint32_t prefix, uint32_t rresp, uint8_t parities[8][8],\r
- uint32_t odd, uint32_t even, struct Crypto1State* sl)\r
+static struct Crypto1State* check_pfx_parity(uint32_t prefix, uint32_t rresp, uint8_t parities[8][8], uint32_t odd, uint32_t even, struct Crypto1State* sl)\r
{\r
uint32_t ks1, nr, ks2, rr, ks3, c, good = 1;\r
\r
* It returns a zero terminated list of possible cipher states after the\r
* tag nonce was fed in\r
*/\r
-struct Crypto1State*\r
-lfsr_common_prefix(uint32_t pfx, uint32_t rr, uint8_t ks[8], uint8_t par[8][8])\r
+struct Crypto1State* lfsr_common_prefix(uint32_t pfx, uint32_t rr, uint8_t ks[8], uint8_t par[8][8])\r
{\r
struct Crypto1State *statelist, *s;\r
uint32_t *odd, *even, *o, *e, top;\r
s = statelist = malloc((sizeof *statelist) << 20);\r
if(!s || !odd || !even) {\r
free(statelist);\r
- statelist = 0;\r
- goto out;\r
+ free(odd);\r
+ free(even);\r
+ return 0;\r
}\r
\r
for(o = odd; *o + 1; ++o)\r
}\r
\r
s->odd = s->even = 0;\r
-out:\r
- free(odd);\r
- free(even);\r
+\r
return statelist;\r
}\r