1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-01-03 12:21:07 +00:00

Get rid of attack_kern variable in data. context

This commit is contained in:
jsteube 2016-09-22 15:50:49 +02:00
parent f1d93d576a
commit f9ec232b9b
10 changed files with 43 additions and 44 deletions

View File

@ -6,7 +6,7 @@
#ifndef _AUTOTUNE_H
#define _AUTOTUNE_H
int autotune (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const user_options_t *user_options);
int autotune (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const user_options_t *user_options, const user_options_extra_t *user_options_extra);
void *thread_autotune (void *p);

View File

@ -81,7 +81,7 @@ int run_kernel_amp (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, c
int run_kernel_memset (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, cl_mem buf, const uint value, const uint num);
int run_kernel_bzero (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, cl_mem buf, const size_t size);
int run_copy (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const user_options_t *user_options, const uint pws_cnt);
int run_copy (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const uint pws_cnt);
int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, hashes_t *hashes, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const uint pws_cnt);

View File

@ -11,7 +11,7 @@
double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_entries);
void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *hashes, const user_options_t *user_options);
void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *hashes, const user_options_t *user_options, const user_options_extra_t *user_options_extra);
void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const user_options_t *user_options, const user_options_extra_t *user_options_extra);
void status_benchmark_automate (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig);
void status_benchmark (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const user_options_t *user_options);

View File

@ -965,7 +965,6 @@ typedef struct
u32 attack_kern;
u32 quiet;
u32 force;
u32 pw_min;

View File

