2 * Authors......: Jens Steube <jens.steube@gmail.com>
3 * Authors......: Fist0urs <eddy.maaalou@gmail.com>
10 #include "include/constants.h"
11 #include "include/kernel_vendor.h"
18 #include "include/kernel_functions.c"
19 #include "OpenCL/types_ocl.c"
20 #include "OpenCL/common.c"
30 static void swap (__local RC4_KEY *rc4_key, const u8 i, const u8 j)
35 rc4_key->S[i] = rc4_key->S[j];
39 static void rc4_init_16 (__local RC4_KEY *rc4_key, const u32 data[4])
44 __local u32 *ptr = (__local u32 *) rc4_key->S;
47 for (u32 i = 0; i < 64; i++)
54 for (u32 i = 0; i < 16; i++)
62 j += rc4_key->S[idx] + (v >> 0); swap (rc4_key, idx, j); idx++;
63 j += rc4_key->S[idx] + (v >> 8); swap (rc4_key, idx, j); idx++;
64 j += rc4_key->S[idx] + (v >> 16); swap (rc4_key, idx, j); idx++;
65 j += rc4_key->S[idx] + (v >> 24); swap (rc4_key, idx, j); idx++;
69 j += rc4_key->S[idx] + (v >> 0); swap (rc4_key, idx, j); idx++;
70 j += rc4_key->S[idx] + (v >> 8); swap (rc4_key, idx, j); idx++;
71 j += rc4_key->S[idx] + (v >> 16); swap (rc4_key, idx, j); idx++;
72 j += rc4_key->S[idx] + (v >> 24); swap (rc4_key, idx, j); idx++;
76 j += rc4_key->S[idx] + (v >> 0); swap (rc4_key, idx, j); idx++;
77 j += rc4_key->S[idx] + (v >> 8); swap (rc4_key, idx, j); idx++;
78 j += rc4_key->S[idx] + (v >> 16); swap (rc4_key, idx, j); idx++;
79 j += rc4_key->S[idx] + (v >> 24); swap (rc4_key, idx, j); idx++;
83 j += rc4_key->S[idx] + (v >> 0); swap (rc4_key, idx, j); idx++;
84 j += rc4_key->S[idx] + (v >> 8); swap (rc4_key, idx, j); idx++;
85 j += rc4_key->S[idx] + (v >> 16); swap (rc4_key, idx, j); idx++;
86 j += rc4_key->S[idx] + (v >> 24); swap (rc4_key, idx, j); idx++;
90 static u8 rc4_next_16 (__local RC4_KEY *rc4_key, u8 i, u8 j, __global u32 in[4], u32 out[4])
93 for (u32 k = 0; k < 4; k++)
102 swap (rc4_key, i, j);
104 idx = rc4_key->S[i] + rc4_key->S[j];
106 xor4 |= rc4_key->S[idx] << 0;
111 swap (rc4_key, i, j);
113 idx = rc4_key->S[i] + rc4_key->S[j];
115 xor4 |= rc4_key->S[idx] << 8;
120 swap (rc4_key, i, j);
122 idx = rc4_key->S[i] + rc4_key->S[j];
124 xor4 |= rc4_key->S[idx] << 16;
129 swap (rc4_key, i, j);
131 idx = rc4_key->S[i] + rc4_key->S[j];
133 xor4 |= rc4_key->S[idx] << 24;
135 out[k] = in[k] ^ xor4;
141 static int decrypt_and_check (__local RC4_KEY *rc4_key, u32 data[4], __global u32* edata2)
143 rc4_init_16 (rc4_key, data);
150 8 first bytes are nonce, then ASN1 structs (DER encoding: type-length-data)
152 if length >= 128 bytes:
153 length is on 2 bytes and type is \x63\x82 (encode_krb5_enc_tkt_part) and data is an ASN1 sequence \x30\x82
155 length is on 1 byte and type is \x63\x81 and data is an ASN1 sequence \x30\x81
157 next headers follow the same ASN1 "type-length-data" scheme
160 j = rc4_next_16 (rc4_key, 0, 0, edata2, out);
162 if (((out[2] & 0xff00ffff) != 0x30008163) && ((out[2] & 0x0000ffff) != 0x00008263)) return 0;
164 j = rc4_next_16 (rc4_key, 16, j, edata2 + 4, out + 4);
166 if (((out[4] & 0x00ffffff) != 0x00000503) && (out[4] != 0x050307A0)) return 0;
168 // TODO (or not): add RC4'ing of all edata2 then hmac-md5 and compare with
169 // checksum to be definitely sure that this is the correct pass (even if
170 // collisions must be very rare)
175 static void md4_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[4])
182 MD4_STEP (MD4_Fo, a, b, c, d, w0[0], MD4C00, MD4S00);
183 MD4_STEP (MD4_Fo, d, a, b, c, w0[1], MD4C00, MD4S01);
184 MD4_STEP (MD4_Fo, c, d, a, b, w0[2], MD4C00, MD4S02);
185 MD4_STEP (MD4_Fo, b, c, d, a, w0[3], MD4C00, MD4S03);
186 MD4_STEP (MD4_Fo, a, b, c, d, w1[0], MD4C00, MD4S00);
187 MD4_STEP (MD4_Fo, d, a, b, c, w1[1], MD4C00, MD4S01);
188 MD4_STEP (MD4_Fo, c, d, a, b, w1[2], MD4C00, MD4S02);
189 MD4_STEP (MD4_Fo, b, c, d, a, w1[3], MD4C00, MD4S03);
190 MD4_STEP (MD4_Fo, a, b, c, d, w2[0], MD4C00, MD4S00);
191 MD4_STEP (MD4_Fo, d, a, b, c, w2[1], MD4C00, MD4S01);
192 MD4_STEP (MD4_Fo, c, d, a, b, w2[2], MD4C00, MD4S02);
193 MD4_STEP (MD4_Fo, b, c, d, a, w2[3], MD4C00, MD4S03);
194 MD4_STEP (MD4_Fo, a, b, c, d, w3[0], MD4C00, MD4S00);
195 MD4_STEP (MD4_Fo, d, a, b, c, w3[1], MD4C00, MD4S01);
196 MD4_STEP (MD4_Fo, c, d, a, b, w3[2], MD4C00, MD4S02);
197 MD4_STEP (MD4_Fo, b, c, d, a, w3[3], MD4C00, MD4S03);
199 MD4_STEP (MD4_Go, a, b, c, d, w0[0], MD4C01, MD4S10);
200 MD4_STEP (MD4_Go, d, a, b, c, w1[0], MD4C01, MD4S11);
201 MD4_STEP (MD4_Go, c, d, a, b, w2[0], MD4C01, MD4S12);
202 MD4_STEP (MD4_Go, b, c, d, a, w3[0], MD4C01, MD4S13);
203 MD4_STEP (MD4_Go, a, b, c, d, w0[1], MD4C01, MD4S10);
204 MD4_STEP (MD4_Go, d, a, b, c, w1[1], MD4C01, MD4S11);
205 MD4_STEP (MD4_Go, c, d, a, b, w2[1], MD4C01, MD4S12);
206 MD4_STEP (MD4_Go, b, c, d, a, w3[1], MD4C01, MD4S13);
207 MD4_STEP (MD4_Go, a, b, c, d, w0[2], MD4C01, MD4S10);
208 MD4_STEP (MD4_Go, d, a, b, c, w1[2], MD4C01, MD4S11);
209 MD4_STEP (MD4_Go, c, d, a, b, w2[2], MD4C01, MD4S12);
210 MD4_STEP (MD4_Go, b, c, d, a, w3[2], MD4C01, MD4S13);
211 MD4_STEP (MD4_Go, a, b, c, d, w0[3], MD4C01, MD4S10);
212 MD4_STEP (MD4_Go, d, a, b, c, w1[3], MD4C01, MD4S11);
213 MD4_STEP (MD4_Go, c, d, a, b, w2[3], MD4C01, MD4S12);
214 MD4_STEP (MD4_Go, b, c, d, a, w3[3], MD4C01, MD4S13);
216 MD4_STEP (MD4_H , a, b, c, d, w0[0], MD4C02, MD4S20);
217 MD4_STEP (MD4_H , d, a, b, c, w2[0], MD4C02, MD4S21);
218 MD4_STEP (MD4_H , c, d, a, b, w1[0], MD4C02, MD4S22);
219 MD4_STEP (MD4_H , b, c, d, a, w3[0], MD4C02, MD4S23);
220 MD4_STEP (MD4_H , a, b, c, d, w0[2], MD4C02, MD4S20);
221 MD4_STEP (MD4_H , d, a, b, c, w2[2], MD4C02, MD4S21);
222 MD4_STEP (MD4_H , c, d, a, b, w1[2], MD4C02, MD4S22);
223 MD4_STEP (MD4_H , b, c, d, a, w3[2], MD4C02, MD4S23);
224 MD4_STEP (MD4_H , a, b, c, d, w0[1], MD4C02, MD4S20);
225 MD4_STEP (MD4_H , d, a, b, c, w2[1], MD4C02, MD4S21);
226 MD4_STEP (MD4_H , c, d, a, b, w1[1], MD4C02, MD4S22);
227 MD4_STEP (MD4_H , b, c, d, a, w3[1], MD4C02, MD4S23);
228 MD4_STEP (MD4_H , a, b, c, d, w0[3], MD4C02, MD4S20);
229 MD4_STEP (MD4_H , d, a, b, c, w2[3], MD4C02, MD4S21);
230 MD4_STEP (MD4_H , c, d, a, b, w1[3], MD4C02, MD4S22);
231 MD4_STEP (MD4_H , b, c, d, a, w3[3], MD4C02, MD4S23);
239 static void md5_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[4])
263 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
264 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
265 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
266 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
267 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
268 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
269 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
270 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
271 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
272 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
273 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
274 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
275 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
276 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
277 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
278 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
280 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
281 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
282 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
283 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
284 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
285 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
286 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
287 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
288 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
289 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
290 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
291 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
292 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
293 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
294 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
295 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
297 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
298 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
299 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
300 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
301 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
302 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
303 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
304 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
305 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
306 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
307 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
308 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
309 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
310 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
311 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
312 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
314 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
315 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
316 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
317 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
318 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
319 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
320 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
321 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
322 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
323 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
324 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
325 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
326 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
327 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
328 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
329 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
337 static void hmac_md5_pad (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], u32 ipad[4], u32 opad[4])
339 w0[0] = w0[0] ^ 0x36363636;
340 w0[1] = w0[1] ^ 0x36363636;
341 w0[2] = w0[2] ^ 0x36363636;
342 w0[3] = w0[3] ^ 0x36363636;
343 w1[0] = w1[0] ^ 0x36363636;
344 w1[1] = w1[1] ^ 0x36363636;
345 w1[2] = w1[2] ^ 0x36363636;
346 w1[3] = w1[3] ^ 0x36363636;
347 w2[0] = w2[0] ^ 0x36363636;
348 w2[1] = w2[1] ^ 0x36363636;
349 w2[2] = w2[2] ^ 0x36363636;
350 w2[3] = w2[3] ^ 0x36363636;
351 w3[0] = w3[0] ^ 0x36363636;
352 w3[1] = w3[1] ^ 0x36363636;
353 w3[2] = w3[2] ^ 0x36363636;
354 w3[3] = w3[3] ^ 0x36363636;
361 md5_transform (w0, w1, w2, w3, ipad);
363 w0[0] = w0[0] ^ 0x6a6a6a6a;
364 w0[1] = w0[1] ^ 0x6a6a6a6a;
365 w0[2] = w0[2] ^ 0x6a6a6a6a;
366 w0[3] = w0[3] ^ 0x6a6a6a6a;
367 w1[0] = w1[0] ^ 0x6a6a6a6a;
368 w1[1] = w1[1] ^ 0x6a6a6a6a;
369 w1[2] = w1[2] ^ 0x6a6a6a6a;
370 w1[3] = w1[3] ^ 0x6a6a6a6a;
371 w2[0] = w2[0] ^ 0x6a6a6a6a;
372 w2[1] = w2[1] ^ 0x6a6a6a6a;
373 w2[2] = w2[2] ^ 0x6a6a6a6a;
374 w2[3] = w2[3] ^ 0x6a6a6a6a;
375 w3[0] = w3[0] ^ 0x6a6a6a6a;
376 w3[1] = w3[1] ^ 0x6a6a6a6a;
377 w3[2] = w3[2] ^ 0x6a6a6a6a;
378 w3[3] = w3[3] ^ 0x6a6a6a6a;
385 md5_transform (w0, w1, w2, w3, opad);
388 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])
395 md5_transform (w0, w1, w2, w3, digest);
411 w3[2] = (64 + 16) * 8;
419 md5_transform (w0, w1, w2, w3, digest);
422 static void kerb_prepare (const u32 w0[4], const u32 w1[4], const u32 pw_len, const u32 checksum[4], u32 digest[4])
450 // K=MD4(Little_indian(UNICODE(pwd))
452 append_0x80_2x4 (w0_t, w1_t, pw_len);
454 make_unicode (w1_t, w2_t, w3_t);
455 make_unicode (w0_t, w0_t, w1_t);
457 w3_t[2] = pw_len * 8 * 2;
465 md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
467 // K1=MD5_HMAC(K,1); with 2 encoded as little indian on 4 bytes (02000000 in hexa);
489 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
505 w3_t[2] = (64 + 4) * 8;
508 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
510 // K3=MD5_HMAC(K1,checksum);
529 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
531 w0_t[0] = checksum[0];
532 w0_t[1] = checksum[1];
533 w0_t[2] = checksum[2];
534 w0_t[3] = checksum[3];
545 w3_t[2] = (64 + 16) * 8;
548 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
551 __kernel void m13100_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 krb5tgs_t *krb5tgs_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 __local RC4_KEY rc4_keys[64];
559 const u32 gid = get_global_id (0);
560 const u32 lid = get_local_id (0);
562 if (gid >= gid_max) return;
570 wordl0[0] = pws[gid].i[ 0];
571 wordl0[1] = pws[gid].i[ 1];
572 wordl0[2] = pws[gid].i[ 2];
573 wordl0[3] = pws[gid].i[ 3];
577 wordl1[0] = pws[gid].i[ 4];
578 wordl1[1] = pws[gid].i[ 5];
579 wordl1[2] = pws[gid].i[ 6];
580 wordl1[3] = pws[gid].i[ 7];
596 const u32 pw_l_len = pws[gid].pw_len;
598 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
600 switch_buffer_by_offset_le (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
609 checksum[0] = krb5tgs_bufs[salt_pos].checksum[0];
610 checksum[1] = krb5tgs_bufs[salt_pos].checksum[1];
611 checksum[2] = krb5tgs_bufs[salt_pos].checksum[2];
612 checksum[3] = krb5tgs_bufs[salt_pos].checksum[3];
618 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
620 const u32 pw_r_len = combs_buf[il_pos].pw_len;
622 const u32 pw_len = pw_l_len + pw_r_len;
626 wordr0[0] = combs_buf[il_pos].i[0];
627 wordr0[1] = combs_buf[il_pos].i[1];
628 wordr0[2] = combs_buf[il_pos].i[2];
629 wordr0[3] = combs_buf[il_pos].i[3];
633 wordr1[0] = combs_buf[il_pos].i[4];
634 wordr1[1] = combs_buf[il_pos].i[5];
635 wordr1[2] = combs_buf[il_pos].i[6];
636 wordr1[3] = combs_buf[il_pos].i[7];
652 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
654 switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
659 w0[0] = wordl0[0] | wordr0[0];
660 w0[1] = wordl0[1] | wordr0[1];
661 w0[2] = wordl0[2] | wordr0[2];
662 w0[3] = wordl0[3] | wordr0[3];
666 w1[0] = wordl1[0] | wordr1[0];
667 w1[1] = wordl1[1] | wordr1[1];
668 w1[2] = wordl1[2] | wordr1[2];
669 w1[3] = wordl1[3] | wordr1[3];
673 w2[0] = wordl2[0] | wordr2[0];
674 w2[1] = wordl2[1] | wordr2[1];
675 w2[2] = wordl2[2] | wordr2[2];
676 w2[3] = wordl2[3] | wordr2[3];
680 w3[0] = wordl3[0] | wordr3[0];
681 w3[1] = wordl3[1] | wordr3[1];
691 kerb_prepare (w0, w1, pw_len, checksum, digest);
700 if (decrypt_and_check (&rc4_keys[lid], tmp, krb5tgs_bufs[salt_pos].edata2) == 1)
702 mark_hash (plains_buf, hashes_shown, digests_offset, gid, il_pos);
704 d_return_buf[lid] = 1;
709 __kernel void m13100_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 krb5tgs_t *krb5tgs_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)
713 __kernel void m13100_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 krb5tgs_t *krb5tgs_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)
717 __kernel void m13100_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 krb5tgs_t *krb5tgs_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)
723 __local RC4_KEY rc4_keys[64];
725 const u32 gid = get_global_id (0);
726 const u32 lid = get_local_id (0);
728 if (gid >= gid_max) return;
736 wordl0[0] = pws[gid].i[ 0];
737 wordl0[1] = pws[gid].i[ 1];
738 wordl0[2] = pws[gid].i[ 2];
739 wordl0[3] = pws[gid].i[ 3];
743 wordl1[0] = pws[gid].i[ 4];
744 wordl1[1] = pws[gid].i[ 5];
745 wordl1[2] = pws[gid].i[ 6];
746 wordl1[3] = pws[gid].i[ 7];
762 const u32 pw_l_len = pws[gid].pw_len;
764 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
766 switch_buffer_by_offset_le (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
775 checksum[0] = krb5tgs_bufs[salt_pos].checksum[0];
776 checksum[1] = krb5tgs_bufs[salt_pos].checksum[1];
777 checksum[2] = krb5tgs_bufs[salt_pos].checksum[2];
778 checksum[3] = krb5tgs_bufs[salt_pos].checksum[3];
784 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
786 const u32 pw_r_len = combs_buf[il_pos].pw_len;
788 const u32 pw_len = pw_l_len + pw_r_len;
792 wordr0[0] = combs_buf[il_pos].i[0];
793 wordr0[1] = combs_buf[il_pos].i[1];
794 wordr0[2] = combs_buf[il_pos].i[2];
795 wordr0[3] = combs_buf[il_pos].i[3];
799 wordr1[0] = combs_buf[il_pos].i[4];
800 wordr1[1] = combs_buf[il_pos].i[5];
801 wordr1[2] = combs_buf[il_pos].i[6];
802 wordr1[3] = combs_buf[il_pos].i[7];
818 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
820 switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
825 w0[0] = wordl0[0] | wordr0[0];
826 w0[1] = wordl0[1] | wordr0[1];
827 w0[2] = wordl0[2] | wordr0[2];
828 w0[3] = wordl0[3] | wordr0[3];
832 w1[0] = wordl1[0] | wordr1[0];
833 w1[1] = wordl1[1] | wordr1[1];
834 w1[2] = wordl1[2] | wordr1[2];
835 w1[3] = wordl1[3] | wordr1[3];
839 w2[0] = wordl2[0] | wordr2[0];
840 w2[1] = wordl2[1] | wordr2[1];
841 w2[2] = wordl2[2] | wordr2[2];
842 w2[3] = wordl2[3] | wordr2[3];
846 w3[0] = wordl3[0] | wordr3[0];
847 w3[1] = wordl3[1] | wordr3[1];
857 kerb_prepare (w0, w1, pw_len, checksum, digest);
866 if (decrypt_and_check (&rc4_keys[lid], tmp, krb5tgs_bufs[salt_pos].edata2) == 1)
868 mark_hash (plains_buf, hashes_shown, digests_offset, gid, il_pos);
870 d_return_buf[lid] = 1;
875 __kernel void m13100_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 krb5tgs_t *krb5tgs_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)
879 __kernel void m13100_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 krb5tgs_t *krb5tgs_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)