1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-06-02 14:19:06 +00:00

Fix a few warnings and divide by zero (speed_pos)

This commit is contained in:
jsteube 2018-02-11 14:25:55 +01:00
parent d656e9c3a4
commit ce8f445ebe
4 changed files with 8 additions and 4 deletions

View File

@ -1975,6 +1975,7 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const size_t out_le
int hashconfig_init (hashcat_ctx_t *hashcat_ctx); int hashconfig_init (hashcat_ctx_t *hashcat_ctx);
void hashconfig_destroy (hashcat_ctx_t *hashcat_ctx); void hashconfig_destroy (hashcat_ctx_t *hashcat_ctx);
u32 hashconfig_forced_kernel_threads (hashcat_ctx_t *hashcat_ctx); u32 hashconfig_forced_kernel_threads (hashcat_ctx_t *hashcat_ctx);
u32 hashconfig_limited_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_param_t *device_param);
u32 hashconfig_get_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_param_t *device_param); u32 hashconfig_get_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_param_t *device_param);
u32 hashconfig_get_kernel_loops (hashcat_ctx_t *hashcat_ctx); u32 hashconfig_get_kernel_loops (hashcat_ctx_t *hashcat_ctx);
int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx); int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx);

View File

@ -26032,8 +26032,6 @@ u32 hashconfig_limited_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_devi
u32 hashconfig_get_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_param_t *device_param) u32 hashconfig_get_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_param_t *device_param)
{ {
const user_options_t *user_options = hashcat_ctx->user_options;
// a kernel can force a fixed value // a kernel can force a fixed value
const u32 forced_kernel_threads = hashconfig_forced_kernel_threads (hashcat_ctx); const u32 forced_kernel_threads = hashconfig_forced_kernel_threads (hashcat_ctx);

View File

@ -1318,7 +1318,12 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
if (user_options->speed_only == true) if (user_options->speed_only == true)
{ {
if (speed_msec > 4000) return -2; // special RC if (speed_msec > 4000)
{
device_param->speed_pos = 1;
return -2; // special RC
}
} }
} }

View File

@ -1391,7 +1391,7 @@ double status_get_hashes_msec_dev (const hashcat_ctx_t *hashcat_ctx, const int d
{ {
const u32 speed_pos = device_param->speed_pos; const u32 speed_pos = device_param->speed_pos;
for (int i = 0; i < speed_pos; i++) for (u32 i = 0; i < speed_pos; i++)
{ {
speed_cnt += device_param->speed_cnt[i]; speed_cnt += device_param->speed_cnt[i];
speed_msec += device_param->speed_msec[i]; speed_msec += device_param->speed_msec[i];