1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-23 00:28:11 +00:00

Revert use of zero-copy for main password buffer using CL_MEM_ALLOC_HOST_PTR and hc_clEnqueueMapBuffer()

Caused problems with WPA cracking performance on NVidia when not using rules
This commit is contained in:
Jens Steube 2017-09-05 17:19:49 +02:00
parent 63f6ca5114
commit 3e597f4c7b

View File

@ -1794,17 +1794,7 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
{ {
int CL_rc; const int CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, pws_cnt * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
CL_rc = hc_clEnqueueUnmapMemObject (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, device_param->pws_buf, 0, NULL, NULL);
if (CL_rc == -1) return -1;
CL_rc = hc_clFinish (hashcat_ctx, device_param->command_queue);
if (CL_rc == -1) return -1;
CL_rc = hc_clEnqueueMapBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, CL_MAP_WRITE, 0, device_param->size_pws, 0, NULL, NULL, (void **) &device_param->pws_buf);
if (CL_rc == -1) return -1; if (CL_rc == -1) return -1;
} }
@ -1866,17 +1856,7 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const
} }
} }
int CL_rc; const int CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, pws_cnt * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
CL_rc = hc_clEnqueueUnmapMemObject (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, device_param->pws_buf, 0, NULL, NULL);
if (CL_rc == -1) return -1;
CL_rc = hc_clFinish (hashcat_ctx, device_param->command_queue);
if (CL_rc == -1) return -1;
CL_rc = hc_clEnqueueMapBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, CL_MAP_WRITE, 0, device_param->size_pws, 0, NULL, NULL, (void **) &device_param->pws_buf);
if (CL_rc == -1) return -1; if (CL_rc == -1) return -1;
} }
@ -1884,33 +1864,13 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const
{ {
if (user_options->attack_mode == ATTACK_MODE_COMBI) if (user_options->attack_mode == ATTACK_MODE_COMBI)
{ {
int CL_rc; const int CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, pws_cnt * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
CL_rc = hc_clEnqueueUnmapMemObject (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, device_param->pws_buf, 0, NULL, NULL);
if (CL_rc == -1) return -1;
CL_rc = hc_clFinish (hashcat_ctx, device_param->command_queue);
if (CL_rc == -1) return -1;
CL_rc = hc_clEnqueueMapBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, CL_MAP_WRITE, 0, device_param->size_pws, 0, NULL, NULL, (void **) &device_param->pws_buf);
if (CL_rc == -1) return -1; if (CL_rc == -1) return -1;
} }
else if (user_options->attack_mode == ATTACK_MODE_HYBRID1) else if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
{ {
int CL_rc; const int CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, pws_cnt * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
CL_rc = hc_clEnqueueUnmapMemObject (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, device_param->pws_buf, 0, NULL, NULL);
if (CL_rc == -1) return -1;
CL_rc = hc_clFinish (hashcat_ctx, device_param->command_queue);
if (CL_rc == -1) return -1;
CL_rc = hc_clEnqueueMapBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, CL_MAP_WRITE, 0, device_param->size_pws, 0, NULL, NULL, (void **) &device_param->pws_buf);
if (CL_rc == -1) return -1; if (CL_rc == -1) return -1;
} }
@ -4826,8 +4786,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
* global buffers * global buffers
*/ */
CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_ONLY | CL_MEM_ALLOC_HOST_PTR, CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_ONLY, size_pws, NULL, &device_param->d_pws_buf); if (CL_rc == -1) return -1;
size_pws, NULL, &device_param->d_pws_buf); if (CL_rc == -1) return -1;
CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_ONLY, size_pws_amp, NULL, &device_param->d_pws_amp_buf); if (CL_rc == -1) return -1; CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_ONLY, size_pws_amp, NULL, &device_param->d_pws_amp_buf); if (CL_rc == -1) return -1;
CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_WRITE, size_tmps, NULL, &device_param->d_tmps); if (CL_rc == -1) return -1; CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_WRITE, size_tmps, NULL, &device_param->d_tmps); if (CL_rc == -1) return -1;
CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_WRITE, size_hooks, NULL, &device_param->d_hooks); if (CL_rc == -1) return -1; CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_WRITE, size_hooks, NULL, &device_param->d_hooks); if (CL_rc == -1) return -1;
@ -4921,9 +4880,9 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
* main host data * main host data
*/ */
CL_rc = hc_clEnqueueMapBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, CL_MAP_WRITE, 0, device_param->size_pws, 0, NULL, NULL, (void **) &device_param->pws_buf); pw_t *pws_buf = (pw_t *) hcmalloc (size_pws);
if (CL_rc == -1) return -1; device_param->pws_buf = pws_buf;
pw_t *combs_buf = (pw_t *) hccalloc (KERNEL_COMBS, sizeof (pw_t)); pw_t *combs_buf = (pw_t *) hccalloc (KERNEL_COMBS, sizeof (pw_t));
@ -5535,8 +5494,7 @@ void opencl_session_destroy (hashcat_ctx_t *hashcat_ctx)
if (device_param->skipped == true) continue; if (device_param->skipped == true) continue;
hc_clEnqueueUnmapMemObject (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, device_param->pws_buf, 0, NULL, NULL); hcfree (device_param->pws_buf);
hcfree (device_param->combs_buf); hcfree (device_param->combs_buf);
hcfree (device_param->hooks_buf); hcfree (device_param->hooks_buf);