From 578f6816c6dd676e184b9557d5e3b43de1a0dcb7 Mon Sep 17 00:00:00 2001 From: jsteube Date: Tue, 4 Oct 2016 11:22:08 +0200 Subject: [PATCH] Fix some uint datatype leftovers --- src/cpu_crc32.c | 4 +-- src/debugfile.c | 6 ++-- src/dispatch.c | 32 ++++++++--------- src/loopback.c | 6 ++-- src/monitor.c | 6 ++-- src/outfile_check.c | 34 +++++++++--------- src/restore.c | 6 ++-- src/status.c | 48 ++++++++++++------------- tools/rules_test/cpu_rules.c | 14 ++++---- tools/rules_test/cpu_rules.h | 8 ++--- tools/rules_test/kernel2cpu_rule_test.c | 4 +-- 11 files changed, 84 insertions(+), 84 deletions(-) diff --git a/src/cpu_crc32.c b/src/cpu_crc32.c index 123ff51ee..282a3ef28 100644 --- a/src/cpu_crc32.c +++ b/src/cpu_crc32.c @@ -9,7 +9,7 @@ #include "logging.h" #include "cpu_crc32.h" -static const uint crc32tab[256] = +static const u32 crc32tab[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, @@ -79,7 +79,7 @@ static const uint crc32tab[256] = void cpu_crc32 (const char *filename, u8 keytab[64]) { - uint crc = ~0u; + u32 crc = ~0u; FILE *fd = fopen (filename, "rb"); diff --git a/src/debugfile.c b/src/debugfile.c index 7769748e9..f15b46584 100644 --- a/src/debugfile.c +++ b/src/debugfile.c @@ -66,7 +66,7 @@ void debugfile_format_plain (debugfile_ctx_t *debugfile_ctx, const u8 *plain_ptr 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) { @@ -87,7 +87,7 @@ void debugfile_format_plain (debugfile_ctx_t *debugfile_ctx, const u8 *plain_ptr { 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]); } @@ -104,7 +104,7 @@ void debugfile_write_append (debugfile_ctx_t *debugfile_ctx, const u8 *rule_buf, { 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)) { diff --git a/src/dispatch.c b/src/dispatch.c index 9d3b014a8..3d42bfa1f 100644 --- a/src/dispatch.c +++ b/src/dispatch.c @@ -72,7 +72,7 @@ static u32 get_power (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param) 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); @@ -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); - uint work = MIN (words_left, kernel_power); + u32 work = MIN (words_left, kernel_power); 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); - 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) { @@ -132,7 +132,7 @@ static void calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_pa break; } - uint words_cur = 0; + u32 words_cur = 0; 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); - 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; } @@ -200,7 +200,7 @@ static void calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_pa // flush - const uint pws_cnt = device_param->pws_cnt; + const u32 pws_cnt = device_param->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; status_ctx_t *status_ctx = hashcat_ctx->status_ctx; - const uint attack_mode = user_options->attack_mode; - const uint attack_kern = user_options_extra->attack_kern; + const u32 attack_mode = user_options->attack_mode; + const u32 attack_kern = user_options_extra->attack_kern; if (attack_mode == ATTACK_MODE_BF) { 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; const u64 words_off = device_param->words_off; const u64 words_fin = words_off + work; - const uint pws_cnt = work; + const u32 pws_cnt = work; 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) { - const uint combs_mode = combinator_ctx->combs_mode; + const u32 combs_mode = combinator_ctx->combs_mode; 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) { - 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; @@ -389,7 +389,7 @@ static void calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) words_fin = words_off + work; 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); @@ -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); - 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; } @@ -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); - 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; } @@ -472,7 +472,7 @@ static void calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) // flush // - const uint pws_cnt = device_param->pws_cnt; + const u32 pws_cnt = device_param->pws_cnt; if (pws_cnt) { diff --git a/src/loopback.c b/src/loopback.c index 6b74a9cbf..6cf046b91 100644 --- a/src/loopback.c +++ b/src/loopback.c @@ -47,7 +47,7 @@ int loopback_write_open (loopback_ctx_t *loopback_ctx, const induct_ctx_t *induc 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); @@ -87,7 +87,7 @@ void loopback_format_plain (loopback_ctx_t *loopback_ctx, const u8 *plain_ptr, c 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) { @@ -108,7 +108,7 @@ void loopback_format_plain (loopback_ctx_t *loopback_ctx, const u8 *plain_ptr, c { 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]); } diff --git a/src/monitor.c b/src/monitor.c index 6a8e352ce..db485bb50 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -102,7 +102,7 @@ static void monitor (hashcat_ctx_t *hashcat_ctx) { 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]; @@ -164,11 +164,11 @@ static void monitor (hashcat_ctx_t *hashcat_ctx) 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; - 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]; diff --git a/src/outfile_check.c b/src/outfile_check.c index 63ad6f505..12cd6d489 100644 --- a/src/outfile_check.c +++ b/src/outfile_check.c @@ -26,14 +26,14 @@ static void outfile_remove (hashcat_ctx_t *hashcat_ctx) status_ctx_t *status_ctx = hashcat_ctx->status_ctx; user_options_t *user_options = hashcat_ctx->user_options; - uint dgst_size = hashconfig->dgst_size; - uint is_salted = hashconfig->is_salted; - uint esalt_size = hashconfig->esalt_size; - uint hash_mode = hashconfig->hash_mode; + u32 dgst_size = hashconfig->dgst_size; + u32 is_salted = hashconfig->is_salted; + u32 esalt_size = hashconfig->esalt_size; + u32 hash_mode = hashconfig->hash_mode; char separator = hashconfig->separator; 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 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 (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; @@ -53,7 +53,7 @@ static void outfile_remove (hashcat_ctx_t *hashcat_ctx) 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) { @@ -69,7 +69,7 @@ static void outfile_remove (hashcat_ctx_t *hashcat_ctx) 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) { @@ -160,7 +160,7 @@ static void outfile_remove (hashcat_ctx_t *hashcat_ctx) 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; @@ -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); } - uint found = 0; + u32 found = 0; 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; 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; - uint cracked = 0; + u32 cracked = 0; 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) - 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])) { @@ -227,7 +227,7 @@ static void outfile_remove (hashcat_ctx_t *hashcat_ctx) // early skip ;) 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])) { @@ -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) { - 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) { diff --git a/src/restore.c b/src/restore.c index fa766655d..a92cddbfd 100644 --- a/src/restore.c +++ b/src/restore.c @@ -27,7 +27,7 @@ u64 get_lowest_words_done (const restore_ctx_t *restore_ctx, const opencl_ctx_t 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]; @@ -200,7 +200,7 @@ void read_restore (restore_ctx_t *restore_ctx) 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) { @@ -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); - for (uint i = 0; i < rd->argc; i++) + for (u32 i = 0; i < rd->argc; i++) { fprintf (fp, "%s", rd->argv[i]); diff --git a/src/status.c b/src/status.c index 2466b27b0..66ed58521 100644 --- a/src/status.c +++ b/src/status.c @@ -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' }; - uint level = 0; + u32 level = 0; 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) { @@ -162,7 +162,7 @@ void status_display_machine_readable (status_ctx_t *status_ctx, opencl_ctx_t *op 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]; @@ -189,7 +189,7 @@ void status_display_machine_readable (status_ctx_t *status_ctx, opencl_ctx_t *op 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]; @@ -218,7 +218,7 @@ void status_display_machine_readable (status_ctx_t *status_ctx, opencl_ctx_t *op u64 all_rejected = 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_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); - 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]; @@ -313,13 +313,13 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h char tmp_buf[1000] = { 0 }; - uint tmp_len = 0; + u32 tmp_len = 0; log_info ("Session.Name...: %s", user_options->session); 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 @@ -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) { - uint i; + u32 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) { - 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); @@ -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 }; 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]; @@ -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 }; - 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]; @@ -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 }; - 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]; @@ -676,7 +676,7 @@ void status_display (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const h 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_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]; @@ -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++) { - 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; 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); - 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]; @@ -1088,7 +1088,7 @@ void status_benchmark_automate (status_ctx_t *status_ctx, opencl_ctx_t *opencl_c u64 speed_cnt[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]; @@ -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 }; - 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]; @@ -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]; @@ -1145,7 +1145,7 @@ void status_benchmark (status_ctx_t *status_ctx, opencl_ctx_t *opencl_ctx, const u64 speed_cnt[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]; @@ -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 }; - 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]; @@ -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 }; - 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]; @@ -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; } - 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]; diff --git a/tools/rules_test/cpu_rules.c b/tools/rules_test/cpu_rules.c index e1e36d0b1..0abf1801b 100644 --- a/tools/rules_test/cpu_rules.c +++ b/tools/rules_test/cpu_rules.c @@ -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_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++) { @@ -929,10 +929,10 @@ int apply_rule_cpu (char *rule, int rule_len, char in[BLOCK_SIZE], int in_len, c 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; - uint rule_cnt; + u32 rule_pos; + u32 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); } -uint get_random_num (uint min, uint max) +u32 get_random_num (u32 min, u32 max) { if (min == max) return (min); - uint data; + u32 data; FILE *fp = fopen("/dev/urandom", "rb"); diff --git a/tools/rules_test/cpu_rules.h b/tools/rules_test/cpu_rules.h index 23324cc4d..3883db91f 100644 --- a/tools/rules_test/cpu_rules.h +++ b/tools/rules_test/cpu_rules.h @@ -17,7 +17,7 @@ typedef struct { - uint cmds[256]; + u32 cmds[256]; } 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 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 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_lower (char c); @@ -64,8 +64,8 @@ bool class_alpha (char c); char conv_ctoi (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 diff --git a/tools/rules_test/kernel2cpu_rule_test.c b/tools/rules_test/kernel2cpu_rule_test.c index fe2b02c15..df67e9f2b 100644 --- a/tools/rules_test/kernel2cpu_rule_test.c +++ b/tools/rules_test/kernel2cpu_rule_test.c @@ -89,7 +89,7 @@ int main (int argc, char **argv) * generate random rule and apply it afterwards */ - uint max; + u32 max; if (argc < 2) { @@ -100,7 +100,7 @@ int main (int argc, char **argv) max = 1; } - uint i; + u32 i; for (i = 0; i < max; i++) {