]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
works
authormerlokk <olegmsn@gmail.com>
Tue, 2 Jan 2018 20:28:13 +0000 (22:28 +0200)
committermerlokk <olegmsn@gmail.com>
Tue, 2 Jan 2018 20:28:13 +0000 (22:28 +0200)
client/cmdhfmf.c
client/cmdhfmfhard.c
client/hardnested/hardnested_bf_core.c

index d9578af25768e8aa0e6e7b5d4a91101bb5ea1cd9..ed08917a57cccd06519a54a9e4f131ff31935227 100644 (file)
@@ -25,6 +25,7 @@
 #include "mifarehost.h"\r
 #include "mifare.h"\r
 #include "mfkey.h"\r
 #include "mifarehost.h"\r
 #include "mifare.h"\r
 #include "mfkey.h"\r
+#include "hardnested/hardnested_bf_core.h"\r
 \r
 #define NESTED_SECTOR_RETRY     10                     // how often we try mfested() until we give up\r
 \r
 \r
 #define NESTED_SECTOR_RETRY     10                     // how often we try mfested() until we give up\r
 \r
@@ -862,6 +863,13 @@ int CmdHF14AMfNestedHard(const char *Cmd)
                PrintAndLog("      w: Acquire nonces and write them to binary file nonces.bin");\r
                PrintAndLog("      s: Slower acquisition (required by some non standard cards)");\r
                PrintAndLog("      r: Read nonces.bin and start attack");\r
                PrintAndLog("      w: Acquire nonces and write them to binary file nonces.bin");\r
                PrintAndLog("      s: Slower acquisition (required by some non standard cards)");\r
                PrintAndLog("      r: Read nonces.bin and start attack");\r
+               PrintAndLog("      iX: set type of SIMD instructions. Without this flag programs autodetect it.");\r
+               PrintAndLog("        i5: AVX512");\r
+               PrintAndLog("        i2: AVX2");\r
+               PrintAndLog("        ia: AVX");\r
+               PrintAndLog("        is: SSE2");\r
+               PrintAndLog("        im: MMX");\r
+               PrintAndLog("        in: none (use CPU regular instruction set)");\r
                PrintAndLog(" ");\r
                PrintAndLog("      sample1: hf mf hardnested 0 A FFFFFFFFFFFF 4 A");\r
                PrintAndLog("      sample2: hf mf hardnested 0 A FFFFFFFFFFFF 4 A w");\r
                PrintAndLog(" ");\r
                PrintAndLog("      sample1: hf mf hardnested 0 A FFFFFFFFFFFF 4 A");\r
                PrintAndLog("      sample2: hf mf hardnested 0 A FFFFFFFFFFFF 4 A w");\r
@@ -880,15 +888,20 @@ int CmdHF14AMfNestedHard(const char *Cmd)
        int tests = 0;\r
 \r
 \r
        int tests = 0;\r
 \r
 \r
+       uint16_t iindx = 0;\r
        if (ctmp == 'R' || ctmp == 'r') {\r
                nonce_file_read = true;\r
        if (ctmp == 'R' || ctmp == 'r') {\r
                nonce_file_read = true;\r
+               iindx = 1;\r
                if (!param_gethex(Cmd, 1, trgkey, 12)) {\r
                        know_target_key = true;\r
                if (!param_gethex(Cmd, 1, trgkey, 12)) {\r
                        know_target_key = true;\r
+                       iindx = 2;\r
                }\r
        } else if (ctmp == 'T' || ctmp == 't') {\r
                tests = param_get32ex(Cmd, 1, 100, 10);\r
                }\r
        } else if (ctmp == 'T' || ctmp == 't') {\r
                tests = param_get32ex(Cmd, 1, 100, 10);\r
+               iindx = 2;\r
                if (!param_gethex(Cmd, 2, trgkey, 12)) {\r
                        know_target_key = true;\r
                if (!param_gethex(Cmd, 2, trgkey, 12)) {\r
                        know_target_key = true;\r
+                       iindx = 3;\r
                }\r
        } else {\r
                blockNo = param_get8(Cmd, 0);\r
                }\r
        } else {\r
                blockNo = param_get8(Cmd, 0);\r
@@ -922,19 +935,54 @@ int CmdHF14AMfNestedHard(const char *Cmd)
                        know_target_key = true;\r
                        i++;\r
                }\r
                        know_target_key = true;\r
                        i++;\r
                }\r
+               iindx = i;\r
 \r
                while ((ctmp = param_getchar(Cmd, i))) {\r
                        if (ctmp == 's' || ctmp == 'S') {\r
                                slow = true;\r
                        } else if (ctmp == 'w' || ctmp == 'W') {\r
                                nonce_file_write = true;\r
 \r
                while ((ctmp = param_getchar(Cmd, i))) {\r
                        if (ctmp == 's' || ctmp == 'S') {\r
                                slow = true;\r
                        } else if (ctmp == 'w' || ctmp == 'W') {\r
                                nonce_file_write = true;\r
+                       } else if (param_getlength(Cmd, i) == 2 && ctmp == 'i') {\r
+                               iindx = i;\r
                        } else {\r
                        } else {\r
-                               PrintAndLog("Possible options are w and/or s");\r
+                               PrintAndLog("Possible options are w , s and/or iX");\r
                                return 1;\r
                        }\r
                        i++;\r
                }\r
        }\r
                                return 1;\r
                        }\r
                        i++;\r
                }\r
        }\r
