Update tuning_db.c function parameters

pull/533/head
jsteube 8 years ago
parent ef582be4eb
commit 14248d38e3

@ -11,9 +11,9 @@
#define TUNING_DB_FILE "hashcat.hctune"
int tuning_db_init (tuning_db_t *tuning_db, const user_options_t *user_options, const folder_config_t *folder_config);
void tuning_db_destroy (tuning_db_t *tuning_db);
int tuning_db_init (hashcat_ctx_t *hashcat_ctx);
void tuning_db_destroy (hashcat_ctx_t *hashcat_ctx);
tuning_db_entry_t *tuning_db_search (const tuning_db_t *tuning_db, const char *device_name, const cl_device_type device_type, int attack_mode, const int hash_type);
tuning_db_entry_t *tuning_db_search (hashcat_ctx_t *hashcat_ctx, const char *device_name, const cl_device_type device_type, int attack_mode, const int hash_type);
#endif // _TUNINGDB_H

@ -1241,7 +1241,6 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, char *install_folder, char *shared_fold
logfile_ctx_t *logfile_ctx = hashcat_ctx->logfile_ctx;
loopback_ctx_t *loopback_ctx = hashcat_ctx->loopback_ctx;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
tuning_db_t *tuning_db = hashcat_ctx->tuning_db;
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
user_options_t *user_options = hashcat_ctx->user_options;
@ -1297,7 +1296,7 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, char *install_folder, char *shared_fold
* tuning db
*/
const int rc_tuning_db = tuning_db_init (tuning_db, user_options, folder_config);
const int rc_tuning_db = tuning_db_init (hashcat_ctx);
if (rc_tuning_db == -1) return -1;
@ -1490,7 +1489,7 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, char *install_folder, char *shared_fold
debugfile_destroy (hashcat_ctx);
tuning_db_destroy (tuning_db);
tuning_db_destroy (hashcat_ctx);
loopback_destroy (loopback_ctx);

@ -2581,7 +2581,6 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
hashes_t *hashes = hashcat_ctx->hashes;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
tuning_db_t *tuning_db = hashcat_ctx->tuning_db;
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
user_options_t *user_options = hashcat_ctx->user_options;
@ -2628,7 +2627,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
{
// tuning db
tuning_db_entry_t *tuningdb_entry = tuning_db_search (tuning_db, device_param->device_name, device_param->device_type, user_options->attack_mode, hashconfig->hash_mode);
tuning_db_entry_t *tuningdb_entry = tuning_db_search (hashcat_ctx, device_param->device_name, device_param->device_type, user_options->attack_mode, hashconfig->hash_mode);
if (tuningdb_entry == NULL || tuningdb_entry->vector_width == -1)
{
@ -2679,7 +2678,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
device_param->kernel_loops_min = 1;
device_param->kernel_loops_max = 1024;
tuning_db_entry_t *tuningdb_entry = tuning_db_search (tuning_db, device_param->device_name, device_param->device_type, user_options->attack_mode, hashconfig->hash_mode);
tuning_db_entry_t *tuningdb_entry = tuning_db_search (hashcat_ctx, device_param->device_name, device_param->device_type, user_options->attack_mode, hashconfig->hash_mode);
if (tuningdb_entry != NULL)
{

@ -50,8 +50,12 @@ static int sort_by_tuning_db_entry (const void *v1, const void *v2)
return 0;
}
int tuning_db_init (tuning_db_t *tuning_db, const user_options_t *user_options, const folder_config_t *folder_config)
int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
{
folder_config_t *folder_config = hashcat_ctx->folder_config;
tuning_db_t *tuning_db = hashcat_ctx->tuning_db;
user_options_t *user_options = hashcat_ctx->user_options;
tuning_db->enabled = false;
if (user_options->keyspace == true) return 0;
@ -239,8 +243,10 @@ int tuning_db_init (tuning_db_t *tuning_db, const user_options_t *user_options,
return 0;
}
void tuning_db_destroy (tuning_db_t *tuning_db)
void tuning_db_destroy (hashcat_ctx_t *hashcat_ctx)
{
tuning_db_t *tuning_db = hashcat_ctx->tuning_db;
if (tuning_db->enabled == false) return;
int i;
@ -266,8 +272,10 @@ void tuning_db_destroy (tuning_db_t *tuning_db)
memset (tuning_db, 0, sizeof (tuning_db_t));
}
tuning_db_entry_t *tuning_db_search (const tuning_db_t *tuning_db, const char *device_name, const cl_device_type device_type, int attack_mode, const int hash_type)
tuning_db_entry_t *tuning_db_search (hashcat_ctx_t *hashcat_ctx, const char *device_name, const cl_device_type device_type, int attack_mode, const int hash_type)
{
tuning_db_t *tuning_db = hashcat_ctx->tuning_db;
static tuning_db_entry_t s;
// first we need to convert all spaces in the device_name to underscore

Loading…
Cancel
Save