Merge pull request #1425 from neheb/master

clang tidy stuff
pull/1430/head
Jens Steube 7 years ago committed by GitHub
commit 50cdeaca19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -44,7 +44,7 @@
PERM_OP (l, r, tt, 4, 0x0f0f0f0f); \
}
void _des_keysetup (u32 data[2], u32 Kc[16], u32 Kd[16]);
void _des_encrypt (u32 data[2], u32 Kc[16], u32 Kd[16]);
void _des_keysetup (const u32 data[2], u32 Kc[16], u32 Kd[16]);
void _des_encrypt (u32 data[2], const u32 Kc[16], const u32 Kd[16]);
#endif // _CPU_DES_H

@ -8,6 +8,6 @@
#include <string.h>
void md4_64 (u32 block[16], u32 digest[4]);
void md4_64 (const u32 block[16], u32 digest[4]);
#endif // _CPU_MD4_H

@ -8,7 +8,7 @@
#include <string.h>
void md5_64 (u32 block[16], u32 digest[4]);
void md5_64 (const u32 block[16], u32 digest[4]);
void md5_complete_no_limit (u32 digest[4], u32 *plain, u32 plain_len);
#endif // _CPU_MD5_H

@ -6,6 +6,6 @@
#ifndef _CPU_SHA1_H
#define _CPU_SHA1_H
void sha1_64 (u32 block[16], u32 digest[5]);
void sha1_64 (const u32 block[16], u32 digest[5]);
#endif // _CPU_SHA1_H

@ -6,6 +6,6 @@
#ifndef _CPU_SHA256_H
#define _CPU_SHA256_H
void sha256_64 (u32 block[16], u32 digest[8]);
void sha256_64 (const u32 block[16], u32 digest[8]);
#endif // _CPU_SHA256_H

