Merge pull request #3839 from neheb/cas

fix some const-qual warnings
pull/3857/head
Jens Steube 8 months ago committed by GitHub
commit ede390c36a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -69,8 +69,8 @@ DECLSPEC bool b58dec (PRIVATE_AS u8 *bin, PRIVATE_AS u32 *binszp, PRIVATE_AS con
{
u32 binsz = *binszp;
PRIVATE_AS const u8 *b58u = (PRIVATE_AS u8*) b58;
PRIVATE_AS u8 *binu = (PRIVATE_AS u8*) bin;
PRIVATE_AS const u8 *b58u = b58;
PRIVATE_AS u8 *binu = bin;
u32 outisz = (binsz + sizeof (u32) - 1) / sizeof (u32);
@ -144,7 +144,7 @@ DECLSPEC bool b58dec (PRIVATE_AS u8 *bin, PRIVATE_AS u32 *binszp, PRIVATE_AS con
// Count canonical base58 byte count
binu = (PRIVATE_AS u8*) bin;
binu = bin;
for (u32 i = 0; i < binsz; i++)
{
@ -255,7 +255,7 @@ DECLSPEC bool b58check (PRIVATE_AS const u8 *bin, PRIVATE_AS const u32 binsz)
u32 data[64] = { 0 }; // 64 * 4 = 256 bytes (should be enough)
PRIVATE_AS u8 *datac = (PRIVATE_AS u8*) data;
PRIVATE_AS u8 *binc = (PRIVATE_AS u8*) bin;
PRIVATE_AS const u8 *binc = bin;
if (binsz < 4) return false;
if (binsz > 256) return false;
@ -288,7 +288,7 @@ DECLSPEC bool b58check (PRIVATE_AS const u8 *bin, PRIVATE_AS const u32 binsz)
ctx.h[0] = hc_swap32_S (ctx.h[0]);
PRIVATE_AS u8 *ph4 = (PRIVATE_AS u8*) ctx.h;
PRIVATE_AS u8 *sum = (PRIVATE_AS u8*) (binc + (binsz - 4)); // offset: binsz - 4, last 4 bytes
PRIVATE_AS const u8 *sum = (binc + (binsz - 4)); // offset: binsz - 4, last 4 bytes
if (ph4[0] != sum[0]) return false;
if (ph4[1] != sum[1]) return false;
@ -547,7 +547,7 @@ DECLSPEC bool b58check_38 (PRIVATE_AS const u32 *bin)
DECLSPEC bool b58enc (PRIVATE_AS u8 *b58, PRIVATE_AS u32 *b58sz, PRIVATE_AS const u8 *data, PRIVATE_AS const u32 binsz)
{
PRIVATE_AS const u8 *bin = (PRIVATE_AS u8 *) data;
PRIVATE_AS const u8 *bin = data;
int carry;
u32 j = 0;
@ -609,7 +609,7 @@ DECLSPEC bool b58check_enc (PRIVATE_AS u8 *b58c, PRIVATE_AS u32 *b58c_sz, PRIVAT
u8 buf[128] = { 0 };
PRIVATE_AS u32 *buf32 = (PRIVATE_AS u32*) buf;
PRIVATE_AS u8 *data8 = (PRIVATE_AS u8 *) data;
PRIVATE_AS const u8 *data8 = data;
PRIVATE_AS u8 *hash = &buf[1 + datasz];
@ -641,7 +641,7 @@ DECLSPEC bool b58check_enc (PRIVATE_AS u8 *b58c, PRIVATE_AS u32 *b58c_sz, PRIVAT
for (u32 i = 0; i < 4; i++)
{
((PRIVATE_AS u8 *) hash)[i] = ((PRIVATE_AS u8 *) ctx.h)[i];
(hash)[i] = ((PRIVATE_AS u8 *) ctx.h)[i];
}
return b58enc (b58c, b58c_sz, buf, 1 + datasz + 4);

@ -2031,8 +2031,8 @@ int run_opencl_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *devi
cl_kernel kernel = device_param->opencl_kernel_bzero;
if (hc_clSetKernelArg (hashcat_ctx, kernel, 0, sizeof (cl_mem), (void *) &buf) == -1) return -1;
if (hc_clSetKernelArg (hashcat_ctx, kernel, 1, sizeof (cl_ulong), (void *) &num16d) == -1) return -1;
if (hc_clSetKernelArg (hashcat_ctx, kernel, 0, sizeof (cl_mem), &buf) == -1) return -1;
if (hc_clSetKernelArg (hashcat_ctx, kernel, 1, sizeof (cl_ulong), &num16d) == -1) return -1;
const size_t global_work_size[3] = { num_elements, 1, 1 };
const size_t local_work_size[3] = { kernel_threads, 1, 1 };
@ -15083,7 +15083,7 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
// size_pws_idx
size_pws_idx = (u64) (kernel_power_max + 1) * sizeof (pw_idx_t);
size_pws_idx = (kernel_power_max + 1) * sizeof (pw_idx_t);
// size_tmps

@ -55,7 +55,7 @@ static void debugfile_format_plain (hashcat_ctx_t *hashcat_ctx, const u8 *plain_
}
else
{
hc_fwrite ((void *)plain_ptr, plain_len, 1, &debugfile_ctx->fp);
hc_fwrite (plain_ptr, plain_len, 1, &debugfile_ctx->fp);
}
}
@ -76,7 +76,7 @@ void debugfile_write_append (hashcat_ctx_t *hashcat_ctx, const u8 *rule_buf, con
if ((debug_mode == 3) || (debug_mode == 4) || (debug_mode == 5)) hc_fputc (':', &debugfile_ctx->fp);
}
hc_fwrite ((void *) rule_buf, rule_len, 1, &debugfile_ctx->fp);
hc_fwrite (rule_buf, rule_len, 1, &debugfile_ctx->fp);
if ((debug_mode == 4) || (debug_mode == 5))
{

@ -247,12 +247,12 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
char rule_buf_out[RP_PASSWORD_SIZE];
int rule_jk_len = (int) user_options_extra->rule_len_l;
char *rule_jk_buf = (char *) user_options->rule_buf_l;
const char *rule_jk_buf = user_options->rule_buf_l;
if (attack_mode == ATTACK_MODE_HYBRID2)
{
rule_jk_len = (int) user_options_extra->rule_len_r;
rule_jk_buf = (char *) user_options->rule_buf_r;
rule_jk_buf = user_options->rule_buf_r;
}
if (run_rule_engine (rule_jk_len, rule_jk_buf))
@ -1426,12 +1426,12 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
// post-process rule engine
int rule_jk_len = (int) user_options_extra->rule_len_l;
char *rule_jk_buf = (char *) user_options->rule_buf_l;
const char *rule_jk_buf = user_options->rule_buf_l;
if (attack_mode == ATTACK_MODE_HYBRID2)
{
rule_jk_len = (int) user_options_extra->rule_len_r;
rule_jk_buf = (char *) user_options->rule_buf_r;
rule_jk_buf = user_options->rule_buf_r;
}
if (run_rule_engine (rule_jk_len, rule_jk_buf))

@ -477,7 +477,7 @@ size_t hc_fread (void *ptr, size_t size, size_t nmemb, HCFILE *fp)
if (inLeft == 0 && outLeft == 0)
{
/* partial read */
n = (size_t) (outPos / size);
n = (outPos / size);
break;
}
outPos += outLeft;

@ -469,18 +469,18 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
{
const int hook_threads = (int) user_options->hook_threads;
module_ctx->hook_extra_params = (void *) hccalloc (hook_threads, sizeof (void *));
module_ctx->hook_extra_params = hccalloc (hook_threads, sizeof (void *));
for (int i = 0; i < hook_threads; i++)
{
module_ctx->hook_extra_params[i] = (void *) hcmalloc (hashconfig->hook_extra_param_size);
module_ctx->hook_extra_params[i] = hcmalloc (hashconfig->hook_extra_param_size);
}
}
else
{
module_ctx->hook_extra_params = (void *) hccalloc (1, sizeof (void *));
module_ctx->hook_extra_params = hccalloc (1, sizeof (void *));
module_ctx->hook_extra_params[0] = (void *) hcmalloc (1);
module_ctx->hook_extra_params[0] = hcmalloc (1);
}
if (module_ctx->module_hook_extra_param_init != MODULE_DEFAULT)

@ -49,7 +49,7 @@ static void loopback_format_plain (hashcat_ctx_t *hashcat_ctx, const u8 *plain_p
}
else
{
hc_fwrite ((void *)plain_ptr, plain_len, 1, &loopback_ctx->fp);
hc_fwrite (plain_ptr, plain_len, 1, &loopback_ctx->fp);
}
}

@ -180,7 +180,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size)
{
u32 *digest = (u32 *) digest_buf;
const u32 *digest = (const u32 *) digest_buf;
char sig[6] = { 'n', 'r', 'c', 's', 't', 'n' };

@ -228,7 +228,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
phpass_encode (digest_buf, tmp);
return snprintf (line_buf, line_size, "%s%s%s", (char *) salt->salt_sign, (char *) salt->salt_buf, tmp);
return snprintf (line_buf, line_size, "%s%s%s", (const char *) salt->salt_sign, (const char *) salt->salt_buf, tmp);
}
void module_init (module_ctx_t *module_ctx)

@ -107,7 +107,7 @@ static void juniper_decrypt_hash (const u8 *in, const int in_len, u8 *out)
u8 base64_buf[100] = { 0 };
base64_decode (base64_to_int, (const u8 *) in, in_len, base64_buf);
base64_decode (base64_to_int, in, in_len, base64_buf);
// iv stuff

@ -57,7 +57,7 @@ bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const void *tmps, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz)
{
u8 *ptr_src = (u8 *) src_buf;
const u8 *ptr_src = (const u8 *) src_buf;
u8 *ptr_dst = (u8 *) dst_buf;
for (int i = 0; i < src_len; i++)

@ -138,8 +138,8 @@ static void to_hccapx_t (const hashes_t *hashes, hccapx_t *hccapx, const u32 sal
memcpy (hccapx->essid, salt->salt_buf, hccapx->essid_len);
wpa_eapol_t *wpa_eapols = (wpa_eapol_t *) esalts_buf;
wpa_eapol_t *wpa_eapol = &wpa_eapols[digest_cur];
const wpa_eapol_t *wpa_eapols = (const wpa_eapol_t *) esalts_buf;
const wpa_eapol_t *wpa_eapol = &wpa_eapols[digest_cur];
hccapx->message_pair = wpa_eapol->message_pair;
hccapx->keyver = wpa_eapol->keyver;
@ -309,10 +309,10 @@ int module_hash_encode_potfile (MAYBE_UNUSED const hashconfig_t *hashconfig, MAY
int module_hash_encode_status (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size)
{
wpa_eapol_t *wpa_eapol = (wpa_eapol_t *) esalt_buf;
const wpa_eapol_t *wpa_eapol = (const wpa_eapol_t *) esalt_buf;
const int line_len = snprintf (line_buf, line_size, "%s (AP:%02x:%02x:%02x:%02x:%02x:%02x STA:%02x:%02x:%02x:%02x:%02x:%02x)",
(char *) salt->salt_buf,
(const char *) salt->salt_buf,
wpa_eapol->orig_mac_ap[0],
wpa_eapol->orig_mac_ap[1],
wpa_eapol->orig_mac_ap[2],

@ -136,8 +136,8 @@ static void to_hccapx_t (const hashes_t *hashes, hccapx_t *hccapx, const u32 sal
memcpy (hccapx->essid, salt->salt_buf, hccapx->essid_len);
wpa_eapol_t *wpa_eapols = (wpa_eapol_t *) esalts_buf;
wpa_eapol_t *wpa_eapol = &wpa_eapols[digest_cur];
const wpa_eapol_t *wpa_eapols = (const wpa_eapol_t *) esalts_buf;
const wpa_eapol_t *wpa_eapol = &wpa_eapols[digest_cur];
hccapx->message_pair = wpa_eapol->message_pair;
hccapx->keyver = wpa_eapol->keyver;
@ -572,10 +572,10 @@ bool module_potfile_custom_check (MAYBE_UNUSED const hashconfig_t *hashconfig, M
int module_hash_encode_status (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size)
{
wpa_eapol_t *wpa_eapol = (wpa_eapol_t *) esalt_buf;
const wpa_eapol_t *wpa_eapol = (const wpa_eapol_t *) esalt_buf;
const int line_len = snprintf (line_buf, line_size, "%s (AP:%02x:%02x:%02x:%02x:%02x:%02x STA:%02x:%02x:%02x:%02x:%02x:%02x)",
(char *) salt->salt_buf,
(const char *) salt->salt_buf,
wpa_eapol->orig_mac_ap[0],
wpa_eapol->orig_mac_ap[1],
wpa_eapol->orig_mac_ap[2],

@ -227,7 +227,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
memset (tmp_buf, 0, sizeof (tmp_buf));
base64_decode (bf64_to_int, (const u8 *) salt_pos, salt_len, tmp_buf);
base64_decode (bf64_to_int, salt_pos, salt_len, tmp_buf);
memcpy (salt_buf_ptr, tmp_buf, 16);
@ -238,7 +238,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
memset (tmp_buf, 0, sizeof (tmp_buf));
base64_decode (bf64_to_int, (const u8 *) hash_pos, hash_len, tmp_buf);
base64_decode (bf64_to_int, hash_pos, hash_len, tmp_buf);
memcpy (digest, tmp_buf, 24);
@ -281,7 +281,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
tmp_buf[22 + 31] = 0; // base64_encode wants to pad
return snprintf (line_buf, line_size, "%s$%s", (char *) salt->salt_sign, tmp_buf);
return snprintf (line_buf, line_size, "%s$%s", (const char *) salt->salt_sign, tmp_buf);
}
void module_init (module_ctx_t *module_ctx)

@ -122,11 +122,11 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
digest[3] -= MD5M_D;
}
const bool parse_rc1 = generic_salt_decode (hashconfig, token.buf[1], token.len[1], (u8 *) md5_double_salt->salt1_buf, (int *) &md5_double_salt->salt1_len);
const bool parse_rc1 = generic_salt_decode (hashconfig, token.buf[1], token.len[1], (u8 *) md5_double_salt->salt1_buf, &md5_double_salt->salt1_len);
if (parse_rc1 == false) return (PARSER_SALT_LENGTH);
const bool parse_rc2 = generic_salt_decode (hashconfig, token.buf[2], token.len[2], (u8 *) md5_double_salt->salt2_buf, (int *) &md5_double_salt->salt2_len);
const bool parse_rc2 = generic_salt_decode (hashconfig, token.buf[2], token.len[2], (u8 *) md5_double_salt->salt2_buf, &md5_double_salt->salt2_len);
if (parse_rc2 == false) return (PARSER_SALT_LENGTH);
@ -186,13 +186,13 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1;
out_len += generic_salt_encode (hashconfig, (const u8 *) md5_double_salt->salt1_buf, (const int) md5_double_salt->salt1_len, out_buf + out_len);
out_len += generic_salt_encode (hashconfig, (const u8 *) md5_double_salt->salt1_buf, md5_double_salt->salt1_len, out_buf + out_len);
out_buf[out_len] = hashconfig->separator;
out_len += 1;
out_len += generic_salt_encode (hashconfig, (const u8 *) md5_double_salt->salt2_buf, (const int) md5_double_salt->salt2_len, out_buf + out_len);
out_len += generic_salt_encode (hashconfig, (const u8 *) md5_double_salt->salt2_buf, md5_double_salt->salt2_len, out_buf + out_len);
return out_len;
}

@ -166,7 +166,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1;
out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) out_buf + out_len);
out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
return out_len;
}

@ -166,7 +166,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1;
out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) out_buf + out_len);
out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
return out_len;
}

@ -167,7 +167,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_len += 1;
out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, (u8 *) out_buf + out_len);
out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len);
return out_len;
}

@ -133,7 +133,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
HCFILE fp;
if (hc_fopen (&fp, (const char *) line_buf, "rb") == false) return (PARSER_HASH_FILE);
if (hc_fopen (&fp, line_buf, "rb") == false) return (PARSER_HASH_FILE);
psafe3_t in;

@ -351,9 +351,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
int out_len = 0;
u8 *ptr;
ptr = (u8 *) netntlm->userdomain_buf;
const u8 *ptr = (const u8 *) netntlm->userdomain_buf;
for (int i = 0; i < netntlm->user_len; i += 2)
{
@ -372,7 +370,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_buf[out_len++] = ':';
ptr = (u8 *) netntlm->chall_buf;
ptr = (const u8 *) netntlm->chall_buf;
for (int i = 0; i < netntlm->srvchall_len; i++)
{

@ -249,9 +249,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
int out_len = 0;
u8 *ptr;
ptr = (u8 *) netntlm->userdomain_buf;
const u8 *ptr = (const u8 *) netntlm->userdomain_buf;
for (int i = 0; i < netntlm->user_len; i += 2)
{
@ -270,7 +268,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
out_buf[out_len++] = ':';
ptr = (u8 *) netntlm->chall_buf;
ptr = (const u8 *) netntlm->chall_buf;
for (int i = 0; i < netntlm->srvchall_len; i++)
{

@ -71,7 +71,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 tmp_buf[100] = { 0 };
base64_decode (itoa64_to_int, (const u8 *) hash_pos, hash_len, tmp_buf);
base64_decode (itoa64_to_int, hash_pos, hash_len, tmp_buf);
memcpy (digest, tmp_buf, 32);

@ -175,7 +175,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
lastpass_t *lastpass = (lastpass_t *) esalt_buf;
const int iv_size = hex_decode ((const u8 *) token.buf[3], token.len[3], (u8 *) lastpass->iv);
const int iv_size = hex_decode (token.buf[3], token.len[3], (u8 *) lastpass->iv);
if (iv_size != sizeof (lastpass->iv)) return (PARSER_IV_LENGTH);

@ -195,7 +195,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
line_len += snprintf (line_buf + line_len, line_size - line_len, "%s%u.", SIGNATURE_SHA512GRUB, salt->salt_iter + 1);
unsigned char *salt_buf_ptr = (unsigned char *) pbkdf2_sha512->salt_buf;
const unsigned char *salt_buf_ptr = (const unsigned char *) pbkdf2_sha512->salt_buf;
for (u32 i = 0; i < salt->salt_len; i++)
{

@ -140,7 +140,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const rakp_t *rakp = (const rakp_t *) esalt_buf;
u8 *ptr = (u8 *) rakp->salt_buf;
const u8 *ptr = (const u8 *) rakp->salt_buf;
int line_len = 0;

@ -343,7 +343,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{
char ptr_plain[48] = { 0 };
sha256crypt_encode ((unsigned char *) digest_buf, (unsigned char *) ptr_plain);
sha256crypt_encode ((const unsigned char *) digest_buf, (unsigned char *) ptr_plain);
char tmp_salt[SALT_MAX * 2];

@ -358,7 +358,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 tmp_dgst[100] = { 0 };
const int dgst_len = hex_decode ((const u8 *) hash_pos, hash_len, (u8 *) tmp_dgst);
const int dgst_len = hex_decode (hash_pos, hash_len, (u8 *) tmp_dgst);
if (dgst_len != 43) return (PARSER_HASH_ENCODING);
@ -373,7 +373,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 dgst[100] = { 0 };
sha256crypt_encode ((u8 *) digest_buf, dgst);
sha256crypt_encode ((const u8 *) digest_buf, dgst);
// yeah, this is weird: we use hex-encoding for base64-encoded salt
// this has to do with missing MySQL function to decode/encode this variant of base64

@ -216,8 +216,8 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{
const krb5pa_t *krb5pa = (const krb5pa_t *) esalt_buf;
u8 *ptr_timestamp = (u8 *) krb5pa->timestamp;
u8 *ptr_checksum = (u8 *) krb5pa->checksum;
const u8 *ptr_timestamp = (const u8 *) krb5pa->timestamp;
const u8 *ptr_checksum = (const u8 *) krb5pa->checksum;
char data[128] = { 0 };
@ -237,9 +237,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const int line_len = snprintf (line_buf, line_size, "%s%s$%s$%s$%s",
SIGNATURE_KRB5PA,
(char *) krb5pa->user,
(char *) krb5pa->realm,
(char *) krb5pa->salt,
(const char *) krb5pa->user,
(const char *) krb5pa->realm,
(const char *) krb5pa->salt,
data);
return line_len;

@ -109,11 +109,11 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *hash_pos = token.buf[1];
digest[0] = hex_to_u32 ((const u8 *) &hash_pos[ 0]);
digest[1] = hex_to_u32 ((const u8 *) &hash_pos[ 8]);
digest[2] = hex_to_u32 ((const u8 *) &hash_pos[16]);
digest[3] = hex_to_u32 ((const u8 *) &hash_pos[24]);
digest[4] = hex_to_u32 ((const u8 *) &hash_pos[32]);
digest[0] = hex_to_u32 (&hash_pos[ 0]);
digest[1] = hex_to_u32 (&hash_pos[ 8]);
digest[2] = hex_to_u32 (&hash_pos[16]);
digest[3] = hex_to_u32 (&hash_pos[24]);
digest[4] = hex_to_u32 (&hash_pos[32]);
digest[0] = byte_swap_32 (digest[0]);
digest[1] = byte_swap_32 (digest[1]);

@ -109,11 +109,11 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *hash_pos = token.buf[1];
digest[0] = hex_to_u32 ((const u8 *) &hash_pos[ 0]);
digest[1] = hex_to_u32 ((const u8 *) &hash_pos[ 8]);
digest[2] = hex_to_u32 ((const u8 *) &hash_pos[16]);
digest[3] = hex_to_u32 ((const u8 *) &hash_pos[24]);
digest[4] = hex_to_u32 ((const u8 *) &hash_pos[32]);
digest[0] = hex_to_u32 (&hash_pos[ 0]);
digest[1] = hex_to_u32 (&hash_pos[ 8]);
digest[2] = hex_to_u32 (&hash_pos[16]);
digest[3] = hex_to_u32 (&hash_pos[24]);
digest[4] = hex_to_u32 (&hash_pos[32]);
digest[0] = byte_swap_32 (digest[0]);
digest[1] = byte_swap_32 (digest[1]);

@ -428,7 +428,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
// ugly hack start
char *tmpx = (char *) salt->salt_buf_pc;
const char *tmpx = (const char *) salt->salt_buf_pc;
ptr_plain[42] = tmpx[0];
@ -436,7 +436,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
ptr_plain[43] = 0;
const int line_len = snprintf (line_buf, line_size, "%s%s%s", (char *) salt->salt_sign, (char *) salt->salt_buf, ptr_plain);
const int line_len = snprintf (line_buf, line_size, "%s%s%s", (const char *) salt->salt_sign, (const char *) salt->salt_buf, ptr_plain);
return line_len;
}

@ -175,7 +175,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
char domain_buf_c[33] = { 0 };
memcpy (domain_buf_c, (char *) salt->salt_buf_pc, salt_pc_len);
memcpy (domain_buf_c, (const char *) salt->salt_buf_pc, salt_pc_len);
for (u32 i = 0; i < salt_pc_len; i++)
{

@ -336,7 +336,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 tmp_buf[128] = { 0 };
const int tmp_len = base64_decode (base64_to_int, (const u8 *) salt_pos, salt_len, tmp_buf);
const int tmp_len = base64_decode (base64_to_int, salt_pos, salt_len, tmp_buf);
memcpy (salt->salt_buf, tmp_buf, tmp_len);
@ -349,7 +349,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
memset (tmp_buf, 0, sizeof (tmp_buf));
const int digest_len = base64_decode (base64_to_int, (const u8 *) hash_pos, hash_len, tmp_buf);
const int digest_len = base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf);
// digest_len should be safe because of 88 limit

@ -188,7 +188,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
HCFILE fp;
if (hc_fopen (&fp, (const char *) line_buf, "rb") == false) return (PARSER_HASH_FILE);
if (hc_fopen (&fp, line_buf, "rb") == false) return (PARSER_HASH_FILE);
psafe2_hdr buf;

@ -171,9 +171,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
// salt
const pbkdf2_sha256_t *pbkdf2_sha256 = (pbkdf2_sha256_t *) esalt_buf;
const pbkdf2_sha256_t *pbkdf2_sha256 = (const pbkdf2_sha256_t *) esalt_buf;
unsigned char *salt_buf_ptr = (unsigned char *) pbkdf2_sha256->salt_buf;
const unsigned char *salt_buf_ptr = (const unsigned char *) pbkdf2_sha256->salt_buf;
// hash

@ -337,7 +337,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
tmp_buf[43] = 0; // cut it here
const int line_len = snprintf (line_buf, line_size, "%s%s$%s", SIGNATURE_CISCO9, (unsigned char *) salt->salt_buf, tmp_buf);
const int line_len = snprintf (line_buf, line_size, "%s%s$%s", SIGNATURE_CISCO9, (const unsigned char *) salt->salt_buf, tmp_buf);
return line_len;
}

@ -261,7 +261,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size)
{
const office2013_t *office2013 = (office2013_t *) esalt_buf;
const office2013_t *office2013 = (const office2013_t *) esalt_buf;
const int line_len = snprintf (line_buf, line_size, "%s*%d*%d*%d*%d*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x%08x%08x%08x",
SIGNATURE_OFFICE2013,

@ -259,7 +259,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{
secondBlockData[0] = '*';
u8 *ptr = (u8 *) oldoffice34->secondBlockData;
const u8 *ptr = (const u8 *) oldoffice34->secondBlockData;
for (int i = 0, j = 1; i < 32; i += 1, j += 2)
{

@ -278,7 +278,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{
secondBlockData[0] = '*';
u8 *ptr = (u8 *) oldoffice34->secondBlockData;
const u8 *ptr = (const u8 *) oldoffice34->secondBlockData;
for (int i = 0, j = 1; i < 32; i += 1, j += 2)
{

@ -293,7 +293,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{
secondBlockData[0] = '*';
u8 *ptr = (u8 *) oldoffice34->secondBlockData;
const u8 *ptr = (const u8 *) oldoffice34->secondBlockData;
for (int i = 0, j = 1; i < 32; i += 1, j += 2)
{

@ -164,7 +164,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 tmp_buf[100] = { 0 };
base64_decode (base64_to_int, (const u8 *) hash_pos, hash_len, tmp_buf);
base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf);
memcpy (digest, tmp_buf, 32);

@ -111,7 +111,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 tmp_buf[256] = { 0 };
const int tmp_len = base64_decode (base64_to_int, (const u8 *) hash_pos, hash_len, tmp_buf);
const int tmp_len = base64_decode (base64_to_int, hash_pos, hash_len, tmp_buf);
if (tmp_len < 32 + 1) return (PARSER_HASH_LENGTH);
@ -155,7 +155,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
char tmp_buf[SALT_MAX * 2];
const int tmp_len = snprintf (tmp_buf, sizeof (tmp_buf), "%s %08x%08x%08x%08x",
(char *) cram_md5->user,
(const char *) cram_md5->user,
byte_swap_32 (digest[0]),
byte_swap_32 (digest[1]),
byte_swap_32 (digest[2]),

@ -117,7 +117,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 tmp_buf[100] = { 0 };
const u32 decoded_len = base64_decode (base64_to_int, (const u8 *) base64_pos, base64_len, tmp_buf);
const u32 decoded_len = base64_decode (base64_to_int, base64_pos, base64_len, tmp_buf);
if (decoded_len < 24) return (PARSER_SALT_LENGTH);

@ -289,7 +289,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{
const pdf_t *pdf = (const pdf_t *) esalt_buf;
char *line_format = "$pdf$%d*%d*%d*%u*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x";
const char *line_format = "$pdf$%d*%d*%d*%u*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x";
if (pdf->P_minus == 1) line_format = "$pdf$%d*%d*%d*%d*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x";

@ -310,7 +310,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{
const pdf_t *pdf = (const pdf_t *) esalt_buf;
char *line_format = "$pdf$%d*%d*%d*%u*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x";
const char *line_format = "$pdf$%d*%d*%d*%u*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x";
if (pdf->P_minus == 1) line_format = "$pdf$%d*%d*%d*%d*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x";

@ -319,7 +319,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *rc4key = (const u8 *) pdf->rc4key;
char *line_format = "$pdf$%d*%d*%d*%u*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x:%02x%02x%02x%02x%02x";
const char *line_format = "$pdf$%d*%d*%d*%u*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x:%02x%02x%02x%02x%02x";
if (pdf->P_minus == 1) line_format = "$pdf$%d*%d*%d*%d*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x:%02x%02x%02x%02x%02x";

@ -378,7 +378,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
if (pdf->id_len == 32)
{
char *line_format = "$pdf$%d*%d*%d*%u*%d*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x";
const char *line_format = "$pdf$%d*%d*%d*%u*%d*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x";
if (pdf->P_minus == 1) line_format = "$pdf$%d*%d*%d*%d*%d*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x";
@ -419,7 +419,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
}
else
{
char *line_format = "$pdf$%d*%d*%d*%u*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x";
const char *line_format = "$pdf$%d*%d*%d*%u*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x";
if (pdf->P_minus == 1) line_format = "$pdf$%d*%d*%d*%d*%d*%d*%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x*%d*%08x%08x%08x%08x%08x%08x%08x%08x";

@ -236,7 +236,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
for (int i = 0, j = 0; i < 8 + 2; i += 1, j += 8)
{
pdf->u_buf[i] = hex_to_u32 ((const u8 *) &u_buf_pos[j]);
pdf->u_buf[i] = hex_to_u32 (&u_buf_pos[j]);
}
salt->salt_buf[0] = pdf->u_buf[8];

@ -315,7 +315,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
for (int i = 0, j = 0; i < 8 + 2; i += 1, j += 8)
{
pdf->u_buf[i] = hex_to_u32 ((const u8 *) &u_buf_pos[j]);
pdf->u_buf[i] = hex_to_u32 (&u_buf_pos[j]);
}
salt->salt_buf[0] = pdf->u_buf[8];

@ -165,7 +165,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{
const u32 *digest = (const u32 *) digest_buf;
const pbkdf2_sha256_t *pbkdf2_sha256 = (pbkdf2_sha256_t *) esalt_buf;
const pbkdf2_sha256_t *pbkdf2_sha256 = (const pbkdf2_sha256_t *) esalt_buf;
u32 tmp_digest[64];

@ -236,7 +236,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
for (int i = 0, j = 0; j < cry_master_len; i += 1, j += 8)
{
bitcoin_wallet->cry_master_buf[i] = hex_to_u32 ((const u8 *) &cry_master_buf_pos[j]);
bitcoin_wallet->cry_master_buf[i] = hex_to_u32 (&cry_master_buf_pos[j]);
}
bitcoin_wallet->cry_master_len = cry_master_len / 2;

@ -408,10 +408,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
* digest
*/
digest[0] = hex_to_u32 ((const u8 *) &digest_pos[ 0]);
digest[1] = hex_to_u32 ((const u8 *) &digest_pos[ 8]);
digest[2] = hex_to_u32 ((const u8 *) &digest_pos[16]);
digest[3] = hex_to_u32 ((const u8 *) &digest_pos[24]);
digest[0] = hex_to_u32 (&digest_pos[ 0]);
digest[1] = hex_to_u32 (&digest_pos[ 8]);
digest[2] = hex_to_u32 (&digest_pos[16]);
digest[3] = hex_to_u32 (&digest_pos[24]);
return (PARSER_OK);
}

@ -185,13 +185,13 @@ void module_hook23 (hc_device_param_t *device_param, MAYBE_UNUSED const void *ho
{
seven_zip_hook_t *hook_items = (seven_zip_hook_t *) device_param->hooks_buf;
seven_zip_hook_salt_t *seven_zips = (seven_zip_hook_salt_t *) hook_salts_buf;
seven_zip_hook_salt_t *seven_zip = &seven_zips[salt_pos];
const seven_zip_hook_salt_t *seven_zips = (const seven_zip_hook_salt_t *) hook_salts_buf;
const seven_zip_hook_salt_t *seven_zip = &seven_zips[salt_pos];
seven_zip_hook_extra_t *seven_zip_hook_extra = (seven_zip_hook_extra_t *) hook_extra_param;
const seven_zip_hook_extra_t *seven_zip_hook_extra = (const seven_zip_hook_extra_t *) hook_extra_param;
u8 data_type = seven_zip->data_type;
u32 *data_buf = seven_zip->data_buf;
const u32 *data_buf = seven_zip->data_buf;
u32 unpack_size = seven_zip->unpack_size;
// this hook data needs to be updated (the "hook_success" variable):
@ -286,7 +286,7 @@ void module_hook23 (hc_device_param_t *device_param, MAYBE_UNUSED const void *ho
{
u32 crc_len = seven_zip->crc_len;
char *coder_attributes = seven_zip->coder_attributes;
const char *coder_attributes = seven_zip->coder_attributes;
// input buffers and length
@ -657,7 +657,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
for (u32 i = 0, j = 0; j < coder_attributes_len; i += 1, j += 2)
{
seven_zip->coder_attributes[i] = hex_to_u8 ((const u8 *) &coder_attributes_pos[j]);
seven_zip->coder_attributes[i] = hex_to_u8 (&coder_attributes_pos[j]);
seven_zip->coder_attributes_len++;
}
@ -716,7 +716,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size)
{
seven_zip_hook_salt_t *seven_zip = (seven_zip_hook_salt_t *) hook_salt_buf;
const seven_zip_hook_salt_t *seven_zip = (const seven_zip_hook_salt_t *) hook_salt_buf;
const u32 data_len = seven_zip->data_len;
@ -752,7 +752,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
salt->salt_sign[0],
cost,
seven_zip->salt_len,
(char *) seven_zip->salt_buf,
(const char *) seven_zip->salt_buf,
iv_len,
iv[0],
iv[1],

@ -133,8 +133,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{
if (line_buf[token.len[0] + 3] == '*')
{
char *account_info_start = (char *) line_buf + 12; // we want the * char included
char *account_info_stop = strchr ((const char *) account_info_start + 1, '*');
const char *account_info_start = line_buf + 12; // we want the * char included
char *account_info_stop = strchr (account_info_start + 1, '*');
if (account_info_stop == NULL) return (PARSER_SEPARATOR_UNMATCHED);
@ -311,7 +311,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
for (u32 i = 0, j = 0; i < krb5tgs->edata2_len; i += 1, j += 2)
{
u8 *ptr_edata2 = (u8 *) krb5tgs->edata2;
const u8 *ptr_edata2 = (const u8 *) krb5tgs->edata2;
snprintf (data + j, 3, "%02x", ptr_edata2[i]);
}
@ -324,7 +324,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{
line_len = snprintf (line_buf, line_size, "%s23$%s%08x%08x%08x%08x$%s",
SIGNATURE_KRB5TGS,
(char *) krb5tgs->account_info,
(const char *) krb5tgs->account_info,
byte_swap_32 (krb5tgs->checksum[0]),
byte_swap_32 (krb5tgs->checksum[1]),
byte_swap_32 (krb5tgs->checksum[2]),
@ -335,7 +335,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{
line_len = snprintf (line_buf, line_size, "%s%s:%08x%08x%08x%08x$%s",
SIGNATURE_KRB5TGS,
(char *) krb5tgs->account_info,
(const char *) krb5tgs->account_info,
byte_swap_32 (krb5tgs->checksum[0]),
byte_swap_32 (krb5tgs->checksum[1]),
byte_swap_32 (krb5tgs->checksum[2]),

@ -282,10 +282,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *final_random_seed_pos = token.buf[4];
keepass->final_random_seed[0] = hex_to_u32 ((const u8 *) &final_random_seed_pos[ 0]);
keepass->final_random_seed[1] = hex_to_u32 ((const u8 *) &final_random_seed_pos[ 8]);
keepass->final_random_seed[2] = hex_to_u32 ((const u8 *) &final_random_seed_pos[16]);
keepass->final_random_seed[3] = hex_to_u32 ((const u8 *) &final_random_seed_pos[24]);
keepass->final_random_seed[0] = hex_to_u32 (&final_random_seed_pos[ 0]);
keepass->final_random_seed[1] = hex_to_u32 (&final_random_seed_pos[ 8]);
keepass->final_random_seed[2] = hex_to_u32 (&final_random_seed_pos[16]);
keepass->final_random_seed[3] = hex_to_u32 (&final_random_seed_pos[24]);
keepass->final_random_seed[0] = byte_swap_32 (keepass->final_random_seed[0]);
keepass->final_random_seed[1] = byte_swap_32 (keepass->final_random_seed[1]);
@ -294,10 +294,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
if (keepass->version == 2)
{
keepass->final_random_seed[4] = hex_to_u32 ((const u8 *) &final_random_seed_pos[32]);
keepass->final_random_seed[5] = hex_to_u32 ((const u8 *) &final_random_seed_pos[40]);
keepass->final_random_seed[6] = hex_to_u32 ((const u8 *) &final_random_seed_pos[48]);
keepass->final_random_seed[7] = hex_to_u32 ((const u8 *) &final_random_seed_pos[56]);
keepass->final_random_seed[4] = hex_to_u32 (&final_random_seed_pos[32]);
keepass->final_random_seed[5] = hex_to_u32 (&final_random_seed_pos[40]);
keepass->final_random_seed[6] = hex_to_u32 (&final_random_seed_pos[48]);
keepass->final_random_seed[7] = hex_to_u32 (&final_random_seed_pos[56]);
keepass->final_random_seed[4] = byte_swap_32 (keepass->final_random_seed[4]);
keepass->final_random_seed[5] = byte_swap_32 (keepass->final_random_seed[5]);
@ -309,14 +309,14 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *transf_random_seed_pos = token.buf[5];
keepass->transf_random_seed[0] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[ 0]);
keepass->transf_random_seed[1] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[ 8]);
keepass->transf_random_seed[2] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[16]);
keepass->transf_random_seed[3] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[24]);
keepass->transf_random_seed[4] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[32]);
keepass->transf_random_seed[5] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[40]);
keepass->transf_random_seed[6] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[48]);
keepass->transf_random_seed[7] = hex_to_u32 ((const u8 *) &transf_random_seed_pos[56]);
keepass->transf_random_seed[0] = hex_to_u32 (&transf_random_seed_pos[ 0]);
keepass->transf_random_seed[1] = hex_to_u32 (&transf_random_seed_pos[ 8]);
keepass->transf_random_seed[2] = hex_to_u32 (&transf_random_seed_pos[16]);
keepass->transf_random_seed[3] = hex_to_u32 (&transf_random_seed_pos[24]);
keepass->transf_random_seed[4] = hex_to_u32 (&transf_random_seed_pos[32]);
keepass->transf_random_seed[5] = hex_to_u32 (&transf_random_seed_pos[40]);
keepass->transf_random_seed[6] = hex_to_u32 (&transf_random_seed_pos[48]);
keepass->transf_random_seed[7] = hex_to_u32 (&transf_random_seed_pos[56]);
keepass->transf_random_seed[0] = byte_swap_32 (keepass->transf_random_seed[0]);
keepass->transf_random_seed[1] = byte_swap_32 (keepass->transf_random_seed[1]);
@ -331,10 +331,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *enc_iv_pos = token.buf[6];
keepass->enc_iv[0] = hex_to_u32 ((const u8 *) &enc_iv_pos[ 0]);
keepass->enc_iv[1] = hex_to_u32 ((const u8 *) &enc_iv_pos[ 8]);
keepass->enc_iv[2] = hex_to_u32 ((const u8 *) &enc_iv_pos[16]);
keepass->enc_iv[3] = hex_to_u32 ((const u8 *) &enc_iv_pos[24]);
keepass->enc_iv[0] = hex_to_u32 (&enc_iv_pos[ 0]);
keepass->enc_iv[1] = hex_to_u32 (&enc_iv_pos[ 8]);
keepass->enc_iv[2] = hex_to_u32 (&enc_iv_pos[16]);
keepass->enc_iv[3] = hex_to_u32 (&enc_iv_pos[24]);
keepass->enc_iv[0] = byte_swap_32 (keepass->enc_iv[0]);
keepass->enc_iv[1] = byte_swap_32 (keepass->enc_iv[1]);
@ -349,14 +349,14 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *contents_hash_pos = token.buf[7];
keepass->contents_hash[0] = hex_to_u32 ((const u8 *) &contents_hash_pos[ 0]);
keepass->contents_hash[1] = hex_to_u32 ((const u8 *) &contents_hash_pos[ 8]);
keepass->contents_hash[2] = hex_to_u32 ((const u8 *) &contents_hash_pos[16]);
keepass->contents_hash[3] = hex_to_u32 ((const u8 *) &contents_hash_pos[24]);
keepass->contents_hash[4] = hex_to_u32 ((const u8 *) &contents_hash_pos[32]);
keepass->contents_hash[5] = hex_to_u32 ((const u8 *) &contents_hash_pos[40]);
keepass->contents_hash[6] = hex_to_u32 ((const u8 *) &contents_hash_pos[48]);
keepass->contents_hash[7] = hex_to_u32 ((const u8 *) &contents_hash_pos[56]);
keepass->contents_hash[0] = hex_to_u32 (&contents_hash_pos[ 0]);
keepass->contents_hash[1] = hex_to_u32 (&contents_hash_pos[ 8]);
keepass->contents_hash[2] = hex_to_u32 (&contents_hash_pos[16]);
keepass->contents_hash[3] = hex_to_u32 (&contents_hash_pos[24]);
keepass->contents_hash[4] = hex_to_u32 (&contents_hash_pos[32]);
keepass->contents_hash[5] = hex_to_u32 (&contents_hash_pos[40]);
keepass->contents_hash[6] = hex_to_u32 (&contents_hash_pos[48]);
keepass->contents_hash[7] = hex_to_u32 (&contents_hash_pos[56]);
keepass->contents_hash[0] = byte_swap_32 (keepass->contents_hash[0]);
keepass->contents_hash[1] = byte_swap_32 (keepass->contents_hash[1]);
@ -376,7 +376,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
for (int i = 0, j = 0; j < contents_len; i += 1, j += 8)
{
keepass->contents[i] = hex_to_u32 ((const u8 *) &contents_pos[j]);
keepass->contents[i] = hex_to_u32 (&contents_pos[j]);
keepass->contents[i] = byte_swap_32 (keepass->contents[i]);
}
@ -392,14 +392,14 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *expected_bytes_pos = token.buf[7];
keepass->expected_bytes[0] = hex_to_u32 ((const u8 *) &expected_bytes_pos[ 0]);
keepass->expected_bytes[1] = hex_to_u32 ((const u8 *) &expected_bytes_pos[ 8]);
keepass->expected_bytes[2] = hex_to_u32 ((const u8 *) &expected_bytes_pos[16]);
keepass->expected_bytes[3] = hex_to_u32 ((const u8 *) &expected_bytes_pos[24]);
keepass->expected_bytes[4] = hex_to_u32 ((const u8 *) &expected_bytes_pos[32]);
keepass->expected_bytes[5] = hex_to_u32 ((const u8 *) &expected_bytes_pos[40]);
keepass->expected_bytes[6] = hex_to_u32 ((const u8 *) &expected_bytes_pos[48]);
keepass->expected_bytes[7] = hex_to_u32 ((const u8 *) &expected_bytes_pos[56]);
keepass->expected_bytes[0] = hex_to_u32 (&expected_bytes_pos[ 0]);
keepass->expected_bytes[1] = hex_to_u32 (&expected_bytes_pos[ 8]);
keepass->expected_bytes[2] = hex_to_u32 (&expected_bytes_pos[16]);
keepass->expected_bytes[3] = hex_to_u32 (&expected_bytes_pos[24]);
keepass->expected_bytes[4] = hex_to_u32 (&expected_bytes_pos[32]);
keepass->expected_bytes[5] = hex_to_u32 (&expected_bytes_pos[40]);
keepass->expected_bytes[6] = hex_to_u32 (&expected_bytes_pos[48]);
keepass->expected_bytes[7] = hex_to_u32 (&expected_bytes_pos[56]);
keepass->expected_bytes[0] = byte_swap_32 (keepass->expected_bytes[0]);
keepass->expected_bytes[1] = byte_swap_32 (keepass->expected_bytes[1]);
@ -414,14 +414,14 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *contents_hash_pos = token.buf[8];
keepass->contents_hash[0] = hex_to_u32 ((const u8 *) &contents_hash_pos[ 0]);
keepass->contents_hash[1] = hex_to_u32 ((const u8 *) &contents_hash_pos[ 8]);
keepass->contents_hash[2] = hex_to_u32 ((const u8 *) &contents_hash_pos[16]);
keepass->contents_hash[3] = hex_to_u32 ((const u8 *) &contents_hash_pos[24]);
keepass->contents_hash[4] = hex_to_u32 ((const u8 *) &contents_hash_pos[32]);
keepass->contents_hash[5] = hex_to_u32 ((const u8 *) &contents_hash_pos[40]);
keepass->contents_hash[6] = hex_to_u32 ((const u8 *) &contents_hash_pos[48]);
keepass->contents_hash[7] = hex_to_u32 ((const u8 *) &contents_hash_pos[56]);
keepass->contents_hash[0] = hex_to_u32 (&contents_hash_pos[ 0]);
keepass->contents_hash[1] = hex_to_u32 (&contents_hash_pos[ 8]);
keepass->contents_hash[2] = hex_to_u32 (&contents_hash_pos[16]);
keepass->contents_hash[3] = hex_to_u32 (&contents_hash_pos[24]);
keepass->contents_hash[4] = hex_to_u32 (&contents_hash_pos[32]);
keepass->contents_hash[5] = hex_to_u32 (&contents_hash_pos[40]);
keepass->contents_hash[6] = hex_to_u32 (&contents_hash_pos[48]);
keepass->contents_hash[7] = hex_to_u32 (&contents_hash_pos[56]);
keepass->contents_hash[0] = byte_swap_32 (keepass->contents_hash[0]);
keepass->contents_hash[1] = byte_swap_32 (keepass->contents_hash[1]);
@ -442,14 +442,14 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{
keepass->keyfile_len = 32;
keepass->keyfile[0] = hex_to_u32 ((const u8 *) &keyfile_pos[ 0]);
keepass->keyfile[1] = hex_to_u32 ((const u8 *) &keyfile_pos[ 8]);
keepass->keyfile[2] = hex_to_u32 ((const u8 *) &keyfile_pos[16]);
keepass->keyfile[3] = hex_to_u32 ((const u8 *) &keyfile_pos[24]);
keepass->keyfile[4] = hex_to_u32 ((const u8 *) &keyfile_pos[32]);
keepass->keyfile[5] = hex_to_u32 ((const u8 *) &keyfile_pos[40]);
keepass->keyfile[6] = hex_to_u32 ((const u8 *) &keyfile_pos[48]);
keepass->keyfile[7] = hex_to_u32 ((const u8 *) &keyfile_pos[56]);
keepass->keyfile[0] = hex_to_u32 (&keyfile_pos[ 0]);
keepass->keyfile[1] = hex_to_u32 (&keyfile_pos[ 8]);
keepass->keyfile[2] = hex_to_u32 (&keyfile_pos[16]);
keepass->keyfile[3] = hex_to_u32 (&keyfile_pos[24]);
keepass->keyfile[4] = hex_to_u32 (&keyfile_pos[32]);
keepass->keyfile[5] = hex_to_u32 (&keyfile_pos[40]);
keepass->keyfile[6] = hex_to_u32 (&keyfile_pos[48]);
keepass->keyfile[7] = hex_to_u32 (&keyfile_pos[56]);
keepass->keyfile[0] = byte_swap_32 (keepass->keyfile[0]);
keepass->keyfile[1] = byte_swap_32 (keepass->keyfile[1]);
@ -507,15 +507,15 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u32 algorithm = keepass->algorithm;
u32 keyfile_len = keepass->keyfile_len;
u32 *ptr_final_random_seed = (u32 *) keepass->final_random_seed;
u32 *ptr_transf_random_seed = (u32 *) keepass->transf_random_seed;
u32 *ptr_enc_iv = (u32 *) keepass->enc_iv;
u32 *ptr_contents_hash = (u32 *) keepass->contents_hash;
u32 *ptr_keyfile = (u32 *) keepass->keyfile;
const u32 *ptr_final_random_seed = (const u32 *) keepass->final_random_seed;
const u32 *ptr_transf_random_seed = (const u32 *) keepass->transf_random_seed;
const u32 *ptr_enc_iv = (const u32 *) keepass->enc_iv;
const u32 *ptr_contents_hash = (const u32 *) keepass->contents_hash;
const u32 *ptr_keyfile = (const u32 *) keepass->keyfile;
// specific to version 2
u32 expected_bytes_len;
u32 *ptr_expected_bytes;
const u32 *ptr_expected_bytes;
u32 final_random_seed_len;
u32 transf_random_seed_len;
@ -561,7 +561,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
if (version == 1)
{
u32 contents_len = keepass->contents_len;
u32 *ptr_contents = (u32 *) keepass->contents;
const u32 *ptr_contents = (const u32 *) keepass->contents;
for (u32 i = 0; i < contents_hash_len; i++, ptr_data += 8) snprintf (ptr_data, 9, "%08x", ptr_contents_hash[i]);
@ -591,7 +591,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
else if (version == 2)
{
expected_bytes_len = 8;
ptr_expected_bytes = (u32 *) keepass->expected_bytes;
ptr_expected_bytes = (const u32 *) keepass->expected_bytes;
for (u32 i = 0; i < expected_bytes_len; i++, ptr_data += 8) snprintf (ptr_data, 9, "%08x", ptr_expected_bytes[i]);

@ -245,8 +245,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{
if (salt_len != 16) return (PARSER_SALT_VALUE);
zip2->salt_buf[0] = hex_to_u32 ((const u8 *) &salt_pos[ 0]);
zip2->salt_buf[1] = hex_to_u32 ((const u8 *) &salt_pos[ 8]);
zip2->salt_buf[0] = hex_to_u32 (&salt_pos[ 0]);
zip2->salt_buf[1] = hex_to_u32 (&salt_pos[ 8]);
zip2->salt_buf[2] = 0;
zip2->salt_buf[3] = 0;
@ -256,9 +256,9 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{
if (salt_len != 24) return (PARSER_SALT_VALUE);
zip2->salt_buf[0] = hex_to_u32 ((const u8 *) &salt_pos[ 0]);
zip2->salt_buf[1] = hex_to_u32 ((const u8 *) &salt_pos[ 8]);
zip2->salt_buf[2] = hex_to_u32 ((const u8 *) &salt_pos[16]);
zip2->salt_buf[0] = hex_to_u32 (&salt_pos[ 0]);
zip2->salt_buf[1] = hex_to_u32 (&salt_pos[ 8]);
zip2->salt_buf[2] = hex_to_u32 (&salt_pos[16]);
zip2->salt_buf[3] = 0;
zip2->salt_len = 12;
@ -267,10 +267,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{
if (salt_len != 32) return (PARSER_SALT_VALUE);
zip2->salt_buf[0] = hex_to_u32 ((const u8 *) &salt_pos[ 0]);
zip2->salt_buf[1] = hex_to_u32 ((const u8 *) &salt_pos[ 8]);
zip2->salt_buf[2] = hex_to_u32 ((const u8 *) &salt_pos[16]);
zip2->salt_buf[3] = hex_to_u32 ((const u8 *) &salt_pos[24]);
zip2->salt_buf[0] = hex_to_u32 (&salt_pos[ 0]);
zip2->salt_buf[1] = hex_to_u32 (&salt_pos[ 8]);
zip2->salt_buf[2] = hex_to_u32 (&salt_pos[16]);
zip2->salt_buf[3] = hex_to_u32 (&salt_pos[24]);
zip2->salt_len = 16;
}

@ -93,11 +93,11 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig,
if (vc_tmp->pim == 0)
{
return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf);
return snprintf ((char *) dst_buf, dst_sz, "%s", (const char *) src_buf);
}
else
{
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, vc_tmp->pim - 15);
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (const char *) src_buf, vc_tmp->pim - 15);
}
}

@ -93,11 +93,11 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig,
if (vc_tmp->pim == 0)
{
return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf);
return snprintf ((char *) dst_buf, dst_sz, "%s", (const char *) src_buf);
}
else
{
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, vc_tmp->pim - 15);
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (const char *) src_buf, vc_tmp->pim - 15);
}
}

@ -93,11 +93,11 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig,
if (vc_tmp->pim == 0)
{
return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf);
return snprintf ((char *) dst_buf, dst_sz, "%s", (const char *) src_buf);
}
else
{
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, vc_tmp->pim - 15);
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (const char *) src_buf, vc_tmp->pim - 15);
}
}

@ -105,11 +105,11 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig,
if (vc64_tmp->pim == 0)
{
return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf);
return snprintf ((char *) dst_buf, dst_sz, "%s", (const char *) src_buf);
}
else
{
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, vc64_tmp->pim - 15);
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (const char *) src_buf, vc64_tmp->pim - 15);
}
}

@ -105,11 +105,11 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig,
if (vc64_tmp->pim == 0)
{
return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf);
return snprintf ((char *) dst_buf, dst_sz, "%s", (const char *) src_buf);
}
else
{
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, vc64_tmp->pim - 15);
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (const char *) src_buf, vc64_tmp->pim - 15);
}
}

@ -105,11 +105,11 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig,
if (vc64_tmp->pim == 0)
{
return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf);
return snprintf ((char *) dst_buf, dst_sz, "%s", (const char *) src_buf);
}
else
{
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, vc64_tmp->pim - 15);
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (const char *) src_buf, vc64_tmp->pim - 15);
}
}

@ -112,11 +112,11 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig,
if (vc_tmp->pim == 0)
{
return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf);
return snprintf ((char *) dst_buf, dst_sz, "%s", (const char *) src_buf);
}
else
{
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, vc_tmp->pim - 15);
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (const char *) src_buf, vc_tmp->pim - 15);
}
}

