]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
ADD: There were lot of calls to enable tracing, but very few to turn it of afterwar...
authoriceman1001 <iceman@iuse.se>
Sun, 11 Oct 2015 17:14:17 +0000 (19:14 +0200)
committericeman1001 <iceman@iuse.se>
Sun, 11 Oct 2015 17:14:17 +0000 (19:14 +0200)
Don't know if it has some influence but can't hurt calling  "set_tracing(FALSE);"  when method returns.

armsrc/hitag2.c
armsrc/iclass.c
armsrc/iso14443a.c
armsrc/iso14443b.c
armsrc/iso15693.c
armsrc/mifarecmd.c
armsrc/mifaredesfire.c
client/cmdmain.c

index 7cc6b96434667d95b91d6a0508040808b5f14c26..02dff46e5f9e4285e74f2ad45a5d425d06987cfe 100644 (file)
@@ -907,7 +907,7 @@ void SnoopHitag(uint32_t type) {
     AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKDIS;
        FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
     LED_A_OFF();
-       
+       set_tracing(TRUE);
 //     Dbprintf("frame received: %d",frame_count);
 //     Dbprintf("Authentication Attempts: %d",(auth_table_len/8));
 //     DbpString("All done");
@@ -1096,7 +1096,7 @@ void SimulateHitagTag(bool tag_mem_supplied, byte_t* data) {
        FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
        
        DbpString("Sim Stopped");
-       
+       set_tracing(TRUE);
 }
 
 void ReaderHitag(hitag_function htf, hitag_data* htd) {
@@ -1168,6 +1168,7 @@ void ReaderHitag(hitag_function htf, hitag_data* htd) {
                        
                default: {
                        Dbprintf("Error, unknown function: %d",htf);
+                       set_tracing(FALSE);
                        return;
                } break;
        }
@@ -1217,26 +1218,27 @@ void ReaderHitag(hitag_function htf, hitag_data* htd) {
        lastbit = 1;
        bStop = false;
 
-  // Tag specific configuration settings (sof, timings, etc.)
-  if (htf < 10){
-    // hitagS settings
-    reset_sof = 1;
-    t_wait = 200;
-    DbpString("Configured for hitagS reader");
-  } else if (htf < 20) {
-    // hitag1 settings
-    reset_sof = 1;
-    t_wait = 200;
-    DbpString("Configured for hitag1 reader");
-  } else if (htf < 30) {
-    // hitag2 settings
-    reset_sof = 4;
-    t_wait = HITAG_T_WAIT_2;
-    DbpString("Configured for hitag2 reader");
+       // Tag specific configuration settings (sof, timings, etc.)
+       if (htf < 10){
+               // hitagS settings
+               reset_sof = 1;
+               t_wait = 200;
+               DbpString("Configured for hitagS reader");
+       } else if (htf < 20) {
+               // hitag1 settings
+               reset_sof = 1;
+               t_wait = 200;
+               DbpString("Configured for hitag1 reader");
+       } else if (htf < 30) {
+               // hitag2 settings
+               reset_sof = 4;
+               t_wait = HITAG_T_WAIT_2;
+               DbpString("Configured for hitag2 reader");
        } else {
-    Dbprintf("Error, unknown hitag reader type: %d",htf);
-    return;
-  }
+               Dbprintf("Error, unknown hitag reader type: %d",htf);
+               set_tracing(FALSE);     
+               return;
+       }
                
        while(!bStop && !BUTTON_PRESS()) {
                // Watchdog hit
@@ -1274,6 +1276,7 @@ void ReaderHitag(hitag_function htf, hitag_data* htd) {
                        } break;
                        default: {
                                Dbprintf("Error, unknown function: %d",htf);
+                               set_tracing(FALSE);
                                return;
                        } break;
                }
@@ -1381,7 +1384,7 @@ void ReaderHitag(hitag_function htf, hitag_data* htd) {
        AT91C_BASE_TC1->TC_CCR = AT91C_TC_CLKDIS;
        AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKDIS;
        FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
-       Dbprintf("frame received: %d",frame_count);
-  DbpString("All done");
-  cmd_send(CMD_ACK,bSuccessful,0,0,(byte_t*)tag.sectors,48);
-}
+       Dbprintf("DONE: frame received: %d",frame_count);
+       cmd_send(CMD_ACK,bSuccessful,0,0,(byte_t*)tag.sectors,48);
+       set_tracing(FALSE);
+}
\ No newline at end of file
index 9046d51b29ee18486a88f08c68e8e3fb8d2b2d0a..38ccf5a444c9b1e2d56a6af4fbea4067f2da3819 100644 (file)
@@ -816,6 +816,7 @@ done:
     LED_B_OFF();
     LED_C_OFF();
     LED_D_OFF();
+       set_tracing(FALSE);     
 }
 
 void rotateCSN(uint8_t* originalCSN, uint8_t* rotatedCSN) {
@@ -1040,7 +1041,7 @@ void SimulateIClass(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain
                Dbprintf("The mode is not implemented, reserved for future use");
        }
        Dbprintf("Done...");
-
+       set_tracing(FALSE);     
 }
 void AppendCrc(uint8_t* data, int len)
 {
@@ -1760,17 +1761,18 @@ void ReaderIClass(uint8_t arg0) {
                                cmd_send(CMD_ACK,result_status,0,0,card_data,sizeof(card_data));
                                if(abort_after_read) {
                                        LED_A_OFF();
+                                       set_tracing(FALSE);     
                                        return;
                                }
-                    //Save that we already sent this....
-                        memcpy(last_csn, card_data, 8);
+                               //Save that we already sent this....
+                               memcpy(last_csn, card_data, 8);
                        }
-
                }
                LED_B_OFF();
     }
     cmd_send(CMD_ACK,0,0,0,card_data, 0);
     LED_A_OFF();
