]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhfepa.c
FIX: lf hitag : Mea culpa, simulation should not have reader_field on. thanks to...
[proxmark3-svn] / client / cmdhfepa.c
index 44a539c89e3a8ed92c7a29af3896e353bfe7e58a..2f7ee7bc3fa04838b25b8d4d7079a10459efe133 100644 (file)
@@ -29,14 +29,14 @@ int CmdHFEPACollectPACENonces(const char *Cmd)
        unsigned int n = 0;
        // delay between requests
        unsigned int d = 0;
-       
+
        sscanf(Cmd, "%u %u %u", &m, &n, &d);
-       
+
        // values are expected to be > 0
        m = m > 0 ? m : 1;
        n = n > 0 ? n : 1;
 
-       PrintAndLog("Collecting %u %"hhu"-byte nonces", n, m);
+       PrintAndLog("Collecting %u %byte nonces", n, m);
        PrintAndLog("Start: %u", time(NULL));
        // repeat n times
        for (unsigned int i = 0; i < n; i++) {
@@ -44,7 +44,7 @@ int CmdHFEPACollectPACENonces(const char *Cmd)
                UsbCommand c = {CMD_EPA_PACE_COLLECT_NONCE, {(int)m, 0, 0}};
                SendCommand(&c);
                UsbCommand resp;
-    
+
                WaitForResponse(CMD_ACK,&resp);
 
                // check if command failed
@@ -58,13 +58,13 @@ int CmdHFEPACollectPACENonces(const char *Cmd)
                        }
                        // print nonce
                        PrintAndLog("Length: %d, Nonce: %s", nonce_length, nonce);
+                       free(nonce);
                }
                if (i < n - 1) {
                        sleep(d);
                }
        }
        PrintAndLog("End: %u", time(NULL));
-
        return 1;
 }
 
@@ -81,7 +81,7 @@ int CmdHFEPAPACEReplay(const char *Cmd)
        uint8_t *apdus[] = {msesa_apdu, gn_apdu, map_apdu, pka_apdu, ma_apdu};
 
        // usage message
-       static const char const *usage_msg =
+       static const char *usage_msg =
                "Please specify 5 APDUs separated by spaces. "
                "Example:\n preplay 0022C1A4 1068000000 1086000002 1234ABCDEF 1A2B3C4D";
 
@@ -178,8 +178,7 @@ int CmdHFEPAPACEReplay(const char *Cmd)
 
 // UI-related stuff
 
-static const command_t CommandTable[] = 
-{
+static const command_t CommandTable[] = {
   {"help",    CmdHelp,                   1, "This help"},
   {"cnonces", CmdHFEPACollectPACENonces, 0,
               "<m> <n> <d> Acquire n>0 encrypted PACE nonces of size m>0 with d sec pauses"},
@@ -188,18 +187,16 @@ static const command_t CommandTable[] =
   {NULL, NULL, 0, NULL}
 };
 
-int CmdHelp(const char *Cmd)
-{
+int CmdHelp(const char *Cmd) {
   CmdsHelp(CommandTable);
   return 0;
 }
 
-int CmdHFEPA(const char *Cmd)
-{
+int CmdHFEPA(const char *Cmd) {
        // flush
-       WaitForResponseTimeout(CMD_ACK,NULL,100);
-
+       clearCommandBuffer();
+       //WaitForResponseTimeout(CMD_ACK,NULL,100);
        // parse
-  CmdsParse(CommandTable, Cmd);
-  return 0;
+       CmdsParse(CommandTable, Cmd);
+       return 0;
 }
Impressum, Datenschutz