@ -112,11 +112,11 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig,
if (vc_tmp->pim == 0)
{
return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf);
return snprintf ((char *) dst_buf, dst_sz, "%s", (const char *) src_buf);
}
else
{
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, vc_tmp->pim - 15);
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (const char *) src_buf, vc_tmp->pim - 15);
}
}

@ -112,11 +112,11 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig,
if (vc_tmp->pim == 0)
{
return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf);
return snprintf ((char *) dst_buf, dst_sz, "%s", (const char *) src_buf);
}
else
{
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, vc_tmp->pim - 15);
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (const char *) src_buf, vc_tmp->pim - 15);
}
}

@ -112,11 +112,11 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig,
if (vc_tmp->pim == 0)
{
return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf);
return snprintf ((char *) dst_buf, dst_sz, "%s", (const char *) src_buf);
}
else
{
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, vc_tmp->pim - 15);
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (const char *) src_buf, vc_tmp->pim - 15);
}
}

@ -112,11 +112,11 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig,
if (vc_tmp->pim == 0)
{
return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf);
return snprintf ((char *) dst_buf, dst_sz, "%s", (const char *) src_buf);
}
else
{
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, vc_tmp->pim - 15);
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (const char *) src_buf, vc_tmp->pim - 15);
}
}

