diff --git a/include/status.h b/include/status.h index 2d3abe618..2799f5def 100644 --- a/include/status.h +++ b/include/status.h @@ -12,16 +12,16 @@ double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_entries); -void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx); -void status_display (hashcat_ctx_t *hashcat_ctx); -void status_benchmark_automate (hashcat_ctx_t *hashcat_ctx); -void status_benchmark (hashcat_ctx_t *hashcat_ctx); +void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx); +void status_display (hashcat_ctx_t *hashcat_ctx); +void status_benchmark_automate (hashcat_ctx_t *hashcat_ctx); +void status_benchmark (hashcat_ctx_t *hashcat_ctx); -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_progress_init (hashcat_ctx_t *hashcat_ctx); +void status_progress_destroy (hashcat_ctx_t *hashcat_ctx); +void status_progress_reset (hashcat_ctx_t *hashcat_ctx); -int status_ctx_init (status_ctx_t *status_ctx); -void status_ctx_destroy (status_ctx_t *status_ctx); +int status_ctx_init (hashcat_ctx_t *hashcat_ctx); +void status_ctx_destroy (hashcat_ctx_t *hashcat_ctx); #endif // _STATUS_H diff --git a/src/hashcat.c b/src/hashcat.c index 1f82efe61..d0445772b 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -145,7 +145,7 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx) logfile_sub_msg ("START"); - status_progress_reset (status_ctx, hashes); + status_progress_reset (hashcat_ctx); status_ctx->words_cur = 0; @@ -979,7 +979,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx) * status progress init; needs hashes that's why we have to do it here and separate from status_ctx_init */ - const int rc_status_init = status_progress_init (status_ctx, hashes); + const int rc_status_init = status_progress_init (hashcat_ctx); if (rc_status_init == -1) return -1; @@ -1214,7 +1214,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx) * Clean up */ - status_progress_destroy (status_ctx); + status_progress_destroy (hashcat_ctx); opencl_session_destroy (opencl_ctx); @@ -1274,7 +1274,7 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, char *install_folder, char *shared_fold * status init */ - const int rc_status_init = status_ctx_init (status_ctx); + const int rc_status_init = status_ctx_init (hashcat_ctx); if (rc_status_init == -1) return -1; @@ -1559,7 +1559,7 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, char *install_folder, char *shared_fold if (status_ctx->devices_status == STATUS_EXHAUSTED) rc_final = 1; if (status_ctx->devices_status == STATUS_CRACKED) rc_final = 0; - status_ctx_destroy (status_ctx); + status_ctx_destroy (hashcat_ctx); return rc_final; } diff --git a/src/status.c b/src/status.c index 86f47da96..a9bc66819 100644 --- a/src/status.c +++ b/src/status.c @@ -1349,8 +1349,11 @@ void status_benchmark (hashcat_ctx_t *hashcat_ctx) if (opencl_ctx->devices_active > 1) log_info ("Speed.Dev.#*.: %9sH/s", display_all_cur); } -int status_progress_init (status_ctx_t *status_ctx, const hashes_t *hashes) +int status_progress_init (hashcat_ctx_t *hashcat_ctx) { + status_ctx_t *status_ctx = hashcat_ctx->status_ctx; + hashes_t *hashes = hashcat_ctx->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)); status_ctx->words_progress_restored = (u64 *) mycalloc (hashes->salts_cnt, sizeof (u64)); @@ -1358,8 +1361,10 @@ int status_progress_init (status_ctx_t *status_ctx, const hashes_t *hashes) return 0; } -void status_progress_destroy (status_ctx_t *status_ctx) +void status_progress_destroy (hashcat_ctx_t *hashcat_ctx) { + status_ctx_t *status_ctx = hashcat_ctx->status_ctx; + myfree (status_ctx->words_progress_done); myfree (status_ctx->words_progress_rejected); myfree (status_ctx->words_progress_restored); @@ -1369,15 +1374,20 @@ void status_progress_destroy (status_ctx_t *status_ctx) status_ctx->words_progress_restored = NULL; } -void status_progress_reset (status_ctx_t *status_ctx, const hashes_t *hashes) +void status_progress_reset (hashcat_ctx_t *hashcat_ctx) { + status_ctx_t *status_ctx = hashcat_ctx->status_ctx; + hashes_t *hashes = hashcat_ctx->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) +int status_ctx_init (hashcat_ctx_t *hashcat_ctx) { + status_ctx_t *status_ctx = hashcat_ctx->status_ctx; + status_ctx->devices_status = STATUS_INIT; status_ctx->run_main_level1 = true; @@ -1396,8 +1406,10 @@ int status_ctx_init (status_ctx_t *status_ctx) return 0; } -void status_ctx_destroy (status_ctx_t *status_ctx) +void status_ctx_destroy (hashcat_ctx_t *hashcat_ctx) { + status_ctx_t *status_ctx = hashcat_ctx->status_ctx; + hc_thread_mutex_delete (status_ctx->mux_dispatcher); hc_thread_mutex_delete (status_ctx->mux_counter); hc_thread_mutex_delete (status_ctx->mux_display);