From: douniwan5788 Date: Thu, 21 Apr 2016 07:50:26 +0000 (+0800) Subject: add support for a new kind Magic Chinese UID changable Mifare Classic card X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/13b71e58fddf20c5d42b8f0af1d72c795139b86f add support for a new kind Magic Chinese UID changable Mifare Classic card --- diff --git a/armsrc/mifarecmd.c b/armsrc/mifarecmd.c index a3d6609d..36a6e8f5 100644 --- a/armsrc/mifarecmd.c +++ b/armsrc/mifarecmd.c @@ -1059,10 +1059,7 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai break; }; - if(mifare_classic_halt(NULL, cuid)) { - if (MF_DBGLEVEL >= 1) Dbprintf("Halt error"); - break; - }; + mifare_classic_halt(NULL, cuid); }; // reset chip @@ -1079,10 +1076,7 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai break; }; - if(mifare_classic_halt(NULL, cuid)) { - if (MF_DBGLEVEL >= 1) Dbprintf("Halt error"); - break; - }; + mifare_classic_halt(NULL, cuid); }; // write block @@ -1115,10 +1109,7 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai }; if (workFlags & 0x04) { - if (mifare_classic_halt(NULL, cuid)) { - if (MF_DBGLEVEL >= 1) Dbprintf("Halt error"); - break; - }; + mifare_classic_halt(NULL, cuid); } isOK = 1; @@ -1192,10 +1183,7 @@ void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai memcpy(data, receivedAnswer, 18); if (workFlags & 0x04) { - if (mifare_classic_halt(NULL, cuid)) { - if (MF_DBGLEVEL >= 1) Dbprintf("Halt error"); - break; - }; + mifare_classic_halt(NULL, cuid); } isOK = 1; @@ -1222,6 +1210,7 @@ void MifareCIdent(){ // card commands uint8_t wupC1[] = { 0x40 }; uint8_t wupC2[] = { 0x43 }; + uint8_t halt_ret = 0; // variables byte_t isOK = 1; @@ -1239,7 +1228,8 @@ void MifareCIdent(){ isOK = 0; }; - if (mifare_classic_halt(NULL, 0)) { + halt_ret = mifare_classic_halt(NULL, 0); + if (halt_ret && halt_ret != 4) { isOK = 0; }; diff --git a/armsrc/mifareutil.c b/armsrc/mifareutil.c index 8ef364c2..fb54c025 100644 --- a/armsrc/mifareutil.c +++ b/armsrc/mifareutil.c @@ -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); if (len != 0) { if (MF_DBGLEVEL >= MF_DBG_ERROR) - Dbprintf("halt error. response len: %x", len); + Dbprintf("halt error. response len: %x data:%02X %02X %02X %02X", len, receivedAnswer[0],receivedAnswer[1],receivedAnswer[2],receivedAnswer[3]); + if (len == 1 && receivedAnswer[0]==0x04) + return 4; return 1; }