added get parity
authorOleg Moiseenko <olegmsn@gmail.com>
Sat, 10 Feb 2018 17:19:56 +0000 (19:19 +0200)
committerOleg Moiseenko <olegmsn@gmail.com>
Sat, 10 Feb 2018 17:19:56 +0000 (19:19 +0200)
client/cmdhf.c
client/cmdhflist.c
client/cmdhflist.h

index 2557607b35e320217c0a0afde98d679cb671862a..3256b69a9e77b24eac2bb216f1d30a8b714fc1c7 100644 (file)
@@ -400,7 +400,7 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
        EndOfTransmissionTimestamp = timestamp + duration;
 
        if (protocol == PROTO_MIFARE)
-               annotateMifare(explanation, sizeof(explanation), frame, data_len, isResponse);
+               annotateMifare(explanation, sizeof(explanation), frame, data_len, parityBytes, parity_len, isResponse);
        
        if(!isResponse)
        {
@@ -430,6 +430,9 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
                                (j == num_lines-1) ? explanation : "");
                }
        }
+       
+//     if (DecodeMifareData(frame, data_len, isResponse)) {
+//     };
 
        if (is_last_record(tracepos, trace, traceLen)) return traceLen;
        
index 8e7b7f6e486a844750fcce52b8d49c4e143e108d..5ff3192b0caec2840f749d96e876f957b8ed4a4c 100644 (file)
@@ -186,7 +186,7 @@ void annotateIso14443a(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize)
        return;
 }
 
-void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, bool isResponse) {
+void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, uint8_t* parity, uint8_t paritysize, bool isResponse) {
        // get UID
        if (MifareAuthState == masNone) {
                if (cmdsize == 7 && cmd[0] == ISO14443A_CMD_ANTICOLL_OR_SELECT && cmd[1] == 0x70) {
@@ -208,6 +208,7 @@ void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, bool
                                        AuthData.nt = bytes_to_num(cmd, cmdsize);
                                else
                                        AuthData.nt_enc = bytes_to_num(cmd, cmdsize);
+                                       AuthData.nt_enc_par = parity[0];
                                return;
                        } else {
                                MifareAuthState = masError;
@@ -219,6 +220,7 @@ void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, bool
                                MifareAuthState = masAt;
                                AuthData.nr_enc = bytes_to_num(cmd, cmdsize);
                                AuthData.ar_enc = bytes_to_num(&cmd[3], cmdsize);
+                               AuthData.ar_enc_par = parity[0] << 4;
                                return;
                        } else {
                                MifareAuthState = masError;
@@ -229,6 +231,7 @@ void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, bool
                                snprintf(exp,size,"AUTH: at (enc)");
                                MifareAuthState = masFirstData;
                                AuthData.at_enc = bytes_to_num(cmd, cmdsize);
+                               AuthData.at_enc_par = parity[0];
                                return;
                        } else {
                                MifareAuthState = masError;
index 6ec2f6fc273e85bacdad0bf6a29bba013e62cfdf..329df7dbb91e7705acab218525745d1184535106 100644 (file)
@@ -31,7 +31,7 @@ extern void ClearAuthData();
 extern uint8_t iso14443A_CRC_check(bool isResponse, uint8_t* data, uint8_t len);
 extern uint8_t mifare_CRC_check(bool isResponse, uint8_t* data, uint8_t len);
 extern void annotateIso14443a(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize);
-extern void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, bool isResponse);
+extern void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, uint8_t* parity, uint8_t paritysize, bool isResponse);
 
 
 #endif // CMDHFLIST
Impressum, Datenschutz