@ -112,11 +112,11 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig,
if (vc_tmp->pim == 0)
{
return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf);
return snprintf ((char *) dst_buf, dst_sz, "%s", (const char *) src_buf);
}
else
{
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, vc_tmp->pim - 15);
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (const char *) src_buf, vc_tmp->pim - 15);
}
}

@ -98,11 +98,11 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig,
if (vc64_sbog_tmp->pim == 0)
{
return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf);
return snprintf ((char *) dst_buf, dst_sz, "%s", (const char *) src_buf);
}
else
{
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, vc64_sbog_tmp->pim - 15);
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (const char *) src_buf, vc64_sbog_tmp->pim - 15);
}
}

@ -98,11 +98,11 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig,
if (vc64_sbog_tmp->pim == 0)
{
return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf);
return snprintf ((char *) dst_buf, dst_sz, "%s", (const char *) src_buf);
}
else
{
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, vc64_sbog_tmp->pim - 15);
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (const char *) src_buf, vc64_sbog_tmp->pim - 15);
}
}

@ -98,11 +98,11 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig,
if (vc64_sbog_tmp->pim == 0)
{
return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf);
return snprintf ((char *) dst_buf, dst_sz, "%s", (const char *) src_buf);
}
else
{
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, vc64_sbog_tmp->pim - 15);
return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (const char *) src_buf, vc64_sbog_tmp->pim - 15);
}
}

