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"
28 static void swap (__local RC4_KEY *rc4_key, const u8 i, const u8 j)
33 rc4_key->S[i] = rc4_key->S[j];
37 static void rc4_init_16 (__local RC4_KEY *rc4_key, const u32 data[4])
42 __local u32 *ptr = (__local u32 *) rc4_key->S;
45 for (u32 i = 0; i < 64; i++)
52 for (u32 i = 0; i < 16; i++)
60 j += rc4_key->S[idx] + (v >> 0); swap (rc4_key, idx, j); idx++;
61 j += rc4_key->S[idx] + (v >> 8); swap (rc4_key, idx, j); idx++;
62 j += rc4_key->S[idx] + (v >> 16); swap (rc4_key, idx, j); idx++;
63 j += rc4_key->S[idx] + (v >> 24); swap (rc4_key, idx, j); idx++;
67 j += rc4_key->S[idx] + (v >> 0); swap (rc4_key, idx, j); idx++;
68 j += rc4_key->S[idx] + (v >> 8); swap (rc4_key, idx, j); idx++;
69 j += rc4_key->S[idx] + (v >> 16); swap (rc4_key, idx, j); idx++;
70 j += rc4_key->S[idx] + (v >> 24); swap (rc4_key, idx, j); idx++;
74 j += rc4_key->S[idx] + (v >> 0); swap (rc4_key, idx, j); idx++;
75 j += rc4_key->S[idx] + (v >> 8); swap (rc4_key, idx, j); idx++;
76 j += rc4_key->S[idx] + (v >> 16); swap (rc4_key, idx, j); idx++;
77 j += rc4_key->S[idx] + (v >> 24); swap (rc4_key, idx, j); idx++;
81 j += rc4_key->S[idx] + (v >> 0); swap (rc4_key, idx, j); idx++;
82 j += rc4_key->S[idx] + (v >> 8); swap (rc4_key, idx, j); idx++;
83 j += rc4_key->S[idx] + (v >> 16); swap (rc4_key, idx, j); idx++;
84 j += rc4_key->S[idx] + (v >> 24); swap (rc4_key, idx, j); idx++;
88 static u8 rc4_next_16 (__local RC4_KEY *rc4_key, u8 i, u8 j, const u32 in[4], u32 out[4])
91 for (u32 k = 0; k < 4; k++)
100 swap (rc4_key, i, j);
102 idx = rc4_key->S[i] + rc4_key->S[j];
104 xor4 |= rc4_key->S[idx] << 0;
109 swap (rc4_key, i, j);
111 idx = rc4_key->S[i] + rc4_key->S[j];
113 xor4 |= rc4_key->S[idx] << 8;
118 swap (rc4_key, i, j);
120 idx = rc4_key->S[i] + rc4_key->S[j];
122 xor4 |= rc4_key->S[idx] << 16;
127 swap (rc4_key, i, j);
129 idx = rc4_key->S[i] + rc4_key->S[j];
131 xor4 |= rc4_key->S[idx] << 24;
133 out[k] = in[k] ^ xor4;
139 static int decrypt_and_check (__local RC4_KEY *rc4_key, u32 data[4], u32 timestamp_ct[8])
141 rc4_init_16 (rc4_key, data);
147 j = rc4_next_16 (rc4_key, 0, j, timestamp_ct + 0, out);
149 if ((out[3] & 0xffff0000) != 0x30320000) return 0;
151 j = rc4_next_16 (rc4_key, 16, j, timestamp_ct + 4, out);
153 if (((out[0] & 0xff) < '0') || ((out[0] & 0xff) > '9')) return 0; out[0] >>= 8;
154 if (((out[0] & 0xff) < '0') || ((out[0] & 0xff) > '9')) return 0; out[0] >>= 8;
155 if (((out[0] & 0xff) < '0') || ((out[0] & 0xff) > '9')) return 0; out[0] >>= 8;
156 if (((out[0] & 0xff) < '0') || ((out[0] & 0xff) > '9')) return 0;
157 if (((out[1] & 0xff) < '0') || ((out[1] & 0xff) > '9')) return 0; out[1] >>= 8;
158 if (((out[1] & 0xff) < '0') || ((out[1] & 0xff) > '9')) return 0; out[1] >>= 8;
159 if (((out[1] & 0xff) < '0') || ((out[1] & 0xff) > '9')) return 0; out[1] >>= 8;
160 if (((out[1] & 0xff) < '0') || ((out[1] & 0xff) > '9')) return 0;
161 if (((out[2] & 0xff) < '0') || ((out[2] & 0xff) > '9')) return 0; out[2] >>= 8;
162 if (((out[2] & 0xff) < '0') || ((out[2] & 0xff) > '9')) return 0; out[2] >>= 8;
163 if (((out[2] & 0xff) < '0') || ((out[2] & 0xff) > '9')) return 0; out[2] >>= 8;
164 if (((out[2] & 0xff) < '0') || ((out[2] & 0xff) > '9')) return 0;
169 static void md4_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[4])
176 MD4_STEP (MD4_Fo, a, b, c, d, w0[0], MD4C00, MD4S00);
177 MD4_STEP (MD4_Fo, d, a, b, c, w0[1], MD4C00, MD4S01);
178 MD4_STEP (MD4_Fo, c, d, a, b, w0[2], MD4C00, MD4S02);
179 MD4_STEP (MD4_Fo, b, c, d, a, w0[3], MD4C00, MD4S03);
180 MD4_STEP (MD4_Fo, a, b, c, d, w1[0], MD4C00, MD4S00);
181 MD4_STEP (MD4_Fo, d, a, b, c, w1[1], MD4C00, MD4S01);
182 MD4_STEP (MD4_Fo, c, d, a, b, w1[2], MD4C00, MD4S02);
183 MD4_STEP (MD4_Fo, b, c, d, a, w1[3], MD4C00, MD4S03);
184 MD4_STEP (MD4_Fo, a, b, c, d, w2[0], MD4C00, MD4S00);
185 MD4_STEP (MD4_Fo, d, a, b, c, w2[1], MD4C00, MD4S01);
186 MD4_STEP (MD4_Fo, c, d, a, b, w2[2], MD4C00, MD4S02);
187 MD4_STEP (MD4_Fo, b, c, d, a, w2[3], MD4C00, MD4S03);
188 MD4_STEP (MD4_Fo, a, b, c, d, w3[0], MD4C00, MD4S00);
189 MD4_STEP (MD4_Fo, d, a, b, c, w3[1], MD4C00, MD4S01);
190 MD4_STEP (MD4_Fo, c, d, a, b, w3[2], MD4C00, MD4S02);
191 MD4_STEP (MD4_Fo, b, c, d, a, w3[3], MD4C00, MD4S03);
193 MD4_STEP (MD4_Go, a, b, c, d, w0[0], MD4C01, MD4S10);
194 MD4_STEP (MD4_Go, d, a, b, c, w1[0], MD4C01, MD4S11);
195 MD4_STEP (MD4_Go, c, d, a, b, w2[0], MD4C01, MD4S12);
196 MD4_STEP (MD4_Go, b, c, d, a, w3[0], MD4C01, MD4S13);
197 MD4_STEP (MD4_Go, a, b, c, d, w0[1], MD4C01, MD4S10);
198 MD4_STEP (MD4_Go, d, a, b, c, w1[1], MD4C01, MD4S11);
199 MD4_STEP (MD4_Go, c, d, a, b, w2[1], MD4C01, MD4S12);
200 MD4_STEP (MD4_Go, b, c, d, a, w3[1], MD4C01, MD4S13);
201 MD4_STEP (MD4_Go, a, b, c, d, w0[2], MD4C01, MD4S10);
202 MD4_STEP (MD4_Go, d, a, b, c, w1[2], MD4C01, MD4S11);
203 MD4_STEP (MD4_Go, c, d, a, b, w2[2], MD4C01, MD4S12);
204 MD4_STEP (MD4_Go, b, c, d, a, w3[2], MD4C01, MD4S13);
205 MD4_STEP (MD4_Go, a, b, c, d, w0[3], MD4C01, MD4S10);
206 MD4_STEP (MD4_Go, d, a, b, c, w1[3], MD4C01, MD4S11);
207 MD4_STEP (MD4_Go, c, d, a, b, w2[3], MD4C01, MD4S12);
208 MD4_STEP (MD4_Go, b, c, d, a, w3[3], MD4C01, MD4S13);
210 MD4_STEP (MD4_H , a, b, c, d, w0[0], MD4C02, MD4S20);
211 MD4_STEP (MD4_H , d, a, b, c, w2[0], MD4C02, MD4S21);
212 MD4_STEP (MD4_H , c, d, a, b, w1[0], MD4C02, MD4S22);
213 MD4_STEP (MD4_H , b, c, d, a, w3[0], MD4C02, MD4S23);
214 MD4_STEP (MD4_H , a, b, c, d, w0[2], MD4C02, MD4S20);
215 MD4_STEP (MD4_H , d, a, b, c, w2[2], MD4C02, MD4S21);
216 MD4_STEP (MD4_H , c, d, a, b, w1[2], MD4C02, MD4S22);
217 MD4_STEP (MD4_H , b, c, d, a, w3[2], MD4C02, MD4S23);
218 MD4_STEP (MD4_H , a, b, c, d, w0[1], MD4C02, MD4S20);
219 MD4_STEP (MD4_H , d, a, b, c, w2[1], MD4C02, MD4S21);
220 MD4_STEP (MD4_H , c, d, a, b, w1[1], MD4C02, MD4S22);
221 MD4_STEP (MD4_H , b, c, d, a, w3[1], MD4C02, MD4S23);
222 MD4_STEP (MD4_H , a, b, c, d, w0[3], MD4C02, MD4S20);
223 MD4_STEP (MD4_H , d, a, b, c, w2[3], MD4C02, MD4S21);
224 MD4_STEP (MD4_H , c, d, a, b, w1[3], MD4C02, MD4S22);
225 MD4_STEP (MD4_H , b, c, d, a, w3[3], MD4C02, MD4S23);
233 static void md5_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[4])
257 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
258 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
259 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
260 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
261 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
262 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
263 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
264 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
265 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
266 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
267 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
268 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
269 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
270 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
271 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
272 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
274 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
275 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
276 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
277 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
278 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
279 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
280 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
281 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
282 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
283 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
284 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
285 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
286 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
287 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
288 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
289 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
291 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
292 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
293 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
294 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
295 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
296 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
297 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
298 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
299 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
300 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
301 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
302 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
303 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
304 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
305 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
306 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
308 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
309 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
310 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
311 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
312 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
313 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
314 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
315 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
316 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
317 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
318 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
319 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
320 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
321 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
322 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
323 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
331 static void hmac_md5_pad (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], u32 ipad[4], u32 opad[4])
333 w0[0] = w0[0] ^ 0x36363636;
334 w0[1] = w0[1] ^ 0x36363636;
335 w0[2] = w0[2] ^ 0x36363636;
336 w0[3] = w0[3] ^ 0x36363636;
337 w1[0] = w1[0] ^ 0x36363636;
338 w1[1] = w1[1] ^ 0x36363636;
339 w1[2] = w1[2] ^ 0x36363636;
340 w1[3] = w1[3] ^ 0x36363636;
341 w2[0] = w2[0] ^ 0x36363636;
342 w2[1] = w2[1] ^ 0x36363636;
343 w2[2] = w2[2] ^ 0x36363636;
344 w2[3] = w2[3] ^ 0x36363636;
345 w3[0] = w3[0] ^ 0x36363636;
346 w3[1] = w3[1] ^ 0x36363636;
347 w3[2] = w3[2] ^ 0x36363636;
348 w3[3] = w3[3] ^ 0x36363636;
355 md5_transform (w0, w1, w2, w3, ipad);
357 w0[0] = w0[0] ^ 0x6a6a6a6a;
358 w0[1] = w0[1] ^ 0x6a6a6a6a;
359 w0[2] = w0[2] ^ 0x6a6a6a6a;
360 w0[3] = w0[3] ^ 0x6a6a6a6a;
361 w1[0] = w1[0] ^ 0x6a6a6a6a;
362 w1[1] = w1[1] ^ 0x6a6a6a6a;
363 w1[2] = w1[2] ^ 0x6a6a6a6a;
364 w1[3] = w1[3] ^ 0x6a6a6a6a;
365 w2[0] = w2[0] ^ 0x6a6a6a6a;
366 w2[1] = w2[1] ^ 0x6a6a6a6a;
367 w2[2] = w2[2] ^ 0x6a6a6a6a;
368 w2[3] = w2[3] ^ 0x6a6a6a6a;
369 w3[0] = w3[0] ^ 0x6a6a6a6a;
370 w3[1] = w3[1] ^ 0x6a6a6a6a;
371 w3[2] = w3[2] ^ 0x6a6a6a6a;
372 w3[3] = w3[3] ^ 0x6a6a6a6a;
379 md5_transform (w0, w1, w2, w3, opad);
382 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])
389 md5_transform (w0, w1, w2, w3, digest);
405 w3[2] = (64 + 16) * 8;
413 md5_transform (w0, w1, w2, w3, digest);
416 static void kerb_prepare (const u32 w0[4], const u32 w1[4], const u32 pw_len, const u32 checksum[4], u32 digest[4])
444 // K=MD4(Little_indian(UNICODE(pwd))
446 append_0x80_2x4 (w0_t, w1_t, pw_len);
448 make_unicode (w1_t, w2_t, w3_t);
449 make_unicode (w0_t, w0_t, w1_t);
451 w3_t[2] = pw_len * 8 * 2;
459 md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
461 // K1=MD5_HMAC(K,1); with 1 encoded as little indian on 4 bytes (01000000 in hexa);
483 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
499 w3_t[2] = (64 + 4) * 8;
502 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
504 // K3=MD5_HMAC(K1,checksum);
523 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
525 w0_t[0] = checksum[0];
526 w0_t[1] = checksum[1];
527 w0_t[2] = checksum[2];
528 w0_t[3] = checksum[3];
539 w3_t[2] = (64 + 16) * 8;
542 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
545 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m07500_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 krb5pa_t *krb5pa_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)
551 __local RC4_KEY rc4_keys[64];
553 const u32 gid = get_global_id (0);
554 const u32 lid = get_local_id (0);
556 if (gid >= gid_max) return;
564 wordl0[0] = pws[gid].i[ 0];
565 wordl0[1] = pws[gid].i[ 1];
566 wordl0[2] = pws[gid].i[ 2];
567 wordl0[3] = pws[gid].i[ 3];
571 wordl1[0] = pws[gid].i[ 4];
572 wordl1[1] = pws[gid].i[ 5];
573 wordl1[2] = pws[gid].i[ 6];
574 wordl1[3] = pws[gid].i[ 7];
590 const u32 pw_l_len = pws[gid].pw_len;
592 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
594 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
603 checksum[0] = krb5pa_bufs[salt_pos].checksum[0];
604 checksum[1] = krb5pa_bufs[salt_pos].checksum[1];
605 checksum[2] = krb5pa_bufs[salt_pos].checksum[2];
606 checksum[3] = krb5pa_bufs[salt_pos].checksum[3];
610 timestamp_ct[0] = krb5pa_bufs[salt_pos].timestamp[0];
611 timestamp_ct[1] = krb5pa_bufs[salt_pos].timestamp[1];
612 timestamp_ct[2] = krb5pa_bufs[salt_pos].timestamp[2];
613 timestamp_ct[3] = krb5pa_bufs[salt_pos].timestamp[3];
614 timestamp_ct[4] = krb5pa_bufs[salt_pos].timestamp[4];
615 timestamp_ct[5] = krb5pa_bufs[salt_pos].timestamp[5];
616 timestamp_ct[6] = krb5pa_bufs[salt_pos].timestamp[6];
617 timestamp_ct[7] = krb5pa_bufs[salt_pos].timestamp[7];
623 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
625 const u32 pw_r_len = combs_buf[il_pos].pw_len;
627 const u32 pw_len = pw_l_len + pw_r_len;
631 wordr0[0] = combs_buf[il_pos].i[0];
632 wordr0[1] = combs_buf[il_pos].i[1];
633 wordr0[2] = combs_buf[il_pos].i[2];
634 wordr0[3] = combs_buf[il_pos].i[3];
638 wordr1[0] = combs_buf[il_pos].i[4];
639 wordr1[1] = combs_buf[il_pos].i[5];
640 wordr1[2] = combs_buf[il_pos].i[6];
641 wordr1[3] = combs_buf[il_pos].i[7];
657 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
659 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
664 w0[0] = wordl0[0] | wordr0[0];
665 w0[1] = wordl0[1] | wordr0[1];
666 w0[2] = wordl0[2] | wordr0[2];
667 w0[3] = wordl0[3] | wordr0[3];
671 w1[0] = wordl1[0] | wordr1[0];
672 w1[1] = wordl1[1] | wordr1[1];
673 w1[2] = wordl1[2] | wordr1[2];
674 w1[3] = wordl1[3] | wordr1[3];
678 w2[0] = wordl2[0] | wordr2[0];
679 w2[1] = wordl2[1] | wordr2[1];
680 w2[2] = wordl2[2] | wordr2[2];
681 w2[3] = wordl2[3] | wordr2[3];
685 w3[0] = wordl3[0] | wordr3[0];
686 w3[1] = wordl3[1] | wordr3[1];
696 kerb_prepare (w0, w1, pw_len, checksum, digest);
705 if (decrypt_and_check (&rc4_keys[lid], tmp, timestamp_ct) == 1)
707 mark_hash (plains_buf, hashes_shown, digests_offset, gid, il_pos);
709 d_return_buf[lid] = 1;
714 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m07500_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 krb5pa_t *krb5pa_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)
718 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m07500_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 krb5pa_t *krb5pa_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)
722 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m07500_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 krb5pa_t *krb5pa_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)
728 __local RC4_KEY rc4_keys[64];
730 const u32 gid = get_global_id (0);
731 const u32 lid = get_local_id (0);
733 if (gid >= gid_max) return;
741 wordl0[0] = pws[gid].i[ 0];
742 wordl0[1] = pws[gid].i[ 1];
743 wordl0[2] = pws[gid].i[ 2];
744 wordl0[3] = pws[gid].i[ 3];
748 wordl1[0] = pws[gid].i[ 4];
749 wordl1[1] = pws[gid].i[ 5];
750 wordl1[2] = pws[gid].i[ 6];
751 wordl1[3] = pws[gid].i[ 7];
767 const u32 pw_l_len = pws[gid].pw_len;
769 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
771 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
780 checksum[0] = krb5pa_bufs[salt_pos].checksum[0];
781 checksum[1] = krb5pa_bufs[salt_pos].checksum[1];
782 checksum[2] = krb5pa_bufs[salt_pos].checksum[2];
783 checksum[3] = krb5pa_bufs[salt_pos].checksum[3];
787 timestamp_ct[0] = krb5pa_bufs[salt_pos].timestamp[0];
788 timestamp_ct[1] = krb5pa_bufs[salt_pos].timestamp[1];
789 timestamp_ct[2] = krb5pa_bufs[salt_pos].timestamp[2];
790 timestamp_ct[3] = krb5pa_bufs[salt_pos].timestamp[3];
791 timestamp_ct[4] = krb5pa_bufs[salt_pos].timestamp[4];
792 timestamp_ct[5] = krb5pa_bufs[salt_pos].timestamp[5];
793 timestamp_ct[6] = krb5pa_bufs[salt_pos].timestamp[6];
794 timestamp_ct[7] = krb5pa_bufs[salt_pos].timestamp[7];
800 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
802 const u32 pw_r_len = combs_buf[il_pos].pw_len;
804 const u32 pw_len = pw_l_len + pw_r_len;
808 wordr0[0] = combs_buf[il_pos].i[0];
809 wordr0[1] = combs_buf[il_pos].i[1];
810 wordr0[2] = combs_buf[il_pos].i[2];
811 wordr0[3] = combs_buf[il_pos].i[3];
815 wordr1[0] = combs_buf[il_pos].i[4];
816 wordr1[1] = combs_buf[il_pos].i[5];
817 wordr1[2] = combs_buf[il_pos].i[6];
818 wordr1[3] = combs_buf[il_pos].i[7];
834 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
836 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
841 w0[0] = wordl0[0] | wordr0[0];
842 w0[1] = wordl0[1] | wordr0[1];
843 w0[2] = wordl0[2] | wordr0[2];
844 w0[3] = wordl0[3] | wordr0[3];
848 w1[0] = wordl1[0] | wordr1[0];
849 w1[1] = wordl1[1] | wordr1[1];
850 w1[2] = wordl1[2] | wordr1[2];
851 w1[3] = wordl1[3] | wordr1[3];
855 w2[0] = wordl2[0] | wordr2[0];
856 w2[1] = wordl2[1] | wordr2[1];
857 w2[2] = wordl2[2] | wordr2[2];
858 w2[3] = wordl2[3] | wordr2[3];
862 w3[0] = wordl3[0] | wordr3[0];
863 w3[1] = wordl3[1] | wordr3[1];
873 kerb_prepare (w0, w1, pw_len, checksum, digest);
882 if (decrypt_and_check (&rc4_keys[lid], tmp, timestamp_ct) == 1)
884 mark_hash (plains_buf, hashes_shown, digests_offset, gid, il_pos);
886 d_return_buf[lid] = 1;
891 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m07500_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 krb5pa_t *krb5pa_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)
895 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m07500_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 krb5pa_t *krb5pa_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)