+       set_tracing(FALSE);             
 }
 
 void ReaderIClass_Replay(uint8_t arg0, uint8_t *MAC) {
@@ -1818,20 +1820,20 @@ void ReaderIClass_Replay(uint8_t arg0, uint8_t *MAC) {
                uint8_t read_status = handshakeIclassTag(card_data);
                if(read_status < 2) continue;
 
-                               //for now replay captured auth (as cc not updated)
-                               memcpy(check+5,MAC,4);
+               //for now replay captured auth (as cc not updated)
+               memcpy(check+5,MAC,4);
 
                if(!sendCmdGetResponseWithRetries(check, sizeof(check),resp, 4, 5))
                {
-                                 Dbprintf("Error: Authentication Fail!");
+                       Dbprintf("Error: Authentication Fail!");
                        continue;
-                               }
+               }
 
                //first get configuration block (block 1)
                crc = block_crc_LUT[1];
-                               read[1]=1;
-                               read[2] = crc >> 8;
-                               read[3] = crc & 0xff;
+               read[1]=1;
+               read[2] = crc >> 8;
+               read[3] = crc & 0xff;
 
                if(!sendCmdGetResponseWithRetries(read, sizeof(read),resp, 10, 10))
                {
@@ -1839,12 +1841,12 @@ void ReaderIClass_Replay(uint8_t arg0, uint8_t *MAC) {
                        continue;
                }
 
-                                        mem=resp[5];
-                                        memory.k16= (mem & 0x80);
-                                        memory.book= (mem & 0x20);
-                                        memory.k2= (mem & 0x8);
-                                        memory.lockauth= (mem & 0x2);
-                                        memory.keyaccess= (mem & 0x1);
+                mem=resp[5];
+                memory.k16= (mem & 0x80);
+                memory.book= (mem & 0x20);
+                memory.k2= (mem & 0x8);
+                memory.lockauth= (mem & 0x2);
+                memory.keyaccess= (mem & 0x1);
 
                cardsize = memory.k16 ? 255 : 32;
                WDT_HIT();
@@ -1857,15 +1859,15 @@ void ReaderIClass_Replay(uint8_t arg0, uint8_t *MAC) {
 
                        read[1]= block;
                        crc = block_crc_LUT[block];
-                                   read[2] = crc >> 8;
-                                   read[3] = crc & 0xff;
+                       read[2] = crc >> 8;
+                       read[3] = crc & 0xff;
 
                        if(sendCmdGetResponseWithRetries(read, sizeof(read), resp, 10, 10))
                        {
-                                        Dbprintf("     %02x: %02x %02x %02x %02x %02x %02x %02x %02x",
-                                                block, resp[0], resp[1], resp[2],
-                                         resp[3], resp[4], resp[5],
-                                         resp[6], resp[7]);
+                               Dbprintf("     %02x: %02x %02x %02x %02x %02x %02x %02x %02x",
+                                       block, resp[0], resp[1], resp[2],
+                                       resp[3], resp[4], resp[5],
+                                       resp[6], resp[7]);
 
                                //Fill up the buffer
                                memcpy(card_data+stored_data_length,resp,8);
@@ -1881,8 +1883,7 @@ void ReaderIClass_Replay(uint8_t arg0, uint8_t *MAC) {
                                        stored_data_length = 0;
                                        failedRead = 0;
                                }
-
-                       }else{
+                       } else {
                                failedRead = 1;
                                stored_data_length +=8;//Otherwise, data becomes misaligned
                                Dbprintf("Failed to dump block %d", block);
@@ -1909,6 +1910,7 @@ void ReaderIClass_Replay(uint8_t arg0, uint8_t *MAC) {
                         card_data, 0);
 
        LED_A_OFF();
+       set_tracing(FALSE);             
 }
 
 void iClass_ReadCheck(uint8_t  blockNo, uint8_t keyType) {
index 492e2d6dc13598db95d213f76fa59aa5f5864047..22ada94f8ec9b876356d4398a3cb84413e6e3919 100644 (file)
@@ -718,6 +718,8 @@ void RAMFUNC SniffIso14443a(uint8_t param) {
 
        Dbprintf("maxDataLen=%d, Uart.state=%x, Uart.len=%d", maxDataLen, Uart.state, Uart.len);
        Dbprintf("traceLen=%d, Uart.output[0]=%08x", BigBuf_get_traceLen(), (uint32_t)Uart.output[0]);
+       
+       set_tracing(FALSE);     
 }
 
 //-----------------------------------------------------------------------------
@@ -1415,13 +1417,14 @@ void SimulateIso14443aTag(int tagType, int flags, byte_t* data)
        }
 
        FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
+       set_tracing(FALSE);
        BigBuf_free_keep_EM();
        LED_A_OFF();
        
        if (MF_DBGLEVEL >= 4){
-       Dbprintf("-[ Wake ups after halt [%d]", happened);
-       Dbprintf("-[ Messages after halt [%d]", happened2);
-       Dbprintf("-[ Num of received cmd [%d]", cmdsRecvd);
+               Dbprintf("-[ Wake ups after halt [%d]", happened);
+               Dbprintf("-[ Messages after halt [%d]", happened2);
+               Dbprintf("-[ Num of received cmd [%d]", cmdsRecvd);
        }
 }
 
@@ -2180,6 +2183,7 @@ void ReaderIso14443a(UsbCommand *c)
        }
 
        FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
+       set_tracing(FALSE);
        LEDsoff();
 }
 