@ -185,7 +185,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
if (rc_tokenizer != PARSER_OK) return (rc_tokenizer);
const u32 type = atoi ((char *)token.buf[1]);
const u32 type = atoi ((const char *)token.buf[1]);
if (type > 14) return (PARSER_CRYPTOAPI_KERNELTYPE);
@ -208,7 +208,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
case 14: cryptoapi->kern_type = KERN_TYPE_CRYPTOAPI_WHIRLPOOL_TWOFISH; break;
}
const u32 key_size = atoi ((char *)token.buf[2]);
const u32 key_size = atoi ((const char *)token.buf[2]);
if (key_size > 2) return (PARSER_CRYPTOAPI_KEYSIZE);

@ -380,7 +380,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
HCFILE fp;
if (hc_fopen (&fp, (const char *) line_buf, "rb") == false) return (PARSER_HAVE_ERRNO);
if (hc_fopen (&fp, line_buf, "rb") == false) return (PARSER_HAVE_ERRNO);
struct luks_phdr hdr;

@ -169,16 +169,16 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u32 *wpky_buf_ptr = (u32 *) itunes_backup->wpky;
wpky_buf_ptr[0] = hex_to_u32 ((const u8 *) &wpky_pos[ 0]);
wpky_buf_ptr[1] = hex_to_u32 ((const u8 *) &wpky_pos[ 8]);
wpky_buf_ptr[2] = hex_to_u32 ((const u8 *) &wpky_pos[16]);
wpky_buf_ptr[3] = hex_to_u32 ((const u8 *) &wpky_pos[24]);
wpky_buf_ptr[4] = hex_to_u32 ((const u8 *) &wpky_pos[32]);
wpky_buf_ptr[5] = hex_to_u32 ((const u8 *) &wpky_pos[40]);
wpky_buf_ptr[6] = hex_to_u32 ((const u8 *) &wpky_pos[48]);
wpky_buf_ptr[7] = hex_to_u32 ((const u8 *) &wpky_pos[56]);
wpky_buf_ptr[8] = hex_to_u32 ((const u8 *) &wpky_pos[64]);
wpky_buf_ptr[9] = hex_to_u32 ((const u8 *) &wpky_pos[72]);
wpky_buf_ptr[0] = hex_to_u32 (&wpky_pos[ 0]);
wpky_buf_ptr[1] = hex_to_u32 (&wpky_pos[ 8]);
wpky_buf_ptr[2] = hex_to_u32 (&wpky_pos[16]);
wpky_buf_ptr[3] = hex_to_u32 (&wpky_pos[24]);
wpky_buf_ptr[4] = hex_to_u32 (&wpky_pos[32]);
wpky_buf_ptr[5] = hex_to_u32 (&wpky_pos[40]);
wpky_buf_ptr[6] = hex_to_u32 (&wpky_pos[48]);
wpky_buf_ptr[7] = hex_to_u32 (&wpky_pos[56]);
wpky_buf_ptr[8] = hex_to_u32 (&wpky_pos[64]);
wpky_buf_ptr[9] = hex_to_u32 (&wpky_pos[72]);
wpky_buf_ptr[0] = byte_swap_32 (wpky_buf_ptr[0]);
wpky_buf_ptr[1] = byte_swap_32 (wpky_buf_ptr[1]);
@ -254,11 +254,11 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u32 *dpsl_buf_ptr = (u32 *) itunes_backup->dpsl;
dpsl_buf_ptr[0] = hex_to_u32 ((const u8 *) &dpsl_pos[ 0]);
dpsl_buf_ptr[1] = hex_to_u32 ((const u8 *) &dpsl_pos[ 8]);
dpsl_buf_ptr[2] = hex_to_u32 ((const u8 *) &dpsl_pos[16]);
dpsl_buf_ptr[3] = hex_to_u32 ((const u8 *) &dpsl_pos[24]);
dpsl_buf_ptr[4] = hex_to_u32 ((const u8 *) &dpsl_pos[32]);
dpsl_buf_ptr[0] = hex_to_u32 (&dpsl_pos[ 0]);
dpsl_buf_ptr[1] = hex_to_u32 (&dpsl_pos[ 8]);
dpsl_buf_ptr[2] = hex_to_u32 (&dpsl_pos[16]);
dpsl_buf_ptr[3] = hex_to_u32 (&dpsl_pos[24]);
dpsl_buf_ptr[4] = hex_to_u32 (&dpsl_pos[32]);
dpsl_buf_ptr[0] = byte_swap_32 (dpsl_buf_ptr[ 0]);
dpsl_buf_ptr[1] = byte_swap_32 (dpsl_buf_ptr[ 1]);

