From 77dee16f6464eac50c72c6f28c4bcd10402cdba3 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Thu, 21 Apr 2016 14:34:58 +0200 Subject: [PATCH] FIX: fixed some compiler warnings about strlen call and sscanf. CHG: trying some optimised gcc settings in Makefile --- tools/mfkey/Makefile | 2 +- tools/mfkey/mfkey64.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/mfkey/Makefile b/tools/mfkey/Makefile index e1bb4d07..8fb7aa30 100755 --- a/tools/mfkey/Makefile +++ b/tools/mfkey/Makefile @@ -1,6 +1,6 @@ CC = gcc LD = gcc -CFLAGS = -std=c99 -Wall -Winline -O3 +CFLAGS = -std=c99 -march=native -Wall -Winline -O3 LDFLAGS = OBJS = crapto1.o crypto1.o diff --git a/tools/mfkey/mfkey64.c b/tools/mfkey/mfkey64.c index b09eeaeb..616c6f3d 100755 --- a/tools/mfkey/mfkey64.c +++ b/tools/mfkey/mfkey64.c @@ -1,8 +1,9 @@ #define __STDC_FORMAT_MACROS -#include -#include "crapto1.h" #include +#include #include +#include +#include "crapto1.h" #define llx PRIx64 #define lli PRIi64 @@ -38,7 +39,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]); } } @@ -97,7 +98,7 @@ int main (int argc, char *argv[]) { lfsr_rollback_word(revstate, nr_enc, 1); lfsr_rollback_word(revstate, uid ^ nt, 0); crypto1_get_lfsr(revstate, &key); - printf("\nFound Key: [%012"llx"]\n\n",key); + printf("\nFound Key: [%012"llx"]\n\n", key); crypto1_destroy(revstate); t1 = clock() - t1; -- 2.39.5