1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-17 12:18:24 +00:00

Fix use of find_kernel_power_div()

This commit is contained in:
Jens Steube 2016-02-22 12:50:04 +01:00
parent 6bc98368ba
commit 6c10ca5853

View File

@ -4321,7 +4321,7 @@ static void pw_add (hc_device_param_t *device_param, const u8 *pw_buf, const int
} }
} }
static uint get_work (hc_device_param_t *device_param, const u64 max) static uint get_work (hc_device_param_t *device_param, const u64 max, const bool allow_div)
{ {
hc_thread_mutex_lock (mux_dispatcher); hc_thread_mutex_lock (mux_dispatcher);
@ -4332,6 +4332,8 @@ static uint get_work (hc_device_param_t *device_param, const u64 max)
const u64 words_left = words_base - words_cur; const u64 words_left = words_base - words_cur;
if (allow_div)
{
if (data.kernel_power_all > words_left) if (data.kernel_power_all > words_left)
{ {
if (data.kernel_power_div == 0) if (data.kernel_power_div == 0)
@ -4352,6 +4354,7 @@ static uint get_work (hc_device_param_t *device_param, const u64 max)
} }
} }
} }
}
const uint kernel_power = device_param->kernel_power; const uint kernel_power = device_param->kernel_power;
@ -4515,7 +4518,7 @@ static void *thread_calc (void *p)
{ {
while ((data.devices_status != STATUS_EXHAUSTED) && (data.devices_status != STATUS_CRACKED) && (data.devices_status != STATUS_ABORTED) && (data.devices_status != STATUS_QUIT)) while ((data.devices_status != STATUS_EXHAUSTED) && (data.devices_status != STATUS_CRACKED) && (data.devices_status != STATUS_ABORTED) && (data.devices_status != STATUS_QUIT))
{ {
const uint work = get_work (device_param, -1); const uint work = get_work (device_param, -1, true);
if (work == 0) break; if (work == 0) break;
@ -4625,11 +4628,15 @@ static void *thread_calc (void *p)
u64 words_off = 0; u64 words_off = 0;
u64 words_fin = 0; u64 words_fin = 0;
bool allow_div = true;
u64 max = -1; u64 max = -1;
while (max) while (max)
{ {
const uint work = get_work (device_param, max); const uint work = get_work (device_param, max, allow_div);
allow_div = false;
if (work == 0) break; if (work == 0) break;