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

Merge pull request #892 from neheb/master

Fixed a few warnings.
This commit is contained in:
Jens Steube 2016-12-01 10:35:10 +01:00 committed by GitHub
commit 1028fb9514
15 changed files with 56 additions and 44 deletions

View File

@ -23,7 +23,6 @@
#define _GNU_SOURCE #define _GNU_SOURCE
#define _FILE_OFFSET_BITS 64 #define _FILE_OFFSET_BITS 64
#define _LARGEFILE64_SOURCE
#define NOMINMAX 1 #define NOMINMAX 1

View File

@ -673,7 +673,7 @@ typedef struct hash
typedef struct outfile_data typedef struct outfile_data
{ {
char *file_name; char *file_name;
long seek; off_t seek;
time_t ctime; time_t ctime;
} outfile_data_t; } outfile_data_t;

View File

@ -84,7 +84,7 @@ int set_cpu_affinity (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx)
if (cpu_id > 32) if (cpu_id > 32)
{ {
event_log_error (hashcat_ctx, "Invalid cpu_id %u specified", cpu_id); event_log_error (hashcat_ctx, "Invalid cpu_id %d specified", cpu_id);
return (-1); return (-1);
} }

View File

@ -1051,13 +1051,13 @@ static int nvapi_init (hashcat_ctx_t *hashcat_ctx)
} }
HC_LOAD_FUNC(nvapi, nvapi_QueryInterface, NVAPI_QUERYINTERFACE, NVAPI, 0) HC_LOAD_FUNC(nvapi, nvapi_QueryInterface, NVAPI_QUERYINTERFACE, NVAPI, 0)
HC_LOAD_ADDR(nvapi, NvAPI_Initialize, NVAPI_INITIALIZE, nvapi_QueryInterface, 0x0150E828, NVAPI, 0) HC_LOAD_ADDR(nvapi, NvAPI_Initialize, NVAPI_INITIALIZE, nvapi_QueryInterface, 0x0150E828u, NVAPI, 0)
HC_LOAD_ADDR(nvapi, NvAPI_Unload, NVAPI_UNLOAD, nvapi_QueryInterface, 0xD22BDD7E, NVAPI, 0) HC_LOAD_ADDR(nvapi, NvAPI_Unload, NVAPI_UNLOAD, nvapi_QueryInterface, 0xD22BDD7Eu, NVAPI, 0)
HC_LOAD_ADDR(nvapi, NvAPI_GetErrorMessage, NVAPI_GETERRORMESSAGE, nvapi_QueryInterface, 0x6C2D048C, NVAPI, 0) HC_LOAD_ADDR(nvapi, NvAPI_GetErrorMessage, NVAPI_GETERRORMESSAGE, nvapi_QueryInterface, 0x6C2D048Cu, NVAPI, 0)
HC_LOAD_ADDR(nvapi, NvAPI_EnumPhysicalGPUs, NVAPI_ENUMPHYSICALGPUS, nvapi_QueryInterface, 0xE5AC921F, NVAPI, 0) HC_LOAD_ADDR(nvapi, NvAPI_EnumPhysicalGPUs, NVAPI_ENUMPHYSICALGPUS, nvapi_QueryInterface, 0xE5AC921Fu, NVAPI, 0)
HC_LOAD_ADDR(nvapi, NvAPI_GPU_GetPerfPoliciesInfo, NVAPI_GPU_GETPERFPOLICIESINFO, nvapi_QueryInterface, 0x409D9841, NVAPI, 0) HC_LOAD_ADDR(nvapi, NvAPI_GPU_GetPerfPoliciesInfo, NVAPI_GPU_GETPERFPOLICIESINFO, nvapi_QueryInterface, 0x409D9841u, NVAPI, 0)
HC_LOAD_ADDR(nvapi, NvAPI_GPU_GetPerfPoliciesStatus, NVAPI_GPU_GETPERFPOLICIESSTATUS, nvapi_QueryInterface, 0x3D358A0C, NVAPI, 0) HC_LOAD_ADDR(nvapi, NvAPI_GPU_GetPerfPoliciesStatus, NVAPI_GPU_GETPERFPOLICIESSTATUS, nvapi_QueryInterface, 0x3D358A0Cu, NVAPI, 0)
HC_LOAD_ADDR(nvapi, NvAPI_GPU_SetCoolerLevels, NVAPI_GPU_SETCOOLERLEVELS, nvapi_QueryInterface, 0x891FA0AE, NVAPI, 0) HC_LOAD_ADDR(nvapi, NvAPI_GPU_SetCoolerLevels, NVAPI_GPU_SETCOOLERLEVELS, nvapi_QueryInterface, 0x891FA0AEu, NVAPI, 0)
return 0; return 0;
} }

