1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-16 11:48:15 +00:00

Update opencl.c and autotune.c function parameters

This commit is contained in:
jsteube 2016-10-06 15:16:30 +02:00
parent f084aaf61b
commit 0579f93402
9 changed files with 198 additions and 138 deletions

View File

@ -18,34 +18,30 @@ static const char CL_VENDOR_MESA[] = "Mesa";
static const char CL_VENDOR_NV[] = "NVIDIA Corporation"; static const char CL_VENDOR_NV[] = "NVIDIA Corporation";
static const char CL_VENDOR_POCL[] = "The pocl project"; static const char CL_VENDOR_POCL[] = "The pocl project";
int gidd_to_pw_t (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const u64 gidd, pw_t *pw); int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u64 gidd, pw_t *pw);
int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 highest_pw_len, const u32 pws_cnt, const u32 fast_iteration, const u32 salt_pos);
int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 kern_run, const u32 num, const u32 event_update, const u32 iteration);
int run_kernel_mp (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 kern_run, const u32 num);
int run_kernel_tm (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param);
int run_kernel_amp (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 num);
int run_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u32 value, const u32 num);
int run_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const size_t size);
int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt);
int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt);
int choose_kernel (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx, hashconfig_t *hashconfig, const hashes_t *hashes, const outfile_ctx_t *outfile_ctx, status_ctx_t *status_ctx, const u32 highest_pw_len, const u32 pws_cnt, const u32 fast_iteration, const u32 salt_pos); int opencl_ctx_init (hashcat_ctx_t *hashcat_ctx);
void opencl_ctx_destroy (hashcat_ctx_t *hashcat_ctx);
int run_kernel (const u32 kern_run, opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const u32 num, const u32 event_update, const u32 iteration, hashconfig_t *hashconfig, const user_options_t *user_options, status_ctx_t *status_ctx); int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime);
int run_kernel_mp (const u32 kern_run, opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const u32 num); void opencl_ctx_devices_destroy (hashcat_ctx_t *hashcat_ctx);
int run_kernel_tm (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param); void opencl_ctx_devices_update_power (hashcat_ctx_t *hashcat_ctx);
int run_kernel_amp (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const u32 num); void opencl_ctx_devices_kernel_loops (hashcat_ctx_t *hashcat_ctx);
int run_kernel_memset (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, cl_mem buf, const u32 value, const u32 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 user_options_extra_t *user_options_extra, const combinator_ctx_t *combinator_ctx, const u32 pws_cnt); int opencl_session_begin (hashcat_ctx_t *hashcat_ctx);
void opencl_session_destroy (hashcat_ctx_t *hashcat_ctx);
int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt); void opencl_session_reset (hashcat_ctx_t *hashcat_ctx);
int opencl_session_update_combinator (hashcat_ctx_t *hashcat_ctx);
int opencl_ctx_init (opencl_ctx_t *opencl_ctx, const user_options_t *user_options); int opencl_session_update_mp (hashcat_ctx_t *hashcat_ctx);
void opencl_ctx_destroy (opencl_ctx_t *opencl_ctx); int opencl_session_update_mp_rl (hashcat_ctx_t *hashcat_ctx, const u32 css_cnt_l, const u32 css_cnt_r);
int opencl_ctx_devices_init (opencl_ctx_t *opencl_ctx, const user_options_t *user_options, const int comptime);
void opencl_ctx_devices_destroy (opencl_ctx_t *opencl_ctx);
void opencl_ctx_devices_update_power (opencl_ctx_t *opencl_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, status_ctx_t *status_ctx);
void opencl_ctx_devices_kernel_loops (opencl_ctx_t *opencl_ctx, const user_options_extra_t *user_options_extra, const hashconfig_t *hashconfig, const hashes_t *hashes, straight_ctx_t *straight_ctx, combinator_ctx_t *combinator_ctx, mask_ctx_t *mask_ctx);
int opencl_session_begin (opencl_ctx_t *opencl_ctx, hashconfig_t *hashconfig, const hashes_t *hashes, const straight_ctx_t *straight_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const folder_config_t *folder_config, const bitmap_ctx_t *bitmap_ctx, const tuning_db_t *tuning_db);
void opencl_session_destroy (opencl_ctx_t *opencl_ctx);
void opencl_session_reset (opencl_ctx_t *opencl_ctx);
int opencl_session_update_combinator (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const combinator_ctx_t *combinator_ctx);
int opencl_session_update_mp (opencl_ctx_t *opencl_ctx, const mask_ctx_t *mask_ctx);
int opencl_session_update_mp_rl (opencl_ctx_t *opencl_ctx, const mask_ctx_t *mask_ctx, const u32 css_cnt_l, const u32 css_cnt_r);
#endif // _OPENCL_H #endif // _OPENCL_H

View File

@ -20,6 +20,6 @@
#include <pwd.h> #include <pwd.h>
#endif // _POSIX #endif // _POSIX
void process_stdout (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const hashconfig_t *hashconfig, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx, const outfile_ctx_t *outfile_ctx, const u32 pws_cnt); void process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt);
#endif // _STDOUT_H #endif // _STDOUT_H

View File

