added check reader/tag
authormerlokk <olegmsn@gmail.com>
Fri, 9 Feb 2018 17:40:39 +0000 (19:40 +0200)
committermerlokk <olegmsn@gmail.com>
Fri, 9 Feb 2018 17:40:39 +0000 (19:40 +0200)
client/cmdhflist.c

index a91df26a94eab361afd9c399154900fa00a11bc8..065cbde2b861f84fb36138397a51b273a1bfe934 100644 (file)
@@ -184,8 +184,8 @@ void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, bool
 
        switch(MifareAuthState) {
                case masNt:
-                       if (cmdsize == 4) {
-                               snprintf(exp,size,"AUTH: nt %s", (MifareAuthState == masData) ? "(enc)" : "");
+                       if (cmdsize == 4 && isResponse) {
+                               snprintf(exp,size,"AUTH: nt %s", (nt) ? "(enc)" : "");
                                MifareAuthState = masNrAr;
                                nt = bytes_to_num(cmd, cmdsize);
                                return;
@@ -194,7 +194,7 @@ void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, bool
                        }
                        break;
                case masNrAr:
-                       if (cmdsize == 8) {
+                       if (cmdsize == 8 && !isResponse) {
                                snprintf(exp,size,"AUTH: nr ar (enc)");
                                MifareAuthState = masAt;
                                nr_enc = bytes_to_num(cmd, cmdsize);
@@ -205,7 +205,7 @@ void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, bool
                        }
                        break;
                case masAt:
-                       if (cmdsize == 4) {
+                       if (cmdsize == 4 && isResponse) {
                                snprintf(exp,size,"AUTH: at (enc)");
                                MifareAuthState = masData;
                                at_enc = bytes_to_num(cmd, cmdsize);
Impressum, Datenschutz