FIX: makeing sure the "make clean" now deletes the nonce2key.exe file.

This commit is contained in:
iceman1001 2016-01-17 23:00:50 +01:00
commit 9d1eaa281f
2 changed files with 7 additions and 14 deletions

View file

@ -5,7 +5,7 @@ LDFLAGS =
OBJS = crypto1.o crapto1.o OBJS = crypto1.o crapto1.o
HEADERS = crapto1.h HEADERS = crapto1.h
EXES = nonce2key EXES = nonce2key nonce2key.exe
all: $(OBJS) $(EXES) all: $(OBJS) $(EXES)
@ -15,8 +15,5 @@ all: $(OBJS) $(EXES)
% : %.c % : %.c
$(LD) $(LDFLAGS) -o $@ $(OBJS) $< $(LD) $(LDFLAGS) -o $@ $(OBJS) $<
crypto1test: libnfc $(OBJS)
$(LD) $(LDFLAGS) -o crypto1test crypto1test.c $(OBJS)
clean: clean:
rm -f $(OBJS) $(EXES) rm -f $(OBJS) $(EXES)

View file

@ -416,9 +416,7 @@ uint32_t *lfsr_prefix_ks(uint8_t ks[8], int isodd)
/** check_pfx_parity /** check_pfx_parity
* helper function which eliminates possible secret states using parity bits * helper function which eliminates possible secret states using parity bits
*/ */
static struct Crypto1State* 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)
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; 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 * It returns a zero terminated list of possible cipher states after the
* tag nonce was fed in * tag nonce was fed in
*/ */
struct Crypto1State* struct Crypto1State* lfsr_common_prefix(uint32_t pfx, uint32_t rr, uint8_t ks[8], uint8_t par[8][8])
lfsr_common_prefix(uint32_t pfx, uint32_t rr, uint8_t ks[8], uint8_t par[8][8])
{ {
struct Crypto1State *statelist, *s; struct Crypto1State *statelist, *s;
uint32_t *odd, *even, *o, *e, top; 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); s = statelist = malloc((sizeof *statelist) << 20);
if(!s || !odd || !even) { if(!s || !odd || !even) {
free(statelist); free(statelist);
statelist = 0; free(odd);
goto out; free(even);
return 0;
} }
for(o = odd; *o + 1; ++o) 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; s->odd = s->even = 0;
out:
free(odd);
free(even);
return statelist; return statelist;
} }