X-Git-Url: https://www.flypig.org.uk/git/?a=blobdiff_plain;f=OpenCL%2Fm09500.cl;h=765d9f9951ea7fa671ac6dae2e6e86d00db09441;hb=161a6eb4bc643d8e636e96eda613f5137d30da59;hp=4fc5b74c535bcbbe71266323c4a7cab6ad0184d4;hpb=50f39b3563fa429dbec441288bd9a21fc328c21e;p=hashcat.git diff --git a/OpenCL/m09500.cl b/OpenCL/m09500.cl index 4fc5b74..765d9f9 100644 --- a/OpenCL/m09500.cl +++ b/OpenCL/m09500.cl @@ -1,33 +1,20 @@ /** - * Author......: Jens Steube + * Authors.....: Jens Steube + * Gabriele Gristina + * * License.....: MIT */ #define _OFFICE2010_ -#include "include/constants.h" -#include "include/kernel_vendor.h" +#include "inc_vendor.cl" +#include "inc_hash_constants.h" +#include "inc_hash_functions.cl" +#include "inc_types.cl" +#include "inc_common.cl" -#define DGST_R0 0 -#define DGST_R1 1 -#define DGST_R2 2 -#define DGST_R3 3 - -#include "include/kernel_functions.c" -#include "types_ocl.c" -#include "common.c" - -#ifdef VECT_SIZE1 -#define COMPARE_M "check_multi_vect1_comp4.c" -#endif - -#ifdef VECT_SIZE2 -#define COMPARE_M "check_multi_vect2_comp4.c" -#endif - -#ifdef VECT_SIZE4 -#define COMPARE_M "check_multi_vect4_comp4.c" -#endif +#define COMPARE_S "inc_comp_single.cl" +#define COMPARE_M "inc_comp_multi.cl" __constant u32 te0[256] = { @@ -716,7 +703,7 @@ __constant u32 rcon[] = 0x1b000000, 0x36000000, }; -static void AES128_ExpandKey (u32 *userkey, u32 *rek, __local u32 s_te0[256], __local u32 s_te1[256], __local u32 s_te2[256], __local u32 s_te3[256], __local u32 s_te4[256]) +void AES128_ExpandKey (u32 *userkey, u32 *rek, __local u32 *s_te0, __local u32 *s_te1, __local u32 *s_te2, __local u32 *s_te3, __local u32 *s_te4) { rek[0] = userkey[0]; rek[1] = userkey[1]; @@ -742,7 +729,7 @@ static void AES128_ExpandKey (u32 *userkey, u32 *rek, __local u32 s_te0[256], __ } } -static void AES128_InvertKey (u32 *rdk, __local u32 s_td0[256], __local u32 s_td1[256], __local u32 s_td2[256], __local u32 s_td3[256], __local u32 s_td4[256], __local u32 s_te0[256], __local u32 s_te1[256], __local u32 s_te2[256], __local u32 s_te3[256], __local u32 s_te4[256]) +void AES128_InvertKey (u32 *rdk, __local u32 *s_td0, __local u32 *s_td1, __local u32 *s_td2, __local u32 *s_td3, __local u32 *s_td4, __local u32 *s_te0, __local u32 *s_te1, __local u32 *s_te2, __local u32 *s_te3, __local u32 *s_te4) { for (u32 i = 0, j = 40; i < j; i += 4, j -= 4) { @@ -782,7 +769,7 @@ static void AES128_InvertKey (u32 *rdk, __local u32 s_td0[256], __local u32 s_td } } -static void AES128_encrypt (const u32 *in, u32 *out, const u32 *rek, __local u32 s_te0[256], __local u32 s_te1[256], __local u32 s_te2[256], __local u32 s_te3[256], __local u32 s_te4[256]) +void AES128_encrypt (const u32 *in, u32 *out, const u32 *rek, __local u32 *s_te0, __local u32 *s_te1, __local u32 *s_te2, __local u32 *s_te3, __local u32 *s_te4) { u32 s0 = in[0] ^ rek[0]; u32 s1 = in[1] ^ rek[1]; @@ -856,7 +843,7 @@ static void AES128_encrypt (const u32 *in, u32 *out, const u32 *rek, __local u32 ^ rek[43]; } -static void AES128_decrypt (const u32 *in, u32 *out, const u32 *rdk, __local u32 s_td0[256], __local u32 s_td1[256], __local u32 s_td2[256], __local u32 s_td3[256], __local u32 s_td4[256]) +void AES128_decrypt (const u32 *in, u32 *out, const u32 *rdk, __local u32 *s_td0, __local u32 *s_td1, __local u32 *s_td2, __local u32 *s_td3, __local u32 *s_td4) { u32 s0 = in[0] ^ rdk[0]; u32 s1 = in[1] ^ rdk[1]; @@ -930,7 +917,7 @@ static void AES128_decrypt (const u32 *in, u32 *out, const u32 *rdk, __local u32 ^ rdk[43]; } -static void sha1_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[5]) +void sha1_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[5]) { u32 A = digest[0]; u32 B = digest[1]; @@ -1058,7 +1045,7 @@ static void sha1_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], c digest[4] += E; } -__kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m09500_init (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global office2010_tmp_t *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global office2010_t *office2010_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max) +__kernel void m09500_init (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global office2010_tmp_t *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global office2010_t *office2010_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max) { /** * base @@ -1129,22 +1116,22 @@ __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m09500_init (__gl u32 t1[4]; - t1[0] = swap_workaround (w0[0]); - t1[1] = swap_workaround (w0[1]); - t1[2] = swap_workaround (w0[2]); - t1[3] = swap_workaround (w0[3]); + t1[0] = swap32 (w0[0]); + t1[1] = swap32 (w0[1]); + t1[2] = swap32 (w0[2]); + t1[3] = swap32 (w0[3]); u32 t2[4]; - t2[0] = swap_workaround (w1[0]); - t2[1] = swap_workaround (w1[1]); - t2[2] = swap_workaround (w1[2]); - t2[3] = swap_workaround (w1[3]); + t2[0] = swap32 (w1[0]); + t2[1] = swap32 (w1[1]); + t2[2] = swap32 (w1[2]); + t2[3] = swap32 (w1[3]); u32 t3[4]; - t3[0] = swap_workaround (w2[0]); - t3[1] = swap_workaround (w2[1]); + t3[0] = swap32 (w2[0]); + t3[1] = swap32 (w2[1]); t3[2] = 0; t3[3] = (salt_len + (pw_len * 2)) * 8; @@ -1165,7 +1152,7 @@ __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m09500_init (__gl tmps[gid].out[4] = digest[4]; } -__kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m09500_loop (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global office2010_tmp_t *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global office2010_t *office2010_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max) +__kernel void m09500_loop (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global office2010_tmp_t *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global office2010_t *office2010_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max) { const u32 gid = get_global_id (0); @@ -1201,7 +1188,7 @@ __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m09500_loop (__gl for (u32 i = 0, j = loop_pos; i < loop_cnt; i++, j++) { - w0[0] = swap_workaround (j); + w0[0] = swap32 (j); u32 digest[5]; @@ -1227,17 +1214,20 @@ __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m09500_loop (__gl tmps[gid].out[4] = w1[1]; } -__kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m09500_comp (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global office2010_tmp_t *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global office2010_t *office2010_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max) +__kernel void m09500_comp (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global office2010_tmp_t *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global office2010_t *office2010_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max) { + /** + * base + */ + const u32 gid = get_global_id (0); const u32 lid = get_local_id (0); + const u32 lsz = get_local_size (0); /** * aes shared */ - const u32 lid4 = lid * 4; - __local u32 s_td0[256]; __local u32 s_td1[256]; __local u32 s_td2[256]; @@ -1250,60 +1240,29 @@ __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m09500_comp (__gl __local u32 s_te3[256]; __local u32 s_te4[256]; - s_td0[lid4 + 0] = td0[lid4 + 0]; - s_td0[lid4 + 1] = td0[lid4 + 1]; - s_td0[lid4 + 2] = td0[lid4 + 2]; - s_td0[lid4 + 3] = td0[lid4 + 3]; - - s_td1[lid4 + 0] = td1[lid4 + 0]; - s_td1[lid4 + 1] = td1[lid4 + 1]; - s_td1[lid4 + 2] = td1[lid4 + 2]; - s_td1[lid4 + 3] = td1[lid4 + 3]; - - s_td2[lid4 + 0] = td2[lid4 + 0]; - s_td2[lid4 + 1] = td2[lid4 + 1]; - s_td2[lid4 + 2] = td2[lid4 + 2]; - s_td2[lid4 + 3] = td2[lid4 + 3]; - - s_td3[lid4 + 0] = td3[lid4 + 0]; - s_td3[lid4 + 1] = td3[lid4 + 1]; - s_td3[lid4 + 2] = td3[lid4 + 2]; - s_td3[lid4 + 3] = td3[lid4 + 3]; - - s_td4[lid4 + 0] = td4[lid4 + 0]; - s_td4[lid4 + 1] = td4[lid4 + 1]; - s_td4[lid4 + 2] = td4[lid4 + 2]; - s_td4[lid4 + 3] = td4[lid4 + 3]; - - s_te0[lid4 + 0] = te0[lid4 + 0]; - s_te0[lid4 + 1] = te0[lid4 + 1]; - s_te0[lid4 + 2] = te0[lid4 + 2]; - s_te0[lid4 + 3] = te0[lid4 + 3]; - - s_te1[lid4 + 0] = te1[lid4 + 0]; - s_te1[lid4 + 1] = te1[lid4 + 1]; - s_te1[lid4 + 2] = te1[lid4 + 2]; - s_te1[lid4 + 3] = te1[lid4 + 3]; - - s_te2[lid4 + 0] = te2[lid4 + 0]; - s_te2[lid4 + 1] = te2[lid4 + 1]; - s_te2[lid4 + 2] = te2[lid4 + 2]; - s_te2[lid4 + 3] = te2[lid4 + 3]; - - s_te3[lid4 + 0] = te3[lid4 + 0]; - s_te3[lid4 + 1] = te3[lid4 + 1]; - s_te3[lid4 + 2] = te3[lid4 + 2]; - s_te3[lid4 + 3] = te3[lid4 + 3]; - - s_te4[lid4 + 0] = te4[lid4 + 0]; - s_te4[lid4 + 1] = te4[lid4 + 1]; - s_te4[lid4 + 2] = te4[lid4 + 2]; - s_te4[lid4 + 3] = te4[lid4 + 3]; + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } barrier (CLK_LOCAL_MEM_FENCE); if (gid >= gid_max) return; + /** + * base + */ + u32 encryptedVerifierHashInputBlockKey[2] = { 0xfea7d276, 0x3b4b9e79 }; u32 encryptedVerifierHashValueBlockKey[2] = { 0xd7aa0f6d, 0x3061344e };