]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
add support for a new kind Magic Chinese UID changable Mifare Classic card
authordouniwan5788 <douniwan5788@gmail.com>
Thu, 21 Apr 2016 07:50:26 +0000 (15:50 +0800)
committerdouniwan5788 <douniwan5788@gmail.com>
Thu, 21 Apr 2016 07:50:26 +0000 (15:50 +0800)
armsrc/mifarecmd.c
armsrc/mifareutil.c

index a3d6609db3413a136b6d5415e3296e103f90a28a..36a6e8f5a409556505eaf0384742b073d69815f9 100644 (file)
@@ -1059,10 +1059,7 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
                                break;\r
                        };\r
 \r
-                       if(mifare_classic_halt(NULL, cuid)) {\r
-                               if (MF_DBGLEVEL >= 1)   Dbprintf("Halt error");\r
-                               break;\r
-                       };\r
+                       mifare_classic_halt(NULL, cuid);\r
                };\r
        \r
                // reset chip\r
@@ -1079,10 +1076,7 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
                                break;\r
                        };\r
 \r
-                       if(mifare_classic_halt(NULL, cuid)) {\r
-                               if (MF_DBGLEVEL >= 1)   Dbprintf("Halt error");\r
-                               break;\r
-                       };\r
+                       mifare_classic_halt(NULL, cuid);\r
                };      \r
 \r
                // write block\r
@@ -1115,10 +1109,7 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
                };      \r
        \r
                if (workFlags & 0x04) {\r
-                       if (mifare_classic_halt(NULL, cuid)) {\r
-                               if (MF_DBGLEVEL >= 1)   Dbprintf("Halt error");\r
-                               break;\r
-                       };\r
+                       mifare_classic_halt(NULL, cuid);\r
                }\r
                \r
                isOK = 1;\r
@@ -1192,10 +1183,7 @@ void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
                memcpy(data, receivedAnswer, 18);\r
                \r
                if (workFlags & 0x04) {\r
-                       if (mifare_classic_halt(NULL, cuid)) {\r
-                               if (MF_DBGLEVEL >= 1)   Dbprintf("Halt error");\r
-                               break;\r
-                       };\r
+                       mifare_classic_halt(NULL, cuid);\r
                }\r
                \r
                isOK = 1;\r
@@ -1222,6 +1210,7 @@ void MifareCIdent(){
        // card commands\r
        uint8_t wupC1[]       = { 0x40 }; \r
        uint8_t wupC2[]       = { 0x43 }; \r
+       uint8_t halt_ret          = 0;\r
        \r
        // variables\r
        byte_t isOK = 1;\r
@@ -1239,7 +1228,8 @@ void MifareCIdent(){
                isOK = 0;\r
        };\r
 \r
-       if (mifare_classic_halt(NULL, 0)) {\r
+       halt_ret = mifare_classic_halt(NULL, 0);\r
+       if (halt_ret && halt_ret != 4) {\r
                isOK = 0;\r
        };\r
 \r
index 8ef364c259f0d16216834a87dac9bef073be1e92..fb54c0254fd4c9925ec4ada57bd5333981a466d5 100644 (file)
@@ -511,7 +511,9 @@ int mifare_classic_halt(struct Crypto1State *pcs, uint32_t uid)
        len = mifare_sendcmd_short(pcs, pcs == NULL ? false:true, 0x50, 0x00, receivedAnswer, receivedAnswerPar, NULL);\r
        if (len != 0) {\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR)\r
-                       Dbprintf("halt error. response len: %x", len);  \r
+                       Dbprintf("halt error. response len: %x data:%02X %02X %02X %02X", len, receivedAnswer[0],receivedAnswer[1],receivedAnswer[2],receivedAnswer[3]);  \r
+               if (len == 1 && receivedAnswer[0]==0x04)\r
+                       return 4;\r
                return 1;\r
        }\r
 \r
Impressum, Datenschutz