View File

@ -13311,7 +13311,7 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const size_t out_le
{ {
snprintf (out_buf, out_len - 1, "0x0100%s%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", snprintf (out_buf, out_len - 1, "0x0100%s%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x",
(char *) salt.salt_buf, (char *) salt.salt_buf,
0, 0, 0, 0, 0, 0u, 0u, 0u, 0u, 0u,
digest_buf[0], digest_buf[0],
digest_buf[1], digest_buf[1],
digest_buf[2], digest_buf[2],

View File

@ -29,7 +29,7 @@ void logfile_generate_topid (hashcat_ctx_t *hashcat_ctx)
const int id = logfile_generate_id (); const int id = logfile_generate_id ();
snprintf (logfile_ctx->topid, 1 + 16, "TOP%08x", id); snprintf (logfile_ctx->topid, 1 + 16, "TOP%08x", (u32) id);
} }
void logfile_generate_subid (hashcat_ctx_t *hashcat_ctx) void logfile_generate_subid (hashcat_ctx_t *hashcat_ctx)
@ -40,7 +40,7 @@ void logfile_generate_subid (hashcat_ctx_t *hashcat_ctx)
const int id = logfile_generate_id (); const int id = logfile_generate_id ();
snprintf (logfile_ctx->subid, 1 + 16, "SUB%08x", id); snprintf (logfile_ctx->subid, 1 + 16, "SUB%08x", (u32) id);
} }
void logfile_append (hashcat_ctx_t *hashcat_ctx, const char *fmt, ...) void logfile_append (hashcat_ctx_t *hashcat_ctx, const char *fmt, ...)

View File

