diff --git a/OpenCL/m06211-pure.cl b/OpenCL/m06211-pure.cl index f406ad8e7..06f519632 100644 --- a/OpenCL/m06211-pure.cl +++ b/OpenCL/m06211-pure.cl @@ -19,7 +19,6 @@ typedef struct tc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -167,7 +166,7 @@ KERNEL_FQ void m06211_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) tmps[gid].opad[3] = ripemd160_hmac_ctx.opad.h[3]; tmps[gid].opad[4] = ripemd160_hmac_ctx.opad.h[4]; - ripemd160_hmac_update_global (&ripemd160_hmac_ctx, esalt_bufs[DIGESTS_OFFSET_HOST].salt_buf, 64); + ripemd160_hmac_update_global (&ripemd160_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 16; i += 5, j += 1) { @@ -379,27 +378,27 @@ KERNEL_FQ void m06211_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey2[6] = tmps[gid].out[14]; ukey2[7] = tmps[gid].out[15]; - if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) + if (verify_header_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m06212-pure.cl b/OpenCL/m06212-pure.cl index 6d37729b1..3dd97cda7 100644 --- a/OpenCL/m06212-pure.cl +++ b/OpenCL/m06212-pure.cl @@ -19,7 +19,6 @@ typedef struct tc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -167,7 +166,7 @@ KERNEL_FQ void m06212_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) tmps[gid].opad[3] = ripemd160_hmac_ctx.opad.h[3]; tmps[gid].opad[4] = ripemd160_hmac_ctx.opad.h[4]; - ripemd160_hmac_update_global (&ripemd160_hmac_ctx, esalt_bufs[DIGESTS_OFFSET_HOST].salt_buf, 64); + ripemd160_hmac_update_global (&ripemd160_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 32; i += 5, j += 1) { @@ -379,27 +378,27 @@ KERNEL_FQ void m06212_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey2[6] = tmps[gid].out[14]; ukey2[7] = tmps[gid].out[15]; - if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) + if (verify_header_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } @@ -425,27 +424,27 @@ KERNEL_FQ void m06212_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey4[6] = tmps[gid].out[30]; ukey4[7] = tmps[gid].out[31]; - if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_serpent_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4) == 1) + if (verify_header_twofish_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m06213-pure.cl b/OpenCL/m06213-pure.cl index f63384102..aeb9d64b3 100644 --- a/OpenCL/m06213-pure.cl +++ b/OpenCL/m06213-pure.cl @@ -19,7 +19,6 @@ typedef struct tc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -167,7 +166,7 @@ KERNEL_FQ void m06213_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) tmps[gid].opad[3] = ripemd160_hmac_ctx.opad.h[3]; tmps[gid].opad[4] = ripemd160_hmac_ctx.opad.h[4]; - ripemd160_hmac_update_global (&ripemd160_hmac_ctx, esalt_bufs[DIGESTS_OFFSET_HOST].salt_buf, 64); + ripemd160_hmac_update_global (&ripemd160_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 48; i += 5, j += 1) { @@ -379,27 +378,27 @@ KERNEL_FQ void m06213_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey2[6] = tmps[gid].out[14]; ukey2[7] = tmps[gid].out[15]; - if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) + if (verify_header_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } @@ -425,27 +424,27 @@ KERNEL_FQ void m06213_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey4[6] = tmps[gid].out[30]; ukey4[7] = tmps[gid].out[31]; - if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_serpent_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4) == 1) + if (verify_header_twofish_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } @@ -471,19 +470,19 @@ KERNEL_FQ void m06213_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey6[6] = tmps[gid].out[46]; ukey6[7] = tmps[gid].out[47]; - if (verify_header_serpent_twofish_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_serpent_twofish_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_aes_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes_twofish_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m06221-pure.cl b/OpenCL/m06221-pure.cl index dd130e637..671459f2a 100644 --- a/OpenCL/m06221-pure.cl +++ b/OpenCL/m06221-pure.cl @@ -19,7 +19,6 @@ typedef struct tc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -195,7 +194,7 @@ KERNEL_FQ void m06221_init (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t)) tmps[gid].opad[6] = sha512_hmac_ctx.opad.h[6]; tmps[gid].opad[7] = sha512_hmac_ctx.opad.h[7]; - sha512_hmac_update_global_swap (&sha512_hmac_ctx, esalt_bufs[DIGESTS_OFFSET_HOST].salt_buf, 64); + sha512_hmac_update_global_swap (&sha512_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 8; i += 8, j += 1) { @@ -474,27 +473,27 @@ KERNEL_FQ void m06221_comp (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t)) ukey2[6] = hc_swap32_S (h32_from_64_S (tmps[gid].out[7])); ukey2[7] = hc_swap32_S (l32_from_64_S (tmps[gid].out[7])); - if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) + if (verify_header_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m06222-pure.cl b/OpenCL/m06222-pure.cl index a73de0e57..348139296 100644 --- a/OpenCL/m06222-pure.cl +++ b/OpenCL/m06222-pure.cl @@ -19,7 +19,6 @@ typedef struct tc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -195,7 +194,7 @@ KERNEL_FQ void m06222_init (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t)) tmps[gid].opad[6] = sha512_hmac_ctx.opad.h[6]; tmps[gid].opad[7] = sha512_hmac_ctx.opad.h[7]; - sha512_hmac_update_global_swap (&sha512_hmac_ctx, esalt_bufs[DIGESTS_OFFSET_HOST].salt_buf, 64); + sha512_hmac_update_global_swap (&sha512_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 16; i += 8, j += 1) { @@ -474,27 +473,27 @@ KERNEL_FQ void m06222_comp (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t)) ukey2[6] = hc_swap32_S (h32_from_64_S (tmps[gid].out[7])); ukey2[7] = hc_swap32_S (l32_from_64_S (tmps[gid].out[7])); - if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) + if (verify_header_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } @@ -520,27 +519,27 @@ KERNEL_FQ void m06222_comp (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t)) ukey4[6] = hc_swap32_S (h32_from_64_S (tmps[gid].out[15])); ukey4[7] = hc_swap32_S (l32_from_64_S (tmps[gid].out[15])); - if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_serpent_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4) == 1) + if (verify_header_twofish_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m06223-pure.cl b/OpenCL/m06223-pure.cl index bd6d403c5..fd79c732d 100644 --- a/OpenCL/m06223-pure.cl +++ b/OpenCL/m06223-pure.cl @@ -19,7 +19,6 @@ typedef struct tc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -195,7 +194,7 @@ KERNEL_FQ void m06223_init (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t)) tmps[gid].opad[6] = sha512_hmac_ctx.opad.h[6]; tmps[gid].opad[7] = sha512_hmac_ctx.opad.h[7]; - sha512_hmac_update_global_swap (&sha512_hmac_ctx, esalt_bufs[DIGESTS_OFFSET_HOST].salt_buf, 64); + sha512_hmac_update_global_swap (&sha512_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 24; i += 8, j += 1) { @@ -474,27 +473,27 @@ KERNEL_FQ void m06223_comp (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t)) ukey2[6] = hc_swap32_S (h32_from_64_S (tmps[gid].out[7])); ukey2[7] = hc_swap32_S (l32_from_64_S (tmps[gid].out[7])); - if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) + if (verify_header_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } @@ -520,27 +519,27 @@ KERNEL_FQ void m06223_comp (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t)) ukey4[6] = hc_swap32_S (h32_from_64_S (tmps[gid].out[15])); ukey4[7] = hc_swap32_S (l32_from_64_S (tmps[gid].out[15])); - if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_serpent_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4) == 1) + if (verify_header_twofish_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } @@ -566,19 +565,19 @@ KERNEL_FQ void m06223_comp (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t)) ukey6[6] = hc_swap32_S (h32_from_64_S (tmps[gid].out[23])); ukey6[7] = hc_swap32_S (l32_from_64_S (tmps[gid].out[23])); - if (verify_header_serpent_twofish_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_serpent_twofish_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_aes_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes_twofish_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m06231-pure.cl b/OpenCL/m06231-pure.cl index 079690d7b..dba51becc 100644 --- a/OpenCL/m06231-pure.cl +++ b/OpenCL/m06231-pure.cl @@ -19,7 +19,6 @@ typedef struct tc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -291,7 +290,7 @@ KERNEL_FQ void m06231_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) tmps[gid].opad[14] = whirlpool_hmac_ctx.opad.h[14]; tmps[gid].opad[15] = whirlpool_hmac_ctx.opad.h[15]; - whirlpool_hmac_update_global_swap (&whirlpool_hmac_ctx, esalt_bufs[DIGESTS_OFFSET_HOST].salt_buf, 64); + whirlpool_hmac_update_global_swap (&whirlpool_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 16; i += 16, j += 1) { @@ -646,27 +645,27 @@ KERNEL_FQ void m06231_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey2[6] = hc_swap32_S (tmps[gid].out[14]); ukey2[7] = hc_swap32_S (tmps[gid].out[15]); - if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) + if (verify_header_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m06232-pure.cl b/OpenCL/m06232-pure.cl index fa7e032be..0241ba0f9 100644 --- a/OpenCL/m06232-pure.cl +++ b/OpenCL/m06232-pure.cl @@ -19,7 +19,6 @@ typedef struct tc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -291,7 +290,7 @@ KERNEL_FQ void m06232_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) tmps[gid].opad[14] = whirlpool_hmac_ctx.opad.h[14]; tmps[gid].opad[15] = whirlpool_hmac_ctx.opad.h[15]; - whirlpool_hmac_update_global_swap (&whirlpool_hmac_ctx, esalt_bufs[DIGESTS_OFFSET_HOST].salt_buf, 64); + whirlpool_hmac_update_global_swap (&whirlpool_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 32; i += 16, j += 1) { @@ -646,27 +645,27 @@ KERNEL_FQ void m06232_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey2[6] = hc_swap32_S (tmps[gid].out[14]); ukey2[7] = hc_swap32_S (tmps[gid].out[15]); - if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) + if (verify_header_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } @@ -692,27 +691,27 @@ KERNEL_FQ void m06232_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey4[6] = hc_swap32_S (tmps[gid].out[30]); ukey4[7] = hc_swap32_S (tmps[gid].out[31]); - if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_serpent_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4) == 1) + if (verify_header_twofish_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m06233-pure.cl b/OpenCL/m06233-pure.cl index d4c9a960d..d2add150c 100644 --- a/OpenCL/m06233-pure.cl +++ b/OpenCL/m06233-pure.cl @@ -19,7 +19,6 @@ typedef struct tc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -291,7 +290,7 @@ KERNEL_FQ void m06233_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) tmps[gid].opad[14] = whirlpool_hmac_ctx.opad.h[14]; tmps[gid].opad[15] = whirlpool_hmac_ctx.opad.h[15]; - whirlpool_hmac_update_global_swap (&whirlpool_hmac_ctx, esalt_bufs[DIGESTS_OFFSET_HOST].salt_buf, 64); + whirlpool_hmac_update_global_swap (&whirlpool_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 48; i += 16, j += 1) { @@ -646,27 +645,27 @@ KERNEL_FQ void m06233_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey2[6] = hc_swap32_S (tmps[gid].out[14]); ukey2[7] = hc_swap32_S (tmps[gid].out[15]); - if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) + if (verify_header_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } @@ -692,27 +691,27 @@ KERNEL_FQ void m06233_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey4[6] = hc_swap32_S (tmps[gid].out[30]); ukey4[7] = hc_swap32_S (tmps[gid].out[31]); - if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_serpent_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4) == 1) + if (verify_header_twofish_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } @@ -738,19 +737,19 @@ KERNEL_FQ void m06233_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey6[6] = hc_swap32_S (tmps[gid].out[46]); ukey6[7] = hc_swap32_S (tmps[gid].out[47]); - if (verify_header_serpent_twofish_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_serpent_twofish_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } - if (verify_header_aes_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes_twofish_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/src/modules/module_06211.c b/src/modules/module_06211.c index d1f836702..eabe0855a 100644 --- a/src/modules/module_06211.c +++ b/src/modules/module_06211.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "TrueCrypt RIPEMD160 + XTS 512 bit"; static const u64 KERN_TYPE = 6211; @@ -46,6 +46,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define TC_SALT_LEN 64 +#define TC_DATA_LEN 448 +#define TC_HEADER_LEN 512 + typedef struct tc_tmp { u32 ipad[16]; @@ -58,7 +62,6 @@ typedef struct tc_tmp typedef struct tc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -140,8 +143,6 @@ int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); - - hcfree (tmpdata); return parser_status; @@ -155,21 +156,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define TC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (TC_HEADER_LEN); - char *in = (char *) hcmalloc (TC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, TC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); + if (n != TC_HEADER_LEN) return (PARSER_TC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, TC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, TC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -222,23 +221,33 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE tc_t *tc = (tc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + // salt - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, TC_SALT_LEN); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_len = TC_SALT_LEN; - salt->salt_len = 4; + // iter salt->salt_iter = ROUNDS_TRUECRYPT_2K - 1; + // data + + memcpy (tc->data_buf, line_buf + TC_SALT_LEN, TC_DATA_LEN); + + // signature + tc->signature = 0x45555254; // "TRUE" - digest[0] = tc->data_buf[0]; + // fake digest + + memcpy (digest, tc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_06212.c b/src/modules/module_06212.c index a5a50cc61..04e24cff2 100644 --- a/src/modules/module_06212.c +++ b/src/modules/module_06212.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "TrueCrypt RIPEMD160 + XTS 1024 bit"; static const u64 KERN_TYPE = 6212; @@ -46,6 +46,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define TC_SALT_LEN 64 +#define TC_DATA_LEN 448 +#define TC_HEADER_LEN 512 + typedef struct tc_tmp { u32 ipad[16]; @@ -58,7 +62,6 @@ typedef struct tc_tmp typedef struct tc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -140,8 +143,6 @@ int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); - - hcfree (tmpdata); return parser_status; @@ -155,21 +156,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define TC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (TC_HEADER_LEN); - char *in = (char *) hcmalloc (TC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, TC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); + if (n != TC_HEADER_LEN) return (PARSER_TC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, TC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, TC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -222,23 +221,33 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE tc_t *tc = (tc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + // salt - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, TC_SALT_LEN); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_len = TC_SALT_LEN; - salt->salt_len = 4; + // iter salt->salt_iter = ROUNDS_TRUECRYPT_2K - 1; + // data + + memcpy (tc->data_buf, line_buf + TC_SALT_LEN, TC_DATA_LEN); + + // signature + tc->signature = 0x45555254; // "TRUE" - digest[0] = tc->data_buf[0]; + // fake digest + + memcpy (digest, tc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_06213.c b/src/modules/module_06213.c index 4d3569ad7..d885a6ea4 100644 --- a/src/modules/module_06213.c +++ b/src/modules/module_06213.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "TrueCrypt RIPEMD160 + XTS 1536 bit"; static const u64 KERN_TYPE = 6213; @@ -46,6 +46,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define TC_SALT_LEN 64 +#define TC_DATA_LEN 448 +#define TC_HEADER_LEN 512 + typedef struct tc_tmp { u32 ipad[16]; @@ -58,7 +62,6 @@ typedef struct tc_tmp typedef struct tc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -153,21 +156,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define TC_HEADER_SIZE 512 - - char *in = (char *) hcmalloc (TC_HEADER_SIZE); + char *in = (char *) hcmalloc (TC_HEADER_LEN); - const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, TC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); + if (n != TC_HEADER_LEN) return (PARSER_TC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, TC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, TC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -220,23 +221,33 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE tc_t *tc = (tc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + // salt - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, TC_SALT_LEN); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_len = TC_SALT_LEN; - salt->salt_len = 4; + // iter salt->salt_iter = ROUNDS_TRUECRYPT_2K - 1; + // data + + memcpy (tc->data_buf, line_buf + TC_SALT_LEN, TC_DATA_LEN); + + // signature + tc->signature = 0x45555254; // "TRUE" - digest[0] = tc->data_buf[0]; + // fake digest + + memcpy (digest, tc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_06221.c b/src/modules/module_06221.c index e43172a21..e65ce2a46 100644 --- a/src/modules/module_06221.c +++ b/src/modules/module_06221.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "TrueCrypt SHA512 + XTS 512 bit"; static const u64 KERN_TYPE = 6221; @@ -48,6 +48,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define TC_SALT_LEN 64 +#define TC_DATA_LEN 448 +#define TC_HEADER_LEN 512 + typedef struct tc64_tmp { u64 ipad[8]; @@ -60,7 +64,6 @@ typedef struct tc64_tmp typedef struct tc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -222,23 +225,33 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE tc_t *tc = (tc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + // salt - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, TC_SALT_LEN); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_len = TC_SALT_LEN; - salt->salt_len = 4; + // iter salt->salt_iter = ROUNDS_TRUECRYPT_1K - 1; + // data + + memcpy (tc->data_buf, line_buf + TC_SALT_LEN, TC_DATA_LEN); + + // signature + tc->signature = 0x45555254; // "TRUE" - digest[0] = tc->data_buf[0]; + // fake digest + + memcpy (digest, tc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_06222.c b/src/modules/module_06222.c index 2ada45b4f..b46cc7052 100644 --- a/src/modules/module_06222.c +++ b/src/modules/module_06222.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "TrueCrypt SHA512 + XTS 1024 bit"; static const u64 KERN_TYPE = 6222; @@ -48,6 +48,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define TC_SALT_LEN 64 +#define TC_DATA_LEN 448 +#define TC_HEADER_LEN 512 + typedef struct tc64_tmp { u64 ipad[8]; @@ -60,7 +64,6 @@ typedef struct tc64_tmp typedef struct tc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -222,23 +225,33 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE tc_t *tc = (tc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + // salt - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, TC_SALT_LEN); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_len = TC_SALT_LEN; - salt->salt_len = 4; + // iter salt->salt_iter = ROUNDS_TRUECRYPT_1K - 1; + // data + + memcpy (tc->data_buf, line_buf + TC_SALT_LEN, TC_DATA_LEN); + + // signature + tc->signature = 0x45555254; // "TRUE" - digest[0] = tc->data_buf[0]; + // fake digest + + memcpy (digest, tc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_06223.c b/src/modules/module_06223.c index eb1cfca74..c2cffa387 100644 --- a/src/modules/module_06223.c +++ b/src/modules/module_06223.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "TrueCrypt SHA512 + XTS 1536 bit"; static const u64 KERN_TYPE = 6223; @@ -48,6 +48,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define TC_SALT_LEN 64 +#define TC_DATA_LEN 448 +#define TC_HEADER_LEN 512 + typedef struct tc64_tmp { u64 ipad[8]; @@ -60,7 +64,6 @@ typedef struct tc64_tmp typedef struct tc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -222,23 +225,33 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE tc_t *tc = (tc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + // salt - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, TC_SALT_LEN); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_len = TC_SALT_LEN; - salt->salt_len = 4; + // iter salt->salt_iter = ROUNDS_TRUECRYPT_1K - 1; + // data + + memcpy (tc->data_buf, line_buf + TC_SALT_LEN, TC_DATA_LEN); + + // signature + tc->signature = 0x45555254; // "TRUE" - digest[0] = tc->data_buf[0]; + // fake digest + + memcpy (digest, tc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_06231.c b/src/modules/module_06231.c index 759ace2a3..cd1347e02 100644 --- a/src/modules/module_06231.c +++ b/src/modules/module_06231.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "TrueCrypt Whirlpool + XTS 512 bit"; static const u64 KERN_TYPE = 6231; @@ -47,6 +47,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define TC_SALT_LEN 64 +#define TC_DATA_LEN 448 +#define TC_HEADER_LEN 512 + typedef struct tc_tmp { u32 ipad[16]; @@ -59,7 +63,6 @@ typedef struct tc_tmp typedef struct tc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -150,8 +153,6 @@ int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); - - hcfree (tmpdata); return parser_status; @@ -232,23 +233,33 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE tc_t *tc = (tc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + // salt - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, TC_SALT_LEN); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_len = TC_SALT_LEN; - salt->salt_len = 4; + // iter salt->salt_iter = ROUNDS_TRUECRYPT_1K - 1; + // data + + memcpy (tc->data_buf, line_buf + TC_SALT_LEN, TC_DATA_LEN); + + // signature + tc->signature = 0x45555254; // "TRUE" - digest[0] = tc->data_buf[0]; + // fake digest + + memcpy (digest, tc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_06232.c b/src/modules/module_06232.c index 7264eebeb..28e868821 100644 --- a/src/modules/module_06232.c +++ b/src/modules/module_06232.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "TrueCrypt Whirlpool + XTS 1024 bit"; static const u64 KERN_TYPE = 6232; @@ -47,6 +47,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define TC_SALT_LEN 64 +#define TC_DATA_LEN 448 +#define TC_HEADER_LEN 512 + typedef struct tc_tmp { u32 ipad[16]; @@ -59,7 +63,6 @@ typedef struct tc_tmp typedef struct tc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -150,8 +153,6 @@ int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); - - hcfree (tmpdata); return parser_status; @@ -232,23 +233,33 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE tc_t *tc = (tc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + // salt - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, TC_SALT_LEN); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_len = TC_SALT_LEN; - salt->salt_len = 4; + // iter salt->salt_iter = ROUNDS_TRUECRYPT_1K - 1; + // data + + memcpy (tc->data_buf, line_buf + TC_SALT_LEN, TC_DATA_LEN); + + // signature + tc->signature = 0x45555254; // "TRUE" - digest[0] = tc->data_buf[0]; + // fake digest + + memcpy (digest, tc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_06233.c b/src/modules/module_06233.c index a60adb4cf..5810f1b40 100644 --- a/src/modules/module_06233.c +++ b/src/modules/module_06233.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "TrueCrypt Whirlpool + XTS 1536 bit"; static const u64 KERN_TYPE = 6233; @@ -47,6 +47,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define TC_SALT_LEN 64 +#define TC_DATA_LEN 448 +#define TC_HEADER_LEN 512 + typedef struct tc_tmp { u32 ipad[16]; @@ -59,7 +63,6 @@ typedef struct tc_tmp typedef struct tc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -146,8 +149,6 @@ int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); - - hcfree (tmpdata); return parser_status; @@ -228,23 +229,33 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE tc_t *tc = (tc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + // salt - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, TC_SALT_LEN); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_len = TC_SALT_LEN; - salt->salt_len = 4; + // iter salt->salt_iter = ROUNDS_TRUECRYPT_1K - 1; + // data + + memcpy (tc->data_buf, line_buf + TC_SALT_LEN, TC_DATA_LEN); + + // signature + tc->signature = 0x45555254; // "TRUE" - digest[0] = tc->data_buf[0]; + // fake digest + + memcpy (digest, tc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_06241.c b/src/modules/module_06241.c index 3f9c23557..d3d1753e0 100644 --- a/src/modules/module_06241.c +++ b/src/modules/module_06241.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "TrueCrypt RIPEMD160 + XTS 512 bit + boot-mode"; static const u64 KERN_TYPE = 6211; @@ -47,6 +47,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define TC_SALT_LEN 64 +#define TC_DATA_LEN 448 +#define TC_HEADER_LEN 512 + typedef struct tc_tmp { u32 ipad[16]; @@ -59,7 +63,6 @@ typedef struct tc_tmp typedef struct tc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -153,8 +156,6 @@ int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); - - hcfree (tmpdata); return parser_status; @@ -235,23 +236,33 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE tc_t *tc = (tc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + // salt - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, TC_SALT_LEN); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_len = TC_SALT_LEN; - salt->salt_len = 4; + // iter salt->salt_iter = ROUNDS_TRUECRYPT_1K - 1; + // data + + memcpy (tc->data_buf, line_buf + TC_SALT_LEN, TC_DATA_LEN); + + // signature + tc->signature = 0x45555254; // "TRUE" - digest[0] = tc->data_buf[0]; + // fake digest + + memcpy (digest, tc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_06242.c b/src/modules/module_06242.c index 08582a6bb..80e43fc01 100644 --- a/src/modules/module_06242.c +++ b/src/modules/module_06242.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "TrueCrypt RIPEMD160 + XTS 1024 bit + boot-mode"; static const u64 KERN_TYPE = 6212; @@ -47,6 +47,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define TC_SALT_LEN 64 +#define TC_DATA_LEN 448 +#define TC_HEADER_LEN 512 + typedef struct tc_tmp { u32 ipad[16]; @@ -59,7 +63,6 @@ typedef struct tc_tmp typedef struct tc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -153,8 +156,6 @@ int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); - - hcfree (tmpdata); return parser_status; @@ -235,23 +236,33 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE tc_t *tc = (tc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + // salt - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, TC_SALT_LEN); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_len = TC_SALT_LEN; - salt->salt_len = 4; + // iter salt->salt_iter = ROUNDS_TRUECRYPT_1K - 1; + // data + + memcpy (tc->data_buf, line_buf + TC_SALT_LEN, TC_DATA_LEN); + + // signature + tc->signature = 0x45555254; // "TRUE" - digest[0] = tc->data_buf[0]; + // fake digest + + memcpy (digest, tc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_06243.c b/src/modules/module_06243.c index 6f9ebe038..9e5d048c5 100644 --- a/src/modules/module_06243.c +++ b/src/modules/module_06243.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "TrueCrypt RIPEMD160 + XTS 1536 bit + boot-mode"; static const u64 KERN_TYPE = 6213; @@ -47,6 +47,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define TC_SALT_LEN 64 +#define TC_DATA_LEN 448 +#define TC_HEADER_LEN 512 + typedef struct tc_tmp { u32 ipad[16]; @@ -59,7 +63,6 @@ typedef struct tc_tmp typedef struct tc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -153,8 +156,6 @@ int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); - - hcfree (tmpdata); return parser_status; @@ -235,23 +236,33 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE tc_t *tc = (tc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + // salt - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, TC_SALT_LEN); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_len = TC_SALT_LEN; - salt->salt_len = 4; + // iter salt->salt_iter = ROUNDS_TRUECRYPT_1K - 1; + // data + + memcpy (tc->data_buf, line_buf + TC_SALT_LEN, TC_DATA_LEN); + + // signature + tc->signature = 0x45555254; // "TRUE" - digest[0] = tc->data_buf[0]; + // fake digest + + memcpy (digest, tc->data_buf, 112); return (PARSER_OK); }