]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
Merge branch 'master' of https://github.com/Proxmark/proxmark3
authoriceman1001 <iceman@iuse.se>
Wed, 11 Mar 2015 21:21:01 +0000 (22:21 +0100)
committericeman1001 <iceman@iuse.se>
Wed, 11 Mar 2015 21:21:01 +0000 (22:21 +0100)
1  2 
armsrc/iso14443a.c

diff --combined armsrc/iso14443a.c
index fe5533e09440846f4ac254cf04e19282e403f06f,ac839cfdc081049ac8ceccaa784c41306158c04e..e7477789d287312fbf68ec4a417f4cbbfb7b01ee
@@@ -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];
        }
  
        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;
                                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;
                                                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;
                                        }
                                }
  
                                        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;
                                        }
        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
                                        );
                } 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
Impressum, Datenschutz