2 * Author......: Jens Steube <jens.steube@gmail.com>
8 #include "inc_vendor.cl"
9 #include "inc_hash_constants.h"
10 #include "inc_hash_functions.cl"
11 #include "inc_types.cl"
12 #include "inc_common.cl"
14 #define COMPARE_S "inc_comp_single.cl"
15 #define COMPARE_M "inc_comp_multi.cl"
17 __constant u32 k_sha256[64] =
19 SHA256C00, SHA256C01, SHA256C02, SHA256C03,
20 SHA256C04, SHA256C05, SHA256C06, SHA256C07,
21 SHA256C08, SHA256C09, SHA256C0a, SHA256C0b,
22 SHA256C0c, SHA256C0d, SHA256C0e, SHA256C0f,
23 SHA256C10, SHA256C11, SHA256C12, SHA256C13,
24 SHA256C14, SHA256C15, SHA256C16, SHA256C17,
25 SHA256C18, SHA256C19, SHA256C1a, SHA256C1b,
26 SHA256C1c, SHA256C1d, SHA256C1e, SHA256C1f,
27 SHA256C20, SHA256C21, SHA256C22, SHA256C23,
28 SHA256C24, SHA256C25, SHA256C26, SHA256C27,
29 SHA256C28, SHA256C29, SHA256C2a, SHA256C2b,
30 SHA256C2c, SHA256C2d, SHA256C2e, SHA256C2f,
31 SHA256C30, SHA256C31, SHA256C32, SHA256C33,
32 SHA256C34, SHA256C35, SHA256C36, SHA256C37,
33 SHA256C38, SHA256C39, SHA256C3a, SHA256C3b,
34 SHA256C3c, SHA256C3d, SHA256C3e, SHA256C3f,
37 __constant u64 k_sha512[80] =
39 SHA512C00, SHA512C01, SHA512C02, SHA512C03,
40 SHA512C04, SHA512C05, SHA512C06, SHA512C07,
41 SHA512C08, SHA512C09, SHA512C0a, SHA512C0b,
42 SHA512C0c, SHA512C0d, SHA512C0e, SHA512C0f,
43 SHA512C10, SHA512C11, SHA512C12, SHA512C13,
44 SHA512C14, SHA512C15, SHA512C16, SHA512C17,
45 SHA512C18, SHA512C19, SHA512C1a, SHA512C1b,
46 SHA512C1c, SHA512C1d, SHA512C1e, SHA512C1f,
47 SHA512C20, SHA512C21, SHA512C22, SHA512C23,
48 SHA512C24, SHA512C25, SHA512C26, SHA512C27,
49 SHA512C28, SHA512C29, SHA512C2a, SHA512C2b,
50 SHA512C2c, SHA512C2d, SHA512C2e, SHA512C2f,
51 SHA512C30, SHA512C31, SHA512C32, SHA512C33,
52 SHA512C34, SHA512C35, SHA512C36, SHA512C37,
53 SHA512C38, SHA512C39, SHA512C3a, SHA512C3b,
54 SHA512C3c, SHA512C3d, SHA512C3e, SHA512C3f,
55 SHA512C40, SHA512C41, SHA512C42, SHA512C43,
56 SHA512C44, SHA512C45, SHA512C46, SHA512C47,
57 SHA512C48, SHA512C49, SHA512C4a, SHA512C4b,
58 SHA512C4c, SHA512C4d, SHA512C4e, SHA512C4f,
61 void sha256_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[8])
89 #define ROUND_EXPAND() \
91 w0_t = SHA256_EXPAND (we_t, w9_t, w1_t, w0_t); \
92 w1_t = SHA256_EXPAND (wf_t, wa_t, w2_t, w1_t); \
93 w2_t = SHA256_EXPAND (w0_t, wb_t, w3_t, w2_t); \
94 w3_t = SHA256_EXPAND (w1_t, wc_t, w4_t, w3_t); \
95 w4_t = SHA256_EXPAND (w2_t, wd_t, w5_t, w4_t); \
96 w5_t = SHA256_EXPAND (w3_t, we_t, w6_t, w5_t); \
97 w6_t = SHA256_EXPAND (w4_t, wf_t, w7_t, w6_t); \
98 w7_t = SHA256_EXPAND (w5_t, w0_t, w8_t, w7_t); \
99 w8_t = SHA256_EXPAND (w6_t, w1_t, w9_t, w8_t); \
100 w9_t = SHA256_EXPAND (w7_t, w2_t, wa_t, w9_t); \
101 wa_t = SHA256_EXPAND (w8_t, w3_t, wb_t, wa_t); \
102 wb_t = SHA256_EXPAND (w9_t, w4_t, wc_t, wb_t); \
103 wc_t = SHA256_EXPAND (wa_t, w5_t, wd_t, wc_t); \
104 wd_t = SHA256_EXPAND (wb_t, w6_t, we_t, wd_t); \
105 we_t = SHA256_EXPAND (wc_t, w7_t, wf_t, we_t); \
106 wf_t = SHA256_EXPAND (wd_t, w8_t, w0_t, wf_t); \
109 #define ROUND_STEP(i) \
111 SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha256[i + 0]); \
112 SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha256[i + 1]); \
113 SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha256[i + 2]); \
114 SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha256[i + 3]); \
115 SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha256[i + 4]); \
116 SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha256[i + 5]); \
117 SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha256[i + 6]); \
118 SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha256[i + 7]); \
119 SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha256[i + 8]); \
120 SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha256[i + 9]); \
121 SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha256[i + 10]); \
122 SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha256[i + 11]); \
123 SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha256[i + 12]); \
124 SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha256[i + 13]); \
125 SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, we_t, k_sha256[i + 14]); \
126 SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha256[i + 15]); \
134 for (int i = 16; i < 64; i += 16)
136 ROUND_EXPAND (); ROUND_STEP (i);
149 void hmac_sha256_pad (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], u32 ipad[8], u32 opad[8])
151 w0[0] = w0[0] ^ 0x36363636;
152 w0[1] = w0[1] ^ 0x36363636;
153 w0[2] = w0[2] ^ 0x36363636;
154 w0[3] = w0[3] ^ 0x36363636;
155 w1[0] = w1[0] ^ 0x36363636;
156 w1[1] = w1[1] ^ 0x36363636;
157 w1[2] = w1[2] ^ 0x36363636;
158 w1[3] = w1[3] ^ 0x36363636;
159 w2[0] = w2[0] ^ 0x36363636;
160 w2[1] = w2[1] ^ 0x36363636;
161 w2[2] = w2[2] ^ 0x36363636;
162 w2[3] = w2[3] ^ 0x36363636;
163 w3[0] = w3[0] ^ 0x36363636;
164 w3[1] = w3[1] ^ 0x36363636;
165 w3[2] = w3[2] ^ 0x36363636;
166 w3[3] = w3[3] ^ 0x36363636;
177 sha256_transform (w0, w1, w2, w3, ipad);
179 w0[0] = w0[0] ^ 0x6a6a6a6a;
180 w0[1] = w0[1] ^ 0x6a6a6a6a;
181 w0[2] = w0[2] ^ 0x6a6a6a6a;
182 w0[3] = w0[3] ^ 0x6a6a6a6a;
183 w1[0] = w1[0] ^ 0x6a6a6a6a;
184 w1[1] = w1[1] ^ 0x6a6a6a6a;
185 w1[2] = w1[2] ^ 0x6a6a6a6a;
186 w1[3] = w1[3] ^ 0x6a6a6a6a;
187 w2[0] = w2[0] ^ 0x6a6a6a6a;
188 w2[1] = w2[1] ^ 0x6a6a6a6a;
189 w2[2] = w2[2] ^ 0x6a6a6a6a;
190 w2[3] = w2[3] ^ 0x6a6a6a6a;
191 w3[0] = w3[0] ^ 0x6a6a6a6a;
192 w3[1] = w3[1] ^ 0x6a6a6a6a;
193 w3[2] = w3[2] ^ 0x6a6a6a6a;
194 w3[3] = w3[3] ^ 0x6a6a6a6a;
205 sha256_transform (w0, w1, w2, w3, opad);
208 void hmac_sha256_run (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], u32 ipad[8], u32 opad[8], u32 digest[8])
219 sha256_transform (w0, w1, w2, w3, digest);
236 w3[3] = (64 + 32) * 8;
247 sha256_transform (w0, w1, w2, w3, digest);
250 void sha512_transform (const u64 w[16], u64 dgst[8])
278 #define ROUND512_EXPAND() \
280 w0_t = SHA512_EXPAND (we_t, w9_t, w1_t, w0_t); \
281 w1_t = SHA512_EXPAND (wf_t, wa_t, w2_t, w1_t); \
282 w2_t = SHA512_EXPAND (w0_t, wb_t, w3_t, w2_t); \
283 w3_t = SHA512_EXPAND (w1_t, wc_t, w4_t, w3_t); \
284 w4_t = SHA512_EXPAND (w2_t, wd_t, w5_t, w4_t); \
285 w5_t = SHA512_EXPAND (w3_t, we_t, w6_t, w5_t); \
286 w6_t = SHA512_EXPAND (w4_t, wf_t, w7_t, w6_t); \
287 w7_t = SHA512_EXPAND (w5_t, w0_t, w8_t, w7_t); \
288 w8_t = SHA512_EXPAND (w6_t, w1_t, w9_t, w8_t); \
289 w9_t = SHA512_EXPAND (w7_t, w2_t, wa_t, w9_t); \
290 wa_t = SHA512_EXPAND (w8_t, w3_t, wb_t, wa_t); \
291 wb_t = SHA512_EXPAND (w9_t, w4_t, wc_t, wb_t); \
292 wc_t = SHA512_EXPAND (wa_t, w5_t, wd_t, wc_t); \
293 wd_t = SHA512_EXPAND (wb_t, w6_t, we_t, wd_t); \
294 we_t = SHA512_EXPAND (wc_t, w7_t, wf_t, we_t); \
295 wf_t = SHA512_EXPAND (wd_t, w8_t, w0_t, wf_t); \
298 #define ROUND512_STEP(i) \
300 SHA512_STEP (SHA512_F0o, SHA512_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha512[i + 0]); \
301 SHA512_STEP (SHA512_F0o, SHA512_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha512[i + 1]); \
302 SHA512_STEP (SHA512_F0o, SHA512_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha512[i + 2]); \
303 SHA512_STEP (SHA512_F0o, SHA512_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha512[i + 3]); \
304 SHA512_STEP (SHA512_F0o, SHA512_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha512[i + 4]); \
305 SHA512_STEP (SHA512_F0o, SHA512_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha512[i + 5]); \
306 SHA512_STEP (SHA512_F0o, SHA512_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha512[i + 6]); \
307 SHA512_STEP (SHA512_F0o, SHA512_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha512[i + 7]); \
308 SHA512_STEP (SHA512_F0o, SHA512_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha512[i + 8]); \
309 SHA512_STEP (SHA512_F0o, SHA512_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha512[i + 9]); \
310 SHA512_STEP (SHA512_F0o, SHA512_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha512[i + 10]); \
311 SHA512_STEP (SHA512_F0o, SHA512_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha512[i + 11]); \
312 SHA512_STEP (SHA512_F0o, SHA512_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha512[i + 12]); \
313 SHA512_STEP (SHA512_F0o, SHA512_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha512[i + 13]); \
314 SHA512_STEP (SHA512_F0o, SHA512_F1o, c, d, e, f, g, h, a, b, we_t, k_sha512[i + 14]); \
315 SHA512_STEP (SHA512_F0o, SHA512_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha512[i + 15]); \
323 for (int i = 16; i < 80; i += 16)
325 ROUND512_EXPAND (); ROUND512_STEP (i);
338 void hmac_sha512_run (const u64 w1[16], const u64 ipad[8], const u64 opad[8], u64 dgst[8])
349 sha512_transform (w1, dgst);
361 w[ 8] = 0x8000000000000000;
368 w[15] = (128 + 64) * 8;
379 sha512_transform (w, dgst);
382 void hmac_sha512_run_x (const u64 ipad[8], const u64 opad[8], u64 dgst[8])
394 w[ 8] = 0x8000000000000000;
401 w[15] = (128 + 64) * 8;
412 sha512_transform (w, dgst);
432 sha512_transform (w, dgst);
435 void hmac_sha512_init (u64 w[16], u64 ipad[8], u64 opad[8])
437 w[ 0] ^= 0x3636363636363636;
438 w[ 1] ^= 0x3636363636363636;
439 w[ 2] ^= 0x3636363636363636;
440 w[ 3] ^= 0x3636363636363636;
441 w[ 4] ^= 0x3636363636363636;
442 w[ 5] ^= 0x3636363636363636;
443 w[ 6] ^= 0x3636363636363636;
444 w[ 7] ^= 0x3636363636363636;
445 w[ 8] ^= 0x3636363636363636;
446 w[ 9] ^= 0x3636363636363636;
447 w[10] ^= 0x3636363636363636;
448 w[11] ^= 0x3636363636363636;
449 w[12] ^= 0x3636363636363636;
450 w[13] ^= 0x3636363636363636;
451 w[14] ^= 0x3636363636363636;
452 w[15] ^= 0x3636363636363636;
463 sha512_transform (w, ipad);
465 w[ 0] ^= 0x6a6a6a6a6a6a6a6a;
466 w[ 1] ^= 0x6a6a6a6a6a6a6a6a;
467 w[ 2] ^= 0x6a6a6a6a6a6a6a6a;
468 w[ 3] ^= 0x6a6a6a6a6a6a6a6a;
469 w[ 4] ^= 0x6a6a6a6a6a6a6a6a;
470 w[ 5] ^= 0x6a6a6a6a6a6a6a6a;
471 w[ 6] ^= 0x6a6a6a6a6a6a6a6a;
472 w[ 7] ^= 0x6a6a6a6a6a6a6a6a;
473 w[ 8] ^= 0x6a6a6a6a6a6a6a6a;
474 w[ 9] ^= 0x6a6a6a6a6a6a6a6a;
475 w[10] ^= 0x6a6a6a6a6a6a6a6a;
476 w[11] ^= 0x6a6a6a6a6a6a6a6a;
477 w[12] ^= 0x6a6a6a6a6a6a6a6a;
478 w[13] ^= 0x6a6a6a6a6a6a6a6a;
479 w[14] ^= 0x6a6a6a6a6a6a6a6a;
480 w[15] ^= 0x6a6a6a6a6a6a6a6a;
491 sha512_transform (w, opad);
494 __kernel void m08200_init (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global pbkdf2_sha512_tmp_t *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 cloudkey_t *esalt_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)
500 const u32 gid = get_global_id (0);
502 if (gid >= gid_max) return;
506 w0[0] = pws[gid].i[ 0];
507 w0[1] = pws[gid].i[ 1];
508 w0[2] = pws[gid].i[ 2];
509 w0[3] = pws[gid].i[ 3];
513 w1[0] = pws[gid].i[ 4];
514 w1[1] = pws[gid].i[ 5];
515 w1[2] = pws[gid].i[ 6];
516 w1[3] = pws[gid].i[ 7];
520 w2[0] = pws[gid].i[ 8];
521 w2[1] = pws[gid].i[ 9];
522 w2[2] = pws[gid].i[10];
523 w2[3] = pws[gid].i[11];
527 w3[0] = pws[gid].i[12];
528 w3[1] = pws[gid].i[13];
529 w3[2] = pws[gid].i[14];
530 w3[3] = pws[gid].i[15];
538 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
539 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
540 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
541 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
545 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
546 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
550 const u32 salt_len = salt_bufs[salt_pos].salt_len;
554 data_buf[ 0] = ((u64) swap32 (salt_buf0[ 0])) << 32 | (u64) swap32 (salt_buf0[ 1]);
555 data_buf[ 1] = ((u64) swap32 (salt_buf0[ 2])) << 32 | (u64) swap32 (salt_buf0[ 3]);
556 data_buf[ 2] = ((u64) swap32 (salt_buf1[ 0])) << 32 | (u64) swap32 (salt_buf1[ 1]);
569 data_buf[15] = (128 + salt_len + 4) * 8;
573 w[ 0] = ((u64) swap32 (w0[0])) << 32 | (u64) swap32 (w0[1]);
574 w[ 1] = ((u64) swap32 (w0[2])) << 32 | (u64) swap32 (w0[3]);
575 w[ 2] = ((u64) swap32 (w1[0])) << 32 | (u64) swap32 (w1[1]);
576 w[ 3] = ((u64) swap32 (w1[2])) << 32 | (u64) swap32 (w1[3]);
577 w[ 4] = ((u64) swap32 (w2[0])) << 32 | (u64) swap32 (w2[1]);
578 w[ 5] = ((u64) swap32 (w2[2])) << 32 | (u64) swap32 (w2[3]);
579 w[ 6] = ((u64) swap32 (w3[0])) << 32 | (u64) swap32 (w3[1]);
580 w[ 7] = ((u64) swap32 (w3[2])) << 32 | (u64) swap32 (w3[3]);
593 hmac_sha512_init (w, ipad, opad);
595 tmps[gid].ipad[0] = ipad[0];
596 tmps[gid].ipad[1] = ipad[1];
597 tmps[gid].ipad[2] = ipad[2];
598 tmps[gid].ipad[3] = ipad[3];
599 tmps[gid].ipad[4] = ipad[4];
600 tmps[gid].ipad[5] = ipad[5];
601 tmps[gid].ipad[6] = ipad[6];
602 tmps[gid].ipad[7] = ipad[7];
604 tmps[gid].opad[0] = opad[0];
605 tmps[gid].opad[1] = opad[1];
606 tmps[gid].opad[2] = opad[2];
607 tmps[gid].opad[3] = opad[3];
608 tmps[gid].opad[4] = opad[4];
609 tmps[gid].opad[5] = opad[5];
610 tmps[gid].opad[6] = opad[6];
611 tmps[gid].opad[7] = opad[7];
613 for (u32 i = 0, j = 1; i < 8; i += 8, j += 1)
617 hmac_sha512_run (data_buf, ipad, opad, dgst);
619 tmps[gid].dgst[i + 0] = dgst[0];
620 tmps[gid].dgst[i + 1] = dgst[1];
621 tmps[gid].dgst[i + 2] = dgst[2];
622 tmps[gid].dgst[i + 3] = dgst[3];
623 tmps[gid].dgst[i + 4] = dgst[4];
624 tmps[gid].dgst[i + 5] = dgst[5];
625 tmps[gid].dgst[i + 6] = dgst[6];
626 tmps[gid].dgst[i + 7] = dgst[7];
628 tmps[gid].out[i + 0] = dgst[0];
629 tmps[gid].out[i + 1] = dgst[1];
630 tmps[gid].out[i + 2] = dgst[2];
631 tmps[gid].out[i + 3] = dgst[3];
632 tmps[gid].out[i + 4] = dgst[4];
633 tmps[gid].out[i + 5] = dgst[5];
634 tmps[gid].out[i + 6] = dgst[6];
635 tmps[gid].out[i + 7] = dgst[7];
639 __kernel void m08200_loop (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global pbkdf2_sha512_tmp_t *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 cloudkey_t *esalt_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)
641 const u32 gid = get_global_id (0);
643 if (gid >= gid_max) return;
647 ipad[0] = tmps[gid].ipad[0];
648 ipad[1] = tmps[gid].ipad[1];
649 ipad[2] = tmps[gid].ipad[2];
650 ipad[3] = tmps[gid].ipad[3];
651 ipad[4] = tmps[gid].ipad[4];
652 ipad[5] = tmps[gid].ipad[5];
653 ipad[6] = tmps[gid].ipad[6];
654 ipad[7] = tmps[gid].ipad[7];
658 opad[0] = tmps[gid].opad[0];
659 opad[1] = tmps[gid].opad[1];
660 opad[2] = tmps[gid].opad[2];
661 opad[3] = tmps[gid].opad[3];
662 opad[4] = tmps[gid].opad[4];
663 opad[5] = tmps[gid].opad[5];
664 opad[6] = tmps[gid].opad[6];
665 opad[7] = tmps[gid].opad[7];
669 dgst[0] = tmps[gid].dgst[0];
670 dgst[1] = tmps[gid].dgst[1];
671 dgst[2] = tmps[gid].dgst[2];
672 dgst[3] = tmps[gid].dgst[3];
673 dgst[4] = tmps[gid].dgst[4];
674 dgst[5] = tmps[gid].dgst[5];
675 dgst[6] = tmps[gid].dgst[6];
676 dgst[7] = tmps[gid].dgst[7];
678 for (u32 j = 0; j < loop_cnt; j++)
680 hmac_sha512_run_x (ipad, opad, dgst);
682 tmps[gid].out[0] ^= dgst[0];
683 tmps[gid].out[1] ^= dgst[1];
684 tmps[gid].out[2] ^= dgst[2];
685 tmps[gid].out[3] ^= dgst[3];
686 tmps[gid].out[4] ^= dgst[4];
687 tmps[gid].out[5] ^= dgst[5];
688 tmps[gid].out[6] ^= dgst[6];
689 tmps[gid].out[7] ^= dgst[7];
692 tmps[gid].dgst[0] = dgst[0];
693 tmps[gid].dgst[1] = dgst[1];
694 tmps[gid].dgst[2] = dgst[2];
695 tmps[gid].dgst[3] = dgst[3];
696 tmps[gid].dgst[4] = dgst[4];
697 tmps[gid].dgst[5] = dgst[5];
698 tmps[gid].dgst[6] = dgst[6];
699 tmps[gid].dgst[7] = dgst[7];
702 __kernel void m08200_comp (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global pbkdf2_sha512_tmp_t *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 cloudkey_t *esalt_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)
708 const u32 gid = get_global_id (0);
710 if (gid >= gid_max) return;
712 const u32 lid = get_local_id (0);
719 w0[0] = tmps[gid].out[4] >> 32;
720 w0[1] = tmps[gid].out[4] & 0xffffffff;
721 w0[2] = tmps[gid].out[5] >> 32;
722 w0[3] = tmps[gid].out[5] & 0xffffffff;
723 w1[0] = tmps[gid].out[6] >> 32;
724 w1[1] = tmps[gid].out[6] & 0xffffffff;
725 w1[2] = tmps[gid].out[7] >> 32;
726 w1[3] = tmps[gid].out[7] & 0xffffffff;
739 hmac_sha256_pad (w0, w1, w2, w3, ipad, opad);
741 int size = esalt_bufs[salt_pos].data_len;
746 for (left = size, off = 0; left >= 56; left -= 64, off += 16)
748 w0[0] = esalt_bufs[salt_pos].data_buf[off + 0];
749 w0[1] = esalt_bufs[salt_pos].data_buf[off + 1];
750 w0[2] = esalt_bufs[salt_pos].data_buf[off + 2];
751 w0[3] = esalt_bufs[salt_pos].data_buf[off + 3];
752 w1[0] = esalt_bufs[salt_pos].data_buf[off + 4];
753 w1[1] = esalt_bufs[salt_pos].data_buf[off + 5];
754 w1[2] = esalt_bufs[salt_pos].data_buf[off + 6];
755 w1[3] = esalt_bufs[salt_pos].data_buf[off + 7];
756 w2[0] = esalt_bufs[salt_pos].data_buf[off + 8];
757 w2[1] = esalt_bufs[salt_pos].data_buf[off + 9];
758 w2[2] = esalt_bufs[salt_pos].data_buf[off + 10];
759 w2[3] = esalt_bufs[salt_pos].data_buf[off + 11];
760 w3[0] = esalt_bufs[salt_pos].data_buf[off + 12];
761 w3[1] = esalt_bufs[salt_pos].data_buf[off + 13];
762 w3[2] = esalt_bufs[salt_pos].data_buf[off + 14];
763 w3[3] = esalt_bufs[salt_pos].data_buf[off + 15];
765 sha256_transform (w0, w1, w2, w3, ipad);
768 w0[0] = esalt_bufs[salt_pos].data_buf[off + 0];
769 w0[1] = esalt_bufs[salt_pos].data_buf[off + 1];
770 w0[2] = esalt_bufs[salt_pos].data_buf[off + 2];
771 w0[3] = esalt_bufs[salt_pos].data_buf[off + 3];
772 w1[0] = esalt_bufs[salt_pos].data_buf[off + 4];
773 w1[1] = esalt_bufs[salt_pos].data_buf[off + 5];
774 w1[2] = esalt_bufs[salt_pos].data_buf[off + 6];
775 w1[3] = esalt_bufs[salt_pos].data_buf[off + 7];
776 w2[0] = esalt_bufs[salt_pos].data_buf[off + 8];
777 w2[1] = esalt_bufs[salt_pos].data_buf[off + 9];
778 w2[2] = esalt_bufs[salt_pos].data_buf[off + 10];
779 w2[3] = esalt_bufs[salt_pos].data_buf[off + 11];
780 w3[0] = esalt_bufs[salt_pos].data_buf[off + 12];
781 w3[1] = esalt_bufs[salt_pos].data_buf[off + 13];
783 w3[3] = (64 + size) * 8;
787 hmac_sha256_run (w0, w1, w2, w3, ipad, opad, digest);
789 const u32 r0 = digest[0];
790 const u32 r1 = digest[1];
791 const u32 r2 = digest[2];
792 const u32 r3 = digest[3];