From 88519f94373cb487ae7796472bbc8d224a6519a9 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 28 Aug 2016 12:44:19 -0700 Subject: [PATCH 1/4] Fix -Wfloat-conversion warnings --- src/hashcat.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/hashcat.c b/src/hashcat.c index 077e18775..1c5ff496a 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -769,7 +769,7 @@ static double get_avg_exec_time (hc_device_param_t *device_param, const int last { double exec_ms = device_param->exec_ms[(exec_pos + i) % EXEC_CACHE]; - if (exec_ms) + if (exec_ms > 0) { exec_ms_sum += exec_ms; @@ -1245,7 +1245,7 @@ void status_display () hashes_dev_ms[device_id] = 0; - if (speed_ms[device_id]) + if (speed_ms[device_id] > 0) { hashes_dev_ms[device_id] = (double) speed_cnt[device_id] / speed_ms[device_id]; @@ -1291,11 +1291,11 @@ void status_display () #ifdef WIN - __time64_t sec_run = ms_running / 1000; + __time64_t sec_run = (__time64_t) ms_running / 1000; #else - time_t sec_run = ms_running / 1000; + time_t sec_run = (time_t) ms_running / 1000; #endif @@ -1408,11 +1408,11 @@ void status_display () time_t sec_etc = 0; #endif - if (hashes_all_ms) + if (hashes_all_ms > 0) { u64 progress_left_relative_skip = progress_end_relative_skip - progress_cur_relative_skip; - u64 ms_left = (progress_left_relative_skip - progress_noneed) / hashes_all_ms; + u64 ms_left = (u64) ((progress_left_relative_skip - progress_noneed) / hashes_all_ms); sec_etc = ms_left / 1000; } @@ -1782,7 +1782,7 @@ static void status_benchmark_automate () hashes_dev_ms[device_id] = 0; - if (speed_ms[device_id]) + if (speed_ms[device_id] > 0) { hashes_dev_ms[device_id] = (double) speed_cnt[device_id] / speed_ms[device_id]; } @@ -1837,7 +1837,7 @@ static void status_benchmark () hashes_dev_ms[device_id] = 0; - if (speed_ms[device_id]) + if (speed_ms[device_id] > 0) { hashes_dev_ms[device_id] = (double) speed_cnt[device_id] / speed_ms[device_id]; @@ -2895,7 +2895,7 @@ static int run_kernel (const uint kern_run, hc_device_param_t *device_param, con { if (data.opti_type & OPTI_TYPE_SLOW_HASH_SIMD) { - num_elements = CEIL ((float) num_elements / device_param->vector_width); + num_elements = CEIL (num_elements / device_param->vector_width); } } @@ -2923,7 +2923,7 @@ static int run_kernel (const uint kern_run, hc_device_param_t *device_param, con return -1; } - if (device_param->nvidia_spin_damp) + if (device_param->nvidia_spin_damp > 0) { if (data.devices_status == STATUS_RUNNING) { @@ -2931,9 +2931,9 @@ static int run_kernel (const uint kern_run, hc_device_param_t *device_param, con { switch (kern_run) { - case KERN_RUN_1: if (device_param->exec_us_prev1[iteration]) usleep (device_param->exec_us_prev1[iteration] * device_param->nvidia_spin_damp); break; - case KERN_RUN_2: if (device_param->exec_us_prev2[iteration]) usleep (device_param->exec_us_prev2[iteration] * device_param->nvidia_spin_damp); break; - case KERN_RUN_3: if (device_param->exec_us_prev3[iteration]) usleep (device_param->exec_us_prev3[iteration] * device_param->nvidia_spin_damp); break; + case KERN_RUN_1: if (device_param->exec_us_prev1[iteration] > 0) usleep ((__useconds_t)(device_param->exec_us_prev1[iteration] * device_param->nvidia_spin_damp)); break; + case KERN_RUN_2: if (device_param->exec_us_prev2[iteration] > 0) usleep ((__useconds_t)(device_param->exec_us_prev2[iteration] * device_param->nvidia_spin_damp)); break; + case KERN_RUN_3: if (device_param->exec_us_prev3[iteration] > 0) usleep ((__useconds_t)(device_param->exec_us_prev3[iteration] * device_param->nvidia_spin_damp)); break; } } } @@ -3405,7 +3405,7 @@ static int choose_kernel (hc_device_param_t *device_param, const uint attack_exe const float iter_part = (float) (loop_pos + loop_left) / iter; - const u64 perf_sum_all = pws_cnt * iter_part; + const u64 perf_sum_all = (u64) (pws_cnt * iter_part); double speed_ms; @@ -3741,8 +3741,8 @@ static int autotune (hc_device_param_t *device_param) for (u32 f = 1; f < 1024; f++) { - const u32 kernel_accel_try = (float) kernel_accel_orig * f; - const u32 kernel_loops_try = (float) kernel_loops_orig / f; + const u32 kernel_accel_try = kernel_accel_orig * f; + const u32 kernel_loops_try = kernel_loops_orig / f; if (kernel_accel_try > kernel_accel_max) break; if (kernel_loops_try < kernel_loops_min) break; @@ -3782,7 +3782,7 @@ static int autotune (hc_device_param_t *device_param) { // this is safe to not overflow kernel_accel_max because of accel_left - kernel_accel = (double) kernel_accel * exec_accel_min; + kernel_accel *= (u32) exec_accel_min; } // reset them fake words @@ -5209,7 +5209,7 @@ static u32 get_power (hc_device_param_t *device_param) { const double device_factor = (double) device_param->hardware_power / data.hardware_power_all; - const u64 words_left_device = CEIL ((double) kernel_power_final * device_factor); + const u64 words_left_device = (u64) CEIL (kernel_power_final * device_factor); // work should be at least the hardware power available without any accelerator @@ -15688,11 +15688,11 @@ int main (int argc, char **argv) return -1; } - int engine_clock_max = caps.sEngineClockRange.iMax * 0.6666; - int memory_clock_max = caps.sMemoryClockRange.iMax * 0.6250; + int engine_clock_max = (int) (0.6666 * caps.sEngineClockRange.iMax); + int memory_clock_max = (int) (0.6250 * caps.sMemoryClockRange.iMax); - int warning_trigger_engine = (int) (0.25 * (double) engine_clock_max); - int warning_trigger_memory = (int) (0.25 * (double) memory_clock_max); + int warning_trigger_engine = (int) (0.25 * engine_clock_max); + int warning_trigger_memory = (int) (0.25 * memory_clock_max); int engine_clock_profile_max = od_clock_mem_status[device_id].state.aLevels[1].iEngineClock; int memory_clock_profile_max = od_clock_mem_status[device_id].state.aLevels[1].iMemoryClock; From ed1ad9714d614521bee6a985d18c303ebdec864b Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 30 Aug 2016 18:13:41 -0700 Subject: [PATCH 2/4] Fix -Wmissing-declarations --- include/cpu-des.h | 2 + include/cpu-md5.h | 2 +- include/cpu-sha1.h | 1 + include/cpu-sha256.h | 1 + include/shared.h | 6 +++ src/hashcat.c | 15 +++--- src/shared.c | 120 ++++++++++++++++++++++--------------------- 7 files changed, 80 insertions(+), 67 deletions(-) create mode 100644 include/cpu-des.h create mode 100644 include/cpu-sha1.h create mode 100644 include/cpu-sha256.h diff --git a/include/cpu-des.h b/include/cpu-des.h new file mode 100644 index 000000000..5cfc82629 --- /dev/null +++ b/include/cpu-des.h @@ -0,0 +1,2 @@ +void _des_keysetup (u32 data[2], u32 Kc[16], u32 Kd[16], const u32 s_skb[8][64]); +void _des_encrypt (u32 data[2], u32 Kc[16], u32 Kd[16], const u32 s_SPtrans[8][64]); diff --git a/include/cpu-md5.h b/include/cpu-md5.h index 5409947d1..06683785a 100644 --- a/include/cpu-md5.h +++ b/include/cpu-md5.h @@ -1,2 +1,2 @@ void md5_64 (uint block[16], uint digest[4]); - +void md5_complete_no_limit (uint digest[4], uint *plain, uint plain_len); diff --git a/include/cpu-sha1.h b/include/cpu-sha1.h new file mode 100644 index 000000000..ba893af59 --- /dev/null +++ b/include/cpu-sha1.h @@ -0,0 +1 @@ +void sha1_64 (uint block[16], uint digest[5]); diff --git a/include/cpu-sha256.h b/include/cpu-sha256.h new file mode 100644 index 000000000..e4c2ac9a8 --- /dev/null +++ b/include/cpu-sha256.h @@ -0,0 +1 @@ +void sha256_64 (uint block[16], uint digest[8]); diff --git a/include/shared.h b/include/shared.h index 0808d2a05..48f4d5cd5 100644 --- a/include/shared.h +++ b/include/shared.h @@ -1746,17 +1746,23 @@ void *thread_device_watch (void *p); void *thread_keypress (void *p); void *thread_runtime (void *p); +void status_display (); +void status_display_machine_readable (); + /** * checksum for use on cpu */ #include "cpu-crc32.h" #include "cpu-md5.h" +#include "cpu-sha1.h" +#include "cpu-sha256.h" /** * ciphers for use on cpu */ #include "cpu-aes.h" +#include "cpu-des.h" #endif // SHARED_H diff --git a/src/hashcat.c b/src/hashcat.c index 1c5ff496a..98313ab3a 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -19,7 +19,8 @@ #include #include -const char *PROGNAME = "hashcat"; +static const char *PROGNAME = "hashcat"; + const uint VERSION_BIN = 310; const uint RESTORE_MIN = 300; @@ -2931,9 +2932,9 @@ static int run_kernel (const uint kern_run, hc_device_param_t *device_param, con { switch (kern_run) { - case KERN_RUN_1: if (device_param->exec_us_prev1[iteration] > 0) usleep ((__useconds_t)(device_param->exec_us_prev1[iteration] * device_param->nvidia_spin_damp)); break; - case KERN_RUN_2: if (device_param->exec_us_prev2[iteration] > 0) usleep ((__useconds_t)(device_param->exec_us_prev2[iteration] * device_param->nvidia_spin_damp)); break; - case KERN_RUN_3: if (device_param->exec_us_prev3[iteration] > 0) usleep ((__useconds_t)(device_param->exec_us_prev3[iteration] * device_param->nvidia_spin_damp)); break; + case KERN_RUN_1: if (device_param->exec_us_prev1[iteration] > 0) usleep ((useconds_t)(device_param->exec_us_prev1[iteration] * device_param->nvidia_spin_damp)); break; + case KERN_RUN_2: if (device_param->exec_us_prev2[iteration] > 0) usleep ((useconds_t)(device_param->exec_us_prev2[iteration] * device_param->nvidia_spin_damp)); break; + case KERN_RUN_3: if (device_param->exec_us_prev3[iteration] > 0) usleep ((useconds_t)(device_param->exec_us_prev3[iteration] * device_param->nvidia_spin_damp)); break; } } } @@ -6055,7 +6056,7 @@ static void hlfmt_user (uint hashfile_format, char *line_buf, int line_len, char } } -char *strhlfmt (const uint hashfile_format) +static char *strhlfmt (const uint hashfile_format) { switch (hashfile_format) { @@ -6125,7 +6126,7 @@ static uint hlfmt_detect (FILE *fp, uint max_check) // wrapper around mymalloc for ADL #if defined(HAVE_HWMON) -void *HC_API_CALL ADL_Main_Memory_Alloc (const int iSize) +static void *HC_API_CALL ADL_Main_Memory_Alloc (const int iSize) { return mymalloc (iSize); } @@ -6182,7 +6183,7 @@ static uint generate_bitmaps (const uint digests_cnt, const uint dgst_size, cons */ #ifdef WIN -void SetConsoleWindowSize (const int x) +static void SetConsoleWindowSize (const int x) { HANDLE h = GetStdHandle (STD_OUTPUT_HANDLE); diff --git a/src/shared.c b/src/shared.c index b8742c527..3305053fb 100644 --- a/src/shared.c +++ b/src/shared.c @@ -86,9 +86,9 @@ u64 byte_swap_64 (const u64 n) * logging */ -int last_len = 0; +static int last_len = 0; -int log_final (FILE *fp, const char *fmt, va_list ap) +static int log_final (FILE *fp, const char *fmt, va_list ap) { if (last_len) { @@ -229,7 +229,8 @@ int log_error (const char *fmt, ...) * converter */ -u8 int_to_base32 (const u8 c) +#if 0 //unused +static u8 int_to_base32 (const u8 c) { static const u8 tbl[0x20] = { @@ -240,15 +241,16 @@ u8 int_to_base32 (const u8 c) return tbl[c]; } -u8 base32_to_int (const u8 c) +static u8 base32_to_int (const u8 c) { if ((c >= 'A') && (c <= 'Z')) return c - 'A'; else if ((c >= '2') && (c <= '7')) return c - '2' + 26; return 0; } +#endif -u8 int_to_itoa32 (const u8 c) +static u8 int_to_itoa32 (const u8 c) { static const u8 tbl[0x20] = { @@ -259,7 +261,7 @@ u8 int_to_itoa32 (const u8 c) return tbl[c]; } -u8 itoa32_to_int (const u8 c) +static u8 itoa32_to_int (const u8 c) { if ((c >= '0') && (c <= '9')) return c - '0'; else if ((c >= 'a') && (c <= 'v')) return c - 'a' + 10; @@ -267,7 +269,7 @@ u8 itoa32_to_int (const u8 c) return 0; } -u8 int_to_itoa64 (const u8 c) +static u8 int_to_itoa64 (const u8 c) { static const u8 tbl[0x40] = { @@ -280,7 +282,7 @@ u8 int_to_itoa64 (const u8 c) return tbl[c]; } -u8 itoa64_to_int (const u8 c) +static u8 itoa64_to_int (const u8 c) { static const u8 tbl[0x100] = { @@ -305,7 +307,7 @@ u8 itoa64_to_int (const u8 c) return tbl[c]; } -u8 int_to_base64 (const u8 c) +static u8 int_to_base64 (const u8 c) { static const u8 tbl[0x40] = { @@ -318,7 +320,7 @@ u8 int_to_base64 (const u8 c) return tbl[c]; } -u8 base64_to_int (const u8 c) +static u8 base64_to_int (const u8 c) { static const u8 tbl[0x100] = { @@ -343,7 +345,7 @@ u8 base64_to_int (const u8 c) return tbl[c]; } -u8 int_to_bf64 (const u8 c) +static u8 int_to_bf64 (const u8 c) { static const u8 tbl[0x40] = { @@ -356,7 +358,7 @@ u8 int_to_bf64 (const u8 c) return tbl[c]; } -u8 bf64_to_int (const u8 c) +static u8 bf64_to_int (const u8 c) { static const u8 tbl[0x100] = { @@ -381,7 +383,7 @@ u8 bf64_to_int (const u8 c) return tbl[c]; } -u8 int_to_lotus64 (const u8 c) +static u8 int_to_lotus64 (const u8 c) { if (c < 10) return '0' + c; else if (c < 36) return 'A' + c - 10; @@ -392,7 +394,7 @@ u8 int_to_lotus64 (const u8 c) return 0; } -u8 lotus64_to_int (const u8 c) +static u8 lotus64_to_int (const u8 c) { if ((c >= '0') && (c <= '9')) return c - '0'; else if ((c >= 'A') && (c <= 'Z')) return c - 'A' + 10; @@ -404,7 +406,7 @@ u8 lotus64_to_int (const u8 c) return 0; } -int base32_decode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf) +static int base32_decode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf) { const u8 *in_ptr = in_buf; @@ -443,7 +445,7 @@ int base32_decode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf return out_len; } -int base32_encode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf) +static int base32_encode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf) { const u8 *in_ptr = in_buf; @@ -485,7 +487,7 @@ int base32_encode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf return out_len; } -int base64_decode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf) +static int base64_decode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf) { const u8 *in_ptr = in_buf; @@ -518,7 +520,7 @@ int base64_decode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf return out_len; } -int base64_encode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf) +static int base64_encode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf) { const u8 *in_ptr = in_buf; @@ -552,7 +554,7 @@ int base64_encode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf return out_len; } -int is_valid_hex_char (const u8 c) +static int is_valid_hex_char (const u8 c) { if ((c >= '0') && (c <= '9')) return 1; if ((c >= 'A') && (c <= 'F')) return 1; @@ -616,7 +618,7 @@ u64 hex_to_u64 (const u8 hex[16]) return (v); } -void bin_to_hex_lower (const u32 v, u8 hex[8]) +static void bin_to_hex_lower (const u32 v, u8 hex[8]) { hex[0] = v >> 28 & 15; hex[1] = v >> 24 & 15; @@ -718,7 +720,7 @@ static void juniper_decrypt_hash (char *in, char *out) AES128_decrypt_cbc (juniper_key, juniper_iv, in_ptr, out_ptr); } -void phpass_decode (u8 digest[16], u8 buf[22]) +static void phpass_decode (u8 digest[16], u8 buf[22]) { int l; @@ -773,7 +775,7 @@ void phpass_decode (u8 digest[16], u8 buf[22]) digest[15] = (l >> 0) & 0xff; } -void phpass_encode (u8 digest[16], u8 buf[22]) +static void phpass_encode (u8 digest[16], u8 buf[22]) { int l; @@ -818,7 +820,7 @@ void phpass_encode (u8 digest[16], u8 buf[22]) buf[21] = int_to_itoa64 (l & 0x3f); } -void md5crypt_decode (u8 digest[16], u8 buf[22]) +static void md5crypt_decode (u8 digest[16], u8 buf[22]) { int l; @@ -873,7 +875,7 @@ void md5crypt_decode (u8 digest[16], u8 buf[22]) digest[11] = (l >> 0) & 0xff; } -void md5crypt_encode (u8 digest[16], u8 buf[22]) +static void md5crypt_encode (u8 digest[16], u8 buf[22]) { int l; @@ -918,7 +920,7 @@ void md5crypt_encode (u8 digest[16], u8 buf[22]) buf[21] = int_to_itoa64 (l & 0x3f); l >>= 6; } -void sha512crypt_decode (u8 digest[64], u8 buf[86]) +static void sha512crypt_decode (u8 digest[64], u8 buf[86]) { int l; @@ -1117,7 +1119,7 @@ void sha512crypt_decode (u8 digest[64], u8 buf[86]) digest[63] = (l >> 0) & 0xff; } -void sha512crypt_encode (u8 digest[64], u8 buf[86]) +static void sha512crypt_encode (u8 digest[64], u8 buf[86]) { int l; @@ -1274,7 +1276,7 @@ void sha512crypt_encode (u8 digest[64], u8 buf[86]) buf[85] = int_to_itoa64 (l & 0x3f); l >>= 6; } -void sha1aix_decode (u8 digest[20], u8 buf[27]) +static void sha1aix_decode (u8 digest[20], u8 buf[27]) { int l; @@ -1340,7 +1342,7 @@ void sha1aix_decode (u8 digest[20], u8 buf[27]) digest[18] = (l >> 16) & 0xff; } -void sha1aix_encode (u8 digest[20], u8 buf[27]) +static void sha1aix_encode (u8 digest[20], u8 buf[27]) { int l; @@ -1393,7 +1395,7 @@ void sha1aix_encode (u8 digest[20], u8 buf[27]) buf[26] = int_to_itoa64 (l & 0x3f); } -void sha256aix_decode (u8 digest[32], u8 buf[43]) +static void sha256aix_decode (u8 digest[32], u8 buf[43]) { int l; @@ -1496,7 +1498,7 @@ void sha256aix_decode (u8 digest[32], u8 buf[43]) digest[30] = (l >> 16) & 0xff; } -void sha256aix_encode (u8 digest[32], u8 buf[43]) +static void sha256aix_encode (u8 digest[32], u8 buf[43]) { int l; @@ -1577,7 +1579,7 @@ void sha256aix_encode (u8 digest[32], u8 buf[43]) buf[42] = int_to_itoa64 (l & 0x3f); } -void sha512aix_decode (u8 digest[64], u8 buf[86]) +static void sha512aix_decode (u8 digest[64], u8 buf[86]) { int l; @@ -1776,7 +1778,7 @@ void sha512aix_decode (u8 digest[64], u8 buf[86]) digest[63] = (l >> 16) & 0xff; } -void sha512aix_encode (u8 digest[64], u8 buf[86]) +static void sha512aix_encode (u8 digest[64], u8 buf[86]) { int l; @@ -1933,7 +1935,7 @@ void sha512aix_encode (u8 digest[64], u8 buf[86]) buf[85] = int_to_itoa64 (l & 0x3f); l >>= 6; } -void sha256crypt_decode (u8 digest[32], u8 buf[43]) +static void sha256crypt_decode (u8 digest[32], u8 buf[43]) { int l; @@ -2035,7 +2037,7 @@ void sha256crypt_decode (u8 digest[32], u8 buf[43]) digest[30] = (l >> 0) & 0xff; } -void sha256crypt_encode (u8 digest[32], u8 buf[43]) +static void sha256crypt_encode (u8 digest[32], u8 buf[43]) { int l; @@ -2116,7 +2118,7 @@ void sha256crypt_encode (u8 digest[32], u8 buf[43]) buf[42] = int_to_itoa64 (l & 0x3f); } -void drupal7_decode (u8 digest[64], u8 buf[44]) +static void drupal7_decode (u8 digest[64], u8 buf[44]) { int l; @@ -2252,7 +2254,7 @@ void drupal7_decode (u8 digest[64], u8 buf[44]) digest[63] = 0; } -void drupal7_encode (u8 digest[64], u8 buf[43]) +static void drupal7_encode (u8 digest[64], u8 buf[43]) { int l; @@ -2342,7 +2344,7 @@ void drupal7_encode (u8 digest[64], u8 buf[43]) static struct termios savemodes; static int havemodes = 0; -int tty_break() +static int tty_break() { struct termios modmodes; @@ -2358,7 +2360,7 @@ int tty_break() return tcsetattr (fileno (stdin), TCSANOW, &modmodes); } -int tty_getchar() +static int tty_getchar() { fd_set rfds; @@ -2379,7 +2381,7 @@ int tty_getchar() return getchar(); } -int tty_fix() +static int tty_fix() { if (!havemodes) return 0; @@ -2439,7 +2441,7 @@ int tty_fix() #ifdef WIN static DWORD saveMode = 0; -int tty_break() +static int tty_break() { HANDLE stdinHandle = GetStdHandle (STD_INPUT_HANDLE); @@ -2449,7 +2451,7 @@ int tty_break() return 0; } -int tty_getchar() +static int tty_getchar() { HANDLE stdinHandle = GetStdHandle (STD_INPUT_HANDLE); @@ -2489,7 +2491,7 @@ int tty_getchar() return 0; } -int tty_fix() +static int tty_fix() { HANDLE stdinHandle = GetStdHandle (STD_INPUT_HANDLE); @@ -2569,7 +2571,7 @@ char *mystrdup (const char *s) return (b); } -FILE *logfile_open (char *logfile) +static FILE *logfile_open (char *logfile) { FILE *fp = fopen (logfile, "ab"); @@ -2581,7 +2583,7 @@ FILE *logfile_open (char *logfile) return fp; } -void logfile_close (FILE *fp) +static void logfile_close (FILE *fp) { if (fp == stdout) return; @@ -2609,7 +2611,7 @@ void logfile_append (const char *fmt, ...) logfile_close (fp); } -int logfile_generate_id () +static int logfile_generate_id () { const int n = rand (); @@ -2834,7 +2836,7 @@ void hm_get_opencl_busid_devid (hm_attrs_t *hm_device, uint opencl_num_devices, } */ -void hm_sort_adl_adapters_by_busid_devid (u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo) +static void hm_sort_adl_adapters_by_busid_devid (u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo) { // basically bubble sort @@ -3562,7 +3564,7 @@ void mp_css_to_uniq_tbl (uint css_cnt, cs_t *css, uint uniq_tbls[SP_PW_MAX][CHAR } } -void mp_add_cs_buf (uint *in_buf, size_t in_len, cs_t *css, int css_cnt) +static void mp_add_cs_buf (uint *in_buf, size_t in_len, cs_t *css, int css_cnt) { cs_t *cs = &css[css_cnt]; @@ -3597,7 +3599,7 @@ void mp_add_cs_buf (uint *in_buf, size_t in_len, cs_t *css, int css_cnt) myfree (css_uniq); } -void mp_expand (char *in_buf, size_t in_len, cs_t *mp_sys, cs_t *mp_usr, int mp_usr_offset, int interpret) +static void mp_expand (char *in_buf, size_t in_len, cs_t *mp_sys, cs_t *mp_usr, int mp_usr_offset, int interpret) { size_t in_pos; @@ -5036,7 +5038,7 @@ int sort_by_digest_p0p1 (const void *v1, const void *v2) return 0; } -int sort_by_tuning_db_alias (const void *v1, const void *v2) +static int sort_by_tuning_db_alias (const void *v1, const void *v2) { const tuning_db_alias_t *t1 = (const tuning_db_alias_t *) v1; const tuning_db_alias_t *t2 = (const tuning_db_alias_t *) v2; @@ -5048,7 +5050,7 @@ int sort_by_tuning_db_alias (const void *v1, const void *v2) return 0; } -int sort_by_tuning_db_entry (const void *v1, const void *v2) +static int sort_by_tuning_db_entry (const void *v1, const void *v2) { const tuning_db_entry_t *t1 = (const tuning_db_entry_t *) v1; const tuning_db_entry_t *t2 = (const tuning_db_entry_t *) v2; @@ -9200,7 +9202,7 @@ void to_hccap_t (hccap_t *hccap, uint salt_pos, uint digest_pos) } } -void SuspendThreads () +static void SuspendThreads () { if (data.devices_status != STATUS_RUNNING) return; @@ -9211,7 +9213,7 @@ void SuspendThreads () log_info ("Paused"); } -void ResumeThreads () +static void ResumeThreads () { if (data.devices_status != STATUS_PAUSED) return; @@ -9226,14 +9228,14 @@ void ResumeThreads () log_info ("Resumed"); } -void bypass () +static void bypass () { data.devices_status = STATUS_BYPASS; log_info ("Next dictionary / mask in queue selected, bypassing current one"); } -void stop_at_checkpoint () +static void stop_at_checkpoint () { if (data.devices_status != STATUS_STOP_AT_CHECKPOINT) { @@ -9971,7 +9973,7 @@ tuning_db_entry_t *tuning_db_search (tuning_db_t *tuning_db, hc_device_param_t * * parser */ -uint parse_and_store_salt (char *out, char *in, uint salt_len) +static uint parse_and_store_salt (char *out, char *in, uint salt_len) { u8 tmp[256] = { 0 }; @@ -11315,7 +11317,7 @@ int md5asa_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf) return (PARSER_OK); } -void transform_netntlmv1_key (const u8 *nthash, u8 *key) +static void transform_netntlmv1_key (const u8 *nthash, u8 *key) { key[0] = (nthash[0] >> 0); key[1] = (nthash[0] << 7) | (nthash[1] >> 1); @@ -20999,7 +21001,7 @@ bool class_alpha (const u8 c) return (class_lower (c) || class_upper (c)); } -int conv_ctoi (const u8 c) +static int conv_ctoi (const u8 c) { if (class_num (c)) { @@ -21013,7 +21015,7 @@ int conv_ctoi (const u8 c) return -1; } -int conv_itoc (const u8 c) +static int conv_itoc (const u8 c) { if (c < 10) { @@ -21696,7 +21698,7 @@ int mangle_insert (char arr[BLOCK_SIZE], int arr_len, int upos, char c) return (arr_len + 1); } -int mangle_insert_multi (char arr[BLOCK_SIZE], int arr_len, int arr_pos, char arr2[BLOCK_SIZE], int arr2_len, int arr2_pos, int arr2_cpy) +static int mangle_insert_multi (char arr[BLOCK_SIZE], int arr_len, int arr_pos, char arr2[BLOCK_SIZE], int arr2_len, int arr2_pos, int arr2_cpy) { if ((arr_len + arr2_cpy) > BLOCK_SIZE) return (RULE_RC_REJECT_ERROR); From edb07bc6c7b6620a32bf058d4157f051a6265a98 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 30 Aug 2016 18:19:09 -0700 Subject: [PATCH 3/4] Missed a few --- src/hashcat.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hashcat.c b/src/hashcat.c index 98313ab3a..36bb61788 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -24,7 +24,7 @@ static const char *PROGNAME = "hashcat"; const uint VERSION_BIN = 310; const uint RESTORE_MIN = 300; -double TARGET_MS_PROFILE[4] = { 2, 12, 96, 480 }; +static double TARGET_MS_PROFILE[4] = { 2, 12, 96, 480 }; #define INCR_RULES 10000 #define INCR_SALTS 100000 @@ -342,10 +342,10 @@ static unsigned int full80 = 0x80808080; int SUPPRESS_OUTPUT = 0; -hc_thread_mutex_t mux_adl; -hc_thread_mutex_t mux_counter; -hc_thread_mutex_t mux_dispatcher; -hc_thread_mutex_t mux_display; +static hc_thread_mutex_t mux_adl; +static hc_thread_mutex_t mux_counter; +static hc_thread_mutex_t mux_dispatcher; + hc_thread_mutex_t mux_display; hc_global_data_t data; From e6641396999a5a6bf560cc8b45ae6d6345ff7c75 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 30 Aug 2016 18:37:16 -0700 Subject: [PATCH 4/4] Fix missing prototypes --- include/shared.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/shared.h b/include/shared.h index 48f4d5cd5..16d77d4cb 100644 --- a/include/shared.h +++ b/include/shared.h @@ -1355,7 +1355,7 @@ void dump_hex (const u8 *s, const int sz); void truecrypt_crc32 (const char *filename, u8 keytab[64]); -char *get_exec_path (); +char *get_exec_path (void); char *get_install_dir (const char *progname); char *get_profile_dir (const char *homedir); char *get_session_dir (const char *profile_dir); @@ -1433,8 +1433,8 @@ void *mymalloc (size_t size); void *myrealloc (void *ptr, size_t oldsz, size_t add); char *mystrdup (const char *s); -char *logfile_generate_topid (); -char *logfile_generate_subid (); +char *logfile_generate_topid (void); +char *logfile_generate_subid (void); void logfile_append (const char *fmt, ...); #ifdef F_SETLKW @@ -1486,8 +1486,8 @@ int hm_set_fanspeed_with_device_id_xnvctrl (const uint device_id, const int fa void hm_device_val_to_str (char *target_buf, int max_buf_size, char *suffix, int value); #endif // HAVE_HWMON -void myabort (); -void myquit (); +void myabort (void); +void myquit (void); void set_cpu_affinity (char *cpu_affinity); @@ -1678,13 +1678,13 @@ void naive_escape (char *s, size_t s_max, const u8 key_char, const u8 escape_cha void load_kernel (const char *kernel_file, int num_devices, size_t *kernel_lengths, const u8 **kernel_sources); void writeProgramBin (char *dst, u8 *binary, size_t binary_size); -u64 get_lowest_words_done (); +u64 get_lowest_words_done (void); restore_data_t *init_restore (int argc, char **argv); void read_restore (const char *eff_restore_file, restore_data_t *rd); void write_restore (const char *new_restore_file, restore_data_t *rd); -void cycle_restore (); -void check_checkpoint (); +void cycle_restore (void); +void check_checkpoint (void); #ifdef WIN @@ -1746,8 +1746,8 @@ void *thread_device_watch (void *p); void *thread_keypress (void *p); void *thread_runtime (void *p); -void status_display (); -void status_display_machine_readable (); +void status_display (void); +void status_display_machine_readable (void); /** * checksum for use on cpu