2 * Author......: Jens Steube <jens.steube@gmail.com>
8 #include "inc_hash_constants.h"
9 #include "inc_vendor.cl"
16 #include "inc_hash_functions.cl"
17 #include "inc_types.cl"
18 #include "inc_common.cl"
20 #define COMPARE_S "inc_comp_single.cl"
21 #define COMPARE_M "inc_comp_multi.cl"
23 __constant u32 k_sha256[64] =
25 SHA256C00, SHA256C01, SHA256C02, SHA256C03,
26 SHA256C04, SHA256C05, SHA256C06, SHA256C07,
27 SHA256C08, SHA256C09, SHA256C0a, SHA256C0b,
28 SHA256C0c, SHA256C0d, SHA256C0e, SHA256C0f,
29 SHA256C10, SHA256C11, SHA256C12, SHA256C13,
30 SHA256C14, SHA256C15, SHA256C16, SHA256C17,
31 SHA256C18, SHA256C19, SHA256C1a, SHA256C1b,
32 SHA256C1c, SHA256C1d, SHA256C1e, SHA256C1f,
33 SHA256C20, SHA256C21, SHA256C22, SHA256C23,
34 SHA256C24, SHA256C25, SHA256C26, SHA256C27,
35 SHA256C28, SHA256C29, SHA256C2a, SHA256C2b,
36 SHA256C2c, SHA256C2d, SHA256C2e, SHA256C2f,
37 SHA256C30, SHA256C31, SHA256C32, SHA256C33,
38 SHA256C34, SHA256C35, SHA256C36, SHA256C37,
39 SHA256C38, SHA256C39, SHA256C3a, SHA256C3b,
40 SHA256C3c, SHA256C3d, SHA256C3e, SHA256C3f,
43 __constant u64 k_sha512[80] =
45 SHA512C00, SHA512C01, SHA512C02, SHA512C03,
46 SHA512C04, SHA512C05, SHA512C06, SHA512C07,
47 SHA512C08, SHA512C09, SHA512C0a, SHA512C0b,
48 SHA512C0c, SHA512C0d, SHA512C0e, SHA512C0f,
49 SHA512C10, SHA512C11, SHA512C12, SHA512C13,
50 SHA512C14, SHA512C15, SHA512C16, SHA512C17,
51 SHA512C18, SHA512C19, SHA512C1a, SHA512C1b,
52 SHA512C1c, SHA512C1d, SHA512C1e, SHA512C1f,
53 SHA512C20, SHA512C21, SHA512C22, SHA512C23,
54 SHA512C24, SHA512C25, SHA512C26, SHA512C27,
55 SHA512C28, SHA512C29, SHA512C2a, SHA512C2b,
56 SHA512C2c, SHA512C2d, SHA512C2e, SHA512C2f,
57 SHA512C30, SHA512C31, SHA512C32, SHA512C33,
58 SHA512C34, SHA512C35, SHA512C36, SHA512C37,
59 SHA512C38, SHA512C39, SHA512C3a, SHA512C3b,
60 SHA512C3c, SHA512C3d, SHA512C3e, SHA512C3f,
61 SHA512C40, SHA512C41, SHA512C42, SHA512C43,
62 SHA512C44, SHA512C45, SHA512C46, SHA512C47,
63 SHA512C48, SHA512C49, SHA512C4a, SHA512C4b,
64 SHA512C4c, SHA512C4d, SHA512C4e, SHA512C4f,
67 void sha256_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[8])
95 #define ROUND_EXPAND() \
97 w0_t = SHA256_EXPAND (we_t, w9_t, w1_t, w0_t); \
98 w1_t = SHA256_EXPAND (wf_t, wa_t, w2_t, w1_t); \
99 w2_t = SHA256_EXPAND (w0_t, wb_t, w3_t, w2_t); \
100 w3_t = SHA256_EXPAND (w1_t, wc_t, w4_t, w3_t); \
101 w4_t = SHA256_EXPAND (w2_t, wd_t, w5_t, w4_t); \
102 w5_t = SHA256_EXPAND (w3_t, we_t, w6_t, w5_t); \
103 w6_t = SHA256_EXPAND (w4_t, wf_t, w7_t, w6_t); \
104 w7_t = SHA256_EXPAND (w5_t, w0_t, w8_t, w7_t); \
105 w8_t = SHA256_EXPAND (w6_t, w1_t, w9_t, w8_t); \
106 w9_t = SHA256_EXPAND (w7_t, w2_t, wa_t, w9_t); \
107 wa_t = SHA256_EXPAND (w8_t, w3_t, wb_t, wa_t); \
108 wb_t = SHA256_EXPAND (w9_t, w4_t, wc_t, wb_t); \
109 wc_t = SHA256_EXPAND (wa_t, w5_t, wd_t, wc_t); \
110 wd_t = SHA256_EXPAND (wb_t, w6_t, we_t, wd_t); \
111 we_t = SHA256_EXPAND (wc_t, w7_t, wf_t, we_t); \
112 wf_t = SHA256_EXPAND (wd_t, w8_t, w0_t, wf_t); \
115 #define ROUND_STEP(i) \
117 SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha256[i + 0]); \
118 SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha256[i + 1]); \
119 SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha256[i + 2]); \
120 SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha256[i + 3]); \
121 SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha256[i + 4]); \
122 SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha256[i + 5]); \
123 SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha256[i + 6]); \
124 SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha256[i + 7]); \
125 SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha256[i + 8]); \
126 SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha256[i + 9]); \
127 SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha256[i + 10]); \
128 SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha256[i + 11]); \
129 SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha256[i + 12]); \
130 SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha256[i + 13]); \
131 SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, we_t, k_sha256[i + 14]); \
132 SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha256[i + 15]); \
140 for (int i = 16; i < 64; i += 16)
142 ROUND_EXPAND (); ROUND_STEP (i);
155 void hmac_sha256_pad (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], u32 ipad[8], u32 opad[8])
157 w0[0] = w0[0] ^ 0x36363636;
158 w0[1] = w0[1] ^ 0x36363636;
159 w0[2] = w0[2] ^ 0x36363636;
160 w0[3] = w0[3] ^ 0x36363636;
161 w1[0] = w1[0] ^ 0x36363636;
162 w1[1] = w1[1] ^ 0x36363636;
163 w1[2] = w1[2] ^ 0x36363636;
164 w1[3] = w1[3] ^ 0x36363636;
165 w2[0] = w2[0] ^ 0x36363636;
166 w2[1] = w2[1] ^ 0x36363636;
167 w2[2] = w2[2] ^ 0x36363636;
168 w2[3] = w2[3] ^ 0x36363636;
169 w3[0] = w3[0] ^ 0x36363636;
170 w3[1] = w3[1] ^ 0x36363636;
171 w3[2] = w3[2] ^ 0x36363636;
172 w3[3] = w3[3] ^ 0x36363636;
183 sha256_transform (w0, w1, w2, w3, ipad);
185 w0[0] = w0[0] ^ 0x6a6a6a6a;
186 w0[1] = w0[1] ^ 0x6a6a6a6a;
187 w0[2] = w0[2] ^ 0x6a6a6a6a;
188 w0[3] = w0[3] ^ 0x6a6a6a6a;
189 w1[0] = w1[0] ^ 0x6a6a6a6a;
190 w1[1] = w1[1] ^ 0x6a6a6a6a;
191 w1[2] = w1[2] ^ 0x6a6a6a6a;
192 w1[3] = w1[3] ^ 0x6a6a6a6a;
193 w2[0] = w2[0] ^ 0x6a6a6a6a;
194 w2[1] = w2[1] ^ 0x6a6a6a6a;
195 w2[2] = w2[2] ^ 0x6a6a6a6a;
196 w2[3] = w2[3] ^ 0x6a6a6a6a;
197 w3[0] = w3[0] ^ 0x6a6a6a6a;
198 w3[1] = w3[1] ^ 0x6a6a6a6a;
199 w3[2] = w3[2] ^ 0x6a6a6a6a;
200 w3[3] = w3[3] ^ 0x6a6a6a6a;
211 sha256_transform (w0, w1, w2, w3, opad);
214 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])
225 sha256_transform (w0, w1, w2, w3, digest);
242 w3[3] = (64 + 32) * 8;
253 sha256_transform (w0, w1, w2, w3, digest);
256 void sha512_transform (const u64 w[16], u64 dgst[8])
284 #define ROUND512_EXPAND() \
286 w0_t = SHA512_EXPAND (we_t, w9_t, w1_t, w0_t); \
287 w1_t = SHA512_EXPAND (wf_t, wa_t, w2_t, w1_t); \
288 w2_t = SHA512_EXPAND (w0_t, wb_t, w3_t, w2_t); \
289 w3_t = SHA512_EXPAND (w1_t, wc_t, w4_t, w3_t); \
290 w4_t = SHA512_EXPAND (w2_t, wd_t, w5_t, w4_t); \
291 w5_t = SHA512_EXPAND (w3_t, we_t, w6_t, w5_t); \
292 w6_t = SHA512_EXPAND (w4_t, wf_t, w7_t, w6_t); \
293 w7_t = SHA512_EXPAND (w5_t, w0_t, w8_t, w7_t); \
294 w8_t = SHA512_EXPAND (w6_t, w1_t, w9_t, w8_t); \
295 w9_t = SHA512_EXPAND (w7_t, w2_t, wa_t, w9_t); \
296 wa_t = SHA512_EXPAND (w8_t, w3_t, wb_t, wa_t); \
297 wb_t = SHA512_EXPAND (w9_t, w4_t, wc_t, wb_t); \
298 wc_t = SHA512_EXPAND (wa_t, w5_t, wd_t, wc_t); \
299 wd_t = SHA512_EXPAND (wb_t, w6_t, we_t, wd_t); \
300 we_t = SHA512_EXPAND (wc_t, w7_t, wf_t, we_t); \
301 wf_t = SHA512_EXPAND (wd_t, w8_t, w0_t, wf_t); \
304 #define ROUND512_STEP(i) \
306 SHA512_STEP (SHA512_F0o, SHA512_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha512[i + 0]); \
307 SHA512_STEP (SHA512_F0o, SHA512_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha512[i + 1]); \
308 SHA512_STEP (SHA512_F0o, SHA512_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha512[i + 2]); \
309 SHA512_STEP (SHA512_F0o, SHA512_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha512[i + 3]); \
310 SHA512_STEP (SHA512_F0o, SHA512_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha512[i + 4]); \
311 SHA512_STEP (SHA512_F0o, SHA512_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha512[i + 5]); \
312 SHA512_STEP (SHA512_F0o, SHA512_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha512[i + 6]); \
313 SHA512_STEP (SHA512_F0o, SHA512_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha512[i + 7]); \
314 SHA512_STEP (SHA512_F0o, SHA512_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha512[i + 8]); \
315 SHA512_STEP (SHA512_F0o, SHA512_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha512[i + 9]); \
316 SHA512_STEP (SHA512_F0o, SHA512_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha512[i + 10]); \
317 SHA512_STEP (SHA512_F0o, SHA512_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha512[i + 11]); \
318 SHA512_STEP (SHA512_F0o, SHA512_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha512[i + 12]); \
319 SHA512_STEP (SHA512_F0o, SHA512_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha512[i + 13]); \
320 SHA512_STEP (SHA512_F0o, SHA512_F1o, c, d, e, f, g, h, a, b, we_t, k_sha512[i + 14]); \
321 SHA512_STEP (SHA512_F0o, SHA512_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha512[i + 15]); \
329 for (int i = 16; i < 80; i += 16)
331 ROUND512_EXPAND (); ROUND512_STEP (i);
344 void hmac_sha512_run (const u64 w1[16], const u64 ipad[8], const u64 opad[8], u64 dgst[8])
355 sha512_transform (w1, dgst);
367 w[ 8] = 0x8000000000000000;
374 w[15] = (128 + 64) * 8;
385 sha512_transform (w, dgst);
388 void hmac_sha512_run_x (const u64 ipad[8], const u64 opad[8], u64 dgst[8])
400 w[ 8] = 0x8000000000000000;
407 w[15] = (128 + 64) * 8;
418 sha512_transform (w, dgst);
438 sha512_transform (w, dgst);
441 void hmac_sha512_init (u64 w[16], u64 ipad[8], u64 opad[8])
443 w[ 0] ^= 0x3636363636363636;
444 w[ 1] ^= 0x3636363636363636;
445 w[ 2] ^= 0x3636363636363636;
446 w[ 3] ^= 0x3636363636363636;
447 w[ 4] ^= 0x3636363636363636;
448 w[ 5] ^= 0x3636363636363636;
449 w[ 6] ^= 0x3636363636363636;
450 w[ 7] ^= 0x3636363636363636;
451 w[ 8] ^= 0x3636363636363636;
452 w[ 9] ^= 0x3636363636363636;
453 w[10] ^= 0x3636363636363636;
454 w[11] ^= 0x3636363636363636;
455 w[12] ^= 0x3636363636363636;
456 w[13] ^= 0x3636363636363636;
457 w[14] ^= 0x3636363636363636;
458 w[15] ^= 0x3636363636363636;
469 sha512_transform (w, ipad);
471 w[ 0] ^= 0x6a6a6a6a6a6a6a6a;
472 w[ 1] ^= 0x6a6a6a6a6a6a6a6a;
473 w[ 2] ^= 0x6a6a6a6a6a6a6a6a;
474 w[ 3] ^= 0x6a6a6a6a6a6a6a6a;
475 w[ 4] ^= 0x6a6a6a6a6a6a6a6a;
476 w[ 5] ^= 0x6a6a6a6a6a6a6a6a;
477 w[ 6] ^= 0x6a6a6a6a6a6a6a6a;
478 w[ 7] ^= 0x6a6a6a6a6a6a6a6a;
479 w[ 8] ^= 0x6a6a6a6a6a6a6a6a;
480 w[ 9] ^= 0x6a6a6a6a6a6a6a6a;
481 w[10] ^= 0x6a6a6a6a6a6a6a6a;
482 w[11] ^= 0x6a6a6a6a6a6a6a6a;
483 w[12] ^= 0x6a6a6a6a6a6a6a6a;
484 w[13] ^= 0x6a6a6a6a6a6a6a6a;
485 w[14] ^= 0x6a6a6a6a6a6a6a6a;
486 w[15] ^= 0x6a6a6a6a6a6a6a6a;
497 sha512_transform (w, opad);
500 __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_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)
506 const u32 gid = get_global_id (0);
508 if (gid >= gid_max) return;
512 w0[0] = pws[gid].i[ 0];
513 w0[1] = pws[gid].i[ 1];
514 w0[2] = pws[gid].i[ 2];
515 w0[3] = pws[gid].i[ 3];
519 w1[0] = pws[gid].i[ 4];
520 w1[1] = pws[gid].i[ 5];
521 w1[2] = pws[gid].i[ 6];
522 w1[3] = pws[gid].i[ 7];
526 w2[0] = pws[gid].i[ 8];
527 w2[1] = pws[gid].i[ 9];
528 w2[2] = pws[gid].i[10];
529 w2[3] = pws[gid].i[11];
533 w3[0] = pws[gid].i[12];
534 w3[1] = pws[gid].i[13];
535 w3[2] = pws[gid].i[14];
536 w3[3] = pws[gid].i[15];
544 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
545 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
546 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
547 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
551 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
552 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
556 const u32 salt_len = salt_bufs[salt_pos].salt_len;
560 data_buf[ 0] = ((u64) swap32 (salt_buf0[ 0])) << 32 | (u64) swap32 (salt_buf0[ 1]);
561 data_buf[ 1] = ((u64) swap32 (salt_buf0[ 2])) << 32 | (u64) swap32 (salt_buf0[ 3]);
562 data_buf[ 2] = ((u64) swap32 (salt_buf1[ 0])) << 32 | (u64) swap32 (salt_buf1[ 1]);
575 data_buf[15] = (128 + salt_len + 4) * 8;
579 w[ 0] = ((u64) swap32 (w0[0])) << 32 | (u64) swap32 (w0[1]);
580 w[ 1] = ((u64) swap32 (w0[2])) << 32 | (u64) swap32 (w0[3]);
581 w[ 2] = ((u64) swap32 (w1[0])) << 32 | (u64) swap32 (w1[1]);
582 w[ 3] = ((u64) swap32 (w1[2])) << 32 | (u64) swap32 (w1[3]);
583 w[ 4] = ((u64) swap32 (w2[0])) << 32 | (u64) swap32 (w2[1]);
584 w[ 5] = ((u64) swap32 (w2[2])) << 32 | (u64) swap32 (w2[3]);
585 w[ 6] = ((u64) swap32 (w3[0])) << 32 | (u64) swap32 (w3[1]);
586 w[ 7] = ((u64) swap32 (w3[2])) << 32 | (u64) swap32 (w3[3]);
599 hmac_sha512_init (w, ipad, opad);
601 tmps[gid].ipad[0] = ipad[0];
602 tmps[gid].ipad[1] = ipad[1];
603 tmps[gid].ipad[2] = ipad[2];
604 tmps[gid].ipad[3] = ipad[3];
605 tmps[gid].ipad[4] = ipad[4];
606 tmps[gid].ipad[5] = ipad[5];
607 tmps[gid].ipad[6] = ipad[6];
608 tmps[gid].ipad[7] = ipad[7];
610 tmps[gid].opad[0] = opad[0];
611 tmps[gid].opad[1] = opad[1];
612 tmps[gid].opad[2] = opad[2];
613 tmps[gid].opad[3] = opad[3];
614 tmps[gid].opad[4] = opad[4];
615 tmps[gid].opad[5] = opad[5];
616 tmps[gid].opad[6] = opad[6];
617 tmps[gid].opad[7] = opad[7];
619 for (u32 i = 0, j = 1; i < 8; i += 8, j += 1)
623 hmac_sha512_run (data_buf, ipad, opad, dgst);
625 tmps[gid].dgst[i + 0] = dgst[0];
626 tmps[gid].dgst[i + 1] = dgst[1];
627 tmps[gid].dgst[i + 2] = dgst[2];
628 tmps[gid].dgst[i + 3] = dgst[3];
629 tmps[gid].dgst[i + 4] = dgst[4];
630 tmps[gid].dgst[i + 5] = dgst[5];
631 tmps[gid].dgst[i + 6] = dgst[6];
632 tmps[gid].dgst[i + 7] = dgst[7];
634 tmps[gid].out[i + 0] = dgst[0];
635 tmps[gid].out[i + 1] = dgst[1];
636 tmps[gid].out[i + 2] = dgst[2];
637 tmps[gid].out[i + 3] = dgst[3];
638 tmps[gid].out[i + 4] = dgst[4];
639 tmps[gid].out[i + 5] = dgst[5];
640 tmps[gid].out[i + 6] = dgst[6];
641 tmps[gid].out[i + 7] = dgst[7];
645 __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_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)
647 const u32 gid = get_global_id (0);
649 if (gid >= gid_max) return;
653 ipad[0] = tmps[gid].ipad[0];
654 ipad[1] = tmps[gid].ipad[1];
655 ipad[2] = tmps[gid].ipad[2];
656 ipad[3] = tmps[gid].ipad[3];
657 ipad[4] = tmps[gid].ipad[4];
658 ipad[5] = tmps[gid].ipad[5];
659 ipad[6] = tmps[gid].ipad[6];
660 ipad[7] = tmps[gid].ipad[7];
664 opad[0] = tmps[gid].opad[0];
665 opad[1] = tmps[gid].opad[1];
666 opad[2] = tmps[gid].opad[2];
667 opad[3] = tmps[gid].opad[3];
668 opad[4] = tmps[gid].opad[4];
669 opad[5] = tmps[gid].opad[5];
670 opad[6] = tmps[gid].opad[6];
671 opad[7] = tmps[gid].opad[7];
675 dgst[0] = tmps[gid].dgst[0];
676 dgst[1] = tmps[gid].dgst[1];
677 dgst[2] = tmps[gid].dgst[2];
678 dgst[3] = tmps[gid].dgst[3];
679 dgst[4] = tmps[gid].dgst[4];
680 dgst[5] = tmps[gid].dgst[5];
681 dgst[6] = tmps[gid].dgst[6];
682 dgst[7] = tmps[gid].dgst[7];
684 for (u32 j = 0; j < loop_cnt; j++)
686 hmac_sha512_run_x (ipad, opad, dgst);
688 tmps[gid].out[0] ^= dgst[0];
689 tmps[gid].out[1] ^= dgst[1];
690 tmps[gid].out[2] ^= dgst[2];
691 tmps[gid].out[3] ^= dgst[3];
692 tmps[gid].out[4] ^= dgst[4];
693 tmps[gid].out[5] ^= dgst[5];
694 tmps[gid].out[6] ^= dgst[6];
695 tmps[gid].out[7] ^= dgst[7];
698 tmps[gid].dgst[0] = dgst[0];
699 tmps[gid].dgst[1] = dgst[1];
700 tmps[gid].dgst[2] = dgst[2];
701 tmps[gid].dgst[3] = dgst[3];
702 tmps[gid].dgst[4] = dgst[4];
703 tmps[gid].dgst[5] = dgst[5];
704 tmps[gid].dgst[6] = dgst[6];
705 tmps[gid].dgst[7] = dgst[7];
708 __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_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)
714 const u32 gid = get_global_id (0);
716 if (gid >= gid_max) return;
718 const u32 lid = get_local_id (0);
725 w0[0] = tmps[gid].out[4] >> 32;
726 w0[1] = tmps[gid].out[4] & 0xffffffff;
727 w0[2] = tmps[gid].out[5] >> 32;
728 w0[3] = tmps[gid].out[5] & 0xffffffff;
729 w1[0] = tmps[gid].out[6] >> 32;
730 w1[1] = tmps[gid].out[6] & 0xffffffff;
731 w1[2] = tmps[gid].out[7] >> 32;
732 w1[3] = tmps[gid].out[7] & 0xffffffff;
745 hmac_sha256_pad (w0, w1, w2, w3, ipad, opad);
747 int size = esalt_bufs[salt_pos].data_len;
752 for (left = size, off = 0; left >= 56; left -= 64, off += 16)
754 w0[0] = esalt_bufs[salt_pos].data_buf[off + 0];
755 w0[1] = esalt_bufs[salt_pos].data_buf[off + 1];
756 w0[2] = esalt_bufs[salt_pos].data_buf[off + 2];
757 w0[3] = esalt_bufs[salt_pos].data_buf[off + 3];
758 w1[0] = esalt_bufs[salt_pos].data_buf[off + 4];
759 w1[1] = esalt_bufs[salt_pos].data_buf[off + 5];
760 w1[2] = esalt_bufs[salt_pos].data_buf[off + 6];
761 w1[3] = esalt_bufs[salt_pos].data_buf[off + 7];
762 w2[0] = esalt_bufs[salt_pos].data_buf[off + 8];
763 w2[1] = esalt_bufs[salt_pos].data_buf[off + 9];
764 w2[2] = esalt_bufs[salt_pos].data_buf[off + 10];
765 w2[3] = esalt_bufs[salt_pos].data_buf[off + 11];
766 w3[0] = esalt_bufs[salt_pos].data_buf[off + 12];
767 w3[1] = esalt_bufs[salt_pos].data_buf[off + 13];
768 w3[2] = esalt_bufs[salt_pos].data_buf[off + 14];
769 w3[3] = esalt_bufs[salt_pos].data_buf[off + 15];
771 sha256_transform (w0, w1, w2, w3, ipad);
774 w0[0] = esalt_bufs[salt_pos].data_buf[off + 0];
775 w0[1] = esalt_bufs[salt_pos].data_buf[off + 1];
776 w0[2] = esalt_bufs[salt_pos].data_buf[off + 2];
777 w0[3] = esalt_bufs[salt_pos].data_buf[off + 3];
778 w1[0] = esalt_bufs[salt_pos].data_buf[off + 4];
779 w1[1] = esalt_bufs[salt_pos].data_buf[off + 5];
780 w1[2] = esalt_bufs[salt_pos].data_buf[off + 6];
781 w1[3] = esalt_bufs[salt_pos].data_buf[off + 7];
782 w2[0] = esalt_bufs[salt_pos].data_buf[off + 8];
783 w2[1] = esalt_bufs[salt_pos].data_buf[off + 9];
784 w2[2] = esalt_bufs[salt_pos].data_buf[off + 10];
785 w2[3] = esalt_bufs[salt_pos].data_buf[off + 11];
786 w3[0] = esalt_bufs[salt_pos].data_buf[off + 12];
787 w3[1] = esalt_bufs[salt_pos].data_buf[off + 13];
789 w3[3] = (64 + size) * 8;
793 hmac_sha256_run (w0, w1, w2, w3, ipad, opad, digest);
795 const u32 r0 = digest[0];
796 const u32 r1 = digest[1];
797 const u32 r2 = digest[2];
798 const u32 r3 = digest[3];