@ -54,7 +54,7 @@ static double try_run (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param
return exec_ms_prev;
}
int autotune (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const user_options_t *user_options)
int autotune (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const user_options_t *user_options, const user_options_extra_t *user_options_extra)
{
const double target_ms = opencl_ctx->target_ms;
@ -96,7 +96,7 @@ int autotune (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashcon
const u32 kernel_power_max = device_param->device_processors * device_param->kernel_threads * kernel_accel_max;
if (data.attack_kern == ATTACK_KERN_BF)
if (user_options_extra->attack_kern == ATTACK_KERN_BF)
{
run_kernel_memset (opencl_ctx, device_param, device_param->d_pws_buf, 7, kernel_power_max * sizeof (pw_t));
}
@ -318,10 +318,11 @@ void *thread_autotune (void *p)
if (device_param->skipped) return NULL;
user_options_t *user_options = data.user_options;
user_options_extra_t *user_options_extra = data.user_options_extra;
hashconfig_t *hashconfig = data.hashconfig;
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
autotune (opencl_ctx, device_param, hashconfig, user_options);
autotune (opencl_ctx, device_param, hashconfig, user_options, user_options_extra);
return NULL;
}

View File

@ -123,7 +123,7 @@ void *thread_calc_stdin (void *p)
char *buf = (char *) mymalloc (HCBUFSIZ_LARGE);
const uint attack_kern = data.attack_kern;
const uint attack_kern = user_options_extra->attack_kern;
while (opencl_ctx->run_thread_level1 == true)
{
@ -208,7 +208,7 @@ void *thread_calc_stdin (void *p)
if (pws_cnt)
{
run_copy (opencl_ctx, device_param, hashconfig, user_options, pws_cnt);
run_copy (opencl_ctx, device_param, hashconfig, user_options, user_options_extra, pws_cnt);
run_cracker (opencl_ctx, device_param, hashconfig, hashes, user_options, user_options_extra, pws_cnt);
@ -249,7 +249,7 @@ void *thread_calc (void *p)
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
const uint attack_mode = user_options->attack_mode;
const uint attack_kern = data.attack_kern;
const uint attack_kern = user_options_extra->attack_kern;
if (attack_mode == ATTACK_MODE_BF)
{
@ -268,7 +268,7 @@ void *thread_calc (void *p)
if (pws_cnt)
{
run_copy (opencl_ctx, device_param, hashconfig, user_options, pws_cnt);
run_copy (opencl_ctx, device_param, hashconfig, user_options, user_options_extra, pws_cnt);
run_cracker (opencl_ctx, device_param, hashconfig, hashes, user_options, user_options_extra, pws_cnt);
@ -460,7 +460,7 @@ void *thread_calc (void *p)
if (pws_cnt)
{
run_copy (opencl_ctx, device_param, hashconfig, user_options, pws_cnt);
run_copy (opencl_ctx, device_param, hashconfig, user_options, user_options_extra, pws_cnt);
run_cracker (opencl_ctx, device_param, hashconfig, hashes, user_options, user_options_extra, pws_cnt);

View File

@ -272,7 +272,6 @@ int main (int argc, char **argv)
{
data.force = user_options->force;
data.quiet = user_options->quiet;
data.attack_kern = user_options_extra->attack_kern;
}
if (user_options->version)

View File

@ -865,11 +865,11 @@ int run_kernel_bzero (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param,
return run_kernel_memset (opencl_ctx, device_param, buf, 0, size);
}
int run_copy (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const user_options_t *user_options, const uint pws_cnt)
int run_copy (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const uint pws_cnt)
{
cl_int CL_err = CL_SUCCESS;
if (data.attack_kern == ATTACK_KERN_STRAIGHT)
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
{
CL_err = hc_clEnqueueWriteBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, pws_cnt * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
@ -880,7 +880,7 @@ int run_copy (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashcon
return -1;
}
}
else if (data.attack_kern == ATTACK_KERN_COMBI)
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI)
{
if (user_options->attack_mode == ATTACK_MODE_COMBI)
{
@ -945,7 +945,7 @@ int run_copy (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashcon
return -1;
}
}
else if (data.attack_kern == ATTACK_KERN_BF)
else if (user_options_extra->attack_kern == ATTACK_KERN_BF)
{
const u64 off = device_param->words_off;
@ -983,13 +983,13 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
uint highest_pw_len = 0;
if (data.attack_kern == ATTACK_KERN_STRAIGHT)
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
{
}
else if (data.attack_kern == ATTACK_KERN_COMBI)
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI)
{
}
else if (data.attack_kern == ATTACK_KERN_BF)
else if (user_options_extra->attack_kern == ATTACK_KERN_BF)
{
highest_pw_len = device_param->kernel_params_mp_l_buf32[4]
+ device_param->kernel_params_mp_l_buf32[5];
@ -1022,9 +1022,9 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) innerloop_step = device_param->kernel_loops;
else innerloop_step = 1;
if (data.attack_kern == ATTACK_KERN_STRAIGHT) innerloop_cnt = data.kernel_rules_cnt;
else if (data.attack_kern == ATTACK_KERN_COMBI) innerloop_cnt = data.combs_cnt;
else if (data.attack_kern == ATTACK_KERN_BF) innerloop_cnt = data.bfs_cnt;
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) innerloop_cnt = data.kernel_rules_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) innerloop_cnt = data.combs_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) innerloop_cnt = data.bfs_cnt;
// innerloops

View File

@ -137,7 +137,7 @@ double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_en
return exec_ms_sum / exec_ms_cnt;
}
void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *hashes, const user_options_t *user_options)
void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *hashes, const user_options_t *user_options, const user_options_extra_t *user_options_extra)
{
if (opencl_ctx->devices_status == STATUS_INIT)
{
@ -228,18 +228,18 @@ void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *
{
progress_skip = MIN (user_options->skip, data.words_base) * hashes->salts_cnt;
if (data.attack_kern == ATTACK_KERN_STRAIGHT) progress_skip *= data.kernel_rules_cnt;
else if (data.attack_kern == ATTACK_KERN_COMBI) progress_skip *= data.combs_cnt;
else if (data.attack_kern == ATTACK_KERN_BF) progress_skip *= data.bfs_cnt;
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) progress_skip *= data.kernel_rules_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) progress_skip *= data.combs_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) progress_skip *= data.bfs_cnt;
}
if (user_options->limit)
{
progress_end = MIN (user_options->limit, data.words_base) * hashes->salts_cnt;
if (data.attack_kern == ATTACK_KERN_STRAIGHT) progress_end *= data.kernel_rules_cnt;
else if (data.attack_kern == ATTACK_KERN_COMBI) progress_end *= data.combs_cnt;
else if (data.attack_kern == ATTACK_KERN_BF) progress_end *= data.bfs_cnt;
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) progress_end *= data.kernel_rules_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) progress_end *= data.combs_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) progress_end *= data.bfs_cnt;
}
u64 progress_cur_relative_skip = progress_cur - progress_skip;
@ -300,7 +300,7 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
if (user_options->machine_readable == true)
{
status_display_machine_readable (opencl_ctx, hashes, user_options);
status_display_machine_readable (opencl_ctx, hashes, user_options, user_options_extra);
return;
}
@ -701,18 +701,18 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
{
progress_skip = MIN (user_options->skip, data.words_base) * hashes->salts_cnt;
if (data.attack_kern == ATTACK_KERN_STRAIGHT) progress_skip *= data.kernel_rules_cnt;
else if (data.attack_kern == ATTACK_KERN_COMBI) progress_skip *= data.combs_cnt;
else if (data.attack_kern == ATTACK_KERN_BF) progress_skip *= data.bfs_cnt;
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) progress_skip *= data.kernel_rules_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) progress_skip *= data.combs_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) progress_skip *= data.bfs_cnt;
}
if (user_options->limit)
{
progress_end = MIN (user_options->limit, data.words_base) * hashes->salts_cnt;
if (data.attack_kern == ATTACK_KERN_STRAIGHT) progress_end *= data.kernel_rules_cnt;
else if (data.attack_kern == ATTACK_KERN_COMBI) progress_end *= data.combs_cnt;
else if (data.attack_kern == ATTACK_KERN_BF) progress_end *= data.bfs_cnt;
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) progress_end *= data.kernel_rules_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) progress_end *= data.combs_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) progress_end *= data.bfs_cnt;
}
u64 progress_cur_relative_skip = progress_cur - progress_skip;

View File

@ -323,11 +323,11 @@ u64 count_words (wl_data_t *wl_data, const user_options_t *user_options, const u
{
u64 keyspace = cached_cnt;
if (data.attack_kern == ATTACK_KERN_STRAIGHT)
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
{
keyspace *= data.kernel_rules_cnt;
}
else if (data.attack_kern == ATTACK_KERN_COMBI)
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI)
{
keyspace *= data.combs_cnt;
}
@ -386,11 +386,11 @@ u64 count_words (wl_data_t *wl_data, const user_options_t *user_options, const u
if (len < PW_MAX1)
{
if (data.attack_kern == ATTACK_KERN_STRAIGHT)
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
{
cnt += data.kernel_rules_cnt;
}
else if (data.attack_kern == ATTACK_KERN_COMBI)
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI)
{
cnt += data.combs_cnt;
}