mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-22 14:48:12 +00:00
Move more stuff to status_ctx_t
This commit is contained in:
parent
831ef1490b
commit
12a2d6d2a0
@ -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, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx);
|
||||
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 straight_ctx_t *straight_ctx, status_ctx_t *status_ctx);
|
||||
|
||||
void *thread_autotune (void *p);
|
||||
|
||||
|
@ -15,10 +15,10 @@ void save_hash (const user_options_t *user_options, const hashconfig_t *hashconf
|
||||
|
||||
void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, plain_t *plain);
|
||||
|
||||
int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, const uint salt_pos);
|
||||
int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, status_ctx_t *status_ctx, const uint salt_pos);
|
||||
|
||||
int hashes_init_stage1 (hashes_t *hashes, const hashconfig_t *hashconfig, potfile_ctx_t *potfile_ctx, outfile_ctx_t *outfile_ctx, user_options_t *user_options, char *hash_or_file);
|
||||
int hashes_init_stage2 (hashes_t *hashes, const hashconfig_t *hashconfig, opencl_ctx_t *opencl_ctx, user_options_t *user_options);
|
||||
int hashes_init_stage2 (hashes_t *hashes, const hashconfig_t *hashconfig, user_options_t *user_options, status_ctx_t *status_ctx);
|
||||
int hashes_init_stage3 (hashes_t *hashes, hashconfig_t *hashconfig, user_options_t *user_options);
|
||||
|
||||
void hashes_destroy (hashes_t *hashes);
|
||||
|
@ -23,9 +23,9 @@ void writeProgramBin (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 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, const uint highest_pw_len, const uint pws_cnt, const uint fast_iteration, const uint salt_pos);
|
||||
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 uint highest_pw_len, const uint pws_cnt, const uint fast_iteration, const uint salt_pos);
|
||||
|
||||
int run_kernel (const uint kern_run, opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const uint num, const uint event_update, const uint iteration, hashconfig_t *hashconfig, const user_options_t *user_options);
|
||||
int run_kernel (const uint kern_run, opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const uint num, const uint event_update, const uint iteration, hashconfig_t *hashconfig, const user_options_t *user_options, status_ctx_t *status_ctx);
|
||||
int run_kernel_mp (const uint kern_run, opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const uint num);
|
||||
int run_kernel_tm (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param);
|
||||
int run_kernel_amp (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const uint num);
|
||||
|
@ -33,7 +33,7 @@ void write_restore (restore_ctx_t *restore_ctx, opencl_ctx_t *opencl_ctx);
|
||||
|
||||
void cycle_restore (restore_ctx_t *restore_ctx, opencl_ctx_t *opencl_ctx);
|
||||
|
||||
void stop_at_checkpoint (restore_ctx_t *restore_ctx, opencl_ctx_t *opencl_ctx);
|
||||
void stop_at_checkpoint (restore_ctx_t *restore_ctx, status_ctx_t *status_ctx);
|
||||
|
||||
int restore_ctx_init (restore_ctx_t *restore_ctx, user_options_t *user_options, const folder_config_t *folder_config, int argc, char **argv);
|
||||
|
||||
|
@ -16,8 +16,11 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *op
|
||||
void status_benchmark_automate (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig);
|
||||
void status_benchmark (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const user_options_t *user_options);
|
||||
|
||||
int status_ctx_init (status_ctx_t *status_ctx, const hashes_t *hashes);
|
||||
int status_progress_init (status_ctx_t *status_ctx, const hashes_t *hashes);
|
||||
void status_progress_destroy (status_ctx_t *status_ctx);
|
||||
void status_progress_reset (status_ctx_t *status_ctx, const hashes_t *hashes);
|
||||
|
||||
int status_ctx_init (status_ctx_t *status_ctx);
|
||||
void status_ctx_destroy (status_ctx_t *status_ctx);
|
||||
void status_ctx_reset (status_ctx_t *status_ctx, const hashes_t *hashes);
|
||||
|
||||
#endif // _STATUS_H
|
||||
|
@ -54,12 +54,12 @@ void hc_signal (void (callback) (int));
|
||||
|
||||
#endif
|
||||
|
||||
void mycracked (opencl_ctx_t *opencl_ctx);
|
||||
void myabort (opencl_ctx_t *opencl_ctx);
|
||||
void myquit (opencl_ctx_t *opencl_ctx);
|
||||
void bypass (opencl_ctx_t *opencl_ctx);
|
||||
void mycracked (status_ctx_t *status_ctx);
|
||||
void myabort (status_ctx_t *status_ctx);
|
||||
void myquit (status_ctx_t *status_ctx);
|
||||
void bypass (status_ctx_t *status_ctx);
|
||||
|
||||
void SuspendThreads (opencl_ctx_t *opencl_ctx);
|
||||
void ResumeThreads (opencl_ctx_t *opencl_ctx);
|
||||
void SuspendThreads (status_ctx_t *status_ctx);
|
||||
void ResumeThreads (status_ctx_t *status_ctx);
|
||||
|
||||
#endif // _THREAD_H
|
||||
|
@ -708,14 +708,6 @@ typedef struct
|
||||
u32 kernel_power_all;
|
||||
u64 kernel_power_final; // we save that so that all divisions are done from the same base
|
||||
|
||||
bool run_main_level1;
|
||||
bool run_main_level2;
|
||||
bool run_main_level3;
|
||||
bool run_thread_level1;
|
||||
bool run_thread_level2;
|
||||
|
||||
u32 devices_status;
|
||||
|
||||
u32 opencl_platforms_filter;
|
||||
u32 devices_filter;
|
||||
cl_device_type device_types_filter;
|
||||
@ -1227,6 +1219,14 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 devices_status;
|
||||
|
||||
bool run_main_level1;
|
||||
bool run_main_level2;
|
||||
bool run_main_level3;
|
||||
bool run_thread_level1;
|
||||
bool run_thread_level2;
|
||||
|
||||
u64 *words_progress_done; // progress number of words done per salt
|
||||
u64 *words_progress_rejected; // progress number of words rejected per salt
|
||||
u64 *words_progress_restored; // progress number of words restored per salt
|
||||
@ -1285,8 +1285,6 @@ typedef struct
|
||||
u64 words_cur;
|
||||
u64 words_base;
|
||||
|
||||
|
||||
|
||||
hc_timer_t timer_running; // timer on current dict
|
||||
hc_timer_t timer_paused; // timer on current dict
|
||||
|
||||
|
@ -6,6 +6,6 @@
|
||||
#ifndef _WEAK_HASH_H
|
||||
#define _WEAK_HASH_H
|
||||
|
||||
void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, const uint salt_pos);
|
||||
void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, status_ctx_t *status_ctx, const uint salt_pos);
|
||||
|
||||
#endif // _WEAK_HASH_H
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
extern hc_global_data_t data;
|
||||
|
||||
static double try_run (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const user_options_t *user_options, const u32 kernel_accel, const u32 kernel_loops)
|
||||
static double try_run (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const user_options_t *user_options, status_ctx_t *status_ctx, const u32 kernel_accel, const u32 kernel_loops)
|
||||
{
|
||||
const u32 kernel_power_try = device_param->device_processors * device_param->kernel_threads * kernel_accel;
|
||||
|
||||
@ -24,11 +24,11 @@ static double try_run (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param
|
||||
|
||||
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);
|
||||
run_kernel (KERN_RUN_1, opencl_ctx, device_param, kernel_power_try, true, 0, hashconfig, user_options, status_ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
run_kernel (KERN_RUN_2, opencl_ctx, device_param, kernel_power_try, true, 0, hashconfig, user_options);
|
||||
run_kernel (KERN_RUN_2, opencl_ctx, device_param, kernel_power_try, true, 0, hashconfig, user_options, status_ctx);
|
||||
}
|
||||
|
||||
const double exec_ms_prev = get_avg_exec_time (device_param, 1);
|
||||
@ -36,7 +36,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, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx)
|
||||
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 straight_ctx_t *straight_ctx, status_ctx_t *status_ctx)
|
||||
{
|
||||
const double target_ms = opencl_ctx->target_ms;
|
||||
|
||||
@ -57,10 +57,10 @@ int autotune (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashcon
|
||||
{
|
||||
if (hashconfig->hash_mode != 2000)
|
||||
{
|
||||
try_run (opencl_ctx, device_param, hashconfig, user_options, kernel_accel, kernel_loops);
|
||||
try_run (opencl_ctx, device_param, hashconfig, user_options, kernel_accel, kernel_loops);
|
||||
try_run (opencl_ctx, device_param, hashconfig, user_options, kernel_accel, kernel_loops);
|
||||
try_run (opencl_ctx, device_param, hashconfig, user_options, kernel_accel, kernel_loops);
|
||||
try_run (opencl_ctx, device_param, hashconfig, user_options, status_ctx, kernel_accel, kernel_loops);
|
||||
try_run (opencl_ctx, device_param, hashconfig, user_options, status_ctx, kernel_accel, kernel_loops);
|
||||
try_run (opencl_ctx, device_param, hashconfig, user_options, status_ctx, kernel_accel, kernel_loops);
|
||||
try_run (opencl_ctx, device_param, hashconfig, user_options, status_ctx, kernel_accel, kernel_loops);
|
||||
}
|
||||
|
||||
device_param->kernel_accel = kernel_accel;
|
||||
@ -128,11 +128,11 @@ int autotune (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashcon
|
||||
{
|
||||
for (kernel_loops = kernel_loops_max; kernel_loops > kernel_loops_min; kernel_loops >>= 1)
|
||||
{
|
||||
double exec_ms = try_run (opencl_ctx, device_param, hashconfig, user_options, kernel_accel_min, kernel_loops);
|
||||
double exec_ms = try_run (opencl_ctx, device_param, hashconfig, user_options, status_ctx, kernel_accel_min, kernel_loops);
|
||||
|
||||
for (int i = 0; i < VERIFIER_CNT; i++)
|
||||
{
|
||||
double exec_ms_v = try_run (opencl_ctx, device_param, hashconfig, user_options, kernel_accel_min, kernel_loops);
|
||||
double exec_ms_v = try_run (opencl_ctx, device_param, hashconfig, user_options, status_ctx, kernel_accel_min, kernel_loops);
|
||||
|
||||
exec_ms = MIN (exec_ms, exec_ms_v);
|
||||
}
|
||||
@ -154,11 +154,11 @@ int autotune (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashcon
|
||||
if (kernel_accel_try < kernel_accel_min) continue;
|
||||
if (kernel_accel_try > kernel_accel_max) break;
|
||||
|
||||
double exec_ms = try_run (opencl_ctx, device_param, hashconfig, user_options, kernel_accel_try, kernel_loops);
|
||||
double exec_ms = try_run (opencl_ctx, device_param, hashconfig, user_options, status_ctx, kernel_accel_try, kernel_loops);
|
||||
|
||||
for (int i = 0; i < VERIFIER_CNT; i++)
|
||||
{
|
||||
double exec_ms_v = try_run (opencl_ctx, device_param, hashconfig, user_options, kernel_accel_try, kernel_loops);
|
||||
double exec_ms_v = try_run (opencl_ctx, device_param, hashconfig, user_options, status_ctx, kernel_accel_try, kernel_loops);
|
||||
|
||||
exec_ms = MIN (exec_ms, exec_ms_v);
|
||||
}
|
||||
@ -177,11 +177,11 @@ int autotune (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashcon
|
||||
// due to the rebalance it's possible that the runtime reduces from 48ms to 47ms
|
||||
// and this creates the possibility to double the workload -> 47 * 2 = 95ms, which is < 96ms
|
||||
|
||||
double exec_ms_pre_final = try_run (opencl_ctx, device_param, hashconfig, user_options, kernel_accel, kernel_loops);
|
||||
double exec_ms_pre_final = try_run (opencl_ctx, device_param, hashconfig, user_options, status_ctx, kernel_accel, kernel_loops);
|
||||
|
||||
for (int i = 0; i < VERIFIER_CNT; i++)
|
||||
{
|
||||
double exec_ms_pre_final_v = try_run (opencl_ctx, device_param, hashconfig, user_options, kernel_accel, kernel_loops);
|
||||
double exec_ms_pre_final_v = try_run (opencl_ctx, device_param, hashconfig, user_options, status_ctx, kernel_accel, kernel_loops);
|
||||
|
||||
exec_ms_pre_final = MIN (exec_ms_pre_final, exec_ms_pre_final_v);
|
||||
}
|
||||
@ -207,11 +207,11 @@ int autotune (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashcon
|
||||
|
||||
diff_new = diff;
|
||||
|
||||
double exec_ms = try_run (opencl_ctx, device_param, hashconfig, user_options, kernel_accel_try, kernel_loops_try);
|
||||
double exec_ms = try_run (opencl_ctx, device_param, hashconfig, user_options, status_ctx, kernel_accel_try, kernel_loops_try);
|
||||
|
||||
for (int i = 0; i < VERIFIER_CNT; i++)
|
||||
{
|
||||
double exec_ms_v = try_run (opencl_ctx, device_param, hashconfig, user_options, kernel_accel_try, kernel_loops_try);
|
||||
double exec_ms_v = try_run (opencl_ctx, device_param, hashconfig, user_options, status_ctx, kernel_accel_try, kernel_loops_try);
|
||||
|
||||
exec_ms = MIN (exec_ms, exec_ms_v);
|
||||
}
|
||||
@ -302,10 +302,11 @@ void *thread_autotune (void *p)
|
||||
user_options_t *user_options = data.user_options;
|
||||
user_options_extra_t *user_options_extra = data.user_options_extra;
|
||||
hashconfig_t *hashconfig = data.hashconfig;
|
||||
straight_ctx_t *straight_ctx = data.straight_ctx;
|
||||
straight_ctx_t *straight_ctx = data.straight_ctx;
|
||||
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
|
||||
status_ctx_t *status_ctx = data.status_ctx;
|
||||
|
||||
autotune (opencl_ctx, device_param, hashconfig, user_options, user_options_extra, straight_ctx);
|
||||
autotune (opencl_ctx, device_param, hashconfig, user_options, user_options_extra, straight_ctx, status_ctx);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ void *thread_calc_stdin (void *p)
|
||||
|
||||
const uint attack_kern = user_options_extra->attack_kern;
|
||||
|
||||
while (opencl_ctx->run_thread_level1 == true)
|
||||
while (status_ctx->run_thread_level1 == true)
|
||||
{
|
||||
hc_thread_mutex_lock (opencl_ctx->mux_dispatcher);
|
||||
|
||||
@ -201,12 +201,12 @@ void *thread_calc_stdin (void *p)
|
||||
|
||||
words_cur++;
|
||||
|
||||
while (opencl_ctx->run_thread_level1 == false) break;
|
||||
while (status_ctx->run_thread_level1 == false) break;
|
||||
}
|
||||
|
||||
hc_thread_mutex_unlock (opencl_ctx->mux_dispatcher);
|
||||
|
||||
while (opencl_ctx->run_thread_level1 == false) break;
|
||||
while (status_ctx->run_thread_level1 == false) break;
|
||||
|
||||
// flush
|
||||
|
||||
@ -265,7 +265,7 @@ void *thread_calc (void *p)
|
||||
|
||||
if (attack_mode == ATTACK_MODE_BF)
|
||||
{
|
||||
while (opencl_ctx->run_thread_level1 == true)
|
||||
while (status_ctx->run_thread_level1 == true)
|
||||
{
|
||||
const uint work = get_work (opencl_ctx, user_options, device_param, -1u);
|
||||
|
||||
@ -292,7 +292,7 @@ void *thread_calc (void *p)
|
||||
*/
|
||||
}
|
||||
|
||||
if (opencl_ctx->run_thread_level1 == false) break;
|
||||
if (status_ctx->run_thread_level1 == false) break;
|
||||
|
||||
if (user_options->benchmark == true) break;
|
||||
|
||||
@ -370,7 +370,7 @@ void *thread_calc (void *p)
|
||||
|
||||
u64 words_cur = 0;
|
||||
|
||||
while (opencl_ctx->run_thread_level1 == true)
|
||||
while (status_ctx->run_thread_level1 == true)
|
||||
{
|
||||
u64 words_off = 0;
|
||||
u64 words_fin = 0;
|
||||
@ -460,13 +460,13 @@ void *thread_calc (void *p)
|
||||
|
||||
pw_add (device_param, (u8 *) line_buf, line_len);
|
||||
|
||||
if (opencl_ctx->run_thread_level1 == false) break;
|
||||
if (status_ctx->run_thread_level1 == false) break;
|
||||
}
|
||||
|
||||
if (opencl_ctx->run_thread_level1 == false) break;
|
||||
if (status_ctx->run_thread_level1 == false) break;
|
||||
}
|
||||
|
||||
if (opencl_ctx->run_thread_level1 == false) break;
|
||||
if (status_ctx->run_thread_level1 == false) break;
|
||||
|
||||
//
|
||||
// flush
|
||||
@ -495,7 +495,7 @@ void *thread_calc (void *p)
|
||||
*/
|
||||
}
|
||||
|
||||
if (opencl_ctx->run_thread_level1 == false) break;
|
||||
if (status_ctx->run_thread_level1 == false) break;
|
||||
|
||||
if (words_fin == 0) break;
|
||||
|
||||
|
@ -229,6 +229,7 @@ void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, cons
|
||||
outfile_ctx_t *outfile_ctx = data.outfile_ctx;
|
||||
potfile_ctx_t *potfile_ctx = data.potfile_ctx;
|
||||
mask_ctx_t *mask_ctx = data.mask_ctx;
|
||||
status_ctx_t *status_ctx = data.status_ctx;
|
||||
|
||||
hashconfig_t *hashconfig = data.hashconfig;
|
||||
hashes_t *hashes = data.hashes;
|
||||
@ -478,7 +479,7 @@ void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, cons
|
||||
|
||||
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
||||
{
|
||||
if ((opencl_ctx->devices_status != STATUS_CRACKED) && (user_options->status != true))
|
||||
if ((status_ctx->devices_status != STATUS_CRACKED) && (user_options->status != true))
|
||||
{
|
||||
if (outfile_ctx->filename == NULL) if (quiet == false) send_prompt ();
|
||||
}
|
||||
@ -507,7 +508,7 @@ void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, cons
|
||||
}
|
||||
}
|
||||
|
||||
int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, const uint salt_pos)
|
||||
int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, status_ctx_t *status_ctx, const uint salt_pos)
|
||||
{
|
||||
salt_t *salt_buf = &hashes->salts_buf[salt_pos];
|
||||
|
||||
@ -569,7 +570,7 @@ int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, co
|
||||
}
|
||||
}
|
||||
|
||||
if (hashes->salts_done == hashes->salts_cnt) mycracked (opencl_ctx);
|
||||
if (hashes->salts_done == hashes->salts_cnt) mycracked (status_ctx);
|
||||
|
||||
check_hash (opencl_ctx, device_param, user_options, user_options_extra, straight_ctx, combinator_ctx, &cracked[i]);
|
||||
}
|
||||
@ -1240,7 +1241,7 @@ int hashes_init_stage1 (hashes_t *hashes, const hashconfig_t *hashconfig, potfil
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hashes_init_stage2 (hashes_t *hashes, const hashconfig_t *hashconfig, opencl_ctx_t *opencl_ctx, user_options_t *user_options)
|
||||
int hashes_init_stage2 (hashes_t *hashes, const hashconfig_t *hashconfig, user_options_t *user_options, status_ctx_t *status_ctx)
|
||||
{
|
||||
hash_t *hashes_buf = hashes->hashes_buf;
|
||||
uint hashes_cnt = hashes->hashes_cnt;
|
||||
@ -1425,7 +1426,7 @@ int hashes_init_stage2 (hashes_t *hashes, const hashconfig_t *hashconfig, opencl
|
||||
salts_done++;
|
||||
}
|
||||
|
||||
if (salts_done == salts_cnt) mycracked (opencl_ctx);
|
||||
if (salts_done == salts_cnt) mycracked (status_ctx);
|
||||
}
|
||||
|
||||
myfree (hashes->digests_buf);
|
||||
|
122
src/hashcat.c
122
src/hashcat.c
@ -68,19 +68,19 @@ const char *version_tag = VERSION_TAG;
|
||||
|
||||
// inner2_loop iterates through wordlists, then calls kernel execution
|
||||
|
||||
static int inner2_loop (user_options_t *user_options, user_options_extra_t *user_options_extra, restore_ctx_t *restore_ctx, logfile_ctx_t *logfile_ctx, induct_ctx_t *induct_ctx, dictstat_ctx_t *dictstat_ctx, loopback_ctx_t *loopback_ctx, opencl_ctx_t *opencl_ctx, hwmon_ctx_t *hwmon_ctx, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, wl_data_t *wl_data, straight_ctx_t *straight_ctx, combinator_ctx_t *combinator_ctx, mask_ctx_t *mask_ctx, status_ctx_t *status_ctx)
|
||||
static int inner2_loop (status_ctx_t *status_ctx, user_options_t *user_options, user_options_extra_t *user_options_extra, restore_ctx_t *restore_ctx, logfile_ctx_t *logfile_ctx, induct_ctx_t *induct_ctx, dictstat_ctx_t *dictstat_ctx, loopback_ctx_t *loopback_ctx, opencl_ctx_t *opencl_ctx, hwmon_ctx_t *hwmon_ctx, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, wl_data_t *wl_data, straight_ctx_t *straight_ctx, combinator_ctx_t *combinator_ctx, mask_ctx_t *mask_ctx)
|
||||
{
|
||||
//opencl_ctx->run_main_level1 = true;
|
||||
//opencl_ctx->run_main_level2 = true;
|
||||
//opencl_ctx->run_main_level3 = true;
|
||||
opencl_ctx->run_thread_level1 = true;
|
||||
opencl_ctx->run_thread_level2 = true;
|
||||
//status_ctx->run_main_level1 = true;
|
||||
//status_ctx->run_main_level2 = true;
|
||||
//status_ctx->run_main_level3 = true;
|
||||
status_ctx->run_thread_level1 = true;
|
||||
status_ctx->run_thread_level2 = true;
|
||||
|
||||
logfile_generate_subid (logfile_ctx);
|
||||
|
||||
logfile_sub_msg ("START");
|
||||
|
||||
status_ctx_reset (status_ctx, hashes);
|
||||
status_progress_reset (status_ctx, hashes);
|
||||
|
||||
data.words_cur = 0;
|
||||
|
||||
@ -316,7 +316,7 @@ static int inner2_loop (user_options_t *user_options, user_options_extra_t *user
|
||||
|
||||
hc_thread_t *c_threads = (hc_thread_t *) mycalloc (opencl_ctx->devices_cnt, sizeof (hc_thread_t));
|
||||
|
||||
opencl_ctx->devices_status = STATUS_AUTOTUNE;
|
||||
status_ctx->devices_status = STATUS_AUTOTUNE;
|
||||
|
||||
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
||||
{
|
||||
@ -377,7 +377,7 @@ static int inner2_loop (user_options_t *user_options, user_options_extra_t *user
|
||||
* create cracker threads
|
||||
*/
|
||||
|
||||
opencl_ctx->devices_status = STATUS_RUNNING;
|
||||
status_ctx->devices_status = STATUS_RUNNING;
|
||||
|
||||
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
||||
{
|
||||
@ -399,15 +399,15 @@ static int inner2_loop (user_options_t *user_options, user_options_extra_t *user
|
||||
|
||||
// calculate final status
|
||||
|
||||
if ((opencl_ctx->devices_status != STATUS_CRACKED)
|
||||
&& (opencl_ctx->devices_status != STATUS_ABORTED)
|
||||
&& (opencl_ctx->devices_status != STATUS_QUIT)
|
||||
&& (opencl_ctx->devices_status != STATUS_BYPASS))
|
||||
if ((status_ctx->devices_status != STATUS_CRACKED)
|
||||
&& (status_ctx->devices_status != STATUS_ABORTED)
|
||||
&& (status_ctx->devices_status != STATUS_QUIT)
|
||||
&& (status_ctx->devices_status != STATUS_BYPASS))
|
||||
{
|
||||
opencl_ctx->devices_status = STATUS_EXHAUSTED;
|
||||
status_ctx->devices_status = STATUS_EXHAUSTED;
|
||||
}
|
||||
|
||||
logfile_sub_var_uint ("status-after-work", opencl_ctx->devices_status);
|
||||
logfile_sub_var_uint ("status-after-work", status_ctx->devices_status);
|
||||
|
||||
// update some timer
|
||||
|
||||
@ -426,7 +426,7 @@ static int inner2_loop (user_options_t *user_options, user_options_extra_t *user
|
||||
|
||||
// no more skip and restore from here
|
||||
|
||||
if (opencl_ctx->devices_status == STATUS_EXHAUSTED)
|
||||
if (status_ctx->devices_status == STATUS_EXHAUSTED)
|
||||
{
|
||||
rd->words_cur = 0;
|
||||
}
|
||||
@ -482,11 +482,11 @@ static int inner2_loop (user_options_t *user_options, user_options_extra_t *user
|
||||
{
|
||||
for (induct_ctx->induction_dictionaries_pos = 0; induct_ctx->induction_dictionaries_pos < induct_ctx->induction_dictionaries_cnt; induct_ctx->induction_dictionaries_pos++)
|
||||
{
|
||||
const int rc_inner2_loop = inner2_loop (user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, wl_data, straight_ctx, combinator_ctx, mask_ctx, status_ctx);
|
||||
const int rc_inner2_loop = inner2_loop (status_ctx, user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, wl_data, straight_ctx, combinator_ctx, mask_ctx);
|
||||
|
||||
if (rc_inner2_loop == -1) return -1;
|
||||
|
||||
if (opencl_ctx->run_main_level3 == false) break;
|
||||
if (status_ctx->run_main_level3 == false) break;
|
||||
|
||||
unlink (induct_ctx->induction_dictionaries[induct_ctx->induction_dictionaries_pos]);
|
||||
}
|
||||
@ -502,13 +502,13 @@ static int inner2_loop (user_options_t *user_options, user_options_extra_t *user
|
||||
|
||||
// inner1_loop iterates through masks, then calls inner2_loop
|
||||
|
||||
static int inner1_loop (user_options_t *user_options, user_options_extra_t *user_options_extra, restore_ctx_t *restore_ctx, logfile_ctx_t *logfile_ctx, induct_ctx_t *induct_ctx, dictstat_ctx_t *dictstat_ctx, loopback_ctx_t *loopback_ctx, opencl_ctx_t *opencl_ctx, hwmon_ctx_t *hwmon_ctx, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, wl_data_t *wl_data, straight_ctx_t *straight_ctx, combinator_ctx_t *combinator_ctx, mask_ctx_t *mask_ctx, status_ctx_t *status_ctx)
|
||||
static int inner1_loop (status_ctx_t *status_ctx, user_options_t *user_options, user_options_extra_t *user_options_extra, restore_ctx_t *restore_ctx, logfile_ctx_t *logfile_ctx, induct_ctx_t *induct_ctx, dictstat_ctx_t *dictstat_ctx, loopback_ctx_t *loopback_ctx, opencl_ctx_t *opencl_ctx, hwmon_ctx_t *hwmon_ctx, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, wl_data_t *wl_data, straight_ctx_t *straight_ctx, combinator_ctx_t *combinator_ctx, mask_ctx_t *mask_ctx)
|
||||
{
|
||||
//opencl_ctx->run_main_level1 = true;
|
||||
//opencl_ctx->run_main_level2 = true;
|
||||
opencl_ctx->run_main_level3 = true;
|
||||
opencl_ctx->run_thread_level1 = true;
|
||||
opencl_ctx->run_thread_level2 = true;
|
||||
//status_ctx->run_main_level1 = true;
|
||||
//status_ctx->run_main_level2 = true;
|
||||
status_ctx->run_main_level3 = true;
|
||||
status_ctx->run_thread_level1 = true;
|
||||
status_ctx->run_thread_level2 = true;
|
||||
|
||||
/**
|
||||
* word len
|
||||
@ -1157,16 +1157,16 @@ static int inner1_loop (user_options_t *user_options, user_options_extra_t *user
|
||||
|
||||
straight_ctx->dicts_pos = dicts_pos;
|
||||
|
||||
const int rc_inner2_loop = inner2_loop (user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, wl_data, straight_ctx, combinator_ctx, mask_ctx, status_ctx);
|
||||
const int rc_inner2_loop = inner2_loop (status_ctx, user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, wl_data, straight_ctx, combinator_ctx, mask_ctx);
|
||||
|
||||
if (rc_inner2_loop == -1) return -1;
|
||||
|
||||
if (opencl_ctx->run_main_level3 == false) break;
|
||||
if (status_ctx->run_main_level3 == false) break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const int rc_inner2_loop = inner2_loop (user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, wl_data, straight_ctx, combinator_ctx, mask_ctx, status_ctx);
|
||||
const int rc_inner2_loop = inner2_loop (status_ctx, user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, wl_data, straight_ctx, combinator_ctx, mask_ctx);
|
||||
|
||||
if (rc_inner2_loop == -1) return -1;
|
||||
}
|
||||
@ -1176,15 +1176,15 @@ static int inner1_loop (user_options_t *user_options, user_options_extra_t *user
|
||||
|
||||
// outer_loop iterates through hash_modes (in benchmark mode)
|
||||
|
||||
static int outer_loop (user_options_t *user_options, user_options_extra_t *user_options_extra, restore_ctx_t *restore_ctx, folder_config_t *folder_config, logfile_ctx_t *logfile_ctx, tuning_db_t *tuning_db, induct_ctx_t *induct_ctx, outcheck_ctx_t *outcheck_ctx, outfile_ctx_t *outfile_ctx, potfile_ctx_t *potfile_ctx, dictstat_ctx_t *dictstat_ctx, loopback_ctx_t *loopback_ctx, opencl_ctx_t *opencl_ctx, hwmon_ctx_t *hwmon_ctx)
|
||||
static int outer_loop (status_ctx_t *status_ctx, user_options_t *user_options, user_options_extra_t *user_options_extra, restore_ctx_t *restore_ctx, folder_config_t *folder_config, logfile_ctx_t *logfile_ctx, tuning_db_t *tuning_db, induct_ctx_t *induct_ctx, outcheck_ctx_t *outcheck_ctx, outfile_ctx_t *outfile_ctx, potfile_ctx_t *potfile_ctx, dictstat_ctx_t *dictstat_ctx, loopback_ctx_t *loopback_ctx, opencl_ctx_t *opencl_ctx, hwmon_ctx_t *hwmon_ctx)
|
||||
{
|
||||
opencl_ctx->devices_status = STATUS_INIT;
|
||||
status_ctx->devices_status = STATUS_INIT;
|
||||
|
||||
//opencl_ctx->run_main_level1 = true;
|
||||
opencl_ctx->run_main_level2 = true;
|
||||
opencl_ctx->run_main_level3 = true;
|
||||
opencl_ctx->run_thread_level1 = true;
|
||||
opencl_ctx->run_thread_level2 = true;
|
||||
//status_ctx->run_main_level1 = true;
|
||||
status_ctx->run_main_level2 = true;
|
||||
status_ctx->run_main_level3 = true;
|
||||
status_ctx->run_thread_level1 = true;
|
||||
status_ctx->run_thread_level2 = true;
|
||||
|
||||
/**
|
||||
* setup prepare timer
|
||||
@ -1279,7 +1279,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
|
||||
|
||||
const u32 hashes_cnt_orig = hashes->hashes_cnt;
|
||||
|
||||
const int rc_hashes_init_stage2 = hashes_init_stage2 (hashes, hashconfig, opencl_ctx, user_options);
|
||||
const int rc_hashes_init_stage2 = hashes_init_stage2 (hashes, hashconfig, user_options, status_ctx);
|
||||
|
||||
if (rc_hashes_init_stage2 == -1) return -1;
|
||||
|
||||
@ -1358,14 +1358,10 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
|
||||
if (rc_mask_init == -1) return -1;
|
||||
|
||||
/**
|
||||
* status init
|
||||
* status progress init; needs hashes that's why we have to do it here and separate from status_ctx_init
|
||||
*/
|
||||
|
||||
status_ctx_t *status_ctx = (status_ctx_t *) mymalloc (sizeof (status_ctx_t));
|
||||
|
||||
data.status_ctx = status_ctx;
|
||||
|
||||
const int rc_status_init = status_ctx_init (status_ctx, hashes);
|
||||
const int rc_status_init = status_progress_init (status_ctx, hashes);
|
||||
|
||||
if (rc_status_init == -1) return -1;
|
||||
|
||||
@ -1495,7 +1491,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
|
||||
|
||||
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
|
||||
{
|
||||
weak_hash_check (opencl_ctx, device_param, user_options, user_options_extra, straight_ctx, combinator_ctx, hashconfig, hashes, cpt_ctx, salt_pos);
|
||||
weak_hash_check (opencl_ctx, device_param, user_options, user_options_extra, straight_ctx, combinator_ctx, hashconfig, hashes, cpt_ctx, status_ctx, salt_pos);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1565,16 +1561,16 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
|
||||
|
||||
mask_ctx->masks_pos = masks_pos;
|
||||
|
||||
const int rc_inner1_loop = inner1_loop (user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, wl_data, straight_ctx, combinator_ctx, mask_ctx, status_ctx);
|
||||
const int rc_inner1_loop = inner1_loop (status_ctx, user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, wl_data, straight_ctx, combinator_ctx, mask_ctx);
|
||||
|
||||
if (rc_inner1_loop == -1) return -1;
|
||||
|
||||
if (opencl_ctx->run_main_level2 == false) break;
|
||||
if (status_ctx->run_main_level2 == false) break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const int rc_inner1_loop = inner1_loop (user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, wl_data, straight_ctx, combinator_ctx, mask_ctx, status_ctx);
|
||||
const int rc_inner1_loop = inner1_loop (status_ctx, user_options, user_options_extra, restore_ctx, logfile_ctx, induct_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx, hashconfig, hashes, cpt_ctx, wl_data, straight_ctx, combinator_ctx, mask_ctx);
|
||||
|
||||
if (rc_inner1_loop == -1) return -1;
|
||||
}
|
||||
@ -1593,9 +1589,9 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
|
||||
// we dont need restore file anymore
|
||||
if (restore_ctx->enabled == true)
|
||||
{
|
||||
if ((opencl_ctx->devices_status == STATUS_EXHAUSTED) || (opencl_ctx->devices_status == STATUS_CRACKED))
|
||||
if ((status_ctx->devices_status == STATUS_EXHAUSTED) || (status_ctx->devices_status == STATUS_CRACKED))
|
||||
{
|
||||
if (opencl_ctx->run_thread_level1 == true) // this is to check for [c]heckpoint
|
||||
if (status_ctx->run_thread_level1 == true) // this is to check for [c]heckpoint
|
||||
{
|
||||
unlink (restore_ctx->eff_restore_file);
|
||||
unlink (restore_ctx->new_restore_file);
|
||||
@ -1621,7 +1617,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
|
||||
* Clean up
|
||||
*/
|
||||
|
||||
status_ctx_destroy (status_ctx);
|
||||
status_progress_destroy (status_ctx);
|
||||
|
||||
opencl_session_destroy (opencl_ctx);
|
||||
|
||||
@ -1675,6 +1671,18 @@ int main (int argc, char **argv)
|
||||
hc_thread_mutex_init (mux_display);
|
||||
hc_thread_mutex_init (mux_hwmon);
|
||||
|
||||
/**
|
||||
* status init
|
||||
*/
|
||||
|
||||
status_ctx_t *status_ctx = (status_ctx_t *) mymalloc (sizeof (status_ctx_t));
|
||||
|
||||
data.status_ctx = status_ctx;
|
||||
|
||||
const int rc_status_init = status_ctx_init (status_ctx);
|
||||
|
||||
if (rc_status_init == -1) return -1;
|
||||
|
||||
/**
|
||||
* folder
|
||||
*/
|
||||
@ -1961,7 +1969,7 @@ int main (int argc, char **argv)
|
||||
|
||||
if (user_options->hash_mode_chgd == true)
|
||||
{
|
||||
const int rc = outer_loop (user_options, user_options_extra, restore_ctx, folder_config, logfile_ctx, tuning_db, induct_ctx, outcheck_ctx, outfile_ctx, potfile_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx);
|
||||
const int rc = outer_loop (status_ctx, user_options, user_options_extra, restore_ctx, folder_config, logfile_ctx, tuning_db, induct_ctx, outcheck_ctx, outfile_ctx, potfile_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx);
|
||||
|
||||
if (rc == -1) return -1;
|
||||
}
|
||||
@ -1971,17 +1979,17 @@ int main (int argc, char **argv)
|
||||
{
|
||||
user_options->hash_mode = DEFAULT_BENCHMARK_ALGORITHMS_BUF[algorithm_pos];
|
||||
|
||||
const int rc = outer_loop (user_options, user_options_extra, restore_ctx, folder_config, logfile_ctx, tuning_db, induct_ctx, outcheck_ctx, outfile_ctx, potfile_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx);
|
||||
const int rc = outer_loop (status_ctx, user_options, user_options_extra, restore_ctx, folder_config, logfile_ctx, tuning_db, induct_ctx, outcheck_ctx, outfile_ctx, potfile_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx);
|
||||
|
||||
if (rc == -1) return -1;
|
||||
|
||||
if (opencl_ctx->run_main_level1 == false) break;
|
||||
if (status_ctx->run_main_level1 == false) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const int rc = outer_loop (user_options, user_options_extra, restore_ctx, folder_config, logfile_ctx, tuning_db, induct_ctx, outcheck_ctx, outfile_ctx, potfile_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx);
|
||||
const int rc = outer_loop (status_ctx, user_options, user_options_extra, restore_ctx, folder_config, logfile_ctx, tuning_db, induct_ctx, outcheck_ctx, outfile_ctx, potfile_ctx, dictstat_ctx, loopback_ctx, opencl_ctx, hwmon_ctx);
|
||||
|
||||
if (rc == -1) return -1;
|
||||
}
|
||||
@ -2052,12 +2060,14 @@ int main (int argc, char **argv)
|
||||
|
||||
u32 rc_final = -1;
|
||||
|
||||
if (opencl_ctx->devices_status == STATUS_ABORTED) rc_final = 2;
|
||||
if (opencl_ctx->devices_status == STATUS_QUIT) rc_final = 2;
|
||||
if (opencl_ctx->devices_status == STATUS_EXHAUSTED) rc_final = 1;
|
||||
if (opencl_ctx->devices_status == STATUS_CRACKED) rc_final = 0;
|
||||
if (status_ctx->devices_status == STATUS_ABORTED) rc_final = 2;
|
||||
if (status_ctx->devices_status == STATUS_QUIT) rc_final = 2;
|
||||
if (status_ctx->devices_status == STATUS_EXHAUSTED) rc_final = 1;
|
||||
if (status_ctx->devices_status == STATUS_CRACKED) rc_final = 0;
|
||||
|
||||
opencl_ctx_destroy (opencl_ctx);
|
||||
|
||||
status_ctx_destroy (status_ctx);
|
||||
|
||||
return rc_final;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ void *thread_monitor (void *p)
|
||||
{
|
||||
hc_sleep (sleep_time);
|
||||
|
||||
if (opencl_ctx->devices_status == STATUS_INIT) continue;
|
||||
if (status_ctx->devices_status == STATUS_INIT) continue;
|
||||
|
||||
if (hwmon_check == true)
|
||||
{
|
||||
@ -202,7 +202,7 @@ void *thread_monitor (void *p)
|
||||
{
|
||||
log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", device_id + 1);
|
||||
|
||||
myabort (opencl_ctx);
|
||||
myabort (status_ctx);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -295,7 +295,7 @@ void *thread_monitor (void *p)
|
||||
{
|
||||
double ms_paused = data.ms_paused;
|
||||
|
||||
if (opencl_ctx->devices_status == STATUS_PAUSED)
|
||||
if (status_ctx->devices_status == STATUS_PAUSED)
|
||||
{
|
||||
double ms_paused_tmp = 0;
|
||||
|
||||
@ -317,7 +317,7 @@ void *thread_monitor (void *p)
|
||||
if (user_options->quiet == false) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
|
||||
}
|
||||
|
||||
myabort (opencl_ctx);
|
||||
myabort (status_ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
46
src/opencl.c
46
src/opencl.c
@ -293,8 +293,7 @@ int gidd_to_pw_t (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, con
|
||||
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, const uint highest_pw_len, const uint pws_cnt, const uint fast_iteration, const uint salt_pos)
|
||||
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 uint highest_pw_len, const uint pws_cnt, const uint fast_iteration, const uint salt_pos)
|
||||
{
|
||||
cl_int CL_err = CL_SUCCESS;
|
||||
|
||||
@ -330,26 +329,26 @@ int choose_kernel (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, co
|
||||
|
||||
if (highest_pw_len < 16)
|
||||
{
|
||||
run_kernel (KERN_RUN_1, opencl_ctx, device_param, pws_cnt, true, fast_iteration, hashconfig, user_options);
|
||||
run_kernel (KERN_RUN_1, opencl_ctx, device_param, pws_cnt, true, fast_iteration, hashconfig, user_options, status_ctx);
|
||||
}
|
||||
else if (highest_pw_len < 32)
|
||||
{
|
||||
run_kernel (KERN_RUN_2, opencl_ctx, device_param, pws_cnt, true, fast_iteration, hashconfig, user_options);
|
||||
run_kernel (KERN_RUN_2, opencl_ctx, device_param, pws_cnt, true, fast_iteration, hashconfig, user_options, status_ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
run_kernel (KERN_RUN_3, opencl_ctx, device_param, pws_cnt, true, fast_iteration, hashconfig, user_options);
|
||||
run_kernel (KERN_RUN_3, opencl_ctx, device_param, pws_cnt, true, fast_iteration, hashconfig, user_options, status_ctx);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
run_kernel_amp (opencl_ctx, device_param, pws_cnt);
|
||||
|
||||
run_kernel (KERN_RUN_1, opencl_ctx, device_param, pws_cnt, false, 0, hashconfig, user_options);
|
||||
run_kernel (KERN_RUN_1, opencl_ctx, device_param, pws_cnt, false, 0, hashconfig, user_options, status_ctx);
|
||||
|
||||
if (hashconfig->opts_type & OPTS_TYPE_HOOK12)
|
||||
{
|
||||
run_kernel (KERN_RUN_12, opencl_ctx, device_param, pws_cnt, false, 0, hashconfig, user_options);
|
||||
run_kernel (KERN_RUN_12, opencl_ctx, device_param, pws_cnt, false, 0, hashconfig, user_options, status_ctx);
|
||||
|
||||
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);
|
||||
|
||||
@ -385,9 +384,9 @@ 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[29] = loop_left;
|
||||
|
||||
run_kernel (KERN_RUN_2, opencl_ctx, device_param, pws_cnt, true, slow_iteration, hashconfig, user_options);
|
||||
run_kernel (KERN_RUN_2, opencl_ctx, device_param, pws_cnt, true, slow_iteration, hashconfig, user_options, status_ctx);
|
||||
|
||||
while (opencl_ctx->run_thread_level2 == false) break;
|
||||
while (status_ctx->run_thread_level2 == false) break;
|
||||
|
||||
/**
|
||||
* speed
|
||||
@ -415,7 +414,7 @@ int choose_kernel (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, co
|
||||
|
||||
if (hashconfig->opts_type & OPTS_TYPE_HOOK23)
|
||||
{
|
||||
run_kernel (KERN_RUN_23, opencl_ctx, device_param, pws_cnt, false, 0, hashconfig, user_options);
|
||||
run_kernel (KERN_RUN_23, opencl_ctx, device_param, pws_cnt, false, 0, hashconfig, user_options, status_ctx);
|
||||
|
||||
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);
|
||||
|
||||
@ -438,13 +437,13 @@ 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);
|
||||
run_kernel (KERN_RUN_3, opencl_ctx, device_param, pws_cnt, false, 0, hashconfig, user_options, status_ctx);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int run_kernel (const uint kern_run, opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const uint num, const uint event_update, const uint iteration, hashconfig_t *hashconfig, const user_options_t *user_options)
|
||||
int run_kernel (const uint kern_run, opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const uint num, const uint event_update, const uint iteration, hashconfig_t *hashconfig, const user_options_t *user_options, status_ctx_t *status_ctx)
|
||||
{
|
||||
cl_int CL_err = CL_SUCCESS;
|
||||
|
||||
@ -538,7 +537,7 @@ int run_kernel (const uint kern_run, opencl_ctx_t *opencl_ctx, hc_device_param_t
|
||||
|
||||
if (device_param->nvidia_spin_damp > 0)
|
||||
{
|
||||
if (opencl_ctx->devices_status == STATUS_RUNNING)
|
||||
if (status_ctx->devices_status == STATUS_RUNNING)
|
||||
{
|
||||
if (iteration < EXPECTED_ITERATIONS)
|
||||
{
|
||||
@ -576,7 +575,7 @@ int run_kernel (const uint kern_run, opencl_ctx_t *opencl_ctx, hc_device_param_t
|
||||
|
||||
const double exec_us = (double) (time_end - time_start) / 1000;
|
||||
|
||||
if (opencl_ctx->devices_status == STATUS_RUNNING)
|
||||
if (status_ctx->devices_status == STATUS_RUNNING)
|
||||
{
|
||||
if (iteration < EXPECTED_ITERATIONS)
|
||||
{
|
||||
@ -1046,7 +1045,7 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
|
||||
|
||||
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
|
||||
{
|
||||
while (opencl_ctx->devices_status == STATUS_PAUSED) hc_sleep (1);
|
||||
while (status_ctx->devices_status == STATUS_PAUSED) hc_sleep (1);
|
||||
|
||||
salt_t *salt_buf = &hashes->salts_buf[salt_pos];
|
||||
|
||||
@ -1077,7 +1076,7 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
|
||||
|
||||
for (uint innerloop_pos = 0; innerloop_pos < innerloop_cnt; innerloop_pos += innerloop_step)
|
||||
{
|
||||
while (opencl_ctx->devices_status == STATUS_PAUSED) hc_sleep (1);
|
||||
while (status_ctx->devices_status == STATUS_PAUSED) hc_sleep (1);
|
||||
|
||||
uint fast_iteration = 0;
|
||||
|
||||
@ -1281,7 +1280,7 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
|
||||
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, highest_pw_len, pws_cnt, fast_iteration, salt_pos);
|
||||
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);
|
||||
|
||||
if (rc == -1) return -1;
|
||||
|
||||
@ -1291,7 +1290,7 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
|
||||
|
||||
if (user_options->benchmark == false)
|
||||
{
|
||||
check_cracked (opencl_ctx, device_param, user_options, user_options_extra, straight_ctx, combinator_ctx, hashconfig, hashes, cpt_ctx, salt_pos);
|
||||
check_cracked (opencl_ctx, device_param, user_options, user_options_extra, straight_ctx, combinator_ctx, hashconfig, hashes, cpt_ctx, status_ctx, salt_pos);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1339,10 +1338,10 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
|
||||
|
||||
if (user_options->benchmark == true) break;
|
||||
|
||||
if (opencl_ctx->run_thread_level2 == false) break;
|
||||
if (status_ctx->run_thread_level2 == false) break;
|
||||
}
|
||||
|
||||
if (opencl_ctx->run_thread_level2 == false) break;
|
||||
if (status_ctx->run_thread_level2 == false) break;
|
||||
}
|
||||
|
||||
device_param->speed_pos = speed_pos;
|
||||
@ -1363,13 +1362,6 @@ int opencl_ctx_init (opencl_ctx_t *opencl_ctx, const user_options_t *user_option
|
||||
hc_thread_mutex_init (opencl_ctx->mux_dispatcher);
|
||||
hc_thread_mutex_init (opencl_ctx->mux_counter);
|
||||
|
||||
opencl_ctx->devices_status = STATUS_INIT;
|
||||
opencl_ctx->run_main_level1 = true;
|
||||
opencl_ctx->run_main_level2 = true;
|
||||
opencl_ctx->run_main_level3 = true;
|
||||
opencl_ctx->run_thread_level1 = true;
|
||||
opencl_ctx->run_thread_level2 = true;
|
||||
|
||||
opencl_ctx->ocl = (OCL_PTR *) mymalloc (sizeof (OCL_PTR));
|
||||
|
||||
hc_device_param_t *devices_param = (hc_device_param_t *) mycalloc (DEVICES_MAX, sizeof (hc_device_param_t));
|
||||
|
@ -39,11 +39,11 @@ void *thread_outfile_remove (void *p)
|
||||
{
|
||||
// some hash-dependent constants
|
||||
|
||||
user_options_t *user_options = data.user_options;
|
||||
hashconfig_t *hashconfig = data.hashconfig;
|
||||
hashes_t *hashes = data.hashes;
|
||||
outcheck_ctx_t *outcheck_ctx = data.outcheck_ctx;
|
||||
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
|
||||
status_ctx_t *status_ctx = data.status_ctx;
|
||||
user_options_t *user_options = data.user_options;
|
||||
|
||||
uint dgst_size = hashconfig->dgst_size;
|
||||
uint is_salted = hashconfig->is_salted;
|
||||
@ -78,7 +78,7 @@ void *thread_outfile_remove (void *p)
|
||||
{
|
||||
hc_sleep (1);
|
||||
|
||||
if (opencl_ctx->devices_status != STATUS_RUNNING) continue;
|
||||
if (status_ctx->devices_status != STATUS_RUNNING) continue;
|
||||
|
||||
check_left--;
|
||||
|
||||
@ -284,23 +284,23 @@ void *thread_outfile_remove (void *p)
|
||||
|
||||
hashes->salts_done++;
|
||||
|
||||
if (hashes->salts_done == hashes->salts_cnt) mycracked (opencl_ctx);
|
||||
if (hashes->salts_done == hashes->salts_cnt) mycracked (status_ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (opencl_ctx->devices_status == STATUS_CRACKED) break;
|
||||
if (status_ctx->devices_status == STATUS_CRACKED) break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found) break;
|
||||
|
||||
if (opencl_ctx->devices_status == STATUS_CRACKED) break;
|
||||
if (status_ctx->devices_status == STATUS_CRACKED) break;
|
||||
|
||||
iter--;
|
||||
}
|
||||
|
||||
if (opencl_ctx->devices_status == STATUS_CRACKED) break;
|
||||
if (status_ctx->devices_status == STATUS_CRACKED) break;
|
||||
}
|
||||
|
||||
myfree (line_buf);
|
||||
|
@ -304,7 +304,7 @@ void cycle_restore (restore_ctx_t *restore_ctx, opencl_ctx_t *opencl_ctx)
|
||||
}
|
||||
}
|
||||
|
||||
void stop_at_checkpoint (restore_ctx_t *restore_ctx, opencl_ctx_t *opencl_ctx)
|
||||
void stop_at_checkpoint (restore_ctx_t *restore_ctx, status_ctx_t *status_ctx)
|
||||
{
|
||||
// this feature only makes sense if --restore-disable was not specified
|
||||
|
||||
@ -315,25 +315,25 @@ void stop_at_checkpoint (restore_ctx_t *restore_ctx, opencl_ctx_t *opencl_ctx)
|
||||
return;
|
||||
}
|
||||
|
||||
if (opencl_ctx->devices_status != STATUS_RUNNING) return;
|
||||
if (status_ctx->devices_status != STATUS_RUNNING) return;
|
||||
|
||||
if ((opencl_ctx->run_thread_level1 == true) && (opencl_ctx->run_thread_level2 == true))
|
||||
if ((status_ctx->run_thread_level1 == true) && (status_ctx->run_thread_level2 == true))
|
||||
{
|
||||
opencl_ctx->run_main_level1 = false;
|
||||
opencl_ctx->run_main_level2 = false;
|
||||
opencl_ctx->run_main_level3 = false;
|
||||
opencl_ctx->run_thread_level1 = false;
|
||||
opencl_ctx->run_thread_level2 = true;
|
||||
status_ctx->run_main_level1 = false;
|
||||
status_ctx->run_main_level2 = false;
|
||||
status_ctx->run_main_level3 = false;
|
||||
status_ctx->run_thread_level1 = false;
|
||||
status_ctx->run_thread_level2 = true;
|
||||
|
||||
log_info ("Checkpoint enabled: Will quit at next Restore Point update");
|
||||
}
|
||||
else
|
||||
{
|
||||
opencl_ctx->run_main_level1 = true;
|
||||
opencl_ctx->run_main_level2 = true;
|
||||
opencl_ctx->run_main_level3 = true;
|
||||
opencl_ctx->run_thread_level1 = true;
|
||||
opencl_ctx->run_thread_level2 = true;
|
||||
status_ctx->run_main_level1 = true;
|
||||
status_ctx->run_main_level2 = true;
|
||||
status_ctx->run_main_level3 = true;
|
||||
status_ctx->run_thread_level1 = true;
|
||||
status_ctx->run_thread_level2 = true;
|
||||
|
||||
log_info ("Checkpoint disabled: Restore Point updates will no longer be monitored");
|
||||
}
|
||||
|
47
src/status.c
47
src/status.c
@ -166,7 +166,7 @@ double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_en
|
||||
|
||||
void status_display_machine_readable (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const hwmon_ctx_t *hwmon_ctx, const hashes_t *hashes, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx)
|
||||
{
|
||||
if (opencl_ctx->devices_status == STATUS_INIT)
|
||||
if (status_ctx->devices_status == STATUS_INIT)
|
||||
{
|
||||
log_error ("ERROR: status view is not available during initialization phase");
|
||||
|
||||
@ -175,7 +175,7 @@ void status_display_machine_readable (status_ctx_t *status_ctx, opencl_ctx_t *op
|
||||
|
||||
FILE *out = stdout;
|
||||
|
||||
fprintf (out, "STATUS\t%u\t", opencl_ctx->devices_status);
|
||||
fprintf (out, "STATUS\t%u\t", status_ctx->devices_status);
|
||||
|
||||
/**
|
||||
* speed new
|
||||
@ -315,7 +315,7 @@ void status_display_machine_readable (status_ctx_t *status_ctx, opencl_ctx_t *op
|
||||
|
||||
void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const hwmon_ctx_t *hwmon_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const cpt_ctx_t *cpt_ctx, const restore_ctx_t *restore_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx)
|
||||
{
|
||||
if (opencl_ctx->devices_status == STATUS_INIT)
|
||||
if (status_ctx->devices_status == STATUS_INIT)
|
||||
{
|
||||
log_error ("ERROR: status view is not available during initialization phase");
|
||||
|
||||
@ -338,7 +338,7 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h
|
||||
|
||||
log_info ("Session.Name...: %s", user_options->session);
|
||||
|
||||
char *status_type = strstatus (opencl_ctx->devices_status);
|
||||
char *status_type = strstatus (status_ctx->devices_status);
|
||||
|
||||
uint hash_mode = hashconfig->hash_mode;
|
||||
|
||||
@ -428,7 +428,7 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h
|
||||
|
||||
if (mask_ctx->masks_cnt > 1)
|
||||
{
|
||||
const int maks_pos_done = ((opencl_ctx->devices_status == STATUS_EXHAUSTED) && (opencl_ctx->run_main_level1 == true)) ? 1 : 0;
|
||||
const int maks_pos_done = ((status_ctx->devices_status == STATUS_EXHAUSTED) && (status_ctx->run_main_level1 == true)) ? 1 : 0;
|
||||
|
||||
double mask_percentage = (double) (mask_ctx->masks_pos + maks_pos_done) / (double) mask_ctx->masks_cnt;
|
||||
|
||||
@ -629,7 +629,7 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h
|
||||
|
||||
double ms_paused = data.ms_paused;
|
||||
|
||||
if (opencl_ctx->devices_status == STATUS_PAUSED)
|
||||
if (status_ctx->devices_status == STATUS_PAUSED)
|
||||
{
|
||||
double ms_paused_tmp = 0;
|
||||
|
||||
@ -749,7 +749,7 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h
|
||||
|
||||
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
||||
{
|
||||
if (opencl_ctx->devices_status != STATUS_CRACKED)
|
||||
if (status_ctx->devices_status != STATUS_CRACKED)
|
||||
{
|
||||
#if defined (_WIN)
|
||||
__time64_t sec_etc = 0;
|
||||
@ -1014,7 +1014,7 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h
|
||||
}
|
||||
}
|
||||
|
||||
if (opencl_ctx->run_main_level1 == false) return;
|
||||
if (status_ctx->run_main_level1 == false) return;
|
||||
|
||||
if (user_options->gpu_temp_disable == false)
|
||||
{
|
||||
@ -1105,7 +1105,7 @@ void status_benchmark_automate (status_ctx_t *status_ctx, opencl_ctx_t *opencl_c
|
||||
{
|
||||
if (status_ctx == NULL) status_ctx = status_ctx; // make gcc happy, for now...
|
||||
|
||||
if (opencl_ctx->devices_status == STATUS_INIT)
|
||||
if (status_ctx->devices_status == STATUS_INIT)
|
||||
{
|
||||
log_error ("ERROR: status view is not available during initialization phase");
|
||||
|
||||
@ -1153,7 +1153,7 @@ void status_benchmark_automate (status_ctx_t *status_ctx, opencl_ctx_t *opencl_c
|
||||
|
||||
void status_benchmark (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const user_options_t *user_options)
|
||||
{
|
||||
if (opencl_ctx->devices_status == STATUS_INIT)
|
||||
if (status_ctx->devices_status == STATUS_INIT)
|
||||
{
|
||||
log_error ("ERROR: status view is not available during initialization phase");
|
||||
|
||||
@ -1250,7 +1250,7 @@ void status_benchmark (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const
|
||||
if (opencl_ctx->devices_active > 1) log_info ("Speed.Dev.#*.: %9sH/s", display_all_cur);
|
||||
}
|
||||
|
||||
int status_ctx_init (status_ctx_t *status_ctx, const hashes_t *hashes)
|
||||
int status_progress_init (status_ctx_t *status_ctx, const hashes_t *hashes)
|
||||
{
|
||||
status_ctx->words_progress_done = (u64 *) mycalloc (hashes->salts_cnt, sizeof (u64));
|
||||
status_ctx->words_progress_rejected = (u64 *) mycalloc (hashes->salts_cnt, sizeof (u64));
|
||||
@ -1259,19 +1259,36 @@ int status_ctx_init (status_ctx_t *status_ctx, const hashes_t *hashes)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void status_ctx_destroy (status_ctx_t *status_ctx)
|
||||
void status_progress_destroy (status_ctx_t *status_ctx)
|
||||
{
|
||||
myfree (status_ctx->words_progress_done);
|
||||
myfree (status_ctx->words_progress_rejected);
|
||||
myfree (status_ctx->words_progress_restored);
|
||||
|
||||
myfree (status_ctx);
|
||||
}
|
||||
|
||||
void status_ctx_reset (status_ctx_t *status_ctx, const hashes_t *hashes)
|
||||
void status_progress_reset (status_ctx_t *status_ctx, const hashes_t *hashes)
|
||||
{
|
||||
memset (status_ctx->words_progress_done, 0, hashes->salts_cnt * sizeof (u64));
|
||||
memset (status_ctx->words_progress_rejected, 0, hashes->salts_cnt * sizeof (u64));
|
||||
memset (status_ctx->words_progress_restored, 0, hashes->salts_cnt * sizeof (u64));
|
||||
}
|
||||
|
||||
int status_ctx_init (status_ctx_t *status_ctx)
|
||||
{
|
||||
status_ctx->devices_status = STATUS_INIT;
|
||||
|
||||
status_ctx->run_main_level1 = true;
|
||||
status_ctx->run_main_level2 = true;
|
||||
status_ctx->run_main_level3 = true;
|
||||
status_ctx->run_thread_level1 = true;
|
||||
status_ctx->run_thread_level2 = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void status_ctx_destroy (status_ctx_t *status_ctx)
|
||||
{
|
||||
|
||||
|
||||
myfree (status_ctx);
|
||||
}
|
||||
|
@ -135,21 +135,21 @@ void clear_prompt ()
|
||||
|
||||
void *thread_keypress (void *p)
|
||||
{
|
||||
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
|
||||
status_ctx_t *status_ctx = data.status_ctx;
|
||||
|
||||
while (opencl_ctx->devices_status == STATUS_INIT) hc_sleep_ms (100);
|
||||
while (status_ctx->devices_status == STATUS_INIT) hc_sleep_ms (100);
|
||||
|
||||
restore_ctx_t *restore_ctx = data.restore_ctx;
|
||||
user_options_t *user_options = data.user_options;
|
||||
user_options_extra_t *user_options_extra = data.user_options_extra;
|
||||
combinator_ctx_t *combinator_ctx = data.combinator_ctx;
|
||||
cpt_ctx_t *cpt_ctx = data.cpt_ctx;
|
||||
hashconfig_t *hashconfig = data.hashconfig;
|
||||
hashes_t *hashes = data.hashes;
|
||||
cpt_ctx_t *cpt_ctx = data.cpt_ctx;
|
||||
straight_ctx_t *straight_ctx = data.straight_ctx;
|
||||
combinator_ctx_t *combinator_ctx = data.combinator_ctx;
|
||||
mask_ctx_t *mask_ctx = data.mask_ctx;
|
||||
hwmon_ctx_t *hwmon_ctx = data.hwmon_ctx;
|
||||
status_ctx_t *status_ctx = data.status_ctx;
|
||||
mask_ctx_t *mask_ctx = data.mask_ctx;
|
||||
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
|
||||
restore_ctx_t *restore_ctx = data.restore_ctx;
|
||||
straight_ctx_t *straight_ctx = data.straight_ctx;
|
||||
user_options_extra_t *user_options_extra = data.user_options_extra;
|
||||
user_options_t *user_options = data.user_options;
|
||||
|
||||
const bool quiet = user_options->quiet;
|
||||
|
||||
@ -192,7 +192,7 @@ void *thread_keypress (void *p)
|
||||
|
||||
log_info ("");
|
||||
|
||||
bypass (opencl_ctx);
|
||||
bypass (status_ctx);
|
||||
|
||||
log_info ("");
|
||||
|
||||
@ -204,7 +204,7 @@ void *thread_keypress (void *p)
|
||||
|
||||
log_info ("");
|
||||
|
||||
SuspendThreads (opencl_ctx);
|
||||
SuspendThreads (status_ctx);
|
||||
|
||||
log_info ("");
|
||||
|
||||
@ -216,7 +216,7 @@ void *thread_keypress (void *p)
|
||||
|
||||
log_info ("");
|
||||
|
||||
ResumeThreads (opencl_ctx);
|
||||
ResumeThreads (status_ctx);
|
||||
|
||||
log_info ("");
|
||||
|
||||
@ -228,7 +228,7 @@ void *thread_keypress (void *p)
|
||||
|
||||
log_info ("");
|
||||
|
||||
stop_at_checkpoint (restore_ctx, opencl_ctx);
|
||||
stop_at_checkpoint (restore_ctx, status_ctx);
|
||||
|
||||
log_info ("");
|
||||
|
||||
@ -240,7 +240,7 @@ void *thread_keypress (void *p)
|
||||
|
||||
log_info ("");
|
||||
|
||||
myabort (opencl_ctx);
|
||||
myabort (status_ctx);
|
||||
|
||||
break;
|
||||
}
|
||||
|
80
src/thread.c
80
src/thread.c
@ -117,14 +117,14 @@ void hc_signal (BOOL WINAPI (callback) (DWORD))
|
||||
|
||||
void sigHandler_default (int sig)
|
||||
{
|
||||
myabort (data.opencl_ctx);
|
||||
myabort (data.status_ctx);
|
||||
|
||||
signal (sig, NULL);
|
||||
}
|
||||
|
||||
void sigHandler_benchmark (int sig)
|
||||
{
|
||||
myquit (data.opencl_ctx);
|
||||
myquit (data.status_ctx);
|
||||
|
||||
signal (sig, NULL);
|
||||
}
|
||||
@ -140,74 +140,74 @@ void hc_signal (void (callback) (int))
|
||||
|
||||
#endif
|
||||
|
||||
void mycracked (opencl_ctx_t *opencl_ctx)
|
||||
void mycracked (status_ctx_t *status_ctx)
|
||||
{
|
||||
if (opencl_ctx->devices_status != STATUS_RUNNING) return;
|
||||
if (status_ctx->devices_status != STATUS_RUNNING) return;
|
||||
|
||||
opencl_ctx->devices_status = STATUS_CRACKED;
|
||||
status_ctx->devices_status = STATUS_CRACKED;
|
||||
|
||||
opencl_ctx->run_main_level1 = false;
|
||||
opencl_ctx->run_main_level2 = false;
|
||||
opencl_ctx->run_main_level3 = false;
|
||||
opencl_ctx->run_thread_level1 = false;
|
||||
opencl_ctx->run_thread_level2 = false;
|
||||
status_ctx->run_main_level1 = false;
|
||||
status_ctx->run_main_level2 = false;
|
||||
status_ctx->run_main_level3 = false;
|
||||
status_ctx->run_thread_level1 = false;
|
||||
status_ctx->run_thread_level2 = false;
|
||||
}
|
||||
|
||||
void myabort (opencl_ctx_t *opencl_ctx)
|
||||
void myabort (status_ctx_t *status_ctx)
|
||||
{
|
||||
if (opencl_ctx->devices_status != STATUS_RUNNING) return;
|
||||
if (status_ctx->devices_status != STATUS_RUNNING) return;
|
||||
|
||||
opencl_ctx->devices_status = STATUS_ABORTED;
|
||||
status_ctx->devices_status = STATUS_ABORTED;
|
||||
|
||||
opencl_ctx->run_main_level1 = false;
|
||||
opencl_ctx->run_main_level2 = false;
|
||||
opencl_ctx->run_main_level3 = false;
|
||||
opencl_ctx->run_thread_level1 = false;
|
||||
opencl_ctx->run_thread_level2 = false;
|
||||
status_ctx->run_main_level1 = false;
|
||||
status_ctx->run_main_level2 = false;
|
||||
status_ctx->run_main_level3 = false;
|
||||
status_ctx->run_thread_level1 = false;
|
||||
status_ctx->run_thread_level2 = false;
|
||||
}
|
||||
|
||||
void myquit (opencl_ctx_t *opencl_ctx)
|
||||
void myquit (status_ctx_t *status_ctx)
|
||||
{
|
||||
if (opencl_ctx->devices_status != STATUS_RUNNING) return;
|
||||
if (status_ctx->devices_status != STATUS_RUNNING) return;
|
||||
|
||||
opencl_ctx->devices_status = STATUS_QUIT;
|
||||
status_ctx->devices_status = STATUS_QUIT;
|
||||
|
||||
opencl_ctx->run_main_level1 = false;
|
||||
opencl_ctx->run_main_level2 = false;
|
||||
opencl_ctx->run_main_level3 = false;
|
||||
opencl_ctx->run_thread_level1 = false;
|
||||
opencl_ctx->run_thread_level2 = false;
|
||||
status_ctx->run_main_level1 = false;
|
||||
status_ctx->run_main_level2 = false;
|
||||
status_ctx->run_main_level3 = false;
|
||||
status_ctx->run_thread_level1 = false;
|
||||
status_ctx->run_thread_level2 = false;
|
||||
}
|
||||
|
||||
void bypass (opencl_ctx_t *opencl_ctx)
|
||||
void bypass (status_ctx_t *status_ctx)
|
||||
{
|
||||
if (opencl_ctx->devices_status != STATUS_RUNNING) return;
|
||||
if (status_ctx->devices_status != STATUS_RUNNING) return;
|
||||
|
||||
opencl_ctx->devices_status = STATUS_BYPASS;
|
||||
status_ctx->devices_status = STATUS_BYPASS;
|
||||
|
||||
opencl_ctx->run_main_level1 = true;
|
||||
opencl_ctx->run_main_level2 = true;
|
||||
opencl_ctx->run_main_level3 = true;
|
||||
opencl_ctx->run_thread_level1 = false;
|
||||
opencl_ctx->run_thread_level2 = false;
|
||||
status_ctx->run_main_level1 = true;
|
||||
status_ctx->run_main_level2 = true;
|
||||
status_ctx->run_main_level3 = true;
|
||||
status_ctx->run_thread_level1 = false;
|
||||
status_ctx->run_thread_level2 = false;
|
||||
|
||||
log_info ("Next dictionary / mask in queue selected, bypassing current one");
|
||||
}
|
||||
|
||||
void SuspendThreads (opencl_ctx_t *opencl_ctx)
|
||||
void SuspendThreads (status_ctx_t *status_ctx)
|
||||
{
|
||||
if (opencl_ctx->devices_status != STATUS_RUNNING) return;
|
||||
if (status_ctx->devices_status != STATUS_RUNNING) return;
|
||||
|
||||
hc_timer_set (&data.timer_paused);
|
||||
|
||||
opencl_ctx->devices_status = STATUS_PAUSED;
|
||||
status_ctx->devices_status = STATUS_PAUSED;
|
||||
|
||||
log_info ("Paused");
|
||||
}
|
||||
|
||||
void ResumeThreads (opencl_ctx_t *opencl_ctx)
|
||||
void ResumeThreads (status_ctx_t *status_ctx)
|
||||
{
|
||||
if (opencl_ctx->devices_status != STATUS_PAUSED) return;
|
||||
if (status_ctx->devices_status != STATUS_PAUSED) return;
|
||||
|
||||
double ms_paused;
|
||||
|
||||
@ -215,7 +215,7 @@ void ResumeThreads (opencl_ctx_t *opencl_ctx)
|
||||
|
||||
data.ms_paused += ms_paused;
|
||||
|
||||
opencl_ctx->devices_status = STATUS_RUNNING;
|
||||
status_ctx->devices_status = STATUS_RUNNING;
|
||||
|
||||
log_info ("Resumed");
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "hash_management.h"
|
||||
#include "weak_hash.h"
|
||||
|
||||
void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, const uint salt_pos)
|
||||
void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, status_ctx_t *status_ctx, const uint salt_pos)
|
||||
{
|
||||
salt_t *salt_buf = &hashes->salts_buf[salt_pos];
|
||||
|
||||
@ -31,11 +31,11 @@ void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param,
|
||||
|
||||
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
|
||||
{
|
||||
run_kernel (KERN_RUN_1, opencl_ctx, device_param, 1, false, 0, hashconfig, user_options);
|
||||
run_kernel (KERN_RUN_1, opencl_ctx, device_param, 1, false, 0, hashconfig, user_options, status_ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
run_kernel (KERN_RUN_1, opencl_ctx, device_param, 1, false, 0, hashconfig, user_options);
|
||||
run_kernel (KERN_RUN_1, opencl_ctx, device_param, 1, false, 0, hashconfig, user_options, status_ctx);
|
||||
|
||||
uint loop_step = 16;
|
||||
|
||||
@ -50,17 +50,17 @@ void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param,
|
||||
device_param->kernel_params_buf32[28] = loop_pos;
|
||||
device_param->kernel_params_buf32[29] = loop_left;
|
||||
|
||||
run_kernel (KERN_RUN_2, opencl_ctx, device_param, 1, false, 0, hashconfig, user_options);
|
||||
run_kernel (KERN_RUN_2, opencl_ctx, device_param, 1, false, 0, hashconfig, user_options, status_ctx);
|
||||
}
|
||||
|
||||
run_kernel (KERN_RUN_3, opencl_ctx, device_param, 1, false, 0, hashconfig, user_options);
|
||||
run_kernel (KERN_RUN_3, opencl_ctx, device_param, 1, false, 0, hashconfig, user_options, status_ctx);
|
||||
}
|
||||
|
||||
/**
|
||||
* result
|
||||
*/
|
||||
|
||||
check_cracked (opencl_ctx, device_param, user_options, user_options_extra, straight_ctx, combinator_ctx, hashconfig, hashes, cpt_ctx, salt_pos);
|
||||
check_cracked (opencl_ctx, device_param, user_options, user_options_extra, straight_ctx, combinator_ctx, hashconfig, hashes, cpt_ctx, status_ctx, salt_pos);
|
||||
|
||||
/**
|
||||
* cleanup
|
||||
|
Loading…
Reference in New Issue
Block a user