]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
fix Mifare AUTH for hi14areader command
authoradam@algroup.co.uk <adam@algroup.co.uk@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Mon, 24 Aug 2009 12:09:43 +0000 (12:09 +0000)
committeradam@algroup.co.uk <adam@algroup.co.uk@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Mon, 24 Aug 2009 12:09:43 +0000 (12:09 +0000)
armsrc/iso14443a.c

index c5557d394ef1cb2e9f2c6fd00fd3004b1dd1e438..6cd217f122ea7da79d13301843dad420090f1915 100644 (file)
@@ -914,8 +914,6 @@ static const BYTE response2a[] = { 0x51, 0x48, 0x1d, 0x80, 0x84 }; //  uid - cas
 BYTE response3a[] = { 0x20, 0x00, 0x00 }; // SAK Select (cascade2) successful response (DESFire)\r
 ComputeCrc14443(CRC_14443_A, response3a, 1, &response3a[1], &response3a[2]);\r
 \r
-// When reader tries to authenticate\r
-       // static const BYTE cmd5[] = { 0x60, 0x00, 0xf5, 0x7b };\r
     static const BYTE response5[] = { 0x00, 0x00, 0x00, 0x00 }; // Very random tag nonce\r
 \r
     BYTE *resp;\r
@@ -1503,6 +1501,9 @@ void ReaderIso14443a(DWORD parameter)
        //BYTE cmd6[] = { 0xe0,0x50,0xbc,0xa5 };  // original RATS\r
        BYTE cmd6[] = { 0xe0,0x21,0xb2,0xc7 };  // Desfire RATS\r
 \r
+       // Mifare AUTH\r
+       BYTE cmd7[] = { 0x60, 0x00, 0x00, 0x00 };\r
+\r
        int reqaddr = 2024;                                     // was 2024 - tied to other size changes\r
        int reqsize = 60;\r
 \r
@@ -1525,8 +1526,8 @@ void ReaderIso14443a(DWORD parameter)
     BYTE *req6 = (((BYTE *)BigBuf) + reqaddr + (reqsize * 5));\r
     int req6Len;\r
 \r
-       //BYTE *req7 = (((BYTE *)BigBuf) + reqaddr + (reqsize * 6));\r
-       //int req7Len;\r
+    BYTE *req7 = (((BYTE *)BigBuf) + reqaddr + (reqsize * 6));\r
+    int req7Len;\r
 \r
        BYTE *receivedAnswer = (((BYTE *)BigBuf) + 3560);       // was 3560 - tied to other size changes\r
 \r
@@ -1771,13 +1772,15 @@ void ReaderIso14443a(DWORD parameter)
                }\r
 \r
                // Secondly compute the two CRC bytes at the end\r
-               ComputeCrc14443(CRC_14443_A, cmd5, 2, &cmd5[2], &cmd5[3]);\r
+               ComputeCrc14443(CRC_14443_A, cmd7, 2, &cmd7[2], &cmd7[3]);\r
+               CodeIso14443aAsReader(cmd7, sizeof(cmd7));\r
+               memcpy(req7, ToSend, ToSendMax); req7Len = ToSendMax;\r
                // Send authentication request (Mifare Classic)\r
-               TransmitFor14443a(req5, req5Len, &samples, &wait);\r
+               TransmitFor14443a(req7, req7Len, &samples, &wait);\r
                trace[traceLen++] = 0; trace[traceLen++] = 0; trace[traceLen++] = 0; trace[traceLen++] = 0;\r
                trace[traceLen++] = 0; trace[traceLen++] = 0; trace[traceLen++] = 0; trace[traceLen++] = 0;\r
                trace[traceLen++] = 4;\r
-               memcpy(trace+traceLen, cmd5, 4);\r
+               memcpy(trace+traceLen, cmd7, 4);\r
                traceLen += 4;\r
                if(traceLen > TRACE_LENGTH) goto done;\r
                if(GetIso14443aAnswerFromTag(receivedAnswer, 100, &samples, &elapsed)) {\r
@@ -1808,9 +1811,7 @@ void ReaderIso14443a(DWORD parameter)
        }\r
 \r
 done:\r
-       LED_A_OFF();\r
-       LED_B_OFF();\r
-       LED_C_OFF();\r
+       LEDsoff();\r
        DbpIntegers(rsamples, 0xCC, 0xCC);\r
        DbpString("ready..");\r
 }\r
Impressum, Datenschutz