2 * Author......: Jens Steube <jens.steube@gmail.com>
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
28 #include "include/kernel_functions.c"
29 #include "types_amd.c"
30 #include "common_amd.c"
33 #define VECT_COMPARE_M "check_multi_vect1_comp4.c"
36 __constant u32 k_sha256[64] =
38 SHA256C00, SHA256C01, SHA256C02, SHA256C03,
39 SHA256C04, SHA256C05, SHA256C06, SHA256C07,
40 SHA256C08, SHA256C09, SHA256C0a, SHA256C0b,
41 SHA256C0c, SHA256C0d, SHA256C0e, SHA256C0f,
42 SHA256C10, SHA256C11, SHA256C12, SHA256C13,
43 SHA256C14, SHA256C15, SHA256C16, SHA256C17,
44 SHA256C18, SHA256C19, SHA256C1a, SHA256C1b,
45 SHA256C1c, SHA256C1d, SHA256C1e, SHA256C1f,
46 SHA256C20, SHA256C21, SHA256C22, SHA256C23,
47 SHA256C24, SHA256C25, SHA256C26, SHA256C27,
48 SHA256C28, SHA256C29, SHA256C2a, SHA256C2b,
49 SHA256C2c, SHA256C2d, SHA256C2e, SHA256C2f,
50 SHA256C30, SHA256C31, SHA256C32, SHA256C33,
51 SHA256C34, SHA256C35, SHA256C36, SHA256C37,
52 SHA256C38, SHA256C39, SHA256C3a, SHA256C3b,
53 SHA256C3c, SHA256C3d, SHA256C3e, SHA256C3f,
56 __constant u64 k_sha512[80] =
58 SHA512C00, SHA512C01, SHA512C02, SHA512C03,
59 SHA512C04, SHA512C05, SHA512C06, SHA512C07,
60 SHA512C08, SHA512C09, SHA512C0a, SHA512C0b,
61 SHA512C0c, SHA512C0d, SHA512C0e, SHA512C0f,
62 SHA512C10, SHA512C11, SHA512C12, SHA512C13,
63 SHA512C14, SHA512C15, SHA512C16, SHA512C17,
64 SHA512C18, SHA512C19, SHA512C1a, SHA512C1b,
65 SHA512C1c, SHA512C1d, SHA512C1e, SHA512C1f,
66 SHA512C20, SHA512C21, SHA512C22, SHA512C23,
67 SHA512C24, SHA512C25, SHA512C26, SHA512C27,
68 SHA512C28, SHA512C29, SHA512C2a, SHA512C2b,
69 SHA512C2c, SHA512C2d, SHA512C2e, SHA512C2f,
70 SHA512C30, SHA512C31, SHA512C32, SHA512C33,
71 SHA512C34, SHA512C35, SHA512C36, SHA512C37,
72 SHA512C38, SHA512C39, SHA512C3a, SHA512C3b,
73 SHA512C3c, SHA512C3d, SHA512C3e, SHA512C3f,
74 SHA512C40, SHA512C41, SHA512C42, SHA512C43,
75 SHA512C44, SHA512C45, SHA512C46, SHA512C47,
76 SHA512C48, SHA512C49, SHA512C4a, SHA512C4b,
77 SHA512C4c, SHA512C4d, SHA512C4e, SHA512C4f,
80 static void sha256_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[8])
108 #define ROUND_EXPAND() \
110 w0_t = SHA256_EXPAND (we_t, w9_t, w1_t, w0_t); \
111 w1_t = SHA256_EXPAND (wf_t, wa_t, w2_t, w1_t); \
112 w2_t = SHA256_EXPAND (w0_t, wb_t, w3_t, w2_t); \
113 w3_t = SHA256_EXPAND (w1_t, wc_t, w4_t, w3_t); \
114 w4_t = SHA256_EXPAND (w2_t, wd_t, w5_t, w4_t); \
115 w5_t = SHA256_EXPAND (w3_t, we_t, w6_t, w5_t); \
116 w6_t = SHA256_EXPAND (w4_t, wf_t, w7_t, w6_t); \
117 w7_t = SHA256_EXPAND (w5_t, w0_t, w8_t, w7_t); \
118 w8_t = SHA256_EXPAND (w6_t, w1_t, w9_t, w8_t); \
119 w9_t = SHA256_EXPAND (w7_t, w2_t, wa_t, w9_t); \
120 wa_t = SHA256_EXPAND (w8_t, w3_t, wb_t, wa_t); \
121 wb_t = SHA256_EXPAND (w9_t, w4_t, wc_t, wb_t); \
122 wc_t = SHA256_EXPAND (wa_t, w5_t, wd_t, wc_t); \
123 wd_t = SHA256_EXPAND (wb_t, w6_t, we_t, wd_t); \
124 we_t = SHA256_EXPAND (wc_t, w7_t, wf_t, we_t); \
125 wf_t = SHA256_EXPAND (wd_t, w8_t, w0_t, wf_t); \
128 #define ROUND_STEP(i) \
130 SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha256[i + 0]); \
131 SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha256[i + 1]); \
132 SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha256[i + 2]); \
133 SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha256[i + 3]); \
134 SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha256[i + 4]); \
135 SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha256[i + 5]); \
136 SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha256[i + 6]); \
137 SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha256[i + 7]); \
138 SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha256[i + 8]); \
139 SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha256[i + 9]); \
140 SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha256[i + 10]); \
141 SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha256[i + 11]); \
142 SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha256[i + 12]); \
143 SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha256[i + 13]); \
144 SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, we_t, k_sha256[i + 14]); \
145 SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha256[i + 15]); \
151 for (int i = 16; i < 64; i += 16)
153 ROUND_EXPAND (); ROUND_STEP (i);
166 static void hmac_sha256_pad (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], u32x ipad[8], u32x opad[8])
168 w0[0] = w0[0] ^ 0x36363636;
169 w0[1] = w0[1] ^ 0x36363636;
170 w0[2] = w0[2] ^ 0x36363636;
171 w0[3] = w0[3] ^ 0x36363636;
172 w1[0] = w1[0] ^ 0x36363636;
173 w1[1] = w1[1] ^ 0x36363636;
174 w1[2] = w1[2] ^ 0x36363636;
175 w1[3] = w1[3] ^ 0x36363636;
176 w2[0] = w2[0] ^ 0x36363636;
177 w2[1] = w2[1] ^ 0x36363636;
178 w2[2] = w2[2] ^ 0x36363636;
179 w2[3] = w2[3] ^ 0x36363636;
180 w3[0] = w3[0] ^ 0x36363636;
181 w3[1] = w3[1] ^ 0x36363636;
182 w3[2] = w3[2] ^ 0x36363636;
183 w3[3] = w3[3] ^ 0x36363636;
194 sha256_transform (w0, w1, w2, w3, ipad);
196 w0[0] = w0[0] ^ 0x6a6a6a6a;
197 w0[1] = w0[1] ^ 0x6a6a6a6a;
198 w0[2] = w0[2] ^ 0x6a6a6a6a;
199 w0[3] = w0[3] ^ 0x6a6a6a6a;
200 w1[0] = w1[0] ^ 0x6a6a6a6a;
201 w1[1] = w1[1] ^ 0x6a6a6a6a;
202 w1[2] = w1[2] ^ 0x6a6a6a6a;
203 w1[3] = w1[3] ^ 0x6a6a6a6a;
204 w2[0] = w2[0] ^ 0x6a6a6a6a;
205 w2[1] = w2[1] ^ 0x6a6a6a6a;
206 w2[2] = w2[2] ^ 0x6a6a6a6a;
207 w2[3] = w2[3] ^ 0x6a6a6a6a;
208 w3[0] = w3[0] ^ 0x6a6a6a6a;
209 w3[1] = w3[1] ^ 0x6a6a6a6a;
210 w3[2] = w3[2] ^ 0x6a6a6a6a;
211 w3[3] = w3[3] ^ 0x6a6a6a6a;
222 sha256_transform (w0, w1, w2, w3, opad);
225 static void hmac_sha256_run (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], u32x ipad[8], u32x opad[8], u32x digest[8])
236 sha256_transform (w0, w1, w2, w3, digest);
253 w3[3] = (64 + 32) * 8;
264 sha256_transform (w0, w1, w2, w3, digest);
267 static void sha512_transform (const u64 w[16], u64 dgst[8])
295 #define ROUND512_EXPAND() \
297 w0_t = SHA512_EXPAND (we_t, w9_t, w1_t, w0_t); \
298 w1_t = SHA512_EXPAND (wf_t, wa_t, w2_t, w1_t); \
299 w2_t = SHA512_EXPAND (w0_t, wb_t, w3_t, w2_t); \
300 w3_t = SHA512_EXPAND (w1_t, wc_t, w4_t, w3_t); \
301 w4_t = SHA512_EXPAND (w2_t, wd_t, w5_t, w4_t); \
302 w5_t = SHA512_EXPAND (w3_t, we_t, w6_t, w5_t); \
303 w6_t = SHA512_EXPAND (w4_t, wf_t, w7_t, w6_t); \
304 w7_t = SHA512_EXPAND (w5_t, w0_t, w8_t, w7_t); \
305 w8_t = SHA512_EXPAND (w6_t, w1_t, w9_t, w8_t); \
306 w9_t = SHA512_EXPAND (w7_t, w2_t, wa_t, w9_t); \
307 wa_t = SHA512_EXPAND (w8_t, w3_t, wb_t, wa_t); \
308 wb_t = SHA512_EXPAND (w9_t, w4_t, wc_t, wb_t); \
309 wc_t = SHA512_EXPAND (wa_t, w5_t, wd_t, wc_t); \
310 wd_t = SHA512_EXPAND (wb_t, w6_t, we_t, wd_t); \
311 we_t = SHA512_EXPAND (wc_t, w7_t, wf_t, we_t); \
312 wf_t = SHA512_EXPAND (wd_t, w8_t, w0_t, wf_t); \
315 #define ROUND512_STEP(i) \
317 SHA512_STEP (SHA512_F0o, SHA512_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha512[i + 0]); \
318 SHA512_STEP (SHA512_F0o, SHA512_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha512[i + 1]); \
319 SHA512_STEP (SHA512_F0o, SHA512_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha512[i + 2]); \
320 SHA512_STEP (SHA512_F0o, SHA512_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha512[i + 3]); \
321 SHA512_STEP (SHA512_F0o, SHA512_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha512[i + 4]); \
322 SHA512_STEP (SHA512_F0o, SHA512_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha512[i + 5]); \
323 SHA512_STEP (SHA512_F0o, SHA512_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha512[i + 6]); \
324 SHA512_STEP (SHA512_F0o, SHA512_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha512[i + 7]); \
325 SHA512_STEP (SHA512_F0o, SHA512_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha512[i + 8]); \
326 SHA512_STEP (SHA512_F0o, SHA512_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha512[i + 9]); \
327 SHA512_STEP (SHA512_F0o, SHA512_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha512[i + 10]); \
328 SHA512_STEP (SHA512_F0o, SHA512_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha512[i + 11]); \
329 SHA512_STEP (SHA512_F0o, SHA512_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha512[i + 12]); \
330 SHA512_STEP (SHA512_F0o, SHA512_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha512[i + 13]); \
331 SHA512_STEP (SHA512_F0o, SHA512_F1o, c, d, e, f, g, h, a, b, we_t, k_sha512[i + 14]); \
332 SHA512_STEP (SHA512_F0o, SHA512_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha512[i + 15]); \
337 //#pragma unroll // kernel fails if used
338 for (int i = 16; i < 80; i += 16)
340 ROUND512_EXPAND (); ROUND512_STEP (i);
353 static void hmac_sha512_run (const u64 w1[16], const u64 ipad[8], const u64 opad[8], u64 dgst[8])
364 sha512_transform (w1, dgst);
376 w[ 8] = 0x8000000000000000;
383 w[15] = (128 + 64) * 8;
394 sha512_transform (w, dgst);
397 static void hmac_sha512_init (u64 w[16], u64 ipad[8], u64 opad[8])
399 w[ 0] ^= 0x3636363636363636;
400 w[ 1] ^= 0x3636363636363636;
401 w[ 2] ^= 0x3636363636363636;
402 w[ 3] ^= 0x3636363636363636;
403 w[ 4] ^= 0x3636363636363636;
404 w[ 5] ^= 0x3636363636363636;
405 w[ 6] ^= 0x3636363636363636;
406 w[ 7] ^= 0x3636363636363636;
407 w[ 8] ^= 0x3636363636363636;
408 w[ 9] ^= 0x3636363636363636;
409 w[10] ^= 0x3636363636363636;
410 w[11] ^= 0x3636363636363636;
411 w[12] ^= 0x3636363636363636;
412 w[13] ^= 0x3636363636363636;
413 w[14] ^= 0x3636363636363636;
414 w[15] ^= 0x3636363636363636;
425 sha512_transform (w, ipad);
427 w[ 0] ^= 0x6a6a6a6a6a6a6a6a;
428 w[ 1] ^= 0x6a6a6a6a6a6a6a6a;
429 w[ 2] ^= 0x6a6a6a6a6a6a6a6a;
430 w[ 3] ^= 0x6a6a6a6a6a6a6a6a;
431 w[ 4] ^= 0x6a6a6a6a6a6a6a6a;
432 w[ 5] ^= 0x6a6a6a6a6a6a6a6a;
433 w[ 6] ^= 0x6a6a6a6a6a6a6a6a;
434 w[ 7] ^= 0x6a6a6a6a6a6a6a6a;
435 w[ 8] ^= 0x6a6a6a6a6a6a6a6a;
436 w[ 9] ^= 0x6a6a6a6a6a6a6a6a;
437 w[10] ^= 0x6a6a6a6a6a6a6a6a;
438 w[11] ^= 0x6a6a6a6a6a6a6a6a;
439 w[12] ^= 0x6a6a6a6a6a6a6a6a;
440 w[13] ^= 0x6a6a6a6a6a6a6a6a;
441 w[14] ^= 0x6a6a6a6a6a6a6a6a;
442 w[15] ^= 0x6a6a6a6a6a6a6a6a;
453 sha512_transform (w, opad);
456 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m08200_init (__global pw_t *pws, __global gpu_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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
462 const u32 gid = get_global_id (0);
464 if (gid >= gid_max) return;
468 w0[0] = pws[gid].i[ 0];
469 w0[1] = pws[gid].i[ 1];
470 w0[2] = pws[gid].i[ 2];
471 w0[3] = pws[gid].i[ 3];
475 w1[0] = pws[gid].i[ 4];
476 w1[1] = pws[gid].i[ 5];
477 w1[2] = pws[gid].i[ 6];
478 w1[3] = pws[gid].i[ 7];
482 w2[0] = pws[gid].i[ 8];
483 w2[1] = pws[gid].i[ 9];
484 w2[2] = pws[gid].i[10];
485 w2[3] = pws[gid].i[11];
489 w3[0] = pws[gid].i[12];
490 w3[1] = pws[gid].i[13];
491 w3[2] = pws[gid].i[14];
492 w3[3] = pws[gid].i[15];
500 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
501 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
502 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
503 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
507 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
508 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
512 const u32 salt_len = salt_bufs[salt_pos].salt_len;
516 data_buf[ 0] = ((u64) swap_workaround (salt_buf0[ 0])) << 32 | (u64) swap_workaround (salt_buf0[ 1]);
517 data_buf[ 1] = ((u64) swap_workaround (salt_buf0[ 2])) << 32 | (u64) swap_workaround (salt_buf0[ 3]);
518 data_buf[ 2] = ((u64) swap_workaround (salt_buf1[ 0])) << 32 | (u64) swap_workaround (salt_buf1[ 1]);
531 data_buf[15] = (128 + salt_len + 4) * 8;
535 w[ 0] = ((u64) swap_workaround (w0[0])) << 32 | (u64) swap_workaround (w0[1]);
536 w[ 1] = ((u64) swap_workaround (w0[2])) << 32 | (u64) swap_workaround (w0[3]);
537 w[ 2] = ((u64) swap_workaround (w1[0])) << 32 | (u64) swap_workaround (w1[1]);
538 w[ 3] = ((u64) swap_workaround (w1[2])) << 32 | (u64) swap_workaround (w1[3]);
539 w[ 4] = ((u64) swap_workaround (w2[0])) << 32 | (u64) swap_workaround (w2[1]);
540 w[ 5] = ((u64) swap_workaround (w2[2])) << 32 | (u64) swap_workaround (w2[3]);
541 w[ 6] = ((u64) swap_workaround (w3[0])) << 32 | (u64) swap_workaround (w3[1]);
542 w[ 7] = ((u64) swap_workaround (w3[2])) << 32 | (u64) swap_workaround (w3[3]);
555 hmac_sha512_init (w, ipad, opad);
557 tmps[gid].ipad[0] = ipad[0];
558 tmps[gid].ipad[1] = ipad[1];
559 tmps[gid].ipad[2] = ipad[2];
560 tmps[gid].ipad[3] = ipad[3];
561 tmps[gid].ipad[4] = ipad[4];
562 tmps[gid].ipad[5] = ipad[5];
563 tmps[gid].ipad[6] = ipad[6];
564 tmps[gid].ipad[7] = ipad[7];
566 tmps[gid].opad[0] = opad[0];
567 tmps[gid].opad[1] = opad[1];
568 tmps[gid].opad[2] = opad[2];
569 tmps[gid].opad[3] = opad[3];
570 tmps[gid].opad[4] = opad[4];
571 tmps[gid].opad[5] = opad[5];
572 tmps[gid].opad[6] = opad[6];
573 tmps[gid].opad[7] = opad[7];
575 for (u32 i = 0, j = 1; i < 8; i += 8, j += 1)
579 hmac_sha512_run (data_buf, ipad, opad, dgst);
581 tmps[gid].dgst[i + 0] = dgst[0];
582 tmps[gid].dgst[i + 1] = dgst[1];
583 tmps[gid].dgst[i + 2] = dgst[2];
584 tmps[gid].dgst[i + 3] = dgst[3];
585 tmps[gid].dgst[i + 4] = dgst[4];
586 tmps[gid].dgst[i + 5] = dgst[5];
587 tmps[gid].dgst[i + 6] = dgst[6];
588 tmps[gid].dgst[i + 7] = dgst[7];
590 tmps[gid].out[i + 0] = dgst[0];
591 tmps[gid].out[i + 1] = dgst[1];
592 tmps[gid].out[i + 2] = dgst[2];
593 tmps[gid].out[i + 3] = dgst[3];
594 tmps[gid].out[i + 4] = dgst[4];
595 tmps[gid].out[i + 5] = dgst[5];
596 tmps[gid].out[i + 6] = dgst[6];
597 tmps[gid].out[i + 7] = dgst[7];
601 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m08200_loop (__global pw_t *pws, __global gpu_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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
603 const u32 gid = get_global_id (0);
605 if (gid >= gid_max) return;
609 ipad[0] = tmps[gid].ipad[0];
610 ipad[1] = tmps[gid].ipad[1];
611 ipad[2] = tmps[gid].ipad[2];
612 ipad[3] = tmps[gid].ipad[3];
613 ipad[4] = tmps[gid].ipad[4];
614 ipad[5] = tmps[gid].ipad[5];
615 ipad[6] = tmps[gid].ipad[6];
616 ipad[7] = tmps[gid].ipad[7];
620 opad[0] = tmps[gid].opad[0];
621 opad[1] = tmps[gid].opad[1];
622 opad[2] = tmps[gid].opad[2];
623 opad[3] = tmps[gid].opad[3];
624 opad[4] = tmps[gid].opad[4];
625 opad[5] = tmps[gid].opad[5];
626 opad[6] = tmps[gid].opad[6];
627 opad[7] = tmps[gid].opad[7];
629 for (u32 i = 0; i < 8; i += 8)
633 dgst[0] = tmps[gid].dgst[i + 0];
634 dgst[1] = tmps[gid].dgst[i + 1];
635 dgst[2] = tmps[gid].dgst[i + 2];
636 dgst[3] = tmps[gid].dgst[i + 3];
637 dgst[4] = tmps[gid].dgst[i + 4];
638 dgst[5] = tmps[gid].dgst[i + 5];
639 dgst[6] = tmps[gid].dgst[i + 6];
640 dgst[7] = tmps[gid].dgst[i + 7];
644 out[0] = tmps[gid].out[i + 0];
645 out[1] = tmps[gid].out[i + 1];
646 out[2] = tmps[gid].out[i + 2];
647 out[3] = tmps[gid].out[i + 3];
648 out[4] = tmps[gid].out[i + 4];
649 out[5] = tmps[gid].out[i + 5];
650 out[6] = tmps[gid].out[i + 6];
651 out[7] = tmps[gid].out[i + 7];
653 for (u32 j = 0; j < loop_cnt; j++)
665 w[ 8] = 0x8000000000000000;
672 w[15] = (128 + 64) * 8;
674 hmac_sha512_run (w, ipad, opad, dgst);
686 tmps[gid].dgst[i + 0] = dgst[0];
687 tmps[gid].dgst[i + 1] = dgst[1];
688 tmps[gid].dgst[i + 2] = dgst[2];
689 tmps[gid].dgst[i + 3] = dgst[3];
690 tmps[gid].dgst[i + 4] = dgst[4];
691 tmps[gid].dgst[i + 5] = dgst[5];
692 tmps[gid].dgst[i + 6] = dgst[6];
693 tmps[gid].dgst[i + 7] = dgst[7];
695 tmps[gid].out[i + 0] = out[0];
696 tmps[gid].out[i + 1] = out[1];
697 tmps[gid].out[i + 2] = out[2];
698 tmps[gid].out[i + 3] = out[3];
699 tmps[gid].out[i + 4] = out[4];
700 tmps[gid].out[i + 5] = out[5];
701 tmps[gid].out[i + 6] = out[6];
702 tmps[gid].out[i + 7] = out[7];
706 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m08200_comp (__global pw_t *pws, __global gpu_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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
712 const u32 gid = get_global_id (0);
714 if (gid >= gid_max) return;
716 const u32 lid = get_local_id (0);
723 w0[0] = tmps[gid].out[4] >> 32;
724 w0[1] = tmps[gid].out[4] & 0xffffffff;
725 w0[2] = tmps[gid].out[5] >> 32;
726 w0[3] = tmps[gid].out[5] & 0xffffffff;
727 w1[0] = tmps[gid].out[6] >> 32;
728 w1[1] = tmps[gid].out[6] & 0xffffffff;
729 w1[2] = tmps[gid].out[7] >> 32;
730 w1[3] = tmps[gid].out[7] & 0xffffffff;
743 hmac_sha256_pad (w0, w1, w2, w3, ipad, opad);
745 int size = esalt_bufs[salt_pos].data_len;
750 for (left = size, off = 0; left >= 56; left -= 64, off += 16)
752 w0[0] = esalt_bufs[salt_pos].data_buf[off + 0];
753 w0[1] = esalt_bufs[salt_pos].data_buf[off + 1];
754 w0[2] = esalt_bufs[salt_pos].data_buf[off + 2];
755 w0[3] = esalt_bufs[salt_pos].data_buf[off + 3];
756 w1[0] = esalt_bufs[salt_pos].data_buf[off + 4];
757 w1[1] = esalt_bufs[salt_pos].data_buf[off + 5];
758 w1[2] = esalt_bufs[salt_pos].data_buf[off + 6];
759 w1[3] = esalt_bufs[salt_pos].data_buf[off + 7];
760 w2[0] = esalt_bufs[salt_pos].data_buf[off + 8];
761 w2[1] = esalt_bufs[salt_pos].data_buf[off + 9];
762 w2[2] = esalt_bufs[salt_pos].data_buf[off + 10];
763 w2[3] = esalt_bufs[salt_pos].data_buf[off + 11];
764 w3[0] = esalt_bufs[salt_pos].data_buf[off + 12];
765 w3[1] = esalt_bufs[salt_pos].data_buf[off + 13];
766 w3[2] = esalt_bufs[salt_pos].data_buf[off + 14];
767 w3[3] = esalt_bufs[salt_pos].data_buf[off + 15];
769 sha256_transform (w0, w1, w2, w3, ipad);
772 w0[0] = esalt_bufs[salt_pos].data_buf[off + 0];
773 w0[1] = esalt_bufs[salt_pos].data_buf[off + 1];
774 w0[2] = esalt_bufs[salt_pos].data_buf[off + 2];
775 w0[3] = esalt_bufs[salt_pos].data_buf[off + 3];
776 w1[0] = esalt_bufs[salt_pos].data_buf[off + 4];
777 w1[1] = esalt_bufs[salt_pos].data_buf[off + 5];
778 w1[2] = esalt_bufs[salt_pos].data_buf[off + 6];
779 w1[3] = esalt_bufs[salt_pos].data_buf[off + 7];
780 w2[0] = esalt_bufs[salt_pos].data_buf[off + 8];
781 w2[1] = esalt_bufs[salt_pos].data_buf[off + 9];
782 w2[2] = esalt_bufs[salt_pos].data_buf[off + 10];
783 w2[3] = esalt_bufs[salt_pos].data_buf[off + 11];
784 w3[0] = esalt_bufs[salt_pos].data_buf[off + 12];
785 w3[1] = esalt_bufs[salt_pos].data_buf[off + 13];
787 w3[3] = (64 + size) * 8;
791 hmac_sha256_run (w0, w1, w2, w3, ipad, opad, digest);
793 const u32x r0 = digest[0];
794 const u32x r1 = digest[1];
795 const u32x r2 = digest[2];
796 const u32x r3 = digest[3];
800 #include VECT_COMPARE_M