@ -543,7 +543,7 @@ static void main_monitor_throttle1 (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAY
u32 *device_id = (u32 *) buf; u32 *device_id = (u32 *) buf;
event_log_warning (hashcat_ctx, "Drivers temperature threshold hit on GPU #%d, expect performance to drop...", *device_id + 1); event_log_warning (hashcat_ctx, "Drivers temperature threshold hit on GPU #%u, expect performance to drop...", *device_id + 1);
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK)) if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
{ {
@ -565,7 +565,7 @@ static void main_monitor_throttle2 (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAY
u32 *device_id = (u32 *) buf; u32 *device_id = (u32 *) buf;
event_log_warning (hashcat_ctx, "Drivers temperature threshold hit on GPU #%d, expect performance to drop...", *device_id + 1); event_log_warning (hashcat_ctx, "Drivers temperature threshold hit on GPU #%u, expect performance to drop...", *device_id + 1);
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK)) if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
{ {
@ -587,7 +587,7 @@ static void main_monitor_throttle3 (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAY
u32 *device_id = (u32 *) buf; u32 *device_id = (u32 *) buf;
event_log_warning (hashcat_ctx, "Drivers temperature threshold hit on GPU #%d, expect performance to drop...", *device_id + 1); event_log_warning (hashcat_ctx, "Drivers temperature threshold hit on GPU #%u, expect performance to drop...", *device_id + 1);
event_log_warning (hashcat_ctx, ""); event_log_warning (hashcat_ctx, "");
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK)) if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
@ -700,7 +700,7 @@ static void main_wordlist_cache_hit (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MA
cache_hit_t *cache_hit = (cache_hit_t *) buf; cache_hit_t *cache_hit = (cache_hit_t *) buf;
event_log_info (hashcat_ctx, "Cache-hit dictionary stats %s: %" PRIu64 " bytes, %" PRIu64 " words, %" PRIu64 " keyspace", cache_hit->dictfile, cache_hit->stat.st_size, cache_hit->cached_cnt, cache_hit->keyspace); event_log_info (hashcat_ctx, "Cache-hit dictionary stats %s: %" PRId64 " bytes, %" PRIu64 " words, %" PRIu64 " keyspace", cache_hit->dictfile, cache_hit->stat.st_size, cache_hit->cached_cnt, cache_hit->keyspace);
event_log_info (hashcat_ctx, ""); event_log_info (hashcat_ctx, "");
} }

View File

@ -551,10 +551,14 @@ static int mp_setup_usr (hashcat_ctx_t *hashcat_ctx, cs_t *mp_sys, cs_t *mp_usr,
{ {
event_log_error (hashcat_ctx, "%s: Custom charset file is too large", buf); event_log_error (hashcat_ctx, "%s: Custom charset file is too large", buf);
fclose (fp);
return -1; return -1;
} }
else
{
fclose (fp); fclose (fp);
}
if (nread == 0) if (nread == 0)
{ {

View File

@ -62,7 +62,16 @@ static int ocl_check_dri (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx)
u32 vendor = 0; u32 vendor = 0;
if (fscanf (fd_drm, "0x%x", &vendor) != 1) return 0; if (fscanf (fd_drm, "0x%x", &vendor) != 1)
{
fclose (fd_drm);
return 0;
}
else
{
fclose (fd_drm);
}
if (vendor != 4098) return 0; if (vendor != 4098) return 0;
@ -181,7 +190,7 @@ static int setup_opencl_platforms_filter (hashcat_ctx_t *hashcat_ctx, const char
if (platform < 1 || platform > 32) if (platform < 1 || platform > 32)
{ {
event_log_error (hashcat_ctx, "Invalid OpenCL platform %u specified", platform); event_log_error (hashcat_ctx, "Invalid OpenCL platform %d specified", platform);
return -1; return -1;
} }
@ -220,7 +229,7 @@ static int setup_devices_filter (hashcat_ctx_t *hashcat_ctx, const char *opencl_
if (device_id < 1 || device_id > 32) if (device_id < 1 || device_id > 32)
{ {
event_log_error (hashcat_ctx, "Invalid device_id %u specified", device_id); event_log_error (hashcat_ctx, "Invalid device_id %d specified", device_id);
return -1; return -1;
} }
@ -259,7 +268,7 @@ static int setup_device_types_filter (hashcat_ctx_t *hashcat_ctx, const char *op
if (device_type < 1 || device_type > 3) if (device_type < 1 || device_type > 3)
{ {
event_log_error (hashcat_ctx, "Invalid device_type %u specified", device_type); event_log_error (hashcat_ctx, "Invalid device_type %d specified", device_type);
return -1; return -1;
} }
@ -2132,7 +2141,7 @@ int opencl_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (opencl_platforms_filter > platform_cnt_mask) if (opencl_platforms_filter > platform_cnt_mask)
{ {
event_log_error (hashcat_ctx, "The platform selected by the --opencl-platforms parameter is larger than the number of available platforms (%d)", platforms_cnt); event_log_error (hashcat_ctx, "The platform selected by the --opencl-platforms parameter is larger than the number of available platforms (%u)", platforms_cnt);
return -1; return -1;
} }
@ -2946,7 +2955,7 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
if (opencl_ctx->devices_filter > devices_cnt_mask) if (opencl_ctx->devices_filter > devices_cnt_mask)
{ {
event_log_error (hashcat_ctx, "The device specified by the --opencl-devices parameter is larger than the number of available devices (%d)", devices_cnt); event_log_error (hashcat_ctx, "The device specified by the --opencl-devices parameter is larger than the number of available devices (%u)", devices_cnt);
return -1; return -1;
} }
@ -3463,14 +3472,14 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
if ((size_scrypt / 4) > device_param->device_maxmem_alloc) if ((size_scrypt / 4) > device_param->device_maxmem_alloc)
{ {
if (user_options->quiet == false) event_log_warning (hashcat_ctx, "Not enough single-block device memory allocatable to use --scrypt-tmto %d, increasing...", tmto); if (user_options->quiet == false) event_log_warning (hashcat_ctx, "Not enough single-block device memory allocatable to use --scrypt-tmto %u, increasing...", tmto);
continue; continue;
} }
if (size_scrypt > device_param->device_global_mem) if (size_scrypt > device_param->device_global_mem)
{ {
if (user_options->quiet == false) event_log_warning (hashcat_ctx, "Not enough total device memory allocatable to use --scrypt-tmto %d, increasing...", tmto); if (user_options->quiet == false) event_log_warning (hashcat_ctx, "Not enough total device memory allocatable to use --scrypt-tmto %u, increasing...", tmto);
continue; continue;
} }
@ -3688,9 +3697,9 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
char build_opts_new[1024] = { 0 }; char build_opts_new[1024] = { 0 };
#if defined (DEBUG) #if defined (DEBUG)
snprintf (build_opts_new, sizeof (build_opts_new) - 1, "%s -D VENDOR_ID=%u -D CUDA_ARCH=%d -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D _unroll -cl-std=CL1.2", build_opts, device_param->platform_vendor_id, (device_param->sm_major * 100) + device_param->sm_minor, device_param->vector_width, (u32) device_param->device_type, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, hashconfig->dgst_size / 4, hashconfig->kern_type); snprintf (build_opts_new, sizeof (build_opts_new) - 1, "%s -D VENDOR_ID=%u -D CUDA_ARCH=%u -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D _unroll -cl-std=CL1.2", build_opts, device_param->platform_vendor_id, (device_param->sm_major * 100) + device_param->sm_minor, device_param->vector_width, (u32) device_param->device_type, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, hashconfig->dgst_size / 4, hashconfig->kern_type);
#else #else
snprintf (build_opts_new, sizeof (build_opts_new) - 1, "%s -D VENDOR_ID=%u -D CUDA_ARCH=%d -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D _unroll -cl-std=CL1.2 -w", build_opts, device_param->platform_vendor_id, (device_param->sm_major * 100) + device_param->sm_minor, device_param->vector_width, (u32) device_param->device_type, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, hashconfig->dgst_size / 4, hashconfig->kern_type); snprintf (build_opts_new, sizeof (build_opts_new) - 1, "%s -D VENDOR_ID=%u -D CUDA_ARCH=%u -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D _unroll -cl-std=CL1.2 -w", build_opts, device_param->platform_vendor_id, (device_param->sm_major * 100) + device_param->sm_minor, device_param->vector_width, (u32) device_param->device_type, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, hashconfig->dgst_size / 4, hashconfig->kern_type);
#endif #endif
strncpy (build_opts, build_opts_new, sizeof (build_opts) - 1); strncpy (build_opts, build_opts_new, sizeof (build_opts) - 1);

View File

@ -148,13 +148,13 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx)
if (ptr == NULL) break; if (ptr == NULL) break;
int line_len = strlen (line_buf); size_t line_len = strlen (line_buf);
if (line_len <= 0) continue; if (line_len == 0) continue;
int iter = MAX_CUT_TRIES; size_t iter = MAX_CUT_TRIES;
for (u32 i = line_len - 1; i && iter; i--, line_len--) for (size_t i = line_len - 1; i && iter; i--, line_len--)
{ {
if (line_buf[i] != separator) continue; if (line_buf[i] != separator) continue;

View File

@ -71,7 +71,7 @@ static int check_running_process (hashcat_ctx_t *hashcat_ctx)
if (strcmp (argv0_r, pidbin_r) == 0) if (strcmp (argv0_r, pidbin_r) == 0)
{ {
event_log_error (hashcat_ctx, "Already an instance %s running on pid %d", pidbin, rd->pid); event_log_error (hashcat_ctx, "Already an instance %s running on pid %u", pidbin, rd->pid);
return -1; return -1;
} }

View File

@ -1637,7 +1637,7 @@ char *status_get_hwmon_dev (const hashcat_ctx_t *hashcat_ctx, const int device_i
} }
else else
{ {
output_len = snprintf (output_buf, HCBUFSIZ_TINY - 1, "N/A"); snprintf (output_buf, HCBUFSIZ_TINY - 1, "N/A");
} }
hc_thread_mutex_unlock (status_ctx->mux_hwmon); hc_thread_mutex_unlock (status_ctx->mux_hwmon);

View File

@ -955,7 +955,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
} }
event_log_info (hashcat_ctx, event_log_info (hashcat_ctx,
"Recovered........: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts", "Recovered........: %d/%d (%.2f%%) Digests, %d/%d (%.2f%%) Salts",
hashcat_status->digests_done, hashcat_status->digests_done,
hashcat_status->digests_cnt, hashcat_status->digests_cnt,
hashcat_status->digests_percent, hashcat_status->digests_percent,
@ -1066,7 +1066,7 @@ void status_benchmark_automate (hashcat_ctx_t *hashcat_ctx)
if (device_info->skipped_dev == true) continue; if (device_info->skipped_dev == true) continue;
event_log_info (hashcat_ctx, "%u:%u:%d:%d:%.2f:%" PRIu64, device_id + 1, hash_mode, device_info->corespeed_dev, device_info->memoryspeed_dev, device_info->exec_msec_dev, (u64) (device_info->hashes_msec_dev_benchmark * 1000)); event_log_info (hashcat_ctx, "%d:%u:%d:%d:%.2f:%" PRIu64, device_id + 1, hash_mode, device_info->corespeed_dev, device_info->memoryspeed_dev, device_info->exec_msec_dev, (u64) (device_info->hashes_msec_dev_benchmark * 1000));
} }
hcfree (hashcat_status); hcfree (hashcat_status);

View File

@ -152,7 +152,7 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
(token_ptr[1][0] != '3') && (token_ptr[1][0] != '3') &&
(token_ptr[1][0] != '*')) (token_ptr[1][0] != '*'))
{ {
event_log_warning (hashcat_ctx, "Tuning-db: Invalid attack_mode '%c' in Line '%u'", token_ptr[1][0], line_num); event_log_warning (hashcat_ctx, "Tuning-db: Invalid attack_mode '%c' in Line '%d'", token_ptr[1][0], line_num);
continue; continue;
} }
@ -163,7 +163,7 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
(token_ptr[3][0] != '8') && (token_ptr[3][0] != '8') &&
(token_ptr[3][0] != 'N')) (token_ptr[3][0] != 'N'))
{ {
event_log_warning (hashcat_ctx, "Tuning-db: Invalid vector_width '%c' in Line '%u'", token_ptr[3][0], line_num); event_log_warning (hashcat_ctx, "Tuning-db: Invalid vector_width '%c' in Line '%d'", token_ptr[3][0], line_num);
continue; continue;
} }
@ -186,7 +186,7 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
if ((kernel_accel < 1) || (kernel_accel > 1024)) if ((kernel_accel < 1) || (kernel_accel > 1024))
{ {
event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_accel '%d' in Line '%u'", kernel_accel, line_num); event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_accel '%d' in Line '%d'", kernel_accel, line_num);
continue; continue;
} }
@ -202,7 +202,7 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
if ((kernel_loops < 1) || (kernel_loops > 1024)) if ((kernel_loops < 1) || (kernel_loops > 1024))
{ {
event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_loops '%d' in Line '%u'", kernel_loops, line_num); event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_loops '%d' in Line '%d'", kernel_loops, line_num);
continue; continue;
} }
@ -225,7 +225,7 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
} }
else else
{ {
event_log_warning (hashcat_ctx, "Tuning-db: Invalid number of token in Line '%u'", line_num); event_log_warning (hashcat_ctx, "Tuning-db: Invalid number of token in Line '%d'", line_num);
continue; continue;
} }

View File

@ -571,7 +571,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
if ((user_options->workload_profile < 1) || (user_options->workload_profile > 4)) if ((user_options->workload_profile < 1) || (user_options->workload_profile > 4))
{ {
event_log_error (hashcat_ctx, "workload-profile %i not available", user_options->workload_profile); event_log_error (hashcat_ctx, "workload-profile %u not available", user_options->workload_profile);
return -1; return -1;
} }
@ -580,7 +580,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{ {
if (is_power_of_2 (user_options->opencl_vector_width) == false || user_options->opencl_vector_width > 16) if (is_power_of_2 (user_options->opencl_vector_width) == false || user_options->opencl_vector_width > 16)
{ {
event_log_error (hashcat_ctx, "opencl-vector-width %i not allowed", user_options->opencl_vector_width); event_log_error (hashcat_ctx, "opencl-vector-width %u not allowed", user_options->opencl_vector_width);
return -1; return -1;
} }