Fix some module hash output in -O mode

pull/1914/head
jsteube 5 years ago
parent d88a5a2a48
commit 0b40518176

@ -97,14 +97,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
digest[2] = hex_to_u32 (hash_pos + 16);
digest[3] = hex_to_u32 (hash_pos + 24);
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
{
digest[0] -= MD5M_A;
digest[1] -= MD5M_B;
digest[2] -= MD5M_C;
digest[3] -= MD5M_D;
}
const u8 *salt_pos = token.buf[1];
const int salt_len = token.len[1];
@ -131,14 +123,6 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
tmp[2] = digest[2];
tmp[3] = digest[3];
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
{
tmp[0] += MD5M_A;
tmp[1] += MD5M_B;
tmp[2] += MD5M_C;
tmp[3] += MD5M_D;
}
u8 *out_buf = (u8 *) line_buf;
int out_len = 0;

@ -145,11 +145,11 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u32 tmp[5];
tmp[0] = byte_swap_32 (digest[0]);
tmp[1] = byte_swap_32 (digest[1]);
tmp[2] = byte_swap_32 (digest[2]);
tmp[3] = byte_swap_32 (digest[3]);
tmp[4] = byte_swap_32 (digest[4]);
tmp[0] = digest[0];
tmp[1] = digest[1];
tmp[2] = digest[2];
tmp[3] = digest[3];
tmp[4] = digest[4];
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
{
@ -160,6 +160,12 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
tmp[4] += SHA1M_E;
}
tmp[0] = byte_swap_32 (tmp[0]);
tmp[1] = byte_swap_32 (tmp[1]);
tmp[2] = byte_swap_32 (tmp[2]);
tmp[3] = byte_swap_32 (tmp[3]);
tmp[4] = byte_swap_32 (tmp[4]);
memcpy (tmp_buf + 12, tmp, 20);
// base64 encode (salt + SHA1)

Loading…
Cancel
Save