@ -185,16 +185,16 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u32 *wpky_buf_ptr = (u32 *) itunes_backup->wpky;
wpky_buf_ptr[0] = hex_to_u32 ((const u8 *) &wpky_pos[ 0]);
wpky_buf_ptr[1] = hex_to_u32 ((const u8 *) &wpky_pos[ 8]);
wpky_buf_ptr[2] = hex_to_u32 ((const u8 *) &wpky_pos[16]);
wpky_buf_ptr[3] = hex_to_u32 ((const u8 *) &wpky_pos[24]);
wpky_buf_ptr[4] = hex_to_u32 ((const u8 *) &wpky_pos[32]);
wpky_buf_ptr[5] = hex_to_u32 ((const u8 *) &wpky_pos[40]);
wpky_buf_ptr[6] = hex_to_u32 ((const u8 *) &wpky_pos[48]);
wpky_buf_ptr[7] = hex_to_u32 ((const u8 *) &wpky_pos[56]);
wpky_buf_ptr[8] = hex_to_u32 ((const u8 *) &wpky_pos[64]);
wpky_buf_ptr[9] = hex_to_u32 ((const u8 *) &wpky_pos[72]);
wpky_buf_ptr[0] = hex_to_u32 (&wpky_pos[ 0]);
wpky_buf_ptr[1] = hex_to_u32 (&wpky_pos[ 8]);
wpky_buf_ptr[2] = hex_to_u32 (&wpky_pos[16]);
wpky_buf_ptr[3] = hex_to_u32 (&wpky_pos[24]);
wpky_buf_ptr[4] = hex_to_u32 (&wpky_pos[32]);
wpky_buf_ptr[5] = hex_to_u32 (&wpky_pos[40]);
wpky_buf_ptr[6] = hex_to_u32 (&wpky_pos[48]);
wpky_buf_ptr[7] = hex_to_u32 (&wpky_pos[56]);
wpky_buf_ptr[8] = hex_to_u32 (&wpky_pos[64]);
wpky_buf_ptr[9] = hex_to_u32 (&wpky_pos[72]);
wpky_buf_ptr[0] = byte_swap_32 (wpky_buf_ptr[0]);
wpky_buf_ptr[1] = byte_swap_32 (wpky_buf_ptr[1]);
@ -270,11 +270,11 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u32 *dpsl_buf_ptr = (u32 *) itunes_backup->dpsl;
dpsl_buf_ptr[0] = hex_to_u32 ((const u8 *) &dpsl_pos[ 0]);
dpsl_buf_ptr[1] = hex_to_u32 ((const u8 *) &dpsl_pos[ 8]);
dpsl_buf_ptr[2] = hex_to_u32 ((const u8 *) &dpsl_pos[16]);
dpsl_buf_ptr[3] = hex_to_u32 ((const u8 *) &dpsl_pos[24]);
dpsl_buf_ptr[4] = hex_to_u32 ((const u8 *) &dpsl_pos[32]);
dpsl_buf_ptr[0] = hex_to_u32 (&dpsl_pos[ 0]);
dpsl_buf_ptr[1] = hex_to_u32 (&dpsl_pos[ 8]);
dpsl_buf_ptr[2] = hex_to_u32 (&dpsl_pos[16]);
dpsl_buf_ptr[3] = hex_to_u32 (&dpsl_pos[24]);
dpsl_buf_ptr[4] = hex_to_u32 (&dpsl_pos[32]);
dpsl_buf_ptr[0] = byte_swap_32 (dpsl_buf_ptr[ 0]);
dpsl_buf_ptr[1] = byte_swap_32 (dpsl_buf_ptr[ 1]);

@ -89,7 +89,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *hash_pos = token.buf[0];
digest[0] = hex_to_u32 ((const u8 *) &hash_pos[0]);
digest[0] = hex_to_u32 (&hash_pos[0]);
digest[1] = 0;
digest[2] = 0;
digest[3] = 0;
@ -99,7 +99,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *salt_pos = token.buf[1];
const int salt_len = token.len[1];
salt->salt_buf[0] = hex_to_u32 ((const u8 *) &salt_pos[0]);
salt->salt_buf[0] = hex_to_u32 (&salt_pos[0]);
salt->salt_len = salt_len / 2; // 4

@ -215,7 +215,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
for (u32 i = 0; i < dpapimk->contents_len / 8; i++)
{
dpapimk->contents[i] = hex_to_u32 ((const u8 *) &contents_pos[i * 8]);
dpapimk->contents[i] = hex_to_u32 (&contents_pos[i * 8]);
dpapimk->contents[i] = byte_swap_32 (dpapimk->contents[i]);
}
@ -246,10 +246,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
// iv
dpapimk->iv[0] = hex_to_u32 ((const u8 *) &iv_pos[ 0]);
dpapimk->iv[1] = hex_to_u32 ((const u8 *) &iv_pos[ 8]);
dpapimk->iv[2] = hex_to_u32 ((const u8 *) &iv_pos[16]);
dpapimk->iv[3] = hex_to_u32 ((const u8 *) &iv_pos[24]);
dpapimk->iv[0] = hex_to_u32 (&iv_pos[ 0]);
dpapimk->iv[1] = hex_to_u32 (&iv_pos[ 8]);
dpapimk->iv[2] = hex_to_u32 (&iv_pos[16]);
dpapimk->iv[3] = hex_to_u32 (&iv_pos[24]);
dpapimk->iv[0] = byte_swap_32 (dpapimk->iv[0]);
dpapimk->iv[1] = byte_swap_32 (dpapimk->iv[1]);
@ -292,9 +292,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8* SID_tmp;
u32 *ptr_SID = (u32 *) dpapimk->SID;
u32 *ptr_iv = (u32 *) dpapimk->iv;
u32 *ptr_contents = (u32 *) dpapimk->contents;
const u32 *ptr_SID = (const u32 *) dpapimk->SID;
const u32 *ptr_iv = (const u32 *) dpapimk->iv;
const u32 *ptr_contents = (const u32 *) dpapimk->contents;
u32 u32_iv[4];

