1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-06-25 01:18:57 +00:00

Show advice to use optimized kernels only if there's actually one for this hash-mode

This commit is contained in:
jsteube 2017-09-16 22:33:04 +02:00
parent 34c5eac550
commit 5551337cf6
6 changed files with 103 additions and 90 deletions

View File

@ -839,7 +839,10 @@ struct hashconfig
u32 dgst_pos2; u32 dgst_pos2;
u32 dgst_pos3; u32 dgst_pos3;
u32 is_salted; bool is_salted;
bool has_pure_kernel;
bool has_optimized_kernel;
// sizes have to be size_t // sizes have to be size_t

View File

@ -85,7 +85,7 @@ int sort_by_hash (const void *v1, const void *v2, void *v3)
hashconfig_t *hashconfig = (hashconfig_t *) v3; hashconfig_t *hashconfig = (hashconfig_t *) v3;
if (hashconfig->is_salted) if (hashconfig->is_salted == true)
{ {
const salt_t *s1 = h1->salt; const salt_t *s1 = h1->salt;
const salt_t *s2 = h2->salt; const salt_t *s2 = h2->salt;
@ -609,16 +609,16 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
} }
} }
if (hashconfig->is_salted) if (hashconfig->is_salted == true)
{ {
salts_buf = (salt_t *) hccalloc (hashes_avail, sizeof (salt_t)); salts_buf = (salt_t *) hccalloc (hashes_avail, sizeof (salt_t));
if (hashconfig->esalt_size) if (hashconfig->esalt_size > 0)
{ {
esalts_buf = (void *) hccalloc (hashes_avail, hashconfig->esalt_size); esalts_buf = (void *) hccalloc (hashes_avail, hashconfig->esalt_size);
} }
if (hashconfig->hook_salt_size) if (hashconfig->hook_salt_size > 0)
{ {
hook_salts_buf = (seven_zip_hook_salt_t *) hccalloc (hashes_avail, hashconfig->hook_salt_size); hook_salts_buf = (seven_zip_hook_salt_t *) hccalloc (hashes_avail, hashconfig->hook_salt_size);
} }
@ -632,16 +632,16 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
{ {
hashes_buf[hash_pos].digest = ((char *) digests_buf) + (hash_pos * hashconfig->dgst_size); hashes_buf[hash_pos].digest = ((char *) digests_buf) + (hash_pos * hashconfig->dgst_size);
if (hashconfig->is_salted) if (hashconfig->is_salted == true)
{ {
hashes_buf[hash_pos].salt = &salts_buf[hash_pos]; hashes_buf[hash_pos].salt = &salts_buf[hash_pos];
if (hashconfig->esalt_size) if (hashconfig->esalt_size > 0)
{ {
hashes_buf[hash_pos].esalt = ((char *) esalts_buf) + (hash_pos * hashconfig->esalt_size); hashes_buf[hash_pos].esalt = ((char *) esalts_buf) + (hash_pos * hashconfig->esalt_size);
} }
if (hashconfig->hook_salt_size) if (hashconfig->hook_salt_size > 0)
{ {
hashes_buf[hash_pos].hook_salt = ((char *) hook_salts_buf) + (hash_pos * hashconfig->hook_salt_size); hashes_buf[hash_pos].hook_salt = ((char *) hook_salts_buf) + (hash_pos * hashconfig->hook_salt_size);
} }
@ -719,17 +719,17 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
hash_info_tmp->orighash = hcstrdup (hash_buf); hash_info_tmp->orighash = hcstrdup (hash_buf);
} }
if (hashconfig->is_salted) if (hashconfig->is_salted == true)
{ {
memset (hashes_buf[0].salt, 0, sizeof (salt_t)); memset (hashes_buf[0].salt, 0, sizeof (salt_t));
} }
if (hashconfig->esalt_size) if (hashconfig->esalt_size > 0)
{ {
memset (hashes_buf[0].esalt, 0, hashconfig->esalt_size); memset (hashes_buf[0].esalt, 0, hashconfig->esalt_size);
} }
if (hashconfig->hook_salt_size) if (hashconfig->hook_salt_size > 0)
{ {
memset (hashes_buf[0].hook_salt, 0, hashconfig->hook_salt_size); memset (hashes_buf[0].hook_salt, 0, hashconfig->hook_salt_size);
} }
@ -766,12 +766,12 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
break; break;
} }
if (hashconfig->is_salted) if (hashconfig->is_salted == true)
{ {
memset (hashes_buf[hashes_cnt].salt, 0, sizeof (salt_t)); memset (hashes_buf[hashes_cnt].salt, 0, sizeof (salt_t));
} }
if (hashconfig->esalt_size) if (hashconfig->esalt_size > 0)
{ {
memset (hashes_buf[hashes_cnt].esalt, 0, hashconfig->esalt_size); memset (hashes_buf[hashes_cnt].esalt, 0, hashconfig->esalt_size);
@ -789,7 +789,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
} }
} }
if (hashconfig->hook_salt_size) if (hashconfig->hook_salt_size > 0)
{ {
memset (hashes_buf[hashes_cnt].hook_salt, 0, hashconfig->hook_salt_size); memset (hashes_buf[hashes_cnt].hook_salt, 0, hashconfig->hook_salt_size);
} }
@ -997,17 +997,17 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
hash_info_tmp->orighash = hcstrdup (hash_buf); hash_info_tmp->orighash = hcstrdup (hash_buf);
} }
if (hashconfig->is_salted) if (hashconfig->is_salted == true)
{ {
memset (hashes_buf[hashes_cnt].salt, 0, sizeof (salt_t)); memset (hashes_buf[hashes_cnt].salt, 0, sizeof (salt_t));
} }
if (hashconfig->esalt_size) if (hashconfig->esalt_size > 0)
{ {
memset (hashes_buf[hashes_cnt].esalt, 0, hashconfig->esalt_size); memset (hashes_buf[hashes_cnt].esalt, 0, hashconfig->esalt_size);
} }
if (hashconfig->hook_salt_size) if (hashconfig->hook_salt_size > 0)
{ {
memset (hashes_buf[hashes_cnt].hook_salt, 0, hashconfig->hook_salt_size); memset (hashes_buf[hashes_cnt].hook_salt, 0, hashconfig->hook_salt_size);
} }
@ -1108,7 +1108,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
{ {
EVENT (EVENT_HASHLIST_SORT_HASH_PRE); EVENT (EVENT_HASHLIST_SORT_HASH_PRE);
if (hashconfig->is_salted) if (hashconfig->is_salted == true)
{ {
hc_qsort_r (hashes_buf, hashes_cnt, sizeof (hash_t), sort_by_hash, (void *) hashconfig); hc_qsort_r (hashes_buf, hashes_cnt, sizeof (hash_t), sort_by_hash, (void *) hashconfig);
} }
@ -1174,7 +1174,7 @@ int hashes_init_stage2 (hashcat_ctx_t *hashcat_ctx)
{ {
// do not sort, because we need to keep all hashes in this particular case // do not sort, because we need to keep all hashes in this particular case
} }
else if (hashconfig->is_salted) else if (hashconfig->is_salted == true)
{ {
if (sort_by_salt (hashes_buf[hashes_pos].salt, hashes_buf[hashes_pos - 1].salt) == 0) if (sort_by_salt (hashes_buf[hashes_pos].salt, hashes_buf[hashes_pos - 1].salt) == 0)
{ {
@ -1215,7 +1215,7 @@ int hashes_init_stage2 (hashcat_ctx_t *hashcat_ctx)
void *esalts_buf_new = NULL; void *esalts_buf_new = NULL;
void *hook_salts_buf_new = NULL; void *hook_salts_buf_new = NULL;
if (hashconfig->is_salted) if (hashconfig->is_salted == true)
{ {
salts_buf_new = (salt_t *) hccalloc (hashes_cnt, sizeof (salt_t)); salts_buf_new = (salt_t *) hccalloc (hashes_cnt, sizeof (salt_t));
} }
@ -1224,12 +1224,12 @@ int hashes_init_stage2 (hashcat_ctx_t *hashcat_ctx)
salts_buf_new = (salt_t *) hccalloc (1, sizeof (salt_t)); salts_buf_new = (salt_t *) hccalloc (1, sizeof (salt_t));
} }
if (hashconfig->esalt_size) if (hashconfig->esalt_size > 0)
{ {
esalts_buf_new = (void *) hccalloc (hashes_cnt, hashconfig->esalt_size); esalts_buf_new = (void *) hccalloc (hashes_cnt, hashconfig->esalt_size);
} }
if (hashconfig->hook_salt_size) if (hashconfig->hook_salt_size > 0)
{ {
hook_salts_buf_new = (void *) hccalloc (hashes_cnt, hashconfig->hook_salt_size); hook_salts_buf_new = (void *) hccalloc (hashes_cnt, hashconfig->hook_salt_size);
} }
@ -1265,7 +1265,7 @@ int hashes_init_stage2 (hashcat_ctx_t *hashcat_ctx)
hashes_buf[0].salt = salt_buf; hashes_buf[0].salt = salt_buf;
if (hashconfig->hook_salt_size) if (hashconfig->hook_salt_size > 0)
{ {
char *hook_salts_buf_new_ptr = ((char *) hook_salts_buf_new) + (salts_cnt * hashconfig->hook_salt_size); char *hook_salts_buf_new_ptr = ((char *) hook_salts_buf_new) + (salts_cnt * hashconfig->hook_salt_size);
@ -1289,7 +1289,7 @@ int hashes_init_stage2 (hashcat_ctx_t *hashcat_ctx)
hashes_buf[0].digest = digests_buf_new_ptr; hashes_buf[0].digest = digests_buf_new_ptr;
if (hashconfig->esalt_size) if (hashconfig->esalt_size > 0)
{ {
char *esalts_buf_new_ptr = ((char *) esalts_buf_new) + (0 * hashconfig->esalt_size); char *esalts_buf_new_ptr = ((char *) esalts_buf_new) + (0 * hashconfig->esalt_size);
@ -1307,7 +1307,7 @@ int hashes_init_stage2 (hashcat_ctx_t *hashcat_ctx)
for (u32 hashes_pos = 1; hashes_pos < hashes_cnt; hashes_pos++) for (u32 hashes_pos = 1; hashes_pos < hashes_cnt; hashes_pos++)
{ {
if (hashconfig->is_salted) if (hashconfig->is_salted == true)
{ {
if (sort_by_salt (hashes_buf[hashes_pos].salt, hashes_buf[hashes_pos - 1].salt) != 0) if (sort_by_salt (hashes_buf[hashes_pos].salt, hashes_buf[hashes_pos - 1].salt) != 0)
{ {
@ -1317,7 +1317,7 @@ int hashes_init_stage2 (hashcat_ctx_t *hashcat_ctx)
hashes_buf[hashes_pos].salt = salt_buf; hashes_buf[hashes_pos].salt = salt_buf;
if (hashconfig->hook_salt_size) if (hashconfig->hook_salt_size > 0)
{ {
char *hook_salts_buf_new_ptr = ((char *) hook_salts_buf_new) + (salts_cnt * hashconfig->hook_salt_size); char *hook_salts_buf_new_ptr = ((char *) hook_salts_buf_new) + (salts_cnt * hashconfig->hook_salt_size);
@ -1335,7 +1335,7 @@ int hashes_init_stage2 (hashcat_ctx_t *hashcat_ctx)
hashes_buf[hashes_pos].salt = salt_buf; hashes_buf[hashes_pos].salt = salt_buf;
if (hashconfig->hook_salt_size) if (hashconfig->hook_salt_size > 0)
{ {
char *hook_salts_buf_new_ptr = ((char *) hook_salts_buf_new) + (salts_cnt * hashconfig->hook_salt_size); char *hook_salts_buf_new_ptr = ((char *) hook_salts_buf_new) + (salts_cnt * hashconfig->hook_salt_size);
@ -1351,7 +1351,7 @@ int hashes_init_stage2 (hashcat_ctx_t *hashcat_ctx)
hashes_buf[hashes_pos].digest = digests_buf_new_ptr; hashes_buf[hashes_pos].digest = digests_buf_new_ptr;
if (hashconfig->esalt_size) if (hashconfig->esalt_size > 0)
{ {
char *esalts_buf_new_ptr = ((char *) esalts_buf_new) + (hashes_pos * hashconfig->esalt_size); char *esalts_buf_new_ptr = ((char *) esalts_buf_new) + (hashes_pos * hashconfig->esalt_size);
@ -1536,12 +1536,12 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx)
st_salts_buf = (salt_t *) hccalloc (1, sizeof (salt_t)); st_salts_buf = (salt_t *) hccalloc (1, sizeof (salt_t));
if (hashconfig->esalt_size) if (hashconfig->esalt_size > 0)
{ {
st_esalts_buf = (void *) hccalloc (1, hashconfig->esalt_size); st_esalts_buf = (void *) hccalloc (1, hashconfig->esalt_size);
} }
if (hashconfig->hook_salt_size) if (hashconfig->hook_salt_size > 0)
{ {
st_hook_salts_buf = (void *) hccalloc (1, hashconfig->hook_salt_size); st_hook_salts_buf = (void *) hccalloc (1, hashconfig->hook_salt_size);
} }

View File

@ -19711,7 +19711,9 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->tmp_size = 0; hashconfig->tmp_size = 0;
hashconfig->hook_size = 0; hashconfig->hook_size = 0;
hashconfig->opti_type = 0; hashconfig->opti_type = 0;
hashconfig->is_salted = 0; hashconfig->is_salted = false;
hashconfig->has_pure_kernel = false;
hashconfig->has_optimized_kernel = false;
hashconfig->dgst_pos0 = 0; hashconfig->dgst_pos0 = 0;
hashconfig->dgst_pos1 = 0; hashconfig->dgst_pos1 = 0;
hashconfig->dgst_pos2 = 0; hashconfig->dgst_pos2 = 0;
@ -24382,17 +24384,23 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
// some kernels do not have an optimized kernel, simply because they do not need them // some kernels do not have an optimized kernel, simply because they do not need them
// or because they are not yet converted, for them we should switch off optimized mode // or because they are not yet converted, for them we should switch off optimized mode
char source_file[256] = { 0 };
generate_source_kernel_filename (hashconfig->attack_exec, user_options_extra->attack_kern, hashconfig->kern_type, false, folder_config->shared_dir, source_file);
hashconfig->has_pure_kernel = hc_path_read (source_file);
generate_source_kernel_filename (hashconfig->attack_exec, user_options_extra->attack_kern, hashconfig->kern_type, true, folder_config->shared_dir, source_file);
hashconfig->has_optimized_kernel = hc_path_read (source_file);
if (user_options->example_hashes == false) if (user_options->example_hashes == false)
{ {
if (user_options->optimized_kernel_enable == true) if (user_options->optimized_kernel_enable == true)
{ {
char source_file[256] = { 0 }; if (hashconfig->has_optimized_kernel == false)
generate_source_kernel_filename (hashconfig->attack_exec, user_options_extra->attack_kern, hashconfig->kern_type, true, folder_config->shared_dir, source_file);
if (hc_path_read (source_file) == false)
{ {
if (user_options->quiet == false) event_log_warning (hashcat_ctx, "%s: Optimized OpenCL kernel not support, falling back to pure kernel", source_file); if (user_options->quiet == false) event_log_warning (hashcat_ctx, "%s: Optimized OpenCL kernel not found, falling back to pure OpenCL kernel", source_file);
} }
else else
{ {
@ -24401,13 +24409,9 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
} }
else else
{ {
char source_file[256] = { 0 }; if (hashconfig->has_pure_kernel == false)
generate_source_kernel_filename (hashconfig->attack_exec, user_options_extra->attack_kern, hashconfig->kern_type, false, folder_config->shared_dir, source_file);
if (hc_path_read (source_file) == false)
{ {
if (user_options->quiet == false) event_log_warning (hashcat_ctx, "%s: Pure kernel not found, falling back to optimized kernel", source_file); if (user_options->quiet == false) event_log_warning (hashcat_ctx, "%s: Pure OpenCL kernel not found, falling back to optimized OpenCL kernel", source_file);
hashconfig->opti_type |= OPTI_TYPE_OPTIMIZED_KERNEL; hashconfig->opti_type |= OPTI_TYPE_OPTIMIZED_KERNEL;
} }
@ -24442,7 +24446,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->opti_type &= ~OPTI_TYPE_APPENDED_SALT; hashconfig->opti_type &= ~OPTI_TYPE_APPENDED_SALT;
} }
const u32 is_salted = ((hashconfig->salt_type == SALT_TYPE_GENERIC) const bool is_salted = ((hashconfig->salt_type == SALT_TYPE_GENERIC)
| (hashconfig->salt_type == SALT_TYPE_EMBEDDED) | (hashconfig->salt_type == SALT_TYPE_EMBEDDED)
| (hashconfig->salt_type == SALT_TYPE_VIRTUAL)); | (hashconfig->salt_type == SALT_TYPE_VIRTUAL));
@ -25155,7 +25159,7 @@ void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, vo
{ {
hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
if (hashconfig->is_salted) if (hashconfig->is_salted == true)
{ {
salt->salt_len = 8; salt->salt_len = 8;

View File

@ -476,7 +476,7 @@ static void main_outerloop_mainscreen (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx,
event_log_info (hashcat_ctx, "Password length minimum: %u", hashconfig->pw_min); event_log_info (hashcat_ctx, "Password length minimum: %u", hashconfig->pw_min);
event_log_info (hashcat_ctx, "Password length maximum: %u", hashconfig->pw_max); event_log_info (hashcat_ctx, "Password length maximum: %u", hashconfig->pw_max);
if (hashconfig->is_salted) if (hashconfig->is_salted == true)
{ {
if (hashconfig->opti_type & OPTI_TYPE_RAW_HASH) if (hashconfig->opti_type & OPTI_TYPE_RAW_HASH)
{ {
@ -488,12 +488,15 @@ static void main_outerloop_mainscreen (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx,
event_log_info (hashcat_ctx, NULL); event_log_info (hashcat_ctx, NULL);
if ((hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) == 0) if ((hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) == 0)
{
if (hashconfig->has_optimized_kernel == true)
{ {
event_log_advice (hashcat_ctx, "ATTENTION! Pure (unoptimized) OpenCL kernels selected."); event_log_advice (hashcat_ctx, "ATTENTION! Pure (unoptimized) OpenCL kernels selected.");
event_log_advice (hashcat_ctx, "This enables cracking passwords and salts > length 32 but for the price of drastical reduced performance."); event_log_advice (hashcat_ctx, "This enables cracking passwords and salts > length 32 but for the price of drastical reduced performance.");
event_log_advice (hashcat_ctx, "If you want to switch to optimized OpenCL kernels, append -O to your commandline."); event_log_advice (hashcat_ctx, "If you want to switch to optimized OpenCL kernels, append -O to your commandline.");
event_log_advice (hashcat_ctx, NULL); event_log_advice (hashcat_ctx, NULL);
} }
}
/** /**
* Watchdog and Temperature balance * Watchdog and Temperature balance
@ -691,11 +694,14 @@ static void main_monitor_performance_hint (MAYBE_UNUSED hashcat_ctx_t *hashcat_c
event_log_advice (hashcat_ctx, NULL); event_log_advice (hashcat_ctx, NULL);
if ((hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) == 0) if ((hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) == 0)
{
if (hashconfig->has_optimized_kernel == true)
{ {
event_log_advice (hashcat_ctx, "* Append -O to the commandline."); event_log_advice (hashcat_ctx, "* Append -O to the commandline.");
event_log_advice (hashcat_ctx, " This lowers the maximum supported password- and salt-length (typically down to 32)."); event_log_advice (hashcat_ctx, " This lowers the maximum supported password- and salt-length (typically down to 32).");
event_log_advice (hashcat_ctx, NULL); event_log_advice (hashcat_ctx, NULL);
} }
}
if (user_options->workload_profile < 3) if (user_options->workload_profile < 3)
{ {

View File

@ -27,7 +27,7 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx)
user_options_t *user_options = hashcat_ctx->user_options; user_options_t *user_options = hashcat_ctx->user_options;
u32 dgst_size = hashconfig->dgst_size; u32 dgst_size = hashconfig->dgst_size;
u32 is_salted = hashconfig->is_salted; bool is_salted = hashconfig->is_salted;
u32 esalt_size = hashconfig->esalt_size; u32 esalt_size = hashconfig->esalt_size;
u32 hook_salt_size = hashconfig->hook_salt_size; u32 hook_salt_size = hashconfig->hook_salt_size;
u32 hash_mode = hashconfig->hash_mode; u32 hash_mode = hashconfig->hash_mode;
@ -41,9 +41,9 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx)
hash_buf.digest = hcmalloc (dgst_size); hash_buf.digest = hcmalloc (dgst_size);
if (is_salted) hash_buf.salt = (salt_t *) hcmalloc (sizeof (salt_t)); if (is_salted == true) hash_buf.salt = (salt_t *) hcmalloc (sizeof (salt_t));
if (esalt_size) hash_buf.esalt = (void *) hcmalloc (esalt_size); if (esalt_size > 0) hash_buf.esalt = (void *) hcmalloc (esalt_size);
if (hook_salt_size) hash_buf.hook_salt = (void *) hcmalloc (hook_salt_size); if (hook_salt_size > 0) hash_buf.hook_salt = (void *) hcmalloc (hook_salt_size);
u32 digest_buf[64] = { 0 }; u32 digest_buf[64] = { 0 };

View File

@ -353,17 +353,17 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
hash_buf.hash_info = NULL; hash_buf.hash_info = NULL;
hash_buf.cracked = 0; hash_buf.cracked = 0;
if (hashconfig->is_salted) if (hashconfig->is_salted == true)
{ {
hash_buf.salt = (salt_t *) hcmalloc (sizeof (salt_t)); hash_buf.salt = (salt_t *) hcmalloc (sizeof (salt_t));
} }
if (hashconfig->esalt_size) if (hashconfig->esalt_size > 0)
{ {
hash_buf.esalt = hcmalloc (hashconfig->esalt_size); hash_buf.esalt = hcmalloc (hashconfig->esalt_size);
} }
if (hashconfig->hook_salt_size) if (hashconfig->hook_salt_size > 0)
{ {
hash_buf.hook_salt = hcmalloc (hashconfig->hook_salt_size); hash_buf.hook_salt = hcmalloc (hashconfig->hook_salt_size);
} }
@ -421,17 +421,17 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
// we should allow length 0 passwords (detected by weak hash check) // we should allow length 0 passwords (detected by weak hash check)
//if (line_pw_len == 0) continue; //if (line_pw_len == 0) continue;
if (hashconfig->is_salted) if (hashconfig->is_salted == true)
{ {
memset (hash_buf.salt, 0, sizeof (salt_t)); memset (hash_buf.salt, 0, sizeof (salt_t));
} }
if (hashconfig->esalt_size) if (hashconfig->esalt_size > 0)
{ {
memset (hash_buf.esalt, 0, hashconfig->esalt_size); memset (hash_buf.esalt, 0, hashconfig->esalt_size);
} }
if (hashconfig->hook_salt_size) if (hashconfig->hook_salt_size > 0)
{ {
memset (hash_buf.hook_salt, 0, hashconfig->hook_salt_size); memset (hash_buf.hook_salt, 0, hashconfig->hook_salt_size);
} }
@ -477,7 +477,7 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
if (essid_len > 32) continue; if (essid_len > 32) continue;
if (hashconfig->is_salted) if (hashconfig->is_salted == true)
{ {
// this should be always true, but we need it to make scan-build happy // this should be always true, but we need it to make scan-build happy
@ -514,7 +514,7 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
if (parser_status == PARSER_OK) if (parser_status == PARSER_OK)
{ {
if (hashconfig->is_salted) if (hashconfig->is_salted == true)
{ {
if (potfile_ctx->keep_all_hashes == true) if (potfile_ctx->keep_all_hashes == true)
{ {
@ -546,17 +546,17 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
potfile_read_close (hashcat_ctx); potfile_read_close (hashcat_ctx);
if (hashconfig->esalt_size) if (hashconfig->esalt_size > 0)
{ {
hcfree (hash_buf.esalt); hcfree (hash_buf.esalt);
} }
if (hashconfig->hook_salt_size) if (hashconfig->hook_salt_size > 0)
{ {
hcfree (hash_buf.hook_salt); hcfree (hash_buf.hook_salt);
} }
if (hashconfig->is_salted) if (hashconfig->is_salted == true)
{ {
hcfree (hash_buf.salt); hcfree (hash_buf.salt);
} }