Rename some more variables

pull/2022/head
Jens Steube 5 years ago
parent 495d89f831
commit 3c4f4df771

@ -126,7 +126,7 @@ _hashcat_get_permutations ()
fi
}
_hashcat_opencl_devices ()
_hashcat_backend_devices ()
{
local num_devices=0
@ -180,7 +180,7 @@ _hashcat ()
local HCCAPX_MESSAGE_PAIRS="0 1 2 3 4 5"
local OUTFILE_FORMATS="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
local OPENCL_DEVICE_TYPES="1 2 3"
local OPENCL_VECTOR_WIDTH="1 2 4 8 16"
local BACKEND_VECTOR_WIDTH="1 2 4 8 16"
local DEBUG_MODE="1 2 3 4"
local WORKLOAD_PROFILE="1 2 3 4"
local BRAIN_CLIENT_FEATURES="1 2 3"
@ -189,8 +189,8 @@ _hashcat ()
local BUILD_IN_CHARSETS='?l ?u ?d ?a ?b ?s ?h ?H'
local SHORT_OPTS="-m -a -V -v -h -b -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -i -I -s -l -O -S -z"
local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --benchmark-all --hex-salt --hex-wordlist --hex-charset --force --status --status-json --status-timer --machine-readable --loopback --markov-hcstat2 --markov-disable --markov-classic --markov-threshold --runtime --session --speed-only --progress-only --restore --restore-file-path --restore-disable --outfile --outfile-format --outfile-autohex-disable --outfile-check-timer --outfile-check-dir --wordlist-autohex-disable --separator --show --left --username --remove --remove-timer --potfile-disable --potfile-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --example-hashes --opencl-info --opencl-devices --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-disable --hwmon-temp-abort --skip --limit --keyspace --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --self-test-disable --slow-candidates --brain-server --brain-client --brain-client-features --brain-host --brain-port --brain-session --brain-session-whitelist --brain-password"
local OPTIONS="-m -a -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -s -l --hash-type --attack-mode --status-timer --markov-hcstat2 --markov-threshold --runtime --session --timer --outfile --outfile-format --outfile-check-timer --outfile-check-dir --separator --remove-timer --potfile-path --restore-file-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --opencl-devices --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-temp-abort --skip --limit --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment-min --increment-max --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --brain-client-features --brain-host --brain-password --brain-port --brain-session --brain-whitelist-session --stdin-timeout-abort"
local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --benchmark-all --hex-salt --hex-wordlist --hex-charset --force --status --status-json --status-timer --machine-readable --loopback --markov-hcstat2 --markov-disable --markov-classic --markov-threshold --runtime --session --speed-only --progress-only --restore --restore-file-path --restore-disable --outfile --outfile-format --outfile-autohex-disable --outfile-check-timer --outfile-check-dir --wordlist-autohex-disable --separator --show --left --username --remove --remove-timer --potfile-disable --potfile-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --example-hashes --backend-info --backend-devices --opencl-device-types --backend-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-disable --hwmon-temp-abort --skip --limit --keyspace --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --self-test-disable --slow-candidates --brain-server --brain-client --brain-client-features --brain-host --brain-port --brain-session --brain-session-whitelist --brain-password"
local OPTIONS="-m -a -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -s -l --hash-type --attack-mode --status-timer --markov-hcstat2 --markov-threshold --runtime --session --timer --outfile --outfile-format --outfile-check-timer --outfile-check-dir --separator --remove-timer --potfile-path --restore-file-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --backend-devices --opencl-device-types --backend-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-temp-abort --skip --limit --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment-min --increment-max --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --brain-client-features --brain-host --brain-password --brain-port --brain-session --brain-whitelist-session --stdin-timeout-abort"
COMPREPLY=()
local cur="${COMP_WORDS[COMP_CWORD]}"
@ -250,8 +250,8 @@ _hashcat ()
return 0
;;
-d|--opencl-devices)
_hashcat_opencl_devices
-d|--backend-devices)
_hashcat_backend_devices
local num_devices=${?}
_hashcat_get_permutations ${num_devices}
@ -265,8 +265,8 @@ _hashcat ()
return 0
;;
--opencl-vector-width)
COMPREPLY=($(compgen -W "${OPENCL_VECTOR_WIDTH}" -- ${cur}))
--backend-vector-width)
COMPREPLY=($(compgen -W "${BACKEND_VECTOR_WIDTH}" -- ${cur}))
return 0
;;
@ -443,13 +443,13 @@ _hashcat ()
;;
-d*)
_hashcat_opencl_devices
_hashcat_backend_devices
local num_devices=${?}
_hashcat_get_permutations ${num_devices}
local opencl_devices_var="$(echo " "${hashcat_devices_permutation} | sed 's/ / -d/g')"
COMPREPLY=($(compgen -W "${opencl_devices_var}" -- ${cur}))
local backend_devices_var="$(echo " "${hashcat_devices_permutation} | sed 's/ / -d/g')"
COMPREPLY=($(compgen -W "${backend_devices_var}" -- ${cur}))
return 0
;;
esac

