]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/iso14443a.c
Step 2 - Ultralight / Ultralight-C
[proxmark3-svn] / armsrc / iso14443a.c
index c2f809fee19ad706e54ee27043b6cd8c27adac56..2722ccb2ef04b62c41a3945a1a0be1d390f396ed 100644 (file)
@@ -1001,10 +1001,11 @@ void SimulateIso14443aTag(int tagType, int uid_1st, int uid_2nd, byte_t* data)
        }
        
        // The second response contains the (mandatory) first 24 bits of the UID
-       uint8_t response2[5];
+       uint8_t response2[5] = {0x00};
 
        // Check if the uid uses the (optional) part
-       uint8_t response2a[5];
+       uint8_t response2a[5] = {0x00};
+       
        if (uid_2nd) {
                response2[0] = 0x88;
                num_to_bytes(uid_1st,3,response2+1);
@@ -1025,12 +1026,12 @@ void SimulateIso14443aTag(int tagType, int uid_1st, int uid_2nd, byte_t* data)
        response2[4] = response2[0] ^ response2[1] ^ response2[2] ^ response2[3];
 
        // Prepare the mandatory SAK (for 4 and 7 byte UID)
-       uint8_t response3[3];
+       uint8_t response3[3]  = {0x00};
        response3[0] = sak;
        ComputeCrc14443(CRC_14443_A, response3, 1, &response3[1], &response3[2]);
 
        // Prepare the optional second SAK (for 7 byte UID), drop the cascade bit
-       uint8_t response3a[3];
+       uint8_t response3a[3]  = {0x00};
        response3a[0] = sak & 0xFB;
        ComputeCrc14443(CRC_14443_A, response3a, 1, &response3a[1], &response3a[2]);
 
@@ -1772,7 +1773,7 @@ int iso14443a_select_card(byte_t *uid_ptr, iso14a_card_select_t *p_hi14a_card, u
                                Dbprintf("Multiple tags detected. Collision after Bit %d", Demod.collisionPos);
                                for (uint16_t i = collision_answer_offset; i < Demod.collisionPos; i++, uid_resp_bits++) {      // add valid UID bits before collision point
                                        uint16_t UIDbit = (resp[i/8] >> (i % 8)) & 0x01;
-                                       uid_resp[uid_resp_bits & 0xf8] |= UIDbit << (uid_resp_bits % 8);
+                                       uid_resp[uid_resp_bits 8] |= UIDbit << (uid_resp_bits % 8);
                                }
                                uid_resp[uid_resp_bits/8] |= 1 << (uid_resp_bits % 8);                                  // next time select the card(s) with a 1 in the collision position
                                uid_resp_bits++;
@@ -1812,7 +1813,7 @@ int iso14443a_select_card(byte_t *uid_ptr, iso14a_card_select_t *p_hi14a_card, u
                if (!ReaderReceive(resp, resp_par)) return 0;
                sak = resp[0];
 
-               // Test if more parts of the uid are comming
+    // Test if more parts of the uid are coming
                if ((sak & 0x04) /* && uid_resp[0] == 0x88 */) {
                        // Remove first byte, 0x88 is not an UID byte, it CT, see page 3 of:
                        // http://www.nxp.com/documents/application_note/AN10927.pdf
Impressum, Datenschutz