2 * Author......: Jens Steube <jens.steube@gmail.com>
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
16 #include "include/kernel_functions.c"
17 #include "OpenCL/types_ocl.c"
18 #include "OpenCL/common.c"
19 #include "include/rp_kernel.h"
20 #include "OpenCL/rp.c"
22 #define COMPARE_S "OpenCL/check_single_comp4.c"
23 #define COMPARE_M "OpenCL/check_multi_comp4.c"
25 static void md4_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[4])
49 MD4_STEP (MD4_Fo, a, b, c, d, w0_t, MD4C00, MD4S00);
50 MD4_STEP (MD4_Fo, d, a, b, c, w1_t, MD4C00, MD4S01);
51 MD4_STEP (MD4_Fo, c, d, a, b, w2_t, MD4C00, MD4S02);
52 MD4_STEP (MD4_Fo, b, c, d, a, w3_t, MD4C00, MD4S03);
53 MD4_STEP (MD4_Fo, a, b, c, d, w4_t, MD4C00, MD4S00);
54 MD4_STEP (MD4_Fo, d, a, b, c, w5_t, MD4C00, MD4S01);
55 MD4_STEP (MD4_Fo, c, d, a, b, w6_t, MD4C00, MD4S02);
56 MD4_STEP (MD4_Fo, b, c, d, a, w7_t, MD4C00, MD4S03);
57 MD4_STEP (MD4_Fo, a, b, c, d, w8_t, MD4C00, MD4S00);
58 MD4_STEP (MD4_Fo, d, a, b, c, w9_t, MD4C00, MD4S01);
59 MD4_STEP (MD4_Fo, c, d, a, b, wa_t, MD4C00, MD4S02);
60 MD4_STEP (MD4_Fo, b, c, d, a, wb_t, MD4C00, MD4S03);
61 MD4_STEP (MD4_Fo, a, b, c, d, wc_t, MD4C00, MD4S00);
62 MD4_STEP (MD4_Fo, d, a, b, c, wd_t, MD4C00, MD4S01);
63 MD4_STEP (MD4_Fo, c, d, a, b, we_t, MD4C00, MD4S02);
64 MD4_STEP (MD4_Fo, b, c, d, a, wf_t, MD4C00, MD4S03);
66 MD4_STEP (MD4_Go, a, b, c, d, w0_t, MD4C01, MD4S10);
67 MD4_STEP (MD4_Go, d, a, b, c, w4_t, MD4C01, MD4S11);
68 MD4_STEP (MD4_Go, c, d, a, b, w8_t, MD4C01, MD4S12);
69 MD4_STEP (MD4_Go, b, c, d, a, wc_t, MD4C01, MD4S13);
70 MD4_STEP (MD4_Go, a, b, c, d, w1_t, MD4C01, MD4S10);
71 MD4_STEP (MD4_Go, d, a, b, c, w5_t, MD4C01, MD4S11);
72 MD4_STEP (MD4_Go, c, d, a, b, w9_t, MD4C01, MD4S12);
73 MD4_STEP (MD4_Go, b, c, d, a, wd_t, MD4C01, MD4S13);
74 MD4_STEP (MD4_Go, a, b, c, d, w2_t, MD4C01, MD4S10);
75 MD4_STEP (MD4_Go, d, a, b, c, w6_t, MD4C01, MD4S11);
76 MD4_STEP (MD4_Go, c, d, a, b, wa_t, MD4C01, MD4S12);
77 MD4_STEP (MD4_Go, b, c, d, a, we_t, MD4C01, MD4S13);
78 MD4_STEP (MD4_Go, a, b, c, d, w3_t, MD4C01, MD4S10);
79 MD4_STEP (MD4_Go, d, a, b, c, w7_t, MD4C01, MD4S11);
80 MD4_STEP (MD4_Go, c, d, a, b, wb_t, MD4C01, MD4S12);
81 MD4_STEP (MD4_Go, b, c, d, a, wf_t, MD4C01, MD4S13);
83 MD4_STEP (MD4_H , a, b, c, d, w0_t, MD4C02, MD4S20);
84 MD4_STEP (MD4_H , d, a, b, c, w8_t, MD4C02, MD4S21);
85 MD4_STEP (MD4_H , c, d, a, b, w4_t, MD4C02, MD4S22);
86 MD4_STEP (MD4_H , b, c, d, a, wc_t, MD4C02, MD4S23);
87 MD4_STEP (MD4_H , a, b, c, d, w2_t, MD4C02, MD4S20);
88 MD4_STEP (MD4_H , d, a, b, c, wa_t, MD4C02, MD4S21);
89 MD4_STEP (MD4_H , c, d, a, b, w6_t, MD4C02, MD4S22);
90 MD4_STEP (MD4_H , b, c, d, a, we_t, MD4C02, MD4S23);
91 MD4_STEP (MD4_H , a, b, c, d, w1_t, MD4C02, MD4S20);
92 MD4_STEP (MD4_H , d, a, b, c, w9_t, MD4C02, MD4S21);
93 MD4_STEP (MD4_H , c, d, a, b, w5_t, MD4C02, MD4S22);
94 MD4_STEP (MD4_H , b, c, d, a, wd_t, MD4C02, MD4S23);
95 MD4_STEP (MD4_H , a, b, c, d, w3_t, MD4C02, MD4S20);
96 MD4_STEP (MD4_H , d, a, b, c, wb_t, MD4C02, MD4S21);
97 MD4_STEP (MD4_H , c, d, a, b, w7_t, MD4C02, MD4S22);
98 MD4_STEP (MD4_H , b, c, d, a, wf_t, MD4C02, MD4S23);
106 static void md5_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[4])
130 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
131 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
132 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
133 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
134 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
135 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
136 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
137 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
138 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
139 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
140 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
141 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
142 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
143 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
144 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
145 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
147 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
148 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
149 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
150 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
151 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
152 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
153 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
154 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
155 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
156 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
157 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
158 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
159 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
160 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
161 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
162 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
164 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
165 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
166 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
167 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
168 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
169 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
170 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
171 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
172 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
173 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
174 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
175 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
176 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
177 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
178 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
179 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
181 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
182 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
183 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
184 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
185 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
186 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
187 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
188 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
189 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
190 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
191 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
192 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
193 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
194 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
195 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
196 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
204 static void hmac_md5_pad (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], u32 ipad[4], u32 opad[4])
206 w0[0] = w0[0] ^ 0x36363636;
207 w0[1] = w0[1] ^ 0x36363636;
208 w0[2] = w0[2] ^ 0x36363636;
209 w0[3] = w0[3] ^ 0x36363636;
210 w1[0] = w1[0] ^ 0x36363636;
211 w1[1] = w1[1] ^ 0x36363636;
212 w1[2] = w1[2] ^ 0x36363636;
213 w1[3] = w1[3] ^ 0x36363636;
214 w2[0] = w2[0] ^ 0x36363636;
215 w2[1] = w2[1] ^ 0x36363636;
216 w2[2] = w2[2] ^ 0x36363636;
217 w2[3] = w2[3] ^ 0x36363636;
218 w3[0] = w3[0] ^ 0x36363636;
219 w3[1] = w3[1] ^ 0x36363636;
220 w3[2] = w3[2] ^ 0x36363636;
221 w3[3] = w3[3] ^ 0x36363636;
228 md5_transform (w0, w1, w2, w3, ipad);
230 w0[0] = w0[0] ^ 0x6a6a6a6a;
231 w0[1] = w0[1] ^ 0x6a6a6a6a;
232 w0[2] = w0[2] ^ 0x6a6a6a6a;
233 w0[3] = w0[3] ^ 0x6a6a6a6a;
234 w1[0] = w1[0] ^ 0x6a6a6a6a;
235 w1[1] = w1[1] ^ 0x6a6a6a6a;
236 w1[2] = w1[2] ^ 0x6a6a6a6a;
237 w1[3] = w1[3] ^ 0x6a6a6a6a;
238 w2[0] = w2[0] ^ 0x6a6a6a6a;
239 w2[1] = w2[1] ^ 0x6a6a6a6a;
240 w2[2] = w2[2] ^ 0x6a6a6a6a;
241 w2[3] = w2[3] ^ 0x6a6a6a6a;
242 w3[0] = w3[0] ^ 0x6a6a6a6a;
243 w3[1] = w3[1] ^ 0x6a6a6a6a;
244 w3[2] = w3[2] ^ 0x6a6a6a6a;
245 w3[3] = w3[3] ^ 0x6a6a6a6a;
252 md5_transform (w0, w1, w2, w3, opad);
255 static void hmac_md5_run (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], u32 ipad[4], u32 opad[4], u32 digest[4])
262 md5_transform (w0, w1, w2, w3, digest);
278 w3[2] = (64 + 16) * 8;
286 md5_transform (w0, w1, w2, w3, digest);
289 __kernel void m05600_m04 (__global pw_t *pws, __global kernel_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)
295 const u32 gid = get_global_id (0);
296 const u32 lid = get_local_id (0);
297 const u32 lsz = get_local_size (0);
303 __local u32 s_userdomain_buf[64];
305 for (u32 i = lid; i < 64; i += lsz)
307 s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
310 __local u32 s_chall_buf[256];
312 for (u32 i = lid; i < 256; i += lsz)
314 s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
317 barrier (CLK_LOCAL_MEM_FENCE);
319 if (gid >= gid_max) return;
321 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
322 + netntlm_bufs[salt_pos].domain_len;
324 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
325 + netntlm_bufs[salt_pos].clichall_len;
333 pw_buf0[0] = pws[gid].i[ 0];
334 pw_buf0[1] = pws[gid].i[ 1];
335 pw_buf0[2] = pws[gid].i[ 2];
336 pw_buf0[3] = pws[gid].i[ 3];
340 pw_buf1[0] = pws[gid].i[ 4];
341 pw_buf1[1] = pws[gid].i[ 5];
342 pw_buf1[2] = pws[gid].i[ 6];
343 pw_buf1[3] = pws[gid].i[ 7];
345 const u32 pw_len = pws[gid].pw_len;
351 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
381 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
383 append_0x80_2x4 (w0, w1, out_len);
390 make_unicode (w0, w0_t, w1_t);
391 make_unicode (w1, w2_t, w3_t);
393 w3_t[2] = out_len * 8 * 2;
402 md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
429 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
434 for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16)
436 w0_t[0] = s_userdomain_buf[off + 0];
437 w0_t[1] = s_userdomain_buf[off + 1];
438 w0_t[2] = s_userdomain_buf[off + 2];
439 w0_t[3] = s_userdomain_buf[off + 3];
440 w1_t[0] = s_userdomain_buf[off + 4];
441 w1_t[1] = s_userdomain_buf[off + 5];
442 w1_t[2] = s_userdomain_buf[off + 6];
443 w1_t[3] = s_userdomain_buf[off + 7];
444 w2_t[0] = s_userdomain_buf[off + 8];
445 w2_t[1] = s_userdomain_buf[off + 9];
446 w2_t[2] = s_userdomain_buf[off + 10];
447 w2_t[3] = s_userdomain_buf[off + 11];
448 w3_t[0] = s_userdomain_buf[off + 12];
449 w3_t[1] = s_userdomain_buf[off + 13];
450 w3_t[2] = s_userdomain_buf[off + 14];
451 w3_t[3] = s_userdomain_buf[off + 15];
453 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
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] = (64 + userdomain_len) * 8;
473 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
497 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
499 for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16)
501 w0_t[0] = s_chall_buf[off + 0];
502 w0_t[1] = s_chall_buf[off + 1];
503 w0_t[2] = s_chall_buf[off + 2];
504 w0_t[3] = s_chall_buf[off + 3];
505 w1_t[0] = s_chall_buf[off + 4];
506 w1_t[1] = s_chall_buf[off + 5];
507 w1_t[2] = s_chall_buf[off + 6];
508 w1_t[3] = s_chall_buf[off + 7];
509 w2_t[0] = s_chall_buf[off + 8];
510 w2_t[1] = s_chall_buf[off + 9];
511 w2_t[2] = s_chall_buf[off + 10];
512 w2_t[3] = s_chall_buf[off + 11];
513 w3_t[0] = s_chall_buf[off + 12];
514 w3_t[1] = s_chall_buf[off + 13];
515 w3_t[2] = s_chall_buf[off + 14];
516 w3_t[3] = s_chall_buf[off + 15];
518 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
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] = (64 + chall_len) * 8;
538 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
540 const u32 r0 = digest[0];
541 const u32 r1 = digest[3];
542 const u32 r2 = digest[2];
543 const u32 r3 = digest[1];
549 __kernel void m05600_m08 (__global pw_t *pws, __global kernel_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)
553 __kernel void m05600_m16 (__global pw_t *pws, __global kernel_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)
557 __kernel void m05600_s04 (__global pw_t *pws, __global kernel_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)
563 const u32 gid = get_global_id (0);
564 const u32 lid = get_local_id (0);
565 const u32 lsz = get_local_size (0);
571 __local u32 s_userdomain_buf[64];
573 for (u32 i = lid; i < 64; i += lsz)
575 s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
578 __local u32 s_chall_buf[256];
580 for (u32 i = lid; i < 256; i += lsz)
582 s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
585 barrier (CLK_LOCAL_MEM_FENCE);
587 if (gid >= gid_max) return;
589 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
590 + netntlm_bufs[salt_pos].domain_len;
592 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
593 + netntlm_bufs[salt_pos].clichall_len;
601 pw_buf0[0] = pws[gid].i[ 0];
602 pw_buf0[1] = pws[gid].i[ 1];
603 pw_buf0[2] = pws[gid].i[ 2];
604 pw_buf0[3] = pws[gid].i[ 3];
608 pw_buf1[0] = pws[gid].i[ 4];
609 pw_buf1[1] = pws[gid].i[ 5];
610 pw_buf1[2] = pws[gid].i[ 6];
611 pw_buf1[3] = pws[gid].i[ 7];
613 const u32 pw_len = pws[gid].pw_len;
619 const u32 search[4] =
621 digests_buf[digests_offset].digest_buf[DGST_R0],
622 digests_buf[digests_offset].digest_buf[DGST_R1],
623 digests_buf[digests_offset].digest_buf[DGST_R2],
624 digests_buf[digests_offset].digest_buf[DGST_R3]
631 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
661 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
663 append_0x80_2x4 (w0, w1, out_len);
670 make_unicode (w0, w0_t, w1_t);
671 make_unicode (w1, w2_t, w3_t);
673 w3_t[2] = out_len * 8 * 2;
682 md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
709 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
714 for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16)
716 w0_t[0] = s_userdomain_buf[off + 0];
717 w0_t[1] = s_userdomain_buf[off + 1];
718 w0_t[2] = s_userdomain_buf[off + 2];
719 w0_t[3] = s_userdomain_buf[off + 3];
720 w1_t[0] = s_userdomain_buf[off + 4];
721 w1_t[1] = s_userdomain_buf[off + 5];
722 w1_t[2] = s_userdomain_buf[off + 6];
723 w1_t[3] = s_userdomain_buf[off + 7];
724 w2_t[0] = s_userdomain_buf[off + 8];
725 w2_t[1] = s_userdomain_buf[off + 9];
726 w2_t[2] = s_userdomain_buf[off + 10];
727 w2_t[3] = s_userdomain_buf[off + 11];
728 w3_t[0] = s_userdomain_buf[off + 12];
729 w3_t[1] = s_userdomain_buf[off + 13];
730 w3_t[2] = s_userdomain_buf[off + 14];
731 w3_t[3] = s_userdomain_buf[off + 15];
733 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
736 w0_t[0] = s_userdomain_buf[off + 0];
737 w0_t[1] = s_userdomain_buf[off + 1];
738 w0_t[2] = s_userdomain_buf[off + 2];
739 w0_t[3] = s_userdomain_buf[off + 3];
740 w1_t[0] = s_userdomain_buf[off + 4];
741 w1_t[1] = s_userdomain_buf[off + 5];
742 w1_t[2] = s_userdomain_buf[off + 6];
743 w1_t[3] = s_userdomain_buf[off + 7];
744 w2_t[0] = s_userdomain_buf[off + 8];
745 w2_t[1] = s_userdomain_buf[off + 9];
746 w2_t[2] = s_userdomain_buf[off + 10];
747 w2_t[3] = s_userdomain_buf[off + 11];
748 w3_t[0] = s_userdomain_buf[off + 12];
749 w3_t[1] = s_userdomain_buf[off + 13];
750 w3_t[2] = (64 + userdomain_len) * 8;
753 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
777 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
779 for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16)
781 w0_t[0] = s_chall_buf[off + 0];
782 w0_t[1] = s_chall_buf[off + 1];
783 w0_t[2] = s_chall_buf[off + 2];
784 w0_t[3] = s_chall_buf[off + 3];
785 w1_t[0] = s_chall_buf[off + 4];
786 w1_t[1] = s_chall_buf[off + 5];
787 w1_t[2] = s_chall_buf[off + 6];
788 w1_t[3] = s_chall_buf[off + 7];
789 w2_t[0] = s_chall_buf[off + 8];
790 w2_t[1] = s_chall_buf[off + 9];
791 w2_t[2] = s_chall_buf[off + 10];
792 w2_t[3] = s_chall_buf[off + 11];
793 w3_t[0] = s_chall_buf[off + 12];
794 w3_t[1] = s_chall_buf[off + 13];
795 w3_t[2] = s_chall_buf[off + 14];
796 w3_t[3] = s_chall_buf[off + 15];
798 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
801 w0_t[0] = s_chall_buf[off + 0];
802 w0_t[1] = s_chall_buf[off + 1];
803 w0_t[2] = s_chall_buf[off + 2];
804 w0_t[3] = s_chall_buf[off + 3];
805 w1_t[0] = s_chall_buf[off + 4];
806 w1_t[1] = s_chall_buf[off + 5];
807 w1_t[2] = s_chall_buf[off + 6];
808 w1_t[3] = s_chall_buf[off + 7];
809 w2_t[0] = s_chall_buf[off + 8];
810 w2_t[1] = s_chall_buf[off + 9];
811 w2_t[2] = s_chall_buf[off + 10];
812 w2_t[3] = s_chall_buf[off + 11];
813 w3_t[0] = s_chall_buf[off + 12];
814 w3_t[1] = s_chall_buf[off + 13];
815 w3_t[2] = (64 + chall_len) * 8;
818 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
820 const u32 r0 = digest[0];
821 const u32 r1 = digest[3];
822 const u32 r2 = digest[2];
823 const u32 r3 = digest[1];
829 __kernel void m05600_s08 (__global pw_t *pws, __global kernel_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)
833 __kernel void m05600_s16 (__global pw_t *pws, __global kernel_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)