]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
chg: cleaning out timing.
authoriceman1001 <iceman@iuse.se>
Mon, 13 Mar 2017 08:45:46 +0000 (09:45 +0100)
committericeman1001 <iceman@iuse.se>
Mon, 13 Mar 2017 08:45:46 +0000 (09:45 +0100)
chg: makefile (piwi)

tools/mfkey/Makefile
tools/mfkey/mfkey32.c
tools/mfkey/mfkey32v2.c
tools/mfkey/mfkey64.c
tools/nonce2key/Makefile
tools/nonce2key/nonce2key.c

index 8fb7aa302e54622eb864cf5ca70127968e6e16d6..6a4c541fddb12ee50036f741c729a3829b7f4584 100755 (executable)
@@ -6,14 +6,16 @@ LDFLAGS =
 OBJS = crapto1.o crypto1.o
 HEADERS = crapto1.h
 EXES = mfkey64 mfkey32 mfkey32v2
-WINEXE = mfkey64.exe mfkey32.exe mfkey32v2.exe
-LIBS =
+WINEXE = $(patsubst %, %.exe, $(EXES))
        
-all: $(OBJS) $(EXES) $(LIBS)
+all: $(OBJS) $(EXES)
 
-% : %.c $(OBJS)
-       $(LD) $(CFLAGS) -o $@ $< $(OBJS) $(LDFLAGS)
+%.o : %.c
+       $(CC) $(CFLAGS) -c -o $@ $<
+
+% : %.c
+       $(LD) $(CFLAGS) -o $@ $(OBJS) $<
 
 clean: 
-       rm -f $(OBJS) $(EXES) $(LIBS) $(WINEXE)
+       rm -f $(OBJS) $(EXES) $(WINEXE)
 
index 3872e81dd7052a563e793ff191c675c7799eda82..1196868d42103a7c77d5bad62255b3385dfb6960 100755 (executable)
@@ -3,7 +3,6 @@
 #include "crapto1.h"
 #include <stdio.h>
 #include <stdlib.h>
-#include <time.h>
 
 int main (int argc, char *argv[]) {
        struct Crypto1State *s,*t;
@@ -44,9 +43,7 @@ int main (int argc, char *argv[]) {
        uint32_t p64 = prng_successor(nt, 64);
        printf("  nt': %08x\n", p64);
        printf(" nt'': %08x\n", prng_successor(p64, 32));
-
-       clock_t t1 = clock();
-               
+       
        // Extract the keystream from the messages
        printf("\nKeystream used to generate {ar} and {at}:\n");
        ks2 = ar0_enc ^ p64;
@@ -66,7 +63,5 @@ int main (int argc, char *argv[]) {
                        break;}
        }
        free(s);
-       t1 = clock() - t1;
-       if ( t1 > 0 ) printf("Time : %.0f ticks \n", (float)t1);
        return 0;
 }
index d220566ee1f3c001a51d9a5f37fb6123f4064768..9c04e9c18d3620f0c65e4183a02714917f108df5 100644 (file)
@@ -3,7 +3,6 @@
 #include "crapto1.h"
 #include <stdio.h>
 #include <stdlib.h>
-#include <time.h>
  
 int main (int argc, char *argv[]) {
        struct Crypto1State *s,*t;
@@ -50,7 +49,6 @@ int main (int argc, char *argv[]) {
        
        printf("  nt': %08x\n", p64);
        printf(" nt'': %08x\n", prng_successor(p64, 32));
-       clock_t t1 = clock();
 
        // Extract the keystream from the messages
        printf("\nKeystream used to generate {ar} and {at}:\n");
@@ -58,7 +56,6 @@ int main (int argc, char *argv[]) {
        printf("  ks2: %08x\n",ks2);
 
        s = lfsr_recovery32(ar0_enc ^ p64, 0);
-       
   
        for(t = s; t->odd | t->even; ++t) {
                lfsr_rollback_word(t, 0, 0);
@@ -73,7 +70,5 @@ int main (int argc, char *argv[]) {
                        break;}
        }
        free(s);
-       t1 = clock() - t1;
-       if ( t1 > 0 ) printf("Time : %.0f ticks \n", (float)t1 );
        return 0;
 }
index 6a7e78c04de5b09eb3527068822a526bc70ca3cf..bf1226ba8912136fe1c6b83a688410ce06bcec81 100755 (executable)
@@ -61,8 +61,6 @@ int main (int argc, char *argv[]) {
        printf("  nt': %08x\n",prng_successor(nt, 64));
        printf(" nt'': %08x\n",prng_successor(nt, 96));
        
-       clock_t t1 = clock();
-       
        // Extract the keystream from the messages
        printf("\nKeystream used to generate {ar} and {at}:\n");
        ks2 = ar_enc ^ prng_successor(nt, 64);
@@ -97,8 +95,5 @@ int main (int argc, char *argv[]) {
        crypto1_get_lfsr(revstate, &key);
        printf("\nFound Key: [%012" PRIx64 "]\n\n", key);
        crypto1_destroy(revstate);
-  
-       t1 = clock() - t1;
-       if ( t1 > 0 ) printf("Time : %.0f ticks \n", (float)t1);
        return 0;
 }
index bfab6fd862153f3d3f104e01a9403b65c0888d69..1119ab7661afaacd03c2dc06438bdaef3f598c44 100644 (file)
@@ -6,12 +6,12 @@ LDFLAGS =
 OBJS = crypto1.o crapto1.o
 HEADERS = crapto1.h
 EXES = nonce2key
-WINEXES = nonce2key.exe
+WINEXES = $(patsubst %, %.exe, $(EXES))
 
 all: $(OBJS) $(EXES)
 
 %.o : %.c
-       $(CC) $(CFLAGS) -o $@ $<
+       $(CC) $(CFLAGS) -c -o $@ $<
 
 % : %.c
        $(LD) $(LDFLAGS) -o $@ $(OBJS) $<
index 250691c1af28c0068c6f92e1d92617e9671fb49b..fffa5a2ac1a01a64f2bf821f14eef09654381eb9 100644 (file)
@@ -2,14 +2,12 @@
 #define __STDC_FORMAT_MACROS
 #include <inttypes.h>
 #include <stdio.h>
-#include <time.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;
-       byte_t bt, i, ks3x[8], par[8][8];
-       uint64_t key, key_recovered;
+       uint32_t pos, uid, nt, nr, rr, nr_diff;
+       uint8_t bt, i, ks3x[8], par[8][8];
+       uint64_t key_recovered;
        uint64_t par_info;
        uint64_t ks_info;
        nr = rr = 0;
@@ -49,16 +47,11 @@ int main(const int argc, const char* argv[]) {
                printf("%01x|\n", par[i][7]);
        }
        printf("+----+--------+---+-----+---------------+\n");
-
-       clock_t t1 = clock();
-  
        state = lfsr_common_prefix(nr,rr,ks3x,par);
        lfsr_rollback_word(state,uid^nt,0);
        crypto1_get_lfsr(state,&key_recovered);
        printf("\nkey recovered: %012" PRIx64 "\n\n", key_recovered);
        crypto1_destroy(state);
-  
-       t1 = clock() - t1;
-       if ( t1 > 0 ) printf("Time in nonce2key: %.0f ticks \n", (float)t1);
        return 0;
 }
Impressum, Datenschutz