switch cpu_crc32.c to event_log_*

pull/544/head
jsteube 8 years ago
parent ebc8eb7454
commit fa4de96ab0

@ -9,6 +9,6 @@
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
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 #endif // _CPU_CRC32_H

@ -1513,7 +1513,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx);
void hashconfig_destroy (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_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_param_t *device_param);
u32 hashconfig_enforce_kernel_loops (hashcat_ctx_t *hashcat_ctx); 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); void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, void *esalt);
char *hashconfig_benchmark_mask (hashcat_ctx_t *hashcat_ctx); char *hashconfig_benchmark_mask (hashcat_ctx_t *hashcat_ctx);

@ -4,4 +4,3 @@
*/ */
#include "common.h" #include "common.h"

@ -6,7 +6,6 @@
#include "common.h" #include "common.h"
#include "types.h" #include "types.h"
#include "memory.h" #include "memory.h"
#include "logging.h"
#include "cpt.h" #include "cpt.h"
int cpt_ctx_init (hashcat_ctx_t *hashcat_ctx) int cpt_ctx_init (hashcat_ctx_t *hashcat_ctx)

@ -6,7 +6,7 @@
#include "common.h" #include "common.h"
#include "types.h" #include "types.h"
#include "memory.h" #include "memory.h"
#include "logging.h" #include "event.h"
#include "cpu_crc32.h" #include "cpu_crc32.h"
static const u32 crc32tab[256] = static const u32 crc32tab[256] =
@ -77,7 +77,7 @@ static const u32 crc32tab[256] =
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d 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; u32 crc = ~0u;
@ -85,9 +85,9 @@ void cpu_crc32 (const char *filename, u8 keytab[64])
if (fd == NULL) 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) #define MAX_KEY_SIZE (1024 * 1024)
@ -113,4 +113,6 @@ void cpu_crc32 (const char *filename, u8 keytab[64])
} }
myfree (buf); myfree (buf);
return 0;
} }

@ -1283,7 +1283,9 @@ int hashes_init_stage3 (hashcat_ctx_t *hashcat_ctx)
hashes_t *hashes = hashcat_ctx->hashes; hashes_t *hashes = hashcat_ctx->hashes;
user_options_t *user_options = hashcat_ctx->user_options; 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) if (hashes->salts_cnt == 1)
hashconfig->opti_type |= OPTI_TYPE_SINGLE_SALT; hashconfig->opti_type |= OPTI_TYPE_SINGLE_SALT;

@ -20190,7 +20190,7 @@ u32 hashconfig_enforce_kernel_loops (hashcat_ctx_t *hashcat_ctx)
return kernel_loops_fixed; 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; hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes; hashes_t *hashes = hashcat_ctx->hashes;
@ -20257,12 +20257,16 @@ void hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx)
do 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); } while ((keyfile = strtok (NULL, ",")) != NULL);
free (keyfiles); free (keyfiles);
} }
return 0;
} }
void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, void *esalt) void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, void *esalt)

Loading…
Cancel
Save