From 14324467340f3aa20d4789617967cae2015daf9f Mon Sep 17 00:00:00 2001 From: jsteube Date: Sun, 20 Aug 2017 12:04:56 +0200 Subject: [PATCH] Fix initialization of size_pws_amp --- src/autotune.c | 2 +- src/opencl.c | 17 ++++++++++------- src/selftest.c | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/autotune.c b/src/autotune.c index 652319f59..892f80dba 100644 --- a/src/autotune.c +++ b/src/autotune.c @@ -272,7 +272,7 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (hashconfig->attack_exec == ATTACK_EXEC_OUTSIDE_KERNEL) { - CL_rc = run_kernel_memset (hashcat_ctx, device_param, device_param->d_pws_amp_buf, 0, device_param->size_pws); + CL_rc = run_kernel_memset (hashcat_ctx, device_param, device_param->d_pws_amp_buf, 0, device_param->size_pws_amp); if (CL_rc == -1) return -1; } diff --git a/src/opencl.c b/src/opencl.c index ef7354570..b000d8c4e 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -3955,6 +3955,8 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) const size_t size_pws = kernel_power_max * sizeof (pw_t); + const size_t size_pws_amp = size_pws; + // size_tmps const size_t size_tmps = kernel_power_max * hashconfig->tmp_size; @@ -3980,7 +3982,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) + size_markov_css + size_plains + size_pws - + size_pws // not a bug + + size_pws_amp + size_results + size_root_css + size_rules @@ -4064,9 +4066,10 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) // find out if we would request too much memory on memory blocks which are based on kernel_accel - size_t size_pws = 4; - size_t size_tmps = 4; - size_t size_hooks = 4; + size_t size_pws = 4; + size_t size_pws_amp = 4; + size_t size_tmps = 4; + size_t size_hooks = 4; while (kernel_accel_max >= kernel_accel_min) { @@ -4076,6 +4079,8 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) size_pws = kernel_power_max * sizeof (pw_t); + size_pws_amp = (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) ? 1 : size_pws; + // size_tmps size_tmps = kernel_power_max * hashconfig->tmp_size; @@ -4110,7 +4115,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) + size_markov_css + size_plains + size_pws - + size_pws // not a bug + + size_pws_amp + size_results + size_root_css + size_rules @@ -4158,8 +4163,6 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) } */ - const size_t size_pws_amp = (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) ? size_pws : size_pws; - device_param->size_bfs = size_bfs; device_param->size_combs = size_combs; device_param->size_rules = size_rules; diff --git a/src/selftest.c b/src/selftest.c index 4609d2c31..1314069ec 100644 --- a/src/selftest.c +++ b/src/selftest.c @@ -455,7 +455,7 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param device_param->kernel_params[18] = &device_param->d_esalt_bufs; CL_rc = run_kernel_bzero (hashcat_ctx, device_param, device_param->d_pws_buf, device_param->size_pws); if (CL_rc == -1) return -1; - CL_rc = run_kernel_bzero (hashcat_ctx, device_param, device_param->d_pws_amp_buf, device_param->size_pws); if (CL_rc == -1) return -1; + CL_rc = run_kernel_bzero (hashcat_ctx, device_param, device_param->d_pws_amp_buf, device_param->size_pws_amp); if (CL_rc == -1) return -1; CL_rc = run_kernel_bzero (hashcat_ctx, device_param, device_param->d_tmps, device_param->size_tmps); if (CL_rc == -1) return -1; CL_rc = run_kernel_bzero (hashcat_ctx, device_param, device_param->d_hooks, device_param->size_hooks); if (CL_rc == -1) return -1; CL_rc = run_kernel_bzero (hashcat_ctx, device_param, device_param->d_plain_bufs, device_param->size_plains); if (CL_rc == -1) return -1;