Prepare remove of hash_type variable

This commit is contained in:
jsteube
2019-02-12 15:30:42 +01:00
parent 8b8cc78b69
commit 75f7172cca
32 changed files with 535 additions and 471 deletions
+17 -8
View File
@@ -9,6 +9,7 @@
#include "bitops.h"
#include "convert.h"
#include "shared.h"
#include "inc_hash_constants.h"
static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL;
static const u32 DGST_POS0 = 0;
@@ -18,7 +19,7 @@ static const u32 DGST_POS3 = 1;
static const u32 DGST_SIZE = DGST_SIZE_4_4;
static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL;
static const char *HASH_NAME = "Skype";
static const u32 HASH_TYPE = HASH_TYPE_MD5;
static const u32 HASH_TYPE = HASH_TYPE_GENERIC;
static const u64 KERN_TYPE = 20;
static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_PRECOMPUTE_INIT
@@ -80,9 +81,13 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
digest[2] = hex_to_u32 (hash_pos + 16);
digest[3] = hex_to_u32 (hash_pos + 24);
decoder_apply_options (hashconfig, digest);
decoder_apply_optimizer (hashconfig, digest);
if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE)
{
digest[0] -= MD5M_A;
digest[1] -= MD5M_B;
digest[2] -= MD5M_C;
digest[3] -= MD5M_D;
}
const u8 *salt_pos = token.buf[1];
const int salt_len = token.len[1];
@@ -90,7 +95,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig);
if (parse_rc == false) return (PARSER_SALT_LENGTH);
/*
* add static "salt" part
*/
@@ -115,9 +120,13 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
tmp[2] = digest[2];
tmp[3] = digest[3];
encoder_apply_optimizer (hashconfig, tmp);
encoder_apply_options (hashconfig, tmp);
if (hashconfig->opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE)
{
tmp[0] += MD5M_A;
tmp[1] += MD5M_B;
tmp[2] += MD5M_C;
tmp[3] += MD5M_D;
}
u8 tmp_buf[128];