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_vect4_comp4.c"
39 #define VECT_COMPARE_M "check_multi_vect4_comp4.c"
42 static void md5_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[4])
66 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
67 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
68 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
69 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
70 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
71 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
72 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
73 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
74 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
75 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
76 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
77 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
78 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
79 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
80 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
81 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
83 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
84 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
85 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
86 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
87 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
88 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
89 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
90 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
91 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
92 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
93 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
94 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
95 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
96 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
97 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
98 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
100 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
101 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
102 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
103 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
104 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
105 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
106 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
107 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
108 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
109 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
110 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
111 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
112 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
113 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
114 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
115 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
117 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
118 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
119 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
120 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
121 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
122 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
123 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
124 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
125 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
126 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
127 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
128 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
129 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
130 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
131 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
132 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
140 static void hmac_md5_pad (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], u32x ipad[4], u32x opad[4])
142 w0[0] = w0[0] ^ 0x36363636;
143 w0[1] = w0[1] ^ 0x36363636;
144 w0[2] = w0[2] ^ 0x36363636;
145 w0[3] = w0[3] ^ 0x36363636;
146 w1[0] = w1[0] ^ 0x36363636;
147 w1[1] = w1[1] ^ 0x36363636;
148 w1[2] = w1[2] ^ 0x36363636;
149 w1[3] = w1[3] ^ 0x36363636;
150 w2[0] = w2[0] ^ 0x36363636;
151 w2[1] = w2[1] ^ 0x36363636;
152 w2[2] = w2[2] ^ 0x36363636;
153 w2[3] = w2[3] ^ 0x36363636;
154 w3[0] = w3[0] ^ 0x36363636;
155 w3[1] = w3[1] ^ 0x36363636;
156 w3[2] = w3[2] ^ 0x36363636;
157 w3[3] = w3[3] ^ 0x36363636;
164 md5_transform (w0, w1, w2, w3, ipad);
166 w0[0] = w0[0] ^ 0x6a6a6a6a;
167 w0[1] = w0[1] ^ 0x6a6a6a6a;
168 w0[2] = w0[2] ^ 0x6a6a6a6a;
169 w0[3] = w0[3] ^ 0x6a6a6a6a;
170 w1[0] = w1[0] ^ 0x6a6a6a6a;
171 w1[1] = w1[1] ^ 0x6a6a6a6a;
172 w1[2] = w1[2] ^ 0x6a6a6a6a;
173 w1[3] = w1[3] ^ 0x6a6a6a6a;
174 w2[0] = w2[0] ^ 0x6a6a6a6a;
175 w2[1] = w2[1] ^ 0x6a6a6a6a;
176 w2[2] = w2[2] ^ 0x6a6a6a6a;
177 w2[3] = w2[3] ^ 0x6a6a6a6a;
178 w3[0] = w3[0] ^ 0x6a6a6a6a;
179 w3[1] = w3[1] ^ 0x6a6a6a6a;
180 w3[2] = w3[2] ^ 0x6a6a6a6a;
181 w3[3] = w3[3] ^ 0x6a6a6a6a;
188 md5_transform (w0, w1, w2, w3, opad);
191 static void hmac_md5_run (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], u32x ipad[4], u32x opad[4], u32x digest[4])
198 md5_transform (w0, w1, w2, w3, digest);
214 w3[2] = (64 + 16) * 8;
222 md5_transform (w0, w1, w2, w3, digest);
225 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m05300_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 ikepsk_t *ikepsk_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)
231 const u32 lid = get_local_id (0);
237 const u32 gid = get_global_id (0);
241 wordl0[0] = pws[gid].i[ 0];
242 wordl0[1] = pws[gid].i[ 1];
243 wordl0[2] = pws[gid].i[ 2];
244 wordl0[3] = pws[gid].i[ 3];
248 wordl1[0] = pws[gid].i[ 4];
249 wordl1[1] = pws[gid].i[ 5];
250 wordl1[2] = pws[gid].i[ 6];
251 wordl1[3] = pws[gid].i[ 7];
267 const u32 pw_l_len = pws[gid].pw_len;
269 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
271 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
278 const u32 nr_len = ikepsk_bufs[salt_pos].nr_len;
279 const u32 msg_len = ikepsk_bufs[salt_pos].msg_len;
283 salt_buf0[0] = ikepsk_bufs[salt_pos].nr_buf[ 0];
284 salt_buf0[1] = ikepsk_bufs[salt_pos].nr_buf[ 1];
285 salt_buf0[2] = ikepsk_bufs[salt_pos].nr_buf[ 2];
286 salt_buf0[3] = ikepsk_bufs[salt_pos].nr_buf[ 3];
290 salt_buf1[0] = ikepsk_bufs[salt_pos].nr_buf[ 4];
291 salt_buf1[1] = ikepsk_bufs[salt_pos].nr_buf[ 5];
292 salt_buf1[2] = ikepsk_bufs[salt_pos].nr_buf[ 6];
293 salt_buf1[3] = ikepsk_bufs[salt_pos].nr_buf[ 7];
297 salt_buf2[0] = ikepsk_bufs[salt_pos].nr_buf[ 8];
298 salt_buf2[1] = ikepsk_bufs[salt_pos].nr_buf[ 9];
299 salt_buf2[2] = ikepsk_bufs[salt_pos].nr_buf[10];
300 salt_buf2[3] = ikepsk_bufs[salt_pos].nr_buf[11];
304 salt_buf3[0] = ikepsk_bufs[salt_pos].nr_buf[12];
305 salt_buf3[1] = ikepsk_bufs[salt_pos].nr_buf[13];
309 __local u32 s_msg_buf[128];
311 const u32 lid2 = lid * 2;
313 s_msg_buf[lid2 + 0] = ikepsk_bufs[salt_pos].msg_buf[lid2 + 0];
314 s_msg_buf[lid2 + 1] = ikepsk_bufs[salt_pos].msg_buf[lid2 + 1];
316 barrier (CLK_LOCAL_MEM_FENCE);
318 if (gid >= gid_max) return;
324 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
326 const u32 pw_r_len = combs_buf[il_pos].pw_len;
328 const u32 pw_len = pw_l_len + pw_r_len;
332 wordr0[0] = combs_buf[il_pos].i[0];
333 wordr0[1] = combs_buf[il_pos].i[1];
334 wordr0[2] = combs_buf[il_pos].i[2];
335 wordr0[3] = combs_buf[il_pos].i[3];
339 wordr1[0] = combs_buf[il_pos].i[4];
340 wordr1[1] = combs_buf[il_pos].i[5];
341 wordr1[2] = combs_buf[il_pos].i[6];
342 wordr1[3] = combs_buf[il_pos].i[7];
358 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
360 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
365 w0[0] = wordl0[0] | wordr0[0];
366 w0[1] = wordl0[1] | wordr0[1];
367 w0[2] = wordl0[2] | wordr0[2];
368 w0[3] = wordl0[3] | wordr0[3];
372 w1[0] = wordl1[0] | wordr1[0];
373 w1[1] = wordl1[1] | wordr1[1];
374 w1[2] = wordl1[2] | wordr1[2];
375 w1[3] = wordl1[3] | wordr1[3];
379 w2[0] = wordl2[0] | wordr2[0];
380 w2[1] = wordl2[1] | wordr2[1];
381 w2[2] = wordl2[2] | wordr2[2];
382 w2[3] = wordl2[3] | wordr2[3];
386 w3[0] = wordl3[0] | wordr3[0];
387 w3[1] = wordl3[1] | wordr3[1];
388 w3[2] = wordl3[2] | wordr3[2];
389 w3[3] = wordl3[3] | wordr3[3];
426 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
428 w0_t[0] = salt_buf0[0];
429 w0_t[1] = salt_buf0[1];
430 w0_t[2] = salt_buf0[2];
431 w0_t[3] = salt_buf0[3];
432 w1_t[0] = salt_buf1[0];
433 w1_t[1] = salt_buf1[1];
434 w1_t[2] = salt_buf1[2];
435 w1_t[3] = salt_buf1[3];
436 w2_t[0] = salt_buf2[0];
437 w2_t[1] = salt_buf2[1];
438 w2_t[2] = salt_buf2[2];
439 w2_t[3] = salt_buf2[3];
440 w3_t[0] = salt_buf3[0];
441 w3_t[1] = salt_buf3[1];
442 w3_t[2] = (64 + nr_len) * 8;
447 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
466 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
471 for (left = ikepsk_bufs[salt_pos].msg_len, off = 0; left >= 56; left -= 64, off += 16)
473 w0_t[0] = s_msg_buf[off + 0];
474 w0_t[1] = s_msg_buf[off + 1];
475 w0_t[2] = s_msg_buf[off + 2];
476 w0_t[3] = s_msg_buf[off + 3];
477 w1_t[0] = s_msg_buf[off + 4];
478 w1_t[1] = s_msg_buf[off + 5];
479 w1_t[2] = s_msg_buf[off + 6];
480 w1_t[3] = s_msg_buf[off + 7];
481 w2_t[0] = s_msg_buf[off + 8];
482 w2_t[1] = s_msg_buf[off + 9];
483 w2_t[2] = s_msg_buf[off + 10];
484 w2_t[3] = s_msg_buf[off + 11];
485 w3_t[0] = s_msg_buf[off + 12];
486 w3_t[1] = s_msg_buf[off + 13];
487 w3_t[2] = s_msg_buf[off + 14];
488 w3_t[3] = s_msg_buf[off + 15];
490 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
493 w0_t[0] = s_msg_buf[off + 0];
494 w0_t[1] = s_msg_buf[off + 1];
495 w0_t[2] = s_msg_buf[off + 2];
496 w0_t[3] = s_msg_buf[off + 3];
497 w1_t[0] = s_msg_buf[off + 4];
498 w1_t[1] = s_msg_buf[off + 5];
499 w1_t[2] = s_msg_buf[off + 6];
500 w1_t[3] = s_msg_buf[off + 7];
501 w2_t[0] = s_msg_buf[off + 8];
502 w2_t[1] = s_msg_buf[off + 9];
503 w2_t[2] = s_msg_buf[off + 10];
504 w2_t[3] = s_msg_buf[off + 11];
505 w3_t[0] = s_msg_buf[off + 12];
506 w3_t[1] = s_msg_buf[off + 13];
507 w3_t[2] = (64 + msg_len) * 8;
510 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
512 const u32x r0 = digest[0];
513 const u32x r1 = digest[3];
514 const u32x r2 = digest[2];
515 const u32x r3 = digest[1];
517 #include VECT_COMPARE_M
521 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m05300_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 ikepsk_t *ikepsk_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)
525 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m05300_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 ikepsk_t *ikepsk_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)
529 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m05300_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 ikepsk_t *ikepsk_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)
535 const u32 lid = get_local_id (0);
541 const u32 gid = get_global_id (0);
545 wordl0[0] = pws[gid].i[ 0];
546 wordl0[1] = pws[gid].i[ 1];
547 wordl0[2] = pws[gid].i[ 2];
548 wordl0[3] = pws[gid].i[ 3];
552 wordl1[0] = pws[gid].i[ 4];
553 wordl1[1] = pws[gid].i[ 5];
554 wordl1[2] = pws[gid].i[ 6];
555 wordl1[3] = pws[gid].i[ 7];
571 const u32 pw_l_len = pws[gid].pw_len;
573 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
575 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
582 const u32 nr_len = ikepsk_bufs[salt_pos].nr_len;
583 const u32 msg_len = ikepsk_bufs[salt_pos].msg_len;
587 salt_buf0[0] = ikepsk_bufs[salt_pos].nr_buf[ 0];
588 salt_buf0[1] = ikepsk_bufs[salt_pos].nr_buf[ 1];
589 salt_buf0[2] = ikepsk_bufs[salt_pos].nr_buf[ 2];
590 salt_buf0[3] = ikepsk_bufs[salt_pos].nr_buf[ 3];
594 salt_buf1[0] = ikepsk_bufs[salt_pos].nr_buf[ 4];
595 salt_buf1[1] = ikepsk_bufs[salt_pos].nr_buf[ 5];
596 salt_buf1[2] = ikepsk_bufs[salt_pos].nr_buf[ 6];
597 salt_buf1[3] = ikepsk_bufs[salt_pos].nr_buf[ 7];
601 salt_buf2[0] = ikepsk_bufs[salt_pos].nr_buf[ 8];
602 salt_buf2[1] = ikepsk_bufs[salt_pos].nr_buf[ 9];
603 salt_buf2[2] = ikepsk_bufs[salt_pos].nr_buf[10];
604 salt_buf2[3] = ikepsk_bufs[salt_pos].nr_buf[11];
608 salt_buf3[0] = ikepsk_bufs[salt_pos].nr_buf[12];
609 salt_buf3[1] = ikepsk_bufs[salt_pos].nr_buf[13];
613 __local u32 s_msg_buf[128];
615 const u32 lid2 = lid * 2;
617 s_msg_buf[lid2 + 0] = ikepsk_bufs[salt_pos].msg_buf[lid2 + 0];
618 s_msg_buf[lid2 + 1] = ikepsk_bufs[salt_pos].msg_buf[lid2 + 1];
620 barrier (CLK_LOCAL_MEM_FENCE);
622 if (gid >= gid_max) return;
628 const u32 search[4] =
630 digests_buf[digests_offset].digest_buf[DGST_R0],
631 digests_buf[digests_offset].digest_buf[DGST_R1],
632 digests_buf[digests_offset].digest_buf[DGST_R2],
633 digests_buf[digests_offset].digest_buf[DGST_R3]
640 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
642 const u32 pw_r_len = combs_buf[il_pos].pw_len;
644 const u32 pw_len = pw_l_len + pw_r_len;
648 wordr0[0] = combs_buf[il_pos].i[0];
649 wordr0[1] = combs_buf[il_pos].i[1];
650 wordr0[2] = combs_buf[il_pos].i[2];
651 wordr0[3] = combs_buf[il_pos].i[3];
655 wordr1[0] = combs_buf[il_pos].i[4];
656 wordr1[1] = combs_buf[il_pos].i[5];
657 wordr1[2] = combs_buf[il_pos].i[6];
658 wordr1[3] = combs_buf[il_pos].i[7];
674 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
676 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
681 w0[0] = wordl0[0] | wordr0[0];
682 w0[1] = wordl0[1] | wordr0[1];
683 w0[2] = wordl0[2] | wordr0[2];
684 w0[3] = wordl0[3] | wordr0[3];
688 w1[0] = wordl1[0] | wordr1[0];
689 w1[1] = wordl1[1] | wordr1[1];
690 w1[2] = wordl1[2] | wordr1[2];
691 w1[3] = wordl1[3] | wordr1[3];
695 w2[0] = wordl2[0] | wordr2[0];
696 w2[1] = wordl2[1] | wordr2[1];
697 w2[2] = wordl2[2] | wordr2[2];
698 w2[3] = wordl2[3] | wordr2[3];
702 w3[0] = wordl3[0] | wordr3[0];
703 w3[1] = wordl3[1] | wordr3[1];
704 w3[2] = wordl3[2] | wordr3[2];
705 w3[3] = wordl3[3] | wordr3[3];
742 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
744 w0_t[0] = salt_buf0[0];
745 w0_t[1] = salt_buf0[1];
746 w0_t[2] = salt_buf0[2];
747 w0_t[3] = salt_buf0[3];
748 w1_t[0] = salt_buf1[0];
749 w1_t[1] = salt_buf1[1];
750 w1_t[2] = salt_buf1[2];
751 w1_t[3] = salt_buf1[3];
752 w2_t[0] = salt_buf2[0];
753 w2_t[1] = salt_buf2[1];
754 w2_t[2] = salt_buf2[2];
755 w2_t[3] = salt_buf2[3];
756 w3_t[0] = salt_buf3[0];
757 w3_t[1] = salt_buf3[1];
758 w3_t[2] = (64 + nr_len) * 8;
763 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
782 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
787 for (left = ikepsk_bufs[salt_pos].msg_len, off = 0; left >= 56; left -= 64, off += 16)
789 w0_t[0] = s_msg_buf[off + 0];
790 w0_t[1] = s_msg_buf[off + 1];
791 w0_t[2] = s_msg_buf[off + 2];
792 w0_t[3] = s_msg_buf[off + 3];
793 w1_t[0] = s_msg_buf[off + 4];
794 w1_t[1] = s_msg_buf[off + 5];
795 w1_t[2] = s_msg_buf[off + 6];
796 w1_t[3] = s_msg_buf[off + 7];
797 w2_t[0] = s_msg_buf[off + 8];
798 w2_t[1] = s_msg_buf[off + 9];
799 w2_t[2] = s_msg_buf[off + 10];
800 w2_t[3] = s_msg_buf[off + 11];
801 w3_t[0] = s_msg_buf[off + 12];
802 w3_t[1] = s_msg_buf[off + 13];
803 w3_t[2] = s_msg_buf[off + 14];
804 w3_t[3] = s_msg_buf[off + 15];
806 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
809 w0_t[0] = s_msg_buf[off + 0];
810 w0_t[1] = s_msg_buf[off + 1];
811 w0_t[2] = s_msg_buf[off + 2];
812 w0_t[3] = s_msg_buf[off + 3];
813 w1_t[0] = s_msg_buf[off + 4];
814 w1_t[1] = s_msg_buf[off + 5];
815 w1_t[2] = s_msg_buf[off + 6];
816 w1_t[3] = s_msg_buf[off + 7];
817 w2_t[0] = s_msg_buf[off + 8];
818 w2_t[1] = s_msg_buf[off + 9];
819 w2_t[2] = s_msg_buf[off + 10];
820 w2_t[3] = s_msg_buf[off + 11];
821 w3_t[0] = s_msg_buf[off + 12];
822 w3_t[1] = s_msg_buf[off + 13];
823 w3_t[2] = (64 + msg_len) * 8;
826 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
828 const u32x r0 = digest[0];
829 const u32x r1 = digest[3];
830 const u32x r2 = digest[2];
831 const u32x r3 = digest[1];
833 #include VECT_COMPARE_S
837 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m05300_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 ikepsk_t *ikepsk_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)
841 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m05300_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 ikepsk_t *ikepsk_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)