#define DGST_R3 3
#include "include/kernel_functions.c"
-#include "types_ocl.c"
-#include "common.c"
+#include "OpenCL/types_ocl.c"
+#include "OpenCL/common.c"
-#include "gpu_aes256_amd.c"
-#include "gpu_twofish256_amd.c"
-#include "gpu_serpent256_amd.c"
+#include "OpenCL/kernel_aes256.c"
+#include "OpenCL/kernel_twofish256.c"
+#include "OpenCL/kernel_serpent256.c"
__constant u64 k_sha512[80] =
{
SHA512C4c, SHA512C4d, SHA512C4e, SHA512C4f,
};
-static void sha512_transform (const u64 w[16], u64 dgst[8])
+void sha512_transform (const u64 w[16], u64 dgst[8])
{
u64 a = dgst[0];
u64 b = dgst[1];
ROUND_STEP (0);
- //#pragma unroll
+ #ifdef IS_AMD
+ // #pragma unroll
+ // breaks compiler
+ #else
+ #pragma unroll
+ #endif
for (int i = 16; i < 80; i += 16)
{
ROUND_EXPAND (); ROUND_STEP (i);
dgst[7] += h;
}
-static void hmac_run (const u64 w1[16], const u64 ipad[8], const u64 opad[8], u64 dgst[8])
+void hmac_run (const u64 w1[16], const u64 ipad[8], const u64 opad[8], u64 dgst[8])
{
dgst[0] = ipad[0];
dgst[1] = ipad[1];
sha512_transform (w, dgst);
}
-static void hmac_init (u64 w[16], u64 ipad[8], u64 opad[8])
+void hmac_init (u64 w[16], u64 ipad[8], u64 opad[8])
{
w[ 0] ^= 0x3636363636363636;
w[ 1] ^= 0x3636363636363636;
sha512_transform (w, opad);
}
-static u32 u8add (const u32 a, const u32 b)
+u32 u8add (const u32 a, const u32 b)
{
const u32 a1 = (a >> 0) & 0xff;
const u32 a2 = (a >> 8) & 0xff;
return r;
}
-__kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m06222_init (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global tc64_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 tc_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)
+__kernel void m06222_init (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global tc64_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 tc_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)
{
/**
* base
// swap fehlt
- salt_buf[ 0] = ((u64) swap_workaround (esalt_bufs[salt_pos].salt_buf[ 0])) << 32 | (u64) swap_workaround (esalt_bufs[salt_pos].salt_buf[ 1]);
- salt_buf[ 1] = ((u64) swap_workaround (esalt_bufs[salt_pos].salt_buf[ 2])) << 32 | (u64) swap_workaround (esalt_bufs[salt_pos].salt_buf[ 3]);
- salt_buf[ 2] = ((u64) swap_workaround (esalt_bufs[salt_pos].salt_buf[ 4])) << 32 | (u64) swap_workaround (esalt_bufs[salt_pos].salt_buf[ 5]);
- salt_buf[ 3] = ((u64) swap_workaround (esalt_bufs[salt_pos].salt_buf[ 6])) << 32 | (u64) swap_workaround (esalt_bufs[salt_pos].salt_buf[ 7]);
- salt_buf[ 4] = ((u64) swap_workaround (esalt_bufs[salt_pos].salt_buf[ 8])) << 32 | (u64) swap_workaround (esalt_bufs[salt_pos].salt_buf[ 9]);
- salt_buf[ 5] = ((u64) swap_workaround (esalt_bufs[salt_pos].salt_buf[10])) << 32 | (u64) swap_workaround (esalt_bufs[salt_pos].salt_buf[11]);
- salt_buf[ 6] = ((u64) swap_workaround (esalt_bufs[salt_pos].salt_buf[12])) << 32 | (u64) swap_workaround (esalt_bufs[salt_pos].salt_buf[13]);
- salt_buf[ 7] = ((u64) swap_workaround (esalt_bufs[salt_pos].salt_buf[14])) << 32 | (u64) swap_workaround (esalt_bufs[salt_pos].salt_buf[15]);
+ salt_buf[ 0] = ((u64) swap32 (esalt_bufs[salt_pos].salt_buf[ 0])) << 32 | (u64) swap32 (esalt_bufs[salt_pos].salt_buf[ 1]);
+ salt_buf[ 1] = ((u64) swap32 (esalt_bufs[salt_pos].salt_buf[ 2])) << 32 | (u64) swap32 (esalt_bufs[salt_pos].salt_buf[ 3]);
+ salt_buf[ 2] = ((u64) swap32 (esalt_bufs[salt_pos].salt_buf[ 4])) << 32 | (u64) swap32 (esalt_bufs[salt_pos].salt_buf[ 5]);
+ salt_buf[ 3] = ((u64) swap32 (esalt_bufs[salt_pos].salt_buf[ 6])) << 32 | (u64) swap32 (esalt_bufs[salt_pos].salt_buf[ 7]);
+ salt_buf[ 4] = ((u64) swap32 (esalt_bufs[salt_pos].salt_buf[ 8])) << 32 | (u64) swap32 (esalt_bufs[salt_pos].salt_buf[ 9]);
+ salt_buf[ 5] = ((u64) swap32 (esalt_bufs[salt_pos].salt_buf[10])) << 32 | (u64) swap32 (esalt_bufs[salt_pos].salt_buf[11]);
+ salt_buf[ 6] = ((u64) swap32 (esalt_bufs[salt_pos].salt_buf[12])) << 32 | (u64) swap32 (esalt_bufs[salt_pos].salt_buf[13]);
+ salt_buf[ 7] = ((u64) swap32 (esalt_bufs[salt_pos].salt_buf[14])) << 32 | (u64) swap32 (esalt_bufs[salt_pos].salt_buf[15]);
salt_buf[ 8] = 0;
salt_buf[ 9] = 0;
salt_buf[10] = 0;
u64 w[16];
- w[ 0] = ((u64) swap_workaround (w0[0])) << 32 | (u64) swap_workaround (w0[1]);
- w[ 1] = ((u64) swap_workaround (w0[2])) << 32 | (u64) swap_workaround (w0[3]);
- w[ 2] = ((u64) swap_workaround (w1[0])) << 32 | (u64) swap_workaround (w1[1]);
- w[ 3] = ((u64) swap_workaround (w1[2])) << 32 | (u64) swap_workaround (w1[3]);
- w[ 4] = ((u64) swap_workaround (w2[0])) << 32 | (u64) swap_workaround (w2[1]);
- w[ 5] = ((u64) swap_workaround (w2[2])) << 32 | (u64) swap_workaround (w2[3]);
- w[ 6] = ((u64) swap_workaround (w3[0])) << 32 | (u64) swap_workaround (w3[1]);
- w[ 7] = ((u64) swap_workaround (w3[2])) << 32 | (u64) swap_workaround (w3[3]);
+ w[ 0] = ((u64) swap32 (w0[0])) << 32 | (u64) swap32 (w0[1]);
+ w[ 1] = ((u64) swap32 (w0[2])) << 32 | (u64) swap32 (w0[3]);
+ w[ 2] = ((u64) swap32 (w1[0])) << 32 | (u64) swap32 (w1[1]);
+ w[ 3] = ((u64) swap32 (w1[2])) << 32 | (u64) swap32 (w1[3]);
+ w[ 4] = ((u64) swap32 (w2[0])) << 32 | (u64) swap32 (w2[1]);
+ w[ 5] = ((u64) swap32 (w2[2])) << 32 | (u64) swap32 (w2[3]);
+ w[ 6] = ((u64) swap32 (w3[0])) << 32 | (u64) swap32 (w3[1]);
+ w[ 7] = ((u64) swap32 (w3[2])) << 32 | (u64) swap32 (w3[3]);
w[ 8] = 0;
w[ 9] = 0;
w[10] = 0;
}
}
-__kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m06222_loop (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global tc64_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 tc_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)
+__kernel void m06222_loop (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global tc64_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 tc_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)
{
const u32 truecrypt_mdlen = salt_bufs[0].truecrypt_mdlen;
}
}
-__kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m06222_comp (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global tc64_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 tc_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)
+__kernel void m06222_comp (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global tc64_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 tc_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)
{
/**
* base
u32 ukey1[8];
- ukey1[0] = swap_workaround (h32_from_64 (tmps[gid].out[ 0]));
- ukey1[1] = swap_workaround (l32_from_64 (tmps[gid].out[ 0]));
- ukey1[2] = swap_workaround (h32_from_64 (tmps[gid].out[ 1]));
- ukey1[3] = swap_workaround (l32_from_64 (tmps[gid].out[ 1]));
- ukey1[4] = swap_workaround (h32_from_64 (tmps[gid].out[ 2]));
- ukey1[5] = swap_workaround (l32_from_64 (tmps[gid].out[ 2]));
- ukey1[6] = swap_workaround (h32_from_64 (tmps[gid].out[ 3]));
- ukey1[7] = swap_workaround (l32_from_64 (tmps[gid].out[ 3]));
+ ukey1[0] = swap32 (h32_from_64 (tmps[gid].out[ 0]));
+ ukey1[1] = swap32 (l32_from_64 (tmps[gid].out[ 0]));
+ ukey1[2] = swap32 (h32_from_64 (tmps[gid].out[ 1]));
+ ukey1[3] = swap32 (l32_from_64 (tmps[gid].out[ 1]));
+ ukey1[4] = swap32 (h32_from_64 (tmps[gid].out[ 2]));
+ ukey1[5] = swap32 (l32_from_64 (tmps[gid].out[ 2]));
+ ukey1[6] = swap32 (h32_from_64 (tmps[gid].out[ 3]));
+ ukey1[7] = swap32 (l32_from_64 (tmps[gid].out[ 3]));
u32 ukey2[8];
- ukey2[0] = swap_workaround (h32_from_64 (tmps[gid].out[ 4]));
- ukey2[1] = swap_workaround (l32_from_64 (tmps[gid].out[ 4]));
- ukey2[2] = swap_workaround (h32_from_64 (tmps[gid].out[ 5]));
- ukey2[3] = swap_workaround (l32_from_64 (tmps[gid].out[ 5]));
- ukey2[4] = swap_workaround (h32_from_64 (tmps[gid].out[ 6]));
- ukey2[5] = swap_workaround (l32_from_64 (tmps[gid].out[ 6]));
- ukey2[6] = swap_workaround (h32_from_64 (tmps[gid].out[ 7]));
- ukey2[7] = swap_workaround (l32_from_64 (tmps[gid].out[ 7]));
+ ukey2[0] = swap32 (h32_from_64 (tmps[gid].out[ 4]));
+ ukey2[1] = swap32 (l32_from_64 (tmps[gid].out[ 4]));
+ ukey2[2] = swap32 (h32_from_64 (tmps[gid].out[ 5]));
+ ukey2[3] = swap32 (l32_from_64 (tmps[gid].out[ 5]));
+ ukey2[4] = swap32 (h32_from_64 (tmps[gid].out[ 6]));
+ ukey2[5] = swap32 (l32_from_64 (tmps[gid].out[ 6]));
+ ukey2[6] = swap32 (h32_from_64 (tmps[gid].out[ 7]));
+ ukey2[7] = swap32 (l32_from_64 (tmps[gid].out[ 7]));
u32 data[4];
u32 ukey3[8];
- ukey3[0] = swap_workaround (h32_from_64 (tmps[gid].out[ 8]));
- ukey3[1] = swap_workaround (l32_from_64 (tmps[gid].out[ 8]));
- ukey3[2] = swap_workaround (h32_from_64 (tmps[gid].out[ 9]));
- ukey3[3] = swap_workaround (l32_from_64 (tmps[gid].out[ 9]));
- ukey3[4] = swap_workaround (h32_from_64 (tmps[gid].out[10]));
- ukey3[5] = swap_workaround (l32_from_64 (tmps[gid].out[10]));
- ukey3[6] = swap_workaround (h32_from_64 (tmps[gid].out[11]));
- ukey3[7] = swap_workaround (l32_from_64 (tmps[gid].out[11]));
+ ukey3[0] = swap32 (h32_from_64 (tmps[gid].out[ 8]));
+ ukey3[1] = swap32 (l32_from_64 (tmps[gid].out[ 8]));
+ ukey3[2] = swap32 (h32_from_64 (tmps[gid].out[ 9]));
+ ukey3[3] = swap32 (l32_from_64 (tmps[gid].out[ 9]));
+ ukey3[4] = swap32 (h32_from_64 (tmps[gid].out[10]));
+ ukey3[5] = swap32 (l32_from_64 (tmps[gid].out[10]));
+ ukey3[6] = swap32 (h32_from_64 (tmps[gid].out[11]));
+ ukey3[7] = swap32 (l32_from_64 (tmps[gid].out[11]));
u32 ukey4[8];
- ukey4[0] = swap_workaround (h32_from_64 (tmps[gid].out[12]));
- ukey4[1] = swap_workaround (l32_from_64 (tmps[gid].out[12]));
- ukey4[2] = swap_workaround (h32_from_64 (tmps[gid].out[13]));
- ukey4[3] = swap_workaround (l32_from_64 (tmps[gid].out[13]));
- ukey4[4] = swap_workaround (h32_from_64 (tmps[gid].out[14]));
- ukey4[5] = swap_workaround (l32_from_64 (tmps[gid].out[14]));
- ukey4[6] = swap_workaround (h32_from_64 (tmps[gid].out[15]));
- ukey4[7] = swap_workaround (l32_from_64 (tmps[gid].out[15]));
+ ukey4[0] = swap32 (h32_from_64 (tmps[gid].out[12]));
+ ukey4[1] = swap32 (l32_from_64 (tmps[gid].out[12]));
+ ukey4[2] = swap32 (h32_from_64 (tmps[gid].out[13]));
+ ukey4[3] = swap32 (l32_from_64 (tmps[gid].out[13]));
+ ukey4[4] = swap32 (h32_from_64 (tmps[gid].out[14]));
+ ukey4[5] = swap32 (l32_from_64 (tmps[gid].out[14]));
+ ukey4[6] = swap32 (h32_from_64 (tmps[gid].out[15]));
+ ukey4[7] = swap32 (l32_from_64 (tmps[gid].out[15]));
{
tmp[0] = data[0];