- // 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 (OLD_MF_DBGLEVEL >= 1) Dbprintf("ChkKeys: Can't select card");\r
- --i; // try same key once again\r
- continue;\r
- }\r
- switch (card_info.uidlen) {\r
- case 4 : cascade_levels = 1; break;\r
- case 7 : cascade_levels = 2; break;\r
- case 10: cascade_levels = 3; break;\r
- default: break;\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 (OLD_MF_DBGLEVEL >= 1) Dbprintf("ChkKeys: Can't select card (UID)");\r
- --i; // try same key once again\r
- continue;\r
- }\r
+ if (multisectorCheck) {\r
+ TKeyIndex keyIndex = {{0}};\r
+ uint8_t sectorCnt = blockNo;\r
+ int res = MifareMultisectorChk(datain, keyCount, sectorCnt, keyType, OLD_MF_DBGLEVEL, &keyIndex);\r
+\r
+ if (res >= 0) {\r
+ cmd_send(CMD_ACK, 1, 0, 0, keyIndex, 80);\r
+ } else {\r
+ cmd_send(CMD_ACK, 0, 0, 0, NULL, 0);\r
+ }\r
+ } else { \r
+ int res = MifareChkBlockKeys(datain, keyCount, blockNo, keyType, OLD_MF_DBGLEVEL);\r
+ \r
+ if (res > 0) {\r
+ cmd_send(CMD_ACK, 1, 0, 0, datain + (res - 1) * 6, 6);\r
+ } else {\r
+ cmd_send(CMD_ACK, 0, 0, 0, NULL, 0);\r