1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-22 22:58:30 +00:00

Fix some uint datatype leftovers

This commit is contained in:
jsteube 2016-10-04 11:22:08 +02:00
parent 79c0fc6a11
commit 578f6816c6
11 changed files with 84 additions and 84 deletions

View File

@ -9,7 +9,7 @@
#include "logging.h" #include "logging.h"
#include "cpu_crc32.h" #include "cpu_crc32.h"
static const uint crc32tab[256] = static const u32 crc32tab[256] =
{ {
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
@ -79,7 +79,7 @@ static const uint crc32tab[256] =
void cpu_crc32 (const char *filename, u8 keytab[64]) void cpu_crc32 (const char *filename, u8 keytab[64])
{ {
uint crc = ~0u; u32 crc = ~0u;
FILE *fd = fopen (filename, "rb"); FILE *fd = fopen (filename, "rb");

View File

@ -66,7 +66,7 @@ void debugfile_format_plain (debugfile_ctx_t *debugfile_ctx, const u8 *plain_ptr
int needs_hexify = 0; int needs_hexify = 0;
for (uint i = 0; i < plain_len; i++) for (u32 i = 0; i < plain_len; i++)
{ {
if (plain_ptr[i] < 0x20) if (plain_ptr[i] < 0x20)
{ {
@ -87,7 +87,7 @@ void debugfile_format_plain (debugfile_ctx_t *debugfile_ctx, const u8 *plain_ptr
{ {
fprintf (debugfile_ctx->fp, "$HEX["); fprintf (debugfile_ctx->fp, "$HEX[");
for (uint i = 0; i < plain_len; i++) for (u32 i = 0; i < plain_len; i++)
{ {
fprintf (debugfile_ctx->fp, "%02x", plain_ptr[i]); fprintf (debugfile_ctx->fp, "%02x", plain_ptr[i]);
} }
@ -104,7 +104,7 @@ void debugfile_write_append (debugfile_ctx_t *debugfile_ctx, const u8 *rule_buf,
{ {
if (debugfile_ctx->enabled == false) return; if (debugfile_ctx->enabled == false) return;
const uint debug_mode = debugfile_ctx->mode; const u32 debug_mode = debugfile_ctx->mode;
if ((debug_mode == 2) || (debug_mode == 3) || (debug_mode == 4)) if ((debug_mode == 2) || (debug_mode == 3) || (debug_mode == 4))
{ {

View File

@ -72,7 +72,7 @@ static u32 get_power (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param)
return device_param->kernel_power; return device_param->kernel_power;
} }
static uint get_work (opencl_ctx_t *opencl_ctx, status_ctx_t *status_ctx, const user_options_t *user_options, hc_device_param_t *device_param, const u64 max) static u32 get_work (opencl_ctx_t *opencl_ctx, status_ctx_t *status_ctx, const user_options_t *user_options, hc_device_param_t *device_param, const u64 max)
{ {
hc_thread_mutex_lock (status_ctx->mux_dispatcher); hc_thread_mutex_lock (status_ctx->mux_dispatcher);
@ -95,7 +95,7 @@ static uint get_work (opencl_ctx_t *opencl_ctx, status_ctx_t *status_ctx, const
const u32 kernel_power = get_power (opencl_ctx, device_param); const u32 kernel_power = get_power (opencl_ctx, device_param);
uint work = MIN (words_left, kernel_power); u32 work = MIN (words_left, kernel_power);
work = MIN (work, max); work = MIN (work, max);
@ -119,7 +119,7 @@ static void calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_pa
char *buf = (char *) mymalloc (HCBUFSIZ_LARGE); char *buf = (char *) mymalloc (HCBUFSIZ_LARGE);
const uint attack_kern = user_options_extra->attack_kern; const u32 attack_kern = user_options_extra->attack_kern;
while (status_ctx->run_thread_level1 == true) while (status_ctx->run_thread_level1 == true)
{ {
@ -132,7 +132,7 @@ static void calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_pa
break; break;
} }
uint words_cur = 0; u32 words_cur = 0;
while (words_cur < device_param->kernel_power) while (words_cur < device_param->kernel_power)
{ {
@ -176,7 +176,7 @@ static void calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_pa
{ {
hc_thread_mutex_lock (status_ctx->mux_counter); hc_thread_mutex_lock (status_ctx->mux_counter);
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++) for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{ {
status_ctx->words_progress_rejected[salt_pos] += straight_ctx->kernel_rules_cnt; status_ctx->words_progress_rejected[salt_pos] += straight_ctx->kernel_rules_cnt;
} }
@ -200,7 +200,7 @@ static void calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_pa
// flush // flush
const uint pws_cnt = device_param->pws_cnt; const u32 pws_cnt = device_param->pws_cnt;
if (pws_cnt) if (pws_cnt)
{ {
@ -260,21 +260,21 @@ static void calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx; opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx; status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
const uint attack_mode = user_options->attack_mode; const u32 attack_mode = user_options->attack_mode;
const uint attack_kern = user_options_extra->attack_kern; const u32 attack_kern = user_options_extra->attack_kern;
if (attack_mode == ATTACK_MODE_BF) if (attack_mode == ATTACK_MODE_BF)
{ {
while (status_ctx->run_thread_level1 == true) while (status_ctx->run_thread_level1 == true)
{ {
const uint work = get_work (opencl_ctx, status_ctx, user_options, device_param, -1u); const u32 work = get_work (opencl_ctx, status_ctx, user_options, device_param, -1u);
if (work == 0) break; if (work == 0) break;
const u64 words_off = device_param->words_off; const u64 words_off = device_param->words_off;
const u64 words_fin = words_off + work; const u64 words_fin = words_off + work;
const uint pws_cnt = work; const u32 pws_cnt = work;
device_param->pws_cnt = pws_cnt; device_param->pws_cnt = pws_cnt;
@ -326,7 +326,7 @@ static void calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (attack_mode == ATTACK_MODE_COMBI) if (attack_mode == ATTACK_MODE_COMBI)
{ {
const uint combs_mode = combinator_ctx->combs_mode; const u32 combs_mode = combinator_ctx->combs_mode;
if (combs_mode == COMBINATOR_MODE_BASE_LEFT) if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
{ {
@ -379,7 +379,7 @@ static void calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
while (max) while (max)
{ {
const uint work = get_work (opencl_ctx, status_ctx, user_options, device_param, max); const u32 work = get_work (opencl_ctx, status_ctx, user_options, device_param, max);
if (work == 0) break; if (work == 0) break;
@ -389,7 +389,7 @@ static void calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
words_fin = words_off + work; words_fin = words_off + work;
char *line_buf; char *line_buf;
uint line_len; u32 line_len;
for ( ; words_cur < words_off; words_cur++) get_next_word (wl_data, user_options, user_options_extra, fd, &line_buf, &line_len); for ( ; words_cur < words_off; words_cur++) get_next_word (wl_data, user_options, user_options_extra, fd, &line_buf, &line_len);
@ -426,7 +426,7 @@ static void calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
hc_thread_mutex_lock (status_ctx->mux_counter); hc_thread_mutex_lock (status_ctx->mux_counter);
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++) for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{ {
status_ctx->words_progress_rejected[salt_pos] += straight_ctx->kernel_rules_cnt; status_ctx->words_progress_rejected[salt_pos] += straight_ctx->kernel_rules_cnt;
} }
@ -447,7 +447,7 @@ static void calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
hc_thread_mutex_lock (status_ctx->mux_counter); hc_thread_mutex_lock (status_ctx->mux_counter);
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++) for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{ {
status_ctx->words_progress_rejected[salt_pos] += combinator_ctx->combs_cnt; status_ctx->words_progress_rejected[salt_pos] += combinator_ctx->combs_cnt;
} }
@ -472,7 +472,7 @@ static void calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
// flush // flush
// //
const uint pws_cnt = device_param->pws_cnt; const u32 pws_cnt = device_param->pws_cnt;
if (pws_cnt) if (pws_cnt)
{ {

View File

@ -47,7 +47,7 @@ int loopback_write_open (loopback_ctx_t *loopback_ctx, const induct_ctx_t *induc
time (&now); time (&now);
const uint random_num = get_random_num (0, 9999); const u32 random_num = get_random_num (0, 9999);
snprintf (loopback_ctx->filename, HCBUFSIZ_TINY - 1, "%s/%s.%d_%u", induct_ctx->root_directory, LOOPBACK_FILE, (int) now, random_num); snprintf (loopback_ctx->filename, HCBUFSIZ_TINY - 1, "%s/%s.%d_%u", induct_ctx->root_directory, LOOPBACK_FILE, (int) now, random_num);
@ -87,7 +87,7 @@ void loopback_format_plain (loopback_ctx_t *loopback_ctx, const u8 *plain_ptr, c
int needs_hexify = 0; int needs_hexify = 0;
for (uint i = 0; i < plain_len; i++) for (u32 i = 0; i < plain_len; i++)
{ {
if (plain_ptr[i] < 0x20) if (plain_ptr[i] < 0x20)
{ {
@ -108,7 +108,7 @@ void loopback_format_plain (loopback_ctx_t *loopback_ctx, const u8 *plain_ptr, c
{ {
fprintf (loopback_ctx->fp, "$HEX["); fprintf (loopback_ctx->fp, "$HEX[");
for (uint i = 0; i < plain_len; i++) for (u32 i = 0; i < plain_len; i++)
{ {
fprintf (loopback_ctx->fp, "%02x", plain_ptr[i]); fprintf (loopback_ctx->fp, "%02x", plain_ptr[i]);
} }

View File

@ -102,7 +102,7 @@ static void monitor (hashcat_ctx_t *hashcat_ctx)
{ {
hc_thread_mutex_lock (status_ctx->mux_hwmon); hc_thread_mutex_lock (status_ctx->mux_hwmon);
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) 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]; hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
@ -164,11 +164,11 @@ static void monitor (hashcat_ctx_t *hashcat_ctx)
time (&temp_check_time); time (&temp_check_time);
uint Ta = temp_check_time - last_temp_check_time; // set Ta = sleep_time; is not good enough (see --remove etc) u32 Ta = temp_check_time - last_temp_check_time; // set Ta = sleep_time; is not good enough (see --remove etc)
if (Ta == 0) Ta = 1; if (Ta == 0) Ta = 1;
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) 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]; hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];

View File

@ -26,14 +26,14 @@ static void outfile_remove (hashcat_ctx_t *hashcat_ctx)
status_ctx_t *status_ctx = hashcat_ctx->status_ctx; status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
user_options_t *user_options = hashcat_ctx->user_options; user_options_t *user_options = hashcat_ctx->user_options;
uint dgst_size = hashconfig->dgst_size; u32 dgst_size = hashconfig->dgst_size;
uint is_salted = hashconfig->is_salted; u32 is_salted = hashconfig->is_salted;
uint esalt_size = hashconfig->esalt_size; u32 esalt_size = hashconfig->esalt_size;
uint hash_mode = hashconfig->hash_mode; u32 hash_mode = hashconfig->hash_mode;
char separator = hashconfig->separator; char separator = hashconfig->separator;
char *root_directory = outcheck_ctx->root_directory; char *root_directory = outcheck_ctx->root_directory;
uint outfile_check_timer = user_options->outfile_check_timer; u32 outfile_check_timer = user_options->outfile_check_timer;
// buffers // buffers
hash_t hash_buf = { 0, 0, 0, 0, 0 }; hash_t hash_buf = { 0, 0, 0, 0, 0 };
@ -43,7 +43,7 @@ static void outfile_remove (hashcat_ctx_t *hashcat_ctx)
if (is_salted) hash_buf.salt = (salt_t *) mymalloc (sizeof (salt_t)); if (is_salted) hash_buf.salt = (salt_t *) mymalloc (sizeof (salt_t));
if (esalt_size) hash_buf.esalt = (void *) mymalloc (esalt_size); if (esalt_size) hash_buf.esalt = (void *) mymalloc (esalt_size);
uint digest_buf[64] = { 0 }; u32 digest_buf[64] = { 0 };
outfile_data_t *out_info = NULL; outfile_data_t *out_info = NULL;
@ -53,7 +53,7 @@ static void outfile_remove (hashcat_ctx_t *hashcat_ctx)
int out_cnt = 0; int out_cnt = 0;
uint check_left = outfile_check_timer; // or 1 if we want to check it at startup u32 check_left = outfile_check_timer; // or 1 if we want to check it at startup
while (status_ctx->shutdown_inner == false) while (status_ctx->shutdown_inner == false)
{ {
@ -69,7 +69,7 @@ static void outfile_remove (hashcat_ctx_t *hashcat_ctx)
if (stat (root_directory, &outfile_check_stat) == 0) if (stat (root_directory, &outfile_check_stat) == 0)
{ {
uint is_dir = S_ISDIR (outfile_check_stat.st_mode); u32 is_dir = S_ISDIR (outfile_check_stat.st_mode);
if (is_dir == 1) if (is_dir == 1)
{ {
@ -160,7 +160,7 @@ static void outfile_remove (hashcat_ctx_t *hashcat_ctx)
int iter = MAX_CUT_TRIES; int iter = MAX_CUT_TRIES;
for (uint i = line_len - 1; i && iter; i--, line_len--) for (u32 i = line_len - 1; i && iter; i--, line_len--)
{ {
if (line_buf[i] != separator) continue; if (line_buf[i] != separator) continue;
@ -171,23 +171,23 @@ static void outfile_remove (hashcat_ctx_t *hashcat_ctx)
parser_status = hashconfig->parse_func (line_buf, line_len - 1, &hash_buf, hashconfig); parser_status = hashconfig->parse_func (line_buf, line_len - 1, &hash_buf, hashconfig);
} }
uint found = 0; u32 found = 0;
if (parser_status == PARSER_OK) if (parser_status == PARSER_OK)
{ {
for (uint salt_pos = 0; (found == 0) && (salt_pos < hashes->salts_cnt); salt_pos++) for (u32 salt_pos = 0; (found == 0) && (salt_pos < hashes->salts_cnt); salt_pos++)
{ {
if (hashes->salts_shown[salt_pos] == 1) continue; if (hashes->salts_shown[salt_pos] == 1) continue;
salt_t *salt_buf = &hashes->salts_buf[salt_pos]; salt_t *salt_buf = &hashes->salts_buf[salt_pos];
for (uint digest_pos = 0; (found == 0) && (digest_pos < salt_buf->digests_cnt); digest_pos++) for (u32 digest_pos = 0; (found == 0) && (digest_pos < salt_buf->digests_cnt); digest_pos++)
{ {
uint idx = salt_buf->digests_offset + digest_pos; u32 idx = salt_buf->digests_offset + digest_pos;
if (hashes->digests_shown[idx] == 1) continue; if (hashes->digests_shown[idx] == 1) continue;
uint cracked = 0; u32 cracked = 0;
if (hash_mode == 6800) if (hash_mode == 6800)
{ {
@ -214,7 +214,7 @@ static void outfile_remove (hashcat_ctx_t *hashcat_ctx)
// compare hex string(s) vs binary MAC address(es) // compare hex string(s) vs binary MAC address(es)
for (uint i = 0, j = 0; i < 6; i++, j += 2) for (u32 i = 0, j = 0; i < 6; i++, j += 2)
{ {
if (wpa->orig_mac1[i] != hex_to_u8 ((const u8 *) &mac1_pos[j])) if (wpa->orig_mac1[i] != hex_to_u8 ((const u8 *) &mac1_pos[j]))
{ {
@ -227,7 +227,7 @@ static void outfile_remove (hashcat_ctx_t *hashcat_ctx)
// early skip ;) // early skip ;)
if (!cracked) continue; if (!cracked) continue;
for (uint i = 0, j = 0; i < 6; i++, j += 2) for (u32 i = 0, j = 0; i < 6; i++, j += 2)
{ {
if (wpa->orig_mac2[i] != hex_to_u8 ((const u8 *) &mac2_pos[j])) if (wpa->orig_mac2[i] != hex_to_u8 ((const u8 *) &mac2_pos[j]))
{ {
@ -348,7 +348,7 @@ int outcheck_ctx_init (outcheck_ctx_t *outcheck_ctx, const user_options_t *user_
if (stat (outcheck_ctx->root_directory, &outfile_check_stat) == 0) if (stat (outcheck_ctx->root_directory, &outfile_check_stat) == 0)
{ {
const uint is_dir = S_ISDIR (outfile_check_stat.st_mode); const u32 is_dir = S_ISDIR (outfile_check_stat.st_mode);
if (is_dir == 0) if (is_dir == 0)
{ {

View File

@ -27,7 +27,7 @@ u64 get_lowest_words_done (const restore_ctx_t *restore_ctx, const opencl_ctx_t
u64 words_cur = -1llu; u64 words_cur = -1llu;
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) 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]; hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
@ -200,7 +200,7 @@ void read_restore (restore_ctx_t *restore_ctx)
char *buf = (char *) mymalloc (HCBUFSIZ_LARGE); char *buf = (char *) mymalloc (HCBUFSIZ_LARGE);
for (uint i = 0; i < rd->argc; i++) for (u32 i = 0; i < rd->argc; i++)
{ {
if (fgets (buf, HCBUFSIZ_LARGE - 1, fp) == NULL) if (fgets (buf, HCBUFSIZ_LARGE - 1, fp) == NULL)
{ {
@ -263,7 +263,7 @@ void write_restore (restore_ctx_t *restore_ctx, opencl_ctx_t *opencl_ctx)
fwrite (rd, sizeof (restore_data_t), 1, fp); fwrite (rd, sizeof (restore_data_t), 1, fp);
for (uint i = 0; i < rd->argc; i++) for (u32 i = 0; i < rd->argc; i++)
{ {
fprintf (fp, "%s", rd->argv[i]); fprintf (fp, "%s", rd->argv[i]);

View File

@ -78,7 +78,7 @@ static void format_speed_display (double val, char *buf, size_t len)
char units[7] = { ' ', 'k', 'M', 'G', 'T', 'P', 'E' }; char units[7] = { ' ', 'k', 'M', 'G', 'T', 'P', 'E' };
uint level = 0; u32 level = 0;
while (val > 99999) while (val > 99999)
{ {
@ -99,7 +99,7 @@ static void format_speed_display (double val, char *buf, size_t len)
} }
} }
static char *strstatus (const uint devices_status) static char *strstatus (const u32 devices_status)
{ {
switch (devices_status) switch (devices_status)
{ {
@ -162,7 +162,7 @@ void status_display_machine_readable (status_ctx_t *status_ctx, opencl_ctx_t *op
fprintf (out, "SPEED\t"); fprintf (out, "SPEED\t");
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) 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]; hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
@ -189,7 +189,7 @@ void status_display_machine_readable (status_ctx_t *status_ctx, opencl_ctx_t *op
fprintf (out, "EXEC_RUNTIME\t"); fprintf (out, "EXEC_RUNTIME\t");
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) 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]; hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
@ -218,7 +218,7 @@ void status_display_machine_readable (status_ctx_t *status_ctx, opencl_ctx_t *op
u64 all_rejected = 0; u64 all_rejected = 0;
u64 all_restored = 0; u64 all_restored = 0;
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++) for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{ {
all_done += status_ctx->words_progress_done[salt_pos]; all_done += status_ctx->words_progress_done[salt_pos];
all_rejected += status_ctx->words_progress_rejected[salt_pos]; all_rejected += status_ctx->words_progress_rejected[salt_pos];
@ -270,7 +270,7 @@ void status_display_machine_readable (status_ctx_t *status_ctx, opencl_ctx_t *op
hc_thread_mutex_lock (status_ctx->mux_hwmon); hc_thread_mutex_lock (status_ctx->mux_hwmon);
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) 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]; hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
@ -313,13 +313,13 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h
char tmp_buf[1000] = { 0 }; char tmp_buf[1000] = { 0 };
uint tmp_len = 0; u32 tmp_len = 0;
log_info ("Session.Name...: %s", user_options->session); log_info ("Session.Name...: %s", user_options->session);
char *status_type = strstatus (status_ctx->devices_status); char *status_type = strstatus (status_ctx->devices_status);
uint hash_mode = hashconfig->hash_mode; u32 hash_mode = hashconfig->hash_mode;
char *hash_type = strhashtype (hash_mode); // not a bug char *hash_type = strhashtype (hash_mode); // not a bug
@ -331,7 +331,7 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h
if (user_options->rp_files_cnt) if (user_options->rp_files_cnt)
{ {
uint i; u32 i;
for (i = 0, tmp_len = 0; i < user_options->rp_files_cnt - 1 && tmp_len < sizeof (tmp_buf); i++) for (i = 0, tmp_len = 0; i < user_options->rp_files_cnt - 1 && tmp_len < sizeof (tmp_buf); i++)
{ {
@ -386,7 +386,7 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h
if (mask != NULL) if (mask != NULL)
{ {
uint mask_len = mask_ctx->css_cnt; u32 mask_len = mask_ctx->css_cnt;
tmp_len += snprintf (tmp_buf + tmp_len, sizeof (tmp_buf) - tmp_len, "Mask (%s)", mask); tmp_len += snprintf (tmp_buf + tmp_len, sizeof (tmp_buf) - tmp_len, "Mask (%s)", mask);
@ -542,7 +542,7 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h
u64 speed_cnt[DEVICES_MAX] = { 0 }; u64 speed_cnt[DEVICES_MAX] = { 0 };
double speed_ms[DEVICES_MAX] = { 0 }; double speed_ms[DEVICES_MAX] = { 0 };
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) 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]; hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
@ -565,7 +565,7 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h
double hashes_dev_ms[DEVICES_MAX] = { 0 }; double hashes_dev_ms[DEVICES_MAX] = { 0 };
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) 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]; hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
@ -587,7 +587,7 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h
double exec_all_ms[DEVICES_MAX] = { 0 }; double exec_all_ms[DEVICES_MAX] = { 0 };
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) 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]; hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
@ -676,7 +676,7 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h
u64 progress_noneed = 0; u64 progress_noneed = 0;
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++) for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{ {
all_done += status_ctx->words_progress_done[salt_pos]; all_done += status_ctx->words_progress_done[salt_pos];
all_rejected += status_ctx->words_progress_rejected[salt_pos]; all_rejected += status_ctx->words_progress_rejected[salt_pos];
@ -828,7 +828,7 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h
} }
} }
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) 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]; hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
@ -868,7 +868,7 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h
for (int i = 0; i < CPT_BUF; i++) for (int i = 0; i < CPT_BUF; i++)
{ {
const uint cracked = cpt_ctx->cpt_buf[i].cracked; const u32 cracked = cpt_ctx->cpt_buf[i].cracked;
const time_t timestamp = cpt_ctx->cpt_buf[i].timestamp; const time_t timestamp = cpt_ctx->cpt_buf[i].timestamp;
if ((timestamp + 60) > now) if ((timestamp + 60) > now)
@ -995,7 +995,7 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h
{ {
hc_thread_mutex_lock (status_ctx->mux_hwmon); hc_thread_mutex_lock (status_ctx->mux_hwmon);
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) 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]; hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
@ -1088,7 +1088,7 @@ void status_benchmark_automate (status_ctx_t *status_ctx, opencl_ctx_t *opencl_c
u64 speed_cnt[DEVICES_MAX] = { 0 }; u64 speed_cnt[DEVICES_MAX] = { 0 };
double speed_ms[DEVICES_MAX] = { 0 }; double speed_ms[DEVICES_MAX] = { 0 };
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) 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]; hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
@ -1100,7 +1100,7 @@ void status_benchmark_automate (status_ctx_t *status_ctx, opencl_ctx_t *opencl_c
u64 hashes_dev_ms[DEVICES_MAX] = { 0 }; u64 hashes_dev_ms[DEVICES_MAX] = { 0 };
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) 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]; hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
@ -1114,7 +1114,7 @@ void status_benchmark_automate (status_ctx_t *status_ctx, opencl_ctx_t *opencl_c
} }
} }
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) 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]; hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
@ -1145,7 +1145,7 @@ void status_benchmark (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const
u64 speed_cnt[DEVICES_MAX] = { 0 }; u64 speed_cnt[DEVICES_MAX] = { 0 };
double speed_ms[DEVICES_MAX] = { 0 }; double speed_ms[DEVICES_MAX] = { 0 };
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) 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]; hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
@ -1159,7 +1159,7 @@ void status_benchmark (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const
double hashes_dev_ms[DEVICES_MAX] = { 0 }; double hashes_dev_ms[DEVICES_MAX] = { 0 };
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) 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]; hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
@ -1181,7 +1181,7 @@ void status_benchmark (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const
double exec_all_ms[DEVICES_MAX] = { 0 }; double exec_all_ms[DEVICES_MAX] = { 0 };
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) 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]; hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
@ -1192,7 +1192,7 @@ void status_benchmark (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const
exec_all_ms[device_id] = exec_ms_avg; exec_all_ms[device_id] = exec_ms_avg;
} }
for (uint device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) 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]; hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];

View File

@ -25,9 +25,9 @@ extern int max_len;
#define GET_P0_CONV(rule) INCR_POS; rule_buf[rule_pos] = conv_itoc (((rule)->cmds[rule_cnt] >> 8) & 0xff) #define GET_P0_CONV(rule) INCR_POS; rule_buf[rule_pos] = conv_itoc (((rule)->cmds[rule_cnt] >> 8) & 0xff)
#define GET_P1_CONV(rule) INCR_POS; rule_buf[rule_pos] = conv_itoc (((rule)->cmds[rule_cnt] >> 16) & 0xff) #define GET_P1_CONV(rule) INCR_POS; rule_buf[rule_pos] = conv_itoc (((rule)->cmds[rule_cnt] >> 16) & 0xff)
void gen_cmask (const u8 *word, u8 *cmask, const uint len) void gen_cmask (const u8 *word, u8 *cmask, const u32 len)
{ {
uint i; u32 i;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
{ {
@ -929,10 +929,10 @@ int apply_rule_cpu (char *rule, int rule_len, char in[BLOCK_SIZE], int in_len, c
return (out_len); return (out_len);
} }
int cpu_rule_to_kernel_rule (char *rule_buf, uint rule_len, kernel_rule_t *rule) int cpu_rule_to_kernel_rule (char *rule_buf, u32 rule_len, kernel_rule_t *rule)
{ {
uint rule_pos; u32 rule_pos;
uint rule_cnt; u32 rule_cnt;
for (rule_pos = 0, rule_cnt = 0; rule_pos < rule_len && rule_cnt < MAX_GPU_RULES; rule_pos++, rule_cnt++) for (rule_pos = 0, rule_cnt = 0; rule_pos < rule_len && rule_cnt < MAX_GPU_RULES; rule_pos++, rule_cnt++)
{ {
@ -1197,11 +1197,11 @@ char conv_itoc (char c)
return (char) (-1); return (char) (-1);
} }
uint get_random_num (uint min, uint max) u32 get_random_num (u32 min, u32 max)
{ {
if (min == max) return (min); if (min == max) return (min);
uint data; u32 data;
FILE *fp = fopen("/dev/urandom", "rb"); FILE *fp = fopen("/dev/urandom", "rb");

View File

@ -17,7 +17,7 @@
typedef struct typedef struct
{ {
uint cmds[256]; u32 cmds[256];
} kernel_rule_t; } kernel_rule_t;
@ -54,7 +54,7 @@ int mangle_chr_decr (u8 arr[BLOCK_SIZE], int arr_len, int upos);
int mangle_title (char arr[BLOCK_SIZE], int arr_len); int mangle_title (char arr[BLOCK_SIZE], int arr_len);
int generate_random_rule (char rule_buf[RP_RULE_BUFSIZ], u32 rp_gen_func_min, u32 rp_gen_func_max); int generate_random_rule (char rule_buf[RP_RULE_BUFSIZ], u32 rp_gen_func_min, u32 rp_gen_func_max);
int apply_rule_cpu (char *rule, int rule_len, char in[BLOCK_SIZE], int in_len, char out[BLOCK_SIZE]); int apply_rule_cpu (char *rule, int rule_len, char in[BLOCK_SIZE], int in_len, char out[BLOCK_SIZE]);
int cpu_rule_to_kernel_rule (char *rule_buf, uint rule_len, kernel_rule_t *rule); int cpu_rule_to_kernel_rule (char *rule_buf, u32 rule_len, kernel_rule_t *rule);
bool class_num (char c); bool class_num (char c);
bool class_lower (char c); bool class_lower (char c);
@ -64,8 +64,8 @@ bool class_alpha (char c);
char conv_ctoi (char c); char conv_ctoi (char c);
char conv_itoc (char c); char conv_itoc (char c);
uint get_random_num (uint min, uint max); u32 get_random_num (u32 min, u32 max);
void gen_cmask (const u8 *word, u8 *cmask, const uint len); void gen_cmask (const u8 *word, u8 *cmask, const u32 len);
#endif #endif

View File

@ -89,7 +89,7 @@ int main (int argc, char **argv)
* generate random rule and apply it afterwards * generate random rule and apply it afterwards
*/ */
uint max; u32 max;
if (argc < 2) if (argc < 2)
{ {
@ -100,7 +100,7 @@ int main (int argc, char **argv)
max = 1; max = 1;
} }
uint i; u32 i;
for (i = 0; i < max; i++) for (i = 0; i < max; i++)
{ {