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