]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/iso14443a.c
CHG: moved some from THUMB to ARM.. Looks like usb communication became bad.
[proxmark3-svn] / armsrc / iso14443a.c
index 4bd55fb3b75d77681120a6d4c4b3150731aa63c6..81e45960fea652f2e331d9dda035487efcb5d1ec 100644 (file)
@@ -1866,6 +1866,9 @@ int iso14443a_select_card(byte_t *uid_ptr, iso14a_card_select_t *p_hi14a_card, u
                        memset(uid_ptr,0,10);
        }
 
                        memset(uid_ptr,0,10);
        }
 
+       // reset the PCB block number
+       iso14_pcb_blocknum = 0;
+       
        // check for proprietary anticollision:
        if ((resp[0] & 0x1F) == 0) return 3;
        
        // check for proprietary anticollision:
        if ((resp[0] & 0x1F) == 0) return 3;
        
@@ -1977,12 +1980,8 @@ int iso14443a_select_card(byte_t *uid_ptr, iso14a_card_select_t *p_hi14a_card, u
                p_hi14a_card->ats_len = len;
        }
 
                p_hi14a_card->ats_len = len;
        }
 
-       // reset the PCB block number
-       iso14_pcb_blocknum = 0;
-
        // set default timeout based on ATS
        iso14a_set_ATS_timeout(resp);
        // set default timeout based on ATS
        iso14a_set_ATS_timeout(resp);
-
        return 1;       
 }
 
        return 1;       
 }
 
@@ -2086,17 +2085,17 @@ void ReaderIso14443a(UsbCommand *c) {
        }
 
        if (param & ISO14A_RAW) {
        }
 
        if (param & ISO14A_RAW) {
-               if(param & ISO14A_APPEND_CRC) {
-                       if(param & ISO14A_TOPAZMODE) {
+               if (param & ISO14A_APPEND_CRC) {
+                       if (param & ISO14A_TOPAZMODE)
                                AppendCrc14443b(cmd,len);
                                AppendCrc14443b(cmd,len);
-                       } else {
+                       else
                                AppendCrc14443a(cmd,len);
                                AppendCrc14443a(cmd,len);
-                       }
+                       
                        len += 2;
                        if (lenbits) lenbits += 16;
                }
                        len += 2;
                        if (lenbits) lenbits += 16;
                }
-               if(lenbits>0) {                         // want to send a specific number of bits (e.g. short commands)
-                       if(param & ISO14A_TOPAZMODE) {
+               if (lenbits>0) {                                // want to send a specific number of bits (e.g. short commands)
+                       if (param & ISO14A_TOPAZMODE) {
                                int bits_to_send = lenbits;
                                uint16_t i = 0;
                                ReaderTransmitBitsPar(&cmd[i++], MIN(bits_to_send, 7), NULL, NULL);             // first byte is always short (7bits) and no parity
                                int bits_to_send = lenbits;
                                uint16_t i = 0;
                                ReaderTransmitBitsPar(&cmd[i++], MIN(bits_to_send, 7), NULL, NULL);             // first byte is always short (7bits) and no parity
@@ -2110,7 +2109,7 @@ void ReaderIso14443a(UsbCommand *c) {
                                ReaderTransmitBitsPar(cmd, lenbits, par, NULL);                                                 // bytes are 8 bit with odd parity
                        }
                } else {                                        // want to send complete bytes only
                                ReaderTransmitBitsPar(cmd, lenbits, par, NULL);                                                 // bytes are 8 bit with odd parity
                        }
                } else {                                        // want to send complete bytes only
-                       if(param & ISO14A_TOPAZMODE) {
+                       if (param & ISO14A_TOPAZMODE) {
                                uint16_t i = 0;
                                ReaderTransmitBitsPar(&cmd[i++], 7, NULL, NULL);                                                // first byte: 7 bits, no paritiy
                                while (i < len) {
                                uint16_t i = 0;
                                ReaderTransmitBitsPar(&cmd[i++], 7, NULL, NULL);                                                // first byte: 7 bits, no paritiy
                                while (i < len) {
@@ -2216,14 +2215,14 @@ void ReaderMifare(bool first_try, uint8_t block, uint8_t keytype ) {
        
        BigBuf_free(); BigBuf_Clear_ext(false); 
        clear_trace();
        
        BigBuf_free(); BigBuf_Clear_ext(false); 
        clear_trace();
-       set_tracing(TRUE);      
+       set_tracing(FALSE);     
        iso14443a_setup(FPGA_HF_ISO14443A_READER_MOD);
 
        sync_time = GetCountSspClk() & 0xfffffff8;
        sync_cycles = PRNG_SEQUENCE_LENGTH; // Mifare Classic's random generator repeats every 2^16 cycles (and so do the nonces).              
        nt_attacked = 0;
        
        iso14443a_setup(FPGA_HF_ISO14443A_READER_MOD);
 
        sync_time = GetCountSspClk() & 0xfffffff8;
        sync_cycles = PRNG_SEQUENCE_LENGTH; // Mifare Classic's random generator repeats every 2^16 cycles (and so do the nonces).              
        nt_attacked = 0;
        
-   if (MF_DBGLEVEL >= 4)       Dbprintf("Mifare::Sync %08x", sync_time);
+   if (MF_DBGLEVEL >= 4)       Dbprintf("Mifare::Sync %u", sync_time);
                                
        if (first_try) {
                mf_nr_ar3 = 0;
                                
        if (first_try) {
                mf_nr_ar3 = 0;
Impressum, Datenschutz