+       \r
+       SetSIMDInstr(SIMD_AUTO);\r
+       if (iindx > 0) {\r
+               while ((ctmp = param_getchar(Cmd, iindx))) {\r
+                       if (param_getlength(Cmd, iindx) == 2 && ctmp == 'i') {\r
+                               switch(param_getchar_indx(Cmd, 1, iindx)) {\r
+                                       case '5':\r
+                                               SetSIMDInstr(SIMD_AVX512);\r
+                                               break;\r
+                                       case '2':\r
+                                               SetSIMDInstr(SIMD_AVX2);\r
+                                               break;\r
+                                       case 'a':\r
+                                               SetSIMDInstr(SIMD_AVX);\r
+                                               break;\r
+                                       case 's':\r
+                                               SetSIMDInstr(SIMD_SSE2);\r
+                                               break;\r
+                                       case 'm':\r
+                                               SetSIMDInstr(SIMD_MMX);\r
+                                               break;\r
+                                       case 'n':\r
+                                               SetSIMDInstr(SIMD_NONE);\r
+                                               break;\r
+                                       default:\r
+                                               PrintAndLog("Unknown SIMD type. %c", param_getchar_indx(Cmd, 1, iindx));\r
+                                               return 1;\r
+                               }\r
+                       }\r
+                       iindx++;\r
+               }       \r
+       }\r
 \r
        PrintAndLog("--target block no:%3d, target key type:%c, known target key: 0x%02x%02x%02x%02x%02x%02x%s, file action: %s, Slow: %s, Tests: %d ",\r
                        trgBlockNo,\r
 \r
        PrintAndLog("--target block no:%3d, target key type:%c, known target key: 0x%02x%02x%02x%02x%02x%02x%s, file action: %s, Slow: %s, Tests: %d ",\r
                        trgBlockNo,\r
index 652a3cadbec88faa77f4fa476b84357e4146dd77..96c3a989f511f4bff60b07012e792099b86ff541 100644 (file)
@@ -2535,7 +2535,6 @@ int mfnestedhard(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBloc
 {
        char progress_text[80];
        
 {
        char progress_text[80];
        
-       SetSIMDInstr(SIMD_NONE);
        char instr_set[12] = {0};
        get_SIMD_instruction_set(instr_set);
        PrintAndLog("Using %s SIMD core.", instr_set);
        char instr_set[12] = {0};
        get_SIMD_instruction_set(instr_set);
        PrintAndLog("Using %s SIMD core.", instr_set);
index d716f7022408f4139642c17d2b08b3fcf703bb72..78384bbc8773e238bdb47be9bca22539d05b3501 100644 (file)
@@ -544,10 +544,17 @@ out:
 
 #ifndef __MMX__
 
 
 #ifndef __MMX__
 
+// pointers to functions:
+crack_states_bitsliced_t *crack_states_bitsliced_function_p = &crack_states_bitsliced_dispatch;
+bitslice_test_nonces_t *bitslice_test_nonces_function_p = &bitslice_test_nonces_dispatch;
+
 static SIMDExecInstr intSIMDInstr = SIMD_AUTO;
 
 void SetSIMDInstr(SIMDExecInstr instr) {
        intSIMDInstr = instr;
 static SIMDExecInstr intSIMDInstr = SIMD_AUTO;
 
 void SetSIMDInstr(SIMDExecInstr instr) {
        intSIMDInstr = instr;
+       
+       crack_states_bitsliced_function_p = &crack_states_bitsliced_dispatch;
+       bitslice_test_nonces_function_p = &bitslice_test_nonces_dispatch;
 }
 
 SIMDExecInstr GetSIMDInstr() {
 }
 
 SIMDExecInstr GetSIMDInstr() {
@@ -580,10 +587,6 @@ SIMDExecInstr GetSIMDInstrAuto() {
        return instr;
 }
 
        return instr;
 }
 
-// pointers to functions:
-crack_states_bitsliced_t *crack_states_bitsliced_function_p = &crack_states_bitsliced_dispatch;
-bitslice_test_nonces_t *bitslice_test_nonces_function_p = &bitslice_test_nonces_dispatch;
-
 // determine the available instruction set at runtime and call the correct function
 const uint64_t crack_states_bitsliced_dispatch(uint32_t cuid, uint8_t *best_first_bytes, statelist_t *p, uint32_t *keys_found, uint64_t *num_keys_tested, uint32_t nonces_to_bruteforce, uint8_t *bf_test_nonce_2nd_byte, noncelist_t *nonces) {
        switch(GetSIMDInstrAuto()) {
 // determine the available instruction set at runtime and call the correct function
 const uint64_t crack_states_bitsliced_dispatch(uint32_t cuid, uint8_t *best_first_bytes, statelist_t *p, uint32_t *keys_found, uint64_t *num_keys_tested, uint32_t nonces_to_bruteforce, uint8_t *bf_test_nonce_2nd_byte, noncelist_t *nonces) {
        switch(GetSIMDInstrAuto()) {
Impressum, Datenschutz