2 * Author......: Jens Steube <jens.steube@gmail.com>
10 #include "inc_vendor.cl"
11 #include "inc_hash_constants.h"
12 #include "inc_hash_functions.cl"
13 #include "inc_types.cl"
14 #include "inc_common.cl"
15 #include "inc_simd.cl"
17 void md4_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[4])
41 MD4_STEP (MD4_Fo, a, b, c, d, w0_t, MD4C00, MD4S00);
42 MD4_STEP (MD4_Fo, d, a, b, c, w1_t, MD4C00, MD4S01);
43 MD4_STEP (MD4_Fo, c, d, a, b, w2_t, MD4C00, MD4S02);
44 MD4_STEP (MD4_Fo, b, c, d, a, w3_t, MD4C00, MD4S03);
45 MD4_STEP (MD4_Fo, a, b, c, d, w4_t, MD4C00, MD4S00);
46 MD4_STEP (MD4_Fo, d, a, b, c, w5_t, MD4C00, MD4S01);
47 MD4_STEP (MD4_Fo, c, d, a, b, w6_t, MD4C00, MD4S02);
48 MD4_STEP (MD4_Fo, b, c, d, a, w7_t, MD4C00, MD4S03);
49 MD4_STEP (MD4_Fo, a, b, c, d, w8_t, MD4C00, MD4S00);
50 MD4_STEP (MD4_Fo, d, a, b, c, w9_t, MD4C00, MD4S01);
51 MD4_STEP (MD4_Fo, c, d, a, b, wa_t, MD4C00, MD4S02);
52 MD4_STEP (MD4_Fo, b, c, d, a, wb_t, MD4C00, MD4S03);
53 MD4_STEP (MD4_Fo, a, b, c, d, wc_t, MD4C00, MD4S00);
54 MD4_STEP (MD4_Fo, d, a, b, c, wd_t, MD4C00, MD4S01);
55 MD4_STEP (MD4_Fo, c, d, a, b, we_t, MD4C00, MD4S02);
56 MD4_STEP (MD4_Fo, b, c, d, a, wf_t, MD4C00, MD4S03);
58 MD4_STEP (MD4_Go, a, b, c, d, w0_t, MD4C01, MD4S10);
59 MD4_STEP (MD4_Go, d, a, b, c, w4_t, MD4C01, MD4S11);
60 MD4_STEP (MD4_Go, c, d, a, b, w8_t, MD4C01, MD4S12);
61 MD4_STEP (MD4_Go, b, c, d, a, wc_t, MD4C01, MD4S13);
62 MD4_STEP (MD4_Go, a, b, c, d, w1_t, MD4C01, MD4S10);
63 MD4_STEP (MD4_Go, d, a, b, c, w5_t, MD4C01, MD4S11);
64 MD4_STEP (MD4_Go, c, d, a, b, w9_t, MD4C01, MD4S12);
65 MD4_STEP (MD4_Go, b, c, d, a, wd_t, MD4C01, MD4S13);
66 MD4_STEP (MD4_Go, a, b, c, d, w2_t, MD4C01, MD4S10);
67 MD4_STEP (MD4_Go, d, a, b, c, w6_t, MD4C01, MD4S11);
68 MD4_STEP (MD4_Go, c, d, a, b, wa_t, MD4C01, MD4S12);
69 MD4_STEP (MD4_Go, b, c, d, a, we_t, MD4C01, MD4S13);
70 MD4_STEP (MD4_Go, a, b, c, d, w3_t, MD4C01, MD4S10);
71 MD4_STEP (MD4_Go, d, a, b, c, w7_t, MD4C01, MD4S11);
72 MD4_STEP (MD4_Go, c, d, a, b, wb_t, MD4C01, MD4S12);
73 MD4_STEP (MD4_Go, b, c, d, a, wf_t, MD4C01, MD4S13);
75 MD4_STEP (MD4_H , a, b, c, d, w0_t, MD4C02, MD4S20);
76 MD4_STEP (MD4_H , d, a, b, c, w8_t, MD4C02, MD4S21);
77 MD4_STEP (MD4_H , c, d, a, b, w4_t, MD4C02, MD4S22);
78 MD4_STEP (MD4_H , b, c, d, a, wc_t, MD4C02, MD4S23);
79 MD4_STEP (MD4_H , a, b, c, d, w2_t, MD4C02, MD4S20);
80 MD4_STEP (MD4_H , d, a, b, c, wa_t, MD4C02, MD4S21);
81 MD4_STEP (MD4_H , c, d, a, b, w6_t, MD4C02, MD4S22);
82 MD4_STEP (MD4_H , b, c, d, a, we_t, MD4C02, MD4S23);
83 MD4_STEP (MD4_H , a, b, c, d, w1_t, MD4C02, MD4S20);
84 MD4_STEP (MD4_H , d, a, b, c, w9_t, MD4C02, MD4S21);
85 MD4_STEP (MD4_H , c, d, a, b, w5_t, MD4C02, MD4S22);
86 MD4_STEP (MD4_H , b, c, d, a, wd_t, MD4C02, MD4S23);
87 MD4_STEP (MD4_H , a, b, c, d, w3_t, MD4C02, MD4S20);
88 MD4_STEP (MD4_H , d, a, b, c, wb_t, MD4C02, MD4S21);
89 MD4_STEP (MD4_H , c, d, a, b, w7_t, MD4C02, MD4S22);
90 MD4_STEP (MD4_H , b, c, d, a, wf_t, MD4C02, MD4S23);
98 void md5_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[4])
122 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
123 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
124 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
125 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
126 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
127 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
128 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
129 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
130 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
131 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
132 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
133 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
134 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
135 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
136 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
137 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
139 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
140 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
141 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
142 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
143 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
144 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
145 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
146 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
147 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
148 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
149 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
150 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
151 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
152 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
153 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
154 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
156 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
157 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
158 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
159 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
160 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
161 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
162 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
163 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
164 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
165 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
166 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
167 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
168 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
169 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
170 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
171 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
173 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
174 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
175 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
176 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
177 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
178 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
179 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
180 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
181 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
182 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
183 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
184 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
185 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
186 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
187 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
188 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
196 void hmac_md5_pad (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], u32x ipad[4], u32x opad[4])
198 w0[0] = w0[0] ^ 0x36363636;
199 w0[1] = w0[1] ^ 0x36363636;
200 w0[2] = w0[2] ^ 0x36363636;
201 w0[3] = w0[3] ^ 0x36363636;
202 w1[0] = w1[0] ^ 0x36363636;
203 w1[1] = w1[1] ^ 0x36363636;
204 w1[2] = w1[2] ^ 0x36363636;
205 w1[3] = w1[3] ^ 0x36363636;
206 w2[0] = w2[0] ^ 0x36363636;
207 w2[1] = w2[1] ^ 0x36363636;
208 w2[2] = w2[2] ^ 0x36363636;
209 w2[3] = w2[3] ^ 0x36363636;
210 w3[0] = w3[0] ^ 0x36363636;
211 w3[1] = w3[1] ^ 0x36363636;
212 w3[2] = w3[2] ^ 0x36363636;
213 w3[3] = w3[3] ^ 0x36363636;
220 md5_transform (w0, w1, w2, w3, ipad);
222 w0[0] = w0[0] ^ 0x6a6a6a6a;
223 w0[1] = w0[1] ^ 0x6a6a6a6a;
224 w0[2] = w0[2] ^ 0x6a6a6a6a;
225 w0[3] = w0[3] ^ 0x6a6a6a6a;
226 w1[0] = w1[0] ^ 0x6a6a6a6a;
227 w1[1] = w1[1] ^ 0x6a6a6a6a;
228 w1[2] = w1[2] ^ 0x6a6a6a6a;
229 w1[3] = w1[3] ^ 0x6a6a6a6a;
230 w2[0] = w2[0] ^ 0x6a6a6a6a;
231 w2[1] = w2[1] ^ 0x6a6a6a6a;
232 w2[2] = w2[2] ^ 0x6a6a6a6a;
233 w2[3] = w2[3] ^ 0x6a6a6a6a;
234 w3[0] = w3[0] ^ 0x6a6a6a6a;
235 w3[1] = w3[1] ^ 0x6a6a6a6a;
236 w3[2] = w3[2] ^ 0x6a6a6a6a;
237 w3[3] = w3[3] ^ 0x6a6a6a6a;
244 md5_transform (w0, w1, w2, w3, opad);
247 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])
254 md5_transform (w0, w1, w2, w3, digest);
270 w3[2] = (64 + 16) * 8;
278 md5_transform (w0, w1, w2, w3, digest);
281 __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
287 const u32 gid = get_global_id (0);
288 const u32 lid = get_local_id (0);
289 const u32 lsz = get_local_size (0);
295 __local u32 s_userdomain_buf[64];
297 for (u32 i = lid; i < 64; i += lsz)
299 s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
302 __local u32 s_chall_buf[256];
304 for (u32 i = lid; i < 256; i += lsz)
306 s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
309 barrier (CLK_LOCAL_MEM_FENCE);
311 if (gid >= gid_max) return;
313 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
314 + netntlm_bufs[salt_pos].domain_len;
316 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
317 + netntlm_bufs[salt_pos].clichall_len;
326 pw_buf0[0] = pws[gid].i[0];
327 pw_buf0[1] = pws[gid].i[1];
328 pw_buf0[2] = pws[gid].i[2];
329 pw_buf0[3] = pws[gid].i[3];
330 pw_buf1[0] = pws[gid].i[4];
331 pw_buf1[1] = pws[gid].i[5];
332 pw_buf1[2] = pws[gid].i[6];
333 pw_buf1[3] = pws[gid].i[7];
335 const u32 pw_l_len = pws[gid].pw_len;
341 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
343 const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
345 const u32x pw_len = pw_l_len + pw_r_len;
348 * concat password candidate
351 u32x wordl0[4] = { 0 };
352 u32x wordl1[4] = { 0 };
353 u32x wordl2[4] = { 0 };
354 u32x wordl3[4] = { 0 };
356 wordl0[0] = pw_buf0[0];
357 wordl0[1] = pw_buf0[1];
358 wordl0[2] = pw_buf0[2];
359 wordl0[3] = pw_buf0[3];
360 wordl1[0] = pw_buf1[0];
361 wordl1[1] = pw_buf1[1];
362 wordl1[2] = pw_buf1[2];
363 wordl1[3] = pw_buf1[3];
365 u32x wordr0[4] = { 0 };
366 u32x wordr1[4] = { 0 };
367 u32x wordr2[4] = { 0 };
368 u32x wordr3[4] = { 0 };
370 wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
371 wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
372 wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
373 wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
374 wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
375 wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
376 wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
377 wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
379 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
381 switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
385 switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
393 w0[0] = wordl0[0] | wordr0[0];
394 w0[1] = wordl0[1] | wordr0[1];
395 w0[2] = wordl0[2] | wordr0[2];
396 w0[3] = wordl0[3] | wordr0[3];
397 w1[0] = wordl1[0] | wordr1[0];
398 w1[1] = wordl1[1] | wordr1[1];
399 w1[2] = wordl1[2] | wordr1[2];
400 w1[3] = wordl1[3] | wordr1[3];
401 w2[0] = wordl2[0] | wordr2[0];
402 w2[1] = wordl2[1] | wordr2[1];
403 w2[2] = wordl2[2] | wordr2[2];
404 w2[3] = wordl2[3] | wordr2[3];
405 w3[0] = wordl3[0] | wordr3[0];
406 w3[1] = wordl3[1] | wordr3[1];
407 w3[2] = wordl3[2] | wordr3[2];
408 w3[3] = wordl3[3] | wordr3[3];
415 make_unicode (w0, w0_t, w1_t);
416 make_unicode (w1, w2_t, w3_t);
418 w3_t[2] = pw_len * 8 * 2;
428 md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
455 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
460 for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16)
462 w0_t[0] = s_userdomain_buf[off + 0];
463 w0_t[1] = s_userdomain_buf[off + 1];
464 w0_t[2] = s_userdomain_buf[off + 2];
465 w0_t[3] = s_userdomain_buf[off + 3];
466 w1_t[0] = s_userdomain_buf[off + 4];
467 w1_t[1] = s_userdomain_buf[off + 5];
468 w1_t[2] = s_userdomain_buf[off + 6];
469 w1_t[3] = s_userdomain_buf[off + 7];
470 w2_t[0] = s_userdomain_buf[off + 8];
471 w2_t[1] = s_userdomain_buf[off + 9];
472 w2_t[2] = s_userdomain_buf[off + 10];
473 w2_t[3] = s_userdomain_buf[off + 11];
474 w3_t[0] = s_userdomain_buf[off + 12];
475 w3_t[1] = s_userdomain_buf[off + 13];
476 w3_t[2] = s_userdomain_buf[off + 14];
477 w3_t[3] = s_userdomain_buf[off + 15];
479 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
482 w0_t[0] = s_userdomain_buf[off + 0];
483 w0_t[1] = s_userdomain_buf[off + 1];
484 w0_t[2] = s_userdomain_buf[off + 2];
485 w0_t[3] = s_userdomain_buf[off + 3];
486 w1_t[0] = s_userdomain_buf[off + 4];
487 w1_t[1] = s_userdomain_buf[off + 5];
488 w1_t[2] = s_userdomain_buf[off + 6];
489 w1_t[3] = s_userdomain_buf[off + 7];
490 w2_t[0] = s_userdomain_buf[off + 8];
491 w2_t[1] = s_userdomain_buf[off + 9];
492 w2_t[2] = s_userdomain_buf[off + 10];
493 w2_t[3] = s_userdomain_buf[off + 11];
494 w3_t[0] = s_userdomain_buf[off + 12];
495 w3_t[1] = s_userdomain_buf[off + 13];
496 w3_t[2] = (64 + userdomain_len) * 8;
499 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
523 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
525 for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16)
527 w0_t[0] = s_chall_buf[off + 0];
528 w0_t[1] = s_chall_buf[off + 1];
529 w0_t[2] = s_chall_buf[off + 2];
530 w0_t[3] = s_chall_buf[off + 3];
531 w1_t[0] = s_chall_buf[off + 4];
532 w1_t[1] = s_chall_buf[off + 5];
533 w1_t[2] = s_chall_buf[off + 6];
534 w1_t[3] = s_chall_buf[off + 7];
535 w2_t[0] = s_chall_buf[off + 8];
536 w2_t[1] = s_chall_buf[off + 9];
537 w2_t[2] = s_chall_buf[off + 10];
538 w2_t[3] = s_chall_buf[off + 11];
539 w3_t[0] = s_chall_buf[off + 12];
540 w3_t[1] = s_chall_buf[off + 13];
541 w3_t[2] = s_chall_buf[off + 14];
542 w3_t[3] = s_chall_buf[off + 15];
544 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
547 w0_t[0] = s_chall_buf[off + 0];
548 w0_t[1] = s_chall_buf[off + 1];
549 w0_t[2] = s_chall_buf[off + 2];
550 w0_t[3] = s_chall_buf[off + 3];
551 w1_t[0] = s_chall_buf[off + 4];
552 w1_t[1] = s_chall_buf[off + 5];
553 w1_t[2] = s_chall_buf[off + 6];
554 w1_t[3] = s_chall_buf[off + 7];
555 w2_t[0] = s_chall_buf[off + 8];
556 w2_t[1] = s_chall_buf[off + 9];
557 w2_t[2] = s_chall_buf[off + 10];
558 w2_t[3] = s_chall_buf[off + 11];
559 w3_t[0] = s_chall_buf[off + 12];
560 w3_t[1] = s_chall_buf[off + 13];
561 w3_t[2] = (64 + chall_len) * 8;
564 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
566 COMPARE_M_SIMD (digest[0], digest[3], digest[2], digest[1]);
570 __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
574 __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
578 __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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 const u32 gid = get_global_id (0);
585 const u32 lid = get_local_id (0);
586 const u32 lsz = get_local_size (0);
592 __local u32 s_userdomain_buf[64];
594 for (u32 i = lid; i < 64; i += lsz)
596 s_userdomain_buf[i] = netntlm_bufs[salt_pos].userdomain_buf[i];
599 __local u32 s_chall_buf[256];
601 for (u32 i = lid; i < 256; i += lsz)
603 s_chall_buf[i] = netntlm_bufs[salt_pos].chall_buf[i];
606 barrier (CLK_LOCAL_MEM_FENCE);
608 if (gid >= gid_max) return;
610 const u32 userdomain_len = netntlm_bufs[salt_pos].user_len
611 + netntlm_bufs[salt_pos].domain_len;
613 const u32 chall_len = netntlm_bufs[salt_pos].srvchall_len
614 + netntlm_bufs[salt_pos].clichall_len;
623 pw_buf0[0] = pws[gid].i[0];
624 pw_buf0[1] = pws[gid].i[1];
625 pw_buf0[2] = pws[gid].i[2];
626 pw_buf0[3] = pws[gid].i[3];
627 pw_buf1[0] = pws[gid].i[4];
628 pw_buf1[1] = pws[gid].i[5];
629 pw_buf1[2] = pws[gid].i[6];
630 pw_buf1[3] = pws[gid].i[7];
632 const u32 pw_l_len = pws[gid].pw_len;
638 const u32 search[4] =
640 digests_buf[digests_offset].digest_buf[DGST_R0],
641 digests_buf[digests_offset].digest_buf[DGST_R1],
642 digests_buf[digests_offset].digest_buf[DGST_R2],
643 digests_buf[digests_offset].digest_buf[DGST_R3]
650 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
652 const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
654 const u32x pw_len = pw_l_len + pw_r_len;
657 * concat password candidate
660 u32x wordl0[4] = { 0 };
661 u32x wordl1[4] = { 0 };
662 u32x wordl2[4] = { 0 };
663 u32x wordl3[4] = { 0 };
665 wordl0[0] = pw_buf0[0];
666 wordl0[1] = pw_buf0[1];
667 wordl0[2] = pw_buf0[2];
668 wordl0[3] = pw_buf0[3];
669 wordl1[0] = pw_buf1[0];
670 wordl1[1] = pw_buf1[1];
671 wordl1[2] = pw_buf1[2];
672 wordl1[3] = pw_buf1[3];
674 u32x wordr0[4] = { 0 };
675 u32x wordr1[4] = { 0 };
676 u32x wordr2[4] = { 0 };
677 u32x wordr3[4] = { 0 };
679 wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
680 wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
681 wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
682 wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
683 wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
684 wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
685 wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
686 wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
688 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
690 switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
694 switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
702 w0[0] = wordl0[0] | wordr0[0];
703 w0[1] = wordl0[1] | wordr0[1];
704 w0[2] = wordl0[2] | wordr0[2];
705 w0[3] = wordl0[3] | wordr0[3];
706 w1[0] = wordl1[0] | wordr1[0];
707 w1[1] = wordl1[1] | wordr1[1];
708 w1[2] = wordl1[2] | wordr1[2];
709 w1[3] = wordl1[3] | wordr1[3];
710 w2[0] = wordl2[0] | wordr2[0];
711 w2[1] = wordl2[1] | wordr2[1];
712 w2[2] = wordl2[2] | wordr2[2];
713 w2[3] = wordl2[3] | wordr2[3];
714 w3[0] = wordl3[0] | wordr3[0];
715 w3[1] = wordl3[1] | wordr3[1];
716 w3[2] = wordl3[2] | wordr3[2];
717 w3[3] = wordl3[3] | wordr3[3];
724 make_unicode (w0, w0_t, w1_t);
725 make_unicode (w1, w2_t, w3_t);
727 w3_t[2] = pw_len * 8 * 2;
737 md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
764 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
769 for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16)
771 w0_t[0] = s_userdomain_buf[off + 0];
772 w0_t[1] = s_userdomain_buf[off + 1];
773 w0_t[2] = s_userdomain_buf[off + 2];
774 w0_t[3] = s_userdomain_buf[off + 3];
775 w1_t[0] = s_userdomain_buf[off + 4];
776 w1_t[1] = s_userdomain_buf[off + 5];
777 w1_t[2] = s_userdomain_buf[off + 6];
778 w1_t[3] = s_userdomain_buf[off + 7];
779 w2_t[0] = s_userdomain_buf[off + 8];
780 w2_t[1] = s_userdomain_buf[off + 9];
781 w2_t[2] = s_userdomain_buf[off + 10];
782 w2_t[3] = s_userdomain_buf[off + 11];
783 w3_t[0] = s_userdomain_buf[off + 12];
784 w3_t[1] = s_userdomain_buf[off + 13];
785 w3_t[2] = s_userdomain_buf[off + 14];
786 w3_t[3] = s_userdomain_buf[off + 15];
788 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
791 w0_t[0] = s_userdomain_buf[off + 0];
792 w0_t[1] = s_userdomain_buf[off + 1];
793 w0_t[2] = s_userdomain_buf[off + 2];
794 w0_t[3] = s_userdomain_buf[off + 3];
795 w1_t[0] = s_userdomain_buf[off + 4];
796 w1_t[1] = s_userdomain_buf[off + 5];
797 w1_t[2] = s_userdomain_buf[off + 6];
798 w1_t[3] = s_userdomain_buf[off + 7];
799 w2_t[0] = s_userdomain_buf[off + 8];
800 w2_t[1] = s_userdomain_buf[off + 9];
801 w2_t[2] = s_userdomain_buf[off + 10];
802 w2_t[3] = s_userdomain_buf[off + 11];
803 w3_t[0] = s_userdomain_buf[off + 12];
804 w3_t[1] = s_userdomain_buf[off + 13];
805 w3_t[2] = (64 + userdomain_len) * 8;
808 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
832 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
834 for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16)
836 w0_t[0] = s_chall_buf[off + 0];
837 w0_t[1] = s_chall_buf[off + 1];
838 w0_t[2] = s_chall_buf[off + 2];
839 w0_t[3] = s_chall_buf[off + 3];
840 w1_t[0] = s_chall_buf[off + 4];
841 w1_t[1] = s_chall_buf[off + 5];
842 w1_t[2] = s_chall_buf[off + 6];
843 w1_t[3] = s_chall_buf[off + 7];
844 w2_t[0] = s_chall_buf[off + 8];
845 w2_t[1] = s_chall_buf[off + 9];
846 w2_t[2] = s_chall_buf[off + 10];
847 w2_t[3] = s_chall_buf[off + 11];
848 w3_t[0] = s_chall_buf[off + 12];
849 w3_t[1] = s_chall_buf[off + 13];
850 w3_t[2] = s_chall_buf[off + 14];
851 w3_t[3] = s_chall_buf[off + 15];
853 md5_transform (w0_t, w1_t, w2_t, w3_t, ipad);
856 w0_t[0] = s_chall_buf[off + 0];
857 w0_t[1] = s_chall_buf[off + 1];
858 w0_t[2] = s_chall_buf[off + 2];
859 w0_t[3] = s_chall_buf[off + 3];
860 w1_t[0] = s_chall_buf[off + 4];
861 w1_t[1] = s_chall_buf[off + 5];
862 w1_t[2] = s_chall_buf[off + 6];
863 w1_t[3] = s_chall_buf[off + 7];
864 w2_t[0] = s_chall_buf[off + 8];
865 w2_t[1] = s_chall_buf[off + 9];
866 w2_t[2] = s_chall_buf[off + 10];
867 w2_t[3] = s_chall_buf[off + 11];
868 w3_t[0] = s_chall_buf[off + 12];
869 w3_t[1] = s_chall_buf[off + 13];
870 w3_t[2] = (64 + chall_len) * 8;
873 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
875 COMPARE_S_SIMD (digest[0], digest[3], digest[2], digest[1]);
879 __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
883 __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)