From e4b4855fbdf6cfe61127b5102135448bcf343e95 Mon Sep 17 00:00:00 2001 From: jsteube Date: Thu, 22 Sep 2016 14:52:51 +0200 Subject: [PATCH] Get rid of status* variables in data. context --- include/hash_management.h | 4 ++-- include/types.h | 2 -- include/weak_hash.h | 2 +- src/hash_management.c | 8 ++++---- src/hashcat.c | 4 +--- src/opencl.c | 2 +- src/weak_hash.c | 4 ++-- 7 files changed, 11 insertions(+), 15 deletions(-) diff --git a/include/hash_management.h b/include/hash_management.h index 29558962b..9d656a06e 100644 --- a/include/hash_management.h +++ b/include/hash_management.h @@ -13,9 +13,9 @@ int sort_by_hash_no_salt (const void *v1, const void *v2); void save_hash (const user_options_t *user_options, const hashconfig_t *hashconfig, const hashes_t *hashes); -void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, plain_t *plain); +void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, plain_t *plain); -int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos); +int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, hashconfig_t *hashconfig, hashes_t *hashes, 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); diff --git a/include/types.h b/include/types.h index e2ebb534c..c09970acd 100644 --- a/include/types.h +++ b/include/types.h @@ -972,8 +972,6 @@ typedef struct char *outfile_check_directory; u32 loopback; - u32 status; - u32 status_timer; u32 machine_readable; u32 quiet; u32 force; diff --git a/include/weak_hash.h b/include/weak_hash.h index 21e5faac9..daad58e9f 100644 --- a/include/weak_hash.h +++ b/include/weak_hash.h @@ -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, hashconfig_t *hashconfig, hashes_t *hashes, 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, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos); #endif // _WEAK_HASH_H diff --git a/src/hash_management.c b/src/hash_management.c index ba398175e..0538c636c 100644 --- a/src/hash_management.c +++ b/src/hash_management.c @@ -219,7 +219,7 @@ void save_hash (const user_options_t *user_options, const hashconfig_t *hashconf unlink (old_hashfile); } -void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, plain_t *plain) +void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, plain_t *plain) { debugfile_ctx_t *debugfile_ctx = data.debugfile_ctx; loopback_ctx_t *loopback_ctx = data.loopback_ctx; @@ -474,7 +474,7 @@ void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, plai if ((data.wordlist_mode == WL_MODE_FILE) || (data.wordlist_mode == WL_MODE_MASK)) { - if ((opencl_ctx->devices_status != STATUS_CRACKED) && (data.status != 1)) + if ((opencl_ctx->devices_status != STATUS_CRACKED) && (user_options->status != true)) { if (outfile_ctx->filename == NULL) if (quiet == false) send_prompt (); } @@ -503,7 +503,7 @@ void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, plai } } -int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos) +int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos) { salt_t *salt_buf = &hashes->salts_buf[salt_pos]; @@ -567,7 +567,7 @@ int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, ha if (hashes->salts_done == hashes->salts_cnt) mycracked (opencl_ctx); - check_hash (opencl_ctx, device_param, &cracked[i]); + check_hash (opencl_ctx, device_param, user_options, &cracked[i]); } hc_thread_mutex_unlock (mux_display); diff --git a/src/hashcat.c b/src/hashcat.c index 15b0fa9e5..19b37f7bd 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -286,8 +286,6 @@ int main (int argc, char **argv) data.scrypt_tmto = user_options->scrypt_tmto; data.segment_size = user_options->segment_size; data.session = user_options->session; - data.status = user_options->status; - data.status_timer = user_options->status_timer; data.truecrypt_keyfiles = user_options->truecrypt_keyfiles; data.veracrypt_keyfiles = user_options->veracrypt_keyfiles; data.veracrypt_pim = user_options->veracrypt_pim; @@ -2601,7 +2599,7 @@ int main (int argc, char **argv) for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++) { - weak_hash_check (opencl_ctx, device_param, hashconfig, hashes, salt_pos); + weak_hash_check (opencl_ctx, device_param, user_options, hashconfig, hashes, salt_pos); } // Display hack, guarantee that there is at least one \r before real start diff --git a/src/opencl.c b/src/opencl.c index 9d81805d5..9e71cd216 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -1244,7 +1244,7 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash if (data.benchmark == false) { - check_cracked (opencl_ctx, device_param, hashconfig, hashes, salt_pos); + check_cracked (opencl_ctx, device_param, user_options, hashconfig, hashes, salt_pos); } /** diff --git a/src/weak_hash.c b/src/weak_hash.c index 8760daeb7..4430659d2 100644 --- a/src/weak_hash.c +++ b/src/weak_hash.c @@ -30,7 +30,7 @@ extern hc_global_data_t data; -void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, hashes_t *hashes, 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, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos) { if (device_param == NULL) { @@ -93,7 +93,7 @@ void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, * result */ - check_cracked (opencl_ctx, device_param, hashconfig, hashes, salt_pos); + check_cracked (opencl_ctx, device_param, user_options, hashconfig, hashes, salt_pos); /** * cleanup