From 6af37ecc10ddcd16257f86ecc1f80f54e2be7df0 Mon Sep 17 00:00:00 2001 From: Gabriele Gristina Date: Fri, 18 Nov 2016 19:44:18 +0100 Subject: [PATCH 1/2] Prevent exit from benchmark mode if all devices are skipped (OSX) --- src/opencl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/opencl.c b/src/opencl.c index d72cdb064..5bf73fe3f 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -3135,6 +3135,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) } u32 hardware_power_all = 0; + u32 skipped = 0; for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) { @@ -3189,6 +3190,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) event_log_warning (hashcat_ctx, "* Device #%u: skipping unstable hash-mode %u for this specific device, use --force to override", device_id + 1, user_options->hash_mode); device_param->skipped_temp = true; + skipped++; device_param->skipped = true; @@ -4752,7 +4754,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) hardware_power_all += device_param->hardware_power; } - if (hardware_power_all == 0) return -1; + if (hardware_power_all == 0) return ((opencl_ctx->devices_cnt - skipped) == 0) ? 1 : -1; opencl_ctx->hardware_power_all = hardware_power_all; From dc2689a99692c6cbed839b38119d2f52216ec023 Mon Sep 17 00:00:00 2001 From: jsteube Date: Fri, 18 Nov 2016 22:26:55 +0100 Subject: [PATCH 2/2] Move skipped_temp check out of main loop --- src/opencl.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/opencl.c b/src/opencl.c index 5bf73fe3f..cd53dd4cd 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -3135,7 +3135,6 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) } u32 hardware_power_all = 0; - u32 skipped = 0; for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) { @@ -3190,7 +3189,6 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) event_log_warning (hashcat_ctx, "* Device #%u: skipping unstable hash-mode %u for this specific device, use --force to override", device_id + 1, user_options->hash_mode); device_param->skipped_temp = true; - skipped++; device_param->skipped = true; @@ -4754,7 +4752,18 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx) hardware_power_all += device_param->hardware_power; } - if (hardware_power_all == 0) return ((opencl_ctx->devices_cnt - skipped) == 0) ? 1 : -1; + // Prevent exit from benchmark mode if all devices are skipped due to unstable hash-modes (OSX) + + bool has_skipped_temp = false; + + for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) + { + hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id]; + + if (device_param->skipped_temp == true) has_skipped_temp = true; + } + + if ((hardware_power_all == 0) && (has_skipped_temp == false)) return -1; opencl_ctx->hardware_power_all = hardware_power_all;