@ -34,7 +34,8 @@ void *hc_dlsym (void *module, const char *symbol);
if (noerr == 1) { \
event_log_error (hashcat_ctx, "%s is missing from %s shared library.", #name, #libname); \
return -1; \
} else { \
} \
if (noerr != 1) { \
event_log_warning (hashcat_ctx, "%s is missing from %s shared library.", #name, #libname); \
return 0; \
} \
@ -48,7 +49,8 @@ void *hc_dlsym (void *module, const char *symbol);
if (noerr == 1) { \
event_log_error (hashcat_ctx, "%s is missing from %s shared library.", #name, #libname); \
return -1; \
} else { \
} \
if (noerr != 1) { \
event_log_warning (hashcat_ctx, "%s is missing from %s shared library.", #name, #libname); \
return 0; \
} \
@ -61,7 +63,8 @@ void *hc_dlsym (void *module, const char *symbol);
if (noerr == 1) { \
event_log_error (hashcat_ctx, "%s at address %08x is missing from %s shared library.", #name, addr, #libname); \
return -1; \
} else { \
} \
if (noerr != 1) { \
event_log_warning (hashcat_ctx, "%s at address %08x is missing from %s shared library.", #name, addr, #libname); \
return 0; \
} \

@ -213,8 +213,8 @@ u8 hex_to_u8 (const u8 hex[2])
{
u8 v = 0;
v |= ((u8) hex_convert (hex[1]) << 0);
v |= ((u8) hex_convert (hex[0]) << 4);
v |= (hex_convert (hex[1]) << 0);
v |= (hex_convert (hex[0]) << 4);
return (v);
}
@ -328,8 +328,8 @@ u8 int_to_base32 (const u8 c)
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;
if ((c >= 'A') && (c <= 'Z')) return c - 'A';
if ((c >= '2') && (c <= '7')) return c - '2' + 26;
return 0;
}
@ -347,8 +347,8 @@ u8 int_to_itoa32 (const u8 c)
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;
if ((c >= '0') && (c <= '9')) return c - '0';
if ((c >= 'a') && (c <= 'v')) return c - 'a' + 10;
return 0;
}
@ -469,23 +469,22 @@ u8 bf64_to_int (const u8 c)
u8 int_to_lotus64 (const u8 c)
{
if (c < 10) return '0' + c;
else if (c < 36) return 'A' + c - 10;
else if (c < 62) return 'a' + c - 36;
else if (c == 62) return '+';
else if (c == 63) return '/';
if (c < 10) return '0' + c;
if (c < 36) return 'A' + c - 10;
if (c < 62) return 'a' + c - 36;
if (c == 62) return '+';
if (c == 63) return '/';
return 0;
}
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;
else if ((c >= 'a') && (c <= 'z')) return c - 'a' + 36;
else if (c == '+') return 62;
else if (c == '/') return 63;
else
if ((c >= '0') && (c <= '9')) return c - '0';
if ((c >= 'A') && (c <= 'Z')) return c - 'A' + 10;
if ((c >= 'a') && (c <= 'z')) return c - 'a' + 36;
if (c == '+') return 62;
if (c == '/') return 63;
return 0;
}

@ -326,7 +326,7 @@ static const u32 c_skb[8][64] =
}
};
void _des_keysetup (u32 data[2], u32 Kc[16], u32 Kd[16])
void _des_keysetup (const u32 data[2], u32 Kc[16], u32 Kd[16])
{
u32 c = data[0];
u32 d = data[1];
@ -384,7 +384,7 @@ void _des_keysetup (u32 data[2], u32 Kc[16], u32 Kd[16])
}
}
void _des_encrypt (u32 data[2], u32 Kc[16], u32 Kd[16])
void _des_encrypt (u32 data[2], const u32 Kc[16], const u32 Kd[16])
{
u32 r = data[0];
u32 l = data[1];

@ -12,7 +12,7 @@
#include "inc_hash_functions.cl"
#include "cpu_md4.h"
void md4_64 (u32 block[16], u32 digest[4])
void md4_64 (const u32 block[16], u32 digest[4])
{
u32 w0[4];
u32 w1[4];

@ -12,7 +12,7 @@
#include "inc_hash_functions.cl"
#include "cpu_md5.h"
void md5_64 (u32 block[16], u32 digest[4])
void md5_64 (const u32 block[16], u32 digest[4])
{
u32 w0[4];
u32 w1[4];

@ -12,7 +12,7 @@
#include "inc_hash_functions.cl"
#include "cpu_sha1.h"
void sha1_64 (u32 block[16], u32 digest[5])
void sha1_64 (const u32 block[16], u32 digest[5])
{
u32 a = digest[0];
u32 b = digest[1];

@ -12,7 +12,7 @@
#include "inc_hash_functions.cl"
#include "cpu_sha256.h"
void sha256_64 (u32 block[16], u32 digest[8])
void sha256_64 (const u32 block[16], u32 digest[8])
{
u32 w0_t = block[ 0];
u32 w1_t = block[ 1];

@ -134,7 +134,7 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
char *iconv_tmp = NULL;
if (strcmp (user_options->encoding_from, user_options->encoding_to))
if (strcmp (user_options->encoding_from, user_options->encoding_to) != 0)
{
iconv_enabled = true;
@ -278,8 +278,6 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
{
iconv_close (iconv_ctx);
iconv_enabled = false;
hcfree (iconv_tmp);
}

@ -125,7 +125,7 @@ int count_dictionaries (char **dictionary_files)
char *first_file_in_directory (const char *path)
{
DIR *d = NULL;
DIR *d;
if ((d = opendir (path)) != NULL)
{
@ -165,10 +165,6 @@ char *first_file_in_directory (const char *path)
return first_file;
}
else if (errno == ENOTDIR)
{
return NULL;
}
return NULL;
}

@ -501,7 +501,8 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
return 0;
}
else if (user_options->left == true)
if (user_options->left == true)
{
outfile_write_open (hashcat_ctx);

@ -589,7 +589,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
*/
hash_t *hashes_buf = (hash_t *) hccalloc (hashes_avail, sizeof (hash_t));
void *digests_buf = (void *) hccalloc (hashes_avail, hashconfig->dgst_size);
void *digests_buf = hccalloc (hashes_avail, hashconfig->dgst_size);
salt_t *salts_buf = NULL;
void *esalts_buf = NULL;
void *hook_salts_buf = NULL;
@ -630,7 +630,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
if (hashconfig->esalt_size > 0)
{
esalts_buf = (void *) hccalloc (hashes_avail, hashconfig->esalt_size);
esalts_buf = hccalloc (hashes_avail, hashconfig->esalt_size);
}
if (hashconfig->hook_salt_size > 0)
@ -1225,7 +1225,7 @@ int hashes_init_stage2 (hashcat_ctx_t *hashcat_ctx)
* Now generate all the buffers required for later
*/
void *digests_buf_new = (void *) hccalloc (hashes_cnt, hashconfig->dgst_size);
void *digests_buf_new = hccalloc (hashes_cnt, hashconfig->dgst_size);
salt_t *salts_buf_new = NULL;
void *esalts_buf_new = NULL;
void *hook_salts_buf_new = NULL;
@ -1241,12 +1241,12 @@ int hashes_init_stage2 (hashcat_ctx_t *hashcat_ctx)
if (hashconfig->esalt_size > 0)
{
esalts_buf_new = (void *) hccalloc (hashes_cnt, hashconfig->esalt_size);
esalts_buf_new = hccalloc (hashes_cnt, hashconfig->esalt_size);
}
if (hashconfig->hook_salt_size > 0)
{
hook_salts_buf_new = (void *) hccalloc (hashes_cnt, hashconfig->hook_salt_size);
hook_salts_buf_new = hccalloc (hashes_cnt, hashconfig->hook_salt_size);
}
EVENT (EVENT_HASHLIST_SORT_SALT_PRE);
@ -1547,18 +1547,18 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx)
void *st_esalts_buf = NULL;
void *st_hook_salts_buf = NULL;
st_digests_buf = (void *) hccalloc (1, hashconfig->dgst_size);
st_digests_buf = hccalloc (1, hashconfig->dgst_size);
st_salts_buf = (salt_t *) hccalloc (1, sizeof (salt_t));
if (hashconfig->esalt_size > 0)
{
st_esalts_buf = (void *) hccalloc (1, hashconfig->esalt_size);
st_esalts_buf = hccalloc (1, hashconfig->esalt_size);
}
if (hashconfig->hook_salt_size > 0)
{
st_hook_salts_buf = (void *) hccalloc (1, hashconfig->hook_salt_size);
st_hook_salts_buf = hccalloc (1, hashconfig->hook_salt_size);
}
hash_t hash;

@ -86,7 +86,7 @@ static void hlfmt_user_hashcat (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *l
// hlfmt pwdump
static int hlfmt_detect_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, int line_len)
static int hlfmt_detect_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const char *line_buf, int line_len)
{
int sep_cnt = 0;
@ -183,7 +183,7 @@ static void hlfmt_user_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *li
// hlfmt passwd
static int hlfmt_detect_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, int line_len)
static int hlfmt_detect_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const char *line_buf, int line_len)
{
int sep_cnt = 0;
@ -266,7 +266,7 @@ static void hlfmt_user_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *li
// hlfmt shadow
static int hlfmt_detect_shadow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, int line_len)
static int hlfmt_detect_shadow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const char *line_buf, int line_len)
{
int sep_cnt = 0;

@ -2563,7 +2563,8 @@ int hm_get_temperature_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 dev
return Temperature.iTemperature / 1000;
}
else if (hwmon_ctx->hm_device[device_id].od_version == 6)
if (hwmon_ctx->hm_device[device_id].od_version == 6)
{
int Temperature = 0;
@ -2649,7 +2650,8 @@ int hm_get_fanpolicy_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 devic
return (lpFanSpeedValue.iFanSpeed & ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED) ? 0 : 1;
}
else // od_version == 6
if (hwmon_ctx->hm_device[device_id].od_version == 6)
{
return 1;
}
@ -2706,7 +2708,8 @@ int hm_get_fanspeed_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 device
return lpFanSpeedValue.iFanSpeed;
}
else // od_version == 6
if (hwmon_ctx->hm_device[device_id].od_version == 6)
{
ADLOD6FanSpeedInfo faninfo;
@ -3108,7 +3111,8 @@ int hm_set_fanspeed_with_device_id_adl (hashcat_ctx_t *hashcat_ctx, const u32 de
return 0;
}
else // od_version == 6
if (hwmon_ctx->hm_device[device_id].od_version == 6)
{
ADLOD6FanSpeedValue fan_speed_value;
@ -3140,7 +3144,8 @@ int hm_set_fanspeed_with_device_id_adl (hashcat_ctx_t *hashcat_ctx, const u32 de
return 0;
}
else // od_version == 6
if (hwmon_ctx->hm_device[device_id].od_version == 6)
{
if (hm_ADL_Overdrive6_FanSpeed_Reset (hashcat_ctx, hwmon_ctx->hm_device[device_id].adl) == -1)
{
@ -3189,7 +3194,8 @@ int hm_set_fanspeed_with_device_id_nvapi (hashcat_ctx_t *hashcat_ctx, const u32
return 0;
}
else
if (fanpolicy != 1)
{
NV_GPU_COOLER_LEVELS CoolerLevels;

File diff suppressed because it is too large Load Diff

@ -17,11 +17,11 @@ void logfile_generate_topid (hashcat_ctx_t *hashcat_ctx)
if (logfile_ctx->enabled == false) return;
u32 v[4];
struct timeval v;
gettimeofday ((struct timeval *) v, NULL);
gettimeofday (&v, NULL);
snprintf (logfile_ctx->topid, 40, "TOP.%08x.%08x", v[0], v[2]);
snprintf (logfile_ctx->topid, 40, "TOP.%08x.%08x", (u32) v.tv_sec, (u32) v.tv_usec);
}
void logfile_generate_subid (hashcat_ctx_t *hashcat_ctx)
@ -30,11 +30,11 @@ void logfile_generate_subid (hashcat_ctx_t *hashcat_ctx)
if (logfile_ctx->enabled == false) return;
u32 v[4];
struct timeval v;
gettimeofday ((struct timeval *) v, NULL);
gettimeofday (&v, NULL);
snprintf (logfile_ctx->subid, 40, "SUB.%08x.%08x", v[0], v[2]);
snprintf (logfile_ctx->subid, 40, "SUB.%08x.%08x", (u32) v.tv_sec, (u32) v.tv_usec);
}
void logfile_append (hashcat_ctx_t *hashcat_ctx, const char *fmt, ...)

@ -101,7 +101,7 @@ static int mp_css_append_salt (hashcat_ctx_t *hashcat_ctx, salt_t *salt_buf)
{
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
u32 salt_len = (u32) salt_buf->salt_len;
u32 salt_len = salt_buf->salt_len;
u8 *salt_buf_ptr = (u8 *) salt_buf->salt_buf;
u32 css_cnt_salt = mask_ctx->css_cnt + salt_len;
@ -201,7 +201,7 @@ static int mp_css_to_uniq_tbl (hashcat_ctx_t *hashcat_ctx, u32 css_cnt, cs_t *cs
return 0;
}
static int mp_add_cs_buf (hashcat_ctx_t *hashcat_ctx, u32 *in_buf, size_t in_len, cs_t *css, u32 css_cnt)
static int mp_add_cs_buf (hashcat_ctx_t *hashcat_ctx, const u32 *in_buf, size_t in_len, cs_t *css, u32 css_cnt)
{
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
@ -569,7 +569,7 @@ static int mp_setup_usr (hashcat_ctx_t *hashcat_ctx, cs_t *mp_sys, cs_t *mp_usr,
}
else
{
char mp_file[1024] = { 0 };
char mp_file[1024];
const size_t nread = hc_fread (mp_file, 1, sizeof (mp_file) - 1, fp);
@ -581,10 +581,8 @@ static int mp_setup_usr (hashcat_ctx_t *hashcat_ctx, cs_t *mp_sys, cs_t *mp_usr,
return -1;
}
else
{
fclose (fp);
}
fclose (fp);
if (nread == 0)
{
@ -749,7 +747,7 @@ static int sp_setup_tbl (hashcat_ctx_t *hashcat_ctx)
u64 z = *ptr++;
memcpy (root_stats_buf, ptr, sizeof (u64) * SP_ROOT_CNT); ptr += SP_ROOT_CNT;
memcpy (markov_stats_buf, ptr, sizeof (u64) * SP_MARKOV_CNT); ptr += SP_MARKOV_CNT;
memcpy (markov_stats_buf, ptr, sizeof (u64) * SP_MARKOV_CNT); // ptr += SP_MARKOV_CNT;
hcfree (inbuf);
hcfree (outbuf);

@ -67,10 +67,8 @@ static int ocl_check_dri (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx)
return 0;
}
else
{
fclose (fd_drm);
}
fclose (fd_drm);
if (vendor != 4098) return 0;
@ -2011,7 +2009,7 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
if (hashes->salts_shown[salt_pos] == 1)
{
status_ctx->words_progress_done[salt_pos] += (u64) pws_cnt * (u64) innerloop_left;
status_ctx->words_progress_done[salt_pos] += (u64) pws_cnt * innerloop_left;
continue;
}
@ -2293,7 +2291,7 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
* speed
*/
const u64 perf_sum_all = (u64) pws_cnt * (u64) innerloop_left;
const u64 perf_sum_all = (u64) pws_cnt * innerloop_left;
const double speed_msec = hc_timer_get (device_param->timer_speed);
@ -5459,7 +5457,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
device_param->kernel_params_mp_buf32[7] = 0;
}
for (u32 i = 0; i < 3; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp, i, sizeof (cl_mem), (void *) device_param->kernel_params_mp[i]); if (CL_rc == -1) return -1; }
for (u32 i = 0; i < 3; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp, i, sizeof (cl_mem), device_param->kernel_params_mp[i]); if (CL_rc == -1) return -1; }
}
else if (user_options->attack_mode == ATTACK_MODE_BF)
{
@ -5476,8 +5474,8 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
if (hashconfig->opts_type & OPTS_TYPE_PT_ADDBITS14) device_param->kernel_params_mp_l_buf32[7] = 1;
if (hashconfig->opts_type & OPTS_TYPE_PT_ADDBITS15) device_param->kernel_params_mp_l_buf32[8] = 1;
for (u32 i = 0; i < 3; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp_l, i, sizeof (cl_mem), (void *) device_param->kernel_params_mp_l[i]); if (CL_rc == -1) return -1; }
for (u32 i = 0; i < 3; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp_r, i, sizeof (cl_mem), (void *) device_param->kernel_params_mp_r[i]); if (CL_rc == -1) return -1; }
for (u32 i = 0; i < 3; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp_l, i, sizeof (cl_mem), device_param->kernel_params_mp_l[i]); if (CL_rc == -1) return -1; }
for (u32 i = 0; i < 3; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp_r, i, sizeof (cl_mem), device_param->kernel_params_mp_r[i]); if (CL_rc == -1) return -1; }
}
hardware_power_all += device_param->hardware_power;
@ -5751,8 +5749,8 @@ int opencl_session_update_mp (hashcat_ctx_t *hashcat_ctx)
int CL_rc = CL_SUCCESS;
for (u32 i = 3; i < 4; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp, i, sizeof (cl_ulong), (void *) device_param->kernel_params_mp[i]); if (CL_rc == -1) return -1; }
for (u32 i = 4; i < 8; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp, i, sizeof (cl_uint), (void *) device_param->kernel_params_mp[i]); if (CL_rc == -1) return -1; }
for (u32 i = 3; i < 4; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp, i, sizeof (cl_ulong), device_param->kernel_params_mp[i]); if (CL_rc == -1) return -1; }
for (u32 i = 4; i < 8; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp, i, sizeof (cl_uint), device_param->kernel_params_mp[i]); if (CL_rc == -1) return -1; }
CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_root_css_buf, CL_TRUE, 0, device_param->size_root_css, mask_ctx->root_css_buf, 0, NULL, NULL); if (CL_rc == -1) return -1;
CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_markov_css_buf, CL_TRUE, 0, device_param->size_markov_css, mask_ctx->markov_css_buf, 0, NULL, NULL); if (CL_rc == -1) return -1;
@ -5783,13 +5781,13 @@ int opencl_session_update_mp_rl (hashcat_ctx_t *hashcat_ctx, const u32 css_cnt_l
int CL_rc = CL_SUCCESS;
for (u32 i = 3; i < 4; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp_l, i, sizeof (cl_ulong), (void *) device_param->kernel_params_mp_l[i]); if (CL_rc == -1) return -1; }
for (u32 i = 4; i < 8; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp_l, i, sizeof (cl_uint), (void *) device_param->kernel_params_mp_l[i]); if (CL_rc == -1) return -1; }
for (u32 i = 9; i < 9; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp_l, i, sizeof (cl_ulong), (void *) device_param->kernel_params_mp_l[i]); if (CL_rc == -1) return -1; }
for (u32 i = 3; i < 4; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp_l, i, sizeof (cl_ulong), device_param->kernel_params_mp_l[i]); if (CL_rc == -1) return -1; }
for (u32 i = 4; i < 8; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp_l, i, sizeof (cl_uint), device_param->kernel_params_mp_l[i]); if (CL_rc == -1) return -1; }
for (u32 i = 9; i < 9; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp_l, i, sizeof (cl_ulong), device_param->kernel_params_mp_l[i]); if (CL_rc == -1) return -1; }
for (u32 i = 3; i < 4; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp_r, i, sizeof (cl_ulong), (void *) device_param->kernel_params_mp_r[i]); if (CL_rc == -1) return -1; }
for (u32 i = 4; i < 7; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp_r, i, sizeof (cl_uint), (void *) device_param->kernel_params_mp_r[i]); if (CL_rc == -1) return -1; }
for (u32 i = 8; i < 8; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp_r, i, sizeof (cl_ulong), (void *) device_param->kernel_params_mp_r[i]); if (CL_rc == -1) return -1; }
for (u32 i = 3; i < 4; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp_r, i, sizeof (cl_ulong), device_param->kernel_params_mp_r[i]); if (CL_rc == -1) return -1; }
for (u32 i = 4; i < 7; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp_r, i, sizeof (cl_uint), device_param->kernel_params_mp_r[i]); if (CL_rc == -1) return -1; }
for (u32 i = 8; i < 8; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp_r, i, sizeof (cl_ulong), device_param->kernel_params_mp_r[i]); if (CL_rc == -1) return -1; }
CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_root_css_buf, CL_TRUE, 0, device_param->size_root_css, mask_ctx->root_css_buf, 0, NULL, NULL); if (CL_rc == -1) return -1;
CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_markov_css_buf, CL_TRUE, 0, device_param->size_markov_css, mask_ctx->markov_css_buf, 0, NULL, NULL); if (CL_rc == -1) return -1;

