]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
Merge pull request #560 from pwpiwi/fix_hfmfmif
authorIceman <iceman@iuse.se>
Tue, 6 Feb 2018 07:15:03 +0000 (08:15 +0100)
committerGitHub <noreply@github.com>
Tue, 6 Feb 2018 07:15:03 +0000 (08:15 +0100)
fix: prevent hf mf mifare from always running twice

1  2 
client/mifarehost.c

diff --combined client/mifarehost.c
index dd656ee1f24253677c4d1b5199db28203e784a33,b6eb60f000d61281d9d88d656ae455acf4acca25..a01d3b5f0485bf43b6b0087bc40a81b357edf9de
@@@ -178,12 -178,14 +178,14 @@@ int mfDarkside(uint64_t *key
                        continue;\r
                }\r
  \r
-               qsort(keylist, keycount, sizeof(*keylist), compare_uint64);\r
-               keycount = intersection(last_keylist, keylist);\r
-               if (keycount == 0) {\r
-                       free(last_keylist);\r
-                       last_keylist = keylist;\r
-                       continue;\r
+               if (par_list == 0) {\r
+                       qsort(keylist, keycount, sizeof(*keylist), compare_uint64);\r
+                       keycount = intersection(last_keylist, keylist);\r
+                       if (keycount == 0) {\r
+                               free(last_keylist);\r
+                               last_keylist = keylist;\r
+                               continue;\r
+                       }\r
                }\r
  \r
                if (keycount > 1) {\r
                for (int i = 0; i < keycount; i += max_keys) {\r
                        int size = keycount - i > max_keys ? max_keys : keycount - i;\r
                        for (int j = 0; j < size; j++) {\r
-                               if (last_keylist == NULL) {\r
-                                       num_to_bytes(keylist[i*max_keys + j], 6, keyBlock);\r
-                               } else {\r
+                               if (par_list == 0) {\r
                                        num_to_bytes(last_keylist[i*max_keys + j], 6, keyBlock);\r
+                               } else {\r
+                                       num_to_bytes(keylist[i*max_keys + j], 6, keyBlock);\r
                                }\r
                        }\r
                        if (!mfCheckKeys(0, 0, false, size, keyBlock, key)) {\r
@@@ -295,13 -297,7 +297,13 @@@ typede
  \r
  \r
  // wrapper function for multi-threaded lfsr_recovery32\r
 -void* nested_worker_thread(void *arg)\r
 +void\r
 +#ifdef __has_attribute\r
 +#if __has_attribute(force_align_arg_pointer)\r
 +__attribute__((force_align_arg_pointer)) \r
 +#endif\r
 +#endif\r
 +*nested_worker_thread(void *arg)\r
  {\r
        struct Crypto1State *p1;\r
        StateList_t *statelist = arg;\r
        return statelist->head.slhead;\r
  }\r
  \r
 +\r
  int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *resultKey, bool calibrate)\r
  {\r
        uint16_t i;\r
Impressum, Datenschutz