diff --git a/include/modules.h b/include/modules.h index 56113fa57..c8e453d77 100644 --- a/include/modules.h +++ b/include/modules.h @@ -57,6 +57,8 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *ha u64 module_extra_buffer_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param); char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param); +u32 module_deep_comp_kernel (MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const u32 salt_pos, MAYBE_UNUSED const u32 digest_pos); + void module_hook12 (hc_device_param_t *device_param, void *hook_salts_buf, const u32 salt_pos, const u64 pws_cnt); void module_hook23 (hc_device_param_t *device_param, void *hook_salts_buf, const u32 salt_pos, const u64 pws_cnt); diff --git a/include/types.h b/include/types.h index cdfbe0012..35f9e4e31 100644 --- a/include/types.h +++ b/include/types.h @@ -938,7 +938,7 @@ struct hashconfig u32 salt_min; u32 salt_max; - int (*parse_func) (u8 *, u32, hash_t *, struct hashconfig *); + // int (*parse_func) (u8 *, u32, hash_t *, struct hashconfig *); const char *st_hash; const char *st_pass; @@ -2302,6 +2302,8 @@ typedef struct module_ctx u64 (*module_extra_buffer_size) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *, const hashes_t *, const hc_device_param_t *); char *(*module_jit_build_options) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *, const hashes_t *, const hc_device_param_t *); + u32 (*module_deep_comp_kernel) (const hashes_t *, const u32, const u32); + void (*module_hook12) (hc_device_param_t *, const void *, const u32, const u64); void (*module_hook23) (hc_device_param_t *, const void *, const u32, const u64); diff --git a/modules/module_01000.c b/modules/module_01000.c index ce7d4d513..7c9f8b7ac 100644 --- a/modules/module_01000.c +++ b/modules/module_01000.c @@ -115,13 +115,13 @@ void module_init (module_ctx_t *module_ctx) { // undefined functions automatically call corresponding default functions - module_ctx->module_attack_exec = module_attack_exec; module_ctx->module_benchmark_esalt = NULL; module_ctx->module_benchmark_hook_salt = NULL; module_ctx->module_benchmark_mask = NULL; module_ctx->module_benchmark_salt = NULL; module_ctx->module_build_plain_postprocess = NULL; + module_ctx->module_deep_comp_kernel = NULL; module_ctx->module_dgst_pos0 = module_dgst_pos0; module_ctx->module_dgst_pos1 = module_dgst_pos1; module_ctx->module_dgst_pos2 = module_dgst_pos2; diff --git a/src/interface_migrate.c b/src/interface_migrate.c index 296087945..94b56508c 100644 --- a/src/interface_migrate.c +++ b/src/interface_migrate.c @@ -28960,3 +28960,39 @@ bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE return false; } + +u32 module_deep_comp_kernel (MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const u32 salt_pos, MAYBE_UNUSED const u32 digest_pos) +{ + if ((hashconfig->hash_mode == 2500) || (hashconfig->hash_mode == 2501)) + { + const u32 digests_offset = hashes->salts_buf[salt_pos].digests_offset; + + wpa_eapol_t *wpa_eapols = (wpa_eapol_t *) hashes->esalts_buf; + + wpa_eapol_t *wpa_eapol = &wpa_eapols[digests_offset + digest_pos]; + + if (wpa_eapol->keyver == 1) + { + return KERN_RUN_AUX1; + } + else if (wpa_eapol->keyver == 2) + { + return KERN_RUN_AUX2; + } + else if (wpa_eapol->keyver == 3) + { + return KERN_RUN_AUX3; + } + } + else if (hashconfig->hash_mode == 9600) + { + return KERN_RUN_3; + } + else if ((hashconfig->hash_mode == 16800) || (hashconfig->hash_mode == 16801)) + { + return KERN_RUN_AUX1; + } +} + + + diff --git a/src/opencl.c b/src/opencl.c index be0fe2f94..454192084 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -1442,45 +1442,11 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, device_param->kernel_params_buf32[28] = loops_pos; device_param->kernel_params_buf32[29] = loops_cnt; - if ((hashconfig->hash_mode == 2500) || (hashconfig->hash_mode == 2501)) - { - const u32 digests_offset = hashes->salts_buf[salt_pos].digests_offset; + const u32 deep_comp_kernel = module_ctx->module_deep_comp_kernel (hashes, salt_pos, loops_pos); - wpa_eapol_t *wpa_eapols = (wpa_eapol_t *) hashes->esalts_buf; + CL_rc = run_kernel (hashcat_ctx, device_param, deep_comp_kernel, pws_cnt, false, 0); - wpa_eapol_t *wpa_eapol = &wpa_eapols[digests_offset + loops_pos]; - - if (wpa_eapol->keyver == 1) - { - CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX1, pws_cnt, false, 0); - - if (CL_rc == -1) return -1; - } - else if (wpa_eapol->keyver == 2) - { - CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX2, pws_cnt, false, 0); - - if (CL_rc == -1) return -1; - } - else if (wpa_eapol->keyver == 3) - { - CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX3, pws_cnt, false, 0); - - if (CL_rc == -1) return -1; - } - } - else if (hashconfig->hash_mode == 9600) - { - CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_3, pws_cnt, false, 0); - - if (CL_rc == -1) return -1; - } - else if ((hashconfig->hash_mode == 16800) || (hashconfig->hash_mode == 16801)) - { - CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX1, pws_cnt, false, 0); - - if (CL_rc == -1) return -1; - } + if (CL_rc == -1) return -1; if (status_ctx->run_thread_level2 == false) break; } diff --git a/src/selftest.c b/src/selftest.c index 8e064a72f..89f283544 100644 --- a/src/selftest.c +++ b/src/selftest.c @@ -449,25 +449,25 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param { device_param->kernel_params_buf32[28] = 0; device_param->kernel_params_buf32[29] = 1; - } - if (hashconfig->opts_type & OPTS_TYPE_AUX1) - { - CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX1, 1, false, 0); + if (hashconfig->opts_type & OPTS_TYPE_AUX1) + { + CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX1, 1, false, 0); - if (CL_rc == -1) return -1; - } - else if (hashconfig->opts_type & OPTS_TYPE_AUX2) - { - CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX2, 1, false, 0); + if (CL_rc == -1) return -1; + } + else if (hashconfig->opts_type & OPTS_TYPE_AUX2) + { + CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX2, 1, false, 0); - if (CL_rc == -1) return -1; - } - else if (hashconfig->opts_type & OPTS_TYPE_AUX3) - { - CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX3, 1, false, 0); + if (CL_rc == -1) return -1; + } + else if (hashconfig->opts_type & OPTS_TYPE_AUX3) + { + CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX3, 1, false, 0); - if (CL_rc == -1) return -1; + if (CL_rc == -1) return -1; + } } else {