@@ -3029,6 +3033,8 @@ void Mifare1ksim(uint8_t flags, uint8_t exitAfterNReads, uint8_t arg2, uint8_t *
                }
        }
        if (MF_DBGLEVEL >= 1)   Dbprintf("Emulator stopped. Tracing: %d  trace length: %d ", tracing, BigBuf_get_traceLen());
+       
+       set_tracing(FALSE);
 }
 
 
@@ -3187,4 +3193,5 @@ void RAMFUNC SniffMifare(uint8_t param) {
        MfSniffEnd();
        LEDsoff();
        Dbprintf("maxDataLen=%x, Uart.state=%x, Uart.len=%x", maxDataLen, Uart.state, Uart.len);
+       set_tracing(FALSE);
 }
index 0ea66a8d7079c65637d5a1e27154e075291dc8d5..0b9962e1e5cf5ffe727051163ede8e9a4c0d6aad 100644 (file)
@@ -479,6 +479,7 @@ void SimulateIso14443bTag(void)
                if (tracing) LogTrace(resp, respLen, 0, 0, parity, FALSE);                      
        }
        FpgaDisableSscDma();
+       set_tracing(FALSE);     
 }
 
 //=============================================================================
@@ -1058,6 +1059,7 @@ void ReadSTMemoryIso14443b(uint32_t dwLast)
 
        if (Demod.len == 0) {
                DbpString("No response from tag");
+               set_tracing(FALSE);     
                return;
        } else {
                Dbprintf("Randomly generated Chip ID (+ 2 byte CRC): %02x %02x %02x",
@@ -1073,17 +1075,20 @@ void ReadSTMemoryIso14443b(uint32_t dwLast)
        GetSamplesFor14443bDemod(RECEIVE_SAMPLES_TIMEOUT, TRUE);
        if (Demod.len != 3) {
                Dbprintf("Expected 3 bytes from tag, got %d", Demod.len);
+               set_tracing(FALSE);     
                return;
        }
        // Check the CRC of the answer:
        ComputeCrc14443(CRC_14443_B, Demod.output, 1 , &cmd1[2], &cmd1[3]);
        if(cmd1[2] != Demod.output[1] || cmd1[3] != Demod.output[2]) {
                DbpString("CRC Error reading select response.");
+               set_tracing(FALSE);     
                return;
        }
        // Check response from the tag: should be the same UID as the command we just sent:
        if (cmd1[1] != Demod.output[0]) {
                Dbprintf("Bad response to SELECT from Tag, aborting: %02x %02x", cmd1[1], Demod.output[0]);
+               set_tracing(FALSE);     
                return;
        }
 
@@ -1095,6 +1100,7 @@ void ReadSTMemoryIso14443b(uint32_t dwLast)
        GetSamplesFor14443bDemod(RECEIVE_SAMPLES_TIMEOUT, TRUE);
        if (Demod.len != 10) {
                Dbprintf("Expected 10 bytes from tag, got %d", Demod.len);
+               set_tracing(FALSE);     
                return;
        }
        // The check the CRC of the answer (use cmd1 as temporary variable):
@@ -1142,6 +1148,8 @@ void ReadSTMemoryIso14443b(uint32_t dwLast)
                }
                i++;
        }