@ -13,10 +13,7 @@
static double try_run (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 kernel_accel, const u32 kernel_loops) static double try_run (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 kernel_accel, const u32 kernel_loops)
{ {
hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
const u32 kernel_power_try = device_param->device_processors * device_param->kernel_threads * kernel_accel; const u32 kernel_power_try = device_param->device_processors * device_param->kernel_threads * kernel_accel;
@ -26,11 +23,11 @@ static double try_run (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{ {
run_kernel (KERN_RUN_1, opencl_ctx, device_param, kernel_power_try, true, 0, hashconfig, user_options, status_ctx); run_kernel (hashcat_ctx, device_param, KERN_RUN_1, kernel_power_try, true, 0);
} }
else else
{ {
run_kernel (KERN_RUN_2, opencl_ctx, device_param, kernel_power_try, true, 0, hashconfig, user_options, status_ctx); run_kernel (hashcat_ctx, device_param, KERN_RUN_2, kernel_power_try, true, 0);
} }
const double exec_ms_prev = get_avg_exec_time (device_param, 1); const double exec_ms_prev = get_avg_exec_time (device_param, 1);
@ -87,7 +84,7 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if (user_options_extra->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)); run_kernel_memset (hashcat_ctx, device_param, device_param->d_pws_buf, 7, kernel_power_max * sizeof (pw_t));
} }
else else
{ {
@ -124,7 +121,7 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
} }
else else
{ {
run_kernel_amp (opencl_ctx, device_param, kernel_power_max); run_kernel_amp (hashcat_ctx, device_param, kernel_power_max);
} }
#define VERIFIER_CNT 1 #define VERIFIER_CNT 1
@ -255,11 +252,11 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
hc_clEnqueueWriteBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_pws_amp_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL); hc_clEnqueueWriteBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_pws_amp_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
*/ */
run_kernel_memset (opencl_ctx, device_param, device_param->d_pws_buf, 0, kernel_power_max * sizeof (pw_t)); run_kernel_memset (hashcat_ctx, device_param, device_param->d_pws_buf, 0, kernel_power_max * sizeof (pw_t));
if (hashconfig->attack_exec == ATTACK_EXEC_OUTSIDE_KERNEL) if (hashconfig->attack_exec == ATTACK_EXEC_OUTSIDE_KERNEL)
{ {
run_kernel_memset (opencl_ctx, device_param, device_param->d_pws_amp_buf, 0, kernel_power_max * sizeof (pw_t)); run_kernel_memset (hashcat_ctx, device_param, device_param->d_pws_amp_buf, 0, kernel_power_max * sizeof (pw_t));
} }
// reset timer // reset timer

View File

