2 * Author......: Jens Steube <jens.steube@gmail.com>
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
28 #include "include/kernel_functions.c"
29 #include "types_amd.c"
30 #include "common_amd.c"
31 #include "include/rp_gpu.h"
35 #define VECT_COMPARE_S "check_single_vect1_comp4.c"
36 #define VECT_COMPARE_M "check_multi_vect1_comp4.c"
40 #define VECT_COMPARE_S "check_single_vect2_comp4.c"
41 #define VECT_COMPARE_M "check_multi_vect2_comp4.c"
45 #define VECT_COMPARE_S "check_single_vect4_comp4.c"
46 #define VECT_COMPARE_M "check_multi_vect4_comp4.c"
49 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00900_m04 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *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 void *esalt_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)
55 const u32 lid = get_local_id (0);
61 const u32 gid = get_global_id (0);
63 if (gid >= gid_max) return;
67 pw_buf0[0] = pws[gid].i[ 0];
68 pw_buf0[1] = pws[gid].i[ 1];
69 pw_buf0[2] = pws[gid].i[ 2];
70 pw_buf0[3] = pws[gid].i[ 3];
74 pw_buf1[0] = pws[gid].i[ 4];
75 pw_buf1[1] = pws[gid].i[ 5];
76 pw_buf1[2] = pws[gid].i[ 6];
77 pw_buf1[3] = pws[gid].i[ 7];
79 const u32 pw_len = pws[gid].pw_len;
85 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
115 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
117 append_0x80_2 (w0, w1, out_len);
126 MD4_STEP (MD4_Fo, a, b, c, d, w0[0], MD4C00, MD4S00);
127 MD4_STEP (MD4_Fo, d, a, b, c, w0[1], MD4C00, MD4S01);
128 MD4_STEP (MD4_Fo, c, d, a, b, w0[2], MD4C00, MD4S02);
129 MD4_STEP (MD4_Fo, b, c, d, a, w0[3], MD4C00, MD4S03);
130 MD4_STEP (MD4_Fo, a, b, c, d, w1[0], MD4C00, MD4S00);
131 MD4_STEP (MD4_Fo, d, a, b, c, w1[1], MD4C00, MD4S01);
132 MD4_STEP (MD4_Fo, c, d, a, b, w1[2], MD4C00, MD4S02);
133 MD4_STEP (MD4_Fo, b, c, d, a, w1[3], MD4C00, MD4S03);
134 MD4_STEP (MD4_Fo, a, b, c, d, w2[0], MD4C00, MD4S00);
135 MD4_STEP (MD4_Fo, d, a, b, c, w2[1], MD4C00, MD4S01);
136 MD4_STEP (MD4_Fo, c, d, a, b, w2[2], MD4C00, MD4S02);
137 MD4_STEP (MD4_Fo, b, c, d, a, w2[3], MD4C00, MD4S03);
138 MD4_STEP (MD4_Fo, a, b, c, d, w3[0], MD4C00, MD4S00);
139 MD4_STEP (MD4_Fo, d, a, b, c, w3[1], MD4C00, MD4S01);
140 MD4_STEP (MD4_Fo, c, d, a, b, w3[2], MD4C00, MD4S02);
141 MD4_STEP (MD4_Fo, b, c, d, a, w3[3], MD4C00, MD4S03);
143 MD4_STEP (MD4_Go, a, b, c, d, w0[0], MD4C01, MD4S10);
144 MD4_STEP (MD4_Go, d, a, b, c, w1[0], MD4C01, MD4S11);
145 MD4_STEP (MD4_Go, c, d, a, b, w2[0], MD4C01, MD4S12);
146 MD4_STEP (MD4_Go, b, c, d, a, w3[0], MD4C01, MD4S13);
147 MD4_STEP (MD4_Go, a, b, c, d, w0[1], MD4C01, MD4S10);
148 MD4_STEP (MD4_Go, d, a, b, c, w1[1], MD4C01, MD4S11);
149 MD4_STEP (MD4_Go, c, d, a, b, w2[1], MD4C01, MD4S12);
150 MD4_STEP (MD4_Go, b, c, d, a, w3[1], MD4C01, MD4S13);
151 MD4_STEP (MD4_Go, a, b, c, d, w0[2], MD4C01, MD4S10);
152 MD4_STEP (MD4_Go, d, a, b, c, w1[2], MD4C01, MD4S11);
153 MD4_STEP (MD4_Go, c, d, a, b, w2[2], MD4C01, MD4S12);
154 MD4_STEP (MD4_Go, b, c, d, a, w3[2], MD4C01, MD4S13);
155 MD4_STEP (MD4_Go, a, b, c, d, w0[3], MD4C01, MD4S10);
156 MD4_STEP (MD4_Go, d, a, b, c, w1[3], MD4C01, MD4S11);
157 MD4_STEP (MD4_Go, c, d, a, b, w2[3], MD4C01, MD4S12);
158 MD4_STEP (MD4_Go, b, c, d, a, w3[3], MD4C01, MD4S13);
160 MD4_STEP (MD4_H , a, b, c, d, w0[0], MD4C02, MD4S20);
161 MD4_STEP (MD4_H , d, a, b, c, w2[0], MD4C02, MD4S21);
162 MD4_STEP (MD4_H , c, d, a, b, w1[0], MD4C02, MD4S22);
163 MD4_STEP (MD4_H , b, c, d, a, w3[0], MD4C02, MD4S23);
164 MD4_STEP (MD4_H , a, b, c, d, w0[2], MD4C02, MD4S20);
165 MD4_STEP (MD4_H , d, a, b, c, w2[2], MD4C02, MD4S21);
166 MD4_STEP (MD4_H , c, d, a, b, w1[2], MD4C02, MD4S22);
167 MD4_STEP (MD4_H , b, c, d, a, w3[2], MD4C02, MD4S23);
168 MD4_STEP (MD4_H , a, b, c, d, w0[1], MD4C02, MD4S20);
169 MD4_STEP (MD4_H , d, a, b, c, w2[1], MD4C02, MD4S21);
170 MD4_STEP (MD4_H , c, d, a, b, w1[1], MD4C02, MD4S22);
171 MD4_STEP (MD4_H , b, c, d, a, w3[1], MD4C02, MD4S23);
172 MD4_STEP (MD4_H , a, b, c, d, w0[3], MD4C02, MD4S20);
173 MD4_STEP (MD4_H , d, a, b, c, w2[3], MD4C02, MD4S21);
174 MD4_STEP (MD4_H , c, d, a, b, w1[3], MD4C02, MD4S22);
175 MD4_STEP (MD4_H , b, c, d, a, w3[3], MD4C02, MD4S23);
182 #include VECT_COMPARE_M
186 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00900_m08 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *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 void *esalt_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
190 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00900_m16 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *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 void *esalt_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
194 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00900_s04 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *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 void *esalt_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)
200 const u32 lid = get_local_id (0);
206 const u32 gid = get_global_id (0);
208 if (gid >= gid_max) return;
212 pw_buf0[0] = pws[gid].i[ 0];
213 pw_buf0[1] = pws[gid].i[ 1];
214 pw_buf0[2] = pws[gid].i[ 2];
215 pw_buf0[3] = pws[gid].i[ 3];
219 pw_buf1[0] = pws[gid].i[ 4];
220 pw_buf1[1] = pws[gid].i[ 5];
221 pw_buf1[2] = pws[gid].i[ 6];
222 pw_buf1[3] = pws[gid].i[ 7];
224 const u32 pw_len = pws[gid].pw_len;
230 const u32 search[4] =
232 digests_buf[digests_offset].digest_buf[DGST_R0],
233 digests_buf[digests_offset].digest_buf[DGST_R1],
234 digests_buf[digests_offset].digest_buf[DGST_R2],
235 digests_buf[digests_offset].digest_buf[DGST_R3]
242 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
272 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
274 append_0x80_2 (w0, w1, out_len);
283 MD4_STEP (MD4_Fo, a, b, c, d, w0[0], MD4C00, MD4S00);
284 MD4_STEP (MD4_Fo, d, a, b, c, w0[1], MD4C00, MD4S01);
285 MD4_STEP (MD4_Fo, c, d, a, b, w0[2], MD4C00, MD4S02);
286 MD4_STEP (MD4_Fo, b, c, d, a, w0[3], MD4C00, MD4S03);
287 MD4_STEP (MD4_Fo, a, b, c, d, w1[0], MD4C00, MD4S00);
288 MD4_STEP (MD4_Fo, d, a, b, c, w1[1], MD4C00, MD4S01);
289 MD4_STEP (MD4_Fo, c, d, a, b, w1[2], MD4C00, MD4S02);
290 MD4_STEP (MD4_Fo, b, c, d, a, w1[3], MD4C00, MD4S03);
291 MD4_STEP (MD4_Fo, a, b, c, d, w2[0], MD4C00, MD4S00);
292 MD4_STEP (MD4_Fo, d, a, b, c, w2[1], MD4C00, MD4S01);
293 MD4_STEP (MD4_Fo, c, d, a, b, w2[2], MD4C00, MD4S02);
294 MD4_STEP (MD4_Fo, b, c, d, a, w2[3], MD4C00, MD4S03);
295 MD4_STEP (MD4_Fo, a, b, c, d, w3[0], MD4C00, MD4S00);
296 MD4_STEP (MD4_Fo, d, a, b, c, w3[1], MD4C00, MD4S01);
297 MD4_STEP (MD4_Fo, c, d, a, b, w3[2], MD4C00, MD4S02);
298 MD4_STEP (MD4_Fo, b, c, d, a, w3[3], MD4C00, MD4S03);
300 MD4_STEP (MD4_Go, a, b, c, d, w0[0], MD4C01, MD4S10);
301 MD4_STEP (MD4_Go, d, a, b, c, w1[0], MD4C01, MD4S11);
302 MD4_STEP (MD4_Go, c, d, a, b, w2[0], MD4C01, MD4S12);
303 MD4_STEP (MD4_Go, b, c, d, a, w3[0], MD4C01, MD4S13);
304 MD4_STEP (MD4_Go, a, b, c, d, w0[1], MD4C01, MD4S10);
305 MD4_STEP (MD4_Go, d, a, b, c, w1[1], MD4C01, MD4S11);
306 MD4_STEP (MD4_Go, c, d, a, b, w2[1], MD4C01, MD4S12);
307 MD4_STEP (MD4_Go, b, c, d, a, w3[1], MD4C01, MD4S13);
308 MD4_STEP (MD4_Go, a, b, c, d, w0[2], MD4C01, MD4S10);
309 MD4_STEP (MD4_Go, d, a, b, c, w1[2], MD4C01, MD4S11);
310 MD4_STEP (MD4_Go, c, d, a, b, w2[2], MD4C01, MD4S12);
311 MD4_STEP (MD4_Go, b, c, d, a, w3[2], MD4C01, MD4S13);
312 MD4_STEP (MD4_Go, a, b, c, d, w0[3], MD4C01, MD4S10);
313 MD4_STEP (MD4_Go, d, a, b, c, w1[3], MD4C01, MD4S11);
314 MD4_STEP (MD4_Go, c, d, a, b, w2[3], MD4C01, MD4S12);
315 MD4_STEP (MD4_Go, b, c, d, a, w3[3], MD4C01, MD4S13);
317 MD4_STEP (MD4_H , a, b, c, d, w0[0], MD4C02, MD4S20);
318 MD4_STEP (MD4_H , d, a, b, c, w2[0], MD4C02, MD4S21);
319 MD4_STEP (MD4_H , c, d, a, b, w1[0], MD4C02, MD4S22);
320 MD4_STEP (MD4_H , b, c, d, a, w3[0], MD4C02, MD4S23);
321 MD4_STEP (MD4_H , a, b, c, d, w0[2], MD4C02, MD4S20);
322 MD4_STEP (MD4_H , d, a, b, c, w2[2], MD4C02, MD4S21);
323 MD4_STEP (MD4_H , c, d, a, b, w1[2], MD4C02, MD4S22);
324 MD4_STEP (MD4_H , b, c, d, a, w3[2], MD4C02, MD4S23);
325 MD4_STEP (MD4_H , a, b, c, d, w0[1], MD4C02, MD4S20);
326 MD4_STEP (MD4_H , d, a, b, c, w2[1], MD4C02, MD4S21);
327 MD4_STEP (MD4_H , c, d, a, b, w1[1], MD4C02, MD4S22);
328 MD4_STEP (MD4_H , b, c, d, a, w3[1], MD4C02, MD4S23);
329 MD4_STEP (MD4_H , a, b, c, d, w0[3], MD4C02, MD4S20);
330 MD4_STEP (MD4_H , d, a, b, c, w2[3], MD4C02, MD4S21);
331 MD4_STEP (MD4_H , c, d, a, b, w1[3], MD4C02, MD4S22);
332 MD4_STEP (MD4_H , b, c, d, a, w3[3], MD4C02, MD4S23);
339 #include VECT_COMPARE_S
343 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00900_s08 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *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 void *esalt_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
347 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00900_s16 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *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 void *esalt_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)