2 * Author......: Jens Steube <jens.steube@gmail.com>
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
16 #include "include/kernel_functions.c"
18 #include "types_ocl.c"
22 #define COMPARE_M "check_multi_vect1_comp4.c"
26 #define uint_to_hex_lower8(i) l_bin2asc[(i)]
29 __constant u32 k_sha256[64] =
31 SHA256C00, SHA256C01, SHA256C02, SHA256C03,
32 SHA256C04, SHA256C05, SHA256C06, SHA256C07,
33 SHA256C08, SHA256C09, SHA256C0a, SHA256C0b,
34 SHA256C0c, SHA256C0d, SHA256C0e, SHA256C0f,
35 SHA256C10, SHA256C11, SHA256C12, SHA256C13,
36 SHA256C14, SHA256C15, SHA256C16, SHA256C17,
37 SHA256C18, SHA256C19, SHA256C1a, SHA256C1b,
38 SHA256C1c, SHA256C1d, SHA256C1e, SHA256C1f,
39 SHA256C20, SHA256C21, SHA256C22, SHA256C23,
40 SHA256C24, SHA256C25, SHA256C26, SHA256C27,
41 SHA256C28, SHA256C29, SHA256C2a, SHA256C2b,
42 SHA256C2c, SHA256C2d, SHA256C2e, SHA256C2f,
43 SHA256C30, SHA256C31, SHA256C32, SHA256C33,
44 SHA256C34, SHA256C35, SHA256C36, SHA256C37,
45 SHA256C38, SHA256C39, SHA256C3a, SHA256C3b,
46 SHA256C3c, SHA256C3d, SHA256C3e, SHA256C3f,
49 static void md4_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[4])
56 MD4_STEP (MD4_Fo, a, b, c, d, w0[0], MD4C00, MD4S00);
57 MD4_STEP (MD4_Fo, d, a, b, c, w0[1], MD4C00, MD4S01);
58 MD4_STEP (MD4_Fo, c, d, a, b, w0[2], MD4C00, MD4S02);
59 MD4_STEP (MD4_Fo, b, c, d, a, w0[3], MD4C00, MD4S03);
60 MD4_STEP (MD4_Fo, a, b, c, d, w1[0], MD4C00, MD4S00);
61 MD4_STEP (MD4_Fo, d, a, b, c, w1[1], MD4C00, MD4S01);
62 MD4_STEP (MD4_Fo, c, d, a, b, w1[2], MD4C00, MD4S02);
63 MD4_STEP (MD4_Fo, b, c, d, a, w1[3], MD4C00, MD4S03);
64 MD4_STEP (MD4_Fo, a, b, c, d, w2[0], MD4C00, MD4S00);
65 MD4_STEP (MD4_Fo, d, a, b, c, w2[1], MD4C00, MD4S01);
66 MD4_STEP (MD4_Fo, c, d, a, b, w2[2], MD4C00, MD4S02);
67 MD4_STEP (MD4_Fo, b, c, d, a, w2[3], MD4C00, MD4S03);
68 MD4_STEP (MD4_Fo, a, b, c, d, w3[0], MD4C00, MD4S00);
69 MD4_STEP (MD4_Fo, d, a, b, c, w3[1], MD4C00, MD4S01);
70 MD4_STEP (MD4_Fo, c, d, a, b, w3[2], MD4C00, MD4S02);
71 MD4_STEP (MD4_Fo, b, c, d, a, w3[3], MD4C00, MD4S03);
73 MD4_STEP (MD4_Go, a, b, c, d, w0[0], MD4C01, MD4S10);
74 MD4_STEP (MD4_Go, d, a, b, c, w1[0], MD4C01, MD4S11);
75 MD4_STEP (MD4_Go, c, d, a, b, w2[0], MD4C01, MD4S12);
76 MD4_STEP (MD4_Go, b, c, d, a, w3[0], MD4C01, MD4S13);
77 MD4_STEP (MD4_Go, a, b, c, d, w0[1], MD4C01, MD4S10);
78 MD4_STEP (MD4_Go, d, a, b, c, w1[1], MD4C01, MD4S11);
79 MD4_STEP (MD4_Go, c, d, a, b, w2[1], MD4C01, MD4S12);
80 MD4_STEP (MD4_Go, b, c, d, a, w3[1], MD4C01, MD4S13);
81 MD4_STEP (MD4_Go, a, b, c, d, w0[2], MD4C01, MD4S10);
82 MD4_STEP (MD4_Go, d, a, b, c, w1[2], MD4C01, MD4S11);
83 MD4_STEP (MD4_Go, c, d, a, b, w2[2], MD4C01, MD4S12);
84 MD4_STEP (MD4_Go, b, c, d, a, w3[2], MD4C01, MD4S13);
85 MD4_STEP (MD4_Go, a, b, c, d, w0[3], MD4C01, MD4S10);
86 MD4_STEP (MD4_Go, d, a, b, c, w1[3], MD4C01, MD4S11);
87 MD4_STEP (MD4_Go, c, d, a, b, w2[3], MD4C01, MD4S12);
88 MD4_STEP (MD4_Go, b, c, d, a, w3[3], MD4C01, MD4S13);
90 MD4_STEP (MD4_H , a, b, c, d, w0[0], MD4C02, MD4S20);
91 MD4_STEP (MD4_H , d, a, b, c, w2[0], MD4C02, MD4S21);
92 MD4_STEP (MD4_H , c, d, a, b, w1[0], MD4C02, MD4S22);
93 MD4_STEP (MD4_H , b, c, d, a, w3[0], MD4C02, MD4S23);
94 MD4_STEP (MD4_H , a, b, c, d, w0[2], MD4C02, MD4S20);
95 MD4_STEP (MD4_H , d, a, b, c, w2[2], MD4C02, MD4S21);
96 MD4_STEP (MD4_H , c, d, a, b, w1[2], MD4C02, MD4S22);
97 MD4_STEP (MD4_H , b, c, d, a, w3[2], MD4C02, MD4S23);
98 MD4_STEP (MD4_H , a, b, c, d, w0[1], MD4C02, MD4S20);
99 MD4_STEP (MD4_H , d, a, b, c, w2[1], MD4C02, MD4S21);
100 MD4_STEP (MD4_H , c, d, a, b, w1[1], MD4C02, MD4S22);
101 MD4_STEP (MD4_H , b, c, d, a, w3[1], MD4C02, MD4S23);
102 MD4_STEP (MD4_H , a, b, c, d, w0[3], MD4C02, MD4S20);
103 MD4_STEP (MD4_H , d, a, b, c, w2[3], MD4C02, MD4S21);
104 MD4_STEP (MD4_H , c, d, a, b, w1[3], MD4C02, MD4S22);
105 MD4_STEP (MD4_H , b, c, d, a, w3[3], MD4C02, MD4S23);
113 static void sha256_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[8])
141 #define ROUND_EXPAND() \
143 w0_t = SHA256_EXPAND (we_t, w9_t, w1_t, w0_t); \
144 w1_t = SHA256_EXPAND (wf_t, wa_t, w2_t, w1_t); \
145 w2_t = SHA256_EXPAND (w0_t, wb_t, w3_t, w2_t); \
146 w3_t = SHA256_EXPAND (w1_t, wc_t, w4_t, w3_t); \
147 w4_t = SHA256_EXPAND (w2_t, wd_t, w5_t, w4_t); \
148 w5_t = SHA256_EXPAND (w3_t, we_t, w6_t, w5_t); \
149 w6_t = SHA256_EXPAND (w4_t, wf_t, w7_t, w6_t); \
150 w7_t = SHA256_EXPAND (w5_t, w0_t, w8_t, w7_t); \
151 w8_t = SHA256_EXPAND (w6_t, w1_t, w9_t, w8_t); \
152 w9_t = SHA256_EXPAND (w7_t, w2_t, wa_t, w9_t); \
153 wa_t = SHA256_EXPAND (w8_t, w3_t, wb_t, wa_t); \
154 wb_t = SHA256_EXPAND (w9_t, w4_t, wc_t, wb_t); \
155 wc_t = SHA256_EXPAND (wa_t, w5_t, wd_t, wc_t); \
156 wd_t = SHA256_EXPAND (wb_t, w6_t, we_t, wd_t); \
157 we_t = SHA256_EXPAND (wc_t, w7_t, wf_t, we_t); \
158 wf_t = SHA256_EXPAND (wd_t, w8_t, w0_t, wf_t); \
161 #define ROUND_STEP(i) \
163 SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha256[i + 0]); \
164 SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha256[i + 1]); \
165 SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha256[i + 2]); \
166 SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha256[i + 3]); \
167 SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha256[i + 4]); \
168 SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha256[i + 5]); \
169 SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha256[i + 6]); \
170 SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha256[i + 7]); \
171 SHA256_STEP (SHA256_F0o, SHA256_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha256[i + 8]); \
172 SHA256_STEP (SHA256_F0o, SHA256_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha256[i + 9]); \
173 SHA256_STEP (SHA256_F0o, SHA256_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha256[i + 10]); \
174 SHA256_STEP (SHA256_F0o, SHA256_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha256[i + 11]); \
175 SHA256_STEP (SHA256_F0o, SHA256_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha256[i + 12]); \
176 SHA256_STEP (SHA256_F0o, SHA256_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha256[i + 13]); \
177 SHA256_STEP (SHA256_F0o, SHA256_F1o, c, d, e, f, g, h, a, b, we_t, k_sha256[i + 14]); \
178 SHA256_STEP (SHA256_F0o, SHA256_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha256[i + 15]); \
184 for (int i = 16; i < 64; i += 16)
186 ROUND_EXPAND (); ROUND_STEP (i);
199 static void hmac_sha256_pad (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], u32 ipad[8], u32 opad[8])
201 w0[0] = w0[0] ^ 0x36363636;
202 w0[1] = w0[1] ^ 0x36363636;
203 w0[2] = w0[2] ^ 0x36363636;
204 w0[3] = w0[3] ^ 0x36363636;
205 w1[0] = w1[0] ^ 0x36363636;
206 w1[1] = w1[1] ^ 0x36363636;
207 w1[2] = w1[2] ^ 0x36363636;
208 w1[3] = w1[3] ^ 0x36363636;
209 w2[0] = w2[0] ^ 0x36363636;
210 w2[1] = w2[1] ^ 0x36363636;
211 w2[2] = w2[2] ^ 0x36363636;
212 w2[3] = w2[3] ^ 0x36363636;
213 w3[0] = w3[0] ^ 0x36363636;
214 w3[1] = w3[1] ^ 0x36363636;
215 w3[2] = w3[2] ^ 0x36363636;
216 w3[3] = w3[3] ^ 0x36363636;
227 sha256_transform (w0, w1, w2, w3, ipad);
229 w0[0] = w0[0] ^ 0x6a6a6a6a;
230 w0[1] = w0[1] ^ 0x6a6a6a6a;
231 w0[2] = w0[2] ^ 0x6a6a6a6a;
232 w0[3] = w0[3] ^ 0x6a6a6a6a;
233 w1[0] = w1[0] ^ 0x6a6a6a6a;
234 w1[1] = w1[1] ^ 0x6a6a6a6a;
235 w1[2] = w1[2] ^ 0x6a6a6a6a;
236 w1[3] = w1[3] ^ 0x6a6a6a6a;
237 w2[0] = w2[0] ^ 0x6a6a6a6a;
238 w2[1] = w2[1] ^ 0x6a6a6a6a;
239 w2[2] = w2[2] ^ 0x6a6a6a6a;
240 w2[3] = w2[3] ^ 0x6a6a6a6a;
241 w3[0] = w3[0] ^ 0x6a6a6a6a;
242 w3[1] = w3[1] ^ 0x6a6a6a6a;
243 w3[2] = w3[2] ^ 0x6a6a6a6a;
244 w3[3] = w3[3] ^ 0x6a6a6a6a;
255 sha256_transform (w0, w1, w2, w3, opad);
258 static 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])
269 sha256_transform (w0, w1, w2, w3, digest);
286 w3[3] = (64 + 32) * 8;
297 sha256_transform (w0, w1, w2, w3, digest);
300 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m12800_init (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global pbkdf2_sha256_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 pbkdf2_sha256_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)
306 const u32 gid = get_global_id (0);
307 const u32 lid = get_local_id (0);
313 __local u32 l_bin2asc[256];
315 const u32 lid4 = lid * 4;
317 const u32 lid40 = lid4 + 0;
318 const u32 lid41 = lid4 + 1;
319 const u32 lid42 = lid4 + 2;
320 const u32 lid43 = lid4 + 3;
322 const u32 v400 = (lid40 >> 0) & 15;
323 const u32 v401 = (lid40 >> 4) & 15;
324 const u32 v410 = (lid41 >> 0) & 15;
325 const u32 v411 = (lid41 >> 4) & 15;
326 const u32 v420 = (lid42 >> 0) & 15;
327 const u32 v421 = (lid42 >> 4) & 15;
328 const u32 v430 = (lid43 >> 0) & 15;
329 const u32 v431 = (lid43 >> 4) & 15;
331 l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'A' - 10 + v400) << 8
332 | ((v401 < 10) ? '0' + v401 : 'A' - 10 + v401) << 0;
333 l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'A' - 10 + v410) << 8
334 | ((v411 < 10) ? '0' + v411 : 'A' - 10 + v411) << 0;
335 l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'A' - 10 + v420) << 8
336 | ((v421 < 10) ? '0' + v421 : 'A' - 10 + v421) << 0;
337 l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'A' - 10 + v430) << 8
338 | ((v431 < 10) ? '0' + v431 : 'A' - 10 + v431) << 0;
340 barrier (CLK_LOCAL_MEM_FENCE);
342 if (gid >= gid_max) return;
350 w0[0] = pws[gid].i[0];
351 w0[1] = pws[gid].i[1];
352 w0[2] = pws[gid].i[2];
353 w0[3] = pws[gid].i[3];
357 w1[0] = pws[gid].i[4];
358 w1[1] = pws[gid].i[5];
376 const u32 pw_len = pws[gid].pw_len;
382 u32 salt_len = salt_bufs[salt_pos].salt_len;
386 salt_buf0[0] = swap_workaround (salt_bufs[salt_pos].salt_buf[0]);
387 salt_buf0[1] = swap_workaround (salt_bufs[salt_pos].salt_buf[1]);
388 salt_buf0[2] = swap_workaround (salt_bufs[salt_pos].salt_buf[2]);
389 salt_buf0[3] = swap_workaround (salt_bufs[salt_pos].salt_buf[3]);
410 salt_buf3[3] = (64 + salt_len + 4) * 8;
416 append_0x80_2x4 (w0, w1, pw_len);
418 make_unicode (w1, w2, w3);
419 make_unicode (w0, w0, w1);
421 w3[2] = pw_len * 2 * 8;
425 digest_md4[0] = MD4M_A;
426 digest_md4[1] = MD4M_B;
427 digest_md4[2] = MD4M_C;
428 digest_md4[3] = MD4M_D;
430 md4_transform (w0, w1, w2, w3, digest_md4);
432 w0[0] = uint_to_hex_lower8 ((digest_md4[0] >> 0) & 255) << 0
433 | uint_to_hex_lower8 ((digest_md4[0] >> 8) & 255) << 16;
434 w0[1] = uint_to_hex_lower8 ((digest_md4[0] >> 16) & 255) << 0
435 | uint_to_hex_lower8 ((digest_md4[0] >> 24) & 255) << 16;
436 w0[2] = uint_to_hex_lower8 ((digest_md4[1] >> 0) & 255) << 0
437 | uint_to_hex_lower8 ((digest_md4[1] >> 8) & 255) << 16;
438 w0[3] = uint_to_hex_lower8 ((digest_md4[1] >> 16) & 255) << 0
439 | uint_to_hex_lower8 ((digest_md4[1] >> 24) & 255) << 16;
440 w1[0] = uint_to_hex_lower8 ((digest_md4[2] >> 0) & 255) << 0
441 | uint_to_hex_lower8 ((digest_md4[2] >> 8) & 255) << 16;
442 w1[1] = uint_to_hex_lower8 ((digest_md4[2] >> 16) & 255) << 0
443 | uint_to_hex_lower8 ((digest_md4[2] >> 24) & 255) << 16;
444 w1[2] = uint_to_hex_lower8 ((digest_md4[3] >> 0) & 255) << 0
445 | uint_to_hex_lower8 ((digest_md4[3] >> 8) & 255) << 16;
446 w1[3] = uint_to_hex_lower8 ((digest_md4[3] >> 16) & 255) << 0
447 | uint_to_hex_lower8 ((digest_md4[3] >> 24) & 255) << 16;
449 make_unicode (w1, w2, w3);
450 make_unicode (w0, w0, w1);
452 w0[0] = swap_workaround (w0[0]);
453 w0[1] = swap_workaround (w0[1]);
454 w0[2] = swap_workaround (w0[2]);
455 w0[3] = swap_workaround (w0[3]);
456 w1[0] = swap_workaround (w1[0]);
457 w1[1] = swap_workaround (w1[1]);
458 w1[2] = swap_workaround (w1[2]);
459 w1[3] = swap_workaround (w1[3]);
460 w2[0] = swap_workaround (w2[0]);
461 w2[1] = swap_workaround (w2[1]);
462 w2[2] = swap_workaround (w2[2]);
463 w2[3] = swap_workaround (w2[3]);
464 w3[0] = swap_workaround (w3[0]);
465 w3[1] = swap_workaround (w3[1]);
466 w3[2] = swap_workaround (w3[2]);
467 w3[3] = swap_workaround (w3[3]);
472 hmac_sha256_pad (w0, w1, w2, w3, ipad, opad);
474 tmps[gid].ipad[0] = ipad[0];
475 tmps[gid].ipad[1] = ipad[1];
476 tmps[gid].ipad[2] = ipad[2];
477 tmps[gid].ipad[3] = ipad[3];
478 tmps[gid].ipad[4] = ipad[4];
479 tmps[gid].ipad[5] = ipad[5];
480 tmps[gid].ipad[6] = ipad[6];
481 tmps[gid].ipad[7] = ipad[7];
483 tmps[gid].opad[0] = opad[0];
484 tmps[gid].opad[1] = opad[1];
485 tmps[gid].opad[2] = opad[2];
486 tmps[gid].opad[3] = opad[3];
487 tmps[gid].opad[4] = opad[4];
488 tmps[gid].opad[5] = opad[5];
489 tmps[gid].opad[6] = opad[6];
490 tmps[gid].opad[7] = opad[7];
492 for (u32 i = 0, j = 1; i < 8; i += 8, j += 1)
496 hmac_sha256_run (salt_buf0, salt_buf1, salt_buf2, salt_buf3, ipad, opad, dgst);
498 tmps[gid].dgst[i + 0] = dgst[0];
499 tmps[gid].dgst[i + 1] = dgst[1];
500 tmps[gid].dgst[i + 2] = dgst[2];
501 tmps[gid].dgst[i + 3] = dgst[3];
502 tmps[gid].dgst[i + 4] = dgst[4];
503 tmps[gid].dgst[i + 5] = dgst[5];
504 tmps[gid].dgst[i + 6] = dgst[6];
505 tmps[gid].dgst[i + 7] = dgst[7];
507 tmps[gid].out[i + 0] = dgst[0];
508 tmps[gid].out[i + 1] = dgst[1];
509 tmps[gid].out[i + 2] = dgst[2];
510 tmps[gid].out[i + 3] = dgst[3];
511 tmps[gid].out[i + 4] = dgst[4];
512 tmps[gid].out[i + 5] = dgst[5];
513 tmps[gid].out[i + 6] = dgst[6];
514 tmps[gid].out[i + 7] = dgst[7];
518 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m12800_loop (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global pbkdf2_sha256_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 pbkdf2_sha256_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)
520 const u32 gid = get_global_id (0);
522 if (gid >= gid_max) return;
526 ipad[0] = tmps[gid].ipad[0];
527 ipad[1] = tmps[gid].ipad[1];
528 ipad[2] = tmps[gid].ipad[2];
529 ipad[3] = tmps[gid].ipad[3];
530 ipad[4] = tmps[gid].ipad[4];
531 ipad[5] = tmps[gid].ipad[5];
532 ipad[6] = tmps[gid].ipad[6];
533 ipad[7] = tmps[gid].ipad[7];
537 opad[0] = tmps[gid].opad[0];
538 opad[1] = tmps[gid].opad[1];
539 opad[2] = tmps[gid].opad[2];
540 opad[3] = tmps[gid].opad[3];
541 opad[4] = tmps[gid].opad[4];
542 opad[5] = tmps[gid].opad[5];
543 opad[6] = tmps[gid].opad[6];
544 opad[7] = tmps[gid].opad[7];
546 for (u32 i = 0; i < 8; i += 8)
550 dgst[0] = tmps[gid].dgst[i + 0];
551 dgst[1] = tmps[gid].dgst[i + 1];
552 dgst[2] = tmps[gid].dgst[i + 2];
553 dgst[3] = tmps[gid].dgst[i + 3];
554 dgst[4] = tmps[gid].dgst[i + 4];
555 dgst[5] = tmps[gid].dgst[i + 5];
556 dgst[6] = tmps[gid].dgst[i + 6];
557 dgst[7] = tmps[gid].dgst[i + 7];
561 out[0] = tmps[gid].out[i + 0];
562 out[1] = tmps[gid].out[i + 1];
563 out[2] = tmps[gid].out[i + 2];
564 out[3] = tmps[gid].out[i + 3];
565 out[4] = tmps[gid].out[i + 4];
566 out[5] = tmps[gid].out[i + 5];
567 out[6] = tmps[gid].out[i + 6];
568 out[7] = tmps[gid].out[i + 7];
570 for (u32 j = 0; j < loop_cnt; j++)
592 w3[3] = (64 + 32) * 8;
594 hmac_sha256_run (w0, w1, w2, w3, ipad, opad, dgst);
606 tmps[gid].dgst[i + 0] = dgst[0];
607 tmps[gid].dgst[i + 1] = dgst[1];
608 tmps[gid].dgst[i + 2] = dgst[2];
609 tmps[gid].dgst[i + 3] = dgst[3];
610 tmps[gid].dgst[i + 4] = dgst[4];
611 tmps[gid].dgst[i + 5] = dgst[5];
612 tmps[gid].dgst[i + 6] = dgst[6];
613 tmps[gid].dgst[i + 7] = dgst[7];
615 tmps[gid].out[i + 0] = out[0];
616 tmps[gid].out[i + 1] = out[1];
617 tmps[gid].out[i + 2] = out[2];
618 tmps[gid].out[i + 3] = out[3];
619 tmps[gid].out[i + 4] = out[4];
620 tmps[gid].out[i + 5] = out[5];
621 tmps[gid].out[i + 6] = out[6];
622 tmps[gid].out[i + 7] = out[7];
626 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m12800_comp (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global pbkdf2_sha256_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 pbkdf2_sha256_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)
632 const u32 gid = get_global_id (0);
634 if (gid >= gid_max) return;
636 const u32 lid = get_local_id (0);
638 const u32 r0 = tmps[gid].out[DGST_R0];
639 const u32 r1 = tmps[gid].out[DGST_R1];
640 const u32 r2 = tmps[gid].out[DGST_R2];
641 const u32 r3 = tmps[gid].out[DGST_R3];