From 9d1eaa281feb6ca36d04dafffc9565d9d7d2875f Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sun, 17 Jan 2016 23:00:50 +0100 Subject: [PATCH] FIX: makeing sure the "make clean" now deletes the nonce2key.exe file. --- tools/nonce2key/Makefile | 5 +---- tools/nonce2key/crapto1.c | 16 ++++++---------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/tools/nonce2key/Makefile b/tools/nonce2key/Makefile index 54abf80e..43a87c3f 100644 --- a/tools/nonce2key/Makefile +++ b/tools/nonce2key/Makefile @@ -5,7 +5,7 @@ LDFLAGS = OBJS = crypto1.o crapto1.o HEADERS = crapto1.h -EXES = nonce2key +EXES = nonce2key nonce2key.exe all: $(OBJS) $(EXES) @@ -15,8 +15,5 @@ all: $(OBJS) $(EXES) % : %.c $(LD) $(LDFLAGS) -o $@ $(OBJS) $< -crypto1test: libnfc $(OBJS) - $(LD) $(LDFLAGS) -o crypto1test crypto1test.c $(OBJS) - clean: rm -f $(OBJS) $(EXES) diff --git a/tools/nonce2key/crapto1.c b/tools/nonce2key/crapto1.c index e35daac8..5b3bab3e 100644 --- a/tools/nonce2key/crapto1.c +++ b/tools/nonce2key/crapto1.c @@ -416,9 +416,7 @@ uint32_t *lfsr_prefix_ks(uint8_t ks[8], int isodd) /** check_pfx_parity * helper function which eliminates possible secret states using parity bits */ -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) +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) { uint32_t ks1, nr, ks2, rr, ks3, c, good = 1; @@ -456,8 +454,7 @@ check_pfx_parity(uint32_t prefix, uint32_t rresp, uint8_t parities[8][8], * 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* lfsr_common_prefix(uint32_t pfx, uint32_t rr, uint8_t ks[8], uint8_t par[8][8]) { struct Crypto1State *statelist, *s; uint32_t *odd, *even, *o, *e, top; @@ -468,8 +465,9 @@ lfsr_common_prefix(uint32_t pfx, uint32_t rr, uint8_t ks[8], uint8_t par[8][8]) s = statelist = malloc((sizeof *statelist) << 20); if(!s || !odd || !even) { free(statelist); - statelist = 0; - goto out; + free(odd); + free(even); + return 0; } for(o = odd; *o + 1; ++o) @@ -481,8 +479,6 @@ lfsr_common_prefix(uint32_t pfx, uint32_t rr, uint8_t ks[8], uint8_t par[8][8]) } s->odd = s->even = 0; -out: - free(odd); - free(even); + return statelist; } -- 2.39.5