@ -52,7 +52,7 @@ int build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl
plain_buf[i] = pw.i[i];
}
plain_len = (int) apply_rules_optimized (straight_ctx->kernel_rules_buf[off].cmds, &plain_buf[0], &plain_buf[4], (u32) pw.pw_len);
plain_len = apply_rules_optimized (straight_ctx->kernel_rules_buf[off].cmds, &plain_buf[0], &plain_buf[4], pw.pw_len);
}
else
{
@ -61,7 +61,7 @@ int build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl
plain_buf[i] = pw.i[i];
}
plain_len = (int) apply_rules (straight_ctx->kernel_rules_buf[off].cmds, plain_buf, pw.pw_len);
plain_len = apply_rules (straight_ctx->kernel_rules_buf[off].cmds, plain_buf, pw.pw_len);
}
if (plain_len > (int) hashconfig->pw_max) plain_len = (int) hashconfig->pw_max;

@ -42,8 +42,8 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx)
hash_buf.digest = hcmalloc (dgst_size);
if (is_salted == true) hash_buf.salt = (salt_t *) hcmalloc (sizeof (salt_t));
if (esalt_size > 0) hash_buf.esalt = (void *) hcmalloc (esalt_size);
if (hook_salt_size > 0) hash_buf.hook_salt = (void *) hcmalloc (hook_salt_size);
if (esalt_size > 0) hash_buf.esalt = hcmalloc (esalt_size);
if (hook_salt_size > 0) hash_buf.hook_salt = hcmalloc (hook_salt_size);
u32 digest_buf[64] = { 0 };

