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"
42 static void md4_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[4])
66 MD4_STEP (MD4_Fo, a, b, c, d, w0_t, MD4C00, MD4S00);
67 MD4_STEP (MD4_Fo, d, a, b, c, w1_t, MD4C00, MD4S01);
68 MD4_STEP (MD4_Fo, c, d, a, b, w2_t, MD4C00, MD4S02);
69 MD4_STEP (MD4_Fo, b, c, d, a, w3_t, MD4C00, MD4S03);
70 MD4_STEP (MD4_Fo, a, b, c, d, w4_t, MD4C00, MD4S00);
71 MD4_STEP (MD4_Fo, d, a, b, c, w5_t, MD4C00, MD4S01);
72 MD4_STEP (MD4_Fo, c, d, a, b, w6_t, MD4C00, MD4S02);
73 MD4_STEP (MD4_Fo, b, c, d, a, w7_t, MD4C00, MD4S03);
74 MD4_STEP (MD4_Fo, a, b, c, d, w8_t, MD4C00, MD4S00);
75 MD4_STEP (MD4_Fo, d, a, b, c, w9_t, MD4C00, MD4S01);
76 MD4_STEP (MD4_Fo, c, d, a, b, wa_t, MD4C00, MD4S02);
77 MD4_STEP (MD4_Fo, b, c, d, a, wb_t, MD4C00, MD4S03);
78 MD4_STEP (MD4_Fo, a, b, c, d, wc_t, MD4C00, MD4S00);
79 MD4_STEP (MD4_Fo, d, a, b, c, wd_t, MD4C00, MD4S01);
80 MD4_STEP (MD4_Fo, c, d, a, b, we_t, MD4C00, MD4S02);
81 MD4_STEP (MD4_Fo, b, c, d, a, wf_t, MD4C00, MD4S03);
83 MD4_STEP (MD4_Go, a, b, c, d, w0_t, MD4C01, MD4S10);
84 MD4_STEP (MD4_Go, d, a, b, c, w4_t, MD4C01, MD4S11);
85 MD4_STEP (MD4_Go, c, d, a, b, w8_t, MD4C01, MD4S12);
86 MD4_STEP (MD4_Go, b, c, d, a, wc_t, MD4C01, MD4S13);
87 MD4_STEP (MD4_Go, a, b, c, d, w1_t, MD4C01, MD4S10);
88 MD4_STEP (MD4_Go, d, a, b, c, w5_t, MD4C01, MD4S11);
89 MD4_STEP (MD4_Go, c, d, a, b, w9_t, MD4C01, MD4S12);
90 MD4_STEP (MD4_Go, b, c, d, a, wd_t, MD4C01, MD4S13);
91 MD4_STEP (MD4_Go, a, b, c, d, w2_t, MD4C01, MD4S10);
92 MD4_STEP (MD4_Go, d, a, b, c, w6_t, MD4C01, MD4S11);
93 MD4_STEP (MD4_Go, c, d, a, b, wa_t, MD4C01, MD4S12);
94 MD4_STEP (MD4_Go, b, c, d, a, we_t, MD4C01, MD4S13);
95 MD4_STEP (MD4_Go, a, b, c, d, w3_t, MD4C01, MD4S10);
96 MD4_STEP (MD4_Go, d, a, b, c, w7_t, MD4C01, MD4S11);
97 MD4_STEP (MD4_Go, c, d, a, b, wb_t, MD4C01, MD4S12);
98 MD4_STEP (MD4_Go, b, c, d, a, wf_t, MD4C01, MD4S13);
100 MD4_STEP (MD4_H , a, b, c, d, w0_t, MD4C02, MD4S20);
101 MD4_STEP (MD4_H , d, a, b, c, w8_t, MD4C02, MD4S21);
102 MD4_STEP (MD4_H , c, d, a, b, w4_t, MD4C02, MD4S22);
103 MD4_STEP (MD4_H , b, c, d, a, wc_t, MD4C02, MD4S23);
104 MD4_STEP (MD4_H , a, b, c, d, w2_t, MD4C02, MD4S20);
105 MD4_STEP (MD4_H , d, a, b, c, wa_t, MD4C02, MD4S21);
106 MD4_STEP (MD4_H , c, d, a, b, w6_t, MD4C02, MD4S22);
107 MD4_STEP (MD4_H , b, c, d, a, we_t, MD4C02, MD4S23);
108 MD4_STEP (MD4_H , a, b, c, d, w1_t, MD4C02, MD4S20);
109 MD4_STEP (MD4_H , d, a, b, c, w9_t, MD4C02, MD4S21);
110 MD4_STEP (MD4_H , c, d, a, b, w5_t, MD4C02, MD4S22);
111 MD4_STEP (MD4_H , b, c, d, a, wd_t, MD4C02, MD4S23);
112 MD4_STEP (MD4_H , a, b, c, d, w3_t, MD4C02, MD4S20);
113 MD4_STEP (MD4_H , d, a, b, c, wb_t, MD4C02, MD4S21);
114 MD4_STEP (MD4_H , c, d, a, b, w7_t, MD4C02, MD4S22);
115 MD4_STEP (MD4_H , b, c, d, a, wf_t, MD4C02, MD4S23);
123 static void md5_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[4])
147 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
148 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
149 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
150 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
151 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
152 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
153 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
154 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
155 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
156 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
157 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
158 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
159 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
160 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
161 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
162 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
164 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
165 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
166 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
167 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
168 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
169 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
170 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
171 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
172 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
173 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
174 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
175 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
176 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
177 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
178 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
179 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
181 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
182 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
183 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
184 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
185 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
186 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
187 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
188 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
189 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
190 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
191 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
192 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
193 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
194 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
195 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
196 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
198 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
199 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
200 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
201 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
202 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
203 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
204 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
205 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
206 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
207 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
208 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
209 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
210 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
211 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
212 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
213 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
221 static void hmac_md5_pad (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], u32x ipad[4], u32x opad[4])
223 w0[0] = w0[0] ^ 0x36363636;
224 w0[1] = w0[1] ^ 0x36363636;
225 w0[2] = w0[2] ^ 0x36363636;
226 w0[3] = w0[3] ^ 0x36363636;
227 w1[0] = w1[0] ^ 0x36363636;
228 w1[1] = w1[1] ^ 0x36363636;
229 w1[2] = w1[2] ^ 0x36363636;
230 w1[3] = w1[3] ^ 0x36363636;
231 w2[0] = w2[0] ^ 0x36363636;
232 w2[1] = w2[1] ^ 0x36363636;
233 w2[2] = w2[2] ^ 0x36363636;
234 w2[3] = w2[3] ^ 0x36363636;
235 w3[0] = w3[0] ^ 0x36363636;
236 w3[1] = w3[1] ^ 0x36363636;
237 w3[2] = w3[2] ^ 0x36363636;
238 w3[3] = w3[3] ^ 0x36363636;
245 md5_transform (w0, w1, w2, w3, ipad);
247 w0[0] = w0[0] ^ 0x6a6a6a6a;
248 w0[1] = w0[1] ^ 0x6a6a6a6a;
249 w0[2] = w0[2] ^ 0x6a6a6a6a;
250 w0[3] = w0[3] ^ 0x6a6a6a6a;
251 w1[0] = w1[0] ^ 0x6a6a6a6a;
252 w1[1] = w1[1] ^ 0x6a6a6a6a;
253 w1[2] = w1[2] ^ 0x6a6a6a6a;
254 w1[3] = w1[3] ^ 0x6a6a6a6a;
255 w2[0] = w2[0] ^ 0x6a6a6a6a;
256 w2[1] = w2[1] ^ 0x6a6a6a6a;
257 w2[2] = w2[2] ^ 0x6a6a6a6a;
258 w2[3] = w2[3] ^ 0x6a6a6a6a;
259 w3[0] = w3[0] ^ 0x6a6a6a6a;
260 w3[1] = w3[1] ^ 0x6a6a6a6a;
261 w3[2] = w3[2] ^ 0x6a6a6a6a;
262 w3[3] = w3[3] ^ 0x6a6a6a6a;
269 md5_transform (w0, w1, w2, w3, opad);
272 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])
279 md5_transform (w0, w1, w2, w3, digest);
295 w3[2] = (64 + 16) * 8;
303 md5_transform (w0, w1, w2, w3, digest);
306 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m05600_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 netntlm_t *netntlm_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)
312 const u32 lid = get_local_id (0);
318 const u32 gid = get_global_id (0);
322 wordl0[0] = pws[gid].i[ 0];
323 wordl0[1] = pws[gid].i[ 1];
324 wordl0[2] = pws[gid].i[ 2];
325 wordl0[3] = pws[gid].i[ 3];
329 wordl1[0] = pws[gid].i[ 4];
330 wordl1[1] = pws[gid].i[ 5];
331 wordl1[2] = pws[gid].i[ 6];
332 wordl1[3] = pws[gid].i[ 7];
348 const u32 pw_l_len = pws[gid].pw_len;
350 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
352 append_0x80_2 (wordl0, wordl1, pw_l_len);
354 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
361 __local u32 s_userdomain_buf[64];
362 __local u32 s_chall_buf[256];
364 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
365 + netntlm_bufs[salt_pos].domain_len;
367 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
368 + netntlm_bufs[salt_pos].clichall_len;
372 s_userdomain_buf[lid] = netntlm_bufs[salt_pos].userdomain_buf[lid];
375 const u32 lid4 = lid * 4;
377 s_chall_buf[lid4 + 0] = netntlm_bufs[salt_pos].chall_buf[lid4 + 0];
378 s_chall_buf[lid4 + 1] = netntlm_bufs[salt_pos].chall_buf[lid4 + 1];
379 s_chall_buf[lid4 + 2] = netntlm_bufs[salt_pos].chall_buf[lid4 + 2];
380 s_chall_buf[lid4 + 3] = netntlm_bufs[salt_pos].chall_buf[lid4 + 3];
382 barrier (CLK_LOCAL_MEM_FENCE);
384 if (gid >= gid_max) return;
390 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
392 const u32 pw_r_len = combs_buf[il_pos].pw_len;
394 const u32 pw_len = pw_l_len + pw_r_len;
398 wordr0[0] = combs_buf[il_pos].i[0];
399 wordr0[1] = combs_buf[il_pos].i[1];
400 wordr0[2] = combs_buf[il_pos].i[2];
401 wordr0[3] = combs_buf[il_pos].i[3];
405 wordr1[0] = combs_buf[il_pos].i[4];
406 wordr1[1] = combs_buf[il_pos].i[5];
407 wordr1[2] = combs_buf[il_pos].i[6];
408 wordr1[3] = combs_buf[il_pos].i[7];
424 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
426 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
431 w0[0] = wordl0[0] | wordr0[0];
432 w0[1] = wordl0[1] | wordr0[1];
433 w0[2] = wordl0[2] | wordr0[2];
434 w0[3] = wordl0[3] | wordr0[3];
438 w1[0] = wordl1[0] | wordr1[0];
439 w1[1] = wordl1[1] | wordr1[1];
440 w1[2] = wordl1[2] | wordr1[2];
441 w1[3] = wordl1[3] | wordr1[3];
462 make_unicode (w0, w0_t, w1_t);
463 make_unicode (w1, w2_t, w3_t);
465 w3_t[2] = pw_len * 8 * 2;
474 md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
501 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
506 for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16)
508 w0_t[0] = s_userdomain_buf[off + 0];
509 w0_t[1] = s_userdomain_buf[off + 1];
510 w0_t[2] = s_userdomain_buf[off + 2];
511 w0_t[3] = s_userdomain_buf[off + 3];
512 w1_t[0] = s_userdomain_buf[off + 4];
513 w1_t[1] = s_userdomain_buf[off + 5];
514 w1_t[2] = s_userdomain_buf[off + 6];
515 w1_t[3] = s_userdomain_buf[off + 7];
516 w2_t[0] = s_userdomain_buf[off + 8];
517 w2_t[1] = s_userdomain_buf[off + 9];
518 w2_t[2] = s_userdomain_buf[off + 10];
519 w2_t[3] = s_userdomain_buf[off + 11];
520 w3_t[0] = s_userdomain_buf[off + 12];
521 w3_t[1] = s_userdomain_buf[off + 13];
522 w3_t[2] = s_userdomain_buf[off + 14];
523 w3_t[3] = s_userdomain_buf[off + 15];
525 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
528 w0_t[0] = s_userdomain_buf[off + 0];
529 w0_t[1] = s_userdomain_buf[off + 1];
530 w0_t[2] = s_userdomain_buf[off + 2];
531 w0_t[3] = s_userdomain_buf[off + 3];
532 w1_t[0] = s_userdomain_buf[off + 4];
533 w1_t[1] = s_userdomain_buf[off + 5];
534 w1_t[2] = s_userdomain_buf[off + 6];
535 w1_t[3] = s_userdomain_buf[off + 7];
536 w2_t[0] = s_userdomain_buf[off + 8];
537 w2_t[1] = s_userdomain_buf[off + 9];
538 w2_t[2] = s_userdomain_buf[off + 10];
539 w2_t[3] = s_userdomain_buf[off + 11];
540 w3_t[0] = s_userdomain_buf[off + 12];
541 w3_t[1] = s_userdomain_buf[off + 13];
542 w3_t[2] = (64 + userdomain_len) * 8;
545 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
569 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
571 for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16)
573 w0_t[0] = s_chall_buf[off + 0];
574 w0_t[1] = s_chall_buf[off + 1];
575 w0_t[2] = s_chall_buf[off + 2];
576 w0_t[3] = s_chall_buf[off + 3];
577 w1_t[0] = s_chall_buf[off + 4];
578 w1_t[1] = s_chall_buf[off + 5];
579 w1_t[2] = s_chall_buf[off + 6];
580 w1_t[3] = s_chall_buf[off + 7];
581 w2_t[0] = s_chall_buf[off + 8];
582 w2_t[1] = s_chall_buf[off + 9];
583 w2_t[2] = s_chall_buf[off + 10];
584 w2_t[3] = s_chall_buf[off + 11];
585 w3_t[0] = s_chall_buf[off + 12];
586 w3_t[1] = s_chall_buf[off + 13];
587 w3_t[2] = s_chall_buf[off + 14];
588 w3_t[3] = s_chall_buf[off + 15];
590 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
593 w0_t[0] = s_chall_buf[off + 0];
594 w0_t[1] = s_chall_buf[off + 1];
595 w0_t[2] = s_chall_buf[off + 2];
596 w0_t[3] = s_chall_buf[off + 3];
597 w1_t[0] = s_chall_buf[off + 4];
598 w1_t[1] = s_chall_buf[off + 5];
599 w1_t[2] = s_chall_buf[off + 6];
600 w1_t[3] = s_chall_buf[off + 7];
601 w2_t[0] = s_chall_buf[off + 8];
602 w2_t[1] = s_chall_buf[off + 9];
603 w2_t[2] = s_chall_buf[off + 10];
604 w2_t[3] = s_chall_buf[off + 11];
605 w3_t[0] = s_chall_buf[off + 12];
606 w3_t[1] = s_chall_buf[off + 13];
607 w3_t[2] = (64 + chall_len) * 8;
610 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
612 const u32x r0 = digest[0];
613 const u32x r1 = digest[3];
614 const u32x r2 = digest[2];
615 const u32x r3 = digest[1];
617 #include VECT_COMPARE_M
621 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m05600_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 netntlm_t *netntlm_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)
625 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m05600_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 netntlm_t *netntlm_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)
629 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m05600_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 netntlm_t *netntlm_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)
635 const u32 lid = get_local_id (0);
641 const u32 gid = get_global_id (0);
645 wordl0[0] = pws[gid].i[ 0];
646 wordl0[1] = pws[gid].i[ 1];
647 wordl0[2] = pws[gid].i[ 2];
648 wordl0[3] = pws[gid].i[ 3];
652 wordl1[0] = pws[gid].i[ 4];
653 wordl1[1] = pws[gid].i[ 5];
654 wordl1[2] = pws[gid].i[ 6];
655 wordl1[3] = pws[gid].i[ 7];
671 const u32 pw_l_len = pws[gid].pw_len;
673 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
675 append_0x80_2 (wordl0, wordl1, pw_l_len);
677 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
684 __local u32 s_userdomain_buf[64];
685 __local u32 s_chall_buf[256];
687 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
688 + netntlm_bufs[salt_pos].domain_len;
690 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
691 + netntlm_bufs[salt_pos].clichall_len;
695 s_userdomain_buf[lid] = netntlm_bufs[salt_pos].userdomain_buf[lid];
698 const u32 lid4 = lid * 4;
700 s_chall_buf[lid4 + 0] = netntlm_bufs[salt_pos].chall_buf[lid4 + 0];
701 s_chall_buf[lid4 + 1] = netntlm_bufs[salt_pos].chall_buf[lid4 + 1];
702 s_chall_buf[lid4 + 2] = netntlm_bufs[salt_pos].chall_buf[lid4 + 2];
703 s_chall_buf[lid4 + 3] = netntlm_bufs[salt_pos].chall_buf[lid4 + 3];
705 barrier (CLK_LOCAL_MEM_FENCE);
707 if (gid >= gid_max) return;
713 const u32 search[4] =
715 digests_buf[digests_offset].digest_buf[DGST_R0],
716 digests_buf[digests_offset].digest_buf[DGST_R1],
717 digests_buf[digests_offset].digest_buf[DGST_R2],
718 digests_buf[digests_offset].digest_buf[DGST_R3]
725 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
727 const u32 pw_r_len = combs_buf[il_pos].pw_len;
729 const u32 pw_len = pw_l_len + pw_r_len;
733 wordr0[0] = combs_buf[il_pos].i[0];
734 wordr0[1] = combs_buf[il_pos].i[1];
735 wordr0[2] = combs_buf[il_pos].i[2];
736 wordr0[3] = combs_buf[il_pos].i[3];
740 wordr1[0] = combs_buf[il_pos].i[4];
741 wordr1[1] = combs_buf[il_pos].i[5];
742 wordr1[2] = combs_buf[il_pos].i[6];
743 wordr1[3] = combs_buf[il_pos].i[7];
759 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
761 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
766 w0[0] = wordl0[0] | wordr0[0];
767 w0[1] = wordl0[1] | wordr0[1];
768 w0[2] = wordl0[2] | wordr0[2];
769 w0[3] = wordl0[3] | wordr0[3];
773 w1[0] = wordl1[0] | wordr1[0];
774 w1[1] = wordl1[1] | wordr1[1];
775 w1[2] = wordl1[2] | wordr1[2];
776 w1[3] = wordl1[3] | wordr1[3];
797 make_unicode (w0, w0_t, w1_t);
798 make_unicode (w1, w2_t, w3_t);
800 w3_t[2] = pw_len * 8 * 2;
809 md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
836 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
841 for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16)
843 w0_t[0] = s_userdomain_buf[off + 0];
844 w0_t[1] = s_userdomain_buf[off + 1];
845 w0_t[2] = s_userdomain_buf[off + 2];
846 w0_t[3] = s_userdomain_buf[off + 3];
847 w1_t[0] = s_userdomain_buf[off + 4];
848 w1_t[1] = s_userdomain_buf[off + 5];
849 w1_t[2] = s_userdomain_buf[off + 6];
850 w1_t[3] = s_userdomain_buf[off + 7];
851 w2_t[0] = s_userdomain_buf[off + 8];
852 w2_t[1] = s_userdomain_buf[off + 9];
853 w2_t[2] = s_userdomain_buf[off + 10];
854 w2_t[3] = s_userdomain_buf[off + 11];
855 w3_t[0] = s_userdomain_buf[off + 12];
856 w3_t[1] = s_userdomain_buf[off + 13];
857 w3_t[2] = s_userdomain_buf[off + 14];
858 w3_t[3] = s_userdomain_buf[off + 15];
860 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
863 w0_t[0] = s_userdomain_buf[off + 0];
864 w0_t[1] = s_userdomain_buf[off + 1];
865 w0_t[2] = s_userdomain_buf[off + 2];
866 w0_t[3] = s_userdomain_buf[off + 3];
867 w1_t[0] = s_userdomain_buf[off + 4];
868 w1_t[1] = s_userdomain_buf[off + 5];
869 w1_t[2] = s_userdomain_buf[off + 6];
870 w1_t[3] = s_userdomain_buf[off + 7];
871 w2_t[0] = s_userdomain_buf[off + 8];
872 w2_t[1] = s_userdomain_buf[off + 9];
873 w2_t[2] = s_userdomain_buf[off + 10];
874 w2_t[3] = s_userdomain_buf[off + 11];
875 w3_t[0] = s_userdomain_buf[off + 12];
876 w3_t[1] = s_userdomain_buf[off + 13];
877 w3_t[2] = (64 + userdomain_len) * 8;
880 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
904 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
906 for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16)
908 w0_t[0] = s_chall_buf[off + 0];
909 w0_t[1] = s_chall_buf[off + 1];
910 w0_t[2] = s_chall_buf[off + 2];
911 w0_t[3] = s_chall_buf[off + 3];
912 w1_t[0] = s_chall_buf[off + 4];
913 w1_t[1] = s_chall_buf[off + 5];
914 w1_t[2] = s_chall_buf[off + 6];
915 w1_t[3] = s_chall_buf[off + 7];
916 w2_t[0] = s_chall_buf[off + 8];
917 w2_t[1] = s_chall_buf[off + 9];
918 w2_t[2] = s_chall_buf[off + 10];
919 w2_t[3] = s_chall_buf[off + 11];
920 w3_t[0] = s_chall_buf[off + 12];
921 w3_t[1] = s_chall_buf[off + 13];
922 w3_t[2] = s_chall_buf[off + 14];
923 w3_t[3] = s_chall_buf[off + 15];
925 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
928 w0_t[0] = s_chall_buf[off + 0];
929 w0_t[1] = s_chall_buf[off + 1];
930 w0_t[2] = s_chall_buf[off + 2];
931 w0_t[3] = s_chall_buf[off + 3];
932 w1_t[0] = s_chall_buf[off + 4];
933 w1_t[1] = s_chall_buf[off + 5];
934 w1_t[2] = s_chall_buf[off + 6];
935 w1_t[3] = s_chall_buf[off + 7];
936 w2_t[0] = s_chall_buf[off + 8];
937 w2_t[1] = s_chall_buf[off + 9];
938 w2_t[2] = s_chall_buf[off + 10];
939 w2_t[3] = s_chall_buf[off + 11];
940 w3_t[0] = s_chall_buf[off + 12];
941 w3_t[1] = s_chall_buf[off + 13];
942 w3_t[2] = (64 + chall_len) * 8;
945 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
947 const u32x r0 = digest[0];
948 const u32x r1 = digest[3];
949 const u32x r2 = digest[2];
950 const u32x r3 = digest[1];
952 #include VECT_COMPARE_S
956 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m05600_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 netntlm_t *netntlm_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)
960 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m05600_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 netntlm_t *netntlm_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)