2 * Author......: Jens Steube <jens.steube@gmail.com>
10 #include "inc_hash_constants.h"
11 #include "inc_vendor.cl"
18 #include "inc_hash_functions.cl"
19 #include "inc_types.cl"
20 #include "inc_common.cl"
21 #include "inc_simd.cl"
23 void md4_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[4])
47 MD4_STEP (MD4_Fo, a, b, c, d, w0_t, MD4C00, MD4S00);
48 MD4_STEP (MD4_Fo, d, a, b, c, w1_t, MD4C00, MD4S01);
49 MD4_STEP (MD4_Fo, c, d, a, b, w2_t, MD4C00, MD4S02);
50 MD4_STEP (MD4_Fo, b, c, d, a, w3_t, MD4C00, MD4S03);
51 MD4_STEP (MD4_Fo, a, b, c, d, w4_t, MD4C00, MD4S00);
52 MD4_STEP (MD4_Fo, d, a, b, c, w5_t, MD4C00, MD4S01);
53 MD4_STEP (MD4_Fo, c, d, a, b, w6_t, MD4C00, MD4S02);
54 MD4_STEP (MD4_Fo, b, c, d, a, w7_t, MD4C00, MD4S03);
55 MD4_STEP (MD4_Fo, a, b, c, d, w8_t, MD4C00, MD4S00);
56 MD4_STEP (MD4_Fo, d, a, b, c, w9_t, MD4C00, MD4S01);
57 MD4_STEP (MD4_Fo, c, d, a, b, wa_t, MD4C00, MD4S02);
58 MD4_STEP (MD4_Fo, b, c, d, a, wb_t, MD4C00, MD4S03);
59 MD4_STEP (MD4_Fo, a, b, c, d, wc_t, MD4C00, MD4S00);
60 MD4_STEP (MD4_Fo, d, a, b, c, wd_t, MD4C00, MD4S01);
61 MD4_STEP (MD4_Fo, c, d, a, b, we_t, MD4C00, MD4S02);
62 MD4_STEP (MD4_Fo, b, c, d, a, wf_t, MD4C00, MD4S03);
64 MD4_STEP (MD4_Go, a, b, c, d, w0_t, MD4C01, MD4S10);
65 MD4_STEP (MD4_Go, d, a, b, c, w4_t, MD4C01, MD4S11);
66 MD4_STEP (MD4_Go, c, d, a, b, w8_t, MD4C01, MD4S12);
67 MD4_STEP (MD4_Go, b, c, d, a, wc_t, MD4C01, MD4S13);
68 MD4_STEP (MD4_Go, a, b, c, d, w1_t, MD4C01, MD4S10);
69 MD4_STEP (MD4_Go, d, a, b, c, w5_t, MD4C01, MD4S11);
70 MD4_STEP (MD4_Go, c, d, a, b, w9_t, MD4C01, MD4S12);
71 MD4_STEP (MD4_Go, b, c, d, a, wd_t, MD4C01, MD4S13);
72 MD4_STEP (MD4_Go, a, b, c, d, w2_t, MD4C01, MD4S10);
73 MD4_STEP (MD4_Go, d, a, b, c, w6_t, MD4C01, MD4S11);
74 MD4_STEP (MD4_Go, c, d, a, b, wa_t, MD4C01, MD4S12);
75 MD4_STEP (MD4_Go, b, c, d, a, we_t, MD4C01, MD4S13);
76 MD4_STEP (MD4_Go, a, b, c, d, w3_t, MD4C01, MD4S10);
77 MD4_STEP (MD4_Go, d, a, b, c, w7_t, MD4C01, MD4S11);
78 MD4_STEP (MD4_Go, c, d, a, b, wb_t, MD4C01, MD4S12);
79 MD4_STEP (MD4_Go, b, c, d, a, wf_t, MD4C01, MD4S13);
81 MD4_STEP (MD4_H , a, b, c, d, w0_t, MD4C02, MD4S20);
82 MD4_STEP (MD4_H , d, a, b, c, w8_t, MD4C02, MD4S21);
83 MD4_STEP (MD4_H , c, d, a, b, w4_t, MD4C02, MD4S22);
84 MD4_STEP (MD4_H , b, c, d, a, wc_t, MD4C02, MD4S23);
85 MD4_STEP (MD4_H , a, b, c, d, w2_t, MD4C02, MD4S20);
86 MD4_STEP (MD4_H , d, a, b, c, wa_t, MD4C02, MD4S21);
87 MD4_STEP (MD4_H , c, d, a, b, w6_t, MD4C02, MD4S22);
88 MD4_STEP (MD4_H , b, c, d, a, we_t, MD4C02, MD4S23);
89 MD4_STEP (MD4_H , a, b, c, d, w1_t, MD4C02, MD4S20);
90 MD4_STEP (MD4_H , d, a, b, c, w9_t, MD4C02, MD4S21);
91 MD4_STEP (MD4_H , c, d, a, b, w5_t, MD4C02, MD4S22);
92 MD4_STEP (MD4_H , b, c, d, a, wd_t, MD4C02, MD4S23);
93 MD4_STEP (MD4_H , a, b, c, d, w3_t, MD4C02, MD4S20);
94 MD4_STEP (MD4_H , d, a, b, c, wb_t, MD4C02, MD4S21);
95 MD4_STEP (MD4_H , c, d, a, b, w7_t, MD4C02, MD4S22);
96 MD4_STEP (MD4_H , b, c, d, a, wf_t, MD4C02, MD4S23);
104 void md5_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[4])
128 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
129 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
130 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
131 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
132 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
133 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
134 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
135 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
136 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
137 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
138 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
139 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
140 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
141 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
142 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
143 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
145 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
146 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
147 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
148 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
149 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
150 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
151 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
152 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
153 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
154 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
155 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
156 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
157 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
158 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
159 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
160 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
162 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
163 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
164 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
165 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
166 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
167 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
168 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
169 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
170 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
171 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
172 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
173 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
174 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
175 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
176 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
177 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
179 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
180 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
181 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
182 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
183 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
184 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
185 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
186 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
187 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
188 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
189 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
190 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
191 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
192 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
193 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
194 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
202 void hmac_md5_pad (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], u32x ipad[4], u32x opad[4])
204 w0[0] = w0[0] ^ 0x36363636;
205 w0[1] = w0[1] ^ 0x36363636;
206 w0[2] = w0[2] ^ 0x36363636;
207 w0[3] = w0[3] ^ 0x36363636;
208 w1[0] = w1[0] ^ 0x36363636;
209 w1[1] = w1[1] ^ 0x36363636;
210 w1[2] = w1[2] ^ 0x36363636;
211 w1[3] = w1[3] ^ 0x36363636;
212 w2[0] = w2[0] ^ 0x36363636;
213 w2[1] = w2[1] ^ 0x36363636;
214 w2[2] = w2[2] ^ 0x36363636;
215 w2[3] = w2[3] ^ 0x36363636;
216 w3[0] = w3[0] ^ 0x36363636;
217 w3[1] = w3[1] ^ 0x36363636;
218 w3[2] = w3[2] ^ 0x36363636;
219 w3[3] = w3[3] ^ 0x36363636;
226 md5_transform (w0, w1, w2, w3, ipad);
228 w0[0] = w0[0] ^ 0x6a6a6a6a;
229 w0[1] = w0[1] ^ 0x6a6a6a6a;
230 w0[2] = w0[2] ^ 0x6a6a6a6a;
231 w0[3] = w0[3] ^ 0x6a6a6a6a;
232 w1[0] = w1[0] ^ 0x6a6a6a6a;
233 w1[1] = w1[1] ^ 0x6a6a6a6a;
234 w1[2] = w1[2] ^ 0x6a6a6a6a;
235 w1[3] = w1[3] ^ 0x6a6a6a6a;
236 w2[0] = w2[0] ^ 0x6a6a6a6a;
237 w2[1] = w2[1] ^ 0x6a6a6a6a;
238 w2[2] = w2[2] ^ 0x6a6a6a6a;
239 w2[3] = w2[3] ^ 0x6a6a6a6a;
240 w3[0] = w3[0] ^ 0x6a6a6a6a;
241 w3[1] = w3[1] ^ 0x6a6a6a6a;
242 w3[2] = w3[2] ^ 0x6a6a6a6a;
243 w3[3] = w3[3] ^ 0x6a6a6a6a;
250 md5_transform (w0, w1, w2, w3, opad);
253 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])
260 md5_transform (w0, w1, w2, w3, digest);
276 w3[2] = (64 + 16) * 8;
284 md5_transform (w0, w1, w2, w3, digest);
287 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
293 const u32 gid = get_global_id (0);
294 const u32 lid = get_local_id (0);
295 const u32 lsz = get_local_size (0);
301 __local u32 s_userdomain_buf[64];
303 for (u32 i = lid; i < 64; i += lsz)
305 s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
308 __local u32 s_chall_buf[256];
310 for (u32 i = lid; i < 256; i += lsz)
312 s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
315 barrier (CLK_LOCAL_MEM_FENCE);
317 if (gid >= gid_max) return;
319 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
320 + netntlm_bufs[salt_pos].domain_len;
322 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
323 + netntlm_bufs[salt_pos].clichall_len;
332 pw_buf0[0] = pws[gid].i[0];
333 pw_buf0[1] = pws[gid].i[1];
334 pw_buf0[2] = pws[gid].i[2];
335 pw_buf0[3] = pws[gid].i[3];
336 pw_buf1[0] = pws[gid].i[4];
337 pw_buf1[1] = pws[gid].i[5];
338 pw_buf1[2] = pws[gid].i[6];
339 pw_buf1[3] = pws[gid].i[7];
341 const u32 pw_l_len = pws[gid].pw_len;
347 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
349 const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
351 const u32x pw_len = pw_l_len + pw_r_len;
354 * concat password candidate
357 u32x wordl0[4] = { 0 };
358 u32x wordl1[4] = { 0 };
359 u32x wordl2[4] = { 0 };
360 u32x wordl3[4] = { 0 };
362 wordl0[0] = pw_buf0[0];
363 wordl0[1] = pw_buf0[1];
364 wordl0[2] = pw_buf0[2];
365 wordl0[3] = pw_buf0[3];
366 wordl1[0] = pw_buf1[0];
367 wordl1[1] = pw_buf1[1];
368 wordl1[2] = pw_buf1[2];
369 wordl1[3] = pw_buf1[3];
371 u32x wordr0[4] = { 0 };
372 u32x wordr1[4] = { 0 };
373 u32x wordr2[4] = { 0 };
374 u32x wordr3[4] = { 0 };
376 wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
377 wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
378 wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
379 wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
380 wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
381 wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
382 wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
383 wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
385 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
387 switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
391 switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
399 w0[0] = wordl0[0] | wordr0[0];
400 w0[1] = wordl0[1] | wordr0[1];
401 w0[2] = wordl0[2] | wordr0[2];
402 w0[3] = wordl0[3] | wordr0[3];
403 w1[0] = wordl1[0] | wordr1[0];
404 w1[1] = wordl1[1] | wordr1[1];
405 w1[2] = wordl1[2] | wordr1[2];
406 w1[3] = wordl1[3] | wordr1[3];
407 w2[0] = wordl2[0] | wordr2[0];
408 w2[1] = wordl2[1] | wordr2[1];
409 w2[2] = wordl2[2] | wordr2[2];
410 w2[3] = wordl2[3] | wordr2[3];
411 w3[0] = wordl3[0] | wordr3[0];
412 w3[1] = wordl3[1] | wordr3[1];
413 w3[2] = wordl3[2] | wordr3[2];
414 w3[3] = wordl3[3] | wordr3[3];
421 make_unicode (w0, w0_t, w1_t);
422 make_unicode (w1, w2_t, w3_t);
424 w3_t[2] = pw_len * 8 * 2;
434 md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
461 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
466 for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16)
468 w0_t[0] = s_userdomain_buf[off + 0];
469 w0_t[1] = s_userdomain_buf[off + 1];
470 w0_t[2] = s_userdomain_buf[off + 2];
471 w0_t[3] = s_userdomain_buf[off + 3];
472 w1_t[0] = s_userdomain_buf[off + 4];
473 w1_t[1] = s_userdomain_buf[off + 5];
474 w1_t[2] = s_userdomain_buf[off + 6];
475 w1_t[3] = s_userdomain_buf[off + 7];
476 w2_t[0] = s_userdomain_buf[off + 8];
477 w2_t[1] = s_userdomain_buf[off + 9];
478 w2_t[2] = s_userdomain_buf[off + 10];
479 w2_t[3] = s_userdomain_buf[off + 11];
480 w3_t[0] = s_userdomain_buf[off + 12];
481 w3_t[1] = s_userdomain_buf[off + 13];
482 w3_t[2] = s_userdomain_buf[off + 14];
483 w3_t[3] = s_userdomain_buf[off + 15];
485 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
488 w0_t[0] = s_userdomain_buf[off + 0];
489 w0_t[1] = s_userdomain_buf[off + 1];
490 w0_t[2] = s_userdomain_buf[off + 2];
491 w0_t[3] = s_userdomain_buf[off + 3];
492 w1_t[0] = s_userdomain_buf[off + 4];
493 w1_t[1] = s_userdomain_buf[off + 5];
494 w1_t[2] = s_userdomain_buf[off + 6];
495 w1_t[3] = s_userdomain_buf[off + 7];
496 w2_t[0] = s_userdomain_buf[off + 8];
497 w2_t[1] = s_userdomain_buf[off + 9];
498 w2_t[2] = s_userdomain_buf[off + 10];
499 w2_t[3] = s_userdomain_buf[off + 11];
500 w3_t[0] = s_userdomain_buf[off + 12];
501 w3_t[1] = s_userdomain_buf[off + 13];
502 w3_t[2] = (64 + userdomain_len) * 8;
505 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
529 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
531 for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16)
533 w0_t[0] = s_chall_buf[off + 0];
534 w0_t[1] = s_chall_buf[off + 1];
535 w0_t[2] = s_chall_buf[off + 2];
536 w0_t[3] = s_chall_buf[off + 3];
537 w1_t[0] = s_chall_buf[off + 4];
538 w1_t[1] = s_chall_buf[off + 5];
539 w1_t[2] = s_chall_buf[off + 6];
540 w1_t[3] = s_chall_buf[off + 7];
541 w2_t[0] = s_chall_buf[off + 8];
542 w2_t[1] = s_chall_buf[off + 9];
543 w2_t[2] = s_chall_buf[off + 10];
544 w2_t[3] = s_chall_buf[off + 11];
545 w3_t[0] = s_chall_buf[off + 12];
546 w3_t[1] = s_chall_buf[off + 13];
547 w3_t[2] = s_chall_buf[off + 14];
548 w3_t[3] = s_chall_buf[off + 15];
550 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
553 w0_t[0] = s_chall_buf[off + 0];
554 w0_t[1] = s_chall_buf[off + 1];
555 w0_t[2] = s_chall_buf[off + 2];
556 w0_t[3] = s_chall_buf[off + 3];
557 w1_t[0] = s_chall_buf[off + 4];
558 w1_t[1] = s_chall_buf[off + 5];
559 w1_t[2] = s_chall_buf[off + 6];
560 w1_t[3] = s_chall_buf[off + 7];
561 w2_t[0] = s_chall_buf[off + 8];
562 w2_t[1] = s_chall_buf[off + 9];
563 w2_t[2] = s_chall_buf[off + 10];
564 w2_t[3] = s_chall_buf[off + 11];
565 w3_t[0] = s_chall_buf[off + 12];
566 w3_t[1] = s_chall_buf[off + 13];
567 w3_t[2] = (64 + chall_len) * 8;
570 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
572 COMPARE_M_SIMD (digest[0], digest[3], digest[2], digest[1]);
576 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
580 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
584 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
590 const u32 gid = get_global_id (0);
591 const u32 lid = get_local_id (0);
592 const u32 lsz = get_local_size (0);
598 __local u32 s_userdomain_buf[64];
600 for (u32 i = lid; i < 64; i += lsz)
602 s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
605 __local u32 s_chall_buf[256];
607 for (u32 i = lid; i < 256; i += lsz)
609 s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
612 barrier (CLK_LOCAL_MEM_FENCE);
614 if (gid >= gid_max) return;
616 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
617 + netntlm_bufs[salt_pos].domain_len;
619 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
620 + netntlm_bufs[salt_pos].clichall_len;
629 pw_buf0[0] = pws[gid].i[0];
630 pw_buf0[1] = pws[gid].i[1];
631 pw_buf0[2] = pws[gid].i[2];
632 pw_buf0[3] = pws[gid].i[3];
633 pw_buf1[0] = pws[gid].i[4];
634 pw_buf1[1] = pws[gid].i[5];
635 pw_buf1[2] = pws[gid].i[6];
636 pw_buf1[3] = pws[gid].i[7];
638 const u32 pw_l_len = pws[gid].pw_len;
644 const u32 search[4] =
646 digests_buf[digests_offset].digest_buf[DGST_R0],
647 digests_buf[digests_offset].digest_buf[DGST_R1],
648 digests_buf[digests_offset].digest_buf[DGST_R2],
649 digests_buf[digests_offset].digest_buf[DGST_R3]
656 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
658 const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
660 const u32x pw_len = pw_l_len + pw_r_len;
663 * concat password candidate
666 u32x wordl0[4] = { 0 };
667 u32x wordl1[4] = { 0 };
668 u32x wordl2[4] = { 0 };
669 u32x wordl3[4] = { 0 };
671 wordl0[0] = pw_buf0[0];
672 wordl0[1] = pw_buf0[1];
673 wordl0[2] = pw_buf0[2];
674 wordl0[3] = pw_buf0[3];
675 wordl1[0] = pw_buf1[0];
676 wordl1[1] = pw_buf1[1];
677 wordl1[2] = pw_buf1[2];
678 wordl1[3] = pw_buf1[3];
680 u32x wordr0[4] = { 0 };
681 u32x wordr1[4] = { 0 };
682 u32x wordr2[4] = { 0 };
683 u32x wordr3[4] = { 0 };
685 wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
686 wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
687 wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
688 wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
689 wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
690 wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
691 wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
692 wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
694 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
696 switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
700 switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
708 w0[0] = wordl0[0] | wordr0[0];
709 w0[1] = wordl0[1] | wordr0[1];
710 w0[2] = wordl0[2] | wordr0[2];
711 w0[3] = wordl0[3] | wordr0[3];
712 w1[0] = wordl1[0] | wordr1[0];
713 w1[1] = wordl1[1] | wordr1[1];
714 w1[2] = wordl1[2] | wordr1[2];
715 w1[3] = wordl1[3] | wordr1[3];
716 w2[0] = wordl2[0] | wordr2[0];
717 w2[1] = wordl2[1] | wordr2[1];
718 w2[2] = wordl2[2] | wordr2[2];
719 w2[3] = wordl2[3] | wordr2[3];
720 w3[0] = wordl3[0] | wordr3[0];
721 w3[1] = wordl3[1] | wordr3[1];
722 w3[2] = wordl3[2] | wordr3[2];
723 w3[3] = wordl3[3] | wordr3[3];
730 make_unicode (w0, w0_t, w1_t);
731 make_unicode (w1, w2_t, w3_t);
733 w3_t[2] = pw_len * 8 * 2;
743 md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
770 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
775 for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16)
777 w0_t[0] = s_userdomain_buf[off + 0];
778 w0_t[1] = s_userdomain_buf[off + 1];
779 w0_t[2] = s_userdomain_buf[off + 2];
780 w0_t[3] = s_userdomain_buf[off + 3];
781 w1_t[0] = s_userdomain_buf[off + 4];
782 w1_t[1] = s_userdomain_buf[off + 5];
783 w1_t[2] = s_userdomain_buf[off + 6];
784 w1_t[3] = s_userdomain_buf[off + 7];
785 w2_t[0] = s_userdomain_buf[off + 8];
786 w2_t[1] = s_userdomain_buf[off + 9];
787 w2_t[2] = s_userdomain_buf[off + 10];
788 w2_t[3] = s_userdomain_buf[off + 11];
789 w3_t[0] = s_userdomain_buf[off + 12];
790 w3_t[1] = s_userdomain_buf[off + 13];
791 w3_t[2] = s_userdomain_buf[off + 14];
792 w3_t[3] = s_userdomain_buf[off + 15];
794 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
797 w0_t[0] = s_userdomain_buf[off + 0];
798 w0_t[1] = s_userdomain_buf[off + 1];
799 w0_t[2] = s_userdomain_buf[off + 2];
800 w0_t[3] = s_userdomain_buf[off + 3];
801 w1_t[0] = s_userdomain_buf[off + 4];
802 w1_t[1] = s_userdomain_buf[off + 5];
803 w1_t[2] = s_userdomain_buf[off + 6];
804 w1_t[3] = s_userdomain_buf[off + 7];
805 w2_t[0] = s_userdomain_buf[off + 8];
806 w2_t[1] = s_userdomain_buf[off + 9];
807 w2_t[2] = s_userdomain_buf[off + 10];
808 w2_t[3] = s_userdomain_buf[off + 11];
809 w3_t[0] = s_userdomain_buf[off + 12];
810 w3_t[1] = s_userdomain_buf[off + 13];
811 w3_t[2] = (64 + userdomain_len) * 8;
814 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
838 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
840 for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16)
842 w0_t[0] = s_chall_buf[off + 0];
843 w0_t[1] = s_chall_buf[off + 1];
844 w0_t[2] = s_chall_buf[off + 2];
845 w0_t[3] = s_chall_buf[off + 3];
846 w1_t[0] = s_chall_buf[off + 4];
847 w1_t[1] = s_chall_buf[off + 5];
848 w1_t[2] = s_chall_buf[off + 6];
849 w1_t[3] = s_chall_buf[off + 7];
850 w2_t[0] = s_chall_buf[off + 8];
851 w2_t[1] = s_chall_buf[off + 9];
852 w2_t[2] = s_chall_buf[off + 10];
853 w2_t[3] = s_chall_buf[off + 11];
854 w3_t[0] = s_chall_buf[off + 12];
855 w3_t[1] = s_chall_buf[off + 13];
856 w3_t[2] = s_chall_buf[off + 14];
857 w3_t[3] = s_chall_buf[off + 15];
859 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
862 w0_t[0] = s_chall_buf[off + 0];
863 w0_t[1] = s_chall_buf[off + 1];
864 w0_t[2] = s_chall_buf[off + 2];
865 w0_t[3] = s_chall_buf[off + 3];
866 w1_t[0] = s_chall_buf[off + 4];
867 w1_t[1] = s_chall_buf[off + 5];
868 w1_t[2] = s_chall_buf[off + 6];
869 w1_t[3] = s_chall_buf[off + 7];
870 w2_t[0] = s_chall_buf[off + 8];
871 w2_t[1] = s_chall_buf[off + 9];
872 w2_t[2] = s_chall_buf[off + 10];
873 w2_t[3] = s_chall_buf[off + 11];
874 w3_t[0] = s_chall_buf[off + 12];
875 w3_t[1] = s_chall_buf[off + 13];
876 w3_t[2] = (64 + chall_len) * 8;
879 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
881 COMPARE_S_SIMD (digest[0], digest[3], digest[2], digest[1]);
885 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
889 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)