X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/7504dc50d539f1f9b0b99064f5c7d38e373890fa..547595784facfc9565ca08af18d9bead6bfac31b:/armsrc/mifarecmd.c diff --git a/armsrc/mifarecmd.c b/armsrc/mifarecmd.c index ad8655db..c68a50e5 100644 --- a/armsrc/mifarecmd.c +++ b/armsrc/mifarecmd.c @@ -944,7 +944,7 @@ void MifareNested(uint32_t arg0, uint32_t arg1, uint32_t calibrate, uint8_t *dat crypto1_destroy(pcs); byte_t buf[4 + 4 * 4] = {0}; - num_to_bytes(cuid, 4, buf); + memcpy(buf, &cuid, 4); memcpy(buf+4, &target_nt[0], 4); memcpy(buf+8, &target_ks[0], 4); memcpy(buf+12, &target_nt[1], 4); @@ -998,8 +998,6 @@ void MifareChkKeys(uint16_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain) set_tracing(TRUE); for (i = 0; i < keyCount; ++i) { - if (mifare_classic_halt(pcs, cuid)) - if (MF_DBGLEVEL >= 1) Dbprintf("ChkKeys: Halt error"); if (!iso14443a_select_card(uid, NULL, &cuid, true, 0)) { if (OLD_MF_DBGLEVEL >= 1) Dbprintf("ChkKeys: Can't select card"); @@ -1007,19 +1005,23 @@ void MifareChkKeys(uint16_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain) } ui64Key = bytes_to_num(datain + i * 6, 6); - if (mifare_classic_auth(pcs, cuid, blockNo, keyType, ui64Key, AUTH_FIRST)) + if (mifare_classic_auth(pcs, cuid, blockNo, keyType, ui64Key, AUTH_FIRST)) { + if (mifare_classic_halt(pcs, cuid)) + if (MF_DBGLEVEL >= 1) Dbprintf("ChkKeys: Halt error"); continue; + } isOK = 1; break; } - crypto1_destroy(pcs); LED_B_ON(); cmd_send(CMD_ACK,isOK,0,0,datain + i * 6,6); + FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); LEDsoff(); set_tracing(FALSE); + crypto1_destroy(pcs); // restore debug level MF_DBGLEVEL = OLD_MF_DBGLEVEL; @@ -1320,10 +1322,9 @@ void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain){ memcpy(data, receivedAnswer, sizeof(data)); // send HALT - if (workFlags & MAGIC_HALT) { + if (workFlags & MAGIC_HALT) mifare_classic_halt_ex(NULL); - break; - } + isOK = true; break; }