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"
44 static void md4_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[4])
68 MD4_STEP (MD4_Fo, a, b, c, d, w0_t, MD4C00, MD4S00);
69 MD4_STEP (MD4_Fo, d, a, b, c, w1_t, MD4C00, MD4S01);
70 MD4_STEP (MD4_Fo, c, d, a, b, w2_t, MD4C00, MD4S02);
71 MD4_STEP (MD4_Fo, b, c, d, a, w3_t, MD4C00, MD4S03);
72 MD4_STEP (MD4_Fo, a, b, c, d, w4_t, MD4C00, MD4S00);
73 MD4_STEP (MD4_Fo, d, a, b, c, w5_t, MD4C00, MD4S01);
74 MD4_STEP (MD4_Fo, c, d, a, b, w6_t, MD4C00, MD4S02);
75 MD4_STEP (MD4_Fo, b, c, d, a, w7_t, MD4C00, MD4S03);
76 MD4_STEP (MD4_Fo, a, b, c, d, w8_t, MD4C00, MD4S00);
77 MD4_STEP (MD4_Fo, d, a, b, c, w9_t, MD4C00, MD4S01);
78 MD4_STEP (MD4_Fo, c, d, a, b, wa_t, MD4C00, MD4S02);
79 MD4_STEP (MD4_Fo, b, c, d, a, wb_t, MD4C00, MD4S03);
80 MD4_STEP (MD4_Fo, a, b, c, d, wc_t, MD4C00, MD4S00);
81 MD4_STEP (MD4_Fo, d, a, b, c, wd_t, MD4C00, MD4S01);
82 MD4_STEP (MD4_Fo, c, d, a, b, we_t, MD4C00, MD4S02);
83 MD4_STEP (MD4_Fo, b, c, d, a, wf_t, MD4C00, MD4S03);
85 MD4_STEP (MD4_Go, a, b, c, d, w0_t, MD4C01, MD4S10);
86 MD4_STEP (MD4_Go, d, a, b, c, w4_t, MD4C01, MD4S11);
87 MD4_STEP (MD4_Go, c, d, a, b, w8_t, MD4C01, MD4S12);
88 MD4_STEP (MD4_Go, b, c, d, a, wc_t, MD4C01, MD4S13);
89 MD4_STEP (MD4_Go, a, b, c, d, w1_t, MD4C01, MD4S10);
90 MD4_STEP (MD4_Go, d, a, b, c, w5_t, MD4C01, MD4S11);
91 MD4_STEP (MD4_Go, c, d, a, b, w9_t, MD4C01, MD4S12);
92 MD4_STEP (MD4_Go, b, c, d, a, wd_t, MD4C01, MD4S13);
93 MD4_STEP (MD4_Go, a, b, c, d, w2_t, MD4C01, MD4S10);
94 MD4_STEP (MD4_Go, d, a, b, c, w6_t, MD4C01, MD4S11);
95 MD4_STEP (MD4_Go, c, d, a, b, wa_t, MD4C01, MD4S12);
96 MD4_STEP (MD4_Go, b, c, d, a, we_t, MD4C01, MD4S13);
97 MD4_STEP (MD4_Go, a, b, c, d, w3_t, MD4C01, MD4S10);
98 MD4_STEP (MD4_Go, d, a, b, c, w7_t, MD4C01, MD4S11);
99 MD4_STEP (MD4_Go, c, d, a, b, wb_t, MD4C01, MD4S12);
100 MD4_STEP (MD4_Go, b, c, d, a, wf_t, MD4C01, MD4S13);
102 MD4_STEP (MD4_H , a, b, c, d, w0_t, MD4C02, MD4S20);
103 MD4_STEP (MD4_H , d, a, b, c, w8_t, MD4C02, MD4S21);
104 MD4_STEP (MD4_H , c, d, a, b, w4_t, MD4C02, MD4S22);
105 MD4_STEP (MD4_H , b, c, d, a, wc_t, MD4C02, MD4S23);
106 MD4_STEP (MD4_H , a, b, c, d, w2_t, MD4C02, MD4S20);
107 MD4_STEP (MD4_H , d, a, b, c, wa_t, MD4C02, MD4S21);
108 MD4_STEP (MD4_H , c, d, a, b, w6_t, MD4C02, MD4S22);
109 MD4_STEP (MD4_H , b, c, d, a, we_t, MD4C02, MD4S23);
110 MD4_STEP (MD4_H , a, b, c, d, w1_t, MD4C02, MD4S20);
111 MD4_STEP (MD4_H , d, a, b, c, w9_t, MD4C02, MD4S21);
112 MD4_STEP (MD4_H , c, d, a, b, w5_t, MD4C02, MD4S22);
113 MD4_STEP (MD4_H , b, c, d, a, wd_t, MD4C02, MD4S23);
114 MD4_STEP (MD4_H , a, b, c, d, w3_t, MD4C02, MD4S20);
115 MD4_STEP (MD4_H , d, a, b, c, wb_t, MD4C02, MD4S21);
116 MD4_STEP (MD4_H , c, d, a, b, w7_t, MD4C02, MD4S22);
117 MD4_STEP (MD4_H , b, c, d, a, wf_t, MD4C02, MD4S23);
125 static void md5_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[4])
149 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
150 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
151 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
152 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
153 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
154 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
155 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
156 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
157 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
158 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
159 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
160 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
161 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
162 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
163 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
164 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
166 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
167 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
168 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
169 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
170 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
171 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
172 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
173 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
174 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
175 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
176 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
177 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
178 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
179 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
180 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
181 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
183 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
184 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
185 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
186 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
187 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
188 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
189 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
190 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
191 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
192 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
193 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
194 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
195 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
196 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
197 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
198 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
200 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
201 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
202 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
203 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
204 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
205 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
206 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
207 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
208 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
209 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
210 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
211 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
212 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
213 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
214 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
215 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
223 static void hmac_md5_pad (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], u32x ipad[4], u32x opad[4])
225 w0[0] = w0[0] ^ 0x36363636;
226 w0[1] = w0[1] ^ 0x36363636;
227 w0[2] = w0[2] ^ 0x36363636;
228 w0[3] = w0[3] ^ 0x36363636;
229 w1[0] = w1[0] ^ 0x36363636;
230 w1[1] = w1[1] ^ 0x36363636;
231 w1[2] = w1[2] ^ 0x36363636;
232 w1[3] = w1[3] ^ 0x36363636;
233 w2[0] = w2[0] ^ 0x36363636;
234 w2[1] = w2[1] ^ 0x36363636;
235 w2[2] = w2[2] ^ 0x36363636;
236 w2[3] = w2[3] ^ 0x36363636;
237 w3[0] = w3[0] ^ 0x36363636;
238 w3[1] = w3[1] ^ 0x36363636;
239 w3[2] = w3[2] ^ 0x36363636;
240 w3[3] = w3[3] ^ 0x36363636;
247 md5_transform (w0, w1, w2, w3, ipad);
249 w0[0] = w0[0] ^ 0x6a6a6a6a;
250 w0[1] = w0[1] ^ 0x6a6a6a6a;
251 w0[2] = w0[2] ^ 0x6a6a6a6a;
252 w0[3] = w0[3] ^ 0x6a6a6a6a;
253 w1[0] = w1[0] ^ 0x6a6a6a6a;
254 w1[1] = w1[1] ^ 0x6a6a6a6a;
255 w1[2] = w1[2] ^ 0x6a6a6a6a;
256 w1[3] = w1[3] ^ 0x6a6a6a6a;
257 w2[0] = w2[0] ^ 0x6a6a6a6a;
258 w2[1] = w2[1] ^ 0x6a6a6a6a;
259 w2[2] = w2[2] ^ 0x6a6a6a6a;
260 w2[3] = w2[3] ^ 0x6a6a6a6a;
261 w3[0] = w3[0] ^ 0x6a6a6a6a;
262 w3[1] = w3[1] ^ 0x6a6a6a6a;
263 w3[2] = w3[2] ^ 0x6a6a6a6a;
264 w3[3] = w3[3] ^ 0x6a6a6a6a;
271 md5_transform (w0, w1, w2, w3, opad);
274 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])
281 md5_transform (w0, w1, w2, w3, digest);
297 w3[2] = (64 + 16) * 8;
305 md5_transform (w0, w1, w2, w3, digest);
308 __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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
314 const u32 lid = get_local_id (0);
320 const u32 gid = get_global_id (0);
324 pw_buf0[0] = pws[gid].i[ 0];
325 pw_buf0[1] = pws[gid].i[ 1];
326 pw_buf0[2] = pws[gid].i[ 2];
327 pw_buf0[3] = pws[gid].i[ 3];
331 pw_buf1[0] = pws[gid].i[ 4];
332 pw_buf1[1] = pws[gid].i[ 5];
333 pw_buf1[2] = pws[gid].i[ 6];
334 pw_buf1[3] = pws[gid].i[ 7];
336 const u32 pw_len = pws[gid].pw_len;
342 __local u32 s_userdomain_buf[64];
343 __local u32 s_chall_buf[256];
345 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
346 + netntlm_bufs[salt_pos].domain_len;
348 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
349 + netntlm_bufs[salt_pos].clichall_len;
353 s_userdomain_buf[lid] = netntlm_bufs[salt_pos].userdomain_buf[lid];
356 const u32 lid4 = lid * 4;
358 s_chall_buf[lid4 + 0] = netntlm_bufs[salt_pos].chall_buf[lid4 + 0];
359 s_chall_buf[lid4 + 1] = netntlm_bufs[salt_pos].chall_buf[lid4 + 1];
360 s_chall_buf[lid4 + 2] = netntlm_bufs[salt_pos].chall_buf[lid4 + 2];
361 s_chall_buf[lid4 + 3] = netntlm_bufs[salt_pos].chall_buf[lid4 + 3];
363 barrier (CLK_LOCAL_MEM_FENCE);
365 if (gid >= gid_max) return;
371 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
401 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
403 append_0x80_2 (w0, w1, out_len);
410 make_unicode (w0, w0_t, w1_t);
411 make_unicode (w1, w2_t, w3_t);
413 w3_t[2] = out_len * 8 * 2;
422 md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
449 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
454 for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16)
456 w0_t[0] = s_userdomain_buf[off + 0];
457 w0_t[1] = s_userdomain_buf[off + 1];
458 w0_t[2] = s_userdomain_buf[off + 2];
459 w0_t[3] = s_userdomain_buf[off + 3];
460 w1_t[0] = s_userdomain_buf[off + 4];
461 w1_t[1] = s_userdomain_buf[off + 5];
462 w1_t[2] = s_userdomain_buf[off + 6];
463 w1_t[3] = s_userdomain_buf[off + 7];
464 w2_t[0] = s_userdomain_buf[off + 8];
465 w2_t[1] = s_userdomain_buf[off + 9];
466 w2_t[2] = s_userdomain_buf[off + 10];
467 w2_t[3] = s_userdomain_buf[off + 11];
468 w3_t[0] = s_userdomain_buf[off + 12];
469 w3_t[1] = s_userdomain_buf[off + 13];
470 w3_t[2] = s_userdomain_buf[off + 14];
471 w3_t[3] = s_userdomain_buf[off + 15];
473 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
476 w0_t[0] = s_userdomain_buf[off + 0];
477 w0_t[1] = s_userdomain_buf[off + 1];
478 w0_t[2] = s_userdomain_buf[off + 2];
479 w0_t[3] = s_userdomain_buf[off + 3];
480 w1_t[0] = s_userdomain_buf[off + 4];
481 w1_t[1] = s_userdomain_buf[off + 5];
482 w1_t[2] = s_userdomain_buf[off + 6];
483 w1_t[3] = s_userdomain_buf[off + 7];
484 w2_t[0] = s_userdomain_buf[off + 8];
485 w2_t[1] = s_userdomain_buf[off + 9];
486 w2_t[2] = s_userdomain_buf[off + 10];
487 w2_t[3] = s_userdomain_buf[off + 11];
488 w3_t[0] = s_userdomain_buf[off + 12];
489 w3_t[1] = s_userdomain_buf[off + 13];
490 w3_t[2] = (64 + userdomain_len) * 8;
493 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
517 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
519 for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16)
521 w0_t[0] = s_chall_buf[off + 0];
522 w0_t[1] = s_chall_buf[off + 1];
523 w0_t[2] = s_chall_buf[off + 2];
524 w0_t[3] = s_chall_buf[off + 3];
525 w1_t[0] = s_chall_buf[off + 4];
526 w1_t[1] = s_chall_buf[off + 5];
527 w1_t[2] = s_chall_buf[off + 6];
528 w1_t[3] = s_chall_buf[off + 7];
529 w2_t[0] = s_chall_buf[off + 8];
530 w2_t[1] = s_chall_buf[off + 9];
531 w2_t[2] = s_chall_buf[off + 10];
532 w2_t[3] = s_chall_buf[off + 11];
533 w3_t[0] = s_chall_buf[off + 12];
534 w3_t[1] = s_chall_buf[off + 13];
535 w3_t[2] = s_chall_buf[off + 14];
536 w3_t[3] = s_chall_buf[off + 15];
538 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
541 w0_t[0] = s_chall_buf[off + 0];
542 w0_t[1] = s_chall_buf[off + 1];
543 w0_t[2] = s_chall_buf[off + 2];
544 w0_t[3] = s_chall_buf[off + 3];
545 w1_t[0] = s_chall_buf[off + 4];
546 w1_t[1] = s_chall_buf[off + 5];
547 w1_t[2] = s_chall_buf[off + 6];
548 w1_t[3] = s_chall_buf[off + 7];
549 w2_t[0] = s_chall_buf[off + 8];
550 w2_t[1] = s_chall_buf[off + 9];
551 w2_t[2] = s_chall_buf[off + 10];
552 w2_t[3] = s_chall_buf[off + 11];
553 w3_t[0] = s_chall_buf[off + 12];
554 w3_t[1] = s_chall_buf[off + 13];
555 w3_t[2] = (64 + chall_len) * 8;
558 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
560 const u32x r0 = digest[0];
561 const u32x r1 = digest[3];
562 const u32x r2 = digest[2];
563 const u32x r3 = digest[1];
565 #include VECT_COMPARE_M
569 __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)
573 __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)
577 __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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
583 const u32 lid = get_local_id (0);
589 const u32 gid = get_global_id (0);
593 pw_buf0[0] = pws[gid].i[ 0];
594 pw_buf0[1] = pws[gid].i[ 1];
595 pw_buf0[2] = pws[gid].i[ 2];
596 pw_buf0[3] = pws[gid].i[ 3];
600 pw_buf1[0] = pws[gid].i[ 4];
601 pw_buf1[1] = pws[gid].i[ 5];
602 pw_buf1[2] = pws[gid].i[ 6];
603 pw_buf1[3] = pws[gid].i[ 7];
605 const u32 pw_len = pws[gid].pw_len;
611 __local u32 s_userdomain_buf[64];
612 __local u32 s_chall_buf[256];
614 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
615 + netntlm_bufs[salt_pos].domain_len;
617 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
618 + netntlm_bufs[salt_pos].clichall_len;
622 s_userdomain_buf[lid] = netntlm_bufs[salt_pos].userdomain_buf[lid];
625 const u32 lid4 = lid * 4;
627 s_chall_buf[lid4 + 0] = netntlm_bufs[salt_pos].chall_buf[lid4 + 0];
628 s_chall_buf[lid4 + 1] = netntlm_bufs[salt_pos].chall_buf[lid4 + 1];
629 s_chall_buf[lid4 + 2] = netntlm_bufs[salt_pos].chall_buf[lid4 + 2];
630 s_chall_buf[lid4 + 3] = netntlm_bufs[salt_pos].chall_buf[lid4 + 3];
632 barrier (CLK_LOCAL_MEM_FENCE);
634 if (gid >= gid_max) return;
640 const u32 search[4] =
642 digests_buf[digests_offset].digest_buf[DGST_R0],
643 digests_buf[digests_offset].digest_buf[DGST_R1],
644 digests_buf[digests_offset].digest_buf[DGST_R2],
645 digests_buf[digests_offset].digest_buf[DGST_R3]
652 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
682 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
684 append_0x80_2 (w0, w1, out_len);
691 make_unicode (w0, w0_t, w1_t);
692 make_unicode (w1, w2_t, w3_t);
694 w3_t[2] = out_len * 8 * 2;
703 md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
730 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
735 for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16)
737 w0_t[0] = s_userdomain_buf[off + 0];
738 w0_t[1] = s_userdomain_buf[off + 1];
739 w0_t[2] = s_userdomain_buf[off + 2];
740 w0_t[3] = s_userdomain_buf[off + 3];
741 w1_t[0] = s_userdomain_buf[off + 4];
742 w1_t[1] = s_userdomain_buf[off + 5];
743 w1_t[2] = s_userdomain_buf[off + 6];
744 w1_t[3] = s_userdomain_buf[off + 7];
745 w2_t[0] = s_userdomain_buf[off + 8];
746 w2_t[1] = s_userdomain_buf[off + 9];
747 w2_t[2] = s_userdomain_buf[off + 10];
748 w2_t[3] = s_userdomain_buf[off + 11];
749 w3_t[0] = s_userdomain_buf[off + 12];
750 w3_t[1] = s_userdomain_buf[off + 13];
751 w3_t[2] = s_userdomain_buf[off + 14];
752 w3_t[3] = s_userdomain_buf[off + 15];
754 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
757 w0_t[0] = s_userdomain_buf[off + 0];
758 w0_t[1] = s_userdomain_buf[off + 1];
759 w0_t[2] = s_userdomain_buf[off + 2];
760 w0_t[3] = s_userdomain_buf[off + 3];
761 w1_t[0] = s_userdomain_buf[off + 4];
762 w1_t[1] = s_userdomain_buf[off + 5];
763 w1_t[2] = s_userdomain_buf[off + 6];
764 w1_t[3] = s_userdomain_buf[off + 7];
765 w2_t[0] = s_userdomain_buf[off + 8];
766 w2_t[1] = s_userdomain_buf[off + 9];
767 w2_t[2] = s_userdomain_buf[off + 10];
768 w2_t[3] = s_userdomain_buf[off + 11];
769 w3_t[0] = s_userdomain_buf[off + 12];
770 w3_t[1] = s_userdomain_buf[off + 13];
771 w3_t[2] = (64 + userdomain_len) * 8;
774 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
798 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
800 for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16)
802 w0_t[0] = s_chall_buf[off + 0];
803 w0_t[1] = s_chall_buf[off + 1];
804 w0_t[2] = s_chall_buf[off + 2];
805 w0_t[3] = s_chall_buf[off + 3];
806 w1_t[0] = s_chall_buf[off + 4];
807 w1_t[1] = s_chall_buf[off + 5];
808 w1_t[2] = s_chall_buf[off + 6];
809 w1_t[3] = s_chall_buf[off + 7];
810 w2_t[0] = s_chall_buf[off + 8];
811 w2_t[1] = s_chall_buf[off + 9];
812 w2_t[2] = s_chall_buf[off + 10];
813 w2_t[3] = s_chall_buf[off + 11];
814 w3_t[0] = s_chall_buf[off + 12];
815 w3_t[1] = s_chall_buf[off + 13];
816 w3_t[2] = s_chall_buf[off + 14];
817 w3_t[3] = s_chall_buf[off + 15];
819 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
822 w0_t[0] = s_chall_buf[off + 0];
823 w0_t[1] = s_chall_buf[off + 1];
824 w0_t[2] = s_chall_buf[off + 2];
825 w0_t[3] = s_chall_buf[off + 3];
826 w1_t[0] = s_chall_buf[off + 4];
827 w1_t[1] = s_chall_buf[off + 5];
828 w1_t[2] = s_chall_buf[off + 6];
829 w1_t[3] = s_chall_buf[off + 7];
830 w2_t[0] = s_chall_buf[off + 8];
831 w2_t[1] = s_chall_buf[off + 9];
832 w2_t[2] = s_chall_buf[off + 10];
833 w2_t[3] = s_chall_buf[off + 11];
834 w3_t[0] = s_chall_buf[off + 12];
835 w3_t[1] = s_chall_buf[off + 13];
836 w3_t[2] = (64 + chall_len) * 8;
839 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
841 const u32x r0 = digest[0];
842 const u32x r1 = digest[3];
843 const u32x r2 = digest[2];
844 const u32x r3 = digest[1];
846 #include VECT_COMPARE_S
850 __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)
854 __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)