@ -231,7 +231,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
for (u32 i = 0; i < dpapimk->contents_len / 8; i++)
{
dpapimk->contents[i] = hex_to_u32 ((const u8 *) &contents_pos[i * 8]);
dpapimk->contents[i] = hex_to_u32 (&contents_pos[i * 8]);
dpapimk->contents[i] = byte_swap_32 (dpapimk->contents[i]);
}
@ -258,10 +258,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
// iv
dpapimk->iv[0] = hex_to_u32 ((const u8 *) &iv_pos[ 0]);
dpapimk->iv[1] = hex_to_u32 ((const u8 *) &iv_pos[ 8]);
dpapimk->iv[2] = hex_to_u32 ((const u8 *) &iv_pos[16]);
dpapimk->iv[3] = hex_to_u32 ((const u8 *) &iv_pos[24]);
dpapimk->iv[0] = hex_to_u32 (&iv_pos[ 0]);
dpapimk->iv[1] = hex_to_u32 (&iv_pos[ 8]);
dpapimk->iv[2] = hex_to_u32 (&iv_pos[16]);
dpapimk->iv[3] = hex_to_u32 (&iv_pos[24]);
dpapimk->iv[0] = byte_swap_32 (dpapimk->iv[0]);
dpapimk->iv[1] = byte_swap_32 (dpapimk->iv[1]);
@ -304,9 +304,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 SID[512] = { 0 };
u8 *SID_tmp = NULL;
u32 *ptr_SID = (u32 *) dpapimk->SID;
u32 *ptr_iv = (u32 *) dpapimk->iv;
u32 *ptr_contents = (u32 *) dpapimk->contents;
const u32 *ptr_SID = (const u32 *) dpapimk->SID;
const u32 *ptr_iv = (const u32 *) dpapimk->iv;
const u32 *ptr_contents = (const u32 *) dpapimk->contents;
u32 u32_iv[4];
u8 iv[32 + 1];

@ -145,22 +145,22 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *position_marker = token.buf[1];
chacha20->position[0] = hex_to_u32 ((const u8 *) position_marker + 0);
chacha20->position[1] = hex_to_u32 ((const u8 *) position_marker + 8);
chacha20->position[0] = hex_to_u32 (position_marker + 0);
chacha20->position[1] = hex_to_u32 (position_marker + 8);
// iv
const u8 *iv_marker = token.buf[3];
chacha20->iv[0] = hex_to_u32 ((const u8 *) iv_marker + 8);
chacha20->iv[1] = hex_to_u32 ((const u8 *) iv_marker + 0);
chacha20->iv[0] = hex_to_u32 (iv_marker + 8);
chacha20->iv[1] = hex_to_u32 (iv_marker + 0);
// plain
const u8 *plain_marker = token.buf[4];
chacha20->plain[0] = hex_to_u32 ((const u8 *) plain_marker + 0);
chacha20->plain[1] = hex_to_u32 ((const u8 *) plain_marker + 8);
chacha20->plain[0] = hex_to_u32 (plain_marker + 0);
chacha20->plain[1] = hex_to_u32 (plain_marker + 8);
/* some fake salt for the sorting mechanisms */
@ -178,8 +178,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *cipher_marker = token.buf[5];
digest[0] = hex_to_u32 ((const u8 *) cipher_marker + 8);
digest[1] = hex_to_u32 ((const u8 *) cipher_marker + 0);
digest[0] = hex_to_u32 (cipher_marker + 8);
digest[1] = hex_to_u32 (cipher_marker + 0);
return (PARSER_OK);
}

@ -140,21 +140,21 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *checksum_pos = token.buf[1];
jks_sha1->checksum[0] = hex_to_u32 ((const u8 *) &checksum_pos[ 0]);
jks_sha1->checksum[1] = hex_to_u32 ((const u8 *) &checksum_pos[ 8]);
jks_sha1->checksum[2] = hex_to_u32 ((const u8 *) &checksum_pos[16]);
jks_sha1->checksum[3] = hex_to_u32 ((const u8 *) &checksum_pos[24]);
jks_sha1->checksum[4] = hex_to_u32 ((const u8 *) &checksum_pos[32]);
jks_sha1->checksum[0] = hex_to_u32 (&checksum_pos[ 0]);
jks_sha1->checksum[1] = hex_to_u32 (&checksum_pos[ 8]);
jks_sha1->checksum[2] = hex_to_u32 (&checksum_pos[16]);
jks_sha1->checksum[3] = hex_to_u32 (&checksum_pos[24]);
jks_sha1->checksum[4] = hex_to_u32 (&checksum_pos[32]);
// iv
const u8 *iv_pos = token.buf[2];
jks_sha1->iv[0] = hex_to_u32 ((const u8 *) &iv_pos[ 0]);
jks_sha1->iv[1] = hex_to_u32 ((const u8 *) &iv_pos[ 8]);
jks_sha1->iv[2] = hex_to_u32 ((const u8 *) &iv_pos[16]);
jks_sha1->iv[3] = hex_to_u32 ((const u8 *) &iv_pos[24]);
jks_sha1->iv[4] = hex_to_u32 ((const u8 *) &iv_pos[32]);
jks_sha1->iv[0] = hex_to_u32 (&iv_pos[ 0]);
jks_sha1->iv[1] = hex_to_u32 (&iv_pos[ 8]);
jks_sha1->iv[2] = hex_to_u32 (&iv_pos[16]);
jks_sha1->iv[3] = hex_to_u32 (&iv_pos[24]);
jks_sha1->iv[4] = hex_to_u32 (&iv_pos[32]);
// enc_key
@ -165,7 +165,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
for (int i = 0, j = 0; j < enc_key_len; i += 1, j += 2)
{
enc_key_buf[i] = hex_to_u8 ((const u8 *) &enc_key_pos[j]);
enc_key_buf[i] = hex_to_u8 (&enc_key_pos[j]);
jks_sha1->enc_key_len++;
}
@ -176,7 +176,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 *der = (u8 *) jks_sha1->der;
der[0] = hex_to_u8 ((const u8 *) &der1_pos[0]);
der[0] = hex_to_u8 (&der1_pos[0]);
// der2
@ -184,7 +184,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
for (int i = 6, j = 0; j < 28; i += 1, j += 2)
{
der[i] = hex_to_u8 ((const u8 *) &der2_pos[j]);
der[i] = hex_to_u8 (&der2_pos[j]);
}
der[1] = 0;
@ -224,18 +224,18 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
char enc_key[16384 + 1] = { 0 };
u8 *ptr = (u8 *) jks_sha1->enc_key_buf;
const u8 *ptr = (const u8 *) jks_sha1->enc_key_buf;
for (u32 i = 0, j = 0; i < jks_sha1->enc_key_len; i += 1, j += 2)
{
snprintf (enc_key + j, 3, "%02X", ptr[i]);
}
u8 *der = (u8 *) jks_sha1->der;
const u8 *der = (const u8 *) jks_sha1->der;
char alias[65] = { 0 };
memcpy (alias, (char *) jks_sha1->alias, 64);
memcpy (alias, (const char *) jks_sha1->alias, 64);
const int line_len = snprintf (line_buf, line_size, "%s*%08X%08X%08X%08X%08X*%08X%08X%08X%08X%08X*%s*%02X*%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X*%s",
SIGNATURE_JKS_SHA1,

@ -198,27 +198,27 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *ciphertext_pos = token.buf[3];
ethereum_pbkdf2->ciphertext[0] = hex_to_u32 ((const u8 *) &ciphertext_pos[ 0]);
ethereum_pbkdf2->ciphertext[1] = hex_to_u32 ((const u8 *) &ciphertext_pos[ 8]);
ethereum_pbkdf2->ciphertext[2] = hex_to_u32 ((const u8 *) &ciphertext_pos[16]);
ethereum_pbkdf2->ciphertext[3] = hex_to_u32 ((const u8 *) &ciphertext_pos[24]);
ethereum_pbkdf2->ciphertext[4] = hex_to_u32 ((const u8 *) &ciphertext_pos[32]);
ethereum_pbkdf2->ciphertext[5] = hex_to_u32 ((const u8 *) &ciphertext_pos[40]);
ethereum_pbkdf2->ciphertext[6] = hex_to_u32 ((const u8 *) &ciphertext_pos[48]);
ethereum_pbkdf2->ciphertext[7] = hex_to_u32 ((const u8 *) &ciphertext_pos[56]);
ethereum_pbkdf2->ciphertext[0] = hex_to_u32 (&ciphertext_pos[ 0]);
ethereum_pbkdf2->ciphertext[1] = hex_to_u32 (&ciphertext_pos[ 8]);
ethereum_pbkdf2->ciphertext[2] = hex_to_u32 (&ciphertext_pos[16]);
ethereum_pbkdf2->ciphertext[3] = hex_to_u32 (&ciphertext_pos[24]);
ethereum_pbkdf2->ciphertext[4] = hex_to_u32 (&ciphertext_pos[32]);
ethereum_pbkdf2->ciphertext[5] = hex_to_u32 (&ciphertext_pos[40]);
ethereum_pbkdf2->ciphertext[6] = hex_to_u32 (&ciphertext_pos[48]);
ethereum_pbkdf2->ciphertext[7] = hex_to_u32 (&ciphertext_pos[56]);
// hash
const u8 *hash_pos = token.buf[4];
digest[0] = hex_to_u32 ((const u8 *) &hash_pos[ 0]);
digest[1] = hex_to_u32 ((const u8 *) &hash_pos[ 8]);
digest[2] = hex_to_u32 ((const u8 *) &hash_pos[16]);
digest[3] = hex_to_u32 ((const u8 *) &hash_pos[24]);
digest[4] = hex_to_u32 ((const u8 *) &hash_pos[32]);
digest[5] = hex_to_u32 ((const u8 *) &hash_pos[40]);
digest[6] = hex_to_u32 ((const u8 *) &hash_pos[48]);
digest[7] = hex_to_u32 ((const u8 *) &hash_pos[56]);
digest[0] = hex_to_u32 (&hash_pos[ 0]);
digest[1] = hex_to_u32 (&hash_pos[ 8]);
digest[2] = hex_to_u32 (&hash_pos[16]);
digest[3] = hex_to_u32 (&hash_pos[24]);
digest[4] = hex_to_u32 (&hash_pos[32]);
digest[5] = hex_to_u32 (&hash_pos[40]);
digest[6] = hex_to_u32 (&hash_pos[48]);
digest[7] = hex_to_u32 (&hash_pos[56]);
return (PARSER_OK);
}

