]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/mifarehost.c
FIX: Some uninitialized variables, some syntax suger, and some extra WDT_HIT calls...
[proxmark3-svn] / client / mifarehost.c
index 1cb228bb68881c9be22c9ae7478b317cff6b0455..431db9dcd35c44f1a41e5fae84402a55d80be1bd 100644 (file)
@@ -15,8 +15,6 @@
 #include "mifarehost.h"\r
 #include "proxmark3.h"\r
 \r
-#define llx PRIx64\r
-\r
 // MIFARE\r
 int compar_int(const void * a, const void * b) {\r
        // didn't work: (the result is truncated to 32 bits)\r
@@ -79,23 +77,19 @@ int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t * key, uint8_t trgBlockNo
        struct Crypto1State *p1, *p2, *p3, *p4;\r
        \r
        // flush queue\r
-       clearCommandBuffer();\r
-       //WaitForResponseTimeout(CMD_ACK,NULL,100);\r
        \r
        UsbCommand c = {CMD_MIFARE_NESTED, {blockNo + keyType * 0x100, trgBlockNo + trgKeyType * 0x100, calibrate}};\r
        memcpy(c.d.asBytes, key, 6);\r
+       clearCommandBuffer();\r
        SendCommand(&c);\r
 \r
-       if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {\r
-               return -1;\r
-       }\r
+       if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) return -1;\r
 \r
-       if (resp.arg[0]) {\r
-               return resp.arg[0];  // error during nested\r
-       }\r
-               \r
+       // error during nested\r
+       if (resp.arg[0]) return resp.arg[0];\r
+       \r
        memcpy(&uid, resp.d.asBytes, 4);\r
-       PrintAndLog("uid:%08x trgbl=%d trgkey=%x", uid, (uint16_t)resp.arg[2] & 0xff, (uint16_t)resp.arg[2] >> 8);\r
+       PrintAndLog("UID: %08x Block:%d Key: %c", uid, (uint16_t)resp.arg[2] & 0xff, (resp.arg[2] >> 8) ?'A':'B' );\r
                        \r
        for (i = 0; i < 2; i++) {\r
                statelists[i].blockNo = resp.arg[2] & 0xff;\r
Impressum, Datenschutz