]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - client/mifarehost.c
CHG: some minor changes in the ouput from hf 14b raw.
[proxmark3-svn] / client / mifarehost.c
index d754b06b4a1a01dd589c6523bc354fdd0c99566d..b18450cf3550a6ae3417ec88714c06ae4651b802 100644 (file)
@@ -71,9 +71,10 @@ void* nested_worker_thread(void *arg)
 \r
 int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t * key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t * resultKey, bool calibrate) \r
 {\r
 \r
 int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t * key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t * resultKey, bool calibrate) \r
 {\r
-       uint16_t i, len;\r
+       uint16_t i;\r
        uint32_t uid;\r
        UsbCommand resp;\r
        uint32_t uid;\r
        UsbCommand resp;\r
+\r
        StateList_t statelists[2];\r
        struct Crypto1State *p1, *p2, *p3, *p4;\r
        \r
        StateList_t statelists[2];\r
        struct Crypto1State *p1, *p2, *p3, *p4;\r
        \r
@@ -84,26 +85,24 @@ int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t * key, uint8_t trgBlockNo
        memcpy(c.d.asBytes, key, 6);\r
        SendCommand(&c);\r
 \r
        memcpy(c.d.asBytes, key, 6);\r
        SendCommand(&c);\r
 \r
-       if (WaitForResponseTimeout(CMD_ACK,&resp,1500)) {\r
-               len = resp.arg[1];\r
-               if (len == 2) { \r
+       if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {\r
+               return -1;\r
+       }\r
+\r
+       if (resp.arg[0]) {\r
+               return resp.arg[0];  // error during nested\r
+       }\r
+               \r
                        memcpy(&uid, resp.d.asBytes, 4);\r
                        memcpy(&uid, resp.d.asBytes, 4);\r
-                       PrintAndLog("uid:%08x len=%d trgbl=%d trgkey=%x", uid, len, (uint16_t)resp.arg[2] & 0xff, (uint16_t)resp.arg[2] >> 8);\r
+       PrintAndLog("uid:%08x trgbl=%d trgkey=%x", uid, (uint16_t)resp.arg[2] & 0xff, (uint16_t)resp.arg[2] >> 8);\r
                        \r
                        for (i = 0; i < 2; i++) {\r
                                statelists[i].blockNo = resp.arg[2] & 0xff;\r
                                statelists[i].keyType = (resp.arg[2] >> 8) & 0xff;\r
                                statelists[i].uid = uid;\r
                        \r
                        for (i = 0; i < 2; i++) {\r
                                statelists[i].blockNo = resp.arg[2] & 0xff;\r
                                statelists[i].keyType = (resp.arg[2] >> 8) & 0xff;\r
                                statelists[i].uid = uid;\r
-\r
                                memcpy(&statelists[i].nt,  (void *)(resp.d.asBytes + 4 + i * 8 + 0), 4);\r
                                memcpy(&statelists[i].ks1, (void *)(resp.d.asBytes + 4 + i * 8 + 4), 4);\r
                        }\r
                                memcpy(&statelists[i].nt,  (void *)(resp.d.asBytes + 4 + i * 8 + 0), 4);\r
                                memcpy(&statelists[i].ks1, (void *)(resp.d.asBytes + 4 + i * 8 + 4), 4);\r
                        }\r
-               }\r
-               else {\r
-                       PrintAndLog("Got 0 keys from proxmark."); \r
-                       return 1;\r
-               }\r
-       }\r
        \r
        // calc keys\r
        \r
        \r
        // calc keys\r
        \r
Impressum, Datenschutz