@ -43,8 +43,8 @@ void compress_terminal_line_length (char *out_buf, const size_t keep_from_beginn
void example_hashes (hashcat_ctx_t *hashcat_ctx);
void opencl_info (hashcat_ctx_t *hashcat_ctx);
void opencl_info_compact (hashcat_ctx_t *hashcat_ctx);
void backend_info (hashcat_ctx_t *hashcat_ctx);
void backend_info_compact (hashcat_ctx_t *hashcat_ctx);
void status_progress_machine_readable (hashcat_ctx_t *hashcat_ctx);
void status_progress (hashcat_ctx_t *hashcat_ctx);

@ -44,13 +44,6 @@ typedef int16_t i16;
typedef int32_t i32;
typedef int64_t i64;
// import types from opencl
//typedef uint8_t uchar;
//typedef uint16_t ushort;
//typedef uint32_t uint;
//typedef uint64_t ulong;
#include "inc_types.h"
// there's no such thing in plain C, therefore all vector operation cannot work in this emu
@ -133,10 +126,10 @@ typedef enum event_identifier
EVENT_MONITOR_PERFORMANCE_HINT = 0x00000086,
EVENT_MONITOR_NOINPUT_HINT = 0x00000087,
EVENT_MONITOR_NOINPUT_ABORT = 0x00000088,
EVENT_OPENCL_SESSION_POST = 0x00000090,
EVENT_OPENCL_SESSION_PRE = 0x00000091,
EVENT_OPENCL_DEVICE_INIT_POST = 0x00000092,
EVENT_OPENCL_DEVICE_INIT_PRE = 0x00000093,
EVENT_BACKEND_SESSION_POST = 0x00000090,
EVENT_BACKEND_SESSION_PRE = 0x00000091,
EVENT_BACKEND_DEVICE_INIT_POST = 0x00000092,
EVENT_BACKEND_DEVICE_INIT_PRE = 0x00000093,
EVENT_OUTERLOOP_FINISHED = 0x000000a0,
EVENT_OUTERLOOP_MAINSCREEN = 0x000000a1,
EVENT_OUTERLOOP_STARTING = 0x000000a2,
@ -592,8 +585,8 @@ typedef enum user_options_defaults
MARKOV_DISABLE = false,
MARKOV_THRESHOLD = 0,
NONCE_ERROR_CORRECTIONS = 8,
OPENCL_INFO = false,
OPENCL_VECTOR_WIDTH = 0,
BACKEND_INFO = false,
BACKEND_VECTOR_WIDTH = 0,
OPTIMIZED_KERNEL_ENABLE = false,
OUTFILE_AUTOHEX = true,
OUTFILE_CHECK_TIMER = 5,
@ -637,6 +630,9 @@ typedef enum user_options_map
{
IDX_ADVICE_DISABLE = 0xff00,
IDX_ATTACK_MODE = 'a',
IDX_BACKEND_DEVICES = 'd',
IDX_BACKEND_INFO = 'I',
IDX_BACKEND_VECTOR_WIDTH = 0xff27,
IDX_BENCHMARK_ALL = 0xff01,
IDX_BENCHMARK = 'b',
IDX_BITMAP_MAX = 0xff02,
@ -690,10 +686,7 @@ typedef enum user_options_map
IDX_MARKOV_HCSTAT2 = 0xff24,
IDX_MARKOV_THRESHOLD = 't',
IDX_NONCE_ERROR_CORRECTIONS = 0xff25,
IDX_OPENCL_DEVICES = 'd',
IDX_OPENCL_DEVICE_TYPES = 'D',
IDX_OPENCL_INFO = 'I',
IDX_OPENCL_VECTOR_WIDTH = 0xff27,
IDX_OPTIMIZED_KERNEL_ENABLE = 'O',
IDX_OUTFILE_AUTOHEX_DISABLE = 0xff28,
IDX_OUTFILE_CHECK_DIR = 0xff29,
@ -1004,8 +997,6 @@ typedef struct hc_device_param
u8 pcie_device;
u8 pcie_function;
u32 opencl_platform_devices_id; // for mapping with hms devices
bool skipped; // permanent
bool skipped_warning; // iteration
@ -1267,7 +1258,7 @@ typedef struct hc_device_param
char *opencl_device_version;
char *opencl_device_c_version;
cl_platform_id opencl_platform;
//cl_platform_id opencl_platform;
cl_device_type opencl_device_type;
cl_uint opencl_device_vendor_id;
cl_uint opencl_platform_vendor_id;
@ -1361,6 +1352,8 @@ typedef struct backend_ctx
int opencl_devices_cnt;
int opencl_devices_active;
u64 backend_devices_filter;
hc_device_param_t *devices_param;
u32 hardware_power_all;
@ -1368,8 +1361,6 @@ typedef struct backend_ctx
u64 kernel_power_all;
u64 kernel_power_final; // we save that so that all divisions are done from the same base
u64 devices_filter;
double target_msec;
bool need_adl;
@ -1393,6 +1384,7 @@ typedef struct backend_ctx
cl_uint *opencl_platforms_devices_cnt;
char **opencl_platforms_name;
char **opencl_platforms_vendor;
cl_uint *opencl_platforms_vendor_id;
char **opencl_platforms_version;
cl_device_type opencl_device_types_filter;
@ -1718,7 +1710,7 @@ typedef struct user_options
bool kernel_threads_chgd;
bool nonce_error_corrections_chgd;
bool spin_damp_chgd;
bool opencl_vector_width_chgd;
bool backend_vector_width_chgd;
bool outfile_format_chgd;
bool remove_timer_chgd;
bool rp_gen_seed_chgd;
@ -1750,7 +1742,7 @@ typedef struct user_options
bool machine_readable;
bool markov_classic;
bool markov_disable;
bool opencl_info;
bool backend_info;
bool optimized_kernel_enable;
bool outfile_autohex;
bool potfile_disable;
@ -1782,7 +1774,7 @@ typedef struct user_options
char *induction_dir;
char *keyboard_layout_mapping;
char *markov_hcstat2;
char *opencl_devices;
char *backend_devices;
char *opencl_device_types;
char *outfile;
char *outfile_check_dir;
@ -1821,7 +1813,7 @@ typedef struct user_options
u32 markov_threshold;
u32 nonce_error_corrections;
u32 spin_damp;
u32 opencl_vector_width;
u32 backend_vector_width;
u32 outfile_check_timer;
u32 outfile_format;
u32 remove_timer;

@ -182,13 +182,13 @@ static int ocl_check_dri (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx)
return 0;
}
static bool setup_devices_filter (hashcat_ctx_t *hashcat_ctx, const char *opencl_devices, u64 *out)
static bool setup_backend_devices_filter (hashcat_ctx_t *hashcat_ctx, const char *backend_devices, u64 *out)
{
u64 backend_devices_filter = 0;
if (opencl_devices)
if (backend_devices)
{
char *devices = hcstrdup (opencl_devices);
char *devices = hcstrdup (backend_devices);
if (devices == NULL) return false;
@ -378,8 +378,8 @@ static bool read_kernel_binary (hashcat_ctx_t *hashcat_ctx, const char *kernel_f
if (force_recompile == true)
{
// this adds some hopefully unique data to the opencl kernel source
// the effect should be that opencl kernel compiler caching see this as new "uncached" source
// this adds some hopefully unique data to the backend kernel source
// the effect should be that backend kernel compiler caching see this as new "uncached" source
// we have to do this since they do not check for the changes only in the #include source
time_t tlog = time (NULL);
@ -3356,7 +3356,7 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
}
else
{
// it's unclear if 4s is enough to turn on boost mode for all opencl device
// it's unclear if 4s is enough to turn on boost mode for all backend device
if ((total_msec > 4000) || (device_param->speed_pos == SPEED_CACHE - 1))
{
@ -3546,19 +3546,19 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (rc_ocl_check == -1) return -1;
/**
* OpenCL device selection (tbd rename)
* Backend device selection
*/
u64 devices_filter;
u64 backend_devices_filter;
const bool rc_devices_filter = setup_devices_filter (hashcat_ctx, user_options->opencl_devices, &devices_filter);
const bool rc_backend_devices_filter = setup_backend_devices_filter (hashcat_ctx, user_options->backend_devices, &backend_devices_filter);
if (rc_devices_filter == false) return -1;
if (rc_backend_devices_filter == false) return -1;
backend_ctx->devices_filter = devices_filter;
backend_ctx->backend_devices_filter = backend_devices_filter;
/**
* OpenCL device type selection (tbd rename)
* OpenCL device type selection
*/
cl_device_type opencl_device_types_filter;
@ -3596,6 +3596,7 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx)
hcfree (opencl_platforms_devices_cnt); \
hcfree (opencl_platforms_name); \
hcfree (opencl_platforms_vendor); \
hcfree (opencl_platforms_vendor_id); \
hcfree (opencl_platforms_version); \
}
@ -3605,6 +3606,7 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx)
cl_uint *opencl_platforms_devices_cnt = (cl_uint *) hccalloc (CL_PLATFORMS_MAX, sizeof (cl_uint));
char **opencl_platforms_name = (char **) hccalloc (CL_PLATFORMS_MAX, sizeof (char *));
char **opencl_platforms_vendor = (char **) hccalloc (CL_PLATFORMS_MAX, sizeof (char *));
cl_uint *opencl_platforms_vendor_id = (cl_uint *) hccalloc (CL_PLATFORMS_MAX, sizeof (cl_uint));
char **opencl_platforms_version = (char **) hccalloc (CL_PLATFORMS_MAX, sizeof (char *));
int CL_rc = hc_clGetPlatformIDs (hashcat_ctx, CL_PLATFORMS_MAX, opencl_platforms, &opencl_platforms_cnt);
@ -3620,6 +3622,123 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (opencl_platforms_cnt)
{
for (u32 opencl_platforms_idx = 0; opencl_platforms_idx < opencl_platforms_cnt; opencl_platforms_idx++)
{
cl_platform_id opencl_platform = opencl_platforms[opencl_platforms_idx];
size_t param_value_size = 0;
// platform vendor
int CL_rc;
CL_rc = hc_clGetPlatformInfo (hashcat_ctx, opencl_platform, CL_PLATFORM_VENDOR, 0, NULL, &param_value_size);
if (CL_rc == -1) return -1;
char *opencl_platform_vendor = (char *) hcmalloc (param_value_size);
CL_rc = hc_clGetPlatformInfo (hashcat_ctx, opencl_platform, CL_PLATFORM_VENDOR, param_value_size, opencl_platform_vendor, NULL);
if (CL_rc == -1) return -1;
opencl_platforms_vendor[opencl_platforms_idx] = opencl_platform_vendor;
// platform name
CL_rc = hc_clGetPlatformInfo (hashcat_ctx, opencl_platform, CL_PLATFORM_NAME, 0, NULL, &param_value_size);
if (CL_rc == -1) return -1;
char *opencl_platform_name = (char *) hcmalloc (param_value_size);
CL_rc = hc_clGetPlatformInfo (hashcat_ctx, opencl_platform, CL_PLATFORM_NAME, param_value_size, opencl_platform_name, NULL);
if (CL_rc == -1) return -1;
opencl_platforms_name[opencl_platforms_idx] = opencl_platform_name;
// platform version
CL_rc = hc_clGetPlatformInfo (hashcat_ctx, opencl_platform, CL_PLATFORM_VERSION, 0, NULL, &param_value_size);
if (CL_rc == -1) return -1;
char *opencl_platform_version = (char *) hcmalloc (param_value_size);
CL_rc = hc_clGetPlatformInfo (hashcat_ctx, opencl_platform, CL_PLATFORM_VERSION, param_value_size, opencl_platform_version, NULL);
if (CL_rc == -1) return -1;
opencl_platforms_version[opencl_platforms_idx] = opencl_platform_version;
// find our own platform vendor because pocl and mesa are pushing original vendor_id through opencl
// this causes trouble with vendor id based macros
// we'll assign generic to those without special optimization available
cl_uint opencl_platform_vendor_id = 0;
if (strcmp (opencl_platform_vendor, CL_VENDOR_AMD1) == 0)
{
opencl_platform_vendor_id = VENDOR_ID_AMD;
}
else if (strcmp (opencl_platform_vendor, CL_VENDOR_AMD2) == 0)
{
opencl_platform_vendor_id = VENDOR_ID_AMD;
}
else if (strcmp (opencl_platform_vendor, CL_VENDOR_AMD_USE_INTEL) == 0)
{
opencl_platform_vendor_id = VENDOR_ID_AMD_USE_INTEL;
}
else if (strcmp (opencl_platform_vendor, CL_VENDOR_APPLE) == 0)
{
opencl_platform_vendor_id = VENDOR_ID_APPLE;
}
else if (strcmp (opencl_platform_vendor, CL_VENDOR_INTEL_BEIGNET) == 0)
{
opencl_platform_vendor_id = VENDOR_ID_INTEL_BEIGNET;
}
else if (strcmp (opencl_platform_vendor, CL_VENDOR_INTEL_SDK) == 0)
{
opencl_platform_vendor_id = VENDOR_ID_INTEL_SDK;
}
else if (strcmp (opencl_platform_vendor, CL_VENDOR_MESA) == 0)
{
opencl_platform_vendor_id = VENDOR_ID_MESA;
}
else if (strcmp (opencl_platform_vendor, CL_VENDOR_NV) == 0)
{
opencl_platform_vendor_id = VENDOR_ID_NV;
}
else if (strcmp (opencl_platform_vendor, CL_VENDOR_POCL) == 0)
{
opencl_platform_vendor_id = VENDOR_ID_POCL;
}
else
{
opencl_platform_vendor_id = VENDOR_ID_GENERIC;
}
opencl_platforms_vendor_id[opencl_platforms_idx] = opencl_platform_vendor_id;
cl_device_id *opencl_platform_devices = (cl_device_id *) hccalloc (DEVICES_MAX, sizeof (cl_device_id));
cl_uint opencl_platform_devices_cnt = 0;
CL_rc = hc_clGetDeviceIDs (hashcat_ctx, opencl_platform, CL_DEVICE_TYPE_ALL, DEVICES_MAX, opencl_platform_devices, &opencl_platform_devices_cnt);
if (CL_rc == -1)
{
event_log_error (hashcat_ctx, "clGetDeviceIDs(): %s", val2cstr_cl (CL_rc));
return -1;
}
opencl_platforms_devices[opencl_platforms_idx] = opencl_platform_devices;
opencl_platforms_devices_cnt[opencl_platforms_idx] = opencl_platform_devices_cnt;
}
if (user_options->opencl_device_types == NULL)
{
/**
@ -3631,22 +3750,8 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx)
for (u32 opencl_platforms_idx = 0; opencl_platforms_idx < opencl_platforms_cnt; opencl_platforms_idx++)
{
cl_platform_id opencl_platform = opencl_platforms[opencl_platforms_idx];
cl_device_id *opencl_platform_devices = (cl_device_id *) hccalloc (DEVICES_MAX, sizeof (cl_device_id));
cl_uint opencl_platform_devices_cnt = 0;
CL_rc = hc_clGetDeviceIDs (hashcat_ctx, opencl_platform, CL_DEVICE_TYPE_ALL, DEVICES_MAX, opencl_platform_devices, &opencl_platform_devices_cnt);
if (CL_rc == -1)
{
hcfree (opencl_platform_devices);
FREE_OPENCL_CTX_ON_ERROR;
continue;
}
cl_device_id *opencl_platform_devices = opencl_platforms_devices[opencl_platforms_idx];
cl_uint opencl_platform_devices_cnt = opencl_platforms_devices_cnt[opencl_platforms_idx];
for (u32 opencl_platform_devices_idx = 0; opencl_platform_devices_idx < opencl_platform_devices_cnt; opencl_platform_devices_idx++)
{
@ -3665,8 +3770,6 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx)
opencl_device_types_all |= opencl_device_type;
}
hcfree (opencl_platform_devices);
}
// In such a case, automatically enable CPU device type support, since it's disabled by default.
@ -3697,6 +3800,7 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx)
backend_ctx->opencl_platforms_devices_cnt = opencl_platforms_devices_cnt;
backend_ctx->opencl_platforms_name = opencl_platforms_name;
backend_ctx->opencl_platforms_vendor = opencl_platforms_vendor;
backend_ctx->opencl_platforms_vendor_id = opencl_platforms_vendor_id;
backend_ctx->opencl_platforms_version = opencl_platforms_version;
#undef FREE_OPENCL_CTX_ON_ERROR
@ -3762,6 +3866,7 @@ void backend_ctx_destroy (hashcat_ctx_t *hashcat_ctx)
hcfree (backend_ctx->opencl_platforms_devices_cnt);
hcfree (backend_ctx->opencl_platforms_name);
hcfree (backend_ctx->opencl_platforms_vendor);
hcfree (backend_ctx->opencl_platforms_vendor_id);
hcfree (backend_ctx->opencl_platforms_version);
memset (backend_ctx, 0, sizeof (backend_ctx_t));
@ -3962,7 +4067,7 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
// skipped
if ((backend_ctx->devices_filter & (1ULL << device_id)) == 0)
if ((backend_ctx->backend_devices_filter & (1ULL << device_id)) == 0)
{
device_param->skipped = true;
}
@ -3988,127 +4093,16 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
* OpenCL devices: simply push all devices from all platforms into the same device array
*/
cl_platform_id *opencl_platforms = backend_ctx->opencl_platforms;
cl_uint opencl_platforms_cnt = backend_ctx->opencl_platforms_cnt;
cl_device_id **opencl_platforms_devices = backend_ctx->opencl_platforms_devices;
cl_uint *opencl_platforms_devices_cnt = backend_ctx->opencl_platforms_devices_cnt;
char **opencl_platforms_name = backend_ctx->opencl_platforms_name;
char **opencl_platforms_vendor = backend_ctx->opencl_platforms_vendor;
char **opencl_platforms_version = backend_ctx->opencl_platforms_version;
cl_uint *opencl_platforms_vendor_id = backend_ctx->opencl_platforms_vendor_id;
for (u32 opencl_platform_idx = 0; opencl_platform_idx < opencl_platforms_cnt; opencl_platform_idx++)
for (u32 opencl_platforms_idx = 0; opencl_platforms_idx < opencl_platforms_cnt; opencl_platforms_idx++)
{
size_t param_value_size = 0;
cl_platform_id opencl_platform = opencl_platforms[opencl_platform_idx];
// platform vendor
int CL_rc;
CL_rc = hc_clGetPlatformInfo (hashcat_ctx, opencl_platform, CL_PLATFORM_VENDOR, 0, NULL, &param_value_size);
if (CL_rc == -1) return -1;
char *opencl_platform_vendor = (char *) hcmalloc (param_value_size);
CL_rc = hc_clGetPlatformInfo (hashcat_ctx, opencl_platform, CL_PLATFORM_VENDOR, param_value_size, opencl_platform_vendor, NULL);
if (CL_rc == -1) return -1;
opencl_platforms_vendor[opencl_platform_idx] = opencl_platform_vendor;
// platform name
CL_rc = hc_clGetPlatformInfo (hashcat_ctx, opencl_platform, CL_PLATFORM_NAME, 0, NULL, &param_value_size);
if (CL_rc == -1) return -1;
char *opencl_platform_name = (char *) hcmalloc (param_value_size);
CL_rc = hc_clGetPlatformInfo (hashcat_ctx, opencl_platform, CL_PLATFORM_NAME, param_value_size, opencl_platform_name, NULL);
if (CL_rc == -1) return -1;
opencl_platforms_name[opencl_platform_idx] = opencl_platform_name;
// platform version
CL_rc = hc_clGetPlatformInfo (hashcat_ctx, opencl_platform, CL_PLATFORM_VERSION, 0, NULL, &param_value_size);
if (CL_rc == -1) return -1;
char *opencl_platform_version = (char *) hcmalloc (param_value_size);
CL_rc = hc_clGetPlatformInfo (hashcat_ctx, opencl_platform, CL_PLATFORM_VERSION, param_value_size, opencl_platform_version, NULL);
if (CL_rc == -1) return -1;
opencl_platforms_version[opencl_platform_idx] = opencl_platform_version;
// find our own platform vendor because pocl and mesa are pushing original vendor_id through opencl
// this causes trouble with vendor id based macros
// we'll assign generic to those without special optimization available
cl_uint opencl_platform_vendor_id = 0;
if (strcmp (opencl_platform_vendor, CL_VENDOR_AMD1) == 0)
{
opencl_platform_vendor_id = VENDOR_ID_AMD;
}
else if (strcmp (opencl_platform_vendor, CL_VENDOR_AMD2) == 0)
{
opencl_platform_vendor_id = VENDOR_ID_AMD;
}
else if (strcmp (opencl_platform_vendor, CL_VENDOR_AMD_USE_INTEL) == 0)
{
opencl_platform_vendor_id = VENDOR_ID_AMD_USE_INTEL;
}
else if (strcmp (opencl_platform_vendor, CL_VENDOR_APPLE) == 0)
{
opencl_platform_vendor_id = VENDOR_ID_APPLE;
}
else if (strcmp (opencl_platform_vendor, CL_VENDOR_INTEL_BEIGNET) == 0)
{
opencl_platform_vendor_id = VENDOR_ID_INTEL_BEIGNET;
}
else if (strcmp (opencl_platform_vendor, CL_VENDOR_INTEL_SDK) == 0)
{
opencl_platform_vendor_id = VENDOR_ID_INTEL_SDK;
}
else if (strcmp (opencl_platform_vendor, CL_VENDOR_MESA) == 0)
{
opencl_platform_vendor_id = VENDOR_ID_MESA;
}
else if (strcmp (opencl_platform_vendor, CL_VENDOR_NV) == 0)
{
opencl_platform_vendor_id = VENDOR_ID_NV;
}
else if (strcmp (opencl_platform_vendor, CL_VENDOR_POCL) == 0)
{
opencl_platform_vendor_id = VENDOR_ID_POCL;
}
else
{
opencl_platform_vendor_id = VENDOR_ID_GENERIC;
}
cl_device_id *opencl_platform_devices = (cl_device_id *) hccalloc (DEVICES_MAX, sizeof (cl_device_id));
cl_uint opencl_platform_devices_cnt = 0;
CL_rc = hc_clGetDeviceIDs (hashcat_ctx, opencl_platform, CL_DEVICE_TYPE_ALL, DEVICES_MAX, opencl_platform_devices, &opencl_platform_devices_cnt);
if (CL_rc == -1)
{
event_log_error (hashcat_ctx, "clGetDeviceIDs(): %s", val2cstr_cl (CL_rc));
return -1;
}
opencl_platforms_devices[opencl_platform_idx] = opencl_platform_devices;
opencl_platforms_devices_cnt[opencl_platform_idx] = opencl_platform_devices_cnt;
cl_device_id *opencl_platform_devices = opencl_platforms_devices[opencl_platforms_idx];
cl_uint opencl_platform_devices_cnt = opencl_platforms_devices_cnt[opencl_platforms_idx];
cl_uint opencl_platform_vendor_id = opencl_platforms_vendor_id[opencl_platforms_idx];
for (u32 opencl_platform_devices_idx = 0; opencl_platform_devices_idx < opencl_platform_devices_cnt; opencl_platform_devices_idx++, backend_devices_idx++, opencl_devices_cnt++)
{
@ -4120,18 +4114,20 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
backend_ctx->backend_device_from_opencl[opencl_devices_cnt] = backend_devices_idx;
backend_ctx->backend_device_from_opencl_platform[opencl_platform_idx][opencl_platform_devices_idx] = backend_devices_idx;
backend_ctx->backend_device_from_opencl_platform[opencl_platforms_idx][opencl_platform_devices_idx] = backend_devices_idx;
device_param->opencl_platform_vendor_id = opencl_platform_vendor_id;
device_param->opencl_device = opencl_platform_devices[opencl_platform_devices_idx];
device_param->opencl_platform_devices_id = opencl_platform_devices_idx;
device_param->opencl_platform = opencl_platform;
//device_param->opencl_platform = opencl_platform;
device_param->is_opencl = true;
size_t param_value_size = 0;
int CL_rc;
// opencl_device_type
cl_device_type opencl_device_type;
@ -4493,7 +4489,7 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
// skipped
if ((backend_ctx->devices_filter & (1ULL << device_id)) == 0)
if ((backend_ctx->backend_devices_filter & (1ULL << device_id)) == 0)
{
device_param->skipped = true;
}
@ -4606,7 +4602,7 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
if (device_param->skipped == false)
{
if ((user_options->force == false) && (user_options->opencl_info == false))
if ((user_options->force == false) && (user_options->backend_info == false))
{
if (opencl_device_type & CL_DEVICE_TYPE_CPU)
{
@ -4785,6 +4781,7 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
cl_context context;
/*
cl_context_properties properties[3];
properties[0] = CL_CONTEXT_PLATFORM;
@ -4792,6 +4789,9 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
properties[2] = 0;
CL_rc = hc_clCreateContext (hashcat_ctx, properties, 1, &device_param->opencl_device, NULL, NULL, &context);
*/
CL_rc = hc_clCreateContext (hashcat_ctx, NULL, 1, &device_param->opencl_device, NULL, NULL, &context);
if (CL_rc == -1) return -1;
@ -4960,13 +4960,13 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
// additional check to see if the user has chosen a device that is not within the range of available devices (i.e. larger than devices_cnt)
if (backend_ctx->devices_filter != (u64) -1)
if (backend_ctx->backend_devices_filter != (u64) -1)
{
const u64 backend_devices_cnt_mask = ~(((u64) -1 >> backend_ctx->backend_devices_cnt) << backend_ctx->backend_devices_cnt);
if (backend_ctx->devices_filter > backend_devices_cnt_mask)
if (backend_ctx->backend_devices_filter > backend_devices_cnt_mask)
{
event_log_error (hashcat_ctx, "An invalid device was specified using the --opencl-devices parameter.");
event_log_error (hashcat_ctx, "An invalid device was specified using the --backend-devices parameter.");
event_log_error (hashcat_ctx, "The specified device was higher than the number of available devices (%u).", backend_ctx->backend_devices_cnt);
return -1;
@ -5007,10 +5007,13 @@ void backend_ctx_devices_destroy (hashcat_ctx_t *hashcat_ctx)
hcfree (device_param->device_name);
hcfree (device_param->opencl_driver_version);
hcfree (device_param->opencl_device_version);
hcfree (device_param->opencl_device_c_version);
hcfree (device_param->opencl_device_vendor);
if (device_param->is_opencl == true)
{
hcfree (device_param->opencl_driver_version);
hcfree (device_param->opencl_device_version);
hcfree (device_param->opencl_device_c_version);
hcfree (device_param->opencl_device_vendor);
}
}
backend_ctx->backend_devices_cnt = 0;
@ -5374,7 +5377,7 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
if (device_param->skipped == true) continue;
EVENT_DATA (EVENT_OPENCL_DEVICE_INIT_PRE, &backend_devices_idx, sizeof (int));
EVENT_DATA (EVENT_BACKEND_DEVICE_INIT_PRE, &backend_devices_idx, sizeof (int));
const int device_id = device_param->device_id;
@ -5403,7 +5406,7 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
cl_uint vector_width;
if (user_options->opencl_vector_width_chgd == false)
if (user_options->backend_vector_width_chgd == false)
{
// tuning db
@ -5440,7 +5443,7 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
}
else
{
vector_width = user_options->opencl_vector_width;
vector_width = user_options->backend_vector_width;
}
// We can't have SIMD in kernels where we have an unknown final password length
@ -5600,6 +5603,7 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
* create context for each device
*/
/*
cl_context_properties properties[3];
properties[0] = CL_CONTEXT_PLATFORM;
@ -5607,6 +5611,9 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
properties[2] = 0;
CL_rc = hc_clCreateContext (hashcat_ctx, properties, 1, &device_param->opencl_device, NULL, NULL, &device_param->context);
*/
CL_rc = hc_clCreateContext (hashcat_ctx, NULL, 1, &device_param->opencl_device, NULL, NULL, &device_param->context);
if (CL_rc == -1) return -1;
@ -7720,7 +7727,7 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
hardware_power_all += device_param->hardware_power;
EVENT_DATA (EVENT_OPENCL_DEVICE_INIT_POST, &backend_devices_idx, sizeof (int));
EVENT_DATA (EVENT_BACKEND_DEVICE_INIT_POST, &backend_devices_idx, sizeof (int));
}
if (user_options->benchmark == false)

@ -82,7 +82,7 @@ int bitmap_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->example_hashes == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->opencl_info == true) return 0;
if (user_options->backend_info == true) return 0;
if (user_options->show == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;

@ -21,7 +21,7 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->example_hashes == true) return 0;
if (user_options->left == true) return 0;
if (user_options->opencl_info == true) return 0;
if (user_options->backend_info == true) return 0;
if (user_options->show == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;

@ -18,7 +18,7 @@ int cpt_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->example_hashes == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->opencl_info == true) return 0;
if (user_options->backend_info == true) return 0;
if (user_options->show == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;

@ -90,7 +90,7 @@ int debugfile_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->example_hashes == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->opencl_info == true) return 0;
if (user_options->backend_info == true) return 0;
if (user_options->show == true) return 0;
if (user_options->stdout_flag == true) return 0;
if (user_options->speed_only == true) return 0;

@ -56,7 +56,7 @@ int dictstat_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->example_hashes == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->opencl_info == true) return 0;
if (user_options->backend_info == true) return 0;
if (user_options->show == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;

@ -207,7 +207,7 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
EVENT (EVENT_AUTOTUNE_FINISHED);
/**
* find same opencl devices and equal results
* find same backend devices and equal results
*/
backend_ctx_devices_sync_tuning (hashcat_ctx);
@ -295,7 +295,7 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
// however, that can create confusion in hashcats RC, because exhausted translates to RC = 1.
// but then having RC = 1 does not match our expection if we use for speed-only and progress-only.
// to get hashcat to return RC = 0 we have to set it to CRACKED or BYPASS
// note: other options like --show, --left, --benchmark, --keyspace, --opencl-info, etc.
// note: other options like --show, --left, --benchmark, --keyspace, --backend-info, etc.
// not not reach this section of the code, they've returned already with rc 0.
if ((user_options->speed_only == true) || (user_options->progress_only == true))
@ -720,13 +720,13 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
* inform the user
*/
EVENT (EVENT_OPENCL_SESSION_PRE);
EVENT (EVENT_BACKEND_SESSION_PRE);
const int rc_session_begin = backend_session_begin (hashcat_ctx);
if (rc_session_begin == -1) return -1;
EVENT (EVENT_OPENCL_SESSION_POST);
EVENT (EVENT_BACKEND_SESSION_POST);
/**
* create self-test threads
@ -879,7 +879,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
potfile_write_close (hashcat_ctx);
// finalize opencl session
// finalize backend session
backend_session_destroy (hashcat_ctx);
@ -1169,7 +1169,7 @@ int hashcat_session_init (hashcat_ctx_t *hashcat_ctx, const char *install_folder
if (rc_user_options_check_files == -1) return -1;
/**
* Init OpenCL library loader
* Init backend library loader
*/
const int rc_backend_init = backend_ctx_init (hashcat_ctx);
@ -1177,7 +1177,7 @@ int hashcat_session_init (hashcat_ctx_t *hashcat_ctx, const char *install_folder
if (rc_backend_init == -1) return -1;
/**
* Init OpenCL devices
* Init backend devices
*/
const int rc_devices_init = backend_ctx_devices_init (hashcat_ctx, comptime);

@ -840,7 +840,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
else if (user_options->stdout_flag == true)
{
}
else if (user_options->opencl_info == true)
else if (user_options->backend_info == true)
{
}
else

File diff suppressed because it is too large Load Diff

@ -43,7 +43,7 @@ int induct_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->example_hashes == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->opencl_info == true) return 0;
if (user_options->backend_info == true) return 0;
if (user_options->show == true) return 0;
if (user_options->stdout_flag == true) return 0;
if (user_options->speed_only == true) return 0;

@ -64,7 +64,7 @@ int loopback_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->example_hashes == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->opencl_info == true) return 0;
if (user_options->backend_info == true) return 0;
if (user_options->show == true) return 0;
if (user_options->stdout_flag == true) return 0;
if (user_options->speed_only == true) return 0;

@ -190,7 +190,7 @@ static void main_outerloop_starting (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MA
status_ctx->shutdown_outer = false;
if ((user_options->example_hashes == false) && (user_options->keyspace == false) && (user_options->stdout_flag == false) && (user_options->opencl_info == false) && (user_options->speed_only == false))
if ((user_options->example_hashes == false) && (user_options->keyspace == false) && (user_options->stdout_flag == false) && (user_options->backend_info == false) && (user_options->speed_only == false))
{
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
{
@ -263,7 +263,7 @@ static void main_cracker_finished (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYB
if (user_options->example_hashes == true) return;
if (user_options->keyspace == true) return;
if (user_options->opencl_info == true) return;
if (user_options->backend_info == true) return;
if (user_options->stdout_flag == true) return;
// if we had a prompt, clear it
@ -512,9 +512,9 @@ static void main_outerloop_mainscreen (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx,
{
if (hashconfig->has_optimized_kernel == true)
{
event_log_advice (hashcat_ctx, "ATTENTION! Pure (unoptimized) OpenCL kernels selected.");
event_log_advice (hashcat_ctx, "ATTENTION! Pure (unoptimized) backend kernels selected.");
event_log_advice (hashcat_ctx, "Using pure kernels enables cracking longer passwords but for the price of drastically reduced performance.");
event_log_advice (hashcat_ctx, "If you want to switch to optimized OpenCL kernels, append -O to your commandline.");
event_log_advice (hashcat_ctx, "If you want to switch to optimized backend kernels, append -O to your commandline.");
event_log_advice (hashcat_ctx, "See the above message to find out about the exact limits.");
event_log_advice (hashcat_ctx, NULL);
}
@ -567,7 +567,7 @@ static void main_backend_session_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx,
event_log_info_nn (hashcat_ctx, "Initialized device kernels and memory...");
}
static void main_opencl_device_init_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
static void main_backend_device_init_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
{
const user_options_t *user_options = hashcat_ctx->user_options;
@ -575,10 +575,10 @@ static void main_opencl_device_init_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx
const u32 *device_id = (const u32 *) buf;
event_log_info_nn (hashcat_ctx, "Initializing OpenCL runtime for device #%u...", *device_id + 1);
event_log_info_nn (hashcat_ctx, "Initializing backend runtime for device #%u...", *device_id + 1);
}
static void main_opencl_device_init_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
static void main_backend_device_init_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
{
const user_options_t *user_options = hashcat_ctx->user_options;
@ -586,7 +586,7 @@ static void main_opencl_device_init_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ct
const u32 *device_id = (const u32 *) buf;
event_log_info_nn (hashcat_ctx, "Initialized OpenCL runtime for device #%u...", *device_id + 1);
event_log_info_nn (hashcat_ctx, "Initialized backend runtime for device #%u...", *device_id + 1);
}
static void main_bitmap_init_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
@ -735,7 +735,7 @@ static void main_monitor_performance_hint (MAYBE_UNUSED hashcat_ctx_t *hashcat_c
event_log_advice (hashcat_ctx, NULL);
}
event_log_advice (hashcat_ctx, "* Update your OpenCL runtime / driver the right way:");
event_log_advice (hashcat_ctx, "* Update your backend API runtime / driver the right way:");
event_log_advice (hashcat_ctx, " https://hashcat.net/faq/wrongdriver");
event_log_advice (hashcat_ctx, NULL);
event_log_advice (hashcat_ctx, "* Create more work items to make use of your parallelization power:");
@ -1022,10 +1022,10 @@ static void event (const u32 id, hashcat_ctx_t *hashcat_ctx, const void *buf, co
case EVENT_MONITOR_PERFORMANCE_HINT: main_monitor_performance_hint (hashcat_ctx, buf, len); break;
case EVENT_MONITOR_NOINPUT_HINT: main_monitor_noinput_hint (hashcat_ctx, buf, len); break;
case EVENT_MONITOR_NOINPUT_ABORT: main_monitor_noinput_abort (hashcat_ctx, buf, len); break;
case EVENT_OPENCL_SESSION_POST: main_backend_session_post (hashcat_ctx, buf, len); break;
case EVENT_OPENCL_SESSION_PRE: main_backend_session_pre (hashcat_ctx, buf, len); break;
case EVENT_OPENCL_DEVICE_INIT_POST: main_opencl_device_init_post (hashcat_ctx, buf, len); break;
case EVENT_OPENCL_DEVICE_INIT_PRE: main_opencl_device_init_pre (hashcat_ctx, buf, len); break;
case EVENT_BACKEND_SESSION_POST: main_backend_session_post (hashcat_ctx, buf, len); break;
case EVENT_BACKEND_SESSION_PRE: main_backend_session_pre (hashcat_ctx, buf, len); break;
case EVENT_BACKEND_DEVICE_INIT_POST: main_backend_device_init_post (hashcat_ctx, buf, len); break;
case EVENT_BACKEND_DEVICE_INIT_PRE: main_backend_device_init_pre (hashcat_ctx, buf, len); break;
case EVENT_OUTERLOOP_FINISHED: main_outerloop_finished (hashcat_ctx, buf, len); break;
case EVENT_OUTERLOOP_MAINSCREEN: main_outerloop_mainscreen (hashcat_ctx, buf, len); break;
case EVENT_OUTERLOOP_STARTING: main_outerloop_starting (hashcat_ctx, buf, len); break;
@ -1106,7 +1106,7 @@ int main (int argc, char **argv)
return 0;
}
// init a hashcat session; this initializes opencl devices, hwmon, etc
// init a hashcat session; this initializes backend devices, hwmon, etc
welcome_screen (hashcat_ctx, VERSION_TAG);
@ -1128,11 +1128,11 @@ int main (int argc, char **argv)
rc_final = 0;
}
else if (user_options->opencl_info == true)
else if (user_options->backend_info == true)
{
// if this is just opencl_info, no need to execute some real cracking session
// if this is just backend_info, no need to execute some real cracking session
opencl_info (hashcat_ctx);
backend_info (hashcat_ctx);
rc_final = 0;
}
@ -1140,7 +1140,7 @@ int main (int argc, char **argv)
{
// now execute hashcat
opencl_info_compact (hashcat_ctx);
backend_info_compact (hashcat_ctx);
user_options_info (hashcat_ctx);
@ -1148,7 +1148,7 @@ int main (int argc, char **argv)
}
}
// finish the hashcat session, this shuts down opencl devices, hwmon, etc
// finish the hashcat session, this shuts down backend devices, hwmon, etc
hashcat_session_destroy (hashcat_ctx);

@ -1398,7 +1398,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->example_hashes == true) return 0;
if (user_options->left == true) return 0;
if (user_options->opencl_info == true) return 0;
if (user_options->backend_info == true) return 0;
if (user_options->show == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;

@ -363,7 +363,7 @@ int outcheck_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->example_hashes == true) return 0;
if (user_options->speed_only == true) return 0;
if (user_options->progress_only == true) return 0;
if (user_options->opencl_info == true) return 0;
if (user_options->backend_info == true) return 0;
if (hashconfig->outfile_check_disable == true) return 0;

@ -103,7 +103,7 @@ int potfile_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->benchmark == true) return 0;
if (user_options->example_hashes == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->opencl_info == true) return 0;
if (user_options->backend_info == true) return 0;
if (user_options->stdout_flag == true) return 0;
if (user_options->speed_only == true) return 0;
if (user_options->progress_only == true) return 0;

@ -304,7 +304,7 @@ int restore_ctx_init (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
if (user_options->example_hashes == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->opencl_info == true) return 0;
if (user_options->backend_info == true) return 0;
if (user_options->show == true) return 0;
if (user_options->stdout_flag == true) return 0;
if (user_options->speed_only == true) return 0;

@ -214,7 +214,7 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->example_hashes == true) return 0;
if (user_options->left == true) return 0;
if (user_options->opencl_info == true) return 0;
if (user_options->backend_info == true) return 0;
if (user_options->show == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;

@ -654,7 +654,7 @@ void example_hashes (hashcat_ctx_t *hashcat_ctx)
}
}
void opencl_info (hashcat_ctx_t *hashcat_ctx)
void backend_info (hashcat_ctx_t *hashcat_ctx)
{
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
@ -684,7 +684,7 @@ void opencl_info (hashcat_ctx_t *hashcat_ctx)
if (device_param->device_id_alias_cnt)
{
event_log_info (hashcat_ctx, "Backend Device ID #%d (alias: #%d)", device_id + 1, device_param->device_id_alias_buf[0] + 1);
event_log_info (hashcat_ctx, "Backend Device ID #%d (Alias: #%d)", device_id + 1, device_param->device_id_alias_buf[0] + 1);
}
else
{
@ -745,7 +745,7 @@ void opencl_info (hashcat_ctx_t *hashcat_ctx)
if (device_param->device_id_alias_cnt)
{
event_log_info (hashcat_ctx, " Backend Device ID #%d (alias: #%d)", device_id + 1, device_param->device_id_alias_buf[0] + 1);
event_log_info (hashcat_ctx, " Backend Device ID #%d (Alias: #%d)", device_id + 1, device_param->device_id_alias_buf[0] + 1);
}
else
{
@ -768,7 +768,7 @@ void opencl_info (hashcat_ctx_t *hashcat_ctx)
}
}
void opencl_info_compact (hashcat_ctx_t *hashcat_ctx)
void backend_info_compact (hashcat_ctx_t *hashcat_ctx)
{
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
const user_options_t *user_options = hashcat_ctx->user_options;

@ -57,7 +57,7 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->example_hashes == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->opencl_info == true) return 0;
if (user_options->backend_info == true) return 0;
if (user_options->show == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;

@ -89,15 +89,15 @@ static const char *const USAGE_BIG_PRE_HASHMODES[] =
" --bitmap-max | Num | Sets maximum bits allowed for bitmaps to X | --bitmap-max=24",
" --cpu-affinity | Str | Locks to CPU devices, separated with commas | --cpu-affinity=1,2,3",
" --example-hashes | | Show an example hash for each hash-mode |",
" -I, --opencl-info | | Show info about detected OpenCL platforms/devices | -I",
" -d, --opencl-devices | Str | OpenCL devices to use, separated with commas | -d 1",
" -I, --backend-info | | Show info about detected backend API devices | -I",
" -d, --backend-devices | Str | Backend devices to use, separated with commas | -d 1",
" -D, --opencl-device-types | Str | OpenCL device-types to use, separated with commas | -D 1",
" --opencl-vector-width | Num | Manually override OpenCL vector-width to X | --opencl-vector=4",
" -O, --optimized-kernel-enable | | Enable optimized kernels (limits password length) |",
" -w, --workload-profile | Num | Enable a specific workload profile, see pool below | -w 3",
" -n, --kernel-accel | Num | Manual workload tuning, set outerloop step size to X | -n 64",
" -u, --kernel-loops | Num | Manual workload tuning, set innerloop step size to X | -u 256",
" -T, --kernel-threads | Num | Manual workload tuning, set thread count to X | -T 64",
" --backend-vector-width | Num | Manually override backend vector-width to X | --backend-vector=4",
" --spin-damp | Num | Use CPU for device synchronization, in percent | --spin-damp=50",
" --hwmon-disable | | Disable temperature and fanspeed reads and triggers |",
" --hwmon-temp-abort | Num | Abort if temperature reaches X degrees Celsius | --hwmon-temp-abort=100",

@ -28,6 +28,9 @@ static const struct option long_options[] =
{
{"advice-disable", no_argument, NULL, IDX_ADVICE_DISABLE},
{"attack-mode", required_argument, NULL, IDX_ATTACK_MODE},
{"backend-devices", required_argument, NULL, IDX_BACKEND_DEVICES},
{"backend-info", no_argument, NULL, IDX_BACKEND_INFO},
{"backend-vector-width", required_argument, NULL, IDX_BACKEND_VECTOR_WIDTH},
{"benchmark-all", no_argument, NULL, IDX_BENCHMARK_ALL},
{"benchmark", no_argument, NULL, IDX_BENCHMARK},
{"bitmap-max", required_argument, NULL, IDX_BITMAP_MAX},
@ -75,10 +78,7 @@ static const struct option long_options[] =
{"markov-hcstat2", required_argument, NULL, IDX_MARKOV_HCSTAT2},
{"markov-threshold", required_argument, NULL, IDX_MARKOV_THRESHOLD},
{"nonce-error-corrections", required_argument, NULL, IDX_NONCE_ERROR_CORRECTIONS},
{"opencl-devices", required_argument, NULL, IDX_OPENCL_DEVICES},
{"opencl-device-types", required_argument, NULL, IDX_OPENCL_DEVICE_TYPES},
{"opencl-info", no_argument, NULL, IDX_OPENCL_INFO},
{"opencl-vector-width", required_argument, NULL, IDX_OPENCL_VECTOR_WIDTH},
{"optimized-kernel-enable", no_argument, NULL, IDX_OPTIMIZED_KERNEL_ENABLE},
{"outfile-autohex-disable", no_argument, NULL, IDX_OUTFILE_AUTOHEX_DISABLE},
{"outfile-check-dir", required_argument, NULL, IDX_OUTFILE_CHECK_DIR},
@ -151,6 +151,9 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
user_options->advice_disable = ADVICE_DISABLE;
user_options->attack_mode = ATTACK_MODE;
user_options->backend_devices = NULL;
user_options->backend_info = BACKEND_INFO;
user_options->backend_vector_width = BACKEND_VECTOR_WIDTH;
user_options->benchmark_all = BENCHMARK_ALL;
user_options->benchmark = BENCHMARK;
user_options->bitmap_max = BITMAP_MAX;
@ -202,10 +205,7 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
user_options->markov_hcstat2 = NULL;
user_options->markov_threshold = MARKOV_THRESHOLD;
user_options->nonce_error_corrections = NONCE_ERROR_CORRECTIONS;
user_options->opencl_devices = NULL;
user_options->opencl_device_types = NULL;
user_options->opencl_info = OPENCL_INFO;
user_options->opencl_vector_width = OPENCL_VECTOR_WIDTH;
user_options->optimized_kernel_enable = OPTIMIZED_KERNEL_ENABLE;
user_options->outfile_autohex = OUTFILE_AUTOHEX;
user_options->outfile_check_dir = NULL;
@ -304,7 +304,7 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
case IDX_MARKOV_THRESHOLD:
case IDX_OUTFILE_FORMAT:
case IDX_OUTFILE_CHECK_TIMER:
case IDX_OPENCL_VECTOR_WIDTH:
case IDX_BACKEND_VECTOR_WIDTH:
case IDX_WORKLOAD_PROFILE:
case IDX_KERNEL_ACCEL:
case IDX_KERNEL_LOOPS:
@ -423,11 +423,11 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
case IDX_HEX_SALT: user_options->hex_salt = true; break;
case IDX_HEX_WORDLIST: user_options->hex_wordlist = true; break;
case IDX_CPU_AFFINITY: user_options->cpu_affinity = optarg; break;
case IDX_OPENCL_INFO: user_options->opencl_info = true; break;
case IDX_OPENCL_DEVICES: user_options->opencl_devices = optarg; break;
case IDX_BACKEND_INFO: user_options->backend_info = true; break;
case IDX_BACKEND_DEVICES: user_options->backend_devices = optarg; break;
case IDX_BACKEND_VECTOR_WIDTH: user_options->backend_vector_width = hc_strtoul (optarg, NULL, 10);
user_options->backend_vector_width_chgd = true; break;
case IDX_OPENCL_DEVICE_TYPES: user_options->opencl_device_types = optarg; break;
case IDX_OPENCL_VECTOR_WIDTH: user_options->opencl_vector_width = hc_strtoul (optarg, NULL, 10);
user_options->opencl_vector_width_chgd = true; break;
case IDX_OPTIMIZED_KERNEL_ENABLE: user_options->optimized_kernel_enable = true; break;
case IDX_WORKLOAD_PROFILE: user_options->workload_profile = hc_strtoul (optarg, NULL, 10);
user_options->workload_profile_chgd = true; break;
@ -856,11 +856,11 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
return -1;
}
if (user_options->opencl_vector_width_chgd == true)
if (user_options->backend_vector_width_chgd == true)
{
if (is_power_of_2 (user_options->opencl_vector_width) == false || user_options->opencl_vector_width > 16)
if (is_power_of_2 (user_options->backend_vector_width) == false || user_options->backend_vector_width > 16)
{
event_log_error (hashcat_ctx, "opencl-vector-width %u is not allowed.", user_options->opencl_vector_width);
event_log_error (hashcat_ctx, "backend-vector-width %u is not allowed.", user_options->backend_vector_width);
return -1;
}
@ -1087,11 +1087,11 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
}
}
if (user_options->opencl_devices != NULL)
if (user_options->backend_devices != NULL)
{
if (strlen (user_options->opencl_devices) == 0)
if (strlen (user_options->backend_devices) == 0)
{
event_log_error (hashcat_ctx, "Invalid --opencl-devices value - must not be empty.");
event_log_error (hashcat_ctx, "Invalid --backend-devices value - must not be empty.");
return -1;
}
@ -1220,7 +1220,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
show_error = false;
}
}
else if (user_options->opencl_info == true)
else if (user_options->backend_info == true)
{
if (user_options->hc_argc == 0)
{
@ -1420,9 +1420,9 @@ void user_options_session_auto (hashcat_ctx_t *hashcat_ctx)
user_options->session = "stdout";
}
if (user_options->opencl_info == true)
if (user_options->backend_info == true)
{
user_options->session = "opencl_info";
user_options->session = "backend_info";
}
if (user_options->show == true)
@ -1469,7 +1469,7 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx)
}
if (user_options->example_hashes == true
|| user_options->opencl_info == true
|| user_options->backend_info == true
|| user_options->keyspace == true
|| user_options->speed_only == true
|| user_options->progress_only == true
@ -1546,17 +1546,17 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx)
if (user_options->slow_candidates == true)
{
user_options->opencl_vector_width = 1;
user_options->backend_vector_width = 1;
}
if (user_options->stdout_flag == true)
{
user_options->force = true;
user_options->hash_mode = 2000;
user_options->kernel_accel = 1024;
user_options->opencl_vector_width = 1;
user_options->outfile_format = OUTFILE_FMT_PLAIN;
user_options->quiet = true;
user_options->force = true;
user_options->hash_mode = 2000;
user_options->kernel_accel = 1024;
user_options->backend_vector_width = 1;
user_options->outfile_format = OUTFILE_FMT_PLAIN;
user_options->quiet = true;
if (user_options->attack_mode == ATTACK_MODE_STRAIGHT)
{
@ -1580,9 +1580,9 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx)
}
}
if (user_options->opencl_info == true)
if (user_options->backend_info == true)
{
user_options->opencl_devices = NULL;
user_options->backend_devices = NULL;
user_options->opencl_device_types = hcstrdup ("1,2,3");
user_options->quiet = true;
}
@ -1638,7 +1638,7 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx)
{
}
else if (user_options->opencl_info == true)
else if (user_options->backend_info == true)
{
}
@ -1718,9 +1718,9 @@ void user_options_info (hashcat_ctx_t *hashcat_ctx)
event_log_info (hashcat_ctx, "* --force");
}
if (user_options->opencl_devices)
if (user_options->backend_devices)
{
event_log_info (hashcat_ctx, "* --opencl-devices=%s", user_options->opencl_devices);
event_log_info (hashcat_ctx, "* --backend-devices=%s", user_options->backend_devices);
}
if (user_options->opencl_device_types)
@ -1733,9 +1733,9 @@ void user_options_info (hashcat_ctx_t *hashcat_ctx)
event_log_info (hashcat_ctx, "* --optimized-kernel-enable");
}
if (user_options->opencl_vector_width_chgd == true)
if (user_options->backend_vector_width_chgd == true)
{
event_log_info (hashcat_ctx, "* --opencl-vector-width=%u", user_options->opencl_vector_width);
event_log_info (hashcat_ctx, "* --backend-vector-width=%u", user_options->backend_vector_width);
}
if (user_options->kernel_accel_chgd == true)
@ -1772,9 +1772,9 @@ void user_options_info (hashcat_ctx_t *hashcat_ctx)
event_log_info (hashcat_ctx, "# option: --force");
}
if (user_options->opencl_devices)
if (user_options->backend_devices)
{
event_log_info (hashcat_ctx, "# option: --opencl-devices=%s", user_options->opencl_devices);
event_log_info (hashcat_ctx, "# option: --backend-devices=%s", user_options->backend_devices);
}
if (user_options->opencl_device_types)
@ -1787,9 +1787,9 @@ void user_options_info (hashcat_ctx_t *hashcat_ctx)
event_log_info (hashcat_ctx, "# option: --optimized-kernel-enable");
}
if (user_options->opencl_vector_width_chgd == true)
if (user_options->backend_vector_width_chgd == true)
{
event_log_info (hashcat_ctx, "# option: --opencl-vector-width=%u", user_options->opencl_vector_width);
event_log_info (hashcat_ctx, "# option: --backend-vector-width=%u", user_options->backend_vector_width);
}
if (user_options->kernel_accel_chgd == true)
@ -1851,7 +1851,7 @@ void user_options_extra_init (hashcat_ctx_t *hashcat_ctx)
{
}
else if (user_options->opencl_info == true)
else if (user_options->backend_info == true)
{
}
@ -2563,7 +2563,7 @@ int user_options_check_files (hashcat_ctx_t *hashcat_ctx)
hcfree (modulefile);
// same check but for an OpenCL kernel
// same check but for an backend kernel
char *kernelfile = (char *) hcmalloc (HCBUFSIZ_TINY);
@ -2694,7 +2694,7 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx)
logfile_top_string (user_options->induction_dir);
logfile_top_string (user_options->keyboard_layout_mapping);
logfile_top_string (user_options->markov_hcstat2);
logfile_top_string (user_options->opencl_devices);
logfile_top_string (user_options->backend_devices);
logfile_top_string (user_options->opencl_device_types);
logfile_top_string (user_options->outfile);
logfile_top_string (user_options->outfile_check_dir);
@ -2740,8 +2740,8 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx)
logfile_top_uint (user_options->markov_classic);
logfile_top_uint (user_options->markov_disable);
logfile_top_uint (user_options->markov_threshold);
logfile_top_uint (user_options->opencl_info);
logfile_top_uint (user_options->opencl_vector_width);
logfile_top_uint (user_options->backend_info);
logfile_top_uint (user_options->backend_vector_width);
logfile_top_uint (user_options->optimized_kernel_enable);
logfile_top_uint (user_options->outfile_autohex);
logfile_top_uint (user_options->outfile_check_timer);

@ -560,7 +560,7 @@ int wl_data_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->benchmark == true) return 0;
if (user_options->example_hashes == true) return 0;
if (user_options->left == true) return 0;
if (user_options->opencl_info == true) return 0;
if (user_options->backend_info == true) return 0;
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;

Loading…
Cancel
Save