1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 01:50:10 +00:00

Add some more returncode checks

This commit is contained in:
jsteube 2016-10-15 19:44:31 +02:00
parent 7383bb14f5
commit bfbc4279f4
2 changed files with 54 additions and 28 deletions

View File

@ -82,9 +82,13 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
const u32 kernel_power_max = device_param->device_processors * device_param->kernel_threads * kernel_accel_max; const u32 kernel_power_max = device_param->device_processors * device_param->kernel_threads * kernel_accel_max;
int CL_rc;
if (user_options_extra->attack_kern == ATTACK_KERN_BF) if (user_options_extra->attack_kern == ATTACK_KERN_BF)
{ {
run_kernel_memset (hashcat_ctx, device_param, device_param->d_pws_buf, 7, kernel_power_max * sizeof (pw_t)); CL_rc = run_kernel_memset (hashcat_ctx, device_param, device_param->d_pws_buf, 7, kernel_power_max * sizeof (pw_t));
if (CL_rc == -1) return -1;
} }
else else
{ {
@ -95,33 +99,25 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
device_param->pws_buf[i].pw_len = 7 + (i & 7); device_param->pws_buf[i].pw_len = 7 + (i & 7);
} }
cl_int CL_err = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL); CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
if (CL_err != CL_SUCCESS) if (CL_rc == -1) return -1;
{
event_log_error (hashcat_ctx, "clEnqueueWriteBuffer(): %s", val2cstr_cl (CL_err));
return -1;
}
} }
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{ {
if (straight_ctx->kernel_rules_cnt > 1) if (straight_ctx->kernel_rules_cnt > 1)
{ {
cl_int CL_err = hc_clEnqueueCopyBuffer (hashcat_ctx, device_param->command_queue, device_param->d_rules, device_param->d_rules_c, 0, 0, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t), 0, NULL, NULL); CL_rc = hc_clEnqueueCopyBuffer (hashcat_ctx, device_param->command_queue, device_param->d_rules, device_param->d_rules_c, 0, 0, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t), 0, NULL, NULL);
if (CL_err != CL_SUCCESS) if (CL_rc == -1) return -1;
{
event_log_error (hashcat_ctx, "clEnqueueCopyBuffer(): %s", val2cstr_cl (CL_err));
return -1;
}
} }
} }
else else
{ {
run_kernel_amp (hashcat_ctx, device_param, kernel_power_max); CL_rc = run_kernel_amp (hashcat_ctx, device_param, kernel_power_max);
if (CL_rc == -1) return -1;
} }
#define VERIFIER_CNT 1 #define VERIFIER_CNT 1
@ -252,11 +248,15 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_amp_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL); hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_amp_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
*/ */
run_kernel_memset (hashcat_ctx, device_param, device_param->d_pws_buf, 0, kernel_power_max * sizeof (pw_t)); CL_rc = run_kernel_memset (hashcat_ctx, device_param, device_param->d_pws_buf, 0, kernel_power_max * sizeof (pw_t));
if (CL_rc == -1) return -1;
if (hashconfig->attack_exec == ATTACK_EXEC_OUTSIDE_KERNEL) if (hashconfig->attack_exec == ATTACK_EXEC_OUTSIDE_KERNEL)
{ {
run_kernel_memset (hashcat_ctx, device_param, device_param->d_pws_amp_buf, 0, kernel_power_max * sizeof (pw_t)); CL_rc = run_kernel_memset (hashcat_ctx, device_param, device_param->d_pws_amp_buf, 0, kernel_power_max * sizeof (pw_t));
if (CL_rc == -1) return -1;
} }
// reset timer // reset timer

View File

@ -200,9 +200,15 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
if (pws_cnt) if (pws_cnt)
{ {
run_copy (hashcat_ctx, device_param, pws_cnt); int CL_rc;
run_cracker (hashcat_ctx, device_param, pws_cnt); CL_rc = run_copy (hashcat_ctx, device_param, pws_cnt);
if (CL_rc == -1) return -1;
CL_rc = run_cracker (hashcat_ctx, device_param, pws_cnt);
if (CL_rc == -1) return -1;
device_param->pws_cnt = 0; device_param->pws_cnt = 0;
@ -210,11 +216,15 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
still required? still required?
if (attack_kern == ATTACK_KERN_STRAIGHT) if (attack_kern == ATTACK_KERN_STRAIGHT)
{ {
run_kernel_bzero (opencl_ctx, device_param, device_param->d_rules_c, device_param->size_rules_c); CL_rc = run_kernel_bzero (opencl_ctx, device_param, device_param->d_rules_c, device_param->size_rules_c);
if (CL_rc == -1) return -1;
} }
else if (attack_kern == ATTACK_KERN_COMBI) else if (attack_kern == ATTACK_KERN_COMBI)
{ {
run_kernel_bzero (opencl_ctx, device_param, device_param->d_combs_c, device_param->size_combs); rCL_rc = un_kernel_bzero (opencl_ctx, device_param, device_param->d_combs_c, device_param->size_combs);
if (CL_rc == -1) return -1;
} }
*/ */
} }
@ -281,9 +291,15 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (pws_cnt) if (pws_cnt)
{ {
run_copy (hashcat_ctx, device_param, pws_cnt); int CL_rc;
run_cracker (hashcat_ctx, device_param, pws_cnt); CL_rc = run_copy (hashcat_ctx, device_param, pws_cnt);
if (CL_rc == -1) return -1;
CL_rc = run_cracker (hashcat_ctx, device_param, pws_cnt);
if (CL_rc == -1) return -1;
device_param->pws_cnt = 0; device_param->pws_cnt = 0;
} }
@ -504,9 +520,15 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (pws_cnt) if (pws_cnt)
{ {
run_copy (hashcat_ctx, device_param, pws_cnt); int CL_rc;
run_cracker (hashcat_ctx, device_param, pws_cnt); CL_rc = run_copy (hashcat_ctx, device_param, pws_cnt);
if (CL_rc == -1) return -1;
CL_rc = run_cracker (hashcat_ctx, device_param, pws_cnt);
if (CL_rc == -1) return -1;
device_param->pws_cnt = 0; device_param->pws_cnt = 0;
@ -514,11 +536,15 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
still required? still required?
if (attack_kern == ATTACK_KERN_STRAIGHT) if (attack_kern == ATTACK_KERN_STRAIGHT)
{ {
run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c); CL_rc = run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
if (CL_rc == -1) return -1;
} }
else if (attack_kern == ATTACK_KERN_COMBI) else if (attack_kern == ATTACK_KERN_COMBI)
{ {
run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs); CL_rc = run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
if (CL_rc == -1) return -1;
} }
*/ */
} }