]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhfmf.c
Nested loop fix for static nonces
[proxmark3-svn] / client / cmdhfmf.c
index 9ecf99fbe831c1b51061921f25188e153e409e7e..2fe747057ee7a2fad1a1ac65a76bcf90f9f8057a 100644 (file)
@@ -707,17 +707,17 @@ int CmdHF14AMfNested(const char *Cmd)
        if (cmdp == 'o') { // ------------------------------------  one sector working\r
                PrintAndLog("--target block no:%3d, target key type:%c ", trgBlockNo, trgKeyType?'B':'A');\r
                int16_t isOK = mfnested(blockNo, keyType, key, trgBlockNo, trgKeyType, keyBlock, true);\r
-               if (isOK) {\r
+               if (isOK < 0) {\r
                        switch (isOK) {\r
                                case -1 : PrintAndLog("Error: No response from Proxmark.\n"); break;\r
                                case -2 : PrintAndLog("Button pressed. Aborted.\n"); break;\r
                                case -3 : PrintAndLog("Tag isn't vulnerable to Nested Attack (random numbers are not predictable).\n"); break;\r
-                               default : PrintAndLog("Unknown Error.\n");\r
+                               default : PrintAndLog("Unknown Error (%d)\n", isOK);\r
                        }\r
                        return 2;\r
                }\r
                key64 = bytes_to_num(keyBlock, 6);\r
-               if (key64) {\r
+               if (!isOK) {\r
                        PrintAndLog("Found valid key:%012" PRIx64, key64);\r
 \r
                        // transfer key to the emulator\r
@@ -792,12 +792,12 @@ int CmdHF14AMfNested(const char *Cmd)
                                        if (e_sector[sectorNo].foundKey[trgKeyType]) continue;\r
                                        PrintAndLog("-----------------------------------------------");\r
                                        int16_t isOK = mfnested(blockNo, keyType, key, FirstBlockOfSector(sectorNo), trgKeyType, keyBlock, calibrate);\r
-                                       if(isOK) {\r
+                                       if(isOK < 0) {\r
                                                switch (isOK) {\r
                                                        case -1 : PrintAndLog("Error: No response from Proxmark.\n"); break;\r
                                                        case -2 : PrintAndLog("Button pressed. Aborted.\n"); break;\r
                                                        case -3 : PrintAndLog("Tag isn't vulnerable to Nested Attack (random numbers are not predictable).\n"); break;\r
-                                                       default : PrintAndLog("Unknown Error.\n");\r
+                                                       default : PrintAndLog("Unknown Error (%d)\n", isOK);\r
                                                }\r
                                                free(e_sector);\r
                                                return 2;\r
@@ -808,7 +808,7 @@ int CmdHF14AMfNested(const char *Cmd)
                                        iterations++;\r
 \r
                                        key64 = bytes_to_num(keyBlock, 6);\r
-                                       if (key64) {\r
+                                       if (!isOK) {\r
                                                PrintAndLog("Found valid key:%012" PRIx64, key64);\r
                                                e_sector[sectorNo].foundKey[trgKeyType] = 1;\r
                                                e_sector[sectorNo].Key[trgKeyType] = key64;\r
Impressum, Datenschutz