]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/mifarecmd.c
Don't do iso14443-4 select for mifare emulations on processor cards (IDPrime, SmartMX...
[proxmark3-svn] / armsrc / mifarecmd.c
index 60a85c80117c571f14132084f915b9a745317e78..a3f0d374430ce9c9c7786f3853b76c7f017b5441 100644 (file)
@@ -59,7 +59,7 @@ void MifareReadBlock(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
        LED_C_OFF();\r
 \r
        while (true) {\r
        LED_C_OFF();\r
 \r
        while (true) {\r
-               if(!iso14443a_select_card(uid, NULL, &cuid, true, 0)) {\r
+               if(!iso14443a_select_card(uid, NULL, &cuid, true, 0, true)) {\r
                        if (MF_DBGLEVEL >= 1)   Dbprintf("Can't select card");\r
                        break;\r
                };\r
                        if (MF_DBGLEVEL >= 1)   Dbprintf("Can't select card");\r
                        break;\r
                };\r
@@ -106,7 +106,7 @@ void MifareUC_Auth(uint8_t arg0, uint8_t *keybytes){
 \r
        clear_trace();\r
 \r
 \r
        clear_trace();\r
 \r
-       if(!iso14443a_select_card(NULL, NULL, NULL, true, 0)) {\r
+       if(!iso14443a_select_card(NULL, NULL, NULL, true, 0, true)) {\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Can't select card");\r
                OnError(0);\r
                return;\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Can't select card");\r
                OnError(0);\r
                return;\r
@@ -141,7 +141,7 @@ void MifareUReadBlock(uint8_t arg0, uint8_t arg1, uint8_t *datain)
 \r
        clear_trace();\r
 \r
 \r
        clear_trace();\r
 \r
-       int len = iso14443a_select_card(NULL, NULL, NULL, true, 0);\r
+       int len = iso14443a_select_card(NULL, NULL, NULL, true, 0, true);\r
        if(!len) {\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Can't select card (RC:%02X)",len);\r
                OnError(1);\r
        if(!len) {\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Can't select card (RC:%02X)",len);\r
                OnError(1);\r
@@ -217,7 +217,7 @@ void MifareReadSector(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
        LED_C_OFF();\r
 \r
        isOK = 1;\r
        LED_C_OFF();\r
 \r
        isOK = 1;\r
-       if(!iso14443a_select_card(uid, NULL, &cuid, true, 0)) {\r
+       if(!iso14443a_select_card(uid, NULL, &cuid, true, 0, true)) {\r
                isOK = 0;\r
                if (MF_DBGLEVEL >= 1)   Dbprintf("Can't select card");\r
        }\r
                isOK = 0;\r
                if (MF_DBGLEVEL >= 1)   Dbprintf("Can't select card");\r
        }\r
@@ -281,7 +281,7 @@ void MifareUReadCard(uint8_t arg0, uint16_t arg1, uint8_t arg2, uint8_t *datain)
                return;\r
        }\r
 \r
                return;\r
        }\r
 \r
-       int len = iso14443a_select_card(NULL, NULL, NULL, true, 0);\r
+       int len = iso14443a_select_card(NULL, NULL, NULL, true, 0, true);\r
        if (!len) {\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Can't select card (RC:%d)",len);\r
                OnError(1);\r
        if (!len) {\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Can't select card (RC:%d)",len);\r
                OnError(1);\r
@@ -383,7 +383,7 @@ void MifareWriteBlock(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
        LED_C_OFF();\r
 \r
        while (true) {\r
        LED_C_OFF();\r
 \r
        while (true) {\r
-                       if(!iso14443a_select_card(uid, NULL, &cuid, true, 0)) {\r
+                       if(!iso14443a_select_card(uid, NULL, &cuid, true, 0, true)) {\r
                        if (MF_DBGLEVEL >= 1)   Dbprintf("Can't select card");\r
                        break;\r
                };\r
                        if (MF_DBGLEVEL >= 1)   Dbprintf("Can't select card");\r
                        break;\r
                };\r
@@ -483,7 +483,7 @@ void MifareUWriteBlock(uint8_t arg0, uint8_t arg1, uint8_t *datain)
 \r
        clear_trace();\r
 \r
 \r
        clear_trace();\r
 \r
-       if(!iso14443a_select_card(NULL, NULL, NULL, true, 0)) {\r
+       if(!iso14443a_select_card(NULL, NULL, NULL, true, 0, true)) {\r
                if (MF_DBGLEVEL >= 1) Dbprintf("Can't select card");\r
                OnError(0);\r
                return;\r
                if (MF_DBGLEVEL >= 1) Dbprintf("Can't select card");\r
                OnError(0);\r
                return;\r
@@ -542,7 +542,7 @@ void MifareUSetPwd(uint8_t arg0, uint8_t *datain){
 \r
        clear_trace();\r
 \r
 \r
        clear_trace();\r
 \r
-       if(!iso14443a_select_card(NULL, NULL, NULL, true, 0)) {\r
+       if(!iso14443a_select_card(NULL, NULL, NULL, true, 0, true)) {\r
                if (MF_DBGLEVEL >= 1) Dbprintf("Can't select card");\r
                OnError(0);\r
                return;\r
                if (MF_DBGLEVEL >= 1) Dbprintf("Can't select card");\r
                OnError(0);\r
                return;\r
@@ -662,7 +662,7 @@ void MifareAcquireEncryptedNonces(uint32_t arg0, uint32_t arg1, uint32_t flags,
 \r
                if (!have_uid) { // need a full select cycle to get the uid first\r
                        iso14a_card_select_t card_info;\r
 \r
                if (!have_uid) { // need a full select cycle to get the uid first\r
                        iso14a_card_select_t card_info;\r
-                       if(!iso14443a_select_card(uid, &card_info, &cuid, true, 0)) {\r
+                       if(!iso14443a_select_card(uid, &card_info, &cuid, true, 0, true)) {\r
                                if (MF_DBGLEVEL >= 1)   Dbprintf("AcquireNonces: Can't select card (ALL)");\r
                                continue;\r
                        }\r
                                if (MF_DBGLEVEL >= 1)   Dbprintf("AcquireNonces: Can't select card (ALL)");\r
                                continue;\r
                        }\r
@@ -674,7 +674,7 @@ void MifareAcquireEncryptedNonces(uint32_t arg0, uint32_t arg1, uint32_t flags,
                        }\r
                        have_uid = true;\r
                } else { // no need for anticollision. We can directly select the card\r
                        }\r
                        have_uid = true;\r
                } else { // no need for anticollision. We can directly select the card\r
-                       if(!iso14443a_select_card(uid, NULL, NULL, false, cascade_levels)) {\r
+                       if(!iso14443a_select_card(uid, NULL, NULL, false, cascade_levels, true)) {\r
                                if (MF_DBGLEVEL >= 1)   Dbprintf("AcquireNonces: Can't select card (UID)");\r
                                continue;\r
                        }\r
                                if (MF_DBGLEVEL >= 1)   Dbprintf("AcquireNonces: Can't select card (UID)");\r
                                continue;\r
                        }\r
@@ -807,7 +807,7 @@ void MifareNested(uint32_t arg0, uint32_t arg1, uint32_t calibrate, uint8_t *dat
                                continue;\r
                        }\r
 \r
                                continue;\r
                        }\r
 \r
-                       if(!iso14443a_select_card(uid, NULL, &cuid, true, 0)) {\r
+                       if(!iso14443a_select_card(uid, NULL, &cuid, true, 0, true)) {\r
                                if (MF_DBGLEVEL >= 1)   Dbprintf("Nested: Can't select card");\r
                                rtr--;\r
                                continue;\r
                                if (MF_DBGLEVEL >= 1)   Dbprintf("Nested: Can't select card");\r
                                rtr--;\r
                                continue;\r
@@ -881,7 +881,7 @@ void MifareNested(uint32_t arg0, uint32_t arg1, uint32_t calibrate, uint8_t *dat
                                continue;\r
                        }\r
 \r
                                continue;\r
                        }\r
 \r
-                       if(!iso14443a_select_card(uid, NULL, &cuid, true, 0)) {\r
+                       if(!iso14443a_select_card(uid, NULL, &cuid, true, 0, true)) {\r
                                if (MF_DBGLEVEL >= 1)   Dbprintf("Nested: Can't select card");\r
                                continue;\r
                        };\r
                                if (MF_DBGLEVEL >= 1)   Dbprintf("Nested: Can't select card");\r
                                continue;\r
                        };\r
@@ -1000,7 +1000,7 @@ void MifareChkKeys(uint16_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
                // Iceman: use piwi's faster nonce collecting part in hardnested.\r
                if (!have_uid) { // need a full select cycle to get the uid first\r
                        iso14a_card_select_t card_info;\r
                // Iceman: use piwi's faster nonce collecting part in hardnested.\r
                if (!have_uid) { // need a full select cycle to get the uid first\r
                        iso14a_card_select_t card_info;\r
-                       if(!iso14443a_select_card(uid, &card_info, &cuid, true, 0)) {\r
+                       if(!iso14443a_select_card(uid, &card_info, &cuid, true, 0, true)) {\r
                                if (OLD_MF_DBGLEVEL >= 1)       Dbprintf("ChkKeys: Can't select card");\r
                                --i; // try same key once again\r
                                continue;\r
                                if (OLD_MF_DBGLEVEL >= 1)       Dbprintf("ChkKeys: Can't select card");\r
                                --i; // try same key once again\r
                                continue;\r
@@ -1013,7 +1013,7 @@ void MifareChkKeys(uint16_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
                        }\r
                        have_uid = true;\r
                } else { // no need for anticollision. We can directly select the card\r
                        }\r
                        have_uid = true;\r
                } else { // no need for anticollision. We can directly select the card\r
-                       if(!iso14443a_select_card(uid, NULL, NULL, false, cascade_levels)) {\r
+                       if(!iso14443a_select_card(uid, NULL, NULL, false, cascade_levels, true)) {\r
                                if (OLD_MF_DBGLEVEL >= 1)       Dbprintf("ChkKeys: Can't select card (UID)");\r
                                --i; // try same key once again\r
                                continue;\r
                                if (OLD_MF_DBGLEVEL >= 1)       Dbprintf("ChkKeys: Can't select card (UID)");\r
                                --i; // try same key once again\r
                                continue;\r
@@ -1111,7 +1111,7 @@ void MifareECardLoad(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
 \r
        bool isOK = true;\r
 \r
 \r
        bool isOK = true;\r
 \r
-       if(!iso14443a_select_card(uid, NULL, &cuid, true, 0)) {\r
+       if(!iso14443a_select_card(uid, NULL, &cuid, true, 0, true)) {\r
                isOK = false;\r
                if (MF_DBGLEVEL >= 1)   Dbprintf("Can't select card");\r
        }\r
                isOK = false;\r
                if (MF_DBGLEVEL >= 1)   Dbprintf("Can't select card");\r
        }\r
@@ -1349,7 +1349,7 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
 \r
                // get UID from chip\r
                if (workFlags & 0x01) {\r
 \r
                // get UID from chip\r
                if (workFlags & 0x01) {\r
-                       if(!iso14443a_select_card(uid, NULL, &cuid, true, 0)) {\r
+                       if(!iso14443a_select_card(uid, NULL, &cuid, true, 0, true)) {\r
                                if (MF_DBGLEVEL >= 1)   Dbprintf("Can't select card");\r
                                // Continue, if we set wrong UID or wrong UID checksum or some ATQA or SAK we will can't select card. But we need to write block 0 to make card work.\r
                                //break;\r
                                if (MF_DBGLEVEL >= 1)   Dbprintf("Can't select card");\r
                                // Continue, if we set wrong UID or wrong UID checksum or some ATQA or SAK we will can't select card. But we need to write block 0 to make card work.\r
                                //break;\r
@@ -1573,7 +1573,7 @@ void Mifare_DES_Auth1(uint8_t arg0, uint8_t *datain){
        iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);\r
        clear_trace();\r
 \r
        iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);\r
        clear_trace();\r
 \r
-       int len = iso14443a_select_card(uid, NULL, &cuid, true, 0);\r
+       int len = iso14443a_select_card(uid, NULL, &cuid, true, 0, true);\r
        if(!len) {\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Can't select card");\r
                OnError(1);\r
        if(!len) {\r
                if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Can't select card");\r
                OnError(1);\r
Impressum, Datenschutz