]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/iclass.c
Merge pull request #131 from holiman/master
[proxmark3-svn] / armsrc / iclass.c
index 7b4daa36bb3b6541e5b77fffbceb84189639ce02..97c62bb60daf7c4d3367f1a49a5bdd9f7c001468 100644 (file)
@@ -1125,7 +1125,6 @@ int doIClassSimulation( int simulationMode, uint8_t *reader_mac_buf)
        int resp_cc_len;
 
        uint8_t *receivedCmd = BigBuf_malloc(MAX_FRAME_SIZE);
-       memset(receivedCmd, 0x44, MAX_FRAME_SIZE);
        int len;
 
        // Prepare card messages
@@ -1336,7 +1335,6 @@ int doIClassSimulation( int simulationMode, uint8_t *reader_mac_buf)
                        }
 
                }
-               memset(receivedCmd, 0x44, MAX_FRAME_SIZE);
        }
 
        //Dbprintf("%x", cmdsRecvd);
@@ -1675,8 +1673,9 @@ uint8_t handshakeIclassTag(uint8_t *card_data)
 // Reader iClass Anticollission
 void ReaderIClass(uint8_t arg0) {
 
-       uint8_t card_data[6 * 8]={0xFF};
-    uint8_t last_csn[8]={0};
+       uint8_t card_data[6 * 8]={0};
+       memset(card_data, 0xFF, sizeof(card_data));
+       uint8_t last_csn[8]={0};
        
        //Read conf block CRC(0x01) => 0xfa 0x22
        uint8_t readConf[] = { ICLASS_CMD_READ_OR_IDENTIFY,0x01, 0xfa, 0x22};
@@ -1684,16 +1683,18 @@ void ReaderIClass(uint8_t arg0) {
        uint8_t readAA[] = { ICLASS_CMD_READ_OR_IDENTIFY,0x05, 0xde, 0x64};
 
 
-    int read_status= 0;
+       int read_status= 0;
        uint8_t result_status = 0;
-    bool abort_after_read = arg0 & FLAG_ICLASS_READER_ONLY_ONCE;
-
+       bool abort_after_read = arg0 & FLAG_ICLASS_READER_ONLY_ONCE;
+       bool try_once = arg0 & FLAG_ICLASS_READER_ONE_TRY;
        set_tracing(TRUE);
-    setupIclassReader();
+       setupIclassReader();
 
+       uint16_t tryCnt=0;
        while(!BUTTON_PRESS())
-    {
-
+       {
+               if (try_once && tryCnt > 5) break; 
+               tryCnt++;
                if(!tracing) {
                        DbpString("Trace full");
                        break;
@@ -1760,7 +1761,7 @@ void ReaderIClass(uint8_t arg0) {
 
                }
                LED_B_OFF();
-    }
+       }
     cmd_send(CMD_ACK,0,0,0,card_data, 0);
     LED_A_OFF();
 }
Impressum, Datenschutz