diff --git a/include/cpu_crc32.h b/include/cpu_crc32.h index 50e4e23b8..a1d86f19e 100644 --- a/include/cpu_crc32.h +++ b/include/cpu_crc32.h @@ -9,6 +9,6 @@ #include #include -void cpu_crc32 (const char *filename, u8 keytab[64]); +int cpu_crc32 (hashcat_ctx_t *hashcat_ctx, const char *filename, u8 keytab[64]); #endif // _CPU_CRC32_H diff --git a/include/interface.h b/include/interface.h index 39d7d1e91..9e65d6a41 100644 --- a/include/interface.h +++ b/include/interface.h @@ -1513,7 +1513,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx); void hashconfig_destroy (hashcat_ctx_t *hashcat_ctx); u32 hashconfig_enforce_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_param_t *device_param); u32 hashconfig_enforce_kernel_loops (hashcat_ctx_t *hashcat_ctx); -void hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx); +int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx); void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, void *esalt); char *hashconfig_benchmark_mask (hashcat_ctx_t *hashcat_ctx); diff --git a/src/common.c b/src/common.c index 324a1237d..211427cd4 100644 --- a/src/common.c +++ b/src/common.c @@ -4,4 +4,3 @@ */ #include "common.h" - diff --git a/src/cpt.c b/src/cpt.c index 58938b528..7f2f2a263 100644 --- a/src/cpt.c +++ b/src/cpt.c @@ -6,7 +6,6 @@ #include "common.h" #include "types.h" #include "memory.h" -#include "logging.h" #include "cpt.h" int cpt_ctx_init (hashcat_ctx_t *hashcat_ctx) diff --git a/src/cpu_crc32.c b/src/cpu_crc32.c index 282a3ef28..6ff88ac5e 100644 --- a/src/cpu_crc32.c +++ b/src/cpu_crc32.c @@ -6,7 +6,7 @@ #include "common.h" #include "types.h" #include "memory.h" -#include "logging.h" +#include "event.h" #include "cpu_crc32.h" static const u32 crc32tab[256] = @@ -77,7 +77,7 @@ static const u32 crc32tab[256] = 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d }; -void cpu_crc32 (const char *filename, u8 keytab[64]) +int cpu_crc32 (hashcat_ctx_t *hashcat_ctx, const char *filename, u8 keytab[64]) { u32 crc = ~0u; @@ -85,9 +85,9 @@ void cpu_crc32 (const char *filename, u8 keytab[64]) if (fd == NULL) { - log_error ("%s: %s", filename, strerror (errno)); + event_log_error (hashcat_ctx, "%s: %s", filename, strerror (errno)); - exit (-1); + return (-1); } #define MAX_KEY_SIZE (1024 * 1024) @@ -113,4 +113,6 @@ void cpu_crc32 (const char *filename, u8 keytab[64]) } myfree (buf); + + return 0; } diff --git a/src/hashes.c b/src/hashes.c index 8a8531353..02f292886 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -1283,7 +1283,9 @@ int hashes_init_stage3 (hashcat_ctx_t *hashcat_ctx) hashes_t *hashes = hashcat_ctx->hashes; user_options_t *user_options = hashcat_ctx->user_options; - hashconfig_general_defaults (hashcat_ctx); + const int rc_defaults = hashconfig_general_defaults (hashcat_ctx); + + if (rc_defaults == -1) return -1; if (hashes->salts_cnt == 1) hashconfig->opti_type |= OPTI_TYPE_SINGLE_SALT; diff --git a/src/interface.c b/src/interface.c index f74199071..df482ec9a 100644 --- a/src/interface.c +++ b/src/interface.c @@ -20190,7 +20190,7 @@ u32 hashconfig_enforce_kernel_loops (hashcat_ctx_t *hashcat_ctx) return kernel_loops_fixed; } -void hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx) +int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx) { hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashes_t *hashes = hashcat_ctx->hashes; @@ -20257,12 +20257,16 @@ void hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx) do { - cpu_crc32 (keyfile, (u8 *) keyfile_buf); + const int rc_crc32 = cpu_crc32 (hashcat_ctx, keyfile, (u8 *) keyfile_buf); + + if (rc_crc32 == -1) return -1; } while ((keyfile = strtok (NULL, ",")) != NULL); free (keyfiles); } + + return 0; } void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, void *esalt)