1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 09:58:16 +00:00

Update interface.c function parameters

This commit is contained in:
jsteube 2016-10-06 15:49:07 +02:00
parent 9b8092abf9
commit a97e31881c
6 changed files with 40 additions and 22 deletions

View File

@ -1509,12 +1509,12 @@ void to_hccap_t (hccap_t *hccap, const u32 salt_pos, const u32 digest_pos, const
void ascii_digest (char *out_buf, const u32 salt_pos, const u32 digest_pos, const hashconfig_t *hashconfig, const hashes_t *hashes);
int hashconfig_init (hashconfig_t *hashconfig, const user_options_t *user_options);
void hashconfig_destroy (hashconfig_t *hashconfig);
u32 hashconfig_enforce_kernel_threads (const hashconfig_t *hashconfig, const hc_device_param_t *device_param);
u32 hashconfig_enforce_kernel_loops (const hashconfig_t *hashconfig, const user_options_t *user_options);
void hashconfig_general_defaults (hashconfig_t *hashconfig, hashes_t *hashes, const user_options_t *user_options);
void hashconfig_benchmark_defaults (const hashconfig_t *hashconfig, salt_t *salt, void *esalt);
char *hashconfig_benchmark_mask (const hashconfig_t *hashconfig);
int hashconfig_init (hashcat_ctx_t *hashcat_ctx);
void hashconfig_destroy (hashcat_ctx_t *hashcat_ctx);
u32 hashconfig_enforce_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_param_t *device_param);
u32 hashconfig_enforce_kernel_loops (hashcat_ctx_t *hashcat_ctx);
void hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx);
void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, void *esalt);
char *hashconfig_benchmark_mask (hashcat_ctx_t *hashcat_ctx);
#endif // _INTERFACE_H

View File

@ -787,7 +787,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
* setup variables and buffers depending on hash_mode
*/
const int rc_hashconfig = hashconfig_init (hashconfig, user_options);
const int rc_hashconfig = hashconfig_init (hashcat_ctx);
if (rc_hashconfig == -1) return -1;
@ -874,7 +874,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
hashes_destroy (hashcat_ctx);
hashconfig_destroy (hashconfig);
hashconfig_destroy (hashcat_ctx);
potfile_destroy (hashcat_ctx);
@ -1216,7 +1216,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
hashes_destroy (hashcat_ctx);
hashconfig_destroy (hashconfig);
hashconfig_destroy (hashcat_ctx);
wl_data_destroy (wl_data);

View File

@ -627,7 +627,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
if (user_options->benchmark == true)
{
hashconfig_benchmark_defaults ((hashconfig_t *) hashconfig, hashes_buf[0].salt, hashes_buf[0].esalt);
hashconfig_benchmark_defaults (hashcat_ctx, hashes_buf[0].salt, hashes_buf[0].esalt);
hashes->hashfile = "-";
@ -1280,7 +1280,7 @@ int hashes_init_stage3 (hashcat_ctx_t *hashcat_ctx)
hashes_t *hashes = hashcat_ctx->hashes;
user_options_t *user_options = hashcat_ctx->user_options;
hashconfig_general_defaults (hashconfig, hashes, user_options);
hashconfig_general_defaults (hashcat_ctx);
if (hashes->salts_cnt == 1)
hashconfig->opti_type |= OPTI_TYPE_SINGLE_SALT;

View File

@ -16158,8 +16158,11 @@ void ascii_digest (char *out_buf, const u32 salt_pos, const u32 digest_pos, cons
#pragma GCC diagnostic pop
int hashconfig_init (hashconfig_t *hashconfig, const user_options_t *user_options)
int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
user_options_t *user_options = hashcat_ctx->user_options;
hashconfig->hash_mode = user_options->hash_mode;
hashconfig->hash_type = 0;
hashconfig->salt_type = 0;
@ -20101,13 +20104,17 @@ int hashconfig_init (hashconfig_t *hashconfig, const user_options_t *user_option
return 0;
}
void hashconfig_destroy (hashconfig_t *hashconfig)
void hashconfig_destroy (hashcat_ctx_t *hashcat_ctx)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
memset (hashconfig, 0, sizeof (hashconfig_t));
}
u32 hashconfig_enforce_kernel_threads (const hashconfig_t *hashconfig, const hc_device_param_t *device_param)
u32 hashconfig_enforce_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_param_t *device_param)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
u32 kernel_threads = MIN (KERNEL_THREADS_MAX, device_param->device_maxworkgroup_size);
if (hashconfig->hash_mode == 8900) kernel_threads = 64; // Scrypt
@ -20139,8 +20146,11 @@ u32 hashconfig_enforce_kernel_threads (const hashconfig_t *hashconfig, const hc_
return kernel_threads;
}
u32 hashconfig_enforce_kernel_loops (const hashconfig_t *hashconfig, const user_options_t *user_options)
u32 hashconfig_enforce_kernel_loops (hashcat_ctx_t *hashcat_ctx)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
user_options_t *user_options = hashcat_ctx->user_options;
u32 kernel_loops_fixed = 0;
if (hashconfig->hash_mode == 1500 && user_options->attack_mode == ATTACK_MODE_BF)
@ -20181,8 +20191,12 @@ u32 hashconfig_enforce_kernel_loops (const hashconfig_t *hashconfig, const user_
return kernel_loops_fixed;
}
void hashconfig_general_defaults (hashconfig_t *hashconfig, hashes_t *hashes, const user_options_t *user_options)
void hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes;
user_options_t *user_options = hashcat_ctx->user_options;
salt_t *salts_buf = hashes->salts_buf;
void *esalts_buf = hashes->esalts_buf;
@ -20252,8 +20266,10 @@ void hashconfig_general_defaults (hashconfig_t *hashconfig, hashes_t *hashes, co
}
}
void hashconfig_benchmark_defaults (const hashconfig_t *hashconfig, salt_t *salt, void *esalt)
void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, void *esalt)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
if (hashconfig->is_salted)
{
salt->salt_len = 8;
@ -20565,8 +20581,10 @@ void hashconfig_benchmark_defaults (const hashconfig_t *hashconfig, salt_t *salt
}
}
char *hashconfig_benchmark_mask (const hashconfig_t *hashconfig)
char *hashconfig_benchmark_mask (hashcat_ctx_t *hashcat_ctx)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
char *mask = NULL;
switch (hashconfig->hash_mode)

View File

@ -1086,7 +1086,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
}
else
{
const char *mask = hashconfig_benchmark_mask (hashconfig);
const char *mask = hashconfig_benchmark_mask (hashcat_ctx);
mask_append (mask_ctx, user_options, mask);
}

View File

@ -2771,7 +2771,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
* there needs to be some upper limit, otherwise there's too much overhead
*/
u32 kernel_threads = hashconfig_enforce_kernel_threads (hashconfig, device_param);
u32 kernel_threads = hashconfig_enforce_kernel_threads (hashcat_ctx, device_param);
device_param->kernel_threads = kernel_threads;
@ -2929,7 +2929,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
* some algorithms need a fixed kernel-loops count
*/
const u32 kernel_loops_fixed = hashconfig_enforce_kernel_loops (hashconfig, user_options);
const u32 kernel_loops_fixed = hashconfig_enforce_kernel_loops (hashcat_ctx);
if (kernel_loops_fixed != 0)
{