]> cvs.zerfleddert.de Git - proxmark3-svn/commitdiff
CHG: Syntax suger
authoriceman1001 <iceman@iuse.se>
Mon, 25 Jan 2016 19:19:15 +0000 (20:19 +0100)
committericeman1001 <iceman@iuse.se>
Mon, 25 Jan 2016 19:19:15 +0000 (20:19 +0100)
armsrc/legicrf.c
armsrc/mifarecmd.c
armsrc/mifaresniff.c

index d9c94106e2f0fec21deede3e6d23fcd0e04455ad..5ad1fdf1f0c31895328f089847186405c2fec2cd 100644 (file)
@@ -276,10 +276,10 @@ static void frame_receive_rwd(struct legic_frame * const f, int bits, int crypt)
 
 static void frame_append_bit(struct legic_frame * const f, int bit)
 {
-   if(f->bits >= 31)
+   if (f->bits >= 31)
        return; /* Overflow, won't happen */
   
-   f->data |= (bit<<f->bits);
+   f->data |= (bit << f->bits);
    f->bits++;
 }
 
@@ -354,9 +354,11 @@ int legic_read_byte(int byte_index, int cmd_sz) {
        frame_receive_rwd(&current_frame, 12, 1);
 
        byte = current_frame.data & 0xff;
+
        if( LegicCRC(byte_index, byte, cmd_sz) != (current_frame.data >> 8) ) {
                Dbprintf("!!! crc mismatch: expected %x but got %x !!!", 
-           LegicCRC(byte_index, current_frame.data & 0xff, cmd_sz), current_frame.data >> 8);
+                       LegicCRC(byte_index, current_frame.data & 0xff, cmd_sz),
+                       current_frame.data >> 8);
                return -1;
        }
 
@@ -372,9 +374,8 @@ int legic_read_byte(int byte_index, int cmd_sz) {
  */
 int legic_write_byte(int byte, int addr, int addr_sz) {
     //do not write UID, CRC, DCF
-    if(addr <= 0x06) { 
+    if(addr <= 0x06)
                return 0;
-       }
 
        //== send write command ==============================
        crc_clear(&legic_crc);
index a3ce6acf9595b6b7f9135503a8debb650f10f9b6..7fa3f525decc2960d933447563e5eea2e8a61e6e 100644 (file)
@@ -996,32 +996,26 @@ void MifareChkKeys(uint16_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
        \r
        set_tracing(TRUE);\r
 \r
-       for (i = 0; i < keyCount; i++) {\r
-               if(mifare_classic_halt(pcs, cuid)) {\r
+       for (i = 0; i < keyCount; ++i) {\r
+               if (mifare_classic_halt(pcs, cuid))\r
                        if (MF_DBGLEVEL >= 1)   Dbprintf("ChkKeys: Halt error");\r
-               }\r
 \r
-               if(!iso14443a_select_card(uid, NULL, &cuid, true, 0)) {\r
+               if (!iso14443a_select_card(uid, NULL, &cuid, true, 0)) {\r
                        if (OLD_MF_DBGLEVEL >= 1)       Dbprintf("ChkKeys: Can't select card");\r
                        break;\r
-               };\r
+               }\r
 \r
                ui64Key = bytes_to_num(datain + i * 6, 6);\r
-               if(mifare_classic_auth(pcs, cuid, blockNo, keyType, ui64Key, AUTH_FIRST)) {\r
+               if (mifare_classic_auth(pcs, cuid, blockNo, keyType, ui64Key, AUTH_FIRST))\r
                        continue;\r
-               };\r
                \r
                isOK = 1;\r
                break;\r
        }\r
-       \r
-       //  ----------------------------- crypto1 destroy\r
        crypto1_destroy(pcs);\r
        \r
        LED_B_ON();\r
     cmd_send(CMD_ACK,isOK,0,0,datain + i * 6,6);\r
-       LED_B_OFF();\r
-\r
        FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);\r
        LEDsoff();\r
        set_tracing(FALSE);\r
index 3194f8d8c06a6510b4090db369b78a23c07a2ea2..fe57f42969ca3be8fa50d1fe9877077c8506e170 100644 (file)
 \r
 static int sniffState = SNF_INIT;\r
 static uint8_t sniffUIDType;\r
-static uint8_t sniffUID[8] = {0x00};\r
-static uint8_t sniffATQA[2] = {0x00};\r
+static uint8_t sniffUID[8];\r
+static uint8_t sniffATQA[2];\r
 static uint8_t sniffSAK;\r
-static uint8_t sniffBuf[16] = {0x00};\r
-static uint32_t timerData = 0;\r
+static uint8_t sniffBuf[16];\r
+static uint32_t timerData;\r
 \r
 \r
 bool MfSniffInit(void){\r
Impressum, Datenschutz