1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-22 14:48:12 +00:00

switch cpu_crc32.c to event_log_*

This commit is contained in:
jsteube 2016-10-08 23:53:52 +02:00
parent ebc8eb7454
commit fa4de96ab0
7 changed files with 17 additions and 11 deletions

View File

@ -9,6 +9,6 @@
#include <stdio.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

View File

@ -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);

View File

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

View File

@ -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)

View File

@ -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;
}

View File

@ -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;

View File

@ -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)