Move more code from hashcat.c to opencl.c related to opencl device initialization and shutdown
This commit is contained in:
+4
-1
@@ -63,7 +63,10 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
|
||||
int opencl_ctx_init (opencl_ctx_t *opencl_ctx, const char *opencl_platforms, const char *opencl_devices, const char *opencl_device_types, const uint opencl_vector_width, const uint opencl_vector_width_chgd, const uint nvidia_spin_damp, const uint nvidia_spin_damp_chgd, const uint workload_profile, const uint kernel_accel, const uint kernel_accel_chgd, const uint kernel_loops, const uint kernel_loops_chgd, const uint keyspace, const uint stdout_flag);
|
||||
void opencl_ctx_destroy (opencl_ctx_t *opencl_ctx);
|
||||
|
||||
int opencl_ctx_devices_init (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const tuning_db_t *tuning_db, const uint attack_mode, const uint quiet, const uint force, const uint benchmark, const uint machine_readable, const uint algorithm_pos);
|
||||
int opencl_ctx_devices_init (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const tuning_db_t *tuning_db, const uint attack_mode, const bool quiet, const bool force, const bool benchmark, const bool machine_readable, const uint algorithm_pos);
|
||||
void opencl_ctx_devices_destroy (opencl_ctx_t *opencl_ctx);
|
||||
|
||||
int opencl_session_begin (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const session_ctx_t *session_ctx);
|
||||
int opencl_session_destroy (opencl_ctx_t *opencl_ctx);
|
||||
|
||||
#endif // _OPENCL_H
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
#ifndef _SESSION_H
|
||||
#define _SESSION_H
|
||||
|
||||
void session_ctx_init (session_ctx_t *session_ctx, const bool quiet, const bool force, const bool benchmark, const u32 scrypt_tmto, char *cwd, char *install_dir, char *profile_dir, char *session_dir, char *shared_dir, char *cpath_real, const u32 wordlist_mode, char *rule_buf_l, char *rule_buf_r, const int rule_len_l, const int rule_len_r, const u32 kernel_rules_cnt, kernel_rule_t *kernel_rules_buf, const u32 attack_mode, const u32 attack_kern, const u32 bitmap_size, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, u32 *bitmap_s1_a, u32 *bitmap_s1_b, u32 *bitmap_s1_c, u32 *bitmap_s1_d, u32 *bitmap_s2_a, u32 *bitmap_s2_b, u32 *bitmap_s2_c, u32 *bitmap_s2_d);
|
||||
|
||||
void session_ctx_destroy (session_ctx_t *session_ctx);
|
||||
|
||||
#endif // _SESSION_H
|
||||
+49
-10
@@ -482,10 +482,10 @@ typedef struct
|
||||
|
||||
void *ocl;
|
||||
|
||||
cl_uint platforms_cnt;
|
||||
cl_uint platforms_cnt;
|
||||
cl_platform_id *platforms;
|
||||
|
||||
cl_uint platform_devices_cnt;
|
||||
cl_uint platform_devices_cnt;
|
||||
cl_device_id *platform_devices;
|
||||
|
||||
u32 devices_cnt;
|
||||
@@ -518,6 +518,8 @@ typedef struct
|
||||
int need_nvapi;
|
||||
int need_xnvctrl;
|
||||
|
||||
int force_jit_compilation;
|
||||
|
||||
} opencl_ctx_t;
|
||||
|
||||
#if defined (__APPLE__)
|
||||
@@ -731,6 +733,50 @@ typedef struct
|
||||
|
||||
} wl_data_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool quiet;
|
||||
bool force;
|
||||
bool benchmark;
|
||||
|
||||
u32 scrypt_tmto;
|
||||
|
||||
char *cwd;
|
||||
char *install_dir;
|
||||
char *profile_dir;
|
||||
char *session_dir;
|
||||
char *shared_dir;
|
||||
char *cpath_real;
|
||||
|
||||
u32 wordlist_mode;
|
||||
|
||||
char *rule_buf_l;
|
||||
char *rule_buf_r;
|
||||
int rule_len_l;
|
||||
int rule_len_r;
|
||||
|
||||
u32 kernel_rules_cnt;
|
||||
kernel_rule_t *kernel_rules_buf;
|
||||
|
||||
u32 attack_mode;
|
||||
u32 attack_kern;
|
||||
|
||||
u32 bitmap_size;
|
||||
u32 bitmap_mask;
|
||||
u32 bitmap_shift1;
|
||||
u32 bitmap_shift2;
|
||||
|
||||
u32 *bitmap_s1_a;
|
||||
u32 *bitmap_s1_b;
|
||||
u32 *bitmap_s1_c;
|
||||
u32 *bitmap_s1_d;
|
||||
u32 *bitmap_s2_a;
|
||||
u32 *bitmap_s2_b;
|
||||
u32 *bitmap_s2_c;
|
||||
u32 *bitmap_s2_d;
|
||||
|
||||
} session_ctx_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/**
|
||||
@@ -794,13 +840,6 @@ typedef struct
|
||||
hm_attrs_t hm_device[DEVICES_MAX];
|
||||
#endif
|
||||
|
||||
/**
|
||||
* hashes
|
||||
*/
|
||||
|
||||
u32 scrypt_tmp_size;
|
||||
u32 scrypt_tmto_final;
|
||||
|
||||
/**
|
||||
* logging
|
||||
*/
|
||||
@@ -830,7 +869,6 @@ typedef struct
|
||||
u32 maskpos;
|
||||
char *session;
|
||||
|
||||
char *homedir;
|
||||
char *install_dir;
|
||||
char *profile_dir;
|
||||
char *session_dir;
|
||||
@@ -880,6 +918,7 @@ typedef struct
|
||||
potfile_ctx_t *potfile_ctx;
|
||||
loopback_ctx_t *loopback_ctx;
|
||||
debugfile_ctx_t *debugfile_ctx;
|
||||
session_ctx_t *session_ctx;
|
||||
|
||||
#if defined (HAVE_HWMON)
|
||||
u32 gpu_temp_disable;
|
||||
|
||||
Reference in New Issue
Block a user