@ -377,27 +377,27 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *ciphertext_pos = token.buf[5];
ethereum_scrypt->ciphertext[0] = hex_to_u32 ((const u8 *) &ciphertext_pos[ 0]);
ethereum_scrypt->ciphertext[1] = hex_to_u32 ((const u8 *) &ciphertext_pos[ 8]);
ethereum_scrypt->ciphertext[2] = hex_to_u32 ((const u8 *) &ciphertext_pos[16]);
ethereum_scrypt->ciphertext[3] = hex_to_u32 ((const u8 *) &ciphertext_pos[24]);
ethereum_scrypt->ciphertext[4] = hex_to_u32 ((const u8 *) &ciphertext_pos[32]);
ethereum_scrypt->ciphertext[5] = hex_to_u32 ((const u8 *) &ciphertext_pos[40]);
ethereum_scrypt->ciphertext[6] = hex_to_u32 ((const u8 *) &ciphertext_pos[48]);
ethereum_scrypt->ciphertext[7] = hex_to_u32 ((const u8 *) &ciphertext_pos[56]);
ethereum_scrypt->ciphertext[0] = hex_to_u32 (&ciphertext_pos[ 0]);
ethereum_scrypt->ciphertext[1] = hex_to_u32 (&ciphertext_pos[ 8]);
ethereum_scrypt->ciphertext[2] = hex_to_u32 (&ciphertext_pos[16]);
ethereum_scrypt->ciphertext[3] = hex_to_u32 (&ciphertext_pos[24]);
ethereum_scrypt->ciphertext[4] = hex_to_u32 (&ciphertext_pos[32]);
ethereum_scrypt->ciphertext[5] = hex_to_u32 (&ciphertext_pos[40]);
ethereum_scrypt->ciphertext[6] = hex_to_u32 (&ciphertext_pos[48]);
ethereum_scrypt->ciphertext[7] = hex_to_u32 (&ciphertext_pos[56]);
// hash
const u8 *hash_pos = token.buf[6];
digest[0] = hex_to_u32 ((const u8 *) &hash_pos[ 0]);
digest[1] = hex_to_u32 ((const u8 *) &hash_pos[ 8]);
digest[2] = hex_to_u32 ((const u8 *) &hash_pos[16]);
digest[3] = hex_to_u32 ((const u8 *) &hash_pos[24]);
digest[4] = hex_to_u32 ((const u8 *) &hash_pos[32]);
digest[5] = hex_to_u32 ((const u8 *) &hash_pos[40]);
digest[6] = hex_to_u32 ((const u8 *) &hash_pos[48]);
digest[7] = hex_to_u32 ((const u8 *) &hash_pos[56]);
digest[0] = hex_to_u32 (&hash_pos[ 0]);
digest[1] = hex_to_u32 (&hash_pos[ 8]);
digest[2] = hex_to_u32 (&hash_pos[16]);
digest[3] = hex_to_u32 (&hash_pos[24]);
digest[4] = hex_to_u32 (&hash_pos[32]);
digest[5] = hex_to_u32 (&hash_pos[40]);
digest[6] = hex_to_u32 (&hash_pos[48]);
digest[7] = hex_to_u32 (&hash_pos[56]);
return (PARSER_OK);
}
@ -412,7 +412,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
tmp_salt[salt_len] = 0;
ethereum_scrypt_t *ethereum_scrypt = (ethereum_scrypt_t *) esalt_buf;
const ethereum_scrypt_t *ethereum_scrypt = (const ethereum_scrypt_t *) esalt_buf;
const int line_len = snprintf (line_buf, line_size, "%s*%u*%u*%u*%s*%08x%08x%08x%08x%08x%08x%08x%08x*%08x%08x%08x%08x%08x%08x%08x%08x",
SIGNATURE_ETHEREUM_SCRYPT,

@ -228,7 +228,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
for (u32 i = 0; i < dpapimk->contents_len / 8; i++)
{
dpapimk->contents[i] = hex_to_u32 ((const u8 *) &contents_pos[i * 8]);
dpapimk->contents[i] = hex_to_u32 (&contents_pos[i * 8]);
dpapimk->contents[i] = byte_swap_32 (dpapimk->contents[i]);
}
@ -259,10 +259,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
// iv
dpapimk->iv[0] = hex_to_u32 ((const u8 *) &iv_pos[ 0]);
dpapimk->iv[1] = hex_to_u32 ((const u8 *) &iv_pos[ 8]);
dpapimk->iv[2] = hex_to_u32 ((const u8 *) &iv_pos[16]);
dpapimk->iv[3] = hex_to_u32 ((const u8 *) &iv_pos[24]);
dpapimk->iv[0] = hex_to_u32 (&iv_pos[ 0]);
dpapimk->iv[1] = hex_to_u32 (&iv_pos[ 8]);
dpapimk->iv[2] = hex_to_u32 (&iv_pos[16]);
dpapimk->iv[3] = hex_to_u32 (&iv_pos[24]);
dpapimk->iv[0] = byte_swap_32 (dpapimk->iv[0]);
dpapimk->iv[1] = byte_swap_32 (dpapimk->iv[1]);
@ -304,9 +304,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 SID[512] = { 0 };
u8* SID_tmp;
u32 *ptr_SID = (u32 *) dpapimk->SID;
u32 *ptr_iv = (u32 *) dpapimk->iv;
u32 *ptr_contents = (u32 *) dpapimk->contents;
const u32 *ptr_SID = (const u32 *) dpapimk->SID;
const u32 *ptr_iv = (const u32 *) dpapimk->iv;
const u32 *ptr_contents = (const u32 *) dpapimk->contents;
u32 u32_iv[4];
u8 iv[32 + 1];

@ -237,7 +237,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
for (u32 i = 0; i < dpapimk->contents_len / 8; i++)
{
dpapimk->contents[i] = hex_to_u32 ((const u8 *) &contents_pos[i * 8]);
dpapimk->contents[i] = hex_to_u32 (&contents_pos[i * 8]);
dpapimk->contents[i] = byte_swap_32 (dpapimk->contents[i]);
}
@ -264,10 +264,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
// iv
dpapimk->iv[0] = hex_to_u32 ((const u8 *) &iv_pos[ 0]);
dpapimk->iv[1] = hex_to_u32 ((const u8 *) &iv_pos[ 8]);
dpapimk->iv[2] = hex_to_u32 ((const u8 *) &iv_pos[16]);
dpapimk->iv[3] = hex_to_u32 ((const u8 *) &iv_pos[24]);
dpapimk->iv[0] = hex_to_u32 (&iv_pos[ 0]);
dpapimk->iv[1] = hex_to_u32 (&iv_pos[ 8]);
dpapimk->iv[2] = hex_to_u32 (&iv_pos[16]);
dpapimk->iv[3] = hex_to_u32 (&iv_pos[24]);
dpapimk->iv[0] = byte_swap_32 (dpapimk->iv[0]);
dpapimk->iv[1] = byte_swap_32 (dpapimk->iv[1]);
@ -310,9 +310,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 SID[512] = { 0 };
u8 *SID_tmp = NULL;
u32 *ptr_SID = (u32 *) dpapimk->SID;
u32 *ptr_iv = (u32 *) dpapimk->iv;
u32 *ptr_contents = (u32 *) dpapimk->contents;
const u32 *ptr_SID = (const u32 *) dpapimk->SID;
const u32 *ptr_iv = (const u32 *) dpapimk->iv;
const u32 *ptr_contents = (const u32 *) dpapimk->contents;
u32 u32_iv[4];
u8 iv[32 + 1];

@ -109,10 +109,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 *session_ptr = (u8 *) tacacs_plus->session_buf;
session_ptr[0] = hex_to_u8 ((const u8 *) session_pos + 0);
session_ptr[1] = hex_to_u8 ((const u8 *) session_pos + 2);
session_ptr[2] = hex_to_u8 ((const u8 *) session_pos + 4);
session_ptr[3] = hex_to_u8 ((const u8 *) session_pos + 6);
session_ptr[0] = hex_to_u8 (session_pos + 0);
session_ptr[1] = hex_to_u8 (session_pos + 2);
session_ptr[2] = hex_to_u8 (session_pos + 4);
session_ptr[3] = hex_to_u8 (session_pos + 6);
// ct_buf
@ -123,7 +123,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
for (int i = 0, j = 0; j < ct_buf_len; i += 1, j += 2)
{
ct_data_ptr[i] = hex_to_u8 ((const u8 *) &ct_buf_pos[j]);
ct_data_ptr[i] = hex_to_u8 (&ct_buf_pos[j]);
tacacs_plus->ct_data_len++;
}
@ -134,8 +134,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 *sequence_ptr = (u8 *) tacacs_plus->sequence_buf;
sequence_ptr[0] = hex_to_u8 ((const u8 *) sequence_pos + 0);
sequence_ptr[1] = hex_to_u8 ((const u8 *) sequence_pos + 2);
sequence_ptr[0] = hex_to_u8 (sequence_pos + 0);
sequence_ptr[1] = hex_to_u8 (sequence_pos + 2);
// fake salt

@ -178,10 +178,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *ZCRYPTOSALT_pos = token.buf[3];
apple_secure_notes->ZCRYPTOSALT[ 0] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[ 0]);
apple_secure_notes->ZCRYPTOSALT[ 1] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[ 8]);
apple_secure_notes->ZCRYPTOSALT[ 2] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[16]);
apple_secure_notes->ZCRYPTOSALT[ 3] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[24]);
apple_secure_notes->ZCRYPTOSALT[ 0] = hex_to_u32 (&ZCRYPTOSALT_pos[ 0]);
apple_secure_notes->ZCRYPTOSALT[ 1] = hex_to_u32 (&ZCRYPTOSALT_pos[ 8]);
apple_secure_notes->ZCRYPTOSALT[ 2] = hex_to_u32 (&ZCRYPTOSALT_pos[16]);
apple_secure_notes->ZCRYPTOSALT[ 3] = hex_to_u32 (&ZCRYPTOSALT_pos[24]);
apple_secure_notes->ZCRYPTOSALT[ 4] = 0;
apple_secure_notes->ZCRYPTOSALT[ 5] = 0;
apple_secure_notes->ZCRYPTOSALT[ 6] = 0;
@ -199,12 +199,12 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *ZCRYPTOWRAPPEDKEY_pos = token.buf[4];
apple_secure_notes->ZCRYPTOWRAPPEDKEY[0] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[ 0]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[1] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[ 8]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[2] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[16]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[3] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[24]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[4] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[32]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[5] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[40]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[0] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[ 0]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[1] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[ 8]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[2] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[16]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[3] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[24]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[4] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[32]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[5] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[40]);
// fake salt

@ -165,10 +165,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *encseed_pos = token.buf[1];
const int encseed_len = token.len[1];
ethereum_presale->iv[0] = hex_to_u32 ((const u8 *) &encseed_pos[ 0]);
ethereum_presale->iv[1] = hex_to_u32 ((const u8 *) &encseed_pos[ 8]);
ethereum_presale->iv[2] = hex_to_u32 ((const u8 *) &encseed_pos[16]);
ethereum_presale->iv[3] = hex_to_u32 ((const u8 *) &encseed_pos[24]);
ethereum_presale->iv[0] = hex_to_u32 (&encseed_pos[ 0]);
ethereum_presale->iv[1] = hex_to_u32 (&encseed_pos[ 8]);
ethereum_presale->iv[2] = hex_to_u32 (&encseed_pos[16]);
ethereum_presale->iv[3] = hex_to_u32 (&encseed_pos[24]);
ethereum_presale->iv[0] = byte_swap_32 (ethereum_presale->iv[0]);
ethereum_presale->iv[1] = byte_swap_32 (ethereum_presale->iv[1]);
@ -179,7 +179,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
for (int i = 32, j = 0; i < encseed_len; i += 8, j++)
{
esalt_buf_ptr[j] = hex_to_u32 ((const u8 *) &encseed_pos[i]);
esalt_buf_ptr[j] = hex_to_u32 (&encseed_pos[i]);
esalt_buf_ptr[j] = byte_swap_32 (esalt_buf_ptr[j]);
}
@ -201,10 +201,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *bkp_pos = token.buf[3];
digest[0] = hex_to_u32 ((const u8 *) &bkp_pos[ 0]);
digest[1] = hex_to_u32 ((const u8 *) &bkp_pos[ 8]);
digest[2] = hex_to_u32 ((const u8 *) &bkp_pos[16]);
digest[3] = hex_to_u32 ((const u8 *) &bkp_pos[24]);
digest[0] = hex_to_u32 (&bkp_pos[ 0]);
digest[1] = hex_to_u32 (&bkp_pos[ 8]);
digest[2] = hex_to_u32 (&bkp_pos[16]);
digest[3] = hex_to_u32 (&bkp_pos[24]);
return (PARSER_OK);
}

@ -91,10 +91,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *hash_pos = (const u8 *) line_buf + 10;
digest[0] = hex_to_u32 ((const u8 *) &hash_pos[ 0]);
digest[1] = hex_to_u32 ((const u8 *) &hash_pos[ 8]);
digest[2] = hex_to_u32 ((const u8 *) &hash_pos[16]);
digest[3] = hex_to_u32 ((const u8 *) &hash_pos[24]);
digest[0] = hex_to_u32 (&hash_pos[ 0]);
digest[1] = hex_to_u32 (&hash_pos[ 8]);
digest[2] = hex_to_u32 (&hash_pos[16]);
digest[3] = hex_to_u32 (&hash_pos[24]);
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
{

@ -327,7 +327,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
ptr_plain[86] = 0;
}
const int line_len = snprintf (line_buf, line_size, "%s.%s", (char *) jwt->salt_buf, (char *) ptr_plain);
const int line_len = snprintf (line_buf, line_size, "%s.%s", (const char *) jwt->salt_buf, (const char *) ptr_plain);
return line_len;
}

@ -121,19 +121,19 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *iv_pos = token.buf[2];
electrum_wallet->iv[0] = hex_to_u32 ((const u8 *) &iv_pos[ 0]);
electrum_wallet->iv[1] = hex_to_u32 ((const u8 *) &iv_pos[ 8]);
electrum_wallet->iv[2] = hex_to_u32 ((const u8 *) &iv_pos[16]);
electrum_wallet->iv[3] = hex_to_u32 ((const u8 *) &iv_pos[24]);
electrum_wallet->iv[0] = hex_to_u32 (&iv_pos[ 0]);
electrum_wallet->iv[1] = hex_to_u32 (&iv_pos[ 8]);
electrum_wallet->iv[2] = hex_to_u32 (&iv_pos[16]);
electrum_wallet->iv[3] = hex_to_u32 (&iv_pos[24]);
// encrypted
const u8 *encrypted_pos = token.buf[3];
electrum_wallet->encrypted[0] = hex_to_u32 ((const u8 *) &encrypted_pos[ 0]);
electrum_wallet->encrypted[1] = hex_to_u32 ((const u8 *) &encrypted_pos[ 8]);
electrum_wallet->encrypted[2] = hex_to_u32 ((const u8 *) &encrypted_pos[16]);
electrum_wallet->encrypted[3] = hex_to_u32 ((const u8 *) &encrypted_pos[24]);
electrum_wallet->encrypted[0] = hex_to_u32 (&encrypted_pos[ 0]);
electrum_wallet->encrypted[1] = hex_to_u32 (&encrypted_pos[ 8]);
electrum_wallet->encrypted[2] = hex_to_u32 (&encrypted_pos[16]);
electrum_wallet->encrypted[3] = hex_to_u32 (&encrypted_pos[24]);
// salt fake

