]> cvs.zerfleddert.de Git - proxmark3-svn/commitdiff
minor fix when reading blocks
authorroel@libnfc.org <roel@libnfc.org@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Mon, 17 Dec 2012 13:21:53 +0000 (13:21 +0000)
committerroel@libnfc.org <roel@libnfc.org@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Mon, 17 Dec 2012 13:21:53 +0000 (13:21 +0000)
armsrc/hitag2.c

index 05ac1f5e8e0a81258d4919c89a7ddd2f43795ddc..a2c1d82323ab7a65abb1f830a201926d5143cea5 100644 (file)
@@ -531,12 +531,17 @@ bool hitag2_crypto(byte_t* rx, const size_t rxlen, byte_t* tx, size_t* txlen) {
         } else {
           // Failed reading a block, could be (read/write) locked, skip block and re-authenticate
           if (blocknr == 1) {
         } else {
           // Failed reading a block, could be (read/write) locked, skip block and re-authenticate
           if (blocknr == 1) {
+            // Write the low part of the key in memory
             memcpy(tag.sectors[1],key+2,4);
           } else if (blocknr == 2) {
             memcpy(tag.sectors[1],key+2,4);
           } else if (blocknr == 2) {
+            // Write the high part of the key in memory
             tag.sectors[2][0] = 0x00;
             tag.sectors[2][1] = 0x00;
             tag.sectors[2][2] = key[0];
             tag.sectors[2][3] = key[1];
             tag.sectors[2][0] = 0x00;
             tag.sectors[2][1] = 0x00;
             tag.sectors[2][2] = key[0];
             tag.sectors[2][3] = key[1];
+          } else {
+            // Just put zero's in the memory (of the unreadable block)
+            memset(tag.sectors[blocknr],0x00,4);
           }
           blocknr++;
           bCrypto = false;
           }
           blocknr++;
           bCrypto = false;
Impressum, Datenschutz