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"
33 #define VECT_COMPARE_S "check_single_vect1_comp4.c"
34 #define VECT_COMPARE_M "check_multi_vect1_comp4.c"
38 #define VECT_COMPARE_S "check_single_vect2_comp4.c"
39 #define VECT_COMPARE_M "check_multi_vect2_comp4.c"
43 #define VECT_COMPARE_S "check_single_vect4_comp4.c"
44 #define VECT_COMPARE_M "check_multi_vect4_comp4.c"
47 __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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
53 const u32 lid = get_local_id (0);
59 const u32 gid = get_global_id (0);
61 if (gid >= gid_max) return;
65 wordl0[0] = pws[gid].i[ 0];
66 wordl0[1] = pws[gid].i[ 1];
67 wordl0[2] = pws[gid].i[ 2];
68 wordl0[3] = pws[gid].i[ 3];
72 wordl1[0] = pws[gid].i[ 4];
73 wordl1[1] = pws[gid].i[ 5];
74 wordl1[2] = pws[gid].i[ 6];
75 wordl1[3] = pws[gid].i[ 7];
91 const u32 pw_l_len = pws[gid].pw_len;
93 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
95 append_0x80_2 (wordl0, wordl1, pw_l_len);
97 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
104 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
106 const u32 pw_r_len = combs_buf[il_pos].pw_len;
108 const u32 pw_len = pw_l_len + pw_r_len;
112 wordr0[0] = combs_buf[il_pos].i[0];
113 wordr0[1] = combs_buf[il_pos].i[1];
114 wordr0[2] = combs_buf[il_pos].i[2];
115 wordr0[3] = combs_buf[il_pos].i[3];
119 wordr1[0] = combs_buf[il_pos].i[4];
120 wordr1[1] = combs_buf[il_pos].i[5];
121 wordr1[2] = combs_buf[il_pos].i[6];
122 wordr1[3] = combs_buf[il_pos].i[7];
138 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
140 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
145 w0[0] = wordl0[0] | wordr0[0];
146 w0[1] = wordl0[1] | wordr0[1];
147 w0[2] = wordl0[2] | wordr0[2];
148 w0[3] = wordl0[3] | wordr0[3];
152 w1[0] = wordl1[0] | wordr1[0];
153 w1[1] = wordl1[1] | wordr1[1];
154 w1[2] = wordl1[2] | wordr1[2];
155 w1[3] = wordl1[3] | wordr1[3];
159 w2[0] = wordl2[0] | wordr2[0];
160 w2[1] = wordl2[1] | wordr2[1];
161 w2[2] = wordl2[2] | wordr2[2];
162 w2[3] = wordl2[3] | wordr2[3];
166 w3[0] = wordl3[0] | wordr3[0];
167 w3[1] = wordl3[1] | wordr3[1];
176 MD4_STEP (MD4_Fo, a, b, c, d, w0[0], MD4C00, MD4S00);
177 MD4_STEP (MD4_Fo, d, a, b, c, w0[1], MD4C00, MD4S01);
178 MD4_STEP (MD4_Fo, c, d, a, b, w0[2], MD4C00, MD4S02);
179 MD4_STEP (MD4_Fo, b, c, d, a, w0[3], MD4C00, MD4S03);
180 MD4_STEP (MD4_Fo, a, b, c, d, w1[0], MD4C00, MD4S00);
181 MD4_STEP (MD4_Fo, d, a, b, c, w1[1], MD4C00, MD4S01);
182 MD4_STEP (MD4_Fo, c, d, a, b, w1[2], MD4C00, MD4S02);
183 MD4_STEP (MD4_Fo, b, c, d, a, w1[3], MD4C00, MD4S03);
184 MD4_STEP (MD4_Fo, a, b, c, d, w2[0], MD4C00, MD4S00);
185 MD4_STEP (MD4_Fo, d, a, b, c, w2[1], MD4C00, MD4S01);
186 MD4_STEP (MD4_Fo, c, d, a, b, w2[2], MD4C00, MD4S02);
187 MD4_STEP (MD4_Fo, b, c, d, a, w2[3], MD4C00, MD4S03);
188 MD4_STEP (MD4_Fo, a, b, c, d, w3[0], MD4C00, MD4S00);
189 MD4_STEP (MD4_Fo, d, a, b, c, w3[1], MD4C00, MD4S01);
190 MD4_STEP (MD4_Fo, c, d, a, b, w3[2], MD4C00, MD4S02);
191 MD4_STEP (MD4_Fo, b, c, d, a, w3[3], MD4C00, MD4S03);
193 MD4_STEP (MD4_Go, a, b, c, d, w0[0], MD4C01, MD4S10);
194 MD4_STEP (MD4_Go, d, a, b, c, w1[0], MD4C01, MD4S11);
195 MD4_STEP (MD4_Go, c, d, a, b, w2[0], MD4C01, MD4S12);
196 MD4_STEP (MD4_Go, b, c, d, a, w3[0], MD4C01, MD4S13);
197 MD4_STEP (MD4_Go, a, b, c, d, w0[1], MD4C01, MD4S10);
198 MD4_STEP (MD4_Go, d, a, b, c, w1[1], MD4C01, MD4S11);
199 MD4_STEP (MD4_Go, c, d, a, b, w2[1], MD4C01, MD4S12);
200 MD4_STEP (MD4_Go, b, c, d, a, w3[1], MD4C01, MD4S13);
201 MD4_STEP (MD4_Go, a, b, c, d, w0[2], MD4C01, MD4S10);
202 MD4_STEP (MD4_Go, d, a, b, c, w1[2], MD4C01, MD4S11);
203 MD4_STEP (MD4_Go, c, d, a, b, w2[2], MD4C01, MD4S12);
204 MD4_STEP (MD4_Go, b, c, d, a, w3[2], MD4C01, MD4S13);
205 MD4_STEP (MD4_Go, a, b, c, d, w0[3], MD4C01, MD4S10);
206 MD4_STEP (MD4_Go, d, a, b, c, w1[3], MD4C01, MD4S11);
207 MD4_STEP (MD4_Go, c, d, a, b, w2[3], MD4C01, MD4S12);
208 MD4_STEP (MD4_Go, b, c, d, a, w3[3], MD4C01, MD4S13);
210 MD4_STEP (MD4_H , a, b, c, d, w0[0], MD4C02, MD4S20);
211 MD4_STEP (MD4_H , d, a, b, c, w2[0], MD4C02, MD4S21);
212 MD4_STEP (MD4_H , c, d, a, b, w1[0], MD4C02, MD4S22);
213 MD4_STEP (MD4_H , b, c, d, a, w3[0], MD4C02, MD4S23);
214 MD4_STEP (MD4_H , a, b, c, d, w0[2], MD4C02, MD4S20);
215 MD4_STEP (MD4_H , d, a, b, c, w2[2], MD4C02, MD4S21);
216 MD4_STEP (MD4_H , c, d, a, b, w1[2], MD4C02, MD4S22);
217 MD4_STEP (MD4_H , b, c, d, a, w3[2], MD4C02, MD4S23);
218 MD4_STEP (MD4_H , a, b, c, d, w0[1], MD4C02, MD4S20);
219 MD4_STEP (MD4_H , d, a, b, c, w2[1], MD4C02, MD4S21);
220 MD4_STEP (MD4_H , c, d, a, b, w1[1], MD4C02, MD4S22);
221 MD4_STEP (MD4_H , b, c, d, a, w3[1], MD4C02, MD4S23);
222 MD4_STEP (MD4_H , a, b, c, d, w0[3], MD4C02, MD4S20);
223 MD4_STEP (MD4_H , d, a, b, c, w2[3], MD4C02, MD4S21);
224 MD4_STEP (MD4_H , c, d, a, b, w1[3], MD4C02, MD4S22);
225 MD4_STEP (MD4_H , b, c, d, a, w3[3], MD4C02, MD4S23);
232 #include VECT_COMPARE_M
236 __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)
240 __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)
244 __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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
250 const u32 lid = get_local_id (0);
256 const u32 gid = get_global_id (0);
258 if (gid >= gid_max) return;
262 wordl0[0] = pws[gid].i[ 0];
263 wordl0[1] = pws[gid].i[ 1];
264 wordl0[2] = pws[gid].i[ 2];
265 wordl0[3] = pws[gid].i[ 3];
269 wordl1[0] = pws[gid].i[ 4];
270 wordl1[1] = pws[gid].i[ 5];
271 wordl1[2] = pws[gid].i[ 6];
272 wordl1[3] = pws[gid].i[ 7];
288 const u32 pw_l_len = pws[gid].pw_len;
290 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
292 append_0x80_2 (wordl0, wordl1, pw_l_len);
294 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
301 const u32 search[4] =
303 digests_buf[digests_offset].digest_buf[DGST_R0],
304 digests_buf[digests_offset].digest_buf[DGST_R1],
305 digests_buf[digests_offset].digest_buf[DGST_R2],
306 digests_buf[digests_offset].digest_buf[DGST_R3]
313 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
315 const u32 pw_r_len = combs_buf[il_pos].pw_len;
317 const u32 pw_len = pw_l_len + pw_r_len;
321 wordr0[0] = combs_buf[il_pos].i[0];
322 wordr0[1] = combs_buf[il_pos].i[1];
323 wordr0[2] = combs_buf[il_pos].i[2];
324 wordr0[3] = combs_buf[il_pos].i[3];
328 wordr1[0] = combs_buf[il_pos].i[4];
329 wordr1[1] = combs_buf[il_pos].i[5];
330 wordr1[2] = combs_buf[il_pos].i[6];
331 wordr1[3] = combs_buf[il_pos].i[7];
347 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
349 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
354 w0[0] = wordl0[0] | wordr0[0];
355 w0[1] = wordl0[1] | wordr0[1];
356 w0[2] = wordl0[2] | wordr0[2];
357 w0[3] = wordl0[3] | wordr0[3];
361 w1[0] = wordl1[0] | wordr1[0];
362 w1[1] = wordl1[1] | wordr1[1];
363 w1[2] = wordl1[2] | wordr1[2];
364 w1[3] = wordl1[3] | wordr1[3];
368 w2[0] = wordl2[0] | wordr2[0];
369 w2[1] = wordl2[1] | wordr2[1];
370 w2[2] = wordl2[2] | wordr2[2];
371 w2[3] = wordl2[3] | wordr2[3];
375 w3[0] = wordl3[0] | wordr3[0];
376 w3[1] = wordl3[1] | wordr3[1];
385 MD4_STEP (MD4_Fo, a, b, c, d, w0[0], MD4C00, MD4S00);
386 MD4_STEP (MD4_Fo, d, a, b, c, w0[1], MD4C00, MD4S01);
387 MD4_STEP (MD4_Fo, c, d, a, b, w0[2], MD4C00, MD4S02);
388 MD4_STEP (MD4_Fo, b, c, d, a, w0[3], MD4C00, MD4S03);
389 MD4_STEP (MD4_Fo, a, b, c, d, w1[0], MD4C00, MD4S00);
390 MD4_STEP (MD4_Fo, d, a, b, c, w1[1], MD4C00, MD4S01);
391 MD4_STEP (MD4_Fo, c, d, a, b, w1[2], MD4C00, MD4S02);
392 MD4_STEP (MD4_Fo, b, c, d, a, w1[3], MD4C00, MD4S03);
393 MD4_STEP (MD4_Fo, a, b, c, d, w2[0], MD4C00, MD4S00);
394 MD4_STEP (MD4_Fo, d, a, b, c, w2[1], MD4C00, MD4S01);
395 MD4_STEP (MD4_Fo, c, d, a, b, w2[2], MD4C00, MD4S02);
396 MD4_STEP (MD4_Fo, b, c, d, a, w2[3], MD4C00, MD4S03);
397 MD4_STEP (MD4_Fo, a, b, c, d, w3[0], MD4C00, MD4S00);
398 MD4_STEP (MD4_Fo, d, a, b, c, w3[1], MD4C00, MD4S01);
399 MD4_STEP (MD4_Fo, c, d, a, b, w3[2], MD4C00, MD4S02);
400 MD4_STEP (MD4_Fo, b, c, d, a, w3[3], MD4C00, MD4S03);
402 MD4_STEP (MD4_Go, a, b, c, d, w0[0], MD4C01, MD4S10);
403 MD4_STEP (MD4_Go, d, a, b, c, w1[0], MD4C01, MD4S11);
404 MD4_STEP (MD4_Go, c, d, a, b, w2[0], MD4C01, MD4S12);
405 MD4_STEP (MD4_Go, b, c, d, a, w3[0], MD4C01, MD4S13);
406 MD4_STEP (MD4_Go, a, b, c, d, w0[1], MD4C01, MD4S10);
407 MD4_STEP (MD4_Go, d, a, b, c, w1[1], MD4C01, MD4S11);
408 MD4_STEP (MD4_Go, c, d, a, b, w2[1], MD4C01, MD4S12);
409 MD4_STEP (MD4_Go, b, c, d, a, w3[1], MD4C01, MD4S13);
410 MD4_STEP (MD4_Go, a, b, c, d, w0[2], MD4C01, MD4S10);
411 MD4_STEP (MD4_Go, d, a, b, c, w1[2], MD4C01, MD4S11);
412 MD4_STEP (MD4_Go, c, d, a, b, w2[2], MD4C01, MD4S12);
413 MD4_STEP (MD4_Go, b, c, d, a, w3[2], MD4C01, MD4S13);
414 MD4_STEP (MD4_Go, a, b, c, d, w0[3], MD4C01, MD4S10);
415 MD4_STEP (MD4_Go, d, a, b, c, w1[3], MD4C01, MD4S11);
416 MD4_STEP (MD4_Go, c, d, a, b, w2[3], MD4C01, MD4S12);
417 MD4_STEP (MD4_Go, b, c, d, a, w3[3], MD4C01, MD4S13);
419 MD4_STEP (MD4_H , a, b, c, d, w0[0], MD4C02, MD4S20);
420 MD4_STEP (MD4_H , d, a, b, c, w2[0], MD4C02, MD4S21);
421 MD4_STEP (MD4_H , c, d, a, b, w1[0], MD4C02, MD4S22);
422 MD4_STEP (MD4_H , b, c, d, a, w3[0], MD4C02, MD4S23);
423 MD4_STEP (MD4_H , a, b, c, d, w0[2], MD4C02, MD4S20);
424 MD4_STEP (MD4_H , d, a, b, c, w2[2], MD4C02, MD4S21);
425 MD4_STEP (MD4_H , c, d, a, b, w1[2], MD4C02, MD4S22);
426 MD4_STEP (MD4_H , b, c, d, a, w3[2], MD4C02, MD4S23);
427 MD4_STEP (MD4_H , a, b, c, d, w0[1], MD4C02, MD4S20);
428 MD4_STEP (MD4_H , d, a, b, c, w2[1], MD4C02, MD4S21);
429 MD4_STEP (MD4_H , c, d, a, b, w1[1], MD4C02, MD4S22);
430 MD4_STEP (MD4_H , b, c, d, a, w3[1], MD4C02, MD4S23);
431 MD4_STEP (MD4_H , a, b, c, d, w0[3], MD4C02, MD4S20);
432 MD4_STEP (MD4_H , d, a, b, c, w2[3], MD4C02, MD4S21);
433 MD4_STEP (MD4_H , c, d, a, b, w1[3], MD4C02, MD4S22);
434 MD4_STEP (MD4_H , b, c, d, a, w3[3], MD4C02, MD4S23);
441 #include VECT_COMPARE_S
445 __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)
449 __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)