@ -142,10 +142,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *ZCRYPTOSALT_pos = token.buf[3];
apple_secure_notes->ZCRYPTOSALT[ 0] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[ 0]);
apple_secure_notes->ZCRYPTOSALT[ 1] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[ 8]);
apple_secure_notes->ZCRYPTOSALT[ 2] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[16]);
apple_secure_notes->ZCRYPTOSALT[ 3] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[24]);
apple_secure_notes->ZCRYPTOSALT[ 0] = hex_to_u32 (&ZCRYPTOSALT_pos[ 0]);
apple_secure_notes->ZCRYPTOSALT[ 1] = hex_to_u32 (&ZCRYPTOSALT_pos[ 8]);
apple_secure_notes->ZCRYPTOSALT[ 2] = hex_to_u32 (&ZCRYPTOSALT_pos[16]);
apple_secure_notes->ZCRYPTOSALT[ 3] = hex_to_u32 (&ZCRYPTOSALT_pos[24]);
apple_secure_notes->ZCRYPTOSALT[ 4] = 0;
apple_secure_notes->ZCRYPTOSALT[ 5] = 0;
apple_secure_notes->ZCRYPTOSALT[ 6] = 0;
@ -171,12 +171,12 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *ZCRYPTOWRAPPEDKEY_pos = token.buf[5];
apple_secure_notes->ZCRYPTOWRAPPEDKEY[0] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[ 0]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[1] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[ 8]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[2] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[16]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[3] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[24]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[4] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[32]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[5] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[40]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[0] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[ 0]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[1] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[ 8]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[2] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[16]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[3] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[24]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[4] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[32]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[5] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[40]);
// fake salt

@ -214,7 +214,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
for (int i = 0, j = 0; j < ct_buf_len; i += 1, j += 2)
{
ct_data_ptr[i] = hex_to_u8 ((const u8 *) &ct_buf_pos[j]);
ct_data_ptr[i] = hex_to_u8 (&ct_buf_pos[j]);
ansible_vault->ct_data_len++;
}
@ -223,14 +223,14 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *hash_pos = token.buf[5];
digest[0] = hex_to_u32 ((const u8 *) &hash_pos[ 0]);
digest[1] = hex_to_u32 ((const u8 *) &hash_pos[ 8]);
digest[2] = hex_to_u32 ((const u8 *) &hash_pos[16]);
digest[3] = hex_to_u32 ((const u8 *) &hash_pos[24]);
digest[4] = hex_to_u32 ((const u8 *) &hash_pos[32]);
digest[5] = hex_to_u32 ((const u8 *) &hash_pos[40]);
digest[6] = hex_to_u32 ((const u8 *) &hash_pos[48]);
digest[7] = hex_to_u32 ((const u8 *) &hash_pos[56]);
digest[0] = hex_to_u32 (&hash_pos[ 0]);
digest[1] = hex_to_u32 (&hash_pos[ 8]);
digest[2] = hex_to_u32 (&hash_pos[16]);
digest[3] = hex_to_u32 (&hash_pos[24]);
digest[4] = hex_to_u32 (&hash_pos[32]);
digest[5] = hex_to_u32 (&hash_pos[40]);
digest[6] = hex_to_u32 (&hash_pos[48]);
digest[7] = hex_to_u32 (&hash_pos[56]);
digest[0] = byte_swap_32 (digest[0]);
digest[1] = byte_swap_32 (digest[1]);

@ -242,7 +242,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const int enc_data_size = hc_strtoul ((const char *) token.buf[2], NULL, 10);
const int encrypted_data_size = hex_decode ((const u8 *) token.buf[4], token.len[4], (u8 *) gpg->encrypted_data);
const int encrypted_data_size = hex_decode (token.buf[4], token.len[4], (u8 *) gpg->encrypted_data);
if (enc_data_size != encrypted_data_size) return (PARSER_CT_LENGTH);
@ -266,7 +266,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
if (hc_strtoul ((const char *) token.buf[9], NULL, 10) != sizeof (gpg->iv)) return (PARSER_IV_LENGTH);
const int iv_size = hex_decode ((const u8 *) token.buf[10], token.len[10], (u8 *) gpg->iv);
const int iv_size = hex_decode (token.buf[10], token.len[10], (u8 *) gpg->iv);
if (iv_size != sizeof (gpg->iv)) return (PARSER_IV_LENGTH);
@ -282,7 +282,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
salt->salt_repeats = gpg->cipher_algo == 7 ? 0 : 1; // "minus one"
salt->salt_len = hex_decode ((const u8 *) token.buf[12], token.len[12], (u8 *) salt->salt_buf);
salt->salt_len = hex_decode (token.buf[12], token.len[12], (u8 *) salt->salt_buf);
if (salt->salt_len != 8) return (PARSER_SALT_LENGTH);

@ -246,7 +246,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const int enc_data_size = hc_strtoul ((const char *) token.buf[2], NULL, 10);
const int encrypted_data_size = hex_decode ((const u8 *) token.buf[4], token.len[4], (u8 *) gpg->encrypted_data);
const int encrypted_data_size = hex_decode (token.buf[4], token.len[4], (u8 *) gpg->encrypted_data);
if (enc_data_size != encrypted_data_size) return (PARSER_CT_LENGTH);
@ -270,7 +270,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
if (hc_strtoul ((const char *) token.buf[9], NULL, 10) != sizeof (gpg->iv)) return (PARSER_IV_LENGTH);
const int iv_size = hex_decode ((const u8 *) token.buf[10], token.len[10], (u8 *) gpg->iv);
const int iv_size = hex_decode (token.buf[10], token.len[10], (u8 *) gpg->iv);
if (iv_size != sizeof (gpg->iv)) return (PARSER_IV_LENGTH);
@ -284,7 +284,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
// Salt Value
salt->salt_len = hex_decode ((const u8 *) token.buf[12], token.len[12], (u8 *) salt->salt_buf);
salt->salt_len = hex_decode (token.buf[12], token.len[12], (u8 *) salt->salt_buf);
if (salt->salt_len != 8) return (PARSER_SALT_LENGTH);

@ -242,7 +242,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const int enc_data_size = hc_strtoul ((const char *) token.buf[2], NULL, 10);
const int encrypted_data_size = hex_decode ((const u8 *) token.buf[4], token.len[4], (u8 *) gpg->encrypted_data);
const int encrypted_data_size = hex_decode (token.buf[4], token.len[4], (u8 *) gpg->encrypted_data);
if (enc_data_size != encrypted_data_size) return (PARSER_CT_LENGTH);
@ -266,7 +266,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
if (hc_strtoul ((const char *) token.buf[9], NULL, 10) != sizeof (gpg->iv)) return (PARSER_IV_LENGTH);
const int iv_size = hex_decode ((const u8 *) token.buf[10], token.len[10], (u8 *) gpg->iv);
const int iv_size = hex_decode (token.buf[10], token.len[10], (u8 *) gpg->iv);
if (iv_size != sizeof (gpg->iv)) return (PARSER_IV_LENGTH);
@ -280,7 +280,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
// Salt Value
salt->salt_len = hex_decode ((const u8 *) token.buf[12], token.len[12], (u8 *) salt->salt_buf);
salt->salt_len = hex_decode (token.buf[12], token.len[12], (u8 *) salt->salt_buf);
if (salt->salt_len != 8) return (PARSER_SALT_LENGTH);

@ -257,7 +257,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const int enc_data_size = hc_strtoul ((const char *) token.buf[2], NULL, 10);
const int encrypted_data_size = hex_decode ((const u8 *) token.buf[4], token.len[4], (u8 *) gpg->encrypted_data);
const int encrypted_data_size = hex_decode (token.buf[4], token.len[4], (u8 *) gpg->encrypted_data);
if (enc_data_size != encrypted_data_size) return (PARSER_CT_LENGTH);
@ -312,7 +312,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
salt->salt_repeats = gpg->cipher_algo == 7 ? 0 : 1; // "minus one" // TODO check this?
salt->salt_len = hex_decode ((const u8 *) token.buf[12], token.len[12], (u8 *) salt->salt_buf);
salt->salt_len = hex_decode (token.buf[12], token.len[12], (u8 *) salt->salt_buf);
if (salt->salt_len != 8) return (PARSER_SALT_LENGTH);

@ -83,7 +83,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
if (rc_tokenizer != PARSER_OK) return (rc_tokenizer);
// now we need to reduce our hash into a token
int otp_code = hc_strtoul ((const char *) line_buf, NULL, 10);
int otp_code = hc_strtoul (line_buf, NULL, 10);
digest[0] = otp_code;

@ -142,8 +142,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
krb5asrep->format = 2;
}
char *account_info_start = (char *) line_buf + strlen (SIGNATURE_KRB5ASREP) + parse_off;
char *account_info_stop = strchr ((const char *) account_info_start, ':');
const char *account_info_start = line_buf + strlen (SIGNATURE_KRB5ASREP) + parse_off;
char *account_info_stop = strchr (account_info_start, ':');
if (account_info_stop == NULL) return (PARSER_SEPARATOR_UNMATCHED);
@ -281,7 +281,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
for (u32 i = 0, j = 0; i < krb5asrep->edata2_len; i += 1, j += 2)
{
u8 *ptr_edata2 = (u8 *) krb5asrep->edata2;
const u8 *ptr_edata2 = (const u8 *) krb5asrep->edata2;
snprintf (data + j, 3, "%02x", ptr_edata2[i]);
}
@ -292,7 +292,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{
line_len = snprintf (line_buf, line_size, "%s23$%s:%08x%08x%08x%08x$%s",
SIGNATURE_KRB5ASREP,
(char *) krb5asrep->account_info,
(const char *) krb5asrep->account_info,
byte_swap_32 (krb5asrep->checksum[0]),
byte_swap_32 (krb5asrep->checksum[1]),
byte_swap_32 (krb5asrep->checksum[2]),
@ -303,7 +303,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
{
line_len = snprintf (line_buf, line_size, "%s%s:%08x%08x%08x%08x$%s",
SIGNATURE_KRB5ASREP,
(char *) krb5asrep->account_info,
(const char *) krb5asrep->account_info,
byte_swap_32 (krb5asrep->checksum[0]),
byte_swap_32 (krb5asrep->checksum[1]),
byte_swap_32 (krb5asrep->checksum[2]),

@ -173,10 +173,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *ZCRYPTOSALT_pos = token.buf[3];
apple_secure_notes->ZCRYPTOSALT[ 0] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[ 0]);
apple_secure_notes->ZCRYPTOSALT[ 1] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[ 8]);
apple_secure_notes->ZCRYPTOSALT[ 2] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[16]);
apple_secure_notes->ZCRYPTOSALT[ 3] = hex_to_u32 ((const u8 *) &ZCRYPTOSALT_pos[24]);
apple_secure_notes->ZCRYPTOSALT[ 0] = hex_to_u32 (&ZCRYPTOSALT_pos[ 0]);
apple_secure_notes->ZCRYPTOSALT[ 1] = hex_to_u32 (&ZCRYPTOSALT_pos[ 8]);
apple_secure_notes->ZCRYPTOSALT[ 2] = hex_to_u32 (&ZCRYPTOSALT_pos[16]);
apple_secure_notes->ZCRYPTOSALT[ 3] = hex_to_u32 (&ZCRYPTOSALT_pos[24]);
apple_secure_notes->ZCRYPTOSALT[ 4] = 0;
apple_secure_notes->ZCRYPTOSALT[ 5] = 0;
apple_secure_notes->ZCRYPTOSALT[ 6] = 0;
@ -202,16 +202,16 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *ZCRYPTOWRAPPEDKEY_pos = token.buf[5];
apple_secure_notes->ZCRYPTOWRAPPEDKEY[0] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[ 0]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[1] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[ 8]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[2] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[16]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[3] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[24]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[4] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[32]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[5] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[40]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[6] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[48]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[7] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[56]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[8] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[64]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[9] = hex_to_u32 ((const u8 *) &ZCRYPTOWRAPPEDKEY_pos[72]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[0] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[ 0]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[1] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[ 8]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[2] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[16]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[3] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[24]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[4] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[32]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[5] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[40]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[6] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[48]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[7] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[56]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[8] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[64]);
apple_secure_notes->ZCRYPTOWRAPPEDKEY[9] = hex_to_u32 (&ZCRYPTOWRAPPEDKEY_pos[72]);
// fake salt
@ -236,7 +236,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size)
{
apple_secure_notes_t *apple_secure_notes = (apple_secure_notes_t *) esalt_buf;
const apple_secure_notes_t *apple_secure_notes = (const apple_secure_notes_t *) esalt_buf;
const int out_len = snprintf (line_buf, line_size, "%s%u$16$%08x%08x%08x%08x$%u$%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x",
SIGNATURE_APFS,

@ -185,28 +185,28 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
for (int i = 0, j = 0; j < 128; i += 1, j += 8)
{
android_backup->user_salt[i] = hex_to_u32 ((const u8 *) user_salt_pos + j);
android_backup->user_salt[i] = hex_to_u32 (user_salt_pos + j);
}
// ck_salt
for (int i = 0, j = 0; j < 128; i += 1, j += 8)
{
android_backup->ck_salt[i] = hex_to_u32 ((const u8 *) ck_salt_pos + j);
android_backup->ck_salt[i] = hex_to_u32 (ck_salt_pos + j);
}
// user_iv
for (int i = 0, j = 0; j < 32; i += 1, j += 8)
{
android_backup->user_iv[i] = hex_to_u32 ((const u8 *) user_iv_pos + j);
android_backup->user_iv[i] = hex_to_u32 (user_iv_pos + j);
}
// masterkey_blob
for (int i = 0, j = 0; j < 192; i += 1, j += 8)
{
android_backup->masterkey_blob[i] = hex_to_u32 ((const u8 *) masterkey_blob_pos + j);
android_backup->masterkey_blob[i] = hex_to_u32 (masterkey_blob_pos + j);
}
// make the entry unique in our databases

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save