Upgrade crapto1 library to v3.3 (#232)

- fix standalone tools mfkey32, mfkey64 and nonce2key to use common crapto1 library
- fix compiler warnings in tools/mfkey/mfkey64.c and tools/nonce2key/nonce2key.c
- allow crapto1.c to compile on ARM hosts
- add @iceman1001's readme.txt to tools/mfkey
This commit is contained in:
pwpiwi 2017-03-12 15:05:54 +01:00 committed by GitHub
commit 0ca9bc0e99
10 changed files with 150 additions and 195 deletions

View file

@ -1,17 +1,20 @@
VPATH = ../../common/crapto1
CC = gcc
LD = gcc
CFLAGS = -Wall -Winline -O4
CFLAGS = -I../../common -Wall -O4
LDFLAGS =
OBJS = crapto1.o crypto1.o
HEADERS =
EXES = mfkey64 mfkey32
LIBS =
all: $(OBJS) $(EXES) $(LIBS)
OBJS = crypto1.o crapto1.o
EXES = mfkey32 mfkey64
WINEXES = $(patsubst %, %.exe, $(EXES))
% : %.c $(OBJS)
$(LD) $(CFLAGS) -o $@ $< $(OBJS) $(LDFLAGS)
all: $(OBJS) $(EXES)
%.o : %.c
$(CC) $(CFLAGS) -c -o $@ $<
% : %.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $<
clean:
rm -f $(OBJS) $(EXES) $(LIBS)
rm -f $(OBJS) $(EXES) $(WINEXES)

View file

@ -1,5 +1,5 @@
#include <inttypes.h>
#include "crapto1.h"
#include "crapto1/crapto1.h"
#include <stdio.h>
#include <stdlib.h>

View file

@ -1,5 +1,5 @@
#include <inttypes.h>
#include "crapto1.h"
#include "crapto1/crapto1.h"
#include <stdio.h>
#include <string.h>
@ -34,7 +34,7 @@ int main (int argc, char *argv[]) {
for (int i = 0; i < encc; i++) {
enclen[i] = strlen(argv[i + 6]) / 2;
for (int i2 = 0; i2 < enclen[i]; i2++) {
sscanf(argv[i+6] + i2*2,"%2x", (uint8_t*)&enc[i][i2]);
sscanf(argv[i+6] + i2*2,"%2x", (unsigned int *)&enc[i][i2]);
}
}
printf("Recovering key for:\n");

View file

@ -1,22 +1,21 @@
VPATH = ../../common/crapto1
CC = gcc
LD = gcc
CFLAGS = -Wall -O4 -c
CFLAGS = -I../../common -Wall -O4
LDFLAGS =
OBJS = crypto1.o crapto1.o
HEADERS = crapto1.h
EXES = nonce2key
WINEXES = $(patsubst %, %.exe, $(EXES))
all: $(OBJS) $(EXES)
%.o : %.c
$(CC) $(CFLAGS) -o $@ $<
$(CC) $(CFLAGS) -c -o $@ $<
% : %.c
$(LD) $(LDFLAGS) -o $@ $(OBJS) $<
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $<
crypto1test: libnfc $(OBJS)
$(LD) $(LDFLAGS) -o crypto1test crypto1test.c $(OBJS)
clean:
rm -f $(OBJS) $(EXES)
rm -f $(OBJS) $(EXES) $(WINEXES)

View file

@ -1,13 +1,13 @@
#include "crapto1.h"
#include "crapto1/crapto1.h"
#include <inttypes.h>
#include <stdio.h>
typedef unsigned char byte_t;
int main(const int argc, const char* argv[]) {
struct Crypto1State *state;
uint32_t pos, uid, nt, nr, rr, nr_diff, ks1, ks2;
uint32_t pos, uid, nt, nr, rr, nr_diff;
byte_t bt, i, ks3x[8], par[8][8];
uint64_t key, key_recovered;
uint64_t key_recovered;
uint64_t par_info;
uint64_t ks_info;
nr = rr = 0;