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 void md4_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[4])
148 MD4_STEP (MD4_Fo, a, b, c, d, w0[0], MD4C00, MD4S00);
149 MD4_STEP (MD4_Fo, d, a, b, c, w0[1], MD4C00, MD4S01);
150 MD4_STEP (MD4_Fo, c, d, a, b, w0[2], MD4C00, MD4S02);
151 MD4_STEP (MD4_Fo, b, c, d, a, w0[3], MD4C00, MD4S03);
152 MD4_STEP (MD4_Fo, a, b, c, d, w1[0], MD4C00, MD4S00);
153 MD4_STEP (MD4_Fo, d, a, b, c, w1[1], MD4C00, MD4S01);
154 MD4_STEP (MD4_Fo, c, d, a, b, w1[2], MD4C00, MD4S02);
155 MD4_STEP (MD4_Fo, b, c, d, a, w1[3], MD4C00, MD4S03);
156 MD4_STEP (MD4_Fo, a, b, c, d, w2[0], MD4C00, MD4S00);
157 MD4_STEP (MD4_Fo, d, a, b, c, w2[1], MD4C00, MD4S01);
158 MD4_STEP (MD4_Fo, c, d, a, b, w2[2], MD4C00, MD4S02);
159 MD4_STEP (MD4_Fo, b, c, d, a, w2[3], MD4C00, MD4S03);
160 MD4_STEP (MD4_Fo, a, b, c, d, w3[0], MD4C00, MD4S00);
161 MD4_STEP (MD4_Fo, d, a, b, c, w3[1], MD4C00, MD4S01);
162 MD4_STEP (MD4_Fo, c, d, a, b, w3[2], MD4C00, MD4S02);
163 MD4_STEP (MD4_Fo, b, c, d, a, w3[3], MD4C00, MD4S03);
165 MD4_STEP (MD4_Go, a, b, c, d, w0[0], MD4C01, MD4S10);
166 MD4_STEP (MD4_Go, d, a, b, c, w1[0], MD4C01, MD4S11);
167 MD4_STEP (MD4_Go, c, d, a, b, w2[0], MD4C01, MD4S12);
168 MD4_STEP (MD4_Go, b, c, d, a, w3[0], MD4C01, MD4S13);
169 MD4_STEP (MD4_Go, a, b, c, d, w0[1], MD4C01, MD4S10);
170 MD4_STEP (MD4_Go, d, a, b, c, w1[1], MD4C01, MD4S11);
171 MD4_STEP (MD4_Go, c, d, a, b, w2[1], MD4C01, MD4S12);
172 MD4_STEP (MD4_Go, b, c, d, a, w3[1], MD4C01, MD4S13);
173 MD4_STEP (MD4_Go, a, b, c, d, w0[2], MD4C01, MD4S10);
174 MD4_STEP (MD4_Go, d, a, b, c, w1[2], MD4C01, MD4S11);
175 MD4_STEP (MD4_Go, c, d, a, b, w2[2], MD4C01, MD4S12);
176 MD4_STEP (MD4_Go, b, c, d, a, w3[2], MD4C01, MD4S13);
177 MD4_STEP (MD4_Go, a, b, c, d, w0[3], MD4C01, MD4S10);
178 MD4_STEP (MD4_Go, d, a, b, c, w1[3], MD4C01, MD4S11);
179 MD4_STEP (MD4_Go, c, d, a, b, w2[3], MD4C01, MD4S12);
180 MD4_STEP (MD4_Go, b, c, d, a, w3[3], MD4C01, MD4S13);
182 MD4_STEP (MD4_H , a, b, c, d, w0[0], MD4C02, MD4S20);
183 MD4_STEP (MD4_H , d, a, b, c, w2[0], MD4C02, MD4S21);
184 MD4_STEP (MD4_H , c, d, a, b, w1[0], MD4C02, MD4S22);
185 MD4_STEP (MD4_H , b, c, d, a, w3[0], MD4C02, MD4S23);
186 MD4_STEP (MD4_H , a, b, c, d, w0[2], MD4C02, MD4S20);
187 MD4_STEP (MD4_H , d, a, b, c, w2[2], MD4C02, MD4S21);
188 MD4_STEP (MD4_H , c, d, a, b, w1[2], MD4C02, MD4S22);
189 MD4_STEP (MD4_H , b, c, d, a, w3[2], MD4C02, MD4S23);
190 MD4_STEP (MD4_H , a, b, c, d, w0[1], MD4C02, MD4S20);
191 MD4_STEP (MD4_H , d, a, b, c, w2[1], MD4C02, MD4S21);
192 MD4_STEP (MD4_H , c, d, a, b, w1[1], MD4C02, MD4S22);
193 MD4_STEP (MD4_H , b, c, d, a, w3[1], MD4C02, MD4S23);
194 MD4_STEP (MD4_H , a, b, c, d, w0[3], MD4C02, MD4S20);
195 MD4_STEP (MD4_H , d, a, b, c, w2[3], MD4C02, MD4S21);
196 MD4_STEP (MD4_H , c, d, a, b, w1[3], MD4C02, MD4S22);
197 MD4_STEP (MD4_H , b, c, d, a, w3[3], MD4C02, MD4S23);
205 static void md5_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[4])
229 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
230 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
231 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
232 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
233 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
234 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
235 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
236 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
237 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
238 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
239 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
240 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
241 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
242 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
243 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
244 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
246 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
247 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
248 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
249 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
250 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
251 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
252 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
253 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
254 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
255 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
256 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
257 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
258 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
259 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
260 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
261 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
263 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
264 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
265 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
266 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
267 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
268 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
269 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
270 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
271 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
272 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
273 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
274 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
275 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
276 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
277 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
278 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
280 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
281 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
282 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
283 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
284 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
285 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
286 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
287 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
288 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
289 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
290 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
291 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
292 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
293 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
294 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
295 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
303 static void hmac_md5_pad (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], u32 ipad[4], u32 opad[4])
305 w0[0] = w0[0] ^ 0x36363636;
306 w0[1] = w0[1] ^ 0x36363636;
307 w0[2] = w0[2] ^ 0x36363636;
308 w0[3] = w0[3] ^ 0x36363636;
309 w1[0] = w1[0] ^ 0x36363636;
310 w1[1] = w1[1] ^ 0x36363636;
311 w1[2] = w1[2] ^ 0x36363636;
312 w1[3] = w1[3] ^ 0x36363636;
313 w2[0] = w2[0] ^ 0x36363636;
314 w2[1] = w2[1] ^ 0x36363636;
315 w2[2] = w2[2] ^ 0x36363636;
316 w2[3] = w2[3] ^ 0x36363636;
317 w3[0] = w3[0] ^ 0x36363636;
318 w3[1] = w3[1] ^ 0x36363636;
319 w3[2] = w3[2] ^ 0x36363636;
320 w3[3] = w3[3] ^ 0x36363636;
327 md5_transform (w0, w1, w2, w3, ipad);
329 w0[0] = w0[0] ^ 0x6a6a6a6a;
330 w0[1] = w0[1] ^ 0x6a6a6a6a;
331 w0[2] = w0[2] ^ 0x6a6a6a6a;
332 w0[3] = w0[3] ^ 0x6a6a6a6a;
333 w1[0] = w1[0] ^ 0x6a6a6a6a;
334 w1[1] = w1[1] ^ 0x6a6a6a6a;
335 w1[2] = w1[2] ^ 0x6a6a6a6a;
336 w1[3] = w1[3] ^ 0x6a6a6a6a;
337 w2[0] = w2[0] ^ 0x6a6a6a6a;
338 w2[1] = w2[1] ^ 0x6a6a6a6a;
339 w2[2] = w2[2] ^ 0x6a6a6a6a;
340 w2[3] = w2[3] ^ 0x6a6a6a6a;
341 w3[0] = w3[0] ^ 0x6a6a6a6a;
342 w3[1] = w3[1] ^ 0x6a6a6a6a;
343 w3[2] = w3[2] ^ 0x6a6a6a6a;
344 w3[3] = w3[3] ^ 0x6a6a6a6a;
351 md5_transform (w0, w1, w2, w3, opad);
354 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])
361 md5_transform (w0, w1, w2, w3, digest);
377 w3[2] = (64 + 16) * 8;
385 md5_transform (w0, w1, w2, w3, digest);
388 static int decrypt_and_check (__local RC4_KEY *rc4_key, u32 data[4], __global u32 *edata2, const u32 edata2_len, const u32 K2[4], const u32 checksum[4])
390 rc4_init_16 (rc4_key, data);
399 8 first bytes are nonce, then ASN1 structs (DER encoding: type-length-data)
401 if length >= 128 bytes:
402 length is on 2 bytes and type is \x63\x82 (encode_krb5_enc_tkt_part) and data is an ASN1 sequence \x30\x82
404 length is on 1 byte and type is \x63\x81 and data is an ASN1 sequence \x30\x81
406 next headers follow the same ASN1 "type-length-data" scheme
409 j = rc4_next_16 (rc4_key, i, j, edata2 + 0, out0); i += 16;
411 if (((out0[2] & 0xff00ffff) != 0x30008163) && ((out0[2] & 0x0000ffff) != 0x00008263)) return 0;
413 j = rc4_next_16 (rc4_key, i, j, edata2 + 4, out1); i += 16;
415 if (((out1[0] & 0x00ffffff) != 0x00000503) && (out1[0] != 0x050307A0)) return 0;
417 rc4_init_16 (rc4_key, data);
449 hmac_md5_pad (w0, w1, w2, w3, ipad, opad);
453 for (edata2_left = edata2_len; edata2_left >= 64; edata2_left -= 64)
455 j = rc4_next_16 (rc4_key, i, j, edata2, w0); i += 16; edata2 += 4;
456 j = rc4_next_16 (rc4_key, i, j, edata2, w1); i += 16; edata2 += 4;
457 j = rc4_next_16 (rc4_key, i, j, edata2, w2); i += 16; edata2 += 4;
458 j = rc4_next_16 (rc4_key, i, j, edata2, w3); i += 16; edata2 += 4;
460 md5_transform (w0, w1, w2, w3, ipad);
480 if (edata2_left < 16)
482 j = rc4_next_16 (rc4_key, i, j, edata2, w0); i += 16; edata2 += 4;
484 truncate_block (w0, edata2_left & 0xf);
485 append_0x80_1x4 (w0, edata2_left & 0xf);
487 w3[2] = (64 + edata2_len) * 8;
490 md5_transform (w0, w1, w2, w3, ipad);
492 else if (edata2_left < 32)
494 j = rc4_next_16 (rc4_key, i, j, edata2, w0); i += 16; edata2 += 4;
495 j = rc4_next_16 (rc4_key, i, j, edata2, w1); i += 16; edata2 += 4;
497 truncate_block (w1, edata2_left & 0xf);
498 append_0x80_1x4 (w1, edata2_left & 0xf);
500 w3[2] = (64 + edata2_len) * 8;
503 md5_transform (w0, w1, w2, w3, ipad);
505 else if (edata2_left < 48)
507 j = rc4_next_16 (rc4_key, i, j, edata2, w0); i += 16; edata2 += 4;
508 j = rc4_next_16 (rc4_key, i, j, edata2, w1); i += 16; edata2 += 4;
509 j = rc4_next_16 (rc4_key, i, j, edata2, w2); i += 16; edata2 += 4;
511 truncate_block (w2, edata2_left & 0xf);
512 append_0x80_1x4 (w2, edata2_left & 0xf);
514 w3[2] = (64 + edata2_len) * 8;
517 md5_transform (w0, w1, w2, w3, ipad);
521 j = rc4_next_16 (rc4_key, i, j, edata2, w0); i += 16; edata2 += 4;
522 j = rc4_next_16 (rc4_key, i, j, edata2, w1); i += 16; edata2 += 4;
523 j = rc4_next_16 (rc4_key, i, j, edata2, w2); i += 16; edata2 += 4;
524 j = rc4_next_16 (rc4_key, i, j, edata2, w3); i += 16; edata2 += 4;
526 truncate_block (w3, edata2_left & 0xf);
527 append_0x80_1x4 (w3, edata2_left & 0xf);
529 if (edata2_left < 56)
531 w3[2] = (64 + edata2_len) * 8;
534 md5_transform (w0, w1, w2, w3, ipad);
538 md5_transform (w0, w1, w2, w3, ipad);
554 w3[2] = (64 + edata2_len) * 8;
557 md5_transform (w0, w1, w2, w3, ipad);
575 w3[2] = (64 + 16) * 8;
578 md5_transform (w0, w1, w2, w3, opad);
580 if (checksum[0] != opad[0]) return 0;
581 if (checksum[1] != opad[1]) return 0;
582 if (checksum[2] != opad[2]) return 0;
583 if (checksum[3] != opad[3]) return 0;
588 static void kerb_prepare (const u32 w0[4], const u32 w1[4], const u32 pw_len, const u32 checksum[4], u32 digest[4], u32 K2[4])
616 // K=MD4(Little_indian(UNICODE(pwd))
618 append_0x80_2x4 (w0_t, w1_t, pw_len);
620 make_unicode (w1_t, w2_t, w3_t);
621 make_unicode (w0_t, w0_t, w1_t);
623 w3_t[2] = pw_len * 8 * 2;
631 md4_transform (w0_t, w1_t, w2_t, w3_t, digest);
633 // K1=MD5_HMAC(K,1); with 2 encoded as little indian on 4 bytes (02000000 in hexa);
655 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
671 w3_t[2] = (64 + 4) * 8;
674 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
683 // K3=MD5_HMAC(K1,checksum);
702 hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
704 w0_t[0] = checksum[0];
705 w0_t[1] = checksum[1];
706 w0_t[2] = checksum[2];
707 w0_t[3] = checksum[3];
718 w3_t[2] = (64 + 16) * 8;
721 hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
724 static void m13100 (__local RC4_KEY *rc4_keys, u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __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 il_cnt, const u32 digests_cnt, const u32 digests_offset)
730 const u32 gid = get_global_id (0);
731 const u32 lid = get_local_id (0);
739 checksum[0] = krb5tgs_bufs[salt_pos].checksum[0];
740 checksum[1] = krb5tgs_bufs[salt_pos].checksum[1];
741 checksum[2] = krb5tgs_bufs[salt_pos].checksum[2];
742 checksum[3] = krb5tgs_bufs[salt_pos].checksum[3];
750 for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
752 const u32 w0r = bfs_buf[il_pos].i;
760 kerb_prepare (w0, w1, pw_len, checksum, digest, K2);
769 if (decrypt_and_check (&rc4_keys[lid], tmp, krb5tgs_bufs[salt_pos].edata2, krb5tgs_bufs[salt_pos].edata2_len, K2, checksum) == 1)
771 mark_hash (plains_buf, hashes_shown, digests_offset, gid, il_pos);
773 d_return_buf[lid] = 1;
778 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
784 const u32 gid = get_global_id (0);
785 const u32 lid = get_local_id (0);
787 if (gid >= gid_max) return;
791 w0[0] = pws[gid].i[ 0];
792 w0[1] = pws[gid].i[ 1];
793 w0[2] = pws[gid].i[ 2];
794 w0[3] = pws[gid].i[ 3];
817 const u32 pw_len = pws[gid].pw_len;
823 __local RC4_KEY rc4_keys[64];
825 m13100 (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, krb5tgs_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset);
828 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
834 const u32 gid = get_global_id (0);
835 const u32 lid = get_local_id (0);
837 if (gid >= gid_max) return;
841 w0[0] = pws[gid].i[ 0];
842 w0[1] = pws[gid].i[ 1];
843 w0[2] = pws[gid].i[ 2];
844 w0[3] = pws[gid].i[ 3];
848 w1[0] = pws[gid].i[ 4];
849 w1[1] = pws[gid].i[ 5];
850 w1[2] = pws[gid].i[ 6];
851 w1[3] = pws[gid].i[ 7];
867 const u32 pw_len = pws[gid].pw_len;
873 __local RC4_KEY rc4_keys[64];
875 m13100 (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, krb5tgs_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset);
878 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
882 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
888 const u32 gid = get_global_id (0);
889 const u32 lid = get_local_id (0);
891 if (gid >= gid_max) return;
895 w0[0] = pws[gid].i[ 0];
896 w0[1] = pws[gid].i[ 1];
897 w0[2] = pws[gid].i[ 2];
898 w0[3] = pws[gid].i[ 3];
921 const u32 pw_len = pws[gid].pw_len;
927 __local RC4_KEY rc4_keys[64];
929 m13100 (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, krb5tgs_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset);
932 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
938 const u32 gid = get_global_id (0);
939 const u32 lid = get_local_id (0);
941 if (gid >= gid_max) return;
945 w0[0] = pws[gid].i[ 0];
946 w0[1] = pws[gid].i[ 1];
947 w0[2] = pws[gid].i[ 2];
948 w0[3] = pws[gid].i[ 3];
952 w1[0] = pws[gid].i[ 4];
953 w1[1] = pws[gid].i[ 5];
954 w1[2] = pws[gid].i[ 6];
955 w1[3] = pws[gid].i[ 7];
971 const u32 pw_len = pws[gid].pw_len;
977 __local RC4_KEY rc4_keys[64];
979 m13100 (rc4_keys, w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, krb5tgs_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset);
982 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)