+       
+       set_tracing(FALSE);
 }
 
 
@@ -1290,11 +1298,12 @@ void RAMFUNC SnoopIso14443b(void)
                }
                        TagIsActive = (Demod.state > DEMOD_GOT_FALLING_EDGE_OF_SOF);
                }
-
        }
 
        FpgaDisableSscDma();
        LEDsoff();
+       set_tracing(FALSE);     
+               
        AT91C_BASE_PDC_SSC->PDC_PTCR = AT91C_PDC_RXTDIS;
        DbpString("Snoop statistics:");
        Dbprintf("  Max behind by: %i", maxBehindBy);
@@ -1337,6 +1346,7 @@ void SendRawCommand14443B(uint32_t datalen, uint32_t recv, uint8_t powerfield, u
        if(!powerfield) {
                FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
                FpgaDisableSscDma();
+               set_tracing(FALSE);
                LED_D_OFF();
        }
 }
index aa4a57fc5aa43d4eda3679a0f72667a28da701eb..928439aa1bd46e1afd19f204db782aa50059fffd 100644 (file)
@@ -689,8 +689,8 @@ void RecordRawAdcSamplesIso15693(void)
        FpgaSetupSsc();
 
        // Start from off (no field generated)
-       FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
-       SpinDelay(200);
+       FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
+       SpinDelay(200);
 
        SetAdcMuxFor(GPIO_MUXSEL_HIPKD);
 
@@ -1022,8 +1022,8 @@ void ReaderIso15693(uint32_t parameter)
        FpgaSetupSsc();
 
        // Start from off (no field generated)
-       FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
-       SpinDelay(200);
+       FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
+       SpinDelay(200);
 
        // Give the tags time to energize
        FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);
