From d9c1c89a57106a4807a3e135dc2456ce4911bd22 Mon Sep 17 00:00:00 2001 From: jsteube Date: Thu, 6 Oct 2016 10:10:04 +0200 Subject: [PATCH] Update combinator.c function parameters --- include/combinator.h | 4 ++-- src/combinator.c | 13 +++++++++++-- src/hashcat.c | 10 ++++------ 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/include/combinator.h b/include/combinator.h index 4475e9b9f..5177e22c8 100644 --- a/include/combinator.h +++ b/include/combinator.h @@ -9,7 +9,7 @@ #include #include -int combinator_ctx_init (combinator_ctx_t *combinator_ctx, user_options_t *user_options, user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, dictstat_ctx_t *dictstat_ctx, wl_data_t *wl_data); -void combinator_ctx_destroy (combinator_ctx_t *combinator_ctx); +int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx); +void combinator_ctx_destroy (hashcat_ctx_t *hashcat_ctx); #endif // _COMBINATOR_H diff --git a/src/combinator.c b/src/combinator.c index 14c168bf0..98ca6ec8c 100644 --- a/src/combinator.c +++ b/src/combinator.c @@ -10,8 +10,15 @@ #include "combinator.h" #include "wordlist.h" -int combinator_ctx_init (combinator_ctx_t *combinator_ctx, user_options_t *user_options, user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, dictstat_ctx_t *dictstat_ctx, wl_data_t *wl_data) +int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx) { + combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx; + dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx; + straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx; + user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra; + user_options_t *user_options = hashcat_ctx->user_options; + wl_data_t *wl_data = hashcat_ctx->wl_data; + combinator_ctx->enabled = false; if (user_options->left == true) return 0; @@ -173,8 +180,10 @@ int combinator_ctx_init (combinator_ctx_t *combinator_ctx, user_options_t *user_ return 0; } -void combinator_ctx_destroy (combinator_ctx_t *combinator_ctx) +void combinator_ctx_destroy (hashcat_ctx_t *hashcat_ctx) { + combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx; + if (combinator_ctx->enabled == false) return; myfree (combinator_ctx->scratch_buf); diff --git a/src/hashcat.c b/src/hashcat.c index d0445772b..2f51bf5c0 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -761,8 +761,6 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx) { bitmap_ctx_t *bitmap_ctx = hashcat_ctx->bitmap_ctx; cpt_ctx_t *cpt_ctx = hashcat_ctx->cpt_ctx; - combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx; - dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx; folder_config_t *folder_config = hashcat_ctx->folder_config; hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashes_t *hashes = hashcat_ctx->hashes; @@ -909,7 +907,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx) * bitmaps */ - bitmap_ctx_init (bitmap_ctx, user_options, hashconfig, hashes); + bitmap_ctx_init (hashcat_ctx); /** * cracks-per-time allocate buffer @@ -935,7 +933,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx) * straight mode init */ - const int rc_combinator_init = combinator_ctx_init (combinator_ctx, user_options, user_options_extra, straight_ctx, dictstat_ctx, wl_data); + const int rc_combinator_init = combinator_ctx_init (hashcat_ctx); if (rc_combinator_init == -1) return -1; @@ -1220,11 +1218,11 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx) potfile_write_close (potfile_ctx); - bitmap_ctx_destroy (bitmap_ctx); + bitmap_ctx_destroy (hashcat_ctx); mask_ctx_destroy (mask_ctx); - combinator_ctx_destroy (combinator_ctx); + combinator_ctx_destroy (hashcat_ctx); straight_ctx_destroy (straight_ctx);