From 0ff49c5b44bbe0eab4daa3b76389c66c306e4669 Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Tue, 12 Jan 2016 17:18:01 +0100 Subject: [PATCH] Fix segfault in related to weak-hash-check on CPU devices Move typedef for bool datatype to common.h --- include/common.h | 2 ++ include/ext_ADL.h | 4 ---- include/shared.h | 2 -- src/oclHashcat.c | 9 ++++----- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/include/common.h b/include/common.h index 40c5d498f..3c4a1cb51 100644 --- a/include/common.h +++ b/include/common.h @@ -93,6 +93,8 @@ void log_out (FILE *fp, const char *fmt, ...); void log_info (const char *fmt, ...); void log_error (const char *fmt, ...); +typedef int bool; // this is ugly but ADL requires the bool datatype + typedef uint32_t uint; // we should rename to u32, sooner or later, for consistency typedef uint64_t u64; diff --git a/include/ext_ADL.h b/include/ext_ADL.h index ae13434b5..8604b280d 100644 --- a/include/ext_ADL.h +++ b/include/ext_ADL.h @@ -8,10 +8,6 @@ #include -// this is ugly but ADL requires the bool datatype - -typedef int bool; - #include typedef int HM_ADAPTER_AMD; diff --git a/include/shared.h b/include/shared.h index fe738189d..3359fc8e7 100644 --- a/include/shared.h +++ b/include/shared.h @@ -1904,8 +1904,6 @@ void hc_signal (void c (int)); #endif -typedef int bool; - bool class_num (char c); bool class_lower (char c); bool class_upper (char c); diff --git a/src/oclHashcat.c b/src/oclHashcat.c index 05ce3292b..9018c2374 100644 --- a/src/oclHashcat.c +++ b/src/oclHashcat.c @@ -2658,7 +2658,7 @@ static void run_cracker (hc_device_param_t *device_param, const uint pw_cnt, con uint innerloop_cnt = 0; if (data.attack_exec == ATTACK_EXEC_INSIDE_KERNEL) innerloop_step = kernel_loops; - else innerloop_step = 1; + else innerloop_step = 1; if (data.attack_kern == ATTACK_KERN_STRAIGHT) innerloop_cnt = data.kernel_rules_cnt; else if (data.attack_kern == ATTACK_KERN_COMBI) innerloop_cnt = data.combs_cnt; @@ -13826,6 +13826,7 @@ int main (int argc, char **argv) device_param->d_pws_buf = hc_clCreateBuffer (device_param->context, CL_MEM_READ_ONLY, size_pws, NULL); device_param->d_pws_amp_buf = hc_clCreateBuffer (device_param->context, CL_MEM_READ_ONLY, size_pws, NULL); + device_param->d_rules_c = hc_clCreateBuffer (device_param->context, CL_MEM_READ_ONLY, size_rules_c, NULL); // we need this for weak-hash-check even if the user has choosen for ex: -a 3 device_param->d_tmps = hc_clCreateBuffer (device_param->context, CL_MEM_READ_WRITE, size_tmps, NULL); device_param->d_hooks = hc_clCreateBuffer (device_param->context, CL_MEM_READ_WRITE, size_hooks, NULL); device_param->d_bitmap_s1_a = hc_clCreateBuffer (device_param->context, CL_MEM_READ_ONLY, bitmap_size, NULL); @@ -13857,6 +13858,7 @@ int main (int argc, char **argv) run_kernel_bzero (device_param, device_param->d_pws_buf, size_pws); run_kernel_bzero (device_param, device_param->d_pws_amp_buf, size_pws); + run_kernel_bzero (device_param, device_param->d_rules_c, size_rules_c); run_kernel_bzero (device_param, device_param->d_tmps, size_tmps); run_kernel_bzero (device_param, device_param->d_hooks, size_hooks); run_kernel_bzero (device_param, device_param->d_plain_bufs, size_plains); @@ -13868,12 +13870,9 @@ int main (int argc, char **argv) if (attack_kern == ATTACK_KERN_STRAIGHT) { - device_param->d_rules = hc_clCreateBuffer (device_param->context, CL_MEM_READ_ONLY, size_rules, NULL); - device_param->d_rules_c = hc_clCreateBuffer (device_param->context, CL_MEM_READ_ONLY, size_rules_c, NULL); + device_param->d_rules = hc_clCreateBuffer (device_param->context, CL_MEM_READ_ONLY, size_rules, NULL); hc_clEnqueueWriteBuffer (device_param->command_queue, device_param->d_rules, CL_TRUE, 0, size_rules, kernel_rules_buf, 0, NULL, NULL); - - run_kernel_bzero (device_param, device_param->d_rules_c, size_rules_c); } else if (attack_kern == ATTACK_KERN_COMBI) {