@@ -1124,7 +1124,7 @@ void SimTagIso15693(uint32_t parameter, uint8_t *uid)
        FpgaSetupSsc();
 
        // Start from off (no field generated)
-       FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
+    FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
        SpinDelay(200);
 
        LED_A_OFF();
index f63d754d1a46a51e035338aeb2800b45e42a867a..0b75ebc3fb9543229463102b28bef0f4a81ad00f 100644 (file)
@@ -723,7 +723,6 @@ void MifareNested(uint32_t arg0, uint32_t arg1, uint32_t calibrate, uint8_t *dat
                dmax = davg + 2;\r
                \r
                LED_B_OFF();\r
-       \r
        }\r
 //  -------------------------------------------------------------------------------------------------  \r
        \r
@@ -815,6 +814,7 @@ void MifareNested(uint32_t arg0, uint32_t arg1, uint32_t calibrate, uint8_t *dat
 \r
        FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);\r
        LEDsoff();\r
+       set_tracing(FALSE);\r
 }\r
 \r
 //-----------------------------------------------------------------------------\r
@@ -879,7 +879,8 @@ void MifareChkKeys(uint16_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
 \r
        FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);\r
        LEDsoff();\r
-\r
+       set_tracing(FALSE);\r
+       \r
        // restore debug level\r
        MF_DBGLEVEL = OLD_MF_DBGLEVEL;  \r
 }\r
@@ -946,7 +947,7 @@ void MifareECardLoad(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
        iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);\r
        \r
        clear_trace();\r
-       set_tracing(false);\r
+       set_tracing(TRUE);\r
        \r
        bool isOK = true;\r
 \r
@@ -1002,6 +1003,7 @@ void MifareECardLoad(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
        \r
        if (MF_DBGLEVEL >= 2) DbpString("EMUL FILL SECTORS FINISHED");\r
 \r
+       set_tracing(FALSE);\r
 }\r
 \r
 \r
@@ -1128,6 +1130,7 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
        if ((workFlags & 0x10) || (!isOK)) {\r
                FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);\r
                LEDsoff();\r
+               set_tracing(FALSE);\r
        }\r
 }\r
 \r
@@ -1210,6 +1213,7 @@ void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
        if ((workFlags & 0x10) || (!isOK)) {\r
                FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);\r
                LEDsoff();\r
+               set_tracing(FALSE);\r
        }\r
 }\r
 \r
@@ -1261,11 +1265,10 @@ void MifareCollectNonces(uint32_t arg0, uint32_t arg1){
        LED_B_OFF();\r
        LED_C_OFF();\r
        \r
-iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);\r
+       iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);\r
        clear_trace();\r
        set_tracing(TRUE);\r
-       \r
-       \r
+               \r
        for (int i = 0; i < iterations; i++) {\r
                                                \r
                WDT_HIT();\r
@@ -1308,6 +1311,7 @@ iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
        }\r
        FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);\r
        LEDsoff();\r
+       set_tracing(FALSE);\r
 }\r
 \r
 //\r
index 4d68bf5fc9a7e6ddf32d6a6064362d4eb6e458dc..b1e035f9a7ca2ea2fea1153682b2e3524c46e632 100644 (file)
@@ -494,6 +494,7 @@ void OnSuccess(){
        ReaderTransmit(deselect_cmd, 3 , NULL);
        FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
        LEDsoff();
+       set_tracing(FALSE);     
 }
 
 void OnError(uint8_t reason){
@@ -503,4 +504,5 @@ void OnError(uint8_t reason){
        FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
        cmd_send(CMD_ACK,0,reason,0,0,0);
        LEDsoff();
+       set_tracing(FALSE);     
 }
index b0e1b2ef07c618b7029a475cbac1b4e2bdcc7dd9..d31147f91531d7a4c633a6d6e4e77e7f570b2231 100644 (file)
@@ -204,9 +204,10 @@ void UsbCommandReceived(UsbCommand *UC)
                        return;
                } break;
 
-               default:
-       storeCommand(UC);
+               default: {
+                       storeCommand(UC);
                        break;
+               }
        }
 
 }
Impressum, Datenschutz