X-Git-Url: https://www.flypig.org.uk/git/?a=blobdiff_plain;f=OpenCL%2Fm08200.cl;h=f1339fa8be1e76663b64ec92a125bd3a7e189b42;hb=161a6eb4bc643d8e636e96eda613f5137d30da59;hp=5077e0398eadd1f0ab4c7b5d2e49453acc63ea36;hpb=dad03e394d815bc45b3f2c571f7195aab8746156;p=hashcat.git diff --git a/OpenCL/m08200.cl b/OpenCL/m08200.cl index 5077e03..f1339fa 100644 --- a/OpenCL/m08200.cl +++ b/OpenCL/m08200.cl @@ -5,20 +5,14 @@ #define _CLOUDKEY_ -#include "include/constants.h" -#include "include/kernel_vendor.h" +#include "inc_vendor.cl" +#include "inc_hash_constants.h" +#include "inc_hash_functions.cl" +#include "inc_types.cl" +#include "inc_common.cl" -#define DGST_R0 0 -#define DGST_R1 1 -#define DGST_R2 2 -#define DGST_R3 3 - -#include "include/kernel_functions.c" -#include "OpenCL/types_ocl.c" -#include "OpenCL/common.c" - -#define COMPARE_S "OpenCL/check_single_comp4.c" -#define COMPARE_M "OpenCL/check_multi_comp4.c" +#define COMPARE_S "inc_comp_single.cl" +#define COMPARE_M "inc_comp_multi.cl" __constant u32 k_sha256[64] = { @@ -64,7 +58,7 @@ __constant u64 k_sha512[80] = SHA512C4c, SHA512C4d, SHA512C4e, SHA512C4f, }; -static void sha256_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[8]) +void sha256_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[8]) { u32 a = digest[0]; u32 b = digest[1]; @@ -134,7 +128,9 @@ static void sha256_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], ROUND_STEP (0); + #ifdef _unroll #pragma unroll + #endif for (int i = 16; i < 64; i += 16) { ROUND_EXPAND (); ROUND_STEP (i); @@ -150,7 +146,7 @@ static void sha256_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], digest[7] += h; } -static void hmac_sha256_pad (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], u32 ipad[8], u32 opad[8]) +void hmac_sha256_pad (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], u32 ipad[8], u32 opad[8]) { w0[0] = w0[0] ^ 0x36363636; w0[1] = w0[1] ^ 0x36363636; @@ -209,7 +205,7 @@ static void hmac_sha256_pad (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], u32 ipa sha256_transform (w0, w1, w2, w3, opad); } -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]) +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]) { digest[0] = ipad[0]; digest[1] = ipad[1]; @@ -251,7 +247,7 @@ static void hmac_sha256_run (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], u32 ipa sha256_transform (w0, w1, w2, w3, digest); } -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]; @@ -321,7 +317,9 @@ static void sha512_transform (const u64 w[16], u64 dgst[8]) ROUND512_STEP (0); - //#pragma unroll + #ifdef _unroll + #pragma unroll + #endif for (int i = 16; i < 80; i += 16) { ROUND512_EXPAND (); ROUND512_STEP (i); @@ -337,7 +335,7 @@ static void sha512_transform (const u64 w[16], u64 dgst[8]) dgst[7] += h; } -static void hmac_sha512_run (const u64 w1[16], const u64 ipad[8], const u64 opad[8], u64 dgst[8]) +void hmac_sha512_run (const u64 w1[16], const u64 ipad[8], const u64 opad[8], u64 dgst[8]) { dgst[0] = ipad[0]; dgst[1] = ipad[1]; @@ -381,7 +379,60 @@ static void hmac_sha512_run (const u64 w1[16], const u64 ipad[8], const u64 opad sha512_transform (w, dgst); } -static void hmac_sha512_init (u64 w[16], u64 ipad[8], u64 opad[8]) +void hmac_sha512_run_x (const u64 ipad[8], const u64 opad[8], u64 dgst[8]) +{ + u64 w[16]; + + w[ 0] = dgst[0]; + w[ 1] = dgst[1]; + w[ 2] = dgst[2]; + w[ 3] = dgst[3]; + w[ 4] = dgst[4]; + w[ 5] = dgst[5]; + w[ 6] = dgst[6]; + w[ 7] = dgst[7]; + w[ 8] = 0x8000000000000000; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = (128 + 64) * 8; + + dgst[0] = ipad[0]; + dgst[1] = ipad[1]; + dgst[2] = ipad[2]; + dgst[3] = ipad[3]; + dgst[4] = ipad[4]; + dgst[5] = ipad[5]; + dgst[6] = ipad[6]; + dgst[7] = ipad[7]; + + sha512_transform (w, dgst); + + w[ 0] = dgst[0]; + w[ 1] = dgst[1]; + w[ 2] = dgst[2]; + w[ 3] = dgst[3]; + w[ 4] = dgst[4]; + w[ 5] = dgst[5]; + w[ 6] = dgst[6]; + w[ 7] = dgst[7]; + + dgst[0] = opad[0]; + dgst[1] = opad[1]; + dgst[2] = opad[2]; + dgst[3] = opad[3]; + dgst[4] = opad[4]; + dgst[5] = opad[5]; + dgst[6] = opad[6]; + dgst[7] = opad[7]; + + sha512_transform (w, dgst); +} + +void hmac_sha512_init (u64 w[16], u64 ipad[8], u64 opad[8]) { w[ 0] ^= 0x3636363636363636; w[ 1] ^= 0x3636363636363636; @@ -440,7 +491,7 @@ static void hmac_sha512_init (u64 w[16], u64 ipad[8], u64 opad[8]) sha512_transform (w, opad); } -__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) +__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) { /** * base @@ -585,7 +636,7 @@ __kernel void m08200_init (__global pw_t *pws, __global kernel_rule_t *rules_buf } } -__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) +__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) { const u32 gid = get_global_id (0); @@ -613,84 +664,42 @@ __kernel void m08200_loop (__global pw_t *pws, __global kernel_rule_t *rules_buf opad[6] = tmps[gid].opad[6]; opad[7] = tmps[gid].opad[7]; - for (u32 i = 0; i < 8; i += 8) - { - u64 dgst[8]; + u64 dgst[8]; - dgst[0] = tmps[gid].dgst[i + 0]; - dgst[1] = tmps[gid].dgst[i + 1]; - dgst[2] = tmps[gid].dgst[i + 2]; - dgst[3] = tmps[gid].dgst[i + 3]; - dgst[4] = tmps[gid].dgst[i + 4]; - dgst[5] = tmps[gid].dgst[i + 5]; - dgst[6] = tmps[gid].dgst[i + 6]; - dgst[7] = tmps[gid].dgst[i + 7]; - - u64 out[8]; - - out[0] = tmps[gid].out[i + 0]; - out[1] = tmps[gid].out[i + 1]; - out[2] = tmps[gid].out[i + 2]; - out[3] = tmps[gid].out[i + 3]; - out[4] = tmps[gid].out[i + 4]; - out[5] = tmps[gid].out[i + 5]; - out[6] = tmps[gid].out[i + 6]; - out[7] = tmps[gid].out[i + 7]; - - for (u32 j = 0; j < loop_cnt; j++) - { - u64 w[16]; - - w[ 0] = dgst[0]; - w[ 1] = dgst[1]; - w[ 2] = dgst[2]; - w[ 3] = dgst[3]; - w[ 4] = dgst[4]; - w[ 5] = dgst[5]; - w[ 6] = dgst[6]; - w[ 7] = dgst[7]; - w[ 8] = 0x8000000000000000; - w[ 9] = 0; - w[10] = 0; - w[11] = 0; - w[12] = 0; - w[13] = 0; - w[14] = 0; - w[15] = (128 + 64) * 8; - - hmac_sha512_run (w, ipad, opad, dgst); - - out[0] ^= dgst[0]; - out[1] ^= dgst[1]; - out[2] ^= dgst[2]; - out[3] ^= dgst[3]; - out[4] ^= dgst[4]; - out[5] ^= dgst[5]; - out[6] ^= dgst[6]; - out[7] ^= dgst[7]; - } + dgst[0] = tmps[gid].dgst[0]; + dgst[1] = tmps[gid].dgst[1]; + dgst[2] = tmps[gid].dgst[2]; + dgst[3] = tmps[gid].dgst[3]; + dgst[4] = tmps[gid].dgst[4]; + dgst[5] = tmps[gid].dgst[5]; + dgst[6] = tmps[gid].dgst[6]; + dgst[7] = tmps[gid].dgst[7]; - tmps[gid].dgst[i + 0] = dgst[0]; - tmps[gid].dgst[i + 1] = dgst[1]; - tmps[gid].dgst[i + 2] = dgst[2]; - tmps[gid].dgst[i + 3] = dgst[3]; - tmps[gid].dgst[i + 4] = dgst[4]; - tmps[gid].dgst[i + 5] = dgst[5]; - tmps[gid].dgst[i + 6] = dgst[6]; - tmps[gid].dgst[i + 7] = dgst[7]; - - tmps[gid].out[i + 0] = out[0]; - tmps[gid].out[i + 1] = out[1]; - tmps[gid].out[i + 2] = out[2]; - tmps[gid].out[i + 3] = out[3]; - tmps[gid].out[i + 4] = out[4]; - tmps[gid].out[i + 5] = out[5]; - tmps[gid].out[i + 6] = out[6]; - tmps[gid].out[i + 7] = out[7]; + for (u32 j = 0; j < loop_cnt; j++) + { + hmac_sha512_run_x (ipad, opad, dgst); + + tmps[gid].out[0] ^= dgst[0]; + tmps[gid].out[1] ^= dgst[1]; + tmps[gid].out[2] ^= dgst[2]; + tmps[gid].out[3] ^= dgst[3]; + tmps[gid].out[4] ^= dgst[4]; + tmps[gid].out[5] ^= dgst[5]; + tmps[gid].out[6] ^= dgst[6]; + tmps[gid].out[7] ^= dgst[7]; } + + tmps[gid].dgst[0] = dgst[0]; + tmps[gid].dgst[1] = dgst[1]; + tmps[gid].dgst[2] = dgst[2]; + tmps[gid].dgst[3] = dgst[3]; + tmps[gid].dgst[4] = dgst[4]; + tmps[gid].dgst[5] = dgst[5]; + tmps[gid].dgst[6] = dgst[6]; + tmps[gid].dgst[7] = dgst[7]; } -__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) +__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) { /** * base