From: iceman1001 Date: Wed, 11 Mar 2015 21:21:01 +0000 (+0100) Subject: Merge branch 'master' of https://github.com/Proxmark/proxmark3 X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/96f39a47a98990dbe0ea35f15d9a764d188e1ead?hp=-c Merge branch 'master' of https://github.com/Proxmark/proxmark3 --- 96f39a47a98990dbe0ea35f15d9a764d188e1ead diff --combined armsrc/iso14443a.c index fe5533e0,ac839cfd..e7477789 --- a/armsrc/iso14443a.c +++ b/armsrc/iso14443a.c @@@ -1890,8 -1890,9 +1890,9 @@@ void ReaderIso14443a(UsbCommand *c { iso14a_command_t param = c->arg[0]; uint8_t *cmd = c->d.asBytes; - size_t len = c->arg[1]; - size_t lenbits = c->arg[2]; + size_t len = c->arg[1] & 0xffff; + size_t lenbits = c->arg[1] >> 16; + uint32_t timeout = c->arg[2]; uint32_t arg0 = 0; byte_t buf[USB_CMD_DATA_SIZE]; uint8_t par[MAX_PARITY_SIZE]; @@@ -1916,7 -1917,7 +1917,7 @@@ } if(param & ISO14A_SET_TIMEOUT) { - iso14a_set_timeout(c->arg[2]); + iso14a_set_timeout(timeout); } if(param & ISO14A_APDU) { @@@ -2301,6 -2302,8 +2302,6 @@@ void Mifare1ksim(uint8_t flags, uint8_ } if(cardSTATE == MFEMUL_NOFIELD) continue; - //Now, get data - res = EmGetCmd(receivedCmd, &len, receivedCmd_par); if (res == 2) { //Field is off! cardSTATE = MFEMUL_NOFIELD; @@@ -2371,7 -2374,7 +2372,7 @@@ uint32_t nr = bytes_to_num(&receivedCmd[4], 4); //Collect AR/NR - if(ar_nr_collected < 2){ + if(ar_nr_collected < 2 && cardAUTHSC == 2){ if(ar_nr_responses[2] != ar) {// Avoid duplicates... probably not necessary, ar should vary. ar_nr_responses[ar_nr_collected*4] = cuid; @@@ -2379,11 -2382,6 +2380,11 @@@ ar_nr_responses[ar_nr_collected*4+2] = ar; ar_nr_responses[ar_nr_collected*4+3] = nr; ar_nr_collected++; + } + // Interactive mode flag, means we need to send ACK + if(flags & FLAG_INTERACTIVE && ar_nr_collected == 2) + { + finished = true; } } @@@ -2531,7 -2529,7 +2532,7 @@@ mf_crypto1_encrypt(pcs, response, 18, response_par); EmSendCmdPar(response, 18, response_par); numReads++; - if(exitAfterNReads > 0 && numReads == exitAfterNReads) { + if(exitAfterNReads > 0 && numReads >= exitAfterNReads) { Dbprintf("%d reads done, exiting", numReads); finished = true; } @@@ -2651,12 -2649,12 +2652,12 @@@ if(flags & FLAG_INTERACTIVE)// Interactive mode flag, means we need to send ACK { //May just aswell send the collected ar_nr in the response aswell - cmd_send(CMD_ACK,CMD_SIMULATE_MIFARE_CARD,0,0,&ar_nr_responses,ar_nr_collected*4*4); + cmd_send(CMD_ACK,CMD_SIMULATE_MIFARE_CARD,1,0,&ar_nr_responses,ar_nr_collected*4*4); } - if(flags & FLAG_NR_AR_ATTACK) + if(flags & FLAG_NR_AR_ATTACK && MF_DBGLEVEL >= 1 ) { - if(ar_nr_collected > 1) { + if(ar_nr_collected > 1 ) { Dbprintf("Collected two pairs of AR/NR which can be used to extract keys from reader:"); Dbprintf("../tools/mfkey/mfkey32 %08x %08x %08x %08x %08x %08x", ar_nr_responses[0], // UID @@@ -2668,7 -2666,7 +2669,7 @@@ ); } else { Dbprintf("Failed to obtain two AR/NR pairs!"); - if(ar_nr_collected >0) { + if(ar_nr_collected > 0 ) { Dbprintf("Only got these: UID=%08x, nonce=%08x, AR1=%08x, NR1=%08x", ar_nr_responses[0], // UID ar_nr_responses[1], //NT