@ -283,7 +283,7 @@ void potfile_write_append (hashcat_ctx_t *hashcat_ctx, const char *out_buf, u8 *
tmp_buf[tmp_len++] = 'X';
tmp_buf[tmp_len++] = '[';
exec_hexify ((const u8 *) plain_ptr, plain_len, (u8 *) tmp_buf + tmp_len);
exec_hexify ((const u8 *) plain_ptr, plain_len, tmp_buf + tmp_len);
tmp_len += plain_len * 2;
@ -602,7 +602,7 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
if (is_hexify ((const u8 *) essid_pos, (const int) essid_len) == true)
{
essid_len = exec_unhexify ((const u8 *) essid_pos, (int) essid_len, (u8 *) essid_pos, (int) essid_len);
essid_len = exec_unhexify ((const u8 *) essid_pos, essid_len, (u8 *) essid_pos, essid_len);
}
if (essid_len > 32) continue;

@ -111,28 +111,16 @@ bool class_alpha (const u8 c)
int conv_ctoi (const u8 c)
{
if (class_num (c))
{
return c - '0';
}
else if (class_upper (c))
{
return c - 'A' + 10;
}
if (class_num (c)) return c - '0';
if (class_upper (c)) return c - 'A' + 10;
return -1;
}
int conv_itoc (const u8 c)
{
if (c < 10)
{
return c + '0';
}
else if (c < 37)
{
return c + 'A' - 10;
}
if (c < 10) return c + '0';
if (c < 37) return c + 'A' - 10;
return -1;
}
@ -878,7 +866,7 @@ int kernel_rules_generate (hashcat_ctx_t *hashcat_ctx, kernel_rule_t **out_buf,
{
memset (rule_buf, 0, RP_RULE_SIZE);
int rule_len = (int) generate_random_rule (rule_buf, user_options->rp_gen_func_min, user_options->rp_gen_func_max);
int rule_len = generate_random_rule (rule_buf, user_options->rp_gen_func_min, user_options->rp_gen_func_max);
if (cpu_rule_to_kernel_rule (rule_buf, rule_len, &kernel_rules_buf[kernel_rules_cnt]) == -1) continue;
}

@ -17,10 +17,8 @@ static int conv_pos (const u8 c, const int pos_mem)
{
return pos_mem;
}
else
{
return conv_ctoi (c);
}
return conv_ctoi (c);
}
static void MANGLE_TOGGLE_AT (char *arr, const int pos)
@ -253,11 +251,11 @@ static int mangle_insert_multi (char arr[RP_PASSWORD_SIZE], int arr_len, int arr
if (arr2_cpy < 1) return (RULE_RC_SYNTAX_ERROR);
memcpy (arr2, arr2 + arr2_pos, arr2_len - arr2_pos);
memmove (arr2, arr2 + arr2_pos, arr2_len - arr2_pos);
memcpy (arr2 + arr2_cpy, arr + arr_pos, arr_len - arr_pos);
memcpy (arr2 + arr2_cpy, arr + arr_pos, arr_len - arr_pos);
memcpy (arr + arr_pos, arr2, arr_len - arr_pos + arr2_cpy);
memcpy (arr + arr_pos, arr2, arr_len - arr_pos + arr2_cpy);
return (arr_len + arr2_cpy);
}
@ -844,14 +842,10 @@ int _old_apply_rule (char *rule, int rule_len, char in[RP_PASSWORD_SIZE], int in
int run_rule_engine (const int rule_len, const char *rule_buf)
{
if (rule_len == 0)
{
return 0;
}
else if (rule_len == 1)
{
if (rule_len == 0) return 0;
if (rule_len == 1)
if (rule_buf[0] == RULE_OP_MANGLE_NOOP) return 0;
}
return 1;
}

@ -607,7 +607,8 @@ char *status_get_guess_mod (const hashcat_ctx_t *hashcat_ctx)
{
return status_get_rules_file (hashcat_ctx);
}
else if (user_options->attack_mode == ATTACK_MODE_COMBI)
if (user_options->attack_mode == ATTACK_MODE_COMBI)
{
const combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
@ -620,17 +621,20 @@ char *status_get_guess_mod (const hashcat_ctx_t *hashcat_ctx)
return strdup (combinator_ctx->dict1);
}
}
else if (user_options->attack_mode == ATTACK_MODE_BF)
if (user_options->attack_mode == ATTACK_MODE_BF)
{
}
else if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
{
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
return strdup (mask_ctx->mask);
}
else if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
{
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
{

@ -133,7 +133,7 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
plain_buf[i] = pw.i[i];
}
plain_len = (int) apply_rules (straight_ctx->kernel_rules_buf[off].cmds, plain_buf, pw.pw_len);
plain_len = apply_rules (straight_ctx->kernel_rules_buf[off].cmds, plain_buf, pw.pw_len);
}
if (plain_len > hashconfig->pw_max) plain_len = hashconfig->pw_max;

@ -76,6 +76,8 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
const int rc = count_words (hashcat_ctx, fd, straight_ctx->dict, &status_ctx->words_cnt);
fclose (fd);
if (rc == -1)
{
event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", straight_ctx->dict);
@ -83,8 +85,6 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
return -1;
}
fclose (fd);
if (status_ctx->words_cnt == 0)
{
logfile_sub_msg ("STOP");
@ -111,14 +111,14 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
const int rc = count_words (hashcat_ctx, fd, combinator_ctx->dict1, &status_ctx->words_cnt);
fclose (fd);
if (rc == -1)
{
event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", combinator_ctx->dict1);
return -1;
}
fclose (fd);
}
else if (combinator_ctx->combs_mode == COMBINATOR_MODE_BASE_RIGHT)
{
@ -133,14 +133,14 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
const int rc = count_words (hashcat_ctx, fd, combinator_ctx->dict2, &status_ctx->words_cnt);
fclose (fd);
if (rc == -1)
{
event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", combinator_ctx->dict2);
return -1;
}
fclose (fd);
}
if (status_ctx->words_cnt == 0)
@ -179,6 +179,8 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
const int rc = count_words (hashcat_ctx, fd, straight_ctx->dict, &status_ctx->words_cnt);
fclose (fd);
if (rc == -1)
{
event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", straight_ctx->dict);
@ -186,8 +188,6 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
return -1;
}
fclose (fd);
if (status_ctx->words_cnt == 0)
{
logfile_sub_msg ("STOP");

@ -239,13 +239,15 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
continue;
}
else if ((user_options_extra->attack_kern == ATTACK_KERN_COMBI) && (kernel_loops > KERNEL_COMBS))
if ((user_options_extra->attack_kern == ATTACK_KERN_COMBI) && (kernel_loops > KERNEL_COMBS))
{
event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_loops '%d' in Line '%d'", kernel_loops, line_num);
continue;
}
else if ((user_options_extra->attack_kern == ATTACK_KERN_BF) && (kernel_loops > KERNEL_BFS))
if ((user_options_extra->attack_kern == ATTACK_KERN_BF) && (kernel_loops > KERNEL_BFS))
{
event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_loops '%d' in Line '%d'", kernel_loops, line_num);

@ -742,7 +742,8 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
return -1;
}
else if (user_options->left == true)
if (user_options->left == true)
{
event_log_error (hashcat_ctx, "Combining --left with --keyspace is not allowed.");
@ -970,7 +971,8 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
return -1;
}
else if (user_options->attack_mode == ATTACK_MODE_COMBI)
if (user_options->attack_mode == ATTACK_MODE_COMBI)
{
event_log_error (hashcat_ctx, "Custom charsets re not supported in attack mode 1 (combination).");

@ -242,7 +242,7 @@ void pw_add (hc_device_param_t *device_param, const u8 *pw_buf, const int pw_len
{
if (device_param->pws_cnt < device_param->kernel_power)
{
pw_t *pw = (pw_t *) device_param->pws_buf + device_param->pws_cnt;
pw_t *pw = device_param->pws_buf + device_param->pws_cnt;
u8 *ptr = (u8 *) pw->i;
@ -538,7 +538,7 @@ int wl_data_init (hashcat_ctx_t *hashcat_ctx)
* iconv
*/
if (strcmp (user_options->encoding_from, user_options->encoding_to))
if (strcmp (user_options->encoding_from, user_options->encoding_to) != 0)
{
wl_data->iconv_enabled = true;

Loading…
Cancel
Save