@ -113,8 +113,6 @@ static void calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_pa
hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes; hashes_t *hashes = hashcat_ctx->hashes;
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx; straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx; status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
char *buf = (char *) mymalloc (HCBUFSIZ_LARGE); char *buf = (char *) mymalloc (HCBUFSIZ_LARGE);
@ -204,7 +202,7 @@ static void calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_pa
if (pws_cnt) if (pws_cnt)
{ {
run_copy (opencl_ctx, device_param, hashconfig, user_options, user_options_extra, combinator_ctx, pws_cnt); run_copy (hashcat_ctx, device_param, pws_cnt);
run_cracker (hashcat_ctx, device_param, pws_cnt); run_cracker (hashcat_ctx, device_param, pws_cnt);
@ -280,7 +278,7 @@ static void calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (pws_cnt) if (pws_cnt)
{ {
run_copy (opencl_ctx, device_param, hashconfig, user_options, user_options_extra, combinator_ctx, pws_cnt); run_copy (hashcat_ctx, device_param, pws_cnt);
run_cracker (hashcat_ctx, device_param, pws_cnt); run_cracker (hashcat_ctx, device_param, pws_cnt);
@ -476,7 +474,7 @@ static void calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (pws_cnt) if (pws_cnt)
{ {
run_copy (opencl_ctx, device_param, hashconfig, user_options, user_options_extra, combinator_ctx, pws_cnt); run_copy (hashcat_ctx, device_param, pws_cnt);
run_cracker (hashcat_ctx, device_param, pws_cnt); run_cracker (hashcat_ctx, device_param, pws_cnt);

View File

@ -118,7 +118,6 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
{ {
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx; combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx; dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes; hashes_t *hashes = hashcat_ctx->hashes;
induct_ctx_t *induct_ctx = hashcat_ctx->induct_ctx; induct_ctx_t *induct_ctx = hashcat_ctx->induct_ctx;
logfile_ctx_t *logfile_ctx = hashcat_ctx->logfile_ctx; logfile_ctx_t *logfile_ctx = hashcat_ctx->logfile_ctx;
@ -166,7 +165,7 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
status_ctx->ms_paused = 0; status_ctx->ms_paused = 0;
opencl_session_reset (opencl_ctx); opencl_session_reset (hashcat_ctx);
cpt_ctx_reset (hashcat_ctx); cpt_ctx_reset (hashcat_ctx);
@ -366,7 +365,7 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
* - hash iteration count for slow hashes * - hash iteration count for slow hashes
*/ */
opencl_ctx_devices_kernel_loops (opencl_ctx, user_options_extra, hashconfig, hashes, straight_ctx, combinator_ctx, mask_ctx); opencl_ctx_devices_kernel_loops (hashcat_ctx);
/** /**
* create autotune threads * create autotune threads
@ -394,7 +393,7 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
* autotune modified kernel_accel, which modifies opencl_ctx->kernel_power_all * autotune modified kernel_accel, which modifies opencl_ctx->kernel_power_all
*/ */
opencl_ctx_devices_update_power (opencl_ctx, user_options, user_options_extra, status_ctx); opencl_ctx_devices_update_power (hashcat_ctx);
/** /**
* Begin loopback recording * Begin loopback recording
@ -577,7 +576,6 @@ static int inner1_loop (hashcat_ctx_t *hashcat_ctx)
hashes_t *hashes = hashcat_ctx->hashes; hashes_t *hashes = hashcat_ctx->hashes;
logfile_ctx_t *logfile_ctx = hashcat_ctx->logfile_ctx; logfile_ctx_t *logfile_ctx = hashcat_ctx->logfile_ctx;
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx; mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx; restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx; status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx; straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
@ -634,12 +632,12 @@ static int inner1_loop (hashcat_ctx_t *hashcat_ctx)
combinator_ctx->combs_cnt = sp_get_sum (0, mask_ctx->css_cnt, mask_ctx->root_css_buf); combinator_ctx->combs_cnt = sp_get_sum (0, mask_ctx->css_cnt, mask_ctx->root_css_buf);
const int rc_update_mp = opencl_session_update_mp (opencl_ctx, mask_ctx); const int rc_update_mp = opencl_session_update_mp (hashcat_ctx);
if (rc_update_mp == -1) return -1; if (rc_update_mp == -1) return -1;
} }
const int rc_update_combinator = opencl_session_update_combinator (opencl_ctx, hashconfig, combinator_ctx); const int rc_update_combinator = opencl_session_update_combinator (hashcat_ctx);
if (rc_update_combinator == -1) return -1; if (rc_update_combinator == -1) return -1;
} }
@ -716,7 +714,7 @@ static int inner1_loop (hashcat_ctx_t *hashcat_ctx)
mask_ctx->bfs_cnt = sp_get_sum (0, css_cnt_lr[1], mask_ctx->root_css_buf); mask_ctx->bfs_cnt = sp_get_sum (0, css_cnt_lr[1], mask_ctx->root_css_buf);
const int rc_update_mp_rl = opencl_session_update_mp_rl (opencl_ctx, mask_ctx, css_cnt_lr[0], css_cnt_lr[1]); const int rc_update_mp_rl = opencl_session_update_mp_rl (hashcat_ctx, css_cnt_lr[0], css_cnt_lr[1]);
if (rc_update_mp_rl == -1) return -1; if (rc_update_mp_rl == -1) return -1;
} }
@ -759,7 +757,6 @@ static int inner1_loop (hashcat_ctx_t *hashcat_ctx)
static int outer_loop (hashcat_ctx_t *hashcat_ctx) static int outer_loop (hashcat_ctx_t *hashcat_ctx)
{ {
bitmap_ctx_t *bitmap_ctx = hashcat_ctx->bitmap_ctx; bitmap_ctx_t *bitmap_ctx = hashcat_ctx->bitmap_ctx;
folder_config_t *folder_config = hashcat_ctx->folder_config;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes; hashes_t *hashes = hashcat_ctx->hashes;
hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx;
@ -771,8 +768,6 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx; restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx; status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx; straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
tuning_db_t *tuning_db = hashcat_ctx->tuning_db;
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
user_options_t *user_options = hashcat_ctx->user_options; user_options_t *user_options = hashcat_ctx->user_options;
wl_data_t *wl_data = hashcat_ctx->wl_data; wl_data_t *wl_data = hashcat_ctx->wl_data;
@ -1062,7 +1057,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
if (user_options->quiet == false) log_info_nn ("Initializing device kernels and memory..."); if (user_options->quiet == false) log_info_nn ("Initializing device kernels and memory...");
opencl_session_begin (opencl_ctx, hashconfig, hashes, straight_ctx, user_options, user_options_extra, folder_config, bitmap_ctx, tuning_db); opencl_session_begin (hashcat_ctx);
if (user_options->quiet == false) log_info_nn (""); if (user_options->quiet == false) log_info_nn ("");
@ -1211,7 +1206,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
status_progress_destroy (hashcat_ctx); status_progress_destroy (hashcat_ctx);
opencl_session_destroy (opencl_ctx); opencl_session_destroy (hashcat_ctx);
potfile_write_close (potfile_ctx); potfile_write_close (potfile_ctx);
@ -1253,7 +1248,6 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, char *install_folder, char *shared_fold
induct_ctx_t *induct_ctx = hashcat_ctx->induct_ctx; induct_ctx_t *induct_ctx = hashcat_ctx->induct_ctx;
logfile_ctx_t *logfile_ctx = hashcat_ctx->logfile_ctx; logfile_ctx_t *logfile_ctx = hashcat_ctx->logfile_ctx;
loopback_ctx_t *loopback_ctx = hashcat_ctx->loopback_ctx; loopback_ctx_t *loopback_ctx = hashcat_ctx->loopback_ctx;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
outcheck_ctx_t *outcheck_ctx = hashcat_ctx->outcheck_ctx; outcheck_ctx_t *outcheck_ctx = hashcat_ctx->outcheck_ctx;
outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx; outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx;
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx; potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
@ -1390,7 +1384,7 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, char *install_folder, char *shared_fold
* Init OpenCL library loader * Init OpenCL library loader
*/ */
const int rc_opencl_init = opencl_ctx_init (opencl_ctx, user_options); const int rc_opencl_init = opencl_ctx_init (hashcat_ctx);
if (rc_opencl_init == -1) if (rc_opencl_init == -1)
{ {
@ -1403,7 +1397,7 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, char *install_folder, char *shared_fold
* Init OpenCL devices * Init OpenCL devices
*/ */
const int rc_devices_init = opencl_ctx_devices_init (opencl_ctx, user_options, comptime); const int rc_devices_init = opencl_ctx_devices_init (hashcat_ctx, comptime);
if (rc_devices_init == -1) if (rc_devices_init == -1)
{ {
@ -1528,9 +1522,9 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, char *install_folder, char *shared_fold
hwmon_ctx_destroy (hashcat_ctx); hwmon_ctx_destroy (hashcat_ctx);
opencl_ctx_devices_destroy (opencl_ctx); opencl_ctx_devices_destroy (hashcat_ctx);
opencl_ctx_destroy (opencl_ctx); opencl_ctx_destroy (hashcat_ctx);
restore_ctx_destroy (restore_ctx); restore_ctx_destroy (restore_ctx);

View File

@ -263,8 +263,10 @@ static void write_kernel_binary (char *dst, char *binary, size_t binary_size)
} }
} }
int gidd_to_pw_t (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const u64 gidd, pw_t *pw) int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u64 gidd, pw_t *pw)
{ {
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
cl_int CL_err = hc_clEnqueueReadBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, gidd * sizeof (pw_t), sizeof (pw_t), pw, 0, NULL, NULL); cl_int CL_err = hc_clEnqueueReadBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, gidd * sizeof (pw_t), sizeof (pw_t), pw, 0, NULL, NULL);
if (CL_err != CL_SUCCESS) if (CL_err != CL_SUCCESS)
@ -277,13 +279,19 @@ int gidd_to_pw_t (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, con
return 0; return 0;
} }
int choose_kernel (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx, hashconfig_t *hashconfig, const hashes_t *hashes, const outfile_ctx_t *outfile_ctx, status_ctx_t *status_ctx, const u32 highest_pw_len, const u32 pws_cnt, const u32 fast_iteration, const u32 salt_pos) int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 highest_pw_len, const u32 pws_cnt, const u32 fast_iteration, const u32 salt_pos)
{ {
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
cl_int CL_err = CL_SUCCESS; cl_int CL_err = CL_SUCCESS;
if (hashconfig->hash_mode == 2000) if (hashconfig->hash_mode == 2000)
{ {
process_stdout (opencl_ctx, device_param, user_options, hashconfig, straight_ctx, combinator_ctx, mask_ctx, outfile_ctx, pws_cnt); process_stdout (hashcat_ctx, device_param, pws_cnt);
return 0; return 0;
} }
@ -296,9 +304,9 @@ int choose_kernel (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, co
{ {
const u32 size_tm = 32 * sizeof (bs_word_t); const u32 size_tm = 32 * sizeof (bs_word_t);
run_kernel_bzero (opencl_ctx, device_param, device_param->d_tm_c, size_tm); run_kernel_bzero (hashcat_ctx, device_param, device_param->d_tm_c, size_tm);
run_kernel_tm (opencl_ctx, device_param); run_kernel_tm (hashcat_ctx, device_param);
CL_err = hc_clEnqueueCopyBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_tm_c, device_param->d_bfs_c, 0, 0, size_tm, 0, NULL, NULL); CL_err = hc_clEnqueueCopyBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_tm_c, device_param->d_bfs_c, 0, 0, size_tm, 0, NULL, NULL);
@ -313,26 +321,26 @@ int choose_kernel (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, co
if (highest_pw_len < 16) if (highest_pw_len < 16)
{ {
run_kernel (KERN_RUN_1, opencl_ctx, device_param, pws_cnt, true, fast_iteration, hashconfig, user_options, status_ctx); run_kernel (hashcat_ctx, device_param, KERN_RUN_1, pws_cnt, true, fast_iteration);
} }
else if (highest_pw_len < 32) else if (highest_pw_len < 32)
{ {
run_kernel (KERN_RUN_2, opencl_ctx, device_param, pws_cnt, true, fast_iteration, hashconfig, user_options, status_ctx); run_kernel (hashcat_ctx, device_param, KERN_RUN_2, pws_cnt, true, fast_iteration);
} }
else else
{ {
run_kernel (KERN_RUN_3, opencl_ctx, device_param, pws_cnt, true, fast_iteration, hashconfig, user_options, status_ctx); run_kernel (hashcat_ctx, device_param, KERN_RUN_3,pws_cnt, true, fast_iteration);
} }
} }
else else
{ {
run_kernel_amp (opencl_ctx, device_param, pws_cnt); run_kernel_amp (hashcat_ctx, device_param, pws_cnt);
run_kernel (KERN_RUN_1, opencl_ctx, device_param, pws_cnt, false, 0, hashconfig, user_options, status_ctx); run_kernel (hashcat_ctx, device_param, KERN_RUN_1, pws_cnt, false, 0);
if (hashconfig->opts_type & OPTS_TYPE_HOOK12) if (hashconfig->opts_type & OPTS_TYPE_HOOK12)
{ {
run_kernel (KERN_RUN_12, opencl_ctx, device_param, pws_cnt, false, 0, hashconfig, user_options, status_ctx); run_kernel (hashcat_ctx, device_param, KERN_RUN_12, pws_cnt, false, 0);
CL_err = hc_clEnqueueReadBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_hooks, CL_TRUE, 0, device_param->size_hooks, device_param->hooks_buf, 0, NULL, NULL); CL_err = hc_clEnqueueReadBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_hooks, CL_TRUE, 0, device_param->size_hooks, device_param->hooks_buf, 0, NULL, NULL);
@ -368,7 +376,7 @@ int choose_kernel (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, co
device_param->kernel_params_buf32[28] = loop_pos; device_param->kernel_params_buf32[28] = loop_pos;
device_param->kernel_params_buf32[29] = loop_left; device_param->kernel_params_buf32[29] = loop_left;
run_kernel (KERN_RUN_2, opencl_ctx, device_param, pws_cnt, true, slow_iteration, hashconfig, user_options, status_ctx); run_kernel (hashcat_ctx, device_param, KERN_RUN_2, pws_cnt, true, slow_iteration);
while (status_ctx->run_thread_level2 == false) break; while (status_ctx->run_thread_level2 == false) break;
@ -396,7 +404,7 @@ int choose_kernel (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, co
if (hashconfig->opts_type & OPTS_TYPE_HOOK23) if (hashconfig->opts_type & OPTS_TYPE_HOOK23)
{ {
run_kernel (KERN_RUN_23, opencl_ctx, device_param, pws_cnt, false, 0, hashconfig, user_options, status_ctx); run_kernel (hashcat_ctx, device_param, KERN_RUN_23, pws_cnt, false, 0);
CL_err = hc_clEnqueueReadBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_hooks, CL_TRUE, 0, device_param->size_hooks, device_param->hooks_buf, 0, NULL, NULL); CL_err = hc_clEnqueueReadBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_hooks, CL_TRUE, 0, device_param->size_hooks, device_param->hooks_buf, 0, NULL, NULL);
@ -419,14 +427,19 @@ int choose_kernel (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, co
} }
} }
run_kernel (KERN_RUN_3, opencl_ctx, device_param, pws_cnt, false, 0, hashconfig, user_options, status_ctx); run_kernel (hashcat_ctx, device_param, KERN_RUN_3, pws_cnt, false, 0);
} }
return 0; return 0;
} }
int run_kernel (const u32 kern_run, opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const u32 num, const u32 event_update, const u32 iteration, hashconfig_t *hashconfig, const user_options_t *user_options, status_ctx_t *status_ctx) int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 kern_run, const u32 num, const u32 event_update, const u32 iteration)
{ {
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
cl_int CL_err = CL_SUCCESS; cl_int CL_err = CL_SUCCESS;
u32 num_elements = num; u32 num_elements = num;
@ -607,8 +620,10 @@ int run_kernel (const u32 kern_run, opencl_ctx_t *opencl_ctx, hc_device_param_t
return 0; return 0;
} }
int run_kernel_mp (const u32 kern_run, opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const u32 num) int run_kernel_mp (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 kern_run, const u32 num)
{ {
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
cl_int CL_err = CL_SUCCESS; cl_int CL_err = CL_SUCCESS;
u32 num_elements = num; u32 num_elements = num;
@ -702,8 +717,10 @@ int run_kernel_mp (const u32 kern_run, opencl_ctx_t *opencl_ctx, hc_device_param
return 0; return 0;
} }
int run_kernel_tm (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param) int run_kernel_tm (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
{ {
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
cl_int CL_err = CL_SUCCESS; cl_int CL_err = CL_SUCCESS;
const u32 num_elements = 1024; // fixed const u32 num_elements = 1024; // fixed
@ -745,8 +762,10 @@ int run_kernel_tm (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param)
return 0; return 0;
} }
int run_kernel_amp (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const u32 num) int run_kernel_amp (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 num)
{ {
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
cl_int CL_err = CL_SUCCESS; cl_int CL_err = CL_SUCCESS;
u32 num_elements = num; u32 num_elements = num;
@ -804,8 +823,10 @@ int run_kernel_amp (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, c
return 0; return 0;
} }
int run_kernel_memset (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, cl_mem buf, const u32 value, const u32 num) int run_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u32 value, const u32 num)
{ {
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
cl_int CL_err = CL_SUCCESS; cl_int CL_err = CL_SUCCESS;
const u32 num16d = num / 16; const u32 num16d = num / 16;
@ -888,13 +909,19 @@ int run_kernel_memset (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param
return 0; return 0;
} }
int run_kernel_bzero (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, cl_mem buf, const size_t size) int run_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const size_t size)
{ {
return run_kernel_memset (opencl_ctx, device_param, buf, 0, size); return run_kernel_memset (hashcat_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 user_options_extra_t *user_options_extra, const combinator_ctx_t *combinator_ctx, const u32 pws_cnt) int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt)
{ {
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
cl_int CL_err = CL_SUCCESS; cl_int CL_err = CL_SUCCESS;
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
@ -979,7 +1006,7 @@ int run_copy (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashcon
device_param->kernel_params_mp_l_buf64[3] = off; device_param->kernel_params_mp_l_buf64[3] = off;
run_kernel_mp (KERN_RUN_MP_L, opencl_ctx, device_param, pws_cnt); run_kernel_mp (hashcat_ctx, device_param, KERN_RUN_MP_L, pws_cnt);
} }
return 0; return 0;
@ -992,7 +1019,6 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
hashes_t *hashes = hashcat_ctx->hashes; hashes_t *hashes = hashcat_ctx->hashes;
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx; mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx; opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx; status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx; straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
user_options_t *user_options = hashcat_ctx->user_options; user_options_t *user_options = hashcat_ctx->user_options;
@ -1196,7 +1222,7 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
device_param->kernel_params_mp_r_buf64[3] = off; device_param->kernel_params_mp_r_buf64[3] = off;
run_kernel_mp (KERN_RUN_MP_R, opencl_ctx, device_param, innerloop_left); run_kernel_mp (hashcat_ctx, device_param, KERN_RUN_MP_R, innerloop_left);
} }
else if (user_options->attack_mode == ATTACK_MODE_HYBRID1) else if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
{ {
@ -1204,7 +1230,7 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
device_param->kernel_params_mp_buf64[3] = off; device_param->kernel_params_mp_buf64[3] = off;
run_kernel_mp (KERN_RUN_MP, opencl_ctx, device_param, innerloop_left); run_kernel_mp (hashcat_ctx, device_param, KERN_RUN_MP, innerloop_left);
} }
else if (user_options->attack_mode == ATTACK_MODE_HYBRID2) else if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
{ {
@ -1212,7 +1238,7 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
device_param->kernel_params_mp_buf64[3] = off; device_param->kernel_params_mp_buf64[3] = off;
run_kernel_mp (KERN_RUN_MP, opencl_ctx, device_param, innerloop_left); run_kernel_mp (hashcat_ctx, device_param, KERN_RUN_MP, innerloop_left);
} }
// copy amplifiers // copy amplifiers
@ -1278,7 +1304,7 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
hc_timer_set (&device_param->timer_speed); hc_timer_set (&device_param->timer_speed);
} }
int rc = choose_kernel (opencl_ctx, device_param, user_options, straight_ctx, combinator_ctx, mask_ctx, hashconfig, hashes, outfile_ctx, status_ctx, highest_pw_len, pws_cnt, fast_iteration, salt_pos); int rc = choose_kernel (hashcat_ctx, device_param, highest_pw_len, pws_cnt, fast_iteration, salt_pos);
if (rc == -1) return -1; if (rc == -1) return -1;
@ -1351,8 +1377,11 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
return 0; return 0;
} }
int opencl_ctx_init (opencl_ctx_t *opencl_ctx, const user_options_t *user_options) int opencl_ctx_init (hashcat_ctx_t *hashcat_ctx)
{ {
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
opencl_ctx->enabled = false; opencl_ctx->enabled = false;
if (user_options->keyspace == true) return 0; if (user_options->keyspace == true) return 0;
@ -1519,8 +1548,10 @@ int opencl_ctx_init (opencl_ctx_t *opencl_ctx, const user_options_t *user_option
return 0; return 0;
} }
void opencl_ctx_destroy (opencl_ctx_t *opencl_ctx) void opencl_ctx_destroy (hashcat_ctx_t *hashcat_ctx)
{ {
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
if (opencl_ctx->enabled == false) return; if (opencl_ctx->enabled == false) return;
myfree (opencl_ctx->devices_param); myfree (opencl_ctx->devices_param);
@ -1536,8 +1567,11 @@ void opencl_ctx_destroy (opencl_ctx_t *opencl_ctx)
memset (opencl_ctx, 0, sizeof (opencl_ctx_t)); memset (opencl_ctx, 0, sizeof (opencl_ctx_t));
} }
int opencl_ctx_devices_init (opencl_ctx_t *opencl_ctx, const user_options_t *user_options, const int comptime) int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
{ {
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
if (opencl_ctx->enabled == false) return 0; if (opencl_ctx->enabled == false) return 0;
/** /**
@ -2427,8 +2461,10 @@ int opencl_ctx_devices_init (opencl_ctx_t *opencl_ctx, const user_options_t *use
return 0; return 0;
} }
void opencl_ctx_devices_destroy (opencl_ctx_t *opencl_ctx) void opencl_ctx_devices_destroy (hashcat_ctx_t *hashcat_ctx)
{ {
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
if (opencl_ctx->enabled == false) return; if (opencl_ctx->enabled == false) return;
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
@ -2452,8 +2488,13 @@ void opencl_ctx_devices_destroy (opencl_ctx_t *opencl_ctx)
opencl_ctx->need_xnvctrl = 0; opencl_ctx->need_xnvctrl = 0;
} }
void opencl_ctx_devices_update_power (opencl_ctx_t *opencl_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, status_ctx_t *status_ctx) void opencl_ctx_devices_update_power (hashcat_ctx_t *hashcat_ctx)
{ {
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
user_options_t *user_options = hashcat_ctx->user_options;
if (opencl_ctx->enabled == false) return; if (opencl_ctx->enabled == false) return;
u32 kernel_power_all = 0; u32 kernel_power_all = 0;
@ -2490,8 +2531,16 @@ void opencl_ctx_devices_update_power (opencl_ctx_t *opencl_ctx, const user_optio
} }
} }
void opencl_ctx_devices_kernel_loops (opencl_ctx_t *opencl_ctx, const user_options_extra_t *user_options_extra, const hashconfig_t *hashconfig, const hashes_t *hashes, straight_ctx_t *straight_ctx, combinator_ctx_t *combinator_ctx, mask_ctx_t *mask_ctx) void opencl_ctx_devices_kernel_loops (hashcat_ctx_t *hashcat_ctx)
{ {
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes;
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
if (opencl_ctx->enabled == false) return; if (opencl_ctx->enabled == false) return;
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
@ -2524,8 +2573,18 @@ void opencl_ctx_devices_kernel_loops (opencl_ctx_t *opencl_ctx, const user_optio
} }
} }
int opencl_session_begin (opencl_ctx_t *opencl_ctx, hashconfig_t *hashconfig, const hashes_t *hashes, const straight_ctx_t *straight_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const folder_config_t *folder_config, const bitmap_ctx_t *bitmap_ctx, const tuning_db_t *tuning_db) int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
{ {
bitmap_ctx_t *bitmap_ctx = hashcat_ctx->bitmap_ctx;
folder_config_t *folder_config = hashcat_ctx->folder_config;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
tuning_db_t *tuning_db = hashcat_ctx->tuning_db;
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
user_options_t *user_options = hashcat_ctx->user_options;
if (opencl_ctx->enabled == false) return 0; if (opencl_ctx->enabled == false) return 0;
/** /**
@ -4385,12 +4444,12 @@ int opencl_session_begin (opencl_ctx_t *opencl_ctx, hashconfig_t *hashconfig, co
// zero some data buffers // zero some data buffers
run_kernel_bzero (opencl_ctx, device_param, device_param->d_pws_buf, size_pws); run_kernel_bzero (hashcat_ctx, device_param, device_param->d_pws_buf, size_pws);
run_kernel_bzero (opencl_ctx, device_param, device_param->d_pws_amp_buf, size_pws); run_kernel_bzero (hashcat_ctx, device_param, device_param->d_pws_amp_buf, size_pws);
run_kernel_bzero (opencl_ctx, device_param, device_param->d_tmps, size_tmps); run_kernel_bzero (hashcat_ctx, device_param, device_param->d_tmps, size_tmps);
run_kernel_bzero (opencl_ctx, device_param, device_param->d_hooks, size_hooks); run_kernel_bzero (hashcat_ctx, device_param, device_param->d_hooks, size_hooks);
run_kernel_bzero (opencl_ctx, device_param, device_param->d_plain_bufs, size_plains); run_kernel_bzero (hashcat_ctx, device_param, device_param->d_plain_bufs, size_plains);
run_kernel_bzero (opencl_ctx, device_param, device_param->d_result, size_results); run_kernel_bzero (hashcat_ctx, device_param, device_param->d_result, size_results);
/** /**
* special buffers * special buffers
@ -4398,22 +4457,22 @@ int opencl_session_begin (opencl_ctx_t *opencl_ctx, hashconfig_t *hashconfig, co
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
{ {
run_kernel_bzero (opencl_ctx, device_param, device_param->d_rules_c, size_rules_c); run_kernel_bzero (hashcat_ctx, device_param, device_param->d_rules_c, size_rules_c);
} }
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI)
{ {
run_kernel_bzero (opencl_ctx, device_param, device_param->d_combs, size_combs); run_kernel_bzero (hashcat_ctx, device_param, device_param->d_combs, size_combs);
run_kernel_bzero (opencl_ctx, device_param, device_param->d_combs_c, size_combs); run_kernel_bzero (hashcat_ctx, device_param, device_param->d_combs_c, size_combs);
run_kernel_bzero (opencl_ctx, device_param, device_param->d_root_css_buf, size_root_css); run_kernel_bzero (hashcat_ctx, device_param, device_param->d_root_css_buf, size_root_css);
run_kernel_bzero (opencl_ctx, device_param, device_param->d_markov_css_buf, size_markov_css); run_kernel_bzero (hashcat_ctx, device_param, device_param->d_markov_css_buf, size_markov_css);
} }
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) else if (user_options_extra->attack_kern == ATTACK_KERN_BF)
{ {
run_kernel_bzero (opencl_ctx, device_param, device_param->d_bfs, size_bfs); run_kernel_bzero (hashcat_ctx, device_param, device_param->d_bfs, size_bfs);
run_kernel_bzero (opencl_ctx, device_param, device_param->d_bfs_c, size_bfs); run_kernel_bzero (hashcat_ctx, device_param, device_param->d_bfs_c, size_bfs);
run_kernel_bzero (opencl_ctx, device_param, device_param->d_tm_c, size_tm); run_kernel_bzero (hashcat_ctx, device_param, device_param->d_tm_c, size_tm);
run_kernel_bzero (opencl_ctx, device_param, device_param->d_root_css_buf, size_root_css); run_kernel_bzero (hashcat_ctx, device_param, device_param->d_root_css_buf, size_root_css);
run_kernel_bzero (opencl_ctx, device_param, device_param->d_markov_css_buf, size_markov_css); run_kernel_bzero (hashcat_ctx, device_param, device_param->d_markov_css_buf, size_markov_css);
} }
if ((user_options->attack_mode == ATTACK_MODE_HYBRID1) || (user_options->attack_mode == ATTACK_MODE_HYBRID2)) if ((user_options->attack_mode == ATTACK_MODE_HYBRID1) || (user_options->attack_mode == ATTACK_MODE_HYBRID2))
@ -4481,8 +4540,10 @@ int opencl_session_begin (opencl_ctx_t *opencl_ctx, hashconfig_t *hashconfig, co
return 0; return 0;
} }
void opencl_session_destroy (opencl_ctx_t *opencl_ctx) void opencl_session_destroy (hashcat_ctx_t *hashcat_ctx)
{ {
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
if (opencl_ctx->enabled == false) return; if (opencl_ctx->enabled == false) return;
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
@ -4608,8 +4669,10 @@ void opencl_session_destroy (opencl_ctx_t *opencl_ctx)
} }
} }
void opencl_session_reset (opencl_ctx_t *opencl_ctx) void opencl_session_reset (hashcat_ctx_t *hashcat_ctx)
{ {
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
if (opencl_ctx->enabled == false) return; if (opencl_ctx->enabled == false) return;
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
@ -4646,8 +4709,12 @@ void opencl_session_reset (opencl_ctx_t *opencl_ctx)
opencl_ctx->kernel_power_final = 0; opencl_ctx->kernel_power_final = 0;
} }
int opencl_session_update_combinator (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const combinator_ctx_t *combinator_ctx) int opencl_session_update_combinator (hashcat_ctx_t *hashcat_ctx)
{ {
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
if (opencl_ctx->enabled == false) return 0; if (opencl_ctx->enabled == false) return 0;
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
@ -4696,8 +4763,11 @@ int opencl_session_update_combinator (opencl_ctx_t *opencl_ctx, const hashconfig
return 0; return 0;
} }
int opencl_session_update_mp (opencl_ctx_t *opencl_ctx, const mask_ctx_t *mask_ctx) int opencl_session_update_mp (hashcat_ctx_t *hashcat_ctx)
{ {
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
if (opencl_ctx->enabled == false) return 0; if (opencl_ctx->enabled == false) return 0;
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
@ -4735,8 +4805,11 @@ int opencl_session_update_mp (opencl_ctx_t *opencl_ctx, const mask_ctx_t *mask_c
return 0; return 0;
} }
int opencl_session_update_mp_rl (opencl_ctx_t *opencl_ctx, const mask_ctx_t *mask_ctx, const u32 css_cnt_l, const u32 css_cnt_r) int opencl_session_update_mp_rl (hashcat_ctx_t *hashcat_ctx, const u32 css_cnt_l, const u32 css_cnt_r)
{ {
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
if (opencl_ctx->enabled == false) return 0; if (opencl_ctx->enabled == false) return 0;
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)

View File

@ -21,7 +21,6 @@ void build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, p
hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes; hashes_t *hashes = hashcat_ctx->hashes;
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx; mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx; straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
user_options_t *user_options = hashcat_ctx->user_options; user_options_t *user_options = hashcat_ctx->user_options;
@ -36,7 +35,7 @@ void build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, p
{ {
pw_t pw; pw_t pw;
gidd_to_pw_t (opencl_ctx, device_param, gidvid, &pw); gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
{ {
@ -55,7 +54,7 @@ void build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, p
{ {
pw_t pw; pw_t pw;
gidd_to_pw_t (opencl_ctx, device_param, gidvid, &pw); gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
{ {
@ -105,7 +104,7 @@ void build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, p
{ {
pw_t pw; pw_t pw;
gidd_to_pw_t (opencl_ctx, device_param, gidvid, &pw); gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
{ {
@ -132,7 +131,7 @@ void build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, p
{ {
pw_t pw; pw_t pw;
gidd_to_pw_t (opencl_ctx, device_param, gidvid, &pw); gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
{ {
@ -222,7 +221,6 @@ void build_crackpos (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
void build_debugdata (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain, u8 *debug_rule_buf, int *debug_rule_len, u8 *debug_plain_ptr, int *debug_plain_len) void build_debugdata (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain, u8 *debug_rule_buf, int *debug_rule_len, u8 *debug_plain_ptr, int *debug_plain_len)
{ {
debugfile_ctx_t *debugfile_ctx = hashcat_ctx->debugfile_ctx; debugfile_ctx_t *debugfile_ctx = hashcat_ctx->debugfile_ctx;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx; straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
user_options_t *user_options = hashcat_ctx->user_options; user_options_t *user_options = hashcat_ctx->user_options;
@ -237,7 +235,7 @@ void build_debugdata (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_para
pw_t pw; pw_t pw;
gidd_to_pw_t (opencl_ctx, device_param, gidvid, &pw); gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
int plain_len = (int) pw.pw_len; int plain_len = (int) pw.pw_len;

View File

@ -35,8 +35,15 @@ static void out_push (out_t *out, const u8 *pw_buf, const int pw_len)
} }
} }
void process_stdout (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const hashconfig_t *hashconfig, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx, const outfile_ctx_t *outfile_ctx, const u32 pws_cnt) void process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt)
{ {
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx;
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
out_t out; out_t out;
out.fp = stdout; out.fp = stdout;
@ -75,7 +82,7 @@ void process_stdout (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param,
for (u32 gidvid = 0; gidvid < pws_cnt; gidvid++) for (u32 gidvid = 0; gidvid < pws_cnt; gidvid++)
{ {
gidd_to_pw_t (opencl_ctx, device_param, gidvid, &pw); gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
const u32 pos = device_param->innerloop_pos; const u32 pos = device_param->innerloop_pos;
@ -102,7 +109,7 @@ void process_stdout (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param,
for (u32 gidvid = 0; gidvid < pws_cnt; gidvid++) for (u32 gidvid = 0; gidvid < pws_cnt; gidvid++)
{ {
gidd_to_pw_t (opencl_ctx, device_param, gidvid, &pw); gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{ {
@ -168,7 +175,7 @@ void process_stdout (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param,
for (u32 gidvid = 0; gidvid < pws_cnt; gidvid++) for (u32 gidvid = 0; gidvid < pws_cnt; gidvid++)
{ {
gidd_to_pw_t (opencl_ctx, device_param, gidvid, &pw); gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{ {
@ -198,7 +205,7 @@ void process_stdout (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param,
for (u32 gidvid = 0; gidvid < pws_cnt; gidvid++) for (u32 gidvid = 0; gidvid < pws_cnt; gidvid++)
{ {
gidd_to_pw_t (opencl_ctx, device_param, gidvid, &pw); gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{ {

View File

@ -12,12 +12,9 @@
void weak_hash_check (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 salt_pos) void weak_hash_check (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 salt_pos)
{ {
hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes; hashes_t *hashes = hashcat_ctx->hashes;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx; straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
salt_t *salt_buf = &hashes->salts_buf[salt_pos]; salt_t *salt_buf = &hashes->salts_buf[salt_pos];
@ -38,11 +35,11 @@ void weak_hash_check (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_para
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{ {
run_kernel (KERN_RUN_1, opencl_ctx, device_param, 1, false, 0, hashconfig, user_options, status_ctx); run_kernel (hashcat_ctx, device_param, KERN_RUN_1, 1, false, 0);
} }
else else
{ {
run_kernel (KERN_RUN_1, opencl_ctx, device_param, 1, false, 0, hashconfig, user_options, status_ctx); run_kernel (hashcat_ctx, device_param, KERN_RUN_1, 1, false, 0);
u32 loop_step = 16; u32 loop_step = 16;
@ -57,10 +54,10 @@ void weak_hash_check (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_para
device_param->kernel_params_buf32[28] = loop_pos; device_param->kernel_params_buf32[28] = loop_pos;
device_param->kernel_params_buf32[29] = loop_left; device_param->kernel_params_buf32[29] = loop_left;
run_kernel (KERN_RUN_2, opencl_ctx, device_param, 1, false, 0, hashconfig, user_options, status_ctx); run_kernel (hashcat_ctx, device_param, KERN_RUN_2, 1, false, 0);
} }
run_kernel (KERN_RUN_3, opencl_ctx, device_param, 1, false, 0, hashconfig, user_options, status_ctx); run_kernel (hashcat_ctx, device_param, KERN_RUN_3, 1, false, 0);
} }
/** /**