diff --git a/OpenCL/inc_common.cl b/OpenCL/inc_common.cl index 1da292b15..bb03282fa 100644 --- a/OpenCL/inc_common.cl +++ b/OpenCL/inc_common.cl @@ -160,8 +160,8 @@ DECLSPEC u32 check (const u32 *digest, __global const u32 *bitmap_s1_a, __global return (1); } -DECLSPEC void mark_hash (__global plain_t *plains_buf, __global u32 *d_result, const u32 salt_pos, const u32 digests_cnt, const u32 digest_pos, const u32 hash_pos, const u64 gid, const u32 il_pos); -DECLSPEC void mark_hash (__global plain_t *plains_buf, __global u32 *d_result, const u32 salt_pos, const u32 digests_cnt, const u32 digest_pos, const u32 hash_pos, const u64 gid, const u32 il_pos) +DECLSPEC void mark_hash (__global plain_t *plains_buf, __global u32 *d_result, const u32 salt_pos, const u32 digests_cnt, const u32 digest_pos, const u32 hash_pos, const u64 gid, const u32 il_pos, const u32 extra1, const u32 extra2); +DECLSPEC void mark_hash (__global plain_t *plains_buf, __global u32 *d_result, const u32 salt_pos, const u32 digests_cnt, const u32 digest_pos, const u32 hash_pos, const u64 gid, const u32 il_pos, const u32 extra1, const u32 extra2) { const u32 idx = atomic_inc (d_result); @@ -175,11 +175,13 @@ DECLSPEC void mark_hash (__global plain_t *plains_buf, __global u32 *d_result, c return; } - plains_buf[idx].salt_pos = salt_pos; - plains_buf[idx].digest_pos = digest_pos; // relative - plains_buf[idx].hash_pos = hash_pos; // absolute - plains_buf[idx].gidvid = gid; - plains_buf[idx].il_pos = il_pos; + plains_buf[idx].salt_pos = salt_pos; + plains_buf[idx].digest_pos = digest_pos; // relative + plains_buf[idx].hash_pos = hash_pos; // absolute + plains_buf[idx].gidvid = gid; + plains_buf[idx].il_pos = il_pos; + plains_buf[idx].extra1 = extra1; // for example, used as veracrypt pim storage + plains_buf[idx].extra2 = extra2; // unused so far } DECLSPEC int count_char (const u32 *buf, const int elems, const u32 c); diff --git a/OpenCL/inc_comp_multi.cl b/OpenCL/inc_comp_multi.cl index b10bfce00..5e6011237 100644 --- a/OpenCL/inc_comp_multi.cl +++ b/OpenCL/inc_comp_multi.cl @@ -26,7 +26,7 @@ if (check (digest_tp, if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/inc_comp_multi_bs.cl b/OpenCL/inc_comp_multi_bs.cl index 8534a0467..82a8c1e02 100644 --- a/OpenCL/inc_comp_multi_bs.cl +++ b/OpenCL/inc_comp_multi_bs.cl @@ -28,7 +28,7 @@ if (check (digest_tp, if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + slice); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + slice, 0, 0); } } } diff --git a/OpenCL/inc_comp_single.cl b/OpenCL/inc_comp_single.cl index 7895d50cc..2f931579e 100644 --- a/OpenCL/inc_comp_single.cl +++ b/OpenCL/inc_comp_single.cl @@ -7,6 +7,6 @@ if ((r0 == search[0]) if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos, 0, 0); } } diff --git a/OpenCL/inc_comp_single_bs.cl b/OpenCL/inc_comp_single_bs.cl index 02ff059eb..5fc4a84b4 100644 --- a/OpenCL/inc_comp_single_bs.cl +++ b/OpenCL/inc_comp_single_bs.cl @@ -5,6 +5,6 @@ if ((il_pos + slice) < il_cnt) if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + slice); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + slice, 0, 0); } } diff --git a/OpenCL/inc_hash_whirlpool.cl b/OpenCL/inc_hash_whirlpool.cl index 51cdbaefe..dd63df9f3 100644 --- a/OpenCL/inc_hash_whirlpool.cl +++ b/OpenCL/inc_hash_whirlpool.cl @@ -1125,13 +1125,13 @@ typedef struct whirlpool_ctx int len; - __local u32 (*s_Ch)[256]; - __local u32 (*s_Cl)[256]; + SHM_TYPE u32 (*s_Ch)[256]; + SHM_TYPE u32 (*s_Cl)[256]; } whirlpool_ctx_t; -DECLSPEC void whirlpool_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]); -DECLSPEC void whirlpool_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) +DECLSPEC void whirlpool_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]); +DECLSPEC void whirlpool_transform (const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, u32 *digest, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]) { u32 Kh[8]; u32 Kl[8]; @@ -1301,8 +1301,8 @@ DECLSPEC void whirlpool_transform (const u32 *w0, const u32 *w1, const u32 *w2, digest[15] ^= statel[7] ^ w3[3]; } -DECLSPEC void whirlpool_init (whirlpool_ctx_t *ctx, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]); -DECLSPEC void whirlpool_init (whirlpool_ctx_t *ctx, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) +DECLSPEC void whirlpool_init (whirlpool_ctx_t *ctx, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]); +DECLSPEC void whirlpool_init (whirlpool_ctx_t *ctx, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]) { ctx->h[ 0] = 0; ctx->h[ 1] = 0; @@ -1983,8 +1983,8 @@ typedef struct whirlpool_hmac_ctx } whirlpool_hmac_ctx_t; -DECLSPEC void whirlpool_hmac_init_64 (whirlpool_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]); -DECLSPEC void whirlpool_hmac_init_64 (whirlpool_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) +DECLSPEC void whirlpool_hmac_init_64 (whirlpool_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]); +DECLSPEC void whirlpool_hmac_init_64 (whirlpool_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]) { u32 t0[4]; u32 t1[4]; @@ -2038,8 +2038,8 @@ DECLSPEC void whirlpool_hmac_init_64 (whirlpool_hmac_ctx_t *ctx, const u32 *w0, whirlpool_update_64 (&ctx->opad, t0, t1, t2, t3, 64); } -DECLSPEC void whirlpool_hmac_init (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]); -DECLSPEC void whirlpool_hmac_init (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) +DECLSPEC void whirlpool_hmac_init (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]); +DECLSPEC void whirlpool_hmac_init (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]) { u32 w0[4]; u32 w1[4]; @@ -2096,8 +2096,8 @@ DECLSPEC void whirlpool_hmac_init (whirlpool_hmac_ctx_t *ctx, const u32 *w, cons whirlpool_hmac_init_64 (ctx, w0, w1, w2, w3, s_Ch, s_Cl); } -DECLSPEC void whirlpool_hmac_init_swap (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]); -DECLSPEC void whirlpool_hmac_init_swap (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) +DECLSPEC void whirlpool_hmac_init_swap (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]); +DECLSPEC void whirlpool_hmac_init_swap (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]) { u32 w0[4]; u32 w1[4]; @@ -2154,8 +2154,8 @@ DECLSPEC void whirlpool_hmac_init_swap (whirlpool_hmac_ctx_t *ctx, const u32 *w, whirlpool_hmac_init_64 (ctx, w0, w1, w2, w3, s_Ch, s_Cl); } -DECLSPEC void whirlpool_hmac_init_global (whirlpool_hmac_ctx_t *ctx, __global const u32 *w, const int len, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]); -DECLSPEC void whirlpool_hmac_init_global (whirlpool_hmac_ctx_t *ctx, __global const u32 *w, const int len, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) +DECLSPEC void whirlpool_hmac_init_global (whirlpool_hmac_ctx_t *ctx, __global const u32 *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]); +DECLSPEC void whirlpool_hmac_init_global (whirlpool_hmac_ctx_t *ctx, __global const u32 *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]) { u32 w0[4]; u32 w1[4]; @@ -2212,8 +2212,8 @@ DECLSPEC void whirlpool_hmac_init_global (whirlpool_hmac_ctx_t *ctx, __global co whirlpool_hmac_init_64 (ctx, w0, w1, w2, w3, s_Ch, s_Cl); } -DECLSPEC void whirlpool_hmac_init_global_swap (whirlpool_hmac_ctx_t *ctx, __global const u32 *w, const int len, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]); -DECLSPEC void whirlpool_hmac_init_global_swap (whirlpool_hmac_ctx_t *ctx, __global const u32 *w, const int len, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) +DECLSPEC void whirlpool_hmac_init_global_swap (whirlpool_hmac_ctx_t *ctx, __global const u32 *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]); +DECLSPEC void whirlpool_hmac_init_global_swap (whirlpool_hmac_ctx_t *ctx, __global const u32 *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]) { u32 w0[4]; u32 w1[4]; @@ -2369,13 +2369,13 @@ typedef struct whirlpool_ctx_vector int len; - __local u32 (*s_Ch)[256]; - __local u32 (*s_Cl)[256]; + SHM_TYPE u32 (*s_Ch)[256]; + SHM_TYPE u32 (*s_Cl)[256]; } whirlpool_ctx_vector_t; -DECLSPEC void whirlpool_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]); -DECLSPEC void whirlpool_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) +DECLSPEC void whirlpool_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]); +DECLSPEC void whirlpool_transform_vector (const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, u32x *digest, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]) { u32x Kh[8]; u32x Kl[8]; @@ -2545,8 +2545,8 @@ DECLSPEC void whirlpool_transform_vector (const u32x *w0, const u32x *w1, const digest[15] ^= statel[7] ^ w3[3]; } -DECLSPEC void whirlpool_init_vector (whirlpool_ctx_vector_t *ctx, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]); -DECLSPEC void whirlpool_init_vector (whirlpool_ctx_vector_t *ctx, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) +DECLSPEC void whirlpool_init_vector (whirlpool_ctx_vector_t *ctx, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]); +DECLSPEC void whirlpool_init_vector (whirlpool_ctx_vector_t *ctx, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]) { ctx->h[ 0] = 0; ctx->h[ 1] = 0; @@ -3010,8 +3010,8 @@ typedef struct whirlpool_hmac_ctx_vector } whirlpool_hmac_ctx_vector_t; -DECLSPEC void whirlpool_hmac_init_vector_64 (whirlpool_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]); -DECLSPEC void whirlpool_hmac_init_vector_64 (whirlpool_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) +DECLSPEC void whirlpool_hmac_init_vector_64 (whirlpool_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]); +DECLSPEC void whirlpool_hmac_init_vector_64 (whirlpool_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]) { u32x t0[4]; u32x t1[4]; @@ -3065,8 +3065,8 @@ DECLSPEC void whirlpool_hmac_init_vector_64 (whirlpool_hmac_ctx_vector_t *ctx, c whirlpool_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64); } -DECLSPEC void whirlpool_hmac_init_vector (whirlpool_hmac_ctx_vector_t *ctx, const u32x *w, const int len, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]); -DECLSPEC void whirlpool_hmac_init_vector (whirlpool_hmac_ctx_vector_t *ctx, const u32x *w, const int len, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) +DECLSPEC void whirlpool_hmac_init_vector (whirlpool_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]); +DECLSPEC void whirlpool_hmac_init_vector (whirlpool_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]) { u32x w0[4]; u32x w1[4]; diff --git a/OpenCL/inc_scalar.cl b/OpenCL/inc_scalar.cl index bc29b2322..49983b10a 100644 --- a/OpenCL/inc_scalar.cl +++ b/OpenCL/inc_scalar.cl @@ -11,7 +11,7 @@ \ if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos, 0, 0); \ } \ } \ } @@ -35,7 +35,7 @@ \ if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos, 0, 0); \ } \ } \ } \ diff --git a/OpenCL/inc_simd.cl b/OpenCL/inc_simd.cl index 451dd5379..bcd1434d7 100644 --- a/OpenCL/inc_simd.cl +++ b/OpenCL/inc_simd.cl @@ -18,7 +18,7 @@ \ if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos, 0, 0); \ } \ } \ } @@ -42,7 +42,7 @@ \ if (atomic_inc (&hashes_shown[final_hash_pos]) == 0) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos, 0, 0); \ } \ } \ } \ @@ -67,7 +67,7 @@ \ if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 0); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 0, 0, 0); \ } \ } \ \ @@ -77,7 +77,7 @@ \ if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 1); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 1, 0, 0); \ } \ } \ } @@ -102,7 +102,7 @@ \ if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0, 0, 0); \ } \ } \ } \ @@ -122,7 +122,7 @@ \ if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1, 0, 0); \ } \ } \ } \ @@ -145,7 +145,7 @@ \ if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 0); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 0, 0, 0); \ } \ } \ \ @@ -155,7 +155,7 @@ \ if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 1); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 1, 0, 0); \ } \ } \ \ @@ -165,7 +165,7 @@ \ if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 2); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 2, 0, 0); \ } \ } \ \ @@ -175,7 +175,7 @@ \ if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 3); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 3, 0, 0); \ } \ } \ } @@ -202,7 +202,7 @@ \ if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0, 0, 0); \ } \ } \ } \ @@ -222,7 +222,7 @@ \ if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1, 0, 0); \ } \ } \ } \ @@ -242,7 +242,7 @@ \ if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 2); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 2, 0, 0); \ } \ } \ } \ @@ -262,7 +262,7 @@ \ if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 3); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 3, 0, 0); \ } \ } \ } \ @@ -285,7 +285,7 @@ \ if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 0); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 0, 0, 0); \ } \ } \ \ @@ -295,7 +295,7 @@ \ if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 1); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 1, 0, 0); \ } \ } \ \ @@ -305,7 +305,7 @@ \ if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 2); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 2, 0, 0); \ } \ } \ \ @@ -315,7 +315,7 @@ \ if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 3); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 3, 0, 0); \ } \ } \ if (((h0).s4 == search[0]) && ((h1).s4 == search[1]) && ((h2).s4 == search[2]) && ((h3).s4 == search[3])) \ @@ -324,7 +324,7 @@ \ if (vector_accessible (il_pos, il_cnt, 4) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 4); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 4, 0, 0); \ } \ } \ \ @@ -334,7 +334,7 @@ \ if (vector_accessible (il_pos, il_cnt, 5) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 5); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 5, 0, 0); \ } \ } \ \ @@ -344,7 +344,7 @@ \ if (vector_accessible (il_pos, il_cnt, 6) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 6); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 6, 0, 0); \ } \ } \ \ @@ -354,7 +354,7 @@ \ if (vector_accessible (il_pos, il_cnt, 7) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 7); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 7, 0, 0); \ } \ } \ } @@ -385,7 +385,7 @@ \ if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0, 0, 0); \ } \ } \ } \ @@ -405,7 +405,7 @@ \ if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1, 0, 0); \ } \ } \ } \ @@ -425,7 +425,7 @@ \ if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 2); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 2, 0, 0); \ } \ } \ } \ @@ -445,7 +445,7 @@ \ if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 3); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 3, 0, 0); \ } \ } \ } \ @@ -464,7 +464,7 @@ \ if (vector_accessible (il_pos, il_cnt, 4) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 4); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 4, 0, 0); \ } \ } \ } \ @@ -484,7 +484,7 @@ \ if (vector_accessible (il_pos, il_cnt, 5) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 5); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 5, 0, 0); \ } \ } \ } \ @@ -504,7 +504,7 @@ \ if (vector_accessible (il_pos, il_cnt, 6) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 6); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 6, 0, 0); \ } \ } \ } \ @@ -524,7 +524,7 @@ \ if (vector_accessible (il_pos, il_cnt, 7) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 7); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 7, 0, 0); \ } \ } \ } \ @@ -547,7 +547,7 @@ \ if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 0); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 0, 0, 0); \ } \ } \ \ @@ -557,7 +557,7 @@ \ if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 1); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 1, 0, 0); \ } \ } \ \ @@ -567,7 +567,7 @@ \ if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 2); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 2, 0, 0); \ } \ } \ \ @@ -577,7 +577,7 @@ \ if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 3); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 3, 0, 0); \ } \ } \ if (((h0).s4 == search[0]) && ((h1).s4 == search[1]) && ((h2).s4 == search[2]) && ((h3).s4 == search[3])) \ @@ -586,7 +586,7 @@ \ if (vector_accessible (il_pos, il_cnt, 4) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 4); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 4, 0, 0); \ } \ } \ \ @@ -596,7 +596,7 @@ \ if (vector_accessible (il_pos, il_cnt, 5) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 5); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 5, 0, 0); \ } \ } \ \ @@ -606,7 +606,7 @@ \ if (vector_accessible (il_pos, il_cnt, 6) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 6); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 6, 0, 0); \ } \ } \ \ @@ -616,7 +616,7 @@ \ if (vector_accessible (il_pos, il_cnt, 7) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 7); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 7, 0, 0); \ } \ } \ \ @@ -626,7 +626,7 @@ \ if (vector_accessible (il_pos, il_cnt, 8) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 8); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 8, 0, 0); \ } \ } \ \ @@ -636,7 +636,7 @@ \ if (vector_accessible (il_pos, il_cnt, 9) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 9); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 9, 0, 0); \ } \ } \ \ @@ -646,7 +646,7 @@ \ if (vector_accessible (il_pos, il_cnt, 10) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 10); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 10, 0, 0); \ } \ } \ \ @@ -656,7 +656,7 @@ \ if (vector_accessible (il_pos, il_cnt, 11) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 11); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 11, 0, 0); \ } \ } \ \ @@ -666,7 +666,7 @@ \ if (vector_accessible (il_pos, il_cnt, 12) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 12); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 12, 0, 0); \ } \ } \ \ @@ -676,7 +676,7 @@ \ if (vector_accessible (il_pos, il_cnt, 13) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 13); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 13, 0, 0); \ } \ } \ \ @@ -686,7 +686,7 @@ \ if (vector_accessible (il_pos, il_cnt, 14) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 14); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 14, 0, 0); \ } \ } \ \ @@ -696,7 +696,7 @@ \ if (vector_accessible (il_pos, il_cnt, 15) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 15); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, final_hash_pos, gid, il_pos + 15, 0, 0); \ } \ } \ } @@ -735,7 +735,7 @@ \ if (vector_accessible (il_pos, il_cnt, 0) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 0, 0, 0); \ } \ } \ } \ @@ -755,7 +755,7 @@ \ if (vector_accessible (il_pos, il_cnt, 1) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 1, 0, 0); \ } \ } \ } \ @@ -775,7 +775,7 @@ \ if (vector_accessible (il_pos, il_cnt, 2) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 2); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 2, 0, 0); \ } \ } \ } \ @@ -795,7 +795,7 @@ \ if (vector_accessible (il_pos, il_cnt, 3) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 3); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 3, 0, 0); \ } \ } \ } \ @@ -815,7 +815,7 @@ \ if (vector_accessible (il_pos, il_cnt, 4) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 4); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 4, 0, 0); \ } \ } \ } \ @@ -835,7 +835,7 @@ \ if (vector_accessible (il_pos, il_cnt, 5) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 5); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 5, 0, 0); \ } \ } \ } \ @@ -855,7 +855,7 @@ \ if (vector_accessible (il_pos, il_cnt, 6) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 6); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 6, 0, 0); \ } \ } \ } \ @@ -875,7 +875,7 @@ \ if (vector_accessible (il_pos, il_cnt, 7) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 7); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 7, 0, 0); \ } \ } \ } \ @@ -895,7 +895,7 @@ \ if (vector_accessible (il_pos, il_cnt, 8) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 8); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 8, 0, 0); \ } \ } \ } \ @@ -915,7 +915,7 @@ \ if (vector_accessible (il_pos, il_cnt, 9) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 9); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 9, 0, 0); \ } \ } \ } \ @@ -935,7 +935,7 @@ \ if (vector_accessible (il_pos, il_cnt, 10) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 10); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 10, 0, 0); \ } \ } \ } \ @@ -955,7 +955,7 @@ \ if (vector_accessible (il_pos, il_cnt, 11) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 11); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 11, 0, 0); \ } \ } \ } \ @@ -975,7 +975,7 @@ \ if (vector_accessible (il_pos, il_cnt, 12) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 12); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 12, 0, 0); \ } \ } \ } \ @@ -995,7 +995,7 @@ \ if (vector_accessible (il_pos, il_cnt, 13) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 13); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 13, 0, 0); \ } \ } \ } \ @@ -1015,7 +1015,7 @@ \ if (vector_accessible (il_pos, il_cnt, 14) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 14); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 14, 0, 0); \ } \ } \ } \ @@ -1035,7 +1035,7 @@ \ if (vector_accessible (il_pos, il_cnt, 15) && (atomic_inc (&hashes_shown[final_hash_pos]) == 0)) \ { \ - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 15); \ + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, final_hash_pos, gid, il_pos + 15, 0, 0); \ } \ } \ } \ diff --git a/OpenCL/inc_truecrypt_xts.cl b/OpenCL/inc_truecrypt_xts.cl index d3b1b99bd..a0b08cb30 100644 --- a/OpenCL/inc_truecrypt_xts.cl +++ b/OpenCL/inc_truecrypt_xts.cl @@ -157,8 +157,8 @@ DECLSPEC void twofish256_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32 // 512 bit -DECLSPEC int verify_header_aes (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4); -DECLSPEC int verify_header_aes (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +DECLSPEC int verify_header_aes (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4); +DECLSPEC int verify_header_aes (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) { u32 ks_aes[60]; @@ -168,17 +168,15 @@ DECLSPEC int verify_header_aes (__global const tc_t *esalt_bufs, const u32 *ukey u32 data[4]; - data[0] = esalt_bufs[0].data_buf[0]; - data[1] = esalt_bufs[0].data_buf[1]; - data[2] = esalt_bufs[0].data_buf[2]; - data[3] = esalt_bufs[0].data_buf[3]; + data[0] = data_buf[0]; + data[1] = data_buf[1]; + data[2] = data_buf[2]; + data[3] = data_buf[3]; u32 tmp[4]; aes256_decrypt_xts_first (ukey1, ukey2, data, tmp, S, T_aes, ks_aes, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); - const u32 signature = esalt_bufs[0].signature; - if (tmp[0] != signature) return 0; const u32 crc32_save = swap32_S (~tmp[2]); @@ -196,10 +194,10 @@ DECLSPEC int verify_header_aes (__global const tc_t *esalt_bufs, const u32 *ukey for (int i = 64 - 16; i < 128 - 16; i += 4) { - data[0] = esalt_bufs[0].data_buf[i + 0]; - data[1] = esalt_bufs[0].data_buf[i + 1]; - data[2] = esalt_bufs[0].data_buf[i + 2]; - data[3] = esalt_bufs[0].data_buf[i + 3]; + data[0] = data_buf[i + 0]; + data[1] = data_buf[i + 1]; + data[2] = data_buf[i + 2]; + data[3] = data_buf[i + 3]; aes256_decrypt_xts_next (data, tmp, T_aes, ks_aes, s_td0, s_td1, s_td2, s_td3, s_td4); @@ -214,8 +212,8 @@ DECLSPEC int verify_header_aes (__global const tc_t *esalt_bufs, const u32 *ukey return 1; } -DECLSPEC int verify_header_serpent (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2); -DECLSPEC int verify_header_serpent (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2) +DECLSPEC int verify_header_serpent (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2); +DECLSPEC int verify_header_serpent (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2) { u32 ks_serpent[140]; @@ -225,17 +223,15 @@ DECLSPEC int verify_header_serpent (__global const tc_t *esalt_bufs, const u32 * u32 data[4]; - data[0] = esalt_bufs[0].data_buf[0]; - data[1] = esalt_bufs[0].data_buf[1]; - data[2] = esalt_bufs[0].data_buf[2]; - data[3] = esalt_bufs[0].data_buf[3]; + data[0] = data_buf[0]; + data[1] = data_buf[1]; + data[2] = data_buf[2]; + data[3] = data_buf[3]; u32 tmp[4]; serpent256_decrypt_xts_first (ukey1, ukey2, data, tmp, S, T_serpent, ks_serpent); - const u32 signature = esalt_bufs[0].signature; - if (tmp[0] != signature) return 0; const u32 crc32_save = swap32_S (~tmp[2]); @@ -253,10 +249,10 @@ DECLSPEC int verify_header_serpent (__global const tc_t *esalt_bufs, const u32 * for (int i = 64 - 16; i < 128 - 16; i += 4) { - data[0] = esalt_bufs[0].data_buf[i + 0]; - data[1] = esalt_bufs[0].data_buf[i + 1]; - data[2] = esalt_bufs[0].data_buf[i + 2]; - data[3] = esalt_bufs[0].data_buf[i + 3]; + data[0] = data_buf[i + 0]; + data[1] = data_buf[i + 1]; + data[2] = data_buf[i + 2]; + data[3] = data_buf[i + 3]; serpent256_decrypt_xts_next (data, tmp, T_serpent, ks_serpent); @@ -271,8 +267,8 @@ DECLSPEC int verify_header_serpent (__global const tc_t *esalt_bufs, const u32 * return 1; } -DECLSPEC int verify_header_twofish (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2); -DECLSPEC int verify_header_twofish (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2) +DECLSPEC int verify_header_twofish (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2); +DECLSPEC int verify_header_twofish (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2) { u32 sk_twofish[4]; u32 lk_twofish[40]; @@ -283,17 +279,15 @@ DECLSPEC int verify_header_twofish (__global const tc_t *esalt_bufs, const u32 * u32 data[4]; - data[0] = esalt_bufs[0].data_buf[0]; - data[1] = esalt_bufs[0].data_buf[1]; - data[2] = esalt_bufs[0].data_buf[2]; - data[3] = esalt_bufs[0].data_buf[3]; + data[0] = data_buf[0]; + data[1] = data_buf[1]; + data[2] = data_buf[2]; + data[3] = data_buf[3]; u32 tmp[4]; twofish256_decrypt_xts_first (ukey1, ukey2, data, tmp, S, T_twofish, sk_twofish, lk_twofish); - const u32 signature = esalt_bufs[0].signature; - if (tmp[0] != signature) return 0; const u32 crc32_save = swap32_S (~tmp[2]); @@ -311,10 +305,10 @@ DECLSPEC int verify_header_twofish (__global const tc_t *esalt_bufs, const u32 * for (int i = 64 - 16; i < 128 - 16; i += 4) { - data[0] = esalt_bufs[0].data_buf[i + 0]; - data[1] = esalt_bufs[0].data_buf[i + 1]; - data[2] = esalt_bufs[0].data_buf[i + 2]; - data[3] = esalt_bufs[0].data_buf[i + 3]; + data[0] = data_buf[i + 0]; + data[1] = data_buf[i + 1]; + data[2] = data_buf[i + 2]; + data[3] = data_buf[i + 3]; twofish256_decrypt_xts_next (data, tmp, T_twofish, sk_twofish, lk_twofish); @@ -331,8 +325,8 @@ DECLSPEC int verify_header_twofish (__global const tc_t *esalt_bufs, const u32 * // 1024 bit -DECLSPEC int verify_header_aes_twofish (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4); -DECLSPEC int verify_header_aes_twofish (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +DECLSPEC int verify_header_aes_twofish (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4); +DECLSPEC int verify_header_aes_twofish (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) { u32 ks_aes[60]; @@ -346,18 +340,16 @@ DECLSPEC int verify_header_aes_twofish (__global const tc_t *esalt_bufs, const u u32 data[4]; - data[0] = esalt_bufs[0].data_buf[0]; - data[1] = esalt_bufs[0].data_buf[1]; - data[2] = esalt_bufs[0].data_buf[2]; - data[3] = esalt_bufs[0].data_buf[3]; + data[0] = data_buf[0]; + data[1] = data_buf[1]; + data[2] = data_buf[2]; + data[3] = data_buf[3]; u32 tmp[4]; aes256_decrypt_xts_first (ukey2, ukey4, data, tmp, S, T_aes, ks_aes, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); twofish256_decrypt_xts_first (ukey1, ukey3, tmp, tmp, S, T_twofish, sk_twofish, lk_twofish); - const u32 signature = esalt_bufs[0].signature; - if (tmp[0] != signature) return 0; const u32 crc32_save = swap32_S (~tmp[2]); @@ -376,10 +368,10 @@ DECLSPEC int verify_header_aes_twofish (__global const tc_t *esalt_bufs, const u for (int i = 64 - 16; i < 128 - 16; i += 4) { - data[0] = esalt_bufs[0].data_buf[i + 0]; - data[1] = esalt_bufs[0].data_buf[i + 1]; - data[2] = esalt_bufs[0].data_buf[i + 2]; - data[3] = esalt_bufs[0].data_buf[i + 3]; + data[0] = data_buf[i + 0]; + data[1] = data_buf[i + 1]; + data[2] = data_buf[i + 2]; + data[3] = data_buf[i + 3]; aes256_decrypt_xts_next (data, tmp, T_aes, ks_aes, s_td0, s_td1, s_td2, s_td3, s_td4); twofish256_decrypt_xts_next (tmp, tmp, T_twofish, sk_twofish, lk_twofish); @@ -395,8 +387,8 @@ DECLSPEC int verify_header_aes_twofish (__global const tc_t *esalt_bufs, const u return 1; } -DECLSPEC int verify_header_serpent_aes (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4); -DECLSPEC int verify_header_serpent_aes (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +DECLSPEC int verify_header_serpent_aes (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4); +DECLSPEC int verify_header_serpent_aes (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) { u32 ks_serpent[140]; u32 ks_aes[60]; @@ -408,18 +400,16 @@ DECLSPEC int verify_header_serpent_aes (__global const tc_t *esalt_bufs, const u u32 data[4]; - data[0] = esalt_bufs[0].data_buf[0]; - data[1] = esalt_bufs[0].data_buf[1]; - data[2] = esalt_bufs[0].data_buf[2]; - data[3] = esalt_bufs[0].data_buf[3]; + data[0] = data_buf[0]; + data[1] = data_buf[1]; + data[2] = data_buf[2]; + data[3] = data_buf[3]; u32 tmp[4]; serpent256_decrypt_xts_first (ukey2, ukey4, data, tmp, S, T_serpent, ks_serpent); aes256_decrypt_xts_first (ukey1, ukey3, tmp, tmp, S, T_aes, ks_aes, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); - const u32 signature = esalt_bufs[0].signature; - if (tmp[0] != signature) return 0; const u32 crc32_save = swap32_S (~tmp[2]); @@ -438,10 +428,10 @@ DECLSPEC int verify_header_serpent_aes (__global const tc_t *esalt_bufs, const u for (int i = 64 - 16; i < 128 - 16; i += 4) { - data[0] = esalt_bufs[0].data_buf[i + 0]; - data[1] = esalt_bufs[0].data_buf[i + 1]; - data[2] = esalt_bufs[0].data_buf[i + 2]; - data[3] = esalt_bufs[0].data_buf[i + 3]; + data[0] = data_buf[i + 0]; + data[1] = data_buf[i + 1]; + data[2] = data_buf[i + 2]; + data[3] = data_buf[i + 3]; serpent256_decrypt_xts_next (data, tmp, T_serpent, ks_serpent); aes256_decrypt_xts_next (tmp, tmp, T_aes, ks_aes, s_td0, s_td1, s_td2, s_td3, s_td4); @@ -457,8 +447,8 @@ DECLSPEC int verify_header_serpent_aes (__global const tc_t *esalt_bufs, const u return 1; } -DECLSPEC int verify_header_twofish_serpent (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4); -DECLSPEC int verify_header_twofish_serpent (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4) +DECLSPEC int verify_header_twofish_serpent (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4); +DECLSPEC int verify_header_twofish_serpent (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4) { u32 sk_twofish[4]; u32 lk_twofish[40]; @@ -472,18 +462,16 @@ DECLSPEC int verify_header_twofish_serpent (__global const tc_t *esalt_bufs, con u32 data[4]; - data[0] = esalt_bufs[0].data_buf[0]; - data[1] = esalt_bufs[0].data_buf[1]; - data[2] = esalt_bufs[0].data_buf[2]; - data[3] = esalt_bufs[0].data_buf[3]; + data[0] = data_buf[0]; + data[1] = data_buf[1]; + data[2] = data_buf[2]; + data[3] = data_buf[3]; u32 tmp[4]; twofish256_decrypt_xts_first (ukey2, ukey4, data, tmp, S, T_twofish, sk_twofish, lk_twofish); serpent256_decrypt_xts_first (ukey1, ukey3, tmp, tmp, S, T_serpent, ks_serpent); - const u32 signature = esalt_bufs[0].signature; - if (tmp[0] != signature) return 0; const u32 crc32_save = swap32_S (~tmp[2]); @@ -502,10 +490,10 @@ DECLSPEC int verify_header_twofish_serpent (__global const tc_t *esalt_bufs, con for (int i = 64 - 16; i < 128 - 16; i += 4) { - data[0] = esalt_bufs[0].data_buf[i + 0]; - data[1] = esalt_bufs[0].data_buf[i + 1]; - data[2] = esalt_bufs[0].data_buf[i + 2]; - data[3] = esalt_bufs[0].data_buf[i + 3]; + data[0] = data_buf[i + 0]; + data[1] = data_buf[i + 1]; + data[2] = data_buf[i + 2]; + data[3] = data_buf[i + 3]; twofish256_decrypt_xts_next (data, tmp, T_twofish, sk_twofish, lk_twofish); serpent256_decrypt_xts_next (tmp, tmp, T_serpent, ks_serpent); @@ -523,8 +511,8 @@ DECLSPEC int verify_header_twofish_serpent (__global const tc_t *esalt_bufs, con // 1536 bit -DECLSPEC int verify_header_aes_twofish_serpent (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4); -DECLSPEC int verify_header_aes_twofish_serpent (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +DECLSPEC int verify_header_aes_twofish_serpent (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4); +DECLSPEC int verify_header_aes_twofish_serpent (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) { u32 ks_aes[60]; @@ -541,10 +529,10 @@ DECLSPEC int verify_header_aes_twofish_serpent (__global const tc_t *esalt_bufs, u32 data[4]; - data[0] = esalt_bufs[0].data_buf[0]; - data[1] = esalt_bufs[0].data_buf[1]; - data[2] = esalt_bufs[0].data_buf[2]; - data[3] = esalt_bufs[0].data_buf[3]; + data[0] = data_buf[0]; + data[1] = data_buf[1]; + data[2] = data_buf[2]; + data[3] = data_buf[3]; u32 tmp[4]; @@ -552,8 +540,6 @@ DECLSPEC int verify_header_aes_twofish_serpent (__global const tc_t *esalt_bufs, twofish256_decrypt_xts_first (ukey2, ukey5, tmp, tmp, S, T_twofish, sk_twofish, lk_twofish); serpent256_decrypt_xts_first (ukey1, ukey4, tmp, tmp, S, T_serpent, ks_serpent); - const u32 signature = esalt_bufs[0].signature; - if (tmp[0] != signature) return 0; const u32 crc32_save = swap32_S (~tmp[2]); @@ -573,10 +559,10 @@ DECLSPEC int verify_header_aes_twofish_serpent (__global const tc_t *esalt_bufs, for (int i = 64 - 16; i < 128 - 16; i += 4) { - data[0] = esalt_bufs[0].data_buf[i + 0]; - data[1] = esalt_bufs[0].data_buf[i + 1]; - data[2] = esalt_bufs[0].data_buf[i + 2]; - data[3] = esalt_bufs[0].data_buf[i + 3]; + data[0] = data_buf[i + 0]; + data[1] = data_buf[i + 1]; + data[2] = data_buf[i + 2]; + data[3] = data_buf[i + 3]; aes256_decrypt_xts_next (data, tmp, T_aes, ks_aes, s_td0, s_td1, s_td2, s_td3, s_td4); twofish256_decrypt_xts_next (tmp, tmp, T_twofish, sk_twofish, lk_twofish); @@ -593,8 +579,8 @@ DECLSPEC int verify_header_aes_twofish_serpent (__global const tc_t *esalt_bufs, return 1; } -DECLSPEC int verify_header_serpent_twofish_aes (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4); -DECLSPEC int verify_header_serpent_twofish_aes (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +DECLSPEC int verify_header_serpent_twofish_aes (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4); +DECLSPEC int verify_header_serpent_twofish_aes (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) { u32 ks_serpent[140]; @@ -611,10 +597,10 @@ DECLSPEC int verify_header_serpent_twofish_aes (__global const tc_t *esalt_bufs, u32 data[4]; - data[0] = esalt_bufs[0].data_buf[0]; - data[1] = esalt_bufs[0].data_buf[1]; - data[2] = esalt_bufs[0].data_buf[2]; - data[3] = esalt_bufs[0].data_buf[3]; + data[0] = data_buf[0]; + data[1] = data_buf[1]; + data[2] = data_buf[2]; + data[3] = data_buf[3]; u32 tmp[4]; @@ -622,8 +608,6 @@ DECLSPEC int verify_header_serpent_twofish_aes (__global const tc_t *esalt_bufs, twofish256_decrypt_xts_first (ukey2, ukey5, tmp, tmp, S, T_twofish, sk_twofish, lk_twofish); aes256_decrypt_xts_first (ukey1, ukey4, tmp, tmp, S, T_aes, ks_aes, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); - const u32 signature = esalt_bufs[0].signature; - if (tmp[0] != signature) return 0; const u32 crc32_save = swap32_S (~tmp[2]); @@ -643,10 +627,10 @@ DECLSPEC int verify_header_serpent_twofish_aes (__global const tc_t *esalt_bufs, for (int i = 64 - 16; i < 128 - 16; i += 4) { - data[0] = esalt_bufs[0].data_buf[i + 0]; - data[1] = esalt_bufs[0].data_buf[i + 1]; - data[2] = esalt_bufs[0].data_buf[i + 2]; - data[3] = esalt_bufs[0].data_buf[i + 3]; + data[0] = data_buf[i + 0]; + data[1] = data_buf[i + 1]; + data[2] = data_buf[i + 2]; + data[3] = data_buf[i + 3]; serpent256_decrypt_xts_next (data, tmp, T_serpent, ks_serpent); twofish256_decrypt_xts_next (tmp, tmp, T_twofish, sk_twofish, lk_twofish); diff --git a/OpenCL/inc_types.cl b/OpenCL/inc_types.cl index 43752dc16..50c789aa5 100644 --- a/OpenCL/inc_types.cl +++ b/OpenCL/inc_types.cl @@ -1413,6 +1413,8 @@ typedef struct plain u32 salt_pos; u32 digest_pos; u32 hash_pos; + u32 extra1; + u32 extra2; } plain_t; diff --git a/OpenCL/inc_veracrypt_xts.cl b/OpenCL/inc_veracrypt_xts.cl index 78a6a0870..a7c598360 100644 --- a/OpenCL/inc_veracrypt_xts.cl +++ b/OpenCL/inc_veracrypt_xts.cl @@ -96,8 +96,8 @@ DECLSPEC void kuznyechik_decrypt_xts_next (const u32 *in, u32 *out, u32 *T, u32 // 512 bit -DECLSPEC int verify_header_camellia (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2); -DECLSPEC int verify_header_camellia (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2) +DECLSPEC int verify_header_camellia (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2); +DECLSPEC int verify_header_camellia (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2) { u32 ks_camellia[68]; @@ -107,17 +107,15 @@ DECLSPEC int verify_header_camellia (__global const tc_t *esalt_bufs, const u32 u32 data[4]; - data[0] = esalt_bufs[0].data_buf[0]; - data[1] = esalt_bufs[0].data_buf[1]; - data[2] = esalt_bufs[0].data_buf[2]; - data[3] = esalt_bufs[0].data_buf[3]; + data[0] = data_buf[0]; + data[1] = data_buf[1]; + data[2] = data_buf[2]; + data[3] = data_buf[3]; u32 tmp[4]; camellia256_decrypt_xts_first (ukey1, ukey2, data, tmp, S, T_camellia, ks_camellia); - const u32 signature = esalt_bufs[0].signature; - if (tmp[0] != signature) return 0; const u32 crc32_save = swap32_S (~tmp[2]); @@ -135,10 +133,10 @@ DECLSPEC int verify_header_camellia (__global const tc_t *esalt_bufs, const u32 for (int i = 64 - 16; i < 128 - 16; i += 4) { - data[0] = esalt_bufs[0].data_buf[i + 0]; - data[1] = esalt_bufs[0].data_buf[i + 1]; - data[2] = esalt_bufs[0].data_buf[i + 2]; - data[3] = esalt_bufs[0].data_buf[i + 3]; + data[0] = data_buf[i + 0]; + data[1] = data_buf[i + 1]; + data[2] = data_buf[i + 2]; + data[3] = data_buf[i + 3]; camellia256_decrypt_xts_next (data, tmp, T_camellia, ks_camellia); @@ -153,8 +151,8 @@ DECLSPEC int verify_header_camellia (__global const tc_t *esalt_bufs, const u32 return 1; } -DECLSPEC int verify_header_kuznyechik (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2); -DECLSPEC int verify_header_kuznyechik (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2) +DECLSPEC int verify_header_kuznyechik (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2); +DECLSPEC int verify_header_kuznyechik (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2) { u32 ks_kuznyechik[40]; @@ -164,17 +162,15 @@ DECLSPEC int verify_header_kuznyechik (__global const tc_t *esalt_bufs, const u3 u32 data[4]; - data[0] = esalt_bufs[0].data_buf[0]; - data[1] = esalt_bufs[0].data_buf[1]; - data[2] = esalt_bufs[0].data_buf[2]; - data[3] = esalt_bufs[0].data_buf[3]; + data[0] = data_buf[0]; + data[1] = data_buf[1]; + data[2] = data_buf[2]; + data[3] = data_buf[3]; u32 tmp[4]; kuznyechik_decrypt_xts_first (ukey1, ukey2, data, tmp, S, T_kuznyechik, ks_kuznyechik); - const u32 signature = esalt_bufs[0].signature; - if (tmp[0] != signature) return 0; const u32 crc32_save = swap32_S (~tmp[2]); @@ -192,10 +188,10 @@ DECLSPEC int verify_header_kuznyechik (__global const tc_t *esalt_bufs, const u3 for (int i = 64 - 16; i < 128 - 16; i += 4) { - data[0] = esalt_bufs[0].data_buf[i + 0]; - data[1] = esalt_bufs[0].data_buf[i + 1]; - data[2] = esalt_bufs[0].data_buf[i + 2]; - data[3] = esalt_bufs[0].data_buf[i + 3]; + data[0] = data_buf[i + 0]; + data[1] = data_buf[i + 1]; + data[2] = data_buf[i + 2]; + data[3] = data_buf[i + 3]; kuznyechik_decrypt_xts_next (data, tmp, T_kuznyechik, ks_kuznyechik); @@ -212,8 +208,8 @@ DECLSPEC int verify_header_kuznyechik (__global const tc_t *esalt_bufs, const u3 // 1024 bit -DECLSPEC int verify_header_camellia_kuznyechik (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4); -DECLSPEC int verify_header_camellia_kuznyechik (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4) +DECLSPEC int verify_header_camellia_kuznyechik (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4); +DECLSPEC int verify_header_camellia_kuznyechik (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4) { u32 ks_camellia[68]; u32 ks_kuznyechik[40]; @@ -225,18 +221,16 @@ DECLSPEC int verify_header_camellia_kuznyechik (__global const tc_t *esalt_bufs, u32 data[4]; - data[0] = esalt_bufs[0].data_buf[0]; - data[1] = esalt_bufs[0].data_buf[1]; - data[2] = esalt_bufs[0].data_buf[2]; - data[3] = esalt_bufs[0].data_buf[3]; + data[0] = data_buf[0]; + data[1] = data_buf[1]; + data[2] = data_buf[2]; + data[3] = data_buf[3]; u32 tmp[4]; camellia256_decrypt_xts_first (ukey2, ukey4, data, tmp, S, T_camellia, ks_camellia); kuznyechik_decrypt_xts_first (ukey1, ukey3, tmp, tmp, S, T_kuznyechik, ks_kuznyechik); - const u32 signature = esalt_bufs[0].signature; - if (tmp[0] != signature) return 0; const u32 crc32_save = swap32_S (~tmp[2]); @@ -255,10 +249,10 @@ DECLSPEC int verify_header_camellia_kuznyechik (__global const tc_t *esalt_bufs, for (int i = 64 - 16; i < 128 - 16; i += 4) { - data[0] = esalt_bufs[0].data_buf[i + 0]; - data[1] = esalt_bufs[0].data_buf[i + 1]; - data[2] = esalt_bufs[0].data_buf[i + 2]; - data[3] = esalt_bufs[0].data_buf[i + 3]; + data[0] = data_buf[i + 0]; + data[1] = data_buf[i + 1]; + data[2] = data_buf[i + 2]; + data[3] = data_buf[i + 3]; camellia256_decrypt_xts_next (data, tmp, T_camellia, ks_camellia); kuznyechik_decrypt_xts_next (tmp, tmp, T_kuznyechik, ks_kuznyechik); @@ -274,8 +268,8 @@ DECLSPEC int verify_header_camellia_kuznyechik (__global const tc_t *esalt_bufs, return 1; } -DECLSPEC int verify_header_camellia_serpent (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4); -DECLSPEC int verify_header_camellia_serpent (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4) +DECLSPEC int verify_header_camellia_serpent (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4); +DECLSPEC int verify_header_camellia_serpent (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4) { u32 ks_camellia[68]; u32 ks_serpent[140]; @@ -287,18 +281,16 @@ DECLSPEC int verify_header_camellia_serpent (__global const tc_t *esalt_bufs, co u32 data[4]; - data[0] = esalt_bufs[0].data_buf[0]; - data[1] = esalt_bufs[0].data_buf[1]; - data[2] = esalt_bufs[0].data_buf[2]; - data[3] = esalt_bufs[0].data_buf[3]; + data[0] = data_buf[0]; + data[1] = data_buf[1]; + data[2] = data_buf[2]; + data[3] = data_buf[3]; u32 tmp[4]; camellia256_decrypt_xts_first (ukey2, ukey4, data, tmp, S, T_camellia, ks_camellia); serpent256_decrypt_xts_first (ukey1, ukey3, tmp, tmp, S, T_serpent, ks_serpent); - const u32 signature = esalt_bufs[0].signature; - if (tmp[0] != signature) return 0; const u32 crc32_save = swap32_S (~tmp[2]); @@ -317,10 +309,10 @@ DECLSPEC int verify_header_camellia_serpent (__global const tc_t *esalt_bufs, co for (int i = 64 - 16; i < 128 - 16; i += 4) { - data[0] = esalt_bufs[0].data_buf[i + 0]; - data[1] = esalt_bufs[0].data_buf[i + 1]; - data[2] = esalt_bufs[0].data_buf[i + 2]; - data[3] = esalt_bufs[0].data_buf[i + 3]; + data[0] = data_buf[i + 0]; + data[1] = data_buf[i + 1]; + data[2] = data_buf[i + 2]; + data[3] = data_buf[i + 3]; camellia256_decrypt_xts_next (data, tmp, T_camellia, ks_camellia); serpent256_decrypt_xts_next (tmp, tmp, T_serpent, ks_serpent); @@ -336,8 +328,8 @@ DECLSPEC int verify_header_camellia_serpent (__global const tc_t *esalt_bufs, co return 1; } -DECLSPEC int verify_header_kuznyechik_aes (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4); -DECLSPEC int verify_header_kuznyechik_aes (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +DECLSPEC int verify_header_kuznyechik_aes (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4); +DECLSPEC int verify_header_kuznyechik_aes (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) { u32 ks_kuznyechik[40]; u32 ks_aes[60]; @@ -349,18 +341,16 @@ DECLSPEC int verify_header_kuznyechik_aes (__global const tc_t *esalt_bufs, cons u32 data[4]; - data[0] = esalt_bufs[0].data_buf[0]; - data[1] = esalt_bufs[0].data_buf[1]; - data[2] = esalt_bufs[0].data_buf[2]; - data[3] = esalt_bufs[0].data_buf[3]; + data[0] = data_buf[0]; + data[1] = data_buf[1]; + data[2] = data_buf[2]; + data[3] = data_buf[3]; u32 tmp[4]; kuznyechik_decrypt_xts_first (ukey2, ukey4, data, tmp, S, T_kuznyechik, ks_kuznyechik); aes256_decrypt_xts_first (ukey1, ukey3, tmp, tmp, S, T_aes, ks_aes, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4); - const u32 signature = esalt_bufs[0].signature; - if (tmp[0] != signature) return 0; const u32 crc32_save = swap32_S (~tmp[2]); @@ -379,10 +369,10 @@ DECLSPEC int verify_header_kuznyechik_aes (__global const tc_t *esalt_bufs, cons for (int i = 64 - 16; i < 128 - 16; i += 4) { - data[0] = esalt_bufs[0].data_buf[i + 0]; - data[1] = esalt_bufs[0].data_buf[i + 1]; - data[2] = esalt_bufs[0].data_buf[i + 2]; - data[3] = esalt_bufs[0].data_buf[i + 3]; + data[0] = data_buf[i + 0]; + data[1] = data_buf[i + 1]; + data[2] = data_buf[i + 2]; + data[3] = data_buf[i + 3]; kuznyechik_decrypt_xts_next (data, tmp, T_kuznyechik, ks_kuznyechik); aes256_decrypt_xts_next (tmp, tmp, T_aes, ks_aes, s_td0, s_td1, s_td2, s_td3, s_td4); @@ -398,8 +388,8 @@ DECLSPEC int verify_header_kuznyechik_aes (__global const tc_t *esalt_bufs, cons return 1; } -DECLSPEC int verify_header_kuznyechik_twofish (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4); -DECLSPEC int verify_header_kuznyechik_twofish (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4) +DECLSPEC int verify_header_kuznyechik_twofish (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4); +DECLSPEC int verify_header_kuznyechik_twofish (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4) { u32 ks_kuznyechik[40]; @@ -413,18 +403,16 @@ DECLSPEC int verify_header_kuznyechik_twofish (__global const tc_t *esalt_bufs, u32 data[4]; - data[0] = esalt_bufs[0].data_buf[0]; - data[1] = esalt_bufs[0].data_buf[1]; - data[2] = esalt_bufs[0].data_buf[2]; - data[3] = esalt_bufs[0].data_buf[3]; + data[0] = data_buf[0]; + data[1] = data_buf[1]; + data[2] = data_buf[2]; + data[3] = data_buf[3]; u32 tmp[4]; kuznyechik_decrypt_xts_first (ukey2, ukey4, data, tmp, S, T_kuznyechik, ks_kuznyechik); twofish256_decrypt_xts_first (ukey1, ukey3, tmp, tmp, S, T_twofish, sk_twofish, lk_twofish); - const u32 signature = esalt_bufs[0].signature; - if (tmp[0] != signature) return 0; const u32 crc32_save = swap32_S (~tmp[2]); @@ -443,10 +431,10 @@ DECLSPEC int verify_header_kuznyechik_twofish (__global const tc_t *esalt_bufs, for (int i = 64 - 16; i < 128 - 16; i += 4) { - data[0] = esalt_bufs[0].data_buf[i + 0]; - data[1] = esalt_bufs[0].data_buf[i + 1]; - data[2] = esalt_bufs[0].data_buf[i + 2]; - data[3] = esalt_bufs[0].data_buf[i + 3]; + data[0] = data_buf[i + 0]; + data[1] = data_buf[i + 1]; + data[2] = data_buf[i + 2]; + data[3] = data_buf[i + 3]; kuznyechik_decrypt_xts_next (data, tmp, T_kuznyechik, ks_kuznyechik); twofish256_decrypt_xts_next (tmp, tmp, T_twofish, sk_twofish, lk_twofish); @@ -464,8 +452,8 @@ DECLSPEC int verify_header_kuznyechik_twofish (__global const tc_t *esalt_bufs, // 1536 bit -DECLSPEC int verify_header_kuznyechik_serpent_camellia (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6); -DECLSPEC int verify_header_kuznyechik_serpent_camellia (__global const tc_t *esalt_bufs, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6) +DECLSPEC int verify_header_kuznyechik_serpent_camellia (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6); +DECLSPEC int verify_header_kuznyechik_serpent_camellia (__global const u32 *data_buf, const u32 signature, const u32 *ukey1, const u32 *ukey2, const u32 *ukey3, const u32 *ukey4, const u32 *ukey5, const u32 *ukey6) { u32 ks_kuznyechik[40]; u32 ks_serpent[140]; @@ -479,10 +467,10 @@ DECLSPEC int verify_header_kuznyechik_serpent_camellia (__global const tc_t *esa u32 data[4]; - data[0] = esalt_bufs[0].data_buf[0]; - data[1] = esalt_bufs[0].data_buf[1]; - data[2] = esalt_bufs[0].data_buf[2]; - data[3] = esalt_bufs[0].data_buf[3]; + data[0] = data_buf[0]; + data[1] = data_buf[1]; + data[2] = data_buf[2]; + data[3] = data_buf[3]; u32 tmp[4]; @@ -490,8 +478,6 @@ DECLSPEC int verify_header_kuznyechik_serpent_camellia (__global const tc_t *esa serpent256_decrypt_xts_first (ukey2, ukey5, tmp, tmp, S, T_serpent, ks_serpent); camellia256_decrypt_xts_first (ukey1, ukey4, tmp, tmp, S, T_camellia, ks_camellia); - const u32 signature = esalt_bufs[0].signature; - if (tmp[0] != signature) return 0; const u32 crc32_save = swap32_S (~tmp[2]); @@ -511,10 +497,10 @@ DECLSPEC int verify_header_kuznyechik_serpent_camellia (__global const tc_t *esa for (int i = 64 - 16; i < 128 - 16; i += 4) { - data[0] = esalt_bufs[0].data_buf[i + 0]; - data[1] = esalt_bufs[0].data_buf[i + 1]; - data[2] = esalt_bufs[0].data_buf[i + 2]; - data[3] = esalt_bufs[0].data_buf[i + 3]; + data[0] = data_buf[i + 0]; + data[1] = data_buf[i + 1]; + data[2] = data_buf[i + 2]; + data[3] = data_buf[i + 3]; kuznyechik_decrypt_xts_next (data, tmp, T_kuznyechik, ks_kuznyechik); serpent256_decrypt_xts_next (tmp, tmp, T_serpent, ks_serpent); diff --git a/OpenCL/m02500-pure.cl b/OpenCL/m02500-pure.cl index c90cd9472..fbad337d6 100644 --- a/OpenCL/m02500-pure.cl +++ b/OpenCL/m02500-pure.cl @@ -464,7 +464,7 @@ __kernel void m02500_aux1 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t)) { if (atomic_inc (&hashes_shown[digest_cur]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0); } } } @@ -584,7 +584,7 @@ __kernel void m02500_aux1 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t)) { if (atomic_inc (&hashes_shown[digest_cur]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0); } } } @@ -775,7 +775,7 @@ __kernel void m02500_aux2 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t)) { if (atomic_inc (&hashes_shown[digest_cur]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0); } } } @@ -895,7 +895,7 @@ __kernel void m02500_aux2 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t)) { if (atomic_inc (&hashes_shown[digest_cur]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0); } } } @@ -1169,7 +1169,7 @@ __kernel void m02500_aux3 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t)) { if (atomic_inc (&hashes_shown[digest_cur]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0); } } } @@ -1320,7 +1320,7 @@ __kernel void m02500_aux3 (KERN_ATTR_TMPS_ESALT (wpa_pbkdf2_tmp_t, wpa_eapol_t)) { if (atomic_inc (&hashes_shown[digest_cur]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0); } } } diff --git a/OpenCL/m02501-pure.cl b/OpenCL/m02501-pure.cl index 5e1e779f9..2b9c19c3f 100644 --- a/OpenCL/m02501-pure.cl +++ b/OpenCL/m02501-pure.cl @@ -335,7 +335,7 @@ __kernel void m02501_aux1 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t)) { if (atomic_inc (&hashes_shown[digest_cur]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0); } } } @@ -455,7 +455,7 @@ __kernel void m02501_aux1 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t)) { if (atomic_inc (&hashes_shown[digest_cur]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0); } } } @@ -646,7 +646,7 @@ __kernel void m02501_aux2 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t)) { if (atomic_inc (&hashes_shown[digest_cur]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0); } } } @@ -766,7 +766,7 @@ __kernel void m02501_aux2 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t)) { if (atomic_inc (&hashes_shown[digest_cur]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0); } } } @@ -1040,7 +1040,7 @@ __kernel void m02501_aux3 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t)) { if (atomic_inc (&hashes_shown[digest_cur]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0); } } } @@ -1191,7 +1191,7 @@ __kernel void m02501_aux3 (KERN_ATTR_TMPS_ESALT (wpa_pmk_tmp_t, wpa_eapol_t)) { if (atomic_inc (&hashes_shown[digest_cur]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, digest_pos, digest_cur, gid, 0, 0, 0); } } } diff --git a/OpenCL/m06100_a0-pure.cl b/OpenCL/m06100_a0-pure.cl index a1c94d998..b32fe287a 100644 --- a/OpenCL/m06100_a0-pure.cl +++ b/OpenCL/m06100_a0-pure.cl @@ -26,9 +26,11 @@ __kernel void m06100_mxx (KERN_ATTR_RULES ()) const u64 lsz = get_local_size (0); /** - * shared + * Whirlpool shared */ + #ifdef REAL_SHM + __local u32 s_Ch[8][256]; __local u32 s_Cl[8][256]; @@ -55,6 +57,13 @@ __kernel void m06100_mxx (KERN_ATTR_RULES ()) barrier (CLK_LOCAL_MEM_FENCE); + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + if (gid >= gid_max) return; /** @@ -101,9 +110,11 @@ __kernel void m06100_sxx (KERN_ATTR_RULES ()) const u64 lsz = get_local_size (0); /** - * shared + * Whirlpool shared */ + #ifdef REAL_SHM + __local u32 s_Ch[8][256]; __local u32 s_Cl[8][256]; @@ -130,6 +141,13 @@ __kernel void m06100_sxx (KERN_ATTR_RULES ()) barrier (CLK_LOCAL_MEM_FENCE); + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + if (gid >= gid_max) return; /** diff --git a/OpenCL/m06100_a1-pure.cl b/OpenCL/m06100_a1-pure.cl index dd4a1d769..4772f68b8 100644 --- a/OpenCL/m06100_a1-pure.cl +++ b/OpenCL/m06100_a1-pure.cl @@ -24,9 +24,11 @@ __kernel void m06100_mxx (KERN_ATTR_BASIC ()) const u64 lsz = get_local_size (0); /** - * shared + * Whirlpool shared */ + #ifdef REAL_SHM + __local u32 s_Ch[8][256]; __local u32 s_Cl[8][256]; @@ -53,6 +55,13 @@ __kernel void m06100_mxx (KERN_ATTR_BASIC ()) barrier (CLK_LOCAL_MEM_FENCE); + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + if (gid >= gid_max) return; /** @@ -97,9 +106,11 @@ __kernel void m06100_sxx (KERN_ATTR_BASIC ()) const u64 lsz = get_local_size (0); /** - * shared + * Whirlpool shared */ + #ifdef REAL_SHM + __local u32 s_Ch[8][256]; __local u32 s_Cl[8][256]; @@ -126,6 +137,13 @@ __kernel void m06100_sxx (KERN_ATTR_BASIC ()) barrier (CLK_LOCAL_MEM_FENCE); + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + if (gid >= gid_max) return; /** diff --git a/OpenCL/m06100_a3-pure.cl b/OpenCL/m06100_a3-pure.cl index fe22a245c..7f9e3de87 100644 --- a/OpenCL/m06100_a3-pure.cl +++ b/OpenCL/m06100_a3-pure.cl @@ -24,9 +24,11 @@ __kernel void m06100_mxx (KERN_ATTR_VECTOR ()) const u64 lsz = get_local_size (0); /** - * shared + * Whirlpool shared */ + #ifdef REAL_SHM + __local u32 s_Ch[8][256]; __local u32 s_Cl[8][256]; @@ -53,6 +55,13 @@ __kernel void m06100_mxx (KERN_ATTR_VECTOR ()) barrier (CLK_LOCAL_MEM_FENCE); + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + if (gid >= gid_max) return; /** @@ -110,9 +119,11 @@ __kernel void m06100_sxx (KERN_ATTR_VECTOR ()) const u64 lsz = get_local_size (0); /** - * shared + * Whirlpool shared */ + #ifdef REAL_SHM + __local u32 s_Ch[8][256]; __local u32 s_Cl[8][256]; @@ -139,6 +150,13 @@ __kernel void m06100_sxx (KERN_ATTR_VECTOR ()) barrier (CLK_LOCAL_MEM_FENCE); + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + if (gid >= gid_max) return; /** diff --git a/OpenCL/m06211-pure.cl b/OpenCL/m06211-pure.cl index 5211345de..ce62c09db 100644 --- a/OpenCL/m06211-pure.cl +++ b/OpenCL/m06211-pure.cl @@ -16,8 +16,6 @@ #include "inc_cipher_aes.cl" #include "inc_cipher_twofish.cl" #include "inc_cipher_serpent.cl" -#include "inc_cipher_camellia.cl" -#include "inc_cipher_kuznyechik.cl" typedef struct tc { @@ -34,7 +32,6 @@ typedef struct tc #include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_xts.cl" -#include "inc_veracrypt_xts.cl" typedef struct tc_tmp { @@ -375,43 +372,27 @@ __kernel void m06211_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey2[6] = tmps[gid].out[14]; ukey2[7] = tmps[gid].out[15]; - if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m06212-pure.cl b/OpenCL/m06212-pure.cl index e30bb12db..4c149af11 100644 --- a/OpenCL/m06212-pure.cl +++ b/OpenCL/m06212-pure.cl @@ -16,8 +16,6 @@ #include "inc_cipher_aes.cl" #include "inc_cipher_twofish.cl" #include "inc_cipher_serpent.cl" -#include "inc_cipher_camellia.cl" -#include "inc_cipher_kuznyechik.cl" typedef struct tc { @@ -34,7 +32,6 @@ typedef struct tc #include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_xts.cl" -#include "inc_veracrypt_xts.cl" typedef struct tc_tmp { @@ -375,43 +372,27 @@ __kernel void m06212_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey2[6] = tmps[gid].out[14]; ukey2[7] = tmps[gid].out[15]; - if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } @@ -437,59 +418,27 @@ __kernel void m06212_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey4[6] = tmps[gid].out[30]; ukey4[7] = tmps[gid].out[31]; - if (verify_header_aes_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_serpent_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_camellia_kuznyechik (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_camellia_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) + if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_kuznyechik_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_kuznyechik_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) + if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m06213-pure.cl b/OpenCL/m06213-pure.cl index d620b47bb..2e1f761a6 100644 --- a/OpenCL/m06213-pure.cl +++ b/OpenCL/m06213-pure.cl @@ -16,8 +16,6 @@ #include "inc_cipher_aes.cl" #include "inc_cipher_twofish.cl" #include "inc_cipher_serpent.cl" -#include "inc_cipher_camellia.cl" -#include "inc_cipher_kuznyechik.cl" typedef struct tc { @@ -34,7 +32,6 @@ typedef struct tc #include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_xts.cl" -#include "inc_veracrypt_xts.cl" typedef struct tc_tmp { @@ -375,43 +372,27 @@ __kernel void m06213_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey2[6] = tmps[gid].out[14]; ukey2[7] = tmps[gid].out[15]; - if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } @@ -437,59 +418,27 @@ __kernel void m06213_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey4[6] = tmps[gid].out[30]; ukey4[7] = tmps[gid].out[31]; - if (verify_header_aes_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_serpent_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) + if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_camellia_kuznyechik (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) + if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_camellia_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) + if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } @@ -515,27 +464,19 @@ __kernel void m06213_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey6[6] = tmps[gid].out[46]; ukey6[7] = tmps[gid].out[47]; - if (verify_header_aes_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_serpent_twofish_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_kuznyechik_serpent_camellia (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6) == 1) + if (verify_header_serpent_twofish_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m06221-pure.cl b/OpenCL/m06221-pure.cl index 06103e490..1f0a41453 100644 --- a/OpenCL/m06221-pure.cl +++ b/OpenCL/m06221-pure.cl @@ -16,8 +16,6 @@ #include "inc_cipher_aes.cl" #include "inc_cipher_twofish.cl" #include "inc_cipher_serpent.cl" -#include "inc_cipher_camellia.cl" -#include "inc_cipher_kuznyechik.cl" typedef struct tc { @@ -34,7 +32,6 @@ typedef struct tc #include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_xts.cl" -#include "inc_veracrypt_xts.cl" typedef struct tc64_tmp { @@ -519,43 +516,27 @@ __kernel void m06221_comp (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t)) ukey2[6] = swap32_S (h32_from_64_S (tmps[gid].out[7])); ukey2[7] = swap32_S (l32_from_64_S (tmps[gid].out[7])); - if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m06222-pure.cl b/OpenCL/m06222-pure.cl index 168b38b10..ea7697860 100644 --- a/OpenCL/m06222-pure.cl +++ b/OpenCL/m06222-pure.cl @@ -16,8 +16,6 @@ #include "inc_cipher_aes.cl" #include "inc_cipher_twofish.cl" #include "inc_cipher_serpent.cl" -#include "inc_cipher_camellia.cl" -#include "inc_cipher_kuznyechik.cl" typedef struct tc { @@ -34,7 +32,6 @@ typedef struct tc #include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_xts.cl" -#include "inc_veracrypt_xts.cl" typedef struct tc64_tmp { @@ -519,43 +516,27 @@ __kernel void m06222_comp (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t)) ukey2[6] = swap32_S (h32_from_64_S (tmps[gid].out[7])); ukey2[7] = swap32_S (l32_from_64_S (tmps[gid].out[7])); - if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } @@ -581,59 +562,27 @@ __kernel void m06222_comp (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t)) ukey4[6] = swap32_S (h32_from_64_S (tmps[gid].out[15])); ukey4[7] = swap32_S (l32_from_64_S (tmps[gid].out[15])); - if (verify_header_aes_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_serpent_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_camellia_kuznyechik (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_camellia_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) + if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_kuznyechik_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_kuznyechik_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) + if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m06223-pure.cl b/OpenCL/m06223-pure.cl index 7970f4830..fd4816401 100644 --- a/OpenCL/m06223-pure.cl +++ b/OpenCL/m06223-pure.cl @@ -16,8 +16,6 @@ #include "inc_cipher_aes.cl" #include "inc_cipher_twofish.cl" #include "inc_cipher_serpent.cl" -#include "inc_cipher_camellia.cl" -#include "inc_cipher_kuznyechik.cl" typedef struct tc { @@ -34,7 +32,6 @@ typedef struct tc #include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_xts.cl" -#include "inc_veracrypt_xts.cl" typedef struct tc64_tmp { @@ -519,43 +516,27 @@ __kernel void m06223_comp (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t)) ukey2[6] = swap32_S (h32_from_64_S (tmps[gid].out[7])); ukey2[7] = swap32_S (l32_from_64_S (tmps[gid].out[7])); - if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } @@ -581,59 +562,27 @@ __kernel void m06223_comp (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t)) ukey4[6] = swap32_S (h32_from_64_S (tmps[gid].out[15])); ukey4[7] = swap32_S (l32_from_64_S (tmps[gid].out[15])); - if (verify_header_aes_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_serpent_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) + if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_camellia_kuznyechik (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) + if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_camellia_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) + if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } @@ -659,27 +608,19 @@ __kernel void m06223_comp (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t)) ukey6[6] = swap32_S (h32_from_64_S (tmps[gid].out[23])); ukey6[7] = swap32_S (l32_from_64_S (tmps[gid].out[23])); - if (verify_header_aes_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_serpent_twofish_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_kuznyechik_serpent_camellia (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6) == 1) + if (verify_header_serpent_twofish_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m06231-pure.cl b/OpenCL/m06231-pure.cl index 4694a6c47..1660acc93 100644 --- a/OpenCL/m06231-pure.cl +++ b/OpenCL/m06231-pure.cl @@ -16,8 +16,6 @@ #include "inc_cipher_aes.cl" #include "inc_cipher_twofish.cl" #include "inc_cipher_serpent.cl" -#include "inc_cipher_camellia.cl" -#include "inc_cipher_kuznyechik.cl" typedef struct tc { @@ -34,7 +32,6 @@ typedef struct tc #include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_xts.cl" -#include "inc_veracrypt_xts.cl" typedef struct tc_tmp { @@ -46,7 +43,7 @@ typedef struct tc_tmp } tc_tmp_t; -DECLSPEC void hmac_whirlpool_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) +DECLSPEC void hmac_whirlpool_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]) { digest[ 0] = ipad[ 0]; digest[ 1] = ipad[ 1]; @@ -161,6 +158,14 @@ __kernel void m06231_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i]; } + barrier (CLK_LOCAL_MEM_FENCE); + + /** + * Whirlpool shared + */ + + #ifdef REAL_SHM + __local u32 s_Ch[8][256]; __local u32 s_Cl[8][256]; @@ -187,6 +192,13 @@ __kernel void m06231_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) barrier (CLK_LOCAL_MEM_FENCE); + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + if (gid >= gid_max) return; /** @@ -357,16 +369,14 @@ __kernel void m06231_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) __kernel void m06231_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) { /** - * modifier + * Whirlpool shared */ const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); const u64 lsz = get_local_size (0); - /** - * shared - */ + #ifdef REAL_SHM __local u32 s_Ch[8][256]; __local u32 s_Cl[8][256]; @@ -394,6 +404,13 @@ __kernel void m06231_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) barrier (CLK_LOCAL_MEM_FENCE); + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + if ((gid * VECT_SIZE) >= gid_max) return; u32x ipad[16]; @@ -609,6 +626,45 @@ __kernel void m06231_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) #endif + /** + * Whirlpool shared + */ + + #ifdef REAL_SHM + + __local u32 s_Ch[8][256]; + __local u32 s_Cl[8][256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_Ch[0][i] = Ch[0][i]; + s_Ch[1][i] = Ch[1][i]; + s_Ch[2][i] = Ch[2][i]; + s_Ch[3][i] = Ch[3][i]; + s_Ch[4][i] = Ch[4][i]; + s_Ch[5][i] = Ch[5][i]; + s_Ch[6][i] = Ch[6][i]; + s_Ch[7][i] = Ch[7][i]; + + s_Cl[0][i] = Cl[0][i]; + s_Cl[1][i] = Cl[1][i]; + s_Cl[2][i] = Cl[2][i]; + s_Cl[3][i] = Cl[3][i]; + s_Cl[4][i] = Cl[4][i]; + s_Cl[5][i] = Cl[5][i]; + s_Cl[6][i] = Cl[6][i]; + s_Cl[7][i] = Cl[7][i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + if (gid >= gid_max) return; u32 ukey1[8]; @@ -633,43 +689,27 @@ __kernel void m06231_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey2[6] = swap32_S (tmps[gid].out[14]); ukey2[7] = swap32_S (tmps[gid].out[15]); - if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1) + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1) + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m06232-pure.cl b/OpenCL/m06232-pure.cl index 7722c0a26..d4515b4a4 100644 --- a/OpenCL/m06232-pure.cl +++ b/OpenCL/m06232-pure.cl @@ -16,8 +16,6 @@ #include "inc_cipher_aes.cl" #include "inc_cipher_twofish.cl" #include "inc_cipher_serpent.cl" -#include "inc_cipher_camellia.cl" -#include "inc_cipher_kuznyechik.cl" typedef struct tc { @@ -34,7 +32,6 @@ typedef struct tc #include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_xts.cl" -#include "inc_veracrypt_xts.cl" typedef struct tc_tmp { @@ -46,7 +43,7 @@ typedef struct tc_tmp } tc_tmp_t; -DECLSPEC void hmac_whirlpool_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) +DECLSPEC void hmac_whirlpool_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]) { digest[ 0] = ipad[ 0]; digest[ 1] = ipad[ 1]; @@ -161,6 +158,14 @@ __kernel void m06232_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i]; } + barrier (CLK_LOCAL_MEM_FENCE); + + /** + * Whirlpool shared + */ + + #ifdef REAL_SHM + __local u32 s_Ch[8][256]; __local u32 s_Cl[8][256]; @@ -187,6 +192,13 @@ __kernel void m06232_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) barrier (CLK_LOCAL_MEM_FENCE); + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + if (gid >= gid_max) return; /** @@ -357,16 +369,14 @@ __kernel void m06232_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) __kernel void m06232_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) { /** - * modifier + * Whirlpool shared */ const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); const u64 lsz = get_local_size (0); - /** - * shared - */ + #ifdef REAL_SHM __local u32 s_Ch[8][256]; __local u32 s_Cl[8][256]; @@ -394,6 +404,13 @@ __kernel void m06232_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) barrier (CLK_LOCAL_MEM_FENCE); + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + if ((gid * VECT_SIZE) >= gid_max) return; u32x ipad[16]; @@ -609,6 +626,45 @@ __kernel void m06232_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) #endif + /** + * Whirlpool shared + */ + + #ifdef REAL_SHM + + __local u32 s_Ch[8][256]; + __local u32 s_Cl[8][256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_Ch[0][i] = Ch[0][i]; + s_Ch[1][i] = Ch[1][i]; + s_Ch[2][i] = Ch[2][i]; + s_Ch[3][i] = Ch[3][i]; + s_Ch[4][i] = Ch[4][i]; + s_Ch[5][i] = Ch[5][i]; + s_Ch[6][i] = Ch[6][i]; + s_Ch[7][i] = Ch[7][i]; + + s_Cl[0][i] = Cl[0][i]; + s_Cl[1][i] = Cl[1][i]; + s_Cl[2][i] = Cl[2][i]; + s_Cl[3][i] = Cl[3][i]; + s_Cl[4][i] = Cl[4][i]; + s_Cl[5][i] = Cl[5][i]; + s_Cl[6][i] = Cl[6][i]; + s_Cl[7][i] = Cl[7][i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + if (gid >= gid_max) return; u32 ukey1[8]; @@ -633,43 +689,27 @@ __kernel void m06232_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey2[6] = swap32_S (tmps[gid].out[14]); ukey2[7] = swap32_S (tmps[gid].out[15]); - if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } @@ -695,59 +735,27 @@ __kernel void m06232_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey4[6] = swap32_S (tmps[gid].out[30]); ukey4[7] = swap32_S (tmps[gid].out[31]); - if (verify_header_aes_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_serpent_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_camellia_kuznyechik (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_camellia_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) + if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_kuznyechik_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_kuznyechik_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) + if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m06233-pure.cl b/OpenCL/m06233-pure.cl index e0766cc62..3b844392f 100644 --- a/OpenCL/m06233-pure.cl +++ b/OpenCL/m06233-pure.cl @@ -16,8 +16,6 @@ #include "inc_cipher_aes.cl" #include "inc_cipher_twofish.cl" #include "inc_cipher_serpent.cl" -#include "inc_cipher_camellia.cl" -#include "inc_cipher_kuznyechik.cl" typedef struct tc { @@ -34,7 +32,6 @@ typedef struct tc #include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_xts.cl" -#include "inc_veracrypt_xts.cl" typedef struct tc_tmp { @@ -46,7 +43,7 @@ typedef struct tc_tmp } tc_tmp_t; -DECLSPEC void hmac_whirlpool_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest, __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256]) +DECLSPEC void hmac_whirlpool_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]) { digest[ 0] = ipad[ 0]; digest[ 1] = ipad[ 1]; @@ -161,6 +158,14 @@ __kernel void m06233_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i]; } + barrier (CLK_LOCAL_MEM_FENCE); + + /** + * Whirlpool shared + */ + + #ifdef REAL_SHM + __local u32 s_Ch[8][256]; __local u32 s_Cl[8][256]; @@ -187,6 +192,13 @@ __kernel void m06233_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) barrier (CLK_LOCAL_MEM_FENCE); + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + if (gid >= gid_max) return; /** @@ -357,16 +369,14 @@ __kernel void m06233_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) __kernel void m06233_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) { /** - * modifier + * Whirlpool shared */ const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); const u64 lsz = get_local_size (0); - /** - * shared - */ + #ifdef REAL_SHM __local u32 s_Ch[8][256]; __local u32 s_Cl[8][256]; @@ -394,6 +404,13 @@ __kernel void m06233_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) barrier (CLK_LOCAL_MEM_FENCE); + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + if ((gid * VECT_SIZE) >= gid_max) return; u32x ipad[16]; @@ -609,6 +626,45 @@ __kernel void m06233_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) #endif + /** + * Whirlpool shared + */ + + #ifdef REAL_SHM + + __local u32 s_Ch[8][256]; + __local u32 s_Cl[8][256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_Ch[0][i] = Ch[0][i]; + s_Ch[1][i] = Ch[1][i]; + s_Ch[2][i] = Ch[2][i]; + s_Ch[3][i] = Ch[3][i]; + s_Ch[4][i] = Ch[4][i]; + s_Ch[5][i] = Ch[5][i]; + s_Ch[6][i] = Ch[6][i]; + s_Ch[7][i] = Ch[7][i]; + + s_Cl[0][i] = Cl[0][i]; + s_Cl[1][i] = Cl[1][i]; + s_Cl[2][i] = Cl[2][i]; + s_Cl[3][i] = Cl[3][i]; + s_Cl[4][i] = Cl[4][i]; + s_Cl[5][i] = Cl[5][i]; + s_Cl[6][i] = Cl[6][i]; + s_Cl[7][i] = Cl[7][i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + if (gid >= gid_max) return; u32 ukey1[8]; @@ -633,43 +689,27 @@ __kernel void m06233_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey2[6] = swap32_S (tmps[gid].out[14]); ukey2[7] = swap32_S (tmps[gid].out[15]); - if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1) + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } @@ -695,59 +735,27 @@ __kernel void m06233_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey4[6] = swap32_S (tmps[gid].out[30]); ukey4[7] = swap32_S (tmps[gid].out[31]); - if (verify_header_aes_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_serpent_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) + if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_camellia_kuznyechik (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) + if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_camellia_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } @@ -773,27 +781,19 @@ __kernel void m06233_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) ukey6[6] = swap32_S (tmps[gid].out[46]); ukey6[7] = swap32_S (tmps[gid].out[47]); - if (verify_header_aes_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_serpent_twofish_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (verify_header_aes_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } - if (verify_header_kuznyechik_serpent_camellia (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6) == 1) + if (verify_header_serpent_twofish_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m06800-pure.cl b/OpenCL/m06800-pure.cl index eb23a5d00..00daeff7b 100644 --- a/OpenCL/m06800-pure.cl +++ b/OpenCL/m06800-pure.cl @@ -375,7 +375,7 @@ __kernel void m06800_comp (KERN_ATTR_TMPS (lastpass_tmp_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m07500_a0-optimized.cl b/OpenCL/m07500_a0-optimized.cl index 29533e2fc..ee4ade751 100644 --- a/OpenCL/m07500_a0-optimized.cl +++ b/OpenCL/m07500_a0-optimized.cl @@ -486,7 +486,7 @@ __kernel void m07500_m04 (KERN_ATTR_RULES_ESALT (krb5pa_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -592,7 +592,7 @@ __kernel void m07500_s04 (KERN_ATTR_RULES_ESALT (krb5pa_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m07500_a0-pure.cl b/OpenCL/m07500_a0-pure.cl index b60e45c7a..184496f57 100644 --- a/OpenCL/m07500_a0-pure.cl +++ b/OpenCL/m07500_a0-pure.cl @@ -343,7 +343,7 @@ __kernel void m07500_mxx (KERN_ATTR_RULES_ESALT (krb5pa_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -414,7 +414,7 @@ __kernel void m07500_sxx (KERN_ATTR_RULES_ESALT (krb5pa_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m07500_a1-optimized.cl b/OpenCL/m07500_a1-optimized.cl index 3b16baa30..620d344b3 100644 --- a/OpenCL/m07500_a1-optimized.cl +++ b/OpenCL/m07500_a1-optimized.cl @@ -534,7 +534,7 @@ __kernel void m07500_m04 (KERN_ATTR_ESALT (krb5pa_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -690,7 +690,7 @@ __kernel void m07500_s04 (KERN_ATTR_ESALT (krb5pa_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m07500_a1-pure.cl b/OpenCL/m07500_a1-pure.cl index 4fc4c6859..f24d1595f 100644 --- a/OpenCL/m07500_a1-pure.cl +++ b/OpenCL/m07500_a1-pure.cl @@ -339,7 +339,7 @@ __kernel void m07500_mxx (KERN_ATTR_ESALT (krb5pa_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -408,7 +408,7 @@ __kernel void m07500_sxx (KERN_ATTR_ESALT (krb5pa_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m07500_a3-optimized.cl b/OpenCL/m07500_a3-optimized.cl index 975335dd0..6d6dbeb92 100644 --- a/OpenCL/m07500_a3-optimized.cl +++ b/OpenCL/m07500_a3-optimized.cl @@ -476,7 +476,7 @@ DECLSPEC void m07500 (__local RC4_KEY *rc4_key, u32 *w0, u32 *w1, u32 *w2, u32 * { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m07500_a3-pure.cl b/OpenCL/m07500_a3-pure.cl index 80aa58073..e610b1eac 100644 --- a/OpenCL/m07500_a3-pure.cl +++ b/OpenCL/m07500_a3-pure.cl @@ -364,7 +364,7 @@ __kernel void m07500_mxx (KERN_ATTR_VECTOR_ESALT (krb5pa_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -458,7 +458,7 @@ __kernel void m07500_sxx (KERN_ATTR_VECTOR_ESALT (krb5pa_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m08800-pure.cl b/OpenCL/m08800-pure.cl index 8a042a542..91db82eb2 100644 --- a/OpenCL/m08800-pure.cl +++ b/OpenCL/m08800-pure.cl @@ -416,7 +416,7 @@ __kernel void m08800_comp (KERN_ATTR_TMPS_ESALT (androidfde_tmp_t, androidfde_t) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, 0, 0, 0); } } } @@ -475,7 +475,7 @@ __kernel void m08800_comp (KERN_ATTR_TMPS_ESALT (androidfde_tmp_t, androidfde_t) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m11300-pure.cl b/OpenCL/m11300-pure.cl index 309ec370a..43bd8d93f 100644 --- a/OpenCL/m11300-pure.cl +++ b/OpenCL/m11300-pure.cl @@ -353,7 +353,7 @@ __kernel void m11300_comp (KERN_ATTR_TMPS_ESALT (bitcoin_wallet_tmp_t, bitcoin_w { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m11600-pure.cl b/OpenCL/m11600-pure.cl index 71e8a41c2..dc4b7bb93 100644 --- a/OpenCL/m11600-pure.cl +++ b/OpenCL/m11600-pure.cl @@ -346,7 +346,7 @@ __kernel void m11600_comp (KERN_ATTR_TMPS_HOOKS (seven_zip_tmp_t, seven_zip_hook { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, 0, 0, 0); } return; diff --git a/OpenCL/m13100_a0-optimized.cl b/OpenCL/m13100_a0-optimized.cl index 4bd700c23..9e42b7ba6 100644 --- a/OpenCL/m13100_a0-optimized.cl +++ b/OpenCL/m13100_a0-optimized.cl @@ -658,7 +658,7 @@ __kernel void m13100_m04 (KERN_ATTR_RULES_ESALT (krb5tgs_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -756,7 +756,7 @@ __kernel void m13100_s04 (KERN_ATTR_RULES_ESALT (krb5tgs_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m13100_a0-pure.cl b/OpenCL/m13100_a0-pure.cl index 06a6c88cc..88bd97c56 100644 --- a/OpenCL/m13100_a0-pure.cl +++ b/OpenCL/m13100_a0-pure.cl @@ -442,7 +442,7 @@ __kernel void m13100_mxx (KERN_ATTR_RULES_ESALT (krb5tgs_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -504,7 +504,7 @@ __kernel void m13100_sxx (KERN_ATTR_RULES_ESALT (krb5tgs_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m13100_a1-optimized.cl b/OpenCL/m13100_a1-optimized.cl index dcc2c383e..bab4b12f2 100644 --- a/OpenCL/m13100_a1-optimized.cl +++ b/OpenCL/m13100_a1-optimized.cl @@ -705,7 +705,7 @@ __kernel void m13100_m04 (KERN_ATTR_ESALT (krb5tgs_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -852,7 +852,7 @@ __kernel void m13100_s04 (KERN_ATTR_ESALT (krb5tgs_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m13100_a1-pure.cl b/OpenCL/m13100_a1-pure.cl index 839ed2a7c..017f98fea 100644 --- a/OpenCL/m13100_a1-pure.cl +++ b/OpenCL/m13100_a1-pure.cl @@ -438,7 +438,7 @@ __kernel void m13100_mxx (KERN_ATTR_ESALT (krb5tgs_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -498,7 +498,7 @@ __kernel void m13100_sxx (KERN_ATTR_ESALT (krb5tgs_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m13100_a3-optimized.cl b/OpenCL/m13100_a3-optimized.cl index 6bb90d6dc..22b6f9214 100644 --- a/OpenCL/m13100_a3-optimized.cl +++ b/OpenCL/m13100_a3-optimized.cl @@ -625,7 +625,7 @@ DECLSPEC void m13100 (__local RC4_KEY *rc4_key, u32 *w0, u32 *w1, u32 *w2, u32 * { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m13100_a3-pure.cl b/OpenCL/m13100_a3-pure.cl index 404e908f0..738d92dab 100644 --- a/OpenCL/m13100_a3-pure.cl +++ b/OpenCL/m13100_a3-pure.cl @@ -451,7 +451,7 @@ __kernel void m13100_mxx (KERN_ATTR_VECTOR_ESALT (krb5tgs_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -524,7 +524,7 @@ __kernel void m13100_sxx (KERN_ATTR_VECTOR_ESALT (krb5tgs_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m13200-pure.cl b/OpenCL/m13200-pure.cl index 066f5aeaa..d88e36e8b 100644 --- a/OpenCL/m13200-pure.cl +++ b/OpenCL/m13200-pure.cl @@ -228,7 +228,7 @@ __kernel void m13200_comp (KERN_ATTR_TMPS (axcrypt_tmp_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m13711-pure.cl b/OpenCL/m13711-pure.cl new file mode 100644 index 000000000..664a9d2a7 --- /dev/null +++ b/OpenCL/m13711-pure.cl @@ -0,0 +1,513 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#undef LOCAL_MEM_TYPE +#define LOCAL_MEM_TYPE LOCAL_MEM_TYPE_GLOBAL + +#include "inc_vendor.cl" +#include "inc_hash_constants.h" +#include "inc_hash_functions.cl" +#include "inc_types.cl" +#include "inc_common.cl" +#include "inc_simd.cl" +#include "inc_hash_ripemd160.cl" + +#include "inc_cipher_aes.cl" +#include "inc_cipher_twofish.cl" +#include "inc_cipher_serpent.cl" +#include "inc_cipher_camellia.cl" +#include "inc_cipher_kuznyechik.cl" + +typedef struct vc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; + +#include "inc_truecrypt_keyfile.cl" +#include "inc_truecrypt_crc32.cl" +#include "inc_truecrypt_xts.cl" +#include "inc_veracrypt_xts.cl" + +typedef struct vc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + + u32 pim_key[64]; + int pim; // marker for cracked + +} vc_tmp_t; + +DECLSPEC int check_header_0512 (__global const vc_t *esalt_bufs, __global u32 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + + key1[0] = key[ 0]; + key1[1] = key[ 1]; + key1[2] = key[ 2]; + key1[3] = key[ 3]; + key1[4] = key[ 4]; + key1[5] = key[ 5]; + key1[6] = key[ 6]; + key1[7] = key[ 7]; + key2[0] = key[ 8]; + key2[1] = key[ 9]; + key2[2] = key[10]; + key2[3] = key[11]; + key2[4] = key[12]; + key2[5] = key[13]; + key2[6] = key[14]; + key2[7] = key[15]; + + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + + return -1; +} + +DECLSPEC void hmac_ripemd160_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest) +{ + digest[0] = ipad[0]; + digest[1] = ipad[1]; + digest[2] = ipad[2]; + digest[3] = ipad[3]; + digest[4] = ipad[4]; + + ripemd160_transform_vector (w0, w1, w2, w3, digest); + + w0[0] = digest[0]; + w0[1] = digest[1]; + w0[2] = digest[2]; + w0[3] = digest[3]; + w1[0] = digest[4]; + w1[1] = 0x80; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = (64 + 20) * 8; + w3[3] = 0; + + digest[0] = opad[0]; + digest[1] = opad[1]; + digest[2] = opad[2]; + digest[3] = opad[3]; + digest[4] = opad[4]; + + ripemd160_transform_vector (w0, w1, w2, w3, digest); +} + +__kernel void m13711_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * keyboard layout shared + */ + + const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt; + + __local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + if (gid >= gid_max) return; + + /** + * base + */ + + u32 w0[4]; + u32 w1[4]; + u32 w2[4]; + u32 w3[4]; + + w0[0] = pws[gid].i[ 0]; + w0[1] = pws[gid].i[ 1]; + w0[2] = pws[gid].i[ 2]; + w0[3] = pws[gid].i[ 3]; + w1[0] = pws[gid].i[ 4]; + w1[1] = pws[gid].i[ 5]; + w1[2] = pws[gid].i[ 6]; + w1[3] = pws[gid].i[ 7]; + w2[0] = pws[gid].i[ 8]; + w2[1] = pws[gid].i[ 9]; + w2[2] = pws[gid].i[10]; + w2[3] = pws[gid].i[11]; + w3[0] = pws[gid].i[12]; + w3[1] = pws[gid].i[13]; + w3[2] = pws[gid].i[14]; + w3[3] = pws[gid].i[15]; + + const u32 pw_len = pws[gid].pw_len; + + execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); + + w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]); + w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]); + w0[2] = u8add (w0[2], esalt_bufs[digests_offset].keyfile_buf[ 2]); + w0[3] = u8add (w0[3], esalt_bufs[digests_offset].keyfile_buf[ 3]); + w1[0] = u8add (w1[0], esalt_bufs[digests_offset].keyfile_buf[ 4]); + w1[1] = u8add (w1[1], esalt_bufs[digests_offset].keyfile_buf[ 5]); + w1[2] = u8add (w1[2], esalt_bufs[digests_offset].keyfile_buf[ 6]); + w1[3] = u8add (w1[3], esalt_bufs[digests_offset].keyfile_buf[ 7]); + w2[0] = u8add (w2[0], esalt_bufs[digests_offset].keyfile_buf[ 8]); + w2[1] = u8add (w2[1], esalt_bufs[digests_offset].keyfile_buf[ 9]); + w2[2] = u8add (w2[2], esalt_bufs[digests_offset].keyfile_buf[10]); + w2[3] = u8add (w2[3], esalt_bufs[digests_offset].keyfile_buf[11]); + w3[0] = u8add (w3[0], esalt_bufs[digests_offset].keyfile_buf[12]); + w3[1] = u8add (w3[1], esalt_bufs[digests_offset].keyfile_buf[13]); + w3[2] = u8add (w3[2], esalt_bufs[digests_offset].keyfile_buf[14]); + w3[3] = u8add (w3[3], esalt_bufs[digests_offset].keyfile_buf[15]); + + ripemd160_hmac_ctx_t ripemd160_hmac_ctx; + + ripemd160_hmac_init_64 (&ripemd160_hmac_ctx, w0, w1, w2, w3); + + tmps[gid].ipad[0] = ripemd160_hmac_ctx.ipad.h[0]; + tmps[gid].ipad[1] = ripemd160_hmac_ctx.ipad.h[1]; + tmps[gid].ipad[2] = ripemd160_hmac_ctx.ipad.h[2]; + tmps[gid].ipad[3] = ripemd160_hmac_ctx.ipad.h[3]; + tmps[gid].ipad[4] = ripemd160_hmac_ctx.ipad.h[4]; + + tmps[gid].opad[0] = ripemd160_hmac_ctx.opad.h[0]; + tmps[gid].opad[1] = ripemd160_hmac_ctx.opad.h[1]; + tmps[gid].opad[2] = ripemd160_hmac_ctx.opad.h[2]; + tmps[gid].opad[3] = ripemd160_hmac_ctx.opad.h[3]; + tmps[gid].opad[4] = ripemd160_hmac_ctx.opad.h[4]; + + ripemd160_hmac_update_global (&ripemd160_hmac_ctx, esalt_bufs[digests_offset].salt_buf, 64); + + for (u32 i = 0, j = 1; i < 16; i += 5, j += 1) + { + ripemd160_hmac_ctx_t ripemd160_hmac_ctx2 = ripemd160_hmac_ctx; + + w0[0] = j << 24; + w0[1] = 0; + w0[2] = 0; + w0[3] = 0; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; + + ripemd160_hmac_update_64 (&ripemd160_hmac_ctx2, w0, w1, w2, w3, 4); + + ripemd160_hmac_final (&ripemd160_hmac_ctx2); + + tmps[gid].dgst[i + 0] = ripemd160_hmac_ctx2.opad.h[0]; + tmps[gid].dgst[i + 1] = ripemd160_hmac_ctx2.opad.h[1]; + tmps[gid].dgst[i + 2] = ripemd160_hmac_ctx2.opad.h[2]; + tmps[gid].dgst[i + 3] = ripemd160_hmac_ctx2.opad.h[3]; + tmps[gid].dgst[i + 4] = ripemd160_hmac_ctx2.opad.h[4]; + + tmps[gid].out[i + 0] = tmps[gid].dgst[i + 0]; + tmps[gid].out[i + 1] = tmps[gid].dgst[i + 1]; + tmps[gid].out[i + 2] = tmps[gid].dgst[i + 2]; + tmps[gid].out[i + 3] = tmps[gid].dgst[i + 3]; + tmps[gid].out[i + 4] = tmps[gid].dgst[i + 4]; + } +} + +__kernel void m13711_loop (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * aes shared + */ + + #ifdef REAL_SHM + + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + + #endif + + if (gid >= gid_max) return; + + // this is the pim range check + // it is guaranteed that only 0 or 1 innerloops will match a "pim" mark (each 1000 iterations) + // therefore the module limits the inner loop iteration count to 1000 + // if the key_pim is set, we know that we have to save and check the key for this pim + + const int pim_multi = esalt_bufs[digests_offset].pim_multi; + const int pim_start = esalt_bufs[digests_offset].pim_start; + const int pim_stop = esalt_bufs[digests_offset].pim_stop; + + int pim = 0; + int pim_at = 0; + + for (u32 j = 0; j < loop_cnt; j++) + { + const int iter_abs = 1 + loop_pos + j; + + if ((iter_abs % pim_multi) == pim_multi - 1) + { + const int pim_cur = (iter_abs / pim_multi) + 1; + + if ((pim_cur >= pim_start) && (pim_cur <= pim_stop)) + { + pim = pim_cur; + + pim_at = j; + } + } + } + + // irregular pbkdf2 from here + + u32x ipad[5]; + u32x opad[5]; + + ipad[0] = packv (tmps, ipad, gid, 0); + ipad[1] = packv (tmps, ipad, gid, 1); + ipad[2] = packv (tmps, ipad, gid, 2); + ipad[3] = packv (tmps, ipad, gid, 3); + ipad[4] = packv (tmps, ipad, gid, 4); + + opad[0] = packv (tmps, opad, gid, 0); + opad[1] = packv (tmps, opad, gid, 1); + opad[2] = packv (tmps, opad, gid, 2); + opad[3] = packv (tmps, opad, gid, 3); + opad[4] = packv (tmps, opad, gid, 4); + + for (u32 i = 0; i < 16; i += 5) + { + u32x dgst[5]; + u32x out[5]; + + dgst[0] = packv (tmps, dgst, gid, i + 0); + dgst[1] = packv (tmps, dgst, gid, i + 1); + dgst[2] = packv (tmps, dgst, gid, i + 2); + dgst[3] = packv (tmps, dgst, gid, i + 3); + dgst[4] = packv (tmps, dgst, gid, i + 4); + + out[0] = packv (tmps, out, gid, i + 0); + out[1] = packv (tmps, out, gid, i + 1); + out[2] = packv (tmps, out, gid, i + 2); + out[3] = packv (tmps, out, gid, i + 3); + out[4] = packv (tmps, out, gid, i + 4); + + for (u32 j = 0; j < loop_cnt; j++) + { + u32x w0[4]; + u32x w1[4]; + u32x w2[4]; + u32x w3[4]; + + w0[0] = dgst[0]; + w0[1] = dgst[1]; + w0[2] = dgst[2]; + w0[3] = dgst[3]; + w1[0] = dgst[4]; + w1[1] = 0x80; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = (64 + 20) * 8; + w3[3] = 0; + + hmac_ripemd160_run_V (w0, w1, w2, w3, ipad, opad, dgst); + + out[0] ^= dgst[0]; + out[1] ^= dgst[1]; + out[2] ^= dgst[2]; + out[3] ^= dgst[3]; + out[4] ^= dgst[4]; + + // this iteration creates a valid pim + + if (j == pim_at) + { + tmps[gid].pim_key[i + 0] = out[0]; + tmps[gid].pim_key[i + 1] = out[1]; + tmps[gid].pim_key[i + 2] = out[2]; + tmps[gid].pim_key[i + 3] = out[3]; + tmps[gid].pim_key[i + 4] = out[4]; + } + } + + unpackv (tmps, dgst, gid, i + 0, dgst[0]); + unpackv (tmps, dgst, gid, i + 1, dgst[1]); + unpackv (tmps, dgst, gid, i + 2, dgst[2]); + unpackv (tmps, dgst, gid, i + 3, dgst[3]); + unpackv (tmps, dgst, gid, i + 4, dgst[4]); + + unpackv (tmps, out, gid, i + 0, out[0]); + unpackv (tmps, out, gid, i + 1, out[1]); + unpackv (tmps, out, gid, i + 2, out[2]); + unpackv (tmps, out, gid, i + 3, out[3]); + unpackv (tmps, out, gid, i + 4, out[4]); + } + + if (pim == 0) return; + + if (check_header_0512 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; +} + +__kernel void m13711_comp (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * aes shared + */ + + #ifdef REAL_SHM + + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + + #endif + + if (gid >= gid_max) return; + + if (tmps[gid].pim) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, tmps[gid].pim, 0); + } + } + else + { + if (check_header_0512 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } + } + } +} diff --git a/OpenCL/m13712-pure.cl b/OpenCL/m13712-pure.cl new file mode 100644 index 000000000..6e0760b3c --- /dev/null +++ b/OpenCL/m13712-pure.cl @@ -0,0 +1,573 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#undef LOCAL_MEM_TYPE +#define LOCAL_MEM_TYPE LOCAL_MEM_TYPE_GLOBAL + +#include "inc_vendor.cl" +#include "inc_hash_constants.h" +#include "inc_hash_functions.cl" +#include "inc_types.cl" +#include "inc_common.cl" +#include "inc_simd.cl" +#include "inc_hash_ripemd160.cl" + +#include "inc_cipher_aes.cl" +#include "inc_cipher_twofish.cl" +#include "inc_cipher_serpent.cl" +#include "inc_cipher_camellia.cl" +#include "inc_cipher_kuznyechik.cl" + +typedef struct vc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; + +#include "inc_truecrypt_keyfile.cl" +#include "inc_truecrypt_crc32.cl" +#include "inc_truecrypt_xts.cl" +#include "inc_veracrypt_xts.cl" + +typedef struct vc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + + u32 pim_key[64]; + int pim; // marker for cracked + +} vc_tmp_t; + +DECLSPEC int check_header_0512 (__global const vc_t *esalt_bufs, __global u32 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + + key1[0] = key[ 0]; + key1[1] = key[ 1]; + key1[2] = key[ 2]; + key1[3] = key[ 3]; + key1[4] = key[ 4]; + key1[5] = key[ 5]; + key1[6] = key[ 6]; + key1[7] = key[ 7]; + key2[0] = key[ 8]; + key2[1] = key[ 9]; + key2[2] = key[10]; + key2[3] = key[11]; + key2[4] = key[12]; + key2[5] = key[13]; + key2[6] = key[14]; + key2[7] = key[15]; + + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + + return -1; +} + +DECLSPEC int check_header_1024 (__global const vc_t *esalt_bufs, __global u32 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + u32 key3[8]; + u32 key4[8]; + + key1[0] = key[ 0]; + key1[1] = key[ 1]; + key1[2] = key[ 2]; + key1[3] = key[ 3]; + key1[4] = key[ 4]; + key1[5] = key[ 5]; + key1[6] = key[ 6]; + key1[7] = key[ 7]; + key2[0] = key[ 8]; + key2[1] = key[ 9]; + key2[2] = key[10]; + key2[3] = key[11]; + key2[4] = key[12]; + key2[5] = key[13]; + key2[6] = key[14]; + key2[7] = key[15]; + key3[0] = key[16]; + key3[1] = key[17]; + key3[2] = key[18]; + key3[3] = key[19]; + key3[4] = key[20]; + key3[5] = key[21]; + key3[6] = key[22]; + key3[7] = key[23]; + key4[0] = key[24]; + key4[1] = key[25]; + key4[2] = key[26]; + key4[3] = key[27]; + key4[4] = key[28]; + key4[5] = key[29]; + key4[6] = key[30]; + key4[7] = key[31]; + + if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_kuznyechik_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + + return -1; +} + +DECLSPEC void hmac_ripemd160_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest) +{ + digest[0] = ipad[0]; + digest[1] = ipad[1]; + digest[2] = ipad[2]; + digest[3] = ipad[3]; + digest[4] = ipad[4]; + + ripemd160_transform_vector (w0, w1, w2, w3, digest); + + w0[0] = digest[0]; + w0[1] = digest[1]; + w0[2] = digest[2]; + w0[3] = digest[3]; + w1[0] = digest[4]; + w1[1] = 0x80; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = (64 + 20) * 8; + w3[3] = 0; + + digest[0] = opad[0]; + digest[1] = opad[1]; + digest[2] = opad[2]; + digest[3] = opad[3]; + digest[4] = opad[4]; + + ripemd160_transform_vector (w0, w1, w2, w3, digest); +} + +__kernel void m13712_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * keyboard layout shared + */ + + const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt; + + __local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + if (gid >= gid_max) return; + + /** + * base + */ + + u32 w0[4]; + u32 w1[4]; + u32 w2[4]; + u32 w3[4]; + + w0[0] = pws[gid].i[ 0]; + w0[1] = pws[gid].i[ 1]; + w0[2] = pws[gid].i[ 2]; + w0[3] = pws[gid].i[ 3]; + w1[0] = pws[gid].i[ 4]; + w1[1] = pws[gid].i[ 5]; + w1[2] = pws[gid].i[ 6]; + w1[3] = pws[gid].i[ 7]; + w2[0] = pws[gid].i[ 8]; + w2[1] = pws[gid].i[ 9]; + w2[2] = pws[gid].i[10]; + w2[3] = pws[gid].i[11]; + w3[0] = pws[gid].i[12]; + w3[1] = pws[gid].i[13]; + w3[2] = pws[gid].i[14]; + w3[3] = pws[gid].i[15]; + + const u32 pw_len = pws[gid].pw_len; + + execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); + + w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]); + w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]); + w0[2] = u8add (w0[2], esalt_bufs[digests_offset].keyfile_buf[ 2]); + w0[3] = u8add (w0[3], esalt_bufs[digests_offset].keyfile_buf[ 3]); + w1[0] = u8add (w1[0], esalt_bufs[digests_offset].keyfile_buf[ 4]); + w1[1] = u8add (w1[1], esalt_bufs[digests_offset].keyfile_buf[ 5]); + w1[2] = u8add (w1[2], esalt_bufs[digests_offset].keyfile_buf[ 6]); + w1[3] = u8add (w1[3], esalt_bufs[digests_offset].keyfile_buf[ 7]); + w2[0] = u8add (w2[0], esalt_bufs[digests_offset].keyfile_buf[ 8]); + w2[1] = u8add (w2[1], esalt_bufs[digests_offset].keyfile_buf[ 9]); + w2[2] = u8add (w2[2], esalt_bufs[digests_offset].keyfile_buf[10]); + w2[3] = u8add (w2[3], esalt_bufs[digests_offset].keyfile_buf[11]); + w3[0] = u8add (w3[0], esalt_bufs[digests_offset].keyfile_buf[12]); + w3[1] = u8add (w3[1], esalt_bufs[digests_offset].keyfile_buf[13]); + w3[2] = u8add (w3[2], esalt_bufs[digests_offset].keyfile_buf[14]); + w3[3] = u8add (w3[3], esalt_bufs[digests_offset].keyfile_buf[15]); + + ripemd160_hmac_ctx_t ripemd160_hmac_ctx; + + ripemd160_hmac_init_64 (&ripemd160_hmac_ctx, w0, w1, w2, w3); + + tmps[gid].ipad[0] = ripemd160_hmac_ctx.ipad.h[0]; + tmps[gid].ipad[1] = ripemd160_hmac_ctx.ipad.h[1]; + tmps[gid].ipad[2] = ripemd160_hmac_ctx.ipad.h[2]; + tmps[gid].ipad[3] = ripemd160_hmac_ctx.ipad.h[3]; + tmps[gid].ipad[4] = ripemd160_hmac_ctx.ipad.h[4]; + + tmps[gid].opad[0] = ripemd160_hmac_ctx.opad.h[0]; + tmps[gid].opad[1] = ripemd160_hmac_ctx.opad.h[1]; + tmps[gid].opad[2] = ripemd160_hmac_ctx.opad.h[2]; + tmps[gid].opad[3] = ripemd160_hmac_ctx.opad.h[3]; + tmps[gid].opad[4] = ripemd160_hmac_ctx.opad.h[4]; + + ripemd160_hmac_update_global (&ripemd160_hmac_ctx, esalt_bufs[digests_offset].salt_buf, 64); + + for (u32 i = 0, j = 1; i < 32; i += 5, j += 1) + { + ripemd160_hmac_ctx_t ripemd160_hmac_ctx2 = ripemd160_hmac_ctx; + + w0[0] = j << 24; + w0[1] = 0; + w0[2] = 0; + w0[3] = 0; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; + + ripemd160_hmac_update_64 (&ripemd160_hmac_ctx2, w0, w1, w2, w3, 4); + + ripemd160_hmac_final (&ripemd160_hmac_ctx2); + + tmps[gid].dgst[i + 0] = ripemd160_hmac_ctx2.opad.h[0]; + tmps[gid].dgst[i + 1] = ripemd160_hmac_ctx2.opad.h[1]; + tmps[gid].dgst[i + 2] = ripemd160_hmac_ctx2.opad.h[2]; + tmps[gid].dgst[i + 3] = ripemd160_hmac_ctx2.opad.h[3]; + tmps[gid].dgst[i + 4] = ripemd160_hmac_ctx2.opad.h[4]; + + tmps[gid].out[i + 0] = tmps[gid].dgst[i + 0]; + tmps[gid].out[i + 1] = tmps[gid].dgst[i + 1]; + tmps[gid].out[i + 2] = tmps[gid].dgst[i + 2]; + tmps[gid].out[i + 3] = tmps[gid].dgst[i + 3]; + tmps[gid].out[i + 4] = tmps[gid].dgst[i + 4]; + } +} + +__kernel void m13712_loop (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * aes shared + */ + + #ifdef REAL_SHM + + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + + #endif + + if (gid >= gid_max) return; + + // this is the pim range check + // it is guaranteed that only 0 or 1 innerloops will match a "pim" mark (each 1000 iterations) + // therefore the module limits the inner loop iteration count to 1000 + // if the key_pim is set, we know that we have to save and check the key for this pim + + const int pim_multi = esalt_bufs[digests_offset].pim_multi; + const int pim_start = esalt_bufs[digests_offset].pim_start; + const int pim_stop = esalt_bufs[digests_offset].pim_stop; + + int pim = 0; + int pim_at = 0; + + for (u32 j = 0; j < loop_cnt; j++) + { + const int iter_abs = 1 + loop_pos + j; + + if ((iter_abs % pim_multi) == pim_multi - 1) + { + const int pim_cur = (iter_abs / pim_multi) + 1; + + if ((pim_cur >= pim_start) && (pim_cur <= pim_stop)) + { + pim = pim_cur; + + pim_at = j; + } + } + } + + // irregular pbkdf2 from here + + u32x ipad[5]; + u32x opad[5]; + + ipad[0] = packv (tmps, ipad, gid, 0); + ipad[1] = packv (tmps, ipad, gid, 1); + ipad[2] = packv (tmps, ipad, gid, 2); + ipad[3] = packv (tmps, ipad, gid, 3); + ipad[4] = packv (tmps, ipad, gid, 4); + + opad[0] = packv (tmps, opad, gid, 0); + opad[1] = packv (tmps, opad, gid, 1); + opad[2] = packv (tmps, opad, gid, 2); + opad[3] = packv (tmps, opad, gid, 3); + opad[4] = packv (tmps, opad, gid, 4); + + for (u32 i = 0; i < 32; i += 5) + { + u32x dgst[5]; + u32x out[5]; + + dgst[0] = packv (tmps, dgst, gid, i + 0); + dgst[1] = packv (tmps, dgst, gid, i + 1); + dgst[2] = packv (tmps, dgst, gid, i + 2); + dgst[3] = packv (tmps, dgst, gid, i + 3); + dgst[4] = packv (tmps, dgst, gid, i + 4); + + out[0] = packv (tmps, out, gid, i + 0); + out[1] = packv (tmps, out, gid, i + 1); + out[2] = packv (tmps, out, gid, i + 2); + out[3] = packv (tmps, out, gid, i + 3); + out[4] = packv (tmps, out, gid, i + 4); + + for (u32 j = 0; j < loop_cnt; j++) + { + u32x w0[4]; + u32x w1[4]; + u32x w2[4]; + u32x w3[4]; + + w0[0] = dgst[0]; + w0[1] = dgst[1]; + w0[2] = dgst[2]; + w0[3] = dgst[3]; + w1[0] = dgst[4]; + w1[1] = 0x80; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = (64 + 20) * 8; + w3[3] = 0; + + hmac_ripemd160_run_V (w0, w1, w2, w3, ipad, opad, dgst); + + out[0] ^= dgst[0]; + out[1] ^= dgst[1]; + out[2] ^= dgst[2]; + out[3] ^= dgst[3]; + out[4] ^= dgst[4]; + + // this iteration creates a valid pim + + if (j == pim_at) + { + tmps[gid].pim_key[i + 0] = out[0]; + tmps[gid].pim_key[i + 1] = out[1]; + tmps[gid].pim_key[i + 2] = out[2]; + tmps[gid].pim_key[i + 3] = out[3]; + tmps[gid].pim_key[i + 4] = out[4]; + } + } + + unpackv (tmps, dgst, gid, i + 0, dgst[0]); + unpackv (tmps, dgst, gid, i + 1, dgst[1]); + unpackv (tmps, dgst, gid, i + 2, dgst[2]); + unpackv (tmps, dgst, gid, i + 3, dgst[3]); + unpackv (tmps, dgst, gid, i + 4, dgst[4]); + + unpackv (tmps, out, gid, i + 0, out[0]); + unpackv (tmps, out, gid, i + 1, out[1]); + unpackv (tmps, out, gid, i + 2, out[2]); + unpackv (tmps, out, gid, i + 3, out[3]); + unpackv (tmps, out, gid, i + 4, out[4]); + } + + if (pim == 0) return; + + if (check_header_0512 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; + if (check_header_1024 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; +} + +__kernel void m13712_comp (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * aes shared + */ + + #ifdef REAL_SHM + + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + + #endif + + if (gid >= gid_max) return; + + if (tmps[gid].pim) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, tmps[gid].pim, 0); + } + } + else + { + if (check_header_0512 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } + } + + if (check_header_1024 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } + } + } +} diff --git a/OpenCL/m13713-pure.cl b/OpenCL/m13713-pure.cl new file mode 100644 index 000000000..467c0f8cc --- /dev/null +++ b/OpenCL/m13713-pure.cl @@ -0,0 +1,647 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#undef LOCAL_MEM_TYPE +#define LOCAL_MEM_TYPE LOCAL_MEM_TYPE_GLOBAL + +#include "inc_vendor.cl" +#include "inc_hash_constants.h" +#include "inc_hash_functions.cl" +#include "inc_types.cl" +#include "inc_common.cl" +#include "inc_simd.cl" +#include "inc_hash_ripemd160.cl" + +#include "inc_cipher_aes.cl" +#include "inc_cipher_twofish.cl" +#include "inc_cipher_serpent.cl" +#include "inc_cipher_camellia.cl" +#include "inc_cipher_kuznyechik.cl" + +typedef struct vc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; + +#include "inc_truecrypt_keyfile.cl" +#include "inc_truecrypt_crc32.cl" +#include "inc_truecrypt_xts.cl" +#include "inc_veracrypt_xts.cl" + +typedef struct vc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + + u32 pim_key[64]; + int pim; // marker for cracked + +} vc_tmp_t; + +DECLSPEC int check_header_0512 (__global const vc_t *esalt_bufs, __global u32 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + + key1[0] = key[ 0]; + key1[1] = key[ 1]; + key1[2] = key[ 2]; + key1[3] = key[ 3]; + key1[4] = key[ 4]; + key1[5] = key[ 5]; + key1[6] = key[ 6]; + key1[7] = key[ 7]; + key2[0] = key[ 8]; + key2[1] = key[ 9]; + key2[2] = key[10]; + key2[3] = key[11]; + key2[4] = key[12]; + key2[5] = key[13]; + key2[6] = key[14]; + key2[7] = key[15]; + + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + + return -1; +} + +DECLSPEC int check_header_1024 (__global const vc_t *esalt_bufs, __global u32 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + u32 key3[8]; + u32 key4[8]; + + key1[0] = key[ 0]; + key1[1] = key[ 1]; + key1[2] = key[ 2]; + key1[3] = key[ 3]; + key1[4] = key[ 4]; + key1[5] = key[ 5]; + key1[6] = key[ 6]; + key1[7] = key[ 7]; + key2[0] = key[ 8]; + key2[1] = key[ 9]; + key2[2] = key[10]; + key2[3] = key[11]; + key2[4] = key[12]; + key2[5] = key[13]; + key2[6] = key[14]; + key2[7] = key[15]; + key3[0] = key[16]; + key3[1] = key[17]; + key3[2] = key[18]; + key3[3] = key[19]; + key3[4] = key[20]; + key3[5] = key[21]; + key3[6] = key[22]; + key3[7] = key[23]; + key4[0] = key[24]; + key4[1] = key[25]; + key4[2] = key[26]; + key4[3] = key[27]; + key4[4] = key[28]; + key4[5] = key[29]; + key4[6] = key[30]; + key4[7] = key[31]; + + if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_kuznyechik_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + + return -1; +} + +DECLSPEC int check_header_1536 (__global const vc_t *esalt_bufs, __global u32 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + u32 key3[8]; + u32 key4[8]; + u32 key5[8]; + u32 key6[8]; + + key1[0] = key[ 0]; + key1[1] = key[ 1]; + key1[2] = key[ 2]; + key1[3] = key[ 3]; + key1[4] = key[ 4]; + key1[5] = key[ 5]; + key1[6] = key[ 6]; + key1[7] = key[ 7]; + key2[0] = key[ 8]; + key2[1] = key[ 9]; + key2[2] = key[10]; + key2[3] = key[11]; + key2[4] = key[12]; + key2[5] = key[13]; + key2[6] = key[14]; + key2[7] = key[15]; + key3[0] = key[16]; + key3[1] = key[17]; + key3[2] = key[18]; + key3[3] = key[19]; + key3[4] = key[20]; + key3[5] = key[21]; + key3[6] = key[22]; + key3[7] = key[23]; + key4[0] = key[24]; + key4[1] = key[25]; + key4[2] = key[26]; + key4[3] = key[27]; + key4[4] = key[28]; + key4[5] = key[29]; + key4[6] = key[30]; + key4[7] = key[31]; + key5[0] = key[32]; + key5[1] = key[33]; + key5[2] = key[34]; + key5[3] = key[35]; + key5[4] = key[36]; + key5[5] = key[37]; + key5[6] = key[38]; + key5[7] = key[39]; + key6[0] = key[40]; + key6[1] = key[41]; + key6[2] = key[42]; + key6[3] = key[43]; + key6[4] = key[44]; + key6[5] = key[45]; + key6[6] = key[46]; + key6[7] = key[47]; + + if (verify_header_aes_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, key5, key6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent_twofish_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, key5, key6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_kuznyechik_serpent_camellia (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, key5, key6) == 1) return 0; + + return -1; +} + +DECLSPEC void hmac_ripemd160_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest) +{ + digest[0] = ipad[0]; + digest[1] = ipad[1]; + digest[2] = ipad[2]; + digest[3] = ipad[3]; + digest[4] = ipad[4]; + + ripemd160_transform_vector (w0, w1, w2, w3, digest); + + w0[0] = digest[0]; + w0[1] = digest[1]; + w0[2] = digest[2]; + w0[3] = digest[3]; + w1[0] = digest[4]; + w1[1] = 0x80; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = (64 + 20) * 8; + w3[3] = 0; + + digest[0] = opad[0]; + digest[1] = opad[1]; + digest[2] = opad[2]; + digest[3] = opad[3]; + digest[4] = opad[4]; + + ripemd160_transform_vector (w0, w1, w2, w3, digest); +} + +__kernel void m13713_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * keyboard layout shared + */ + + const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt; + + __local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + if (gid >= gid_max) return; + + /** + * base + */ + + u32 w0[4]; + u32 w1[4]; + u32 w2[4]; + u32 w3[4]; + + w0[0] = pws[gid].i[ 0]; + w0[1] = pws[gid].i[ 1]; + w0[2] = pws[gid].i[ 2]; + w0[3] = pws[gid].i[ 3]; + w1[0] = pws[gid].i[ 4]; + w1[1] = pws[gid].i[ 5]; + w1[2] = pws[gid].i[ 6]; + w1[3] = pws[gid].i[ 7]; + w2[0] = pws[gid].i[ 8]; + w2[1] = pws[gid].i[ 9]; + w2[2] = pws[gid].i[10]; + w2[3] = pws[gid].i[11]; + w3[0] = pws[gid].i[12]; + w3[1] = pws[gid].i[13]; + w3[2] = pws[gid].i[14]; + w3[3] = pws[gid].i[15]; + + const u32 pw_len = pws[gid].pw_len; + + execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); + + w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]); + w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]); + w0[2] = u8add (w0[2], esalt_bufs[digests_offset].keyfile_buf[ 2]); + w0[3] = u8add (w0[3], esalt_bufs[digests_offset].keyfile_buf[ 3]); + w1[0] = u8add (w1[0], esalt_bufs[digests_offset].keyfile_buf[ 4]); + w1[1] = u8add (w1[1], esalt_bufs[digests_offset].keyfile_buf[ 5]); + w1[2] = u8add (w1[2], esalt_bufs[digests_offset].keyfile_buf[ 6]); + w1[3] = u8add (w1[3], esalt_bufs[digests_offset].keyfile_buf[ 7]); + w2[0] = u8add (w2[0], esalt_bufs[digests_offset].keyfile_buf[ 8]); + w2[1] = u8add (w2[1], esalt_bufs[digests_offset].keyfile_buf[ 9]); + w2[2] = u8add (w2[2], esalt_bufs[digests_offset].keyfile_buf[10]); + w2[3] = u8add (w2[3], esalt_bufs[digests_offset].keyfile_buf[11]); + w3[0] = u8add (w3[0], esalt_bufs[digests_offset].keyfile_buf[12]); + w3[1] = u8add (w3[1], esalt_bufs[digests_offset].keyfile_buf[13]); + w3[2] = u8add (w3[2], esalt_bufs[digests_offset].keyfile_buf[14]); + w3[3] = u8add (w3[3], esalt_bufs[digests_offset].keyfile_buf[15]); + + ripemd160_hmac_ctx_t ripemd160_hmac_ctx; + + ripemd160_hmac_init_64 (&ripemd160_hmac_ctx, w0, w1, w2, w3); + + tmps[gid].ipad[0] = ripemd160_hmac_ctx.ipad.h[0]; + tmps[gid].ipad[1] = ripemd160_hmac_ctx.ipad.h[1]; + tmps[gid].ipad[2] = ripemd160_hmac_ctx.ipad.h[2]; + tmps[gid].ipad[3] = ripemd160_hmac_ctx.ipad.h[3]; + tmps[gid].ipad[4] = ripemd160_hmac_ctx.ipad.h[4]; + + tmps[gid].opad[0] = ripemd160_hmac_ctx.opad.h[0]; + tmps[gid].opad[1] = ripemd160_hmac_ctx.opad.h[1]; + tmps[gid].opad[2] = ripemd160_hmac_ctx.opad.h[2]; + tmps[gid].opad[3] = ripemd160_hmac_ctx.opad.h[3]; + tmps[gid].opad[4] = ripemd160_hmac_ctx.opad.h[4]; + + ripemd160_hmac_update_global (&ripemd160_hmac_ctx, esalt_bufs[digests_offset].salt_buf, 64); + + for (u32 i = 0, j = 1; i < 48; i += 5, j += 1) + { + ripemd160_hmac_ctx_t ripemd160_hmac_ctx2 = ripemd160_hmac_ctx; + + w0[0] = j << 24; + w0[1] = 0; + w0[2] = 0; + w0[3] = 0; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; + + ripemd160_hmac_update_64 (&ripemd160_hmac_ctx2, w0, w1, w2, w3, 4); + + ripemd160_hmac_final (&ripemd160_hmac_ctx2); + + tmps[gid].dgst[i + 0] = ripemd160_hmac_ctx2.opad.h[0]; + tmps[gid].dgst[i + 1] = ripemd160_hmac_ctx2.opad.h[1]; + tmps[gid].dgst[i + 2] = ripemd160_hmac_ctx2.opad.h[2]; + tmps[gid].dgst[i + 3] = ripemd160_hmac_ctx2.opad.h[3]; + tmps[gid].dgst[i + 4] = ripemd160_hmac_ctx2.opad.h[4]; + + tmps[gid].out[i + 0] = tmps[gid].dgst[i + 0]; + tmps[gid].out[i + 1] = tmps[gid].dgst[i + 1]; + tmps[gid].out[i + 2] = tmps[gid].dgst[i + 2]; + tmps[gid].out[i + 3] = tmps[gid].dgst[i + 3]; + tmps[gid].out[i + 4] = tmps[gid].dgst[i + 4]; + } +} + +__kernel void m13713_loop (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * aes shared + */ + + #ifdef REAL_SHM + + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + + #endif + + if (gid >= gid_max) return; + + // this is the pim range check + // it is guaranteed that only 0 or 1 innerloops will match a "pim" mark (each 1000 iterations) + // therefore the module limits the inner loop iteration count to 1000 + // if the key_pim is set, we know that we have to save and check the key for this pim + + const int pim_multi = esalt_bufs[digests_offset].pim_multi; + const int pim_start = esalt_bufs[digests_offset].pim_start; + const int pim_stop = esalt_bufs[digests_offset].pim_stop; + + int pim = 0; + int pim_at = 0; + + for (u32 j = 0; j < loop_cnt; j++) + { + const int iter_abs = 1 + loop_pos + j; + + if ((iter_abs % pim_multi) == pim_multi - 1) + { + const int pim_cur = (iter_abs / pim_multi) + 1; + + if ((pim_cur >= pim_start) && (pim_cur <= pim_stop)) + { + pim = pim_cur; + + pim_at = j; + } + } + } + + // irregular pbkdf2 from here + + u32x ipad[5]; + u32x opad[5]; + + ipad[0] = packv (tmps, ipad, gid, 0); + ipad[1] = packv (tmps, ipad, gid, 1); + ipad[2] = packv (tmps, ipad, gid, 2); + ipad[3] = packv (tmps, ipad, gid, 3); + ipad[4] = packv (tmps, ipad, gid, 4); + + opad[0] = packv (tmps, opad, gid, 0); + opad[1] = packv (tmps, opad, gid, 1); + opad[2] = packv (tmps, opad, gid, 2); + opad[3] = packv (tmps, opad, gid, 3); + opad[4] = packv (tmps, opad, gid, 4); + + for (u32 i = 0; i < 48; i += 5) + { + u32x dgst[5]; + u32x out[5]; + + dgst[0] = packv (tmps, dgst, gid, i + 0); + dgst[1] = packv (tmps, dgst, gid, i + 1); + dgst[2] = packv (tmps, dgst, gid, i + 2); + dgst[3] = packv (tmps, dgst, gid, i + 3); + dgst[4] = packv (tmps, dgst, gid, i + 4); + + out[0] = packv (tmps, out, gid, i + 0); + out[1] = packv (tmps, out, gid, i + 1); + out[2] = packv (tmps, out, gid, i + 2); + out[3] = packv (tmps, out, gid, i + 3); + out[4] = packv (tmps, out, gid, i + 4); + + for (u32 j = 0; j < loop_cnt; j++) + { + u32x w0[4]; + u32x w1[4]; + u32x w2[4]; + u32x w3[4]; + + w0[0] = dgst[0]; + w0[1] = dgst[1]; + w0[2] = dgst[2]; + w0[3] = dgst[3]; + w1[0] = dgst[4]; + w1[1] = 0x80; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = (64 + 20) * 8; + w3[3] = 0; + + hmac_ripemd160_run_V (w0, w1, w2, w3, ipad, opad, dgst); + + out[0] ^= dgst[0]; + out[1] ^= dgst[1]; + out[2] ^= dgst[2]; + out[3] ^= dgst[3]; + out[4] ^= dgst[4]; + + // this iteration creates a valid pim + + if (j == pim_at) + { + tmps[gid].pim_key[i + 0] = out[0]; + tmps[gid].pim_key[i + 1] = out[1]; + tmps[gid].pim_key[i + 2] = out[2]; + tmps[gid].pim_key[i + 3] = out[3]; + tmps[gid].pim_key[i + 4] = out[4]; + } + } + + unpackv (tmps, dgst, gid, i + 0, dgst[0]); + unpackv (tmps, dgst, gid, i + 1, dgst[1]); + unpackv (tmps, dgst, gid, i + 2, dgst[2]); + unpackv (tmps, dgst, gid, i + 3, dgst[3]); + unpackv (tmps, dgst, gid, i + 4, dgst[4]); + + unpackv (tmps, out, gid, i + 0, out[0]); + unpackv (tmps, out, gid, i + 1, out[1]); + unpackv (tmps, out, gid, i + 2, out[2]); + unpackv (tmps, out, gid, i + 3, out[3]); + unpackv (tmps, out, gid, i + 4, out[4]); + } + + if (pim == 0) return; + + if (check_header_0512 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; + if (check_header_1024 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; + if (check_header_1536 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; +} + +__kernel void m13713_comp (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * aes shared + */ + + #ifdef REAL_SHM + + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + + #endif + + if (gid >= gid_max) return; + + if (tmps[gid].pim) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, tmps[gid].pim, 0); + } + } + else + { + if (check_header_0512 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } + } + + if (check_header_1024 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } + } + + if (check_header_1536 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } + } + } +} diff --git a/OpenCL/m13721-pure.cl b/OpenCL/m13721-pure.cl new file mode 100644 index 000000000..04c371f65 --- /dev/null +++ b/OpenCL/m13721-pure.cl @@ -0,0 +1,660 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#undef LOCAL_MEM_TYPE +#define LOCAL_MEM_TYPE LOCAL_MEM_TYPE_GLOBAL + +#include "inc_vendor.cl" +#include "inc_hash_constants.h" +#include "inc_hash_functions.cl" +#include "inc_types.cl" +#include "inc_common.cl" +#include "inc_simd.cl" +#include "inc_hash_sha512.cl" + +#include "inc_cipher_aes.cl" +#include "inc_cipher_twofish.cl" +#include "inc_cipher_serpent.cl" +#include "inc_cipher_camellia.cl" +#include "inc_cipher_kuznyechik.cl" + +typedef struct vc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; + +#include "inc_truecrypt_keyfile.cl" +#include "inc_truecrypt_crc32.cl" +#include "inc_truecrypt_xts.cl" +#include "inc_veracrypt_xts.cl" + +typedef struct vc64_tmp +{ + u64 ipad[8]; + u64 opad[8]; + + u64 dgst[32]; + u64 out[32]; + + u64 pim_key[32]; + int pim; // marker for cracked + +} vc64_tmp_t; + +DECLSPEC int check_header_0512 (__global const vc_t *esalt_bufs, __global u64 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + + key1[0] = swap32_S (h32_from_64_S (key[0])); + key1[1] = swap32_S (l32_from_64_S (key[0])); + key1[2] = swap32_S (h32_from_64_S (key[1])); + key1[3] = swap32_S (l32_from_64_S (key[1])); + key1[4] = swap32_S (h32_from_64_S (key[2])); + key1[5] = swap32_S (l32_from_64_S (key[2])); + key1[6] = swap32_S (h32_from_64_S (key[3])); + key1[7] = swap32_S (l32_from_64_S (key[3])); + key2[0] = swap32_S (h32_from_64_S (key[4])); + key2[1] = swap32_S (l32_from_64_S (key[4])); + key2[2] = swap32_S (h32_from_64_S (key[5])); + key2[3] = swap32_S (l32_from_64_S (key[5])); + key2[4] = swap32_S (h32_from_64_S (key[6])); + key2[5] = swap32_S (l32_from_64_S (key[6])); + key2[6] = swap32_S (h32_from_64_S (key[7])); + key2[7] = swap32_S (l32_from_64_S (key[7])); + + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + + return -1; +} + +DECLSPEC void hmac_sha512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, u64x *ipad, u64x *opad, u64x *digest) +{ + digest[0] = ipad[0]; + digest[1] = ipad[1]; + digest[2] = ipad[2]; + digest[3] = ipad[3]; + digest[4] = ipad[4]; + digest[5] = ipad[5]; + digest[6] = ipad[6]; + digest[7] = ipad[7]; + + sha512_transform_vector (w0, w1, w2, w3, w4, w5, w6, w7, digest); + + w0[0] = h32_from_64 (digest[0]); + w0[1] = l32_from_64 (digest[0]); + w0[2] = h32_from_64 (digest[1]); + w0[3] = l32_from_64 (digest[1]); + w1[0] = h32_from_64 (digest[2]); + w1[1] = l32_from_64 (digest[2]); + w1[2] = h32_from_64 (digest[3]); + w1[3] = l32_from_64 (digest[3]); + w2[0] = h32_from_64 (digest[4]); + w2[1] = l32_from_64 (digest[4]); + w2[2] = h32_from_64 (digest[5]); + w2[3] = l32_from_64 (digest[5]); + w3[0] = h32_from_64 (digest[6]); + w3[1] = l32_from_64 (digest[6]); + w3[2] = h32_from_64 (digest[7]); + w3[3] = l32_from_64 (digest[7]); + w4[0] = 0x80000000; + w4[1] = 0; + w4[2] = 0; + w4[3] = 0; + w5[0] = 0; + w5[1] = 0; + w5[2] = 0; + w5[3] = 0; + w6[0] = 0; + w6[1] = 0; + w6[2] = 0; + w6[3] = 0; + w7[0] = 0; + w7[1] = 0; + w7[2] = 0; + w7[3] = (128 + 64) * 8; + + digest[0] = opad[0]; + digest[1] = opad[1]; + digest[2] = opad[2]; + digest[3] = opad[3]; + digest[4] = opad[4]; + digest[5] = opad[5]; + digest[6] = opad[6]; + digest[7] = opad[7]; + + sha512_transform_vector (w0, w1, w2, w3, w4, w5, w6, w7, digest); +} + +__kernel void m13721_init (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * keyboard layout shared + */ + + const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt; + + __local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + if (gid >= gid_max) return; + + /** + * base + */ + + u32 w0[4]; + u32 w1[4]; + u32 w2[4]; + u32 w3[4]; + u32 w4[4]; + u32 w5[4]; + u32 w6[4]; + u32 w7[4]; + + w0[0] = pws[gid].i[ 0]; + w0[1] = pws[gid].i[ 1]; + w0[2] = pws[gid].i[ 2]; + w0[3] = pws[gid].i[ 3]; + w1[0] = pws[gid].i[ 4]; + w1[1] = pws[gid].i[ 5]; + w1[2] = pws[gid].i[ 6]; + w1[3] = pws[gid].i[ 7]; + w2[0] = pws[gid].i[ 8]; + w2[1] = pws[gid].i[ 9]; + w2[2] = pws[gid].i[10]; + w2[3] = pws[gid].i[11]; + w3[0] = pws[gid].i[12]; + w3[1] = pws[gid].i[13]; + w3[2] = pws[gid].i[14]; + w3[3] = pws[gid].i[15]; + w4[0] = pws[gid].i[16]; + w4[1] = pws[gid].i[17]; + w4[2] = pws[gid].i[18]; + w4[3] = pws[gid].i[19]; + w5[0] = pws[gid].i[20]; + w5[1] = pws[gid].i[21]; + w5[2] = pws[gid].i[22]; + w5[3] = pws[gid].i[23]; + w6[0] = pws[gid].i[24]; + w6[1] = pws[gid].i[25]; + w6[2] = pws[gid].i[26]; + w6[3] = pws[gid].i[27]; + w7[0] = pws[gid].i[28]; + w7[1] = pws[gid].i[29]; + w7[2] = pws[gid].i[30]; + w7[3] = pws[gid].i[31]; + + const u32 pw_len = pws[gid].pw_len; + + execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); + + w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]); + w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]); + w0[2] = u8add (w0[2], esalt_bufs[digests_offset].keyfile_buf[ 2]); + w0[3] = u8add (w0[3], esalt_bufs[digests_offset].keyfile_buf[ 3]); + w1[0] = u8add (w1[0], esalt_bufs[digests_offset].keyfile_buf[ 4]); + w1[1] = u8add (w1[1], esalt_bufs[digests_offset].keyfile_buf[ 5]); + w1[2] = u8add (w1[2], esalt_bufs[digests_offset].keyfile_buf[ 6]); + w1[3] = u8add (w1[3], esalt_bufs[digests_offset].keyfile_buf[ 7]); + w2[0] = u8add (w2[0], esalt_bufs[digests_offset].keyfile_buf[ 8]); + w2[1] = u8add (w2[1], esalt_bufs[digests_offset].keyfile_buf[ 9]); + w2[2] = u8add (w2[2], esalt_bufs[digests_offset].keyfile_buf[10]); + w2[3] = u8add (w2[3], esalt_bufs[digests_offset].keyfile_buf[11]); + w3[0] = u8add (w3[0], esalt_bufs[digests_offset].keyfile_buf[12]); + w3[1] = u8add (w3[1], esalt_bufs[digests_offset].keyfile_buf[13]); + w3[2] = u8add (w3[2], esalt_bufs[digests_offset].keyfile_buf[14]); + w3[3] = u8add (w3[3], esalt_bufs[digests_offset].keyfile_buf[15]); + + w0[0] = swap32_S (w0[0]); + w0[1] = swap32_S (w0[1]); + w0[2] = swap32_S (w0[2]); + w0[3] = swap32_S (w0[3]); + w1[0] = swap32_S (w1[0]); + w1[1] = swap32_S (w1[1]); + w1[2] = swap32_S (w1[2]); + w1[3] = swap32_S (w1[3]); + w2[0] = swap32_S (w2[0]); + w2[1] = swap32_S (w2[1]); + w2[2] = swap32_S (w2[2]); + w2[3] = swap32_S (w2[3]); + w3[0] = swap32_S (w3[0]); + w3[1] = swap32_S (w3[1]); + w3[2] = swap32_S (w3[2]); + w3[3] = swap32_S (w3[3]); + w4[0] = swap32_S (w4[0]); + w4[1] = swap32_S (w4[1]); + w4[2] = swap32_S (w4[2]); + w4[3] = swap32_S (w4[3]); + w5[0] = swap32_S (w5[0]); + w5[1] = swap32_S (w5[1]); + w5[2] = swap32_S (w5[2]); + w5[3] = swap32_S (w5[3]); + w6[0] = swap32_S (w6[0]); + w6[1] = swap32_S (w6[1]); + w6[2] = swap32_S (w6[2]); + w6[3] = swap32_S (w6[3]); + w7[0] = swap32_S (w7[0]); + w7[1] = swap32_S (w7[1]); + w7[2] = swap32_S (w7[2]); + w7[3] = swap32_S (w7[3]); + + sha512_hmac_ctx_t sha512_hmac_ctx; + + sha512_hmac_init_128 (&sha512_hmac_ctx, w0, w1, w2, w3, w5, w5, w6, w7); + + tmps[gid].ipad[0] = sha512_hmac_ctx.ipad.h[0]; + tmps[gid].ipad[1] = sha512_hmac_ctx.ipad.h[1]; + tmps[gid].ipad[2] = sha512_hmac_ctx.ipad.h[2]; + tmps[gid].ipad[3] = sha512_hmac_ctx.ipad.h[3]; + tmps[gid].ipad[4] = sha512_hmac_ctx.ipad.h[4]; + tmps[gid].ipad[5] = sha512_hmac_ctx.ipad.h[5]; + tmps[gid].ipad[6] = sha512_hmac_ctx.ipad.h[6]; + tmps[gid].ipad[7] = sha512_hmac_ctx.ipad.h[7]; + + tmps[gid].opad[0] = sha512_hmac_ctx.opad.h[0]; + tmps[gid].opad[1] = sha512_hmac_ctx.opad.h[1]; + tmps[gid].opad[2] = sha512_hmac_ctx.opad.h[2]; + tmps[gid].opad[3] = sha512_hmac_ctx.opad.h[3]; + tmps[gid].opad[4] = sha512_hmac_ctx.opad.h[4]; + tmps[gid].opad[5] = sha512_hmac_ctx.opad.h[5]; + tmps[gid].opad[6] = sha512_hmac_ctx.opad.h[6]; + tmps[gid].opad[7] = sha512_hmac_ctx.opad.h[7]; + + sha512_hmac_update_global_swap (&sha512_hmac_ctx, esalt_bufs[digests_offset].salt_buf, 64); + + for (u32 i = 0, j = 1; i < 8; i += 8, j += 1) + { + sha512_hmac_ctx_t sha512_hmac_ctx2 = sha512_hmac_ctx; + + w0[0] = j; + w0[1] = 0; + w0[2] = 0; + w0[3] = 0; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; + w4[0] = 0; + w4[1] = 0; + w4[2] = 0; + w4[3] = 0; + w5[0] = 0; + w5[1] = 0; + w5[2] = 0; + w5[3] = 0; + w6[0] = 0; + w6[1] = 0; + w6[2] = 0; + w6[3] = 0; + w7[0] = 0; + w7[1] = 0; + w7[2] = 0; + w7[3] = 0; + + sha512_hmac_update_128 (&sha512_hmac_ctx2, w0, w1, w2, w3, w4, w5, w6, w7, 4); + + sha512_hmac_final (&sha512_hmac_ctx2); + + tmps[gid].dgst[i + 0] = sha512_hmac_ctx2.opad.h[0]; + tmps[gid].dgst[i + 1] = sha512_hmac_ctx2.opad.h[1]; + tmps[gid].dgst[i + 2] = sha512_hmac_ctx2.opad.h[2]; + tmps[gid].dgst[i + 3] = sha512_hmac_ctx2.opad.h[3]; + tmps[gid].dgst[i + 4] = sha512_hmac_ctx2.opad.h[4]; + tmps[gid].dgst[i + 5] = sha512_hmac_ctx2.opad.h[5]; + tmps[gid].dgst[i + 6] = sha512_hmac_ctx2.opad.h[6]; + tmps[gid].dgst[i + 7] = sha512_hmac_ctx2.opad.h[7]; + + tmps[gid].out[i + 0] = tmps[gid].dgst[i + 0]; + tmps[gid].out[i + 1] = tmps[gid].dgst[i + 1]; + tmps[gid].out[i + 2] = tmps[gid].dgst[i + 2]; + tmps[gid].out[i + 3] = tmps[gid].dgst[i + 3]; + tmps[gid].out[i + 4] = tmps[gid].dgst[i + 4]; + tmps[gid].out[i + 5] = tmps[gid].dgst[i + 5]; + tmps[gid].out[i + 6] = tmps[gid].dgst[i + 6]; + tmps[gid].out[i + 7] = tmps[gid].dgst[i + 7]; + } +} + +__kernel void m13721_loop (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * shared lookup table + */ + + #ifdef REAL_SHM + + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + + #endif + + if (gid >= gid_max) return; + + // this is the pim range check + // it is guaranteed that only 0 or 1 innerloops will match a "pim" mark (each 1000 iterations) + // therefore the module limits the inner loop iteration count to 1000 + // if the key_pim is set, we know that we have to save and check the key for this pim + + const int pim_multi = esalt_bufs[digests_offset].pim_multi; + const int pim_start = esalt_bufs[digests_offset].pim_start; + const int pim_stop = esalt_bufs[digests_offset].pim_stop; + + int pim = 0; + int pim_at = 0; + + for (u32 j = 0; j < loop_cnt; j++) + { + const int iter_abs = 1 + loop_pos + j; + + if ((iter_abs % pim_multi) == pim_multi - 1) + { + const int pim_cur = (iter_abs / pim_multi) + 1; + + if ((pim_cur >= pim_start) && (pim_cur <= pim_stop)) + { + pim = pim_cur; + + pim_at = j; + } + } + } + + // irregular pbkdf2 from here + + u64x ipad[8]; + u64x opad[8]; + + ipad[0] = pack64v (tmps, ipad, gid, 0); + ipad[1] = pack64v (tmps, ipad, gid, 1); + ipad[2] = pack64v (tmps, ipad, gid, 2); + ipad[3] = pack64v (tmps, ipad, gid, 3); + ipad[4] = pack64v (tmps, ipad, gid, 4); + ipad[5] = pack64v (tmps, ipad, gid, 5); + ipad[6] = pack64v (tmps, ipad, gid, 6); + ipad[7] = pack64v (tmps, ipad, gid, 7); + + opad[0] = pack64v (tmps, opad, gid, 0); + opad[1] = pack64v (tmps, opad, gid, 1); + opad[2] = pack64v (tmps, opad, gid, 2); + opad[3] = pack64v (tmps, opad, gid, 3); + opad[4] = pack64v (tmps, opad, gid, 4); + opad[5] = pack64v (tmps, opad, gid, 5); + opad[6] = pack64v (tmps, opad, gid, 6); + opad[7] = pack64v (tmps, opad, gid, 7); + + for (u32 i = 0; i < 8; i += 8) + { + u64x dgst[8]; + u64x out[8]; + + dgst[0] = pack64v (tmps, dgst, gid, i + 0); + dgst[1] = pack64v (tmps, dgst, gid, i + 1); + dgst[2] = pack64v (tmps, dgst, gid, i + 2); + dgst[3] = pack64v (tmps, dgst, gid, i + 3); + dgst[4] = pack64v (tmps, dgst, gid, i + 4); + dgst[5] = pack64v (tmps, dgst, gid, i + 5); + dgst[6] = pack64v (tmps, dgst, gid, i + 6); + dgst[7] = pack64v (tmps, dgst, gid, i + 7); + + out[0] = pack64v (tmps, out, gid, i + 0); + out[1] = pack64v (tmps, out, gid, i + 1); + out[2] = pack64v (tmps, out, gid, i + 2); + out[3] = pack64v (tmps, out, gid, i + 3); + out[4] = pack64v (tmps, out, gid, i + 4); + out[5] = pack64v (tmps, out, gid, i + 5); + out[6] = pack64v (tmps, out, gid, i + 6); + out[7] = pack64v (tmps, out, gid, i + 7); + + for (u32 j = 0; j < loop_cnt; j++) + { + u32x w0[4]; + u32x w1[4]; + u32x w2[4]; + u32x w3[4]; + u32x w4[4]; + u32x w5[4]; + u32x w6[4]; + u32x w7[4]; + + w0[0] = h32_from_64 (dgst[0]); + w0[1] = l32_from_64 (dgst[0]); + w0[2] = h32_from_64 (dgst[1]); + w0[3] = l32_from_64 (dgst[1]); + w1[0] = h32_from_64 (dgst[2]); + w1[1] = l32_from_64 (dgst[2]); + w1[2] = h32_from_64 (dgst[3]); + w1[3] = l32_from_64 (dgst[3]); + w2[0] = h32_from_64 (dgst[4]); + w2[1] = l32_from_64 (dgst[4]); + w2[2] = h32_from_64 (dgst[5]); + w2[3] = l32_from_64 (dgst[5]); + w3[0] = h32_from_64 (dgst[6]); + w3[1] = l32_from_64 (dgst[6]); + w3[2] = h32_from_64 (dgst[7]); + w3[3] = l32_from_64 (dgst[7]); + w4[0] = 0x80000000; + w4[1] = 0; + w4[2] = 0; + w4[3] = 0; + w5[0] = 0; + w5[1] = 0; + w5[2] = 0; + w5[3] = 0; + w6[0] = 0; + w6[1] = 0; + w6[2] = 0; + w6[3] = 0; + w7[0] = 0; + w7[1] = 0; + w7[2] = 0; + w7[3] = (128 + 64) * 8; + + hmac_sha512_run_V (w0, w1, w2, w3, w4, w5, w6, w7, 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]; + + // this iteration creates a valid pim + + if (j == pim_at) + { + tmps[gid].pim_key[i + 0] = out[0]; + tmps[gid].pim_key[i + 1] = out[1]; + tmps[gid].pim_key[i + 2] = out[2]; + tmps[gid].pim_key[i + 3] = out[3]; + tmps[gid].pim_key[i + 4] = out[4]; + tmps[gid].pim_key[i + 5] = out[5]; + tmps[gid].pim_key[i + 6] = out[6]; + tmps[gid].pim_key[i + 7] = out[7]; + } + } + + unpack64v (tmps, dgst, gid, i + 0, dgst[0]); + unpack64v (tmps, dgst, gid, i + 1, dgst[1]); + unpack64v (tmps, dgst, gid, i + 2, dgst[2]); + unpack64v (tmps, dgst, gid, i + 3, dgst[3]); + unpack64v (tmps, dgst, gid, i + 4, dgst[4]); + unpack64v (tmps, dgst, gid, i + 5, dgst[5]); + unpack64v (tmps, dgst, gid, i + 6, dgst[6]); + unpack64v (tmps, dgst, gid, i + 7, dgst[7]); + + unpack64v (tmps, out, gid, i + 0, out[0]); + unpack64v (tmps, out, gid, i + 1, out[1]); + unpack64v (tmps, out, gid, i + 2, out[2]); + unpack64v (tmps, out, gid, i + 3, out[3]); + unpack64v (tmps, out, gid, i + 4, out[4]); + unpack64v (tmps, out, gid, i + 5, out[5]); + unpack64v (tmps, out, gid, i + 6, out[6]); + unpack64v (tmps, out, gid, i + 7, out[7]); + } + + if (pim == 0) return; + + if (check_header_0512 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; +} + +__kernel void m13721_comp (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * aes shared + */ + + #ifdef REAL_SHM + + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + + #endif + + if (gid >= gid_max) return; + + if (tmps[gid].pim) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, tmps[gid].pim, 0); + } + } + else + { + if (check_header_0512 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } + } + } +} diff --git a/OpenCL/m13722-pure.cl b/OpenCL/m13722-pure.cl new file mode 100644 index 000000000..559908682 --- /dev/null +++ b/OpenCL/m13722-pure.cl @@ -0,0 +1,720 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#undef LOCAL_MEM_TYPE +#define LOCAL_MEM_TYPE LOCAL_MEM_TYPE_GLOBAL + +#include "inc_vendor.cl" +#include "inc_hash_constants.h" +#include "inc_hash_functions.cl" +#include "inc_types.cl" +#include "inc_common.cl" +#include "inc_simd.cl" +#include "inc_hash_sha512.cl" + +#include "inc_cipher_aes.cl" +#include "inc_cipher_twofish.cl" +#include "inc_cipher_serpent.cl" +#include "inc_cipher_camellia.cl" +#include "inc_cipher_kuznyechik.cl" + +typedef struct vc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; + +#include "inc_truecrypt_keyfile.cl" +#include "inc_truecrypt_crc32.cl" +#include "inc_truecrypt_xts.cl" +#include "inc_veracrypt_xts.cl" + +typedef struct vc64_tmp +{ + u64 ipad[8]; + u64 opad[8]; + + u64 dgst[32]; + u64 out[32]; + + u64 pim_key[32]; + int pim; // marker for cracked + +} vc64_tmp_t; + +DECLSPEC int check_header_0512 (__global const vc_t *esalt_bufs, __global u64 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + + key1[0] = swap32_S (h32_from_64_S (key[0])); + key1[1] = swap32_S (l32_from_64_S (key[0])); + key1[2] = swap32_S (h32_from_64_S (key[1])); + key1[3] = swap32_S (l32_from_64_S (key[1])); + key1[4] = swap32_S (h32_from_64_S (key[2])); + key1[5] = swap32_S (l32_from_64_S (key[2])); + key1[6] = swap32_S (h32_from_64_S (key[3])); + key1[7] = swap32_S (l32_from_64_S (key[3])); + key2[0] = swap32_S (h32_from_64_S (key[4])); + key2[1] = swap32_S (l32_from_64_S (key[4])); + key2[2] = swap32_S (h32_from_64_S (key[5])); + key2[3] = swap32_S (l32_from_64_S (key[5])); + key2[4] = swap32_S (h32_from_64_S (key[6])); + key2[5] = swap32_S (l32_from_64_S (key[6])); + key2[6] = swap32_S (h32_from_64_S (key[7])); + key2[7] = swap32_S (l32_from_64_S (key[7])); + + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + + return -1; +} + +DECLSPEC int check_header_1024 (__global const vc_t *esalt_bufs, __global u64 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + u32 key3[8]; + u32 key4[8]; + + key1[0] = swap32_S (h32_from_64_S (key[ 0])); + key1[1] = swap32_S (l32_from_64_S (key[ 0])); + key1[2] = swap32_S (h32_from_64_S (key[ 1])); + key1[3] = swap32_S (l32_from_64_S (key[ 1])); + key1[4] = swap32_S (h32_from_64_S (key[ 2])); + key1[5] = swap32_S (l32_from_64_S (key[ 2])); + key1[6] = swap32_S (h32_from_64_S (key[ 3])); + key1[7] = swap32_S (l32_from_64_S (key[ 3])); + key2[0] = swap32_S (h32_from_64_S (key[ 4])); + key2[1] = swap32_S (l32_from_64_S (key[ 4])); + key2[2] = swap32_S (h32_from_64_S (key[ 5])); + key2[3] = swap32_S (l32_from_64_S (key[ 5])); + key2[4] = swap32_S (h32_from_64_S (key[ 6])); + key2[5] = swap32_S (l32_from_64_S (key[ 6])); + key2[6] = swap32_S (h32_from_64_S (key[ 7])); + key2[7] = swap32_S (l32_from_64_S (key[ 7])); + key3[0] = swap32_S (h32_from_64_S (key[ 8])); + key3[1] = swap32_S (l32_from_64_S (key[ 8])); + key3[2] = swap32_S (h32_from_64_S (key[ 9])); + key3[3] = swap32_S (l32_from_64_S (key[ 9])); + key3[4] = swap32_S (h32_from_64_S (key[10])); + key3[5] = swap32_S (l32_from_64_S (key[10])); + key3[6] = swap32_S (h32_from_64_S (key[11])); + key3[7] = swap32_S (l32_from_64_S (key[11])); + key4[0] = swap32_S (h32_from_64_S (key[12])); + key4[1] = swap32_S (l32_from_64_S (key[12])); + key4[2] = swap32_S (h32_from_64_S (key[13])); + key4[3] = swap32_S (l32_from_64_S (key[13])); + key4[4] = swap32_S (h32_from_64_S (key[14])); + key4[5] = swap32_S (l32_from_64_S (key[14])); + key4[6] = swap32_S (h32_from_64_S (key[15])); + key4[7] = swap32_S (l32_from_64_S (key[15])); + + if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_kuznyechik_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + + return -1; +} + +DECLSPEC void hmac_sha512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, u64x *ipad, u64x *opad, u64x *digest) +{ + digest[0] = ipad[0]; + digest[1] = ipad[1]; + digest[2] = ipad[2]; + digest[3] = ipad[3]; + digest[4] = ipad[4]; + digest[5] = ipad[5]; + digest[6] = ipad[6]; + digest[7] = ipad[7]; + + sha512_transform_vector (w0, w1, w2, w3, w4, w5, w6, w7, digest); + + w0[0] = h32_from_64 (digest[0]); + w0[1] = l32_from_64 (digest[0]); + w0[2] = h32_from_64 (digest[1]); + w0[3] = l32_from_64 (digest[1]); + w1[0] = h32_from_64 (digest[2]); + w1[1] = l32_from_64 (digest[2]); + w1[2] = h32_from_64 (digest[3]); + w1[3] = l32_from_64 (digest[3]); + w2[0] = h32_from_64 (digest[4]); + w2[1] = l32_from_64 (digest[4]); + w2[2] = h32_from_64 (digest[5]); + w2[3] = l32_from_64 (digest[5]); + w3[0] = h32_from_64 (digest[6]); + w3[1] = l32_from_64 (digest[6]); + w3[2] = h32_from_64 (digest[7]); + w3[3] = l32_from_64 (digest[7]); + w4[0] = 0x80000000; + w4[1] = 0; + w4[2] = 0; + w4[3] = 0; + w5[0] = 0; + w5[1] = 0; + w5[2] = 0; + w5[3] = 0; + w6[0] = 0; + w6[1] = 0; + w6[2] = 0; + w6[3] = 0; + w7[0] = 0; + w7[1] = 0; + w7[2] = 0; + w7[3] = (128 + 64) * 8; + + digest[0] = opad[0]; + digest[1] = opad[1]; + digest[2] = opad[2]; + digest[3] = opad[3]; + digest[4] = opad[4]; + digest[5] = opad[5]; + digest[6] = opad[6]; + digest[7] = opad[7]; + + sha512_transform_vector (w0, w1, w2, w3, w4, w5, w6, w7, digest); +} + +__kernel void m13722_init (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * keyboard layout shared + */ + + const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt; + + __local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + if (gid >= gid_max) return; + + /** + * base + */ + + u32 w0[4]; + u32 w1[4]; + u32 w2[4]; + u32 w3[4]; + u32 w4[4]; + u32 w5[4]; + u32 w6[4]; + u32 w7[4]; + + w0[0] = pws[gid].i[ 0]; + w0[1] = pws[gid].i[ 1]; + w0[2] = pws[gid].i[ 2]; + w0[3] = pws[gid].i[ 3]; + w1[0] = pws[gid].i[ 4]; + w1[1] = pws[gid].i[ 5]; + w1[2] = pws[gid].i[ 6]; + w1[3] = pws[gid].i[ 7]; + w2[0] = pws[gid].i[ 8]; + w2[1] = pws[gid].i[ 9]; + w2[2] = pws[gid].i[10]; + w2[3] = pws[gid].i[11]; + w3[0] = pws[gid].i[12]; + w3[1] = pws[gid].i[13]; + w3[2] = pws[gid].i[14]; + w3[3] = pws[gid].i[15]; + w4[0] = pws[gid].i[16]; + w4[1] = pws[gid].i[17]; + w4[2] = pws[gid].i[18]; + w4[3] = pws[gid].i[19]; + w5[0] = pws[gid].i[20]; + w5[1] = pws[gid].i[21]; + w5[2] = pws[gid].i[22]; + w5[3] = pws[gid].i[23]; + w6[0] = pws[gid].i[24]; + w6[1] = pws[gid].i[25]; + w6[2] = pws[gid].i[26]; + w6[3] = pws[gid].i[27]; + w7[0] = pws[gid].i[28]; + w7[1] = pws[gid].i[29]; + w7[2] = pws[gid].i[30]; + w7[3] = pws[gid].i[31]; + + const u32 pw_len = pws[gid].pw_len; + + execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); + + w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]); + w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]); + w0[2] = u8add (w0[2], esalt_bufs[digests_offset].keyfile_buf[ 2]); + w0[3] = u8add (w0[3], esalt_bufs[digests_offset].keyfile_buf[ 3]); + w1[0] = u8add (w1[0], esalt_bufs[digests_offset].keyfile_buf[ 4]); + w1[1] = u8add (w1[1], esalt_bufs[digests_offset].keyfile_buf[ 5]); + w1[2] = u8add (w1[2], esalt_bufs[digests_offset].keyfile_buf[ 6]); + w1[3] = u8add (w1[3], esalt_bufs[digests_offset].keyfile_buf[ 7]); + w2[0] = u8add (w2[0], esalt_bufs[digests_offset].keyfile_buf[ 8]); + w2[1] = u8add (w2[1], esalt_bufs[digests_offset].keyfile_buf[ 9]); + w2[2] = u8add (w2[2], esalt_bufs[digests_offset].keyfile_buf[10]); + w2[3] = u8add (w2[3], esalt_bufs[digests_offset].keyfile_buf[11]); + w3[0] = u8add (w3[0], esalt_bufs[digests_offset].keyfile_buf[12]); + w3[1] = u8add (w3[1], esalt_bufs[digests_offset].keyfile_buf[13]); + w3[2] = u8add (w3[2], esalt_bufs[digests_offset].keyfile_buf[14]); + w3[3] = u8add (w3[3], esalt_bufs[digests_offset].keyfile_buf[15]); + + w0[0] = swap32_S (w0[0]); + w0[1] = swap32_S (w0[1]); + w0[2] = swap32_S (w0[2]); + w0[3] = swap32_S (w0[3]); + w1[0] = swap32_S (w1[0]); + w1[1] = swap32_S (w1[1]); + w1[2] = swap32_S (w1[2]); + w1[3] = swap32_S (w1[3]); + w2[0] = swap32_S (w2[0]); + w2[1] = swap32_S (w2[1]); + w2[2] = swap32_S (w2[2]); + w2[3] = swap32_S (w2[3]); + w3[0] = swap32_S (w3[0]); + w3[1] = swap32_S (w3[1]); + w3[2] = swap32_S (w3[2]); + w3[3] = swap32_S (w3[3]); + w4[0] = swap32_S (w4[0]); + w4[1] = swap32_S (w4[1]); + w4[2] = swap32_S (w4[2]); + w4[3] = swap32_S (w4[3]); + w5[0] = swap32_S (w5[0]); + w5[1] = swap32_S (w5[1]); + w5[2] = swap32_S (w5[2]); + w5[3] = swap32_S (w5[3]); + w6[0] = swap32_S (w6[0]); + w6[1] = swap32_S (w6[1]); + w6[2] = swap32_S (w6[2]); + w6[3] = swap32_S (w6[3]); + w7[0] = swap32_S (w7[0]); + w7[1] = swap32_S (w7[1]); + w7[2] = swap32_S (w7[2]); + w7[3] = swap32_S (w7[3]); + + sha512_hmac_ctx_t sha512_hmac_ctx; + + sha512_hmac_init_128 (&sha512_hmac_ctx, w0, w1, w2, w3, w5, w5, w6, w7); + + tmps[gid].ipad[0] = sha512_hmac_ctx.ipad.h[0]; + tmps[gid].ipad[1] = sha512_hmac_ctx.ipad.h[1]; + tmps[gid].ipad[2] = sha512_hmac_ctx.ipad.h[2]; + tmps[gid].ipad[3] = sha512_hmac_ctx.ipad.h[3]; + tmps[gid].ipad[4] = sha512_hmac_ctx.ipad.h[4]; + tmps[gid].ipad[5] = sha512_hmac_ctx.ipad.h[5]; + tmps[gid].ipad[6] = sha512_hmac_ctx.ipad.h[6]; + tmps[gid].ipad[7] = sha512_hmac_ctx.ipad.h[7]; + + tmps[gid].opad[0] = sha512_hmac_ctx.opad.h[0]; + tmps[gid].opad[1] = sha512_hmac_ctx.opad.h[1]; + tmps[gid].opad[2] = sha512_hmac_ctx.opad.h[2]; + tmps[gid].opad[3] = sha512_hmac_ctx.opad.h[3]; + tmps[gid].opad[4] = sha512_hmac_ctx.opad.h[4]; + tmps[gid].opad[5] = sha512_hmac_ctx.opad.h[5]; + tmps[gid].opad[6] = sha512_hmac_ctx.opad.h[6]; + tmps[gid].opad[7] = sha512_hmac_ctx.opad.h[7]; + + sha512_hmac_update_global_swap (&sha512_hmac_ctx, esalt_bufs[digests_offset].salt_buf, 64); + + for (u32 i = 0, j = 1; i < 16; i += 8, j += 1) + { + sha512_hmac_ctx_t sha512_hmac_ctx2 = sha512_hmac_ctx; + + w0[0] = j; + w0[1] = 0; + w0[2] = 0; + w0[3] = 0; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; + w4[0] = 0; + w4[1] = 0; + w4[2] = 0; + w4[3] = 0; + w5[0] = 0; + w5[1] = 0; + w5[2] = 0; + w5[3] = 0; + w6[0] = 0; + w6[1] = 0; + w6[2] = 0; + w6[3] = 0; + w7[0] = 0; + w7[1] = 0; + w7[2] = 0; + w7[3] = 0; + + sha512_hmac_update_128 (&sha512_hmac_ctx2, w0, w1, w2, w3, w4, w5, w6, w7, 4); + + sha512_hmac_final (&sha512_hmac_ctx2); + + tmps[gid].dgst[i + 0] = sha512_hmac_ctx2.opad.h[0]; + tmps[gid].dgst[i + 1] = sha512_hmac_ctx2.opad.h[1]; + tmps[gid].dgst[i + 2] = sha512_hmac_ctx2.opad.h[2]; + tmps[gid].dgst[i + 3] = sha512_hmac_ctx2.opad.h[3]; + tmps[gid].dgst[i + 4] = sha512_hmac_ctx2.opad.h[4]; + tmps[gid].dgst[i + 5] = sha512_hmac_ctx2.opad.h[5]; + tmps[gid].dgst[i + 6] = sha512_hmac_ctx2.opad.h[6]; + tmps[gid].dgst[i + 7] = sha512_hmac_ctx2.opad.h[7]; + + tmps[gid].out[i + 0] = tmps[gid].dgst[i + 0]; + tmps[gid].out[i + 1] = tmps[gid].dgst[i + 1]; + tmps[gid].out[i + 2] = tmps[gid].dgst[i + 2]; + tmps[gid].out[i + 3] = tmps[gid].dgst[i + 3]; + tmps[gid].out[i + 4] = tmps[gid].dgst[i + 4]; + tmps[gid].out[i + 5] = tmps[gid].dgst[i + 5]; + tmps[gid].out[i + 6] = tmps[gid].dgst[i + 6]; + tmps[gid].out[i + 7] = tmps[gid].dgst[i + 7]; + } +} + +__kernel void m13722_loop (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * shared lookup table + */ + + #ifdef REAL_SHM + + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + + #endif + + if (gid >= gid_max) return; + + // this is the pim range check + // it is guaranteed that only 0 or 1 innerloops will match a "pim" mark (each 1000 iterations) + // therefore the module limits the inner loop iteration count to 1000 + // if the key_pim is set, we know that we have to save and check the key for this pim + + const int pim_multi = esalt_bufs[digests_offset].pim_multi; + const int pim_start = esalt_bufs[digests_offset].pim_start; + const int pim_stop = esalt_bufs[digests_offset].pim_stop; + + int pim = 0; + int pim_at = 0; + + for (u32 j = 0; j < loop_cnt; j++) + { + const int iter_abs = 1 + loop_pos + j; + + if ((iter_abs % pim_multi) == pim_multi - 1) + { + const int pim_cur = (iter_abs / pim_multi) + 1; + + if ((pim_cur >= pim_start) && (pim_cur <= pim_stop)) + { + pim = pim_cur; + + pim_at = j; + } + } + } + + // irregular pbkdf2 from here + + u64x ipad[8]; + u64x opad[8]; + + ipad[0] = pack64v (tmps, ipad, gid, 0); + ipad[1] = pack64v (tmps, ipad, gid, 1); + ipad[2] = pack64v (tmps, ipad, gid, 2); + ipad[3] = pack64v (tmps, ipad, gid, 3); + ipad[4] = pack64v (tmps, ipad, gid, 4); + ipad[5] = pack64v (tmps, ipad, gid, 5); + ipad[6] = pack64v (tmps, ipad, gid, 6); + ipad[7] = pack64v (tmps, ipad, gid, 7); + + opad[0] = pack64v (tmps, opad, gid, 0); + opad[1] = pack64v (tmps, opad, gid, 1); + opad[2] = pack64v (tmps, opad, gid, 2); + opad[3] = pack64v (tmps, opad, gid, 3); + opad[4] = pack64v (tmps, opad, gid, 4); + opad[5] = pack64v (tmps, opad, gid, 5); + opad[6] = pack64v (tmps, opad, gid, 6); + opad[7] = pack64v (tmps, opad, gid, 7); + + for (u32 i = 0; i < 16; i += 8) + { + u64x dgst[8]; + u64x out[8]; + + dgst[0] = pack64v (tmps, dgst, gid, i + 0); + dgst[1] = pack64v (tmps, dgst, gid, i + 1); + dgst[2] = pack64v (tmps, dgst, gid, i + 2); + dgst[3] = pack64v (tmps, dgst, gid, i + 3); + dgst[4] = pack64v (tmps, dgst, gid, i + 4); + dgst[5] = pack64v (tmps, dgst, gid, i + 5); + dgst[6] = pack64v (tmps, dgst, gid, i + 6); + dgst[7] = pack64v (tmps, dgst, gid, i + 7); + + out[0] = pack64v (tmps, out, gid, i + 0); + out[1] = pack64v (tmps, out, gid, i + 1); + out[2] = pack64v (tmps, out, gid, i + 2); + out[3] = pack64v (tmps, out, gid, i + 3); + out[4] = pack64v (tmps, out, gid, i + 4); + out[5] = pack64v (tmps, out, gid, i + 5); + out[6] = pack64v (tmps, out, gid, i + 6); + out[7] = pack64v (tmps, out, gid, i + 7); + + for (u32 j = 0; j < loop_cnt; j++) + { + u32x w0[4]; + u32x w1[4]; + u32x w2[4]; + u32x w3[4]; + u32x w4[4]; + u32x w5[4]; + u32x w6[4]; + u32x w7[4]; + + w0[0] = h32_from_64 (dgst[0]); + w0[1] = l32_from_64 (dgst[0]); + w0[2] = h32_from_64 (dgst[1]); + w0[3] = l32_from_64 (dgst[1]); + w1[0] = h32_from_64 (dgst[2]); + w1[1] = l32_from_64 (dgst[2]); + w1[2] = h32_from_64 (dgst[3]); + w1[3] = l32_from_64 (dgst[3]); + w2[0] = h32_from_64 (dgst[4]); + w2[1] = l32_from_64 (dgst[4]); + w2[2] = h32_from_64 (dgst[5]); + w2[3] = l32_from_64 (dgst[5]); + w3[0] = h32_from_64 (dgst[6]); + w3[1] = l32_from_64 (dgst[6]); + w3[2] = h32_from_64 (dgst[7]); + w3[3] = l32_from_64 (dgst[7]); + w4[0] = 0x80000000; + w4[1] = 0; + w4[2] = 0; + w4[3] = 0; + w5[0] = 0; + w5[1] = 0; + w5[2] = 0; + w5[3] = 0; + w6[0] = 0; + w6[1] = 0; + w6[2] = 0; + w6[3] = 0; + w7[0] = 0; + w7[1] = 0; + w7[2] = 0; + w7[3] = (128 + 64) * 8; + + hmac_sha512_run_V (w0, w1, w2, w3, w4, w5, w6, w7, 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]; + + // this iteration creates a valid pim + + if (j == pim_at) + { + tmps[gid].pim_key[i + 0] = out[0]; + tmps[gid].pim_key[i + 1] = out[1]; + tmps[gid].pim_key[i + 2] = out[2]; + tmps[gid].pim_key[i + 3] = out[3]; + tmps[gid].pim_key[i + 4] = out[4]; + tmps[gid].pim_key[i + 5] = out[5]; + tmps[gid].pim_key[i + 6] = out[6]; + tmps[gid].pim_key[i + 7] = out[7]; + } + } + + unpack64v (tmps, dgst, gid, i + 0, dgst[0]); + unpack64v (tmps, dgst, gid, i + 1, dgst[1]); + unpack64v (tmps, dgst, gid, i + 2, dgst[2]); + unpack64v (tmps, dgst, gid, i + 3, dgst[3]); + unpack64v (tmps, dgst, gid, i + 4, dgst[4]); + unpack64v (tmps, dgst, gid, i + 5, dgst[5]); + unpack64v (tmps, dgst, gid, i + 6, dgst[6]); + unpack64v (tmps, dgst, gid, i + 7, dgst[7]); + + unpack64v (tmps, out, gid, i + 0, out[0]); + unpack64v (tmps, out, gid, i + 1, out[1]); + unpack64v (tmps, out, gid, i + 2, out[2]); + unpack64v (tmps, out, gid, i + 3, out[3]); + unpack64v (tmps, out, gid, i + 4, out[4]); + unpack64v (tmps, out, gid, i + 5, out[5]); + unpack64v (tmps, out, gid, i + 6, out[6]); + unpack64v (tmps, out, gid, i + 7, out[7]); + } + + if (pim == 0) return; + + if (check_header_0512 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; + if (check_header_1024 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; +} + +__kernel void m13722_comp (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * aes shared + */ + + #ifdef REAL_SHM + + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + + #endif + + if (gid >= gid_max) return; + + if (tmps[gid].pim) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, tmps[gid].pim, 0); + } + } + else + { + if (check_header_0512 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } + } + + if (check_header_1024 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } + } + } +} diff --git a/OpenCL/m13723-pure.cl b/OpenCL/m13723-pure.cl new file mode 100644 index 000000000..176aa5993 --- /dev/null +++ b/OpenCL/m13723-pure.cl @@ -0,0 +1,794 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#undef LOCAL_MEM_TYPE +#define LOCAL_MEM_TYPE LOCAL_MEM_TYPE_GLOBAL + +#include "inc_vendor.cl" +#include "inc_hash_constants.h" +#include "inc_hash_functions.cl" +#include "inc_types.cl" +#include "inc_common.cl" +#include "inc_simd.cl" +#include "inc_hash_sha512.cl" + +#include "inc_cipher_aes.cl" +#include "inc_cipher_twofish.cl" +#include "inc_cipher_serpent.cl" +#include "inc_cipher_camellia.cl" +#include "inc_cipher_kuznyechik.cl" + +typedef struct vc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; + +#include "inc_truecrypt_keyfile.cl" +#include "inc_truecrypt_crc32.cl" +#include "inc_truecrypt_xts.cl" +#include "inc_veracrypt_xts.cl" + +typedef struct vc64_tmp +{ + u64 ipad[8]; + u64 opad[8]; + + u64 dgst[32]; + u64 out[32]; + + u64 pim_key[32]; + int pim; // marker for cracked + +} vc64_tmp_t; + +DECLSPEC int check_header_0512 (__global const vc_t *esalt_bufs, __global u64 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + + key1[0] = swap32_S (h32_from_64_S (key[0])); + key1[1] = swap32_S (l32_from_64_S (key[0])); + key1[2] = swap32_S (h32_from_64_S (key[1])); + key1[3] = swap32_S (l32_from_64_S (key[1])); + key1[4] = swap32_S (h32_from_64_S (key[2])); + key1[5] = swap32_S (l32_from_64_S (key[2])); + key1[6] = swap32_S (h32_from_64_S (key[3])); + key1[7] = swap32_S (l32_from_64_S (key[3])); + key2[0] = swap32_S (h32_from_64_S (key[4])); + key2[1] = swap32_S (l32_from_64_S (key[4])); + key2[2] = swap32_S (h32_from_64_S (key[5])); + key2[3] = swap32_S (l32_from_64_S (key[5])); + key2[4] = swap32_S (h32_from_64_S (key[6])); + key2[5] = swap32_S (l32_from_64_S (key[6])); + key2[6] = swap32_S (h32_from_64_S (key[7])); + key2[7] = swap32_S (l32_from_64_S (key[7])); + + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + + return -1; +} + +DECLSPEC int check_header_1024 (__global const vc_t *esalt_bufs, __global u64 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + u32 key3[8]; + u32 key4[8]; + + key1[0] = swap32_S (h32_from_64_S (key[ 0])); + key1[1] = swap32_S (l32_from_64_S (key[ 0])); + key1[2] = swap32_S (h32_from_64_S (key[ 1])); + key1[3] = swap32_S (l32_from_64_S (key[ 1])); + key1[4] = swap32_S (h32_from_64_S (key[ 2])); + key1[5] = swap32_S (l32_from_64_S (key[ 2])); + key1[6] = swap32_S (h32_from_64_S (key[ 3])); + key1[7] = swap32_S (l32_from_64_S (key[ 3])); + key2[0] = swap32_S (h32_from_64_S (key[ 4])); + key2[1] = swap32_S (l32_from_64_S (key[ 4])); + key2[2] = swap32_S (h32_from_64_S (key[ 5])); + key2[3] = swap32_S (l32_from_64_S (key[ 5])); + key2[4] = swap32_S (h32_from_64_S (key[ 6])); + key2[5] = swap32_S (l32_from_64_S (key[ 6])); + key2[6] = swap32_S (h32_from_64_S (key[ 7])); + key2[7] = swap32_S (l32_from_64_S (key[ 7])); + key3[0] = swap32_S (h32_from_64_S (key[ 8])); + key3[1] = swap32_S (l32_from_64_S (key[ 8])); + key3[2] = swap32_S (h32_from_64_S (key[ 9])); + key3[3] = swap32_S (l32_from_64_S (key[ 9])); + key3[4] = swap32_S (h32_from_64_S (key[10])); + key3[5] = swap32_S (l32_from_64_S (key[10])); + key3[6] = swap32_S (h32_from_64_S (key[11])); + key3[7] = swap32_S (l32_from_64_S (key[11])); + key4[0] = swap32_S (h32_from_64_S (key[12])); + key4[1] = swap32_S (l32_from_64_S (key[12])); + key4[2] = swap32_S (h32_from_64_S (key[13])); + key4[3] = swap32_S (l32_from_64_S (key[13])); + key4[4] = swap32_S (h32_from_64_S (key[14])); + key4[5] = swap32_S (l32_from_64_S (key[14])); + key4[6] = swap32_S (h32_from_64_S (key[15])); + key4[7] = swap32_S (l32_from_64_S (key[15])); + + if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_kuznyechik_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + + return -1; +} + +DECLSPEC int check_header_1536 (__global const vc_t *esalt_bufs, __global u64 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + u32 key3[8]; + u32 key4[8]; + u32 key5[8]; + u32 key6[8]; + + key1[0] = swap32_S (h32_from_64_S (key[ 0])); + key1[1] = swap32_S (l32_from_64_S (key[ 0])); + key1[2] = swap32_S (h32_from_64_S (key[ 1])); + key1[3] = swap32_S (l32_from_64_S (key[ 1])); + key1[4] = swap32_S (h32_from_64_S (key[ 2])); + key1[5] = swap32_S (l32_from_64_S (key[ 2])); + key1[6] = swap32_S (h32_from_64_S (key[ 3])); + key1[7] = swap32_S (l32_from_64_S (key[ 3])); + key2[0] = swap32_S (h32_from_64_S (key[ 4])); + key2[1] = swap32_S (l32_from_64_S (key[ 4])); + key2[2] = swap32_S (h32_from_64_S (key[ 5])); + key2[3] = swap32_S (l32_from_64_S (key[ 5])); + key2[4] = swap32_S (h32_from_64_S (key[ 6])); + key2[5] = swap32_S (l32_from_64_S (key[ 6])); + key2[6] = swap32_S (h32_from_64_S (key[ 7])); + key2[7] = swap32_S (l32_from_64_S (key[ 7])); + key3[0] = swap32_S (h32_from_64_S (key[ 8])); + key3[1] = swap32_S (l32_from_64_S (key[ 8])); + key3[2] = swap32_S (h32_from_64_S (key[ 9])); + key3[3] = swap32_S (l32_from_64_S (key[ 9])); + key3[4] = swap32_S (h32_from_64_S (key[10])); + key3[5] = swap32_S (l32_from_64_S (key[10])); + key3[6] = swap32_S (h32_from_64_S (key[11])); + key3[7] = swap32_S (l32_from_64_S (key[11])); + key4[0] = swap32_S (h32_from_64_S (key[12])); + key4[1] = swap32_S (l32_from_64_S (key[12])); + key4[2] = swap32_S (h32_from_64_S (key[13])); + key4[3] = swap32_S (l32_from_64_S (key[13])); + key4[4] = swap32_S (h32_from_64_S (key[14])); + key4[5] = swap32_S (l32_from_64_S (key[14])); + key4[6] = swap32_S (h32_from_64_S (key[15])); + key4[7] = swap32_S (l32_from_64_S (key[15])); + key5[0] = swap32_S (h32_from_64_S (key[16])); + key5[1] = swap32_S (l32_from_64_S (key[16])); + key5[2] = swap32_S (h32_from_64_S (key[17])); + key5[3] = swap32_S (l32_from_64_S (key[17])); + key5[4] = swap32_S (h32_from_64_S (key[18])); + key5[5] = swap32_S (l32_from_64_S (key[18])); + key5[6] = swap32_S (h32_from_64_S (key[19])); + key5[7] = swap32_S (l32_from_64_S (key[19])); + key6[0] = swap32_S (h32_from_64_S (key[20])); + key6[1] = swap32_S (l32_from_64_S (key[20])); + key6[2] = swap32_S (h32_from_64_S (key[21])); + key6[3] = swap32_S (l32_from_64_S (key[21])); + key6[4] = swap32_S (h32_from_64_S (key[22])); + key6[5] = swap32_S (l32_from_64_S (key[22])); + key6[6] = swap32_S (h32_from_64_S (key[23])); + key6[7] = swap32_S (l32_from_64_S (key[23])); + + if (verify_header_aes_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, key5, key6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent_twofish_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, key5, key6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_kuznyechik_serpent_camellia (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, key5, key6) == 1) return 0; + + return -1; +} + +DECLSPEC void hmac_sha512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, u64x *ipad, u64x *opad, u64x *digest) +{ + digest[0] = ipad[0]; + digest[1] = ipad[1]; + digest[2] = ipad[2]; + digest[3] = ipad[3]; + digest[4] = ipad[4]; + digest[5] = ipad[5]; + digest[6] = ipad[6]; + digest[7] = ipad[7]; + + sha512_transform_vector (w0, w1, w2, w3, w4, w5, w6, w7, digest); + + w0[0] = h32_from_64 (digest[0]); + w0[1] = l32_from_64 (digest[0]); + w0[2] = h32_from_64 (digest[1]); + w0[3] = l32_from_64 (digest[1]); + w1[0] = h32_from_64 (digest[2]); + w1[1] = l32_from_64 (digest[2]); + w1[2] = h32_from_64 (digest[3]); + w1[3] = l32_from_64 (digest[3]); + w2[0] = h32_from_64 (digest[4]); + w2[1] = l32_from_64 (digest[4]); + w2[2] = h32_from_64 (digest[5]); + w2[3] = l32_from_64 (digest[5]); + w3[0] = h32_from_64 (digest[6]); + w3[1] = l32_from_64 (digest[6]); + w3[2] = h32_from_64 (digest[7]); + w3[3] = l32_from_64 (digest[7]); + w4[0] = 0x80000000; + w4[1] = 0; + w4[2] = 0; + w4[3] = 0; + w5[0] = 0; + w5[1] = 0; + w5[2] = 0; + w5[3] = 0; + w6[0] = 0; + w6[1] = 0; + w6[2] = 0; + w6[3] = 0; + w7[0] = 0; + w7[1] = 0; + w7[2] = 0; + w7[3] = (128 + 64) * 8; + + digest[0] = opad[0]; + digest[1] = opad[1]; + digest[2] = opad[2]; + digest[3] = opad[3]; + digest[4] = opad[4]; + digest[5] = opad[5]; + digest[6] = opad[6]; + digest[7] = opad[7]; + + sha512_transform_vector (w0, w1, w2, w3, w4, w5, w6, w7, digest); +} + +__kernel void m13723_init (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * keyboard layout shared + */ + + const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt; + + __local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + if (gid >= gid_max) return; + + /** + * base + */ + + u32 w0[4]; + u32 w1[4]; + u32 w2[4]; + u32 w3[4]; + u32 w4[4]; + u32 w5[4]; + u32 w6[4]; + u32 w7[4]; + + w0[0] = pws[gid].i[ 0]; + w0[1] = pws[gid].i[ 1]; + w0[2] = pws[gid].i[ 2]; + w0[3] = pws[gid].i[ 3]; + w1[0] = pws[gid].i[ 4]; + w1[1] = pws[gid].i[ 5]; + w1[2] = pws[gid].i[ 6]; + w1[3] = pws[gid].i[ 7]; + w2[0] = pws[gid].i[ 8]; + w2[1] = pws[gid].i[ 9]; + w2[2] = pws[gid].i[10]; + w2[3] = pws[gid].i[11]; + w3[0] = pws[gid].i[12]; + w3[1] = pws[gid].i[13]; + w3[2] = pws[gid].i[14]; + w3[3] = pws[gid].i[15]; + w4[0] = pws[gid].i[16]; + w4[1] = pws[gid].i[17]; + w4[2] = pws[gid].i[18]; + w4[3] = pws[gid].i[19]; + w5[0] = pws[gid].i[20]; + w5[1] = pws[gid].i[21]; + w5[2] = pws[gid].i[22]; + w5[3] = pws[gid].i[23]; + w6[0] = pws[gid].i[24]; + w6[1] = pws[gid].i[25]; + w6[2] = pws[gid].i[26]; + w6[3] = pws[gid].i[27]; + w7[0] = pws[gid].i[28]; + w7[1] = pws[gid].i[29]; + w7[2] = pws[gid].i[30]; + w7[3] = pws[gid].i[31]; + + const u32 pw_len = pws[gid].pw_len; + + execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); + + w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]); + w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]); + w0[2] = u8add (w0[2], esalt_bufs[digests_offset].keyfile_buf[ 2]); + w0[3] = u8add (w0[3], esalt_bufs[digests_offset].keyfile_buf[ 3]); + w1[0] = u8add (w1[0], esalt_bufs[digests_offset].keyfile_buf[ 4]); + w1[1] = u8add (w1[1], esalt_bufs[digests_offset].keyfile_buf[ 5]); + w1[2] = u8add (w1[2], esalt_bufs[digests_offset].keyfile_buf[ 6]); + w1[3] = u8add (w1[3], esalt_bufs[digests_offset].keyfile_buf[ 7]); + w2[0] = u8add (w2[0], esalt_bufs[digests_offset].keyfile_buf[ 8]); + w2[1] = u8add (w2[1], esalt_bufs[digests_offset].keyfile_buf[ 9]); + w2[2] = u8add (w2[2], esalt_bufs[digests_offset].keyfile_buf[10]); + w2[3] = u8add (w2[3], esalt_bufs[digests_offset].keyfile_buf[11]); + w3[0] = u8add (w3[0], esalt_bufs[digests_offset].keyfile_buf[12]); + w3[1] = u8add (w3[1], esalt_bufs[digests_offset].keyfile_buf[13]); + w3[2] = u8add (w3[2], esalt_bufs[digests_offset].keyfile_buf[14]); + w3[3] = u8add (w3[3], esalt_bufs[digests_offset].keyfile_buf[15]); + + w0[0] = swap32_S (w0[0]); + w0[1] = swap32_S (w0[1]); + w0[2] = swap32_S (w0[2]); + w0[3] = swap32_S (w0[3]); + w1[0] = swap32_S (w1[0]); + w1[1] = swap32_S (w1[1]); + w1[2] = swap32_S (w1[2]); + w1[3] = swap32_S (w1[3]); + w2[0] = swap32_S (w2[0]); + w2[1] = swap32_S (w2[1]); + w2[2] = swap32_S (w2[2]); + w2[3] = swap32_S (w2[3]); + w3[0] = swap32_S (w3[0]); + w3[1] = swap32_S (w3[1]); + w3[2] = swap32_S (w3[2]); + w3[3] = swap32_S (w3[3]); + w4[0] = swap32_S (w4[0]); + w4[1] = swap32_S (w4[1]); + w4[2] = swap32_S (w4[2]); + w4[3] = swap32_S (w4[3]); + w5[0] = swap32_S (w5[0]); + w5[1] = swap32_S (w5[1]); + w5[2] = swap32_S (w5[2]); + w5[3] = swap32_S (w5[3]); + w6[0] = swap32_S (w6[0]); + w6[1] = swap32_S (w6[1]); + w6[2] = swap32_S (w6[2]); + w6[3] = swap32_S (w6[3]); + w7[0] = swap32_S (w7[0]); + w7[1] = swap32_S (w7[1]); + w7[2] = swap32_S (w7[2]); + w7[3] = swap32_S (w7[3]); + + sha512_hmac_ctx_t sha512_hmac_ctx; + + sha512_hmac_init_128 (&sha512_hmac_ctx, w0, w1, w2, w3, w5, w5, w6, w7); + + tmps[gid].ipad[0] = sha512_hmac_ctx.ipad.h[0]; + tmps[gid].ipad[1] = sha512_hmac_ctx.ipad.h[1]; + tmps[gid].ipad[2] = sha512_hmac_ctx.ipad.h[2]; + tmps[gid].ipad[3] = sha512_hmac_ctx.ipad.h[3]; + tmps[gid].ipad[4] = sha512_hmac_ctx.ipad.h[4]; + tmps[gid].ipad[5] = sha512_hmac_ctx.ipad.h[5]; + tmps[gid].ipad[6] = sha512_hmac_ctx.ipad.h[6]; + tmps[gid].ipad[7] = sha512_hmac_ctx.ipad.h[7]; + + tmps[gid].opad[0] = sha512_hmac_ctx.opad.h[0]; + tmps[gid].opad[1] = sha512_hmac_ctx.opad.h[1]; + tmps[gid].opad[2] = sha512_hmac_ctx.opad.h[2]; + tmps[gid].opad[3] = sha512_hmac_ctx.opad.h[3]; + tmps[gid].opad[4] = sha512_hmac_ctx.opad.h[4]; + tmps[gid].opad[5] = sha512_hmac_ctx.opad.h[5]; + tmps[gid].opad[6] = sha512_hmac_ctx.opad.h[6]; + tmps[gid].opad[7] = sha512_hmac_ctx.opad.h[7]; + + sha512_hmac_update_global_swap (&sha512_hmac_ctx, esalt_bufs[digests_offset].salt_buf, 64); + + for (u32 i = 0, j = 1; i < 24; i += 8, j += 1) + { + sha512_hmac_ctx_t sha512_hmac_ctx2 = sha512_hmac_ctx; + + w0[0] = j; + w0[1] = 0; + w0[2] = 0; + w0[3] = 0; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; + w4[0] = 0; + w4[1] = 0; + w4[2] = 0; + w4[3] = 0; + w5[0] = 0; + w5[1] = 0; + w5[2] = 0; + w5[3] = 0; + w6[0] = 0; + w6[1] = 0; + w6[2] = 0; + w6[3] = 0; + w7[0] = 0; + w7[1] = 0; + w7[2] = 0; + w7[3] = 0; + + sha512_hmac_update_128 (&sha512_hmac_ctx2, w0, w1, w2, w3, w4, w5, w6, w7, 4); + + sha512_hmac_final (&sha512_hmac_ctx2); + + tmps[gid].dgst[i + 0] = sha512_hmac_ctx2.opad.h[0]; + tmps[gid].dgst[i + 1] = sha512_hmac_ctx2.opad.h[1]; + tmps[gid].dgst[i + 2] = sha512_hmac_ctx2.opad.h[2]; + tmps[gid].dgst[i + 3] = sha512_hmac_ctx2.opad.h[3]; + tmps[gid].dgst[i + 4] = sha512_hmac_ctx2.opad.h[4]; + tmps[gid].dgst[i + 5] = sha512_hmac_ctx2.opad.h[5]; + tmps[gid].dgst[i + 6] = sha512_hmac_ctx2.opad.h[6]; + tmps[gid].dgst[i + 7] = sha512_hmac_ctx2.opad.h[7]; + + tmps[gid].out[i + 0] = tmps[gid].dgst[i + 0]; + tmps[gid].out[i + 1] = tmps[gid].dgst[i + 1]; + tmps[gid].out[i + 2] = tmps[gid].dgst[i + 2]; + tmps[gid].out[i + 3] = tmps[gid].dgst[i + 3]; + tmps[gid].out[i + 4] = tmps[gid].dgst[i + 4]; + tmps[gid].out[i + 5] = tmps[gid].dgst[i + 5]; + tmps[gid].out[i + 6] = tmps[gid].dgst[i + 6]; + tmps[gid].out[i + 7] = tmps[gid].dgst[i + 7]; + } +} + +__kernel void m13723_loop (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * shared lookup table + */ + + #ifdef REAL_SHM + + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + + #endif + + if (gid >= gid_max) return; + + // this is the pim range check + // it is guaranteed that only 0 or 1 innerloops will match a "pim" mark (each 1000 iterations) + // therefore the module limits the inner loop iteration count to 1000 + // if the key_pim is set, we know that we have to save and check the key for this pim + + const int pim_multi = esalt_bufs[digests_offset].pim_multi; + const int pim_start = esalt_bufs[digests_offset].pim_start; + const int pim_stop = esalt_bufs[digests_offset].pim_stop; + + int pim = 0; + int pim_at = 0; + + for (u32 j = 0; j < loop_cnt; j++) + { + const int iter_abs = 1 + loop_pos + j; + + if ((iter_abs % pim_multi) == pim_multi - 1) + { + const int pim_cur = (iter_abs / pim_multi) + 1; + + if ((pim_cur >= pim_start) && (pim_cur <= pim_stop)) + { + pim = pim_cur; + + pim_at = j; + } + } + } + + // irregular pbkdf2 from here + + u64x ipad[8]; + u64x opad[8]; + + ipad[0] = pack64v (tmps, ipad, gid, 0); + ipad[1] = pack64v (tmps, ipad, gid, 1); + ipad[2] = pack64v (tmps, ipad, gid, 2); + ipad[3] = pack64v (tmps, ipad, gid, 3); + ipad[4] = pack64v (tmps, ipad, gid, 4); + ipad[5] = pack64v (tmps, ipad, gid, 5); + ipad[6] = pack64v (tmps, ipad, gid, 6); + ipad[7] = pack64v (tmps, ipad, gid, 7); + + opad[0] = pack64v (tmps, opad, gid, 0); + opad[1] = pack64v (tmps, opad, gid, 1); + opad[2] = pack64v (tmps, opad, gid, 2); + opad[3] = pack64v (tmps, opad, gid, 3); + opad[4] = pack64v (tmps, opad, gid, 4); + opad[5] = pack64v (tmps, opad, gid, 5); + opad[6] = pack64v (tmps, opad, gid, 6); + opad[7] = pack64v (tmps, opad, gid, 7); + + for (u32 i = 0; i < 24; i += 8) + { + u64x dgst[8]; + u64x out[8]; + + dgst[0] = pack64v (tmps, dgst, gid, i + 0); + dgst[1] = pack64v (tmps, dgst, gid, i + 1); + dgst[2] = pack64v (tmps, dgst, gid, i + 2); + dgst[3] = pack64v (tmps, dgst, gid, i + 3); + dgst[4] = pack64v (tmps, dgst, gid, i + 4); + dgst[5] = pack64v (tmps, dgst, gid, i + 5); + dgst[6] = pack64v (tmps, dgst, gid, i + 6); + dgst[7] = pack64v (tmps, dgst, gid, i + 7); + + out[0] = pack64v (tmps, out, gid, i + 0); + out[1] = pack64v (tmps, out, gid, i + 1); + out[2] = pack64v (tmps, out, gid, i + 2); + out[3] = pack64v (tmps, out, gid, i + 3); + out[4] = pack64v (tmps, out, gid, i + 4); + out[5] = pack64v (tmps, out, gid, i + 5); + out[6] = pack64v (tmps, out, gid, i + 6); + out[7] = pack64v (tmps, out, gid, i + 7); + + for (u32 j = 0; j < loop_cnt; j++) + { + u32x w0[4]; + u32x w1[4]; + u32x w2[4]; + u32x w3[4]; + u32x w4[4]; + u32x w5[4]; + u32x w6[4]; + u32x w7[4]; + + w0[0] = h32_from_64 (dgst[0]); + w0[1] = l32_from_64 (dgst[0]); + w0[2] = h32_from_64 (dgst[1]); + w0[3] = l32_from_64 (dgst[1]); + w1[0] = h32_from_64 (dgst[2]); + w1[1] = l32_from_64 (dgst[2]); + w1[2] = h32_from_64 (dgst[3]); + w1[3] = l32_from_64 (dgst[3]); + w2[0] = h32_from_64 (dgst[4]); + w2[1] = l32_from_64 (dgst[4]); + w2[2] = h32_from_64 (dgst[5]); + w2[3] = l32_from_64 (dgst[5]); + w3[0] = h32_from_64 (dgst[6]); + w3[1] = l32_from_64 (dgst[6]); + w3[2] = h32_from_64 (dgst[7]); + w3[3] = l32_from_64 (dgst[7]); + w4[0] = 0x80000000; + w4[1] = 0; + w4[2] = 0; + w4[3] = 0; + w5[0] = 0; + w5[1] = 0; + w5[2] = 0; + w5[3] = 0; + w6[0] = 0; + w6[1] = 0; + w6[2] = 0; + w6[3] = 0; + w7[0] = 0; + w7[1] = 0; + w7[2] = 0; + w7[3] = (128 + 64) * 8; + + hmac_sha512_run_V (w0, w1, w2, w3, w4, w5, w6, w7, 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]; + + // this iteration creates a valid pim + + if (j == pim_at) + { + tmps[gid].pim_key[i + 0] = out[0]; + tmps[gid].pim_key[i + 1] = out[1]; + tmps[gid].pim_key[i + 2] = out[2]; + tmps[gid].pim_key[i + 3] = out[3]; + tmps[gid].pim_key[i + 4] = out[4]; + tmps[gid].pim_key[i + 5] = out[5]; + tmps[gid].pim_key[i + 6] = out[6]; + tmps[gid].pim_key[i + 7] = out[7]; + } + } + + unpack64v (tmps, dgst, gid, i + 0, dgst[0]); + unpack64v (tmps, dgst, gid, i + 1, dgst[1]); + unpack64v (tmps, dgst, gid, i + 2, dgst[2]); + unpack64v (tmps, dgst, gid, i + 3, dgst[3]); + unpack64v (tmps, dgst, gid, i + 4, dgst[4]); + unpack64v (tmps, dgst, gid, i + 5, dgst[5]); + unpack64v (tmps, dgst, gid, i + 6, dgst[6]); + unpack64v (tmps, dgst, gid, i + 7, dgst[7]); + + unpack64v (tmps, out, gid, i + 0, out[0]); + unpack64v (tmps, out, gid, i + 1, out[1]); + unpack64v (tmps, out, gid, i + 2, out[2]); + unpack64v (tmps, out, gid, i + 3, out[3]); + unpack64v (tmps, out, gid, i + 4, out[4]); + unpack64v (tmps, out, gid, i + 5, out[5]); + unpack64v (tmps, out, gid, i + 6, out[6]); + unpack64v (tmps, out, gid, i + 7, out[7]); + } + + if (pim == 0) return; + + if (check_header_0512 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; + if (check_header_1024 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; + if (check_header_1536 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; +} + +__kernel void m13723_comp (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * aes shared + */ + + #ifdef REAL_SHM + + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + + #endif + + if (gid >= gid_max) return; + + if (tmps[gid].pim) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, tmps[gid].pim, 0); + } + } + else + { + if (check_header_0512 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } + } + + if (check_header_1024 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } + } + + if (check_header_1536 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } + } + } +} diff --git a/OpenCL/m13731-pure.cl b/OpenCL/m13731-pure.cl new file mode 100644 index 000000000..1b6ac9431 --- /dev/null +++ b/OpenCL/m13731-pure.cl @@ -0,0 +1,839 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#undef LOCAL_MEM_TYPE +#define LOCAL_MEM_TYPE LOCAL_MEM_TYPE_GLOBAL + +#include "inc_vendor.cl" +#include "inc_hash_constants.h" +#include "inc_hash_functions.cl" +#include "inc_types.cl" +#include "inc_common.cl" +#include "inc_simd.cl" +#include "inc_hash_whirlpool.cl" + +#include "inc_cipher_aes.cl" +#include "inc_cipher_twofish.cl" +#include "inc_cipher_serpent.cl" +#include "inc_cipher_camellia.cl" +#include "inc_cipher_kuznyechik.cl" + +typedef struct vc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; + +#include "inc_truecrypt_keyfile.cl" +#include "inc_truecrypt_crc32.cl" +#include "inc_truecrypt_xts.cl" +#include "inc_veracrypt_xts.cl" + +typedef struct vc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + + u32 pim_key[64]; + int pim; // marker for cracked + +} vc_tmp_t; + +DECLSPEC int check_header_0512 (__global const vc_t *esalt_bufs, __global u32 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + + key1[0] = swap32_S (key[ 0]); + key1[1] = swap32_S (key[ 1]); + key1[2] = swap32_S (key[ 2]); + key1[3] = swap32_S (key[ 3]); + key1[4] = swap32_S (key[ 4]); + key1[5] = swap32_S (key[ 5]); + key1[6] = swap32_S (key[ 6]); + key1[7] = swap32_S (key[ 7]); + key2[0] = swap32_S (key[ 8]); + key2[1] = swap32_S (key[ 9]); + key2[2] = swap32_S (key[10]); + key2[3] = swap32_S (key[11]); + key2[4] = swap32_S (key[12]); + key2[5] = swap32_S (key[13]); + key2[6] = swap32_S (key[14]); + key2[7] = swap32_S (key[15]); + + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + + return -1; +} + +DECLSPEC void hmac_whirlpool_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]) +{ + digest[ 0] = ipad[ 0]; + digest[ 1] = ipad[ 1]; + digest[ 2] = ipad[ 2]; + digest[ 3] = ipad[ 3]; + digest[ 4] = ipad[ 4]; + digest[ 5] = ipad[ 5]; + digest[ 6] = ipad[ 6]; + digest[ 7] = ipad[ 7]; + digest[ 8] = ipad[ 8]; + digest[ 9] = ipad[ 9]; + digest[10] = ipad[10]; + digest[11] = ipad[11]; + digest[12] = ipad[12]; + digest[13] = ipad[13]; + digest[14] = ipad[14]; + digest[15] = ipad[15]; + + whirlpool_transform_vector (w0, w1, w2, w3, digest, s_Ch, s_Cl); + + w0[0] = 0x80000000; + w0[1] = 0; + w0[2] = 0; + w0[3] = 0; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = (64 + 64) * 8; + + whirlpool_transform_vector (w0, w1, w2, w3, digest, s_Ch, s_Cl); + + w0[0] = digest[ 0]; + w0[1] = digest[ 1]; + w0[2] = digest[ 2]; + w0[3] = digest[ 3]; + w1[0] = digest[ 4]; + w1[1] = digest[ 5]; + w1[2] = digest[ 6]; + w1[3] = digest[ 7]; + w2[0] = digest[ 8]; + w2[1] = digest[ 9]; + w2[2] = digest[10]; + w2[3] = digest[11]; + w3[0] = digest[12]; + w3[1] = digest[13]; + w3[2] = digest[14]; + w3[3] = digest[15]; + + digest[ 0] = opad[ 0]; + digest[ 1] = opad[ 1]; + digest[ 2] = opad[ 2]; + digest[ 3] = opad[ 3]; + digest[ 4] = opad[ 4]; + digest[ 5] = opad[ 5]; + digest[ 6] = opad[ 6]; + digest[ 7] = opad[ 7]; + digest[ 8] = opad[ 8]; + digest[ 9] = opad[ 9]; + digest[10] = opad[10]; + digest[11] = opad[11]; + digest[12] = opad[12]; + digest[13] = opad[13]; + digest[14] = opad[14]; + digest[15] = opad[15]; + + whirlpool_transform_vector (w0, w1, w2, w3, digest, s_Ch, s_Cl); + + w0[0] = 0x80000000; + w0[1] = 0; + w0[2] = 0; + w0[3] = 0; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = (64 + 64) * 8; + + whirlpool_transform_vector (w0, w1, w2, w3, digest, s_Ch, s_Cl); +} + +__kernel void m13731_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * keyboard layout shared + */ + + const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt; + + __local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + /** + * Whirlpool shared + */ + + #ifdef REAL_SHM + + __local u32 s_Ch[8][256]; + __local u32 s_Cl[8][256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_Ch[0][i] = Ch[0][i]; + s_Ch[1][i] = Ch[1][i]; + s_Ch[2][i] = Ch[2][i]; + s_Ch[3][i] = Ch[3][i]; + s_Ch[4][i] = Ch[4][i]; + s_Ch[5][i] = Ch[5][i]; + s_Ch[6][i] = Ch[6][i]; + s_Ch[7][i] = Ch[7][i]; + + s_Cl[0][i] = Cl[0][i]; + s_Cl[1][i] = Cl[1][i]; + s_Cl[2][i] = Cl[2][i]; + s_Cl[3][i] = Cl[3][i]; + s_Cl[4][i] = Cl[4][i]; + s_Cl[5][i] = Cl[5][i]; + s_Cl[6][i] = Cl[6][i]; + s_Cl[7][i] = Cl[7][i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + + if (gid >= gid_max) return; + + /** + * base + */ + + u32 w0[4]; + u32 w1[4]; + u32 w2[4]; + u32 w3[4]; + + w0[0] = pws[gid].i[ 0]; + w0[1] = pws[gid].i[ 1]; + w0[2] = pws[gid].i[ 2]; + w0[3] = pws[gid].i[ 3]; + w1[0] = pws[gid].i[ 4]; + w1[1] = pws[gid].i[ 5]; + w1[2] = pws[gid].i[ 6]; + w1[3] = pws[gid].i[ 7]; + w2[0] = pws[gid].i[ 8]; + w2[1] = pws[gid].i[ 9]; + w2[2] = pws[gid].i[10]; + w2[3] = pws[gid].i[11]; + w3[0] = pws[gid].i[12]; + w3[1] = pws[gid].i[13]; + w3[2] = pws[gid].i[14]; + w3[3] = pws[gid].i[15]; + + const u32 pw_len = pws[gid].pw_len; + + execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); + + w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]); + w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]); + w0[2] = u8add (w0[2], esalt_bufs[digests_offset].keyfile_buf[ 2]); + w0[3] = u8add (w0[3], esalt_bufs[digests_offset].keyfile_buf[ 3]); + w1[0] = u8add (w1[0], esalt_bufs[digests_offset].keyfile_buf[ 4]); + w1[1] = u8add (w1[1], esalt_bufs[digests_offset].keyfile_buf[ 5]); + w1[2] = u8add (w1[2], esalt_bufs[digests_offset].keyfile_buf[ 6]); + w1[3] = u8add (w1[3], esalt_bufs[digests_offset].keyfile_buf[ 7]); + w2[0] = u8add (w2[0], esalt_bufs[digests_offset].keyfile_buf[ 8]); + w2[1] = u8add (w2[1], esalt_bufs[digests_offset].keyfile_buf[ 9]); + w2[2] = u8add (w2[2], esalt_bufs[digests_offset].keyfile_buf[10]); + w2[3] = u8add (w2[3], esalt_bufs[digests_offset].keyfile_buf[11]); + w3[0] = u8add (w3[0], esalt_bufs[digests_offset].keyfile_buf[12]); + w3[1] = u8add (w3[1], esalt_bufs[digests_offset].keyfile_buf[13]); + w3[2] = u8add (w3[2], esalt_bufs[digests_offset].keyfile_buf[14]); + w3[3] = u8add (w3[3], esalt_bufs[digests_offset].keyfile_buf[15]); + + w0[0] = swap32_S (w0[0]); + w0[1] = swap32_S (w0[1]); + w0[2] = swap32_S (w0[2]); + w0[3] = swap32_S (w0[3]); + w1[0] = swap32_S (w1[0]); + w1[1] = swap32_S (w1[1]); + w1[2] = swap32_S (w1[2]); + w1[3] = swap32_S (w1[3]); + w2[0] = swap32_S (w2[0]); + w2[1] = swap32_S (w2[1]); + w2[2] = swap32_S (w2[2]); + w2[3] = swap32_S (w2[3]); + w3[0] = swap32_S (w3[0]); + w3[1] = swap32_S (w3[1]); + w3[2] = swap32_S (w3[2]); + w3[3] = swap32_S (w3[3]); + + whirlpool_hmac_ctx_t whirlpool_hmac_ctx; + + whirlpool_hmac_init_64 (&whirlpool_hmac_ctx, w0, w1, w2, w3, s_Ch, s_Cl); + + tmps[gid].ipad[ 0] = whirlpool_hmac_ctx.ipad.h[ 0]; + tmps[gid].ipad[ 1] = whirlpool_hmac_ctx.ipad.h[ 1]; + tmps[gid].ipad[ 2] = whirlpool_hmac_ctx.ipad.h[ 2]; + tmps[gid].ipad[ 3] = whirlpool_hmac_ctx.ipad.h[ 3]; + tmps[gid].ipad[ 4] = whirlpool_hmac_ctx.ipad.h[ 4]; + tmps[gid].ipad[ 5] = whirlpool_hmac_ctx.ipad.h[ 5]; + tmps[gid].ipad[ 6] = whirlpool_hmac_ctx.ipad.h[ 6]; + tmps[gid].ipad[ 7] = whirlpool_hmac_ctx.ipad.h[ 7]; + tmps[gid].ipad[ 8] = whirlpool_hmac_ctx.ipad.h[ 8]; + tmps[gid].ipad[ 9] = whirlpool_hmac_ctx.ipad.h[ 9]; + tmps[gid].ipad[10] = whirlpool_hmac_ctx.ipad.h[10]; + tmps[gid].ipad[11] = whirlpool_hmac_ctx.ipad.h[11]; + tmps[gid].ipad[12] = whirlpool_hmac_ctx.ipad.h[12]; + tmps[gid].ipad[13] = whirlpool_hmac_ctx.ipad.h[13]; + tmps[gid].ipad[14] = whirlpool_hmac_ctx.ipad.h[14]; + tmps[gid].ipad[15] = whirlpool_hmac_ctx.ipad.h[15]; + + tmps[gid].opad[ 0] = whirlpool_hmac_ctx.opad.h[ 0]; + tmps[gid].opad[ 1] = whirlpool_hmac_ctx.opad.h[ 1]; + tmps[gid].opad[ 2] = whirlpool_hmac_ctx.opad.h[ 2]; + tmps[gid].opad[ 3] = whirlpool_hmac_ctx.opad.h[ 3]; + tmps[gid].opad[ 4] = whirlpool_hmac_ctx.opad.h[ 4]; + tmps[gid].opad[ 5] = whirlpool_hmac_ctx.opad.h[ 5]; + tmps[gid].opad[ 6] = whirlpool_hmac_ctx.opad.h[ 6]; + tmps[gid].opad[ 7] = whirlpool_hmac_ctx.opad.h[ 7]; + tmps[gid].opad[ 8] = whirlpool_hmac_ctx.opad.h[ 8]; + tmps[gid].opad[ 9] = whirlpool_hmac_ctx.opad.h[ 9]; + tmps[gid].opad[10] = whirlpool_hmac_ctx.opad.h[10]; + tmps[gid].opad[11] = whirlpool_hmac_ctx.opad.h[11]; + tmps[gid].opad[12] = whirlpool_hmac_ctx.opad.h[12]; + tmps[gid].opad[13] = whirlpool_hmac_ctx.opad.h[13]; + tmps[gid].opad[14] = whirlpool_hmac_ctx.opad.h[14]; + tmps[gid].opad[15] = whirlpool_hmac_ctx.opad.h[15]; + + whirlpool_hmac_update_global_swap (&whirlpool_hmac_ctx, esalt_bufs[digests_offset].salt_buf, 64); + + for (u32 i = 0, j = 1; i < 16; i += 16, j += 1) + { + whirlpool_hmac_ctx_t whirlpool_hmac_ctx2 = whirlpool_hmac_ctx; + + w0[0] = j; + w0[1] = 0; + w0[2] = 0; + w0[3] = 0; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; + + whirlpool_hmac_update_64 (&whirlpool_hmac_ctx2, w0, w1, w2, w3, 4); + + whirlpool_hmac_final (&whirlpool_hmac_ctx2); + + tmps[gid].dgst[i + 0] = whirlpool_hmac_ctx2.opad.h[ 0]; + tmps[gid].dgst[i + 1] = whirlpool_hmac_ctx2.opad.h[ 1]; + tmps[gid].dgst[i + 2] = whirlpool_hmac_ctx2.opad.h[ 2]; + tmps[gid].dgst[i + 3] = whirlpool_hmac_ctx2.opad.h[ 3]; + tmps[gid].dgst[i + 4] = whirlpool_hmac_ctx2.opad.h[ 4]; + tmps[gid].dgst[i + 5] = whirlpool_hmac_ctx2.opad.h[ 5]; + tmps[gid].dgst[i + 6] = whirlpool_hmac_ctx2.opad.h[ 6]; + tmps[gid].dgst[i + 7] = whirlpool_hmac_ctx2.opad.h[ 7]; + tmps[gid].dgst[i + 8] = whirlpool_hmac_ctx2.opad.h[ 8]; + tmps[gid].dgst[i + 9] = whirlpool_hmac_ctx2.opad.h[ 9]; + tmps[gid].dgst[i + 10] = whirlpool_hmac_ctx2.opad.h[10]; + tmps[gid].dgst[i + 11] = whirlpool_hmac_ctx2.opad.h[11]; + tmps[gid].dgst[i + 12] = whirlpool_hmac_ctx2.opad.h[12]; + tmps[gid].dgst[i + 13] = whirlpool_hmac_ctx2.opad.h[13]; + tmps[gid].dgst[i + 14] = whirlpool_hmac_ctx2.opad.h[14]; + tmps[gid].dgst[i + 15] = whirlpool_hmac_ctx2.opad.h[15]; + + tmps[gid].out[i + 0] = tmps[gid].dgst[i + 0]; + tmps[gid].out[i + 1] = tmps[gid].dgst[i + 1]; + tmps[gid].out[i + 2] = tmps[gid].dgst[i + 2]; + tmps[gid].out[i + 3] = tmps[gid].dgst[i + 3]; + tmps[gid].out[i + 4] = tmps[gid].dgst[i + 4]; + tmps[gid].out[i + 5] = tmps[gid].dgst[i + 5]; + tmps[gid].out[i + 6] = tmps[gid].dgst[i + 6]; + tmps[gid].out[i + 7] = tmps[gid].dgst[i + 7]; + tmps[gid].out[i + 8] = tmps[gid].dgst[i + 8]; + tmps[gid].out[i + 9] = tmps[gid].dgst[i + 9]; + tmps[gid].out[i + 10] = tmps[gid].dgst[i + 10]; + tmps[gid].out[i + 11] = tmps[gid].dgst[i + 11]; + tmps[gid].out[i + 12] = tmps[gid].dgst[i + 12]; + tmps[gid].out[i + 13] = tmps[gid].dgst[i + 13]; + tmps[gid].out[i + 14] = tmps[gid].dgst[i + 14]; + tmps[gid].out[i + 15] = tmps[gid].dgst[i + 15]; + } +} + +__kernel void m13731_loop (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * aes shared + */ + + #ifdef REAL_SHM + + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + + #endif + + /** + * Whirlpool shared + */ + + #ifdef REAL_SHM + + __local u32 s_Ch[8][256]; + __local u32 s_Cl[8][256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_Ch[0][i] = Ch[0][i]; + s_Ch[1][i] = Ch[1][i]; + s_Ch[2][i] = Ch[2][i]; + s_Ch[3][i] = Ch[3][i]; + s_Ch[4][i] = Ch[4][i]; + s_Ch[5][i] = Ch[5][i]; + s_Ch[6][i] = Ch[6][i]; + s_Ch[7][i] = Ch[7][i]; + + s_Cl[0][i] = Cl[0][i]; + s_Cl[1][i] = Cl[1][i]; + s_Cl[2][i] = Cl[2][i]; + s_Cl[3][i] = Cl[3][i]; + s_Cl[4][i] = Cl[4][i]; + s_Cl[5][i] = Cl[5][i]; + s_Cl[6][i] = Cl[6][i]; + s_Cl[7][i] = Cl[7][i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + + if (gid >= gid_max) return; + + // this is the pim range check + // it is guaranteed that only 0 or 1 innerloops will match a "pim" mark (each 1000 iterations) + // therefore the module limits the inner loop iteration count to 1000 + // if the key_pim is set, we know that we have to save and check the key for this pim + + const int pim_multi = esalt_bufs[digests_offset].pim_multi; + const int pim_start = esalt_bufs[digests_offset].pim_start; + const int pim_stop = esalt_bufs[digests_offset].pim_stop; + + int pim = 0; + int pim_at = 0; + + for (u32 j = 0; j < loop_cnt; j++) + { + const int iter_abs = 1 + loop_pos + j; + + if ((iter_abs % pim_multi) == pim_multi - 1) + { + const int pim_cur = (iter_abs / pim_multi) + 1; + + if ((pim_cur >= pim_start) && (pim_cur <= pim_stop)) + { + pim = pim_cur; + + pim_at = j; + } + } + } + + // irregular pbkdf2 from here + + u32x ipad[16]; + u32x opad[16]; + + ipad[ 0] = packv (tmps, ipad, gid, 0); + ipad[ 1] = packv (tmps, ipad, gid, 1); + ipad[ 2] = packv (tmps, ipad, gid, 2); + ipad[ 3] = packv (tmps, ipad, gid, 3); + ipad[ 4] = packv (tmps, ipad, gid, 4); + ipad[ 5] = packv (tmps, ipad, gid, 5); + ipad[ 6] = packv (tmps, ipad, gid, 6); + ipad[ 7] = packv (tmps, ipad, gid, 7); + ipad[ 8] = packv (tmps, ipad, gid, 8); + ipad[ 9] = packv (tmps, ipad, gid, 9); + ipad[10] = packv (tmps, ipad, gid, 10); + ipad[11] = packv (tmps, ipad, gid, 11); + ipad[12] = packv (tmps, ipad, gid, 12); + ipad[13] = packv (tmps, ipad, gid, 13); + ipad[14] = packv (tmps, ipad, gid, 14); + ipad[15] = packv (tmps, ipad, gid, 15); + + opad[ 0] = packv (tmps, opad, gid, 0); + opad[ 1] = packv (tmps, opad, gid, 1); + opad[ 2] = packv (tmps, opad, gid, 2); + opad[ 3] = packv (tmps, opad, gid, 3); + opad[ 4] = packv (tmps, opad, gid, 4); + opad[ 5] = packv (tmps, opad, gid, 5); + opad[ 6] = packv (tmps, opad, gid, 6); + opad[ 7] = packv (tmps, opad, gid, 7); + opad[ 8] = packv (tmps, opad, gid, 8); + opad[ 9] = packv (tmps, opad, gid, 9); + opad[10] = packv (tmps, opad, gid, 10); + opad[11] = packv (tmps, opad, gid, 11); + opad[12] = packv (tmps, opad, gid, 12); + opad[13] = packv (tmps, opad, gid, 13); + opad[14] = packv (tmps, opad, gid, 14); + opad[15] = packv (tmps, opad, gid, 15); + + for (u32 i = 0; i < 16; i += 16) + { + u32x dgst[16]; + u32x out[16]; + + dgst[ 0] = packv (tmps, dgst, gid, i + 0); + dgst[ 1] = packv (tmps, dgst, gid, i + 1); + dgst[ 2] = packv (tmps, dgst, gid, i + 2); + dgst[ 3] = packv (tmps, dgst, gid, i + 3); + dgst[ 4] = packv (tmps, dgst, gid, i + 4); + dgst[ 5] = packv (tmps, dgst, gid, i + 5); + dgst[ 6] = packv (tmps, dgst, gid, i + 6); + dgst[ 7] = packv (tmps, dgst, gid, i + 7); + dgst[ 8] = packv (tmps, dgst, gid, i + 8); + dgst[ 9] = packv (tmps, dgst, gid, i + 9); + dgst[10] = packv (tmps, dgst, gid, i + 10); + dgst[11] = packv (tmps, dgst, gid, i + 11); + dgst[12] = packv (tmps, dgst, gid, i + 12); + dgst[13] = packv (tmps, dgst, gid, i + 13); + dgst[14] = packv (tmps, dgst, gid, i + 14); + dgst[15] = packv (tmps, dgst, gid, i + 15); + + out[ 0] = packv (tmps, out, gid, i + 0); + out[ 1] = packv (tmps, out, gid, i + 1); + out[ 2] = packv (tmps, out, gid, i + 2); + out[ 3] = packv (tmps, out, gid, i + 3); + out[ 4] = packv (tmps, out, gid, i + 4); + out[ 5] = packv (tmps, out, gid, i + 5); + out[ 6] = packv (tmps, out, gid, i + 6); + out[ 7] = packv (tmps, out, gid, i + 7); + out[ 8] = packv (tmps, out, gid, i + 8); + out[ 9] = packv (tmps, out, gid, i + 9); + out[10] = packv (tmps, out, gid, i + 10); + out[11] = packv (tmps, out, gid, i + 11); + out[12] = packv (tmps, out, gid, i + 12); + out[13] = packv (tmps, out, gid, i + 13); + out[14] = packv (tmps, out, gid, i + 14); + out[15] = packv (tmps, out, gid, i + 15); + + for (u32 j = 0; j < loop_cnt; j++) + { + u32x w0[4]; + u32x w1[4]; + u32x w2[4]; + u32x w3[4]; + + w0[0] = dgst[ 0]; + w0[1] = dgst[ 1]; + w0[2] = dgst[ 2]; + w0[3] = dgst[ 3]; + w1[0] = dgst[ 4]; + w1[1] = dgst[ 5]; + w1[2] = dgst[ 6]; + w1[3] = dgst[ 7]; + w2[0] = dgst[ 8]; + w2[1] = dgst[ 9]; + w2[2] = dgst[10]; + w2[3] = dgst[11]; + w3[0] = dgst[12]; + w3[1] = dgst[13]; + w3[2] = dgst[14]; + w3[3] = dgst[15]; + + hmac_whirlpool_run_V (w0, w1, w2, w3, ipad, opad, dgst, s_Ch, s_Cl); + + 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]; + out[ 8] ^= dgst[ 8]; + out[ 9] ^= dgst[ 9]; + out[10] ^= dgst[10]; + out[11] ^= dgst[11]; + out[12] ^= dgst[12]; + out[13] ^= dgst[13]; + out[14] ^= dgst[14]; + out[15] ^= dgst[15]; + + // this iteration creates a valid pim + + if (j == pim_at) + { + tmps[gid].pim_key[i + 0] = out[ 0]; + tmps[gid].pim_key[i + 1] = out[ 1]; + tmps[gid].pim_key[i + 2] = out[ 2]; + tmps[gid].pim_key[i + 3] = out[ 3]; + tmps[gid].pim_key[i + 4] = out[ 4]; + tmps[gid].pim_key[i + 5] = out[ 5]; + tmps[gid].pim_key[i + 6] = out[ 6]; + tmps[gid].pim_key[i + 7] = out[ 7]; + tmps[gid].pim_key[i + 8] = out[ 8]; + tmps[gid].pim_key[i + 9] = out[ 9]; + tmps[gid].pim_key[i + 10] = out[10]; + tmps[gid].pim_key[i + 11] = out[11]; + tmps[gid].pim_key[i + 12] = out[12]; + tmps[gid].pim_key[i + 13] = out[13]; + tmps[gid].pim_key[i + 14] = out[14]; + tmps[gid].pim_key[i + 15] = out[15]; + } + } + + unpackv (tmps, dgst, gid, i + 0, dgst[ 0]); + unpackv (tmps, dgst, gid, i + 1, dgst[ 1]); + unpackv (tmps, dgst, gid, i + 2, dgst[ 2]); + unpackv (tmps, dgst, gid, i + 3, dgst[ 3]); + unpackv (tmps, dgst, gid, i + 4, dgst[ 4]); + unpackv (tmps, dgst, gid, i + 5, dgst[ 5]); + unpackv (tmps, dgst, gid, i + 6, dgst[ 6]); + unpackv (tmps, dgst, gid, i + 7, dgst[ 7]); + unpackv (tmps, dgst, gid, i + 8, dgst[ 8]); + unpackv (tmps, dgst, gid, i + 9, dgst[ 9]); + unpackv (tmps, dgst, gid, i + 10, dgst[10]); + unpackv (tmps, dgst, gid, i + 11, dgst[11]); + unpackv (tmps, dgst, gid, i + 12, dgst[12]); + unpackv (tmps, dgst, gid, i + 13, dgst[13]); + unpackv (tmps, dgst, gid, i + 14, dgst[14]); + unpackv (tmps, dgst, gid, i + 15, dgst[15]); + + unpackv (tmps, out, gid, i + 0, out[ 0]); + unpackv (tmps, out, gid, i + 1, out[ 1]); + unpackv (tmps, out, gid, i + 2, out[ 2]); + unpackv (tmps, out, gid, i + 3, out[ 3]); + unpackv (tmps, out, gid, i + 4, out[ 4]); + unpackv (tmps, out, gid, i + 5, out[ 5]); + unpackv (tmps, out, gid, i + 6, out[ 6]); + unpackv (tmps, out, gid, i + 7, out[ 7]); + unpackv (tmps, out, gid, i + 8, out[ 8]); + unpackv (tmps, out, gid, i + 9, out[ 9]); + unpackv (tmps, out, gid, i + 10, out[10]); + unpackv (tmps, out, gid, i + 11, out[11]); + unpackv (tmps, out, gid, i + 12, out[12]); + unpackv (tmps, out, gid, i + 13, out[13]); + unpackv (tmps, out, gid, i + 14, out[14]); + unpackv (tmps, out, gid, i + 15, out[15]); + } + + if (pim == 0) return; + + if (check_header_0512 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; +} + +__kernel void m13731_comp (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * aes shared + */ + + #ifdef REAL_SHM + + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + + #endif + + /** + * Whirlpool shared + */ + + #ifdef REAL_SHM + + __local u32 s_Ch[8][256]; + __local u32 s_Cl[8][256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_Ch[0][i] = Ch[0][i]; + s_Ch[1][i] = Ch[1][i]; + s_Ch[2][i] = Ch[2][i]; + s_Ch[3][i] = Ch[3][i]; + s_Ch[4][i] = Ch[4][i]; + s_Ch[5][i] = Ch[5][i]; + s_Ch[6][i] = Ch[6][i]; + s_Ch[7][i] = Ch[7][i]; + + s_Cl[0][i] = Cl[0][i]; + s_Cl[1][i] = Cl[1][i]; + s_Cl[2][i] = Cl[2][i]; + s_Cl[3][i] = Cl[3][i]; + s_Cl[4][i] = Cl[4][i]; + s_Cl[5][i] = Cl[5][i]; + s_Cl[6][i] = Cl[6][i]; + s_Cl[7][i] = Cl[7][i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + + if (gid >= gid_max) return; + + if (tmps[gid].pim) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, tmps[gid].pim, 0); + } + } + else + { + if (check_header_0512 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } + } + } +} diff --git a/OpenCL/m13732-pure.cl b/OpenCL/m13732-pure.cl new file mode 100644 index 000000000..522ab2c1d --- /dev/null +++ b/OpenCL/m13732-pure.cl @@ -0,0 +1,899 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#undef LOCAL_MEM_TYPE +#define LOCAL_MEM_TYPE LOCAL_MEM_TYPE_GLOBAL + +#include "inc_vendor.cl" +#include "inc_hash_constants.h" +#include "inc_hash_functions.cl" +#include "inc_types.cl" +#include "inc_common.cl" +#include "inc_simd.cl" +#include "inc_hash_whirlpool.cl" + +#include "inc_cipher_aes.cl" +#include "inc_cipher_twofish.cl" +#include "inc_cipher_serpent.cl" +#include "inc_cipher_camellia.cl" +#include "inc_cipher_kuznyechik.cl" + +typedef struct vc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; + +#include "inc_truecrypt_keyfile.cl" +#include "inc_truecrypt_crc32.cl" +#include "inc_truecrypt_xts.cl" +#include "inc_veracrypt_xts.cl" + +typedef struct vc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + + u32 pim_key[64]; + int pim; // marker for cracked + +} vc_tmp_t; + +DECLSPEC int check_header_0512 (__global const vc_t *esalt_bufs, __global u32 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + + key1[0] = swap32_S (key[ 0]); + key1[1] = swap32_S (key[ 1]); + key1[2] = swap32_S (key[ 2]); + key1[3] = swap32_S (key[ 3]); + key1[4] = swap32_S (key[ 4]); + key1[5] = swap32_S (key[ 5]); + key1[6] = swap32_S (key[ 6]); + key1[7] = swap32_S (key[ 7]); + key2[0] = swap32_S (key[ 8]); + key2[1] = swap32_S (key[ 9]); + key2[2] = swap32_S (key[10]); + key2[3] = swap32_S (key[11]); + key2[4] = swap32_S (key[12]); + key2[5] = swap32_S (key[13]); + key2[6] = swap32_S (key[14]); + key2[7] = swap32_S (key[15]); + + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + + return -1; +} + +DECLSPEC int check_header_1024 (__global const vc_t *esalt_bufs, __global u32 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + u32 key3[8]; + u32 key4[8]; + + key1[0] = swap32_S (key[ 0]); + key1[1] = swap32_S (key[ 1]); + key1[2] = swap32_S (key[ 2]); + key1[3] = swap32_S (key[ 3]); + key1[4] = swap32_S (key[ 4]); + key1[5] = swap32_S (key[ 5]); + key1[6] = swap32_S (key[ 6]); + key1[7] = swap32_S (key[ 7]); + key2[0] = swap32_S (key[ 8]); + key2[1] = swap32_S (key[ 9]); + key2[2] = swap32_S (key[10]); + key2[3] = swap32_S (key[11]); + key2[4] = swap32_S (key[12]); + key2[5] = swap32_S (key[13]); + key2[6] = swap32_S (key[14]); + key2[7] = swap32_S (key[15]); + key3[0] = swap32_S (key[16]); + key3[1] = swap32_S (key[17]); + key3[2] = swap32_S (key[18]); + key3[3] = swap32_S (key[19]); + key3[4] = swap32_S (key[20]); + key3[5] = swap32_S (key[21]); + key3[6] = swap32_S (key[22]); + key3[7] = swap32_S (key[23]); + key4[0] = swap32_S (key[24]); + key4[1] = swap32_S (key[25]); + key4[2] = swap32_S (key[26]); + key4[3] = swap32_S (key[27]); + key4[4] = swap32_S (key[28]); + key4[5] = swap32_S (key[29]); + key4[6] = swap32_S (key[30]); + key4[7] = swap32_S (key[31]); + + if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_kuznyechik_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + + return -1; +} + +DECLSPEC void hmac_whirlpool_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]) +{ + digest[ 0] = ipad[ 0]; + digest[ 1] = ipad[ 1]; + digest[ 2] = ipad[ 2]; + digest[ 3] = ipad[ 3]; + digest[ 4] = ipad[ 4]; + digest[ 5] = ipad[ 5]; + digest[ 6] = ipad[ 6]; + digest[ 7] = ipad[ 7]; + digest[ 8] = ipad[ 8]; + digest[ 9] = ipad[ 9]; + digest[10] = ipad[10]; + digest[11] = ipad[11]; + digest[12] = ipad[12]; + digest[13] = ipad[13]; + digest[14] = ipad[14]; + digest[15] = ipad[15]; + + whirlpool_transform_vector (w0, w1, w2, w3, digest, s_Ch, s_Cl); + + w0[0] = 0x80000000; + w0[1] = 0; + w0[2] = 0; + w0[3] = 0; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = (64 + 64) * 8; + + whirlpool_transform_vector (w0, w1, w2, w3, digest, s_Ch, s_Cl); + + w0[0] = digest[ 0]; + w0[1] = digest[ 1]; + w0[2] = digest[ 2]; + w0[3] = digest[ 3]; + w1[0] = digest[ 4]; + w1[1] = digest[ 5]; + w1[2] = digest[ 6]; + w1[3] = digest[ 7]; + w2[0] = digest[ 8]; + w2[1] = digest[ 9]; + w2[2] = digest[10]; + w2[3] = digest[11]; + w3[0] = digest[12]; + w3[1] = digest[13]; + w3[2] = digest[14]; + w3[3] = digest[15]; + + digest[ 0] = opad[ 0]; + digest[ 1] = opad[ 1]; + digest[ 2] = opad[ 2]; + digest[ 3] = opad[ 3]; + digest[ 4] = opad[ 4]; + digest[ 5] = opad[ 5]; + digest[ 6] = opad[ 6]; + digest[ 7] = opad[ 7]; + digest[ 8] = opad[ 8]; + digest[ 9] = opad[ 9]; + digest[10] = opad[10]; + digest[11] = opad[11]; + digest[12] = opad[12]; + digest[13] = opad[13]; + digest[14] = opad[14]; + digest[15] = opad[15]; + + whirlpool_transform_vector (w0, w1, w2, w3, digest, s_Ch, s_Cl); + + w0[0] = 0x80000000; + w0[1] = 0; + w0[2] = 0; + w0[3] = 0; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = (64 + 64) * 8; + + whirlpool_transform_vector (w0, w1, w2, w3, digest, s_Ch, s_Cl); +} + +__kernel void m13732_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * keyboard layout shared + */ + + const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt; + + __local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + /** + * Whirlpool shared + */ + + #ifdef REAL_SHM + + __local u32 s_Ch[8][256]; + __local u32 s_Cl[8][256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_Ch[0][i] = Ch[0][i]; + s_Ch[1][i] = Ch[1][i]; + s_Ch[2][i] = Ch[2][i]; + s_Ch[3][i] = Ch[3][i]; + s_Ch[4][i] = Ch[4][i]; + s_Ch[5][i] = Ch[5][i]; + s_Ch[6][i] = Ch[6][i]; + s_Ch[7][i] = Ch[7][i]; + + s_Cl[0][i] = Cl[0][i]; + s_Cl[1][i] = Cl[1][i]; + s_Cl[2][i] = Cl[2][i]; + s_Cl[3][i] = Cl[3][i]; + s_Cl[4][i] = Cl[4][i]; + s_Cl[5][i] = Cl[5][i]; + s_Cl[6][i] = Cl[6][i]; + s_Cl[7][i] = Cl[7][i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + + if (gid >= gid_max) return; + + /** + * base + */ + + u32 w0[4]; + u32 w1[4]; + u32 w2[4]; + u32 w3[4]; + + w0[0] = pws[gid].i[ 0]; + w0[1] = pws[gid].i[ 1]; + w0[2] = pws[gid].i[ 2]; + w0[3] = pws[gid].i[ 3]; + w1[0] = pws[gid].i[ 4]; + w1[1] = pws[gid].i[ 5]; + w1[2] = pws[gid].i[ 6]; + w1[3] = pws[gid].i[ 7]; + w2[0] = pws[gid].i[ 8]; + w2[1] = pws[gid].i[ 9]; + w2[2] = pws[gid].i[10]; + w2[3] = pws[gid].i[11]; + w3[0] = pws[gid].i[12]; + w3[1] = pws[gid].i[13]; + w3[2] = pws[gid].i[14]; + w3[3] = pws[gid].i[15]; + + const u32 pw_len = pws[gid].pw_len; + + execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); + + w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]); + w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]); + w0[2] = u8add (w0[2], esalt_bufs[digests_offset].keyfile_buf[ 2]); + w0[3] = u8add (w0[3], esalt_bufs[digests_offset].keyfile_buf[ 3]); + w1[0] = u8add (w1[0], esalt_bufs[digests_offset].keyfile_buf[ 4]); + w1[1] = u8add (w1[1], esalt_bufs[digests_offset].keyfile_buf[ 5]); + w1[2] = u8add (w1[2], esalt_bufs[digests_offset].keyfile_buf[ 6]); + w1[3] = u8add (w1[3], esalt_bufs[digests_offset].keyfile_buf[ 7]); + w2[0] = u8add (w2[0], esalt_bufs[digests_offset].keyfile_buf[ 8]); + w2[1] = u8add (w2[1], esalt_bufs[digests_offset].keyfile_buf[ 9]); + w2[2] = u8add (w2[2], esalt_bufs[digests_offset].keyfile_buf[10]); + w2[3] = u8add (w2[3], esalt_bufs[digests_offset].keyfile_buf[11]); + w3[0] = u8add (w3[0], esalt_bufs[digests_offset].keyfile_buf[12]); + w3[1] = u8add (w3[1], esalt_bufs[digests_offset].keyfile_buf[13]); + w3[2] = u8add (w3[2], esalt_bufs[digests_offset].keyfile_buf[14]); + w3[3] = u8add (w3[3], esalt_bufs[digests_offset].keyfile_buf[15]); + + w0[0] = swap32_S (w0[0]); + w0[1] = swap32_S (w0[1]); + w0[2] = swap32_S (w0[2]); + w0[3] = swap32_S (w0[3]); + w1[0] = swap32_S (w1[0]); + w1[1] = swap32_S (w1[1]); + w1[2] = swap32_S (w1[2]); + w1[3] = swap32_S (w1[3]); + w2[0] = swap32_S (w2[0]); + w2[1] = swap32_S (w2[1]); + w2[2] = swap32_S (w2[2]); + w2[3] = swap32_S (w2[3]); + w3[0] = swap32_S (w3[0]); + w3[1] = swap32_S (w3[1]); + w3[2] = swap32_S (w3[2]); + w3[3] = swap32_S (w3[3]); + + whirlpool_hmac_ctx_t whirlpool_hmac_ctx; + + whirlpool_hmac_init_64 (&whirlpool_hmac_ctx, w0, w1, w2, w3, s_Ch, s_Cl); + + tmps[gid].ipad[ 0] = whirlpool_hmac_ctx.ipad.h[ 0]; + tmps[gid].ipad[ 1] = whirlpool_hmac_ctx.ipad.h[ 1]; + tmps[gid].ipad[ 2] = whirlpool_hmac_ctx.ipad.h[ 2]; + tmps[gid].ipad[ 3] = whirlpool_hmac_ctx.ipad.h[ 3]; + tmps[gid].ipad[ 4] = whirlpool_hmac_ctx.ipad.h[ 4]; + tmps[gid].ipad[ 5] = whirlpool_hmac_ctx.ipad.h[ 5]; + tmps[gid].ipad[ 6] = whirlpool_hmac_ctx.ipad.h[ 6]; + tmps[gid].ipad[ 7] = whirlpool_hmac_ctx.ipad.h[ 7]; + tmps[gid].ipad[ 8] = whirlpool_hmac_ctx.ipad.h[ 8]; + tmps[gid].ipad[ 9] = whirlpool_hmac_ctx.ipad.h[ 9]; + tmps[gid].ipad[10] = whirlpool_hmac_ctx.ipad.h[10]; + tmps[gid].ipad[11] = whirlpool_hmac_ctx.ipad.h[11]; + tmps[gid].ipad[12] = whirlpool_hmac_ctx.ipad.h[12]; + tmps[gid].ipad[13] = whirlpool_hmac_ctx.ipad.h[13]; + tmps[gid].ipad[14] = whirlpool_hmac_ctx.ipad.h[14]; + tmps[gid].ipad[15] = whirlpool_hmac_ctx.ipad.h[15]; + + tmps[gid].opad[ 0] = whirlpool_hmac_ctx.opad.h[ 0]; + tmps[gid].opad[ 1] = whirlpool_hmac_ctx.opad.h[ 1]; + tmps[gid].opad[ 2] = whirlpool_hmac_ctx.opad.h[ 2]; + tmps[gid].opad[ 3] = whirlpool_hmac_ctx.opad.h[ 3]; + tmps[gid].opad[ 4] = whirlpool_hmac_ctx.opad.h[ 4]; + tmps[gid].opad[ 5] = whirlpool_hmac_ctx.opad.h[ 5]; + tmps[gid].opad[ 6] = whirlpool_hmac_ctx.opad.h[ 6]; + tmps[gid].opad[ 7] = whirlpool_hmac_ctx.opad.h[ 7]; + tmps[gid].opad[ 8] = whirlpool_hmac_ctx.opad.h[ 8]; + tmps[gid].opad[ 9] = whirlpool_hmac_ctx.opad.h[ 9]; + tmps[gid].opad[10] = whirlpool_hmac_ctx.opad.h[10]; + tmps[gid].opad[11] = whirlpool_hmac_ctx.opad.h[11]; + tmps[gid].opad[12] = whirlpool_hmac_ctx.opad.h[12]; + tmps[gid].opad[13] = whirlpool_hmac_ctx.opad.h[13]; + tmps[gid].opad[14] = whirlpool_hmac_ctx.opad.h[14]; + tmps[gid].opad[15] = whirlpool_hmac_ctx.opad.h[15]; + + whirlpool_hmac_update_global_swap (&whirlpool_hmac_ctx, esalt_bufs[digests_offset].salt_buf, 64); + + for (u32 i = 0, j = 1; i < 32; i += 16, j += 1) + { + whirlpool_hmac_ctx_t whirlpool_hmac_ctx2 = whirlpool_hmac_ctx; + + w0[0] = j; + w0[1] = 0; + w0[2] = 0; + w0[3] = 0; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; + + whirlpool_hmac_update_64 (&whirlpool_hmac_ctx2, w0, w1, w2, w3, 4); + + whirlpool_hmac_final (&whirlpool_hmac_ctx2); + + tmps[gid].dgst[i + 0] = whirlpool_hmac_ctx2.opad.h[ 0]; + tmps[gid].dgst[i + 1] = whirlpool_hmac_ctx2.opad.h[ 1]; + tmps[gid].dgst[i + 2] = whirlpool_hmac_ctx2.opad.h[ 2]; + tmps[gid].dgst[i + 3] = whirlpool_hmac_ctx2.opad.h[ 3]; + tmps[gid].dgst[i + 4] = whirlpool_hmac_ctx2.opad.h[ 4]; + tmps[gid].dgst[i + 5] = whirlpool_hmac_ctx2.opad.h[ 5]; + tmps[gid].dgst[i + 6] = whirlpool_hmac_ctx2.opad.h[ 6]; + tmps[gid].dgst[i + 7] = whirlpool_hmac_ctx2.opad.h[ 7]; + tmps[gid].dgst[i + 8] = whirlpool_hmac_ctx2.opad.h[ 8]; + tmps[gid].dgst[i + 9] = whirlpool_hmac_ctx2.opad.h[ 9]; + tmps[gid].dgst[i + 10] = whirlpool_hmac_ctx2.opad.h[10]; + tmps[gid].dgst[i + 11] = whirlpool_hmac_ctx2.opad.h[11]; + tmps[gid].dgst[i + 12] = whirlpool_hmac_ctx2.opad.h[12]; + tmps[gid].dgst[i + 13] = whirlpool_hmac_ctx2.opad.h[13]; + tmps[gid].dgst[i + 14] = whirlpool_hmac_ctx2.opad.h[14]; + tmps[gid].dgst[i + 15] = whirlpool_hmac_ctx2.opad.h[15]; + + tmps[gid].out[i + 0] = tmps[gid].dgst[i + 0]; + tmps[gid].out[i + 1] = tmps[gid].dgst[i + 1]; + tmps[gid].out[i + 2] = tmps[gid].dgst[i + 2]; + tmps[gid].out[i + 3] = tmps[gid].dgst[i + 3]; + tmps[gid].out[i + 4] = tmps[gid].dgst[i + 4]; + tmps[gid].out[i + 5] = tmps[gid].dgst[i + 5]; + tmps[gid].out[i + 6] = tmps[gid].dgst[i + 6]; + tmps[gid].out[i + 7] = tmps[gid].dgst[i + 7]; + tmps[gid].out[i + 8] = tmps[gid].dgst[i + 8]; + tmps[gid].out[i + 9] = tmps[gid].dgst[i + 9]; + tmps[gid].out[i + 10] = tmps[gid].dgst[i + 10]; + tmps[gid].out[i + 11] = tmps[gid].dgst[i + 11]; + tmps[gid].out[i + 12] = tmps[gid].dgst[i + 12]; + tmps[gid].out[i + 13] = tmps[gid].dgst[i + 13]; + tmps[gid].out[i + 14] = tmps[gid].dgst[i + 14]; + tmps[gid].out[i + 15] = tmps[gid].dgst[i + 15]; + } +} + +__kernel void m13732_loop (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * aes shared + */ + + #ifdef REAL_SHM + + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + + #endif + + /** + * Whirlpool shared + */ + + #ifdef REAL_SHM + + __local u32 s_Ch[8][256]; + __local u32 s_Cl[8][256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_Ch[0][i] = Ch[0][i]; + s_Ch[1][i] = Ch[1][i]; + s_Ch[2][i] = Ch[2][i]; + s_Ch[3][i] = Ch[3][i]; + s_Ch[4][i] = Ch[4][i]; + s_Ch[5][i] = Ch[5][i]; + s_Ch[6][i] = Ch[6][i]; + s_Ch[7][i] = Ch[7][i]; + + s_Cl[0][i] = Cl[0][i]; + s_Cl[1][i] = Cl[1][i]; + s_Cl[2][i] = Cl[2][i]; + s_Cl[3][i] = Cl[3][i]; + s_Cl[4][i] = Cl[4][i]; + s_Cl[5][i] = Cl[5][i]; + s_Cl[6][i] = Cl[6][i]; + s_Cl[7][i] = Cl[7][i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + + if (gid >= gid_max) return; + + // this is the pim range check + // it is guaranteed that only 0 or 1 innerloops will match a "pim" mark (each 1000 iterations) + // therefore the module limits the inner loop iteration count to 1000 + // if the key_pim is set, we know that we have to save and check the key for this pim + + const int pim_multi = esalt_bufs[digests_offset].pim_multi; + const int pim_start = esalt_bufs[digests_offset].pim_start; + const int pim_stop = esalt_bufs[digests_offset].pim_stop; + + int pim = 0; + int pim_at = 0; + + for (u32 j = 0; j < loop_cnt; j++) + { + const int iter_abs = 1 + loop_pos + j; + + if ((iter_abs % pim_multi) == pim_multi - 1) + { + const int pim_cur = (iter_abs / pim_multi) + 1; + + if ((pim_cur >= pim_start) && (pim_cur <= pim_stop)) + { + pim = pim_cur; + + pim_at = j; + } + } + } + + // irregular pbkdf2 from here + + u32x ipad[16]; + u32x opad[16]; + + ipad[ 0] = packv (tmps, ipad, gid, 0); + ipad[ 1] = packv (tmps, ipad, gid, 1); + ipad[ 2] = packv (tmps, ipad, gid, 2); + ipad[ 3] = packv (tmps, ipad, gid, 3); + ipad[ 4] = packv (tmps, ipad, gid, 4); + ipad[ 5] = packv (tmps, ipad, gid, 5); + ipad[ 6] = packv (tmps, ipad, gid, 6); + ipad[ 7] = packv (tmps, ipad, gid, 7); + ipad[ 8] = packv (tmps, ipad, gid, 8); + ipad[ 9] = packv (tmps, ipad, gid, 9); + ipad[10] = packv (tmps, ipad, gid, 10); + ipad[11] = packv (tmps, ipad, gid, 11); + ipad[12] = packv (tmps, ipad, gid, 12); + ipad[13] = packv (tmps, ipad, gid, 13); + ipad[14] = packv (tmps, ipad, gid, 14); + ipad[15] = packv (tmps, ipad, gid, 15); + + opad[ 0] = packv (tmps, opad, gid, 0); + opad[ 1] = packv (tmps, opad, gid, 1); + opad[ 2] = packv (tmps, opad, gid, 2); + opad[ 3] = packv (tmps, opad, gid, 3); + opad[ 4] = packv (tmps, opad, gid, 4); + opad[ 5] = packv (tmps, opad, gid, 5); + opad[ 6] = packv (tmps, opad, gid, 6); + opad[ 7] = packv (tmps, opad, gid, 7); + opad[ 8] = packv (tmps, opad, gid, 8); + opad[ 9] = packv (tmps, opad, gid, 9); + opad[10] = packv (tmps, opad, gid, 10); + opad[11] = packv (tmps, opad, gid, 11); + opad[12] = packv (tmps, opad, gid, 12); + opad[13] = packv (tmps, opad, gid, 13); + opad[14] = packv (tmps, opad, gid, 14); + opad[15] = packv (tmps, opad, gid, 15); + + for (u32 i = 0; i < 32; i += 16) + { + u32x dgst[16]; + u32x out[16]; + + dgst[ 0] = packv (tmps, dgst, gid, i + 0); + dgst[ 1] = packv (tmps, dgst, gid, i + 1); + dgst[ 2] = packv (tmps, dgst, gid, i + 2); + dgst[ 3] = packv (tmps, dgst, gid, i + 3); + dgst[ 4] = packv (tmps, dgst, gid, i + 4); + dgst[ 5] = packv (tmps, dgst, gid, i + 5); + dgst[ 6] = packv (tmps, dgst, gid, i + 6); + dgst[ 7] = packv (tmps, dgst, gid, i + 7); + dgst[ 8] = packv (tmps, dgst, gid, i + 8); + dgst[ 9] = packv (tmps, dgst, gid, i + 9); + dgst[10] = packv (tmps, dgst, gid, i + 10); + dgst[11] = packv (tmps, dgst, gid, i + 11); + dgst[12] = packv (tmps, dgst, gid, i + 12); + dgst[13] = packv (tmps, dgst, gid, i + 13); + dgst[14] = packv (tmps, dgst, gid, i + 14); + dgst[15] = packv (tmps, dgst, gid, i + 15); + + out[ 0] = packv (tmps, out, gid, i + 0); + out[ 1] = packv (tmps, out, gid, i + 1); + out[ 2] = packv (tmps, out, gid, i + 2); + out[ 3] = packv (tmps, out, gid, i + 3); + out[ 4] = packv (tmps, out, gid, i + 4); + out[ 5] = packv (tmps, out, gid, i + 5); + out[ 6] = packv (tmps, out, gid, i + 6); + out[ 7] = packv (tmps, out, gid, i + 7); + out[ 8] = packv (tmps, out, gid, i + 8); + out[ 9] = packv (tmps, out, gid, i + 9); + out[10] = packv (tmps, out, gid, i + 10); + out[11] = packv (tmps, out, gid, i + 11); + out[12] = packv (tmps, out, gid, i + 12); + out[13] = packv (tmps, out, gid, i + 13); + out[14] = packv (tmps, out, gid, i + 14); + out[15] = packv (tmps, out, gid, i + 15); + + for (u32 j = 0; j < loop_cnt; j++) + { + u32x w0[4]; + u32x w1[4]; + u32x w2[4]; + u32x w3[4]; + + w0[0] = dgst[ 0]; + w0[1] = dgst[ 1]; + w0[2] = dgst[ 2]; + w0[3] = dgst[ 3]; + w1[0] = dgst[ 4]; + w1[1] = dgst[ 5]; + w1[2] = dgst[ 6]; + w1[3] = dgst[ 7]; + w2[0] = dgst[ 8]; + w2[1] = dgst[ 9]; + w2[2] = dgst[10]; + w2[3] = dgst[11]; + w3[0] = dgst[12]; + w3[1] = dgst[13]; + w3[2] = dgst[14]; + w3[3] = dgst[15]; + + hmac_whirlpool_run_V (w0, w1, w2, w3, ipad, opad, dgst, s_Ch, s_Cl); + + 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]; + out[ 8] ^= dgst[ 8]; + out[ 9] ^= dgst[ 9]; + out[10] ^= dgst[10]; + out[11] ^= dgst[11]; + out[12] ^= dgst[12]; + out[13] ^= dgst[13]; + out[14] ^= dgst[14]; + out[15] ^= dgst[15]; + + // this iteration creates a valid pim + + if (j == pim_at) + { + tmps[gid].pim_key[i + 0] = out[ 0]; + tmps[gid].pim_key[i + 1] = out[ 1]; + tmps[gid].pim_key[i + 2] = out[ 2]; + tmps[gid].pim_key[i + 3] = out[ 3]; + tmps[gid].pim_key[i + 4] = out[ 4]; + tmps[gid].pim_key[i + 5] = out[ 5]; + tmps[gid].pim_key[i + 6] = out[ 6]; + tmps[gid].pim_key[i + 7] = out[ 7]; + tmps[gid].pim_key[i + 8] = out[ 8]; + tmps[gid].pim_key[i + 9] = out[ 9]; + tmps[gid].pim_key[i + 10] = out[10]; + tmps[gid].pim_key[i + 11] = out[11]; + tmps[gid].pim_key[i + 12] = out[12]; + tmps[gid].pim_key[i + 13] = out[13]; + tmps[gid].pim_key[i + 14] = out[14]; + tmps[gid].pim_key[i + 15] = out[15]; + } + } + + unpackv (tmps, dgst, gid, i + 0, dgst[ 0]); + unpackv (tmps, dgst, gid, i + 1, dgst[ 1]); + unpackv (tmps, dgst, gid, i + 2, dgst[ 2]); + unpackv (tmps, dgst, gid, i + 3, dgst[ 3]); + unpackv (tmps, dgst, gid, i + 4, dgst[ 4]); + unpackv (tmps, dgst, gid, i + 5, dgst[ 5]); + unpackv (tmps, dgst, gid, i + 6, dgst[ 6]); + unpackv (tmps, dgst, gid, i + 7, dgst[ 7]); + unpackv (tmps, dgst, gid, i + 8, dgst[ 8]); + unpackv (tmps, dgst, gid, i + 9, dgst[ 9]); + unpackv (tmps, dgst, gid, i + 10, dgst[10]); + unpackv (tmps, dgst, gid, i + 11, dgst[11]); + unpackv (tmps, dgst, gid, i + 12, dgst[12]); + unpackv (tmps, dgst, gid, i + 13, dgst[13]); + unpackv (tmps, dgst, gid, i + 14, dgst[14]); + unpackv (tmps, dgst, gid, i + 15, dgst[15]); + + unpackv (tmps, out, gid, i + 0, out[ 0]); + unpackv (tmps, out, gid, i + 1, out[ 1]); + unpackv (tmps, out, gid, i + 2, out[ 2]); + unpackv (tmps, out, gid, i + 3, out[ 3]); + unpackv (tmps, out, gid, i + 4, out[ 4]); + unpackv (tmps, out, gid, i + 5, out[ 5]); + unpackv (tmps, out, gid, i + 6, out[ 6]); + unpackv (tmps, out, gid, i + 7, out[ 7]); + unpackv (tmps, out, gid, i + 8, out[ 8]); + unpackv (tmps, out, gid, i + 9, out[ 9]); + unpackv (tmps, out, gid, i + 10, out[10]); + unpackv (tmps, out, gid, i + 11, out[11]); + unpackv (tmps, out, gid, i + 12, out[12]); + unpackv (tmps, out, gid, i + 13, out[13]); + unpackv (tmps, out, gid, i + 14, out[14]); + unpackv (tmps, out, gid, i + 15, out[15]); + } + + if (pim == 0) return; + + if (check_header_0512 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; + if (check_header_1024 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; +} + +__kernel void m13732_comp (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * aes shared + */ + + #ifdef REAL_SHM + + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + + #endif + + /** + * Whirlpool shared + */ + + #ifdef REAL_SHM + + __local u32 s_Ch[8][256]; + __local u32 s_Cl[8][256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_Ch[0][i] = Ch[0][i]; + s_Ch[1][i] = Ch[1][i]; + s_Ch[2][i] = Ch[2][i]; + s_Ch[3][i] = Ch[3][i]; + s_Ch[4][i] = Ch[4][i]; + s_Ch[5][i] = Ch[5][i]; + s_Ch[6][i] = Ch[6][i]; + s_Ch[7][i] = Ch[7][i]; + + s_Cl[0][i] = Cl[0][i]; + s_Cl[1][i] = Cl[1][i]; + s_Cl[2][i] = Cl[2][i]; + s_Cl[3][i] = Cl[3][i]; + s_Cl[4][i] = Cl[4][i]; + s_Cl[5][i] = Cl[5][i]; + s_Cl[6][i] = Cl[6][i]; + s_Cl[7][i] = Cl[7][i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + + if (gid >= gid_max) return; + + if (tmps[gid].pim) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, tmps[gid].pim, 0); + } + } + else + { + if (check_header_0512 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } + } + + if (check_header_1024 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } + } + } +} diff --git a/OpenCL/m13733-pure.cl b/OpenCL/m13733-pure.cl new file mode 100644 index 000000000..9a8bbaa3c --- /dev/null +++ b/OpenCL/m13733-pure.cl @@ -0,0 +1,973 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#undef LOCAL_MEM_TYPE +#define LOCAL_MEM_TYPE LOCAL_MEM_TYPE_GLOBAL + +#include "inc_vendor.cl" +#include "inc_hash_constants.h" +#include "inc_hash_functions.cl" +#include "inc_types.cl" +#include "inc_common.cl" +#include "inc_simd.cl" +#include "inc_hash_whirlpool.cl" + +#include "inc_cipher_aes.cl" +#include "inc_cipher_twofish.cl" +#include "inc_cipher_serpent.cl" +#include "inc_cipher_camellia.cl" +#include "inc_cipher_kuznyechik.cl" + +typedef struct vc +{ + u32 salt_buf[32]; + u32 data_buf[112]; + u32 keyfile_buf[16]; + u32 signature; + + keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; + int keyboard_layout_mapping_cnt; + + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; + +#include "inc_truecrypt_keyfile.cl" +#include "inc_truecrypt_crc32.cl" +#include "inc_truecrypt_xts.cl" +#include "inc_veracrypt_xts.cl" + +typedef struct vc_tmp +{ + u32 ipad[16]; + u32 opad[16]; + + u32 dgst[64]; + u32 out[64]; + + u32 pim_key[64]; + int pim; // marker for cracked + +} vc_tmp_t; + +DECLSPEC int check_header_0512 (__global const vc_t *esalt_bufs, __global u32 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + + key1[0] = swap32_S (key[ 0]); + key1[1] = swap32_S (key[ 1]); + key1[2] = swap32_S (key[ 2]); + key1[3] = swap32_S (key[ 3]); + key1[4] = swap32_S (key[ 4]); + key1[5] = swap32_S (key[ 5]); + key1[6] = swap32_S (key[ 6]); + key1[7] = swap32_S (key[ 7]); + key2[0] = swap32_S (key[ 8]); + key2[1] = swap32_S (key[ 9]); + key2[2] = swap32_S (key[10]); + key2[3] = swap32_S (key[11]); + key2[4] = swap32_S (key[12]); + key2[5] = swap32_S (key[13]); + key2[6] = swap32_S (key[14]); + key2[7] = swap32_S (key[15]); + + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + + return -1; +} + +DECLSPEC int check_header_1024 (__global const vc_t *esalt_bufs, __global u32 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + u32 key3[8]; + u32 key4[8]; + + key1[0] = swap32_S (key[ 0]); + key1[1] = swap32_S (key[ 1]); + key1[2] = swap32_S (key[ 2]); + key1[3] = swap32_S (key[ 3]); + key1[4] = swap32_S (key[ 4]); + key1[5] = swap32_S (key[ 5]); + key1[6] = swap32_S (key[ 6]); + key1[7] = swap32_S (key[ 7]); + key2[0] = swap32_S (key[ 8]); + key2[1] = swap32_S (key[ 9]); + key2[2] = swap32_S (key[10]); + key2[3] = swap32_S (key[11]); + key2[4] = swap32_S (key[12]); + key2[5] = swap32_S (key[13]); + key2[6] = swap32_S (key[14]); + key2[7] = swap32_S (key[15]); + key3[0] = swap32_S (key[16]); + key3[1] = swap32_S (key[17]); + key3[2] = swap32_S (key[18]); + key3[3] = swap32_S (key[19]); + key3[4] = swap32_S (key[20]); + key3[5] = swap32_S (key[21]); + key3[6] = swap32_S (key[22]); + key3[7] = swap32_S (key[23]); + key4[0] = swap32_S (key[24]); + key4[1] = swap32_S (key[25]); + key4[2] = swap32_S (key[26]); + key4[3] = swap32_S (key[27]); + key4[4] = swap32_S (key[28]); + key4[5] = swap32_S (key[29]); + key4[6] = swap32_S (key[30]); + key4[7] = swap32_S (key[31]); + + if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_kuznyechik_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + + return -1; +} + +DECLSPEC int check_header_1536 (__global const vc_t *esalt_bufs, __global u32 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + u32 key3[8]; + u32 key4[8]; + u32 key5[8]; + u32 key6[8]; + + key1[0] = swap32_S (key[ 0]); + key1[1] = swap32_S (key[ 1]); + key1[2] = swap32_S (key[ 2]); + key1[3] = swap32_S (key[ 3]); + key1[4] = swap32_S (key[ 4]); + key1[5] = swap32_S (key[ 5]); + key1[6] = swap32_S (key[ 6]); + key1[7] = swap32_S (key[ 7]); + key2[0] = swap32_S (key[ 8]); + key2[1] = swap32_S (key[ 9]); + key2[2] = swap32_S (key[10]); + key2[3] = swap32_S (key[11]); + key2[4] = swap32_S (key[12]); + key2[5] = swap32_S (key[13]); + key2[6] = swap32_S (key[14]); + key2[7] = swap32_S (key[15]); + key3[0] = swap32_S (key[16]); + key3[1] = swap32_S (key[17]); + key3[2] = swap32_S (key[18]); + key3[3] = swap32_S (key[19]); + key3[4] = swap32_S (key[20]); + key3[5] = swap32_S (key[21]); + key3[6] = swap32_S (key[22]); + key3[7] = swap32_S (key[23]); + key4[0] = swap32_S (key[24]); + key4[1] = swap32_S (key[25]); + key4[2] = swap32_S (key[26]); + key4[3] = swap32_S (key[27]); + key4[4] = swap32_S (key[28]); + key4[5] = swap32_S (key[29]); + key4[6] = swap32_S (key[30]); + key4[7] = swap32_S (key[31]); + key5[0] = swap32_S (key[32]); + key5[1] = swap32_S (key[33]); + key5[2] = swap32_S (key[34]); + key5[3] = swap32_S (key[35]); + key5[4] = swap32_S (key[36]); + key5[5] = swap32_S (key[37]); + key5[6] = swap32_S (key[38]); + key5[7] = swap32_S (key[39]); + key6[0] = swap32_S (key[40]); + key6[1] = swap32_S (key[41]); + key6[2] = swap32_S (key[42]); + key6[3] = swap32_S (key[43]); + key6[4] = swap32_S (key[44]); + key6[5] = swap32_S (key[45]); + key6[6] = swap32_S (key[46]); + key6[7] = swap32_S (key[47]); + + if (verify_header_aes_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, key5, key6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent_twofish_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, key5, key6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_kuznyechik_serpent_camellia (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, key5, key6) == 1) return 0; + + return -1; +} + +DECLSPEC void hmac_whirlpool_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256]) +{ + digest[ 0] = ipad[ 0]; + digest[ 1] = ipad[ 1]; + digest[ 2] = ipad[ 2]; + digest[ 3] = ipad[ 3]; + digest[ 4] = ipad[ 4]; + digest[ 5] = ipad[ 5]; + digest[ 6] = ipad[ 6]; + digest[ 7] = ipad[ 7]; + digest[ 8] = ipad[ 8]; + digest[ 9] = ipad[ 9]; + digest[10] = ipad[10]; + digest[11] = ipad[11]; + digest[12] = ipad[12]; + digest[13] = ipad[13]; + digest[14] = ipad[14]; + digest[15] = ipad[15]; + + whirlpool_transform_vector (w0, w1, w2, w3, digest, s_Ch, s_Cl); + + w0[0] = 0x80000000; + w0[1] = 0; + w0[2] = 0; + w0[3] = 0; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = (64 + 64) * 8; + + whirlpool_transform_vector (w0, w1, w2, w3, digest, s_Ch, s_Cl); + + w0[0] = digest[ 0]; + w0[1] = digest[ 1]; + w0[2] = digest[ 2]; + w0[3] = digest[ 3]; + w1[0] = digest[ 4]; + w1[1] = digest[ 5]; + w1[2] = digest[ 6]; + w1[3] = digest[ 7]; + w2[0] = digest[ 8]; + w2[1] = digest[ 9]; + w2[2] = digest[10]; + w2[3] = digest[11]; + w3[0] = digest[12]; + w3[1] = digest[13]; + w3[2] = digest[14]; + w3[3] = digest[15]; + + digest[ 0] = opad[ 0]; + digest[ 1] = opad[ 1]; + digest[ 2] = opad[ 2]; + digest[ 3] = opad[ 3]; + digest[ 4] = opad[ 4]; + digest[ 5] = opad[ 5]; + digest[ 6] = opad[ 6]; + digest[ 7] = opad[ 7]; + digest[ 8] = opad[ 8]; + digest[ 9] = opad[ 9]; + digest[10] = opad[10]; + digest[11] = opad[11]; + digest[12] = opad[12]; + digest[13] = opad[13]; + digest[14] = opad[14]; + digest[15] = opad[15]; + + whirlpool_transform_vector (w0, w1, w2, w3, digest, s_Ch, s_Cl); + + w0[0] = 0x80000000; + w0[1] = 0; + w0[2] = 0; + w0[3] = 0; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = (64 + 64) * 8; + + whirlpool_transform_vector (w0, w1, w2, w3, digest, s_Ch, s_Cl); +} + +__kernel void m13733_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * keyboard layout shared + */ + + const int keyboard_layout_mapping_cnt = esalt_bufs[digests_offset].keyboard_layout_mapping_cnt; + + __local keyboard_layout_mapping_t s_keyboard_layout_mapping_buf[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + /** + * Whirlpool shared + */ + + #ifdef REAL_SHM + + __local u32 s_Ch[8][256]; + __local u32 s_Cl[8][256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_Ch[0][i] = Ch[0][i]; + s_Ch[1][i] = Ch[1][i]; + s_Ch[2][i] = Ch[2][i]; + s_Ch[3][i] = Ch[3][i]; + s_Ch[4][i] = Ch[4][i]; + s_Ch[5][i] = Ch[5][i]; + s_Ch[6][i] = Ch[6][i]; + s_Ch[7][i] = Ch[7][i]; + + s_Cl[0][i] = Cl[0][i]; + s_Cl[1][i] = Cl[1][i]; + s_Cl[2][i] = Cl[2][i]; + s_Cl[3][i] = Cl[3][i]; + s_Cl[4][i] = Cl[4][i]; + s_Cl[5][i] = Cl[5][i]; + s_Cl[6][i] = Cl[6][i]; + s_Cl[7][i] = Cl[7][i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + + if (gid >= gid_max) return; + + /** + * base + */ + + u32 w0[4]; + u32 w1[4]; + u32 w2[4]; + u32 w3[4]; + + w0[0] = pws[gid].i[ 0]; + w0[1] = pws[gid].i[ 1]; + w0[2] = pws[gid].i[ 2]; + w0[3] = pws[gid].i[ 3]; + w1[0] = pws[gid].i[ 4]; + w1[1] = pws[gid].i[ 5]; + w1[2] = pws[gid].i[ 6]; + w1[3] = pws[gid].i[ 7]; + w2[0] = pws[gid].i[ 8]; + w2[1] = pws[gid].i[ 9]; + w2[2] = pws[gid].i[10]; + w2[3] = pws[gid].i[11]; + w3[0] = pws[gid].i[12]; + w3[1] = pws[gid].i[13]; + w3[2] = pws[gid].i[14]; + w3[3] = pws[gid].i[15]; + + const u32 pw_len = pws[gid].pw_len; + + execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); + + w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]); + w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]); + w0[2] = u8add (w0[2], esalt_bufs[digests_offset].keyfile_buf[ 2]); + w0[3] = u8add (w0[3], esalt_bufs[digests_offset].keyfile_buf[ 3]); + w1[0] = u8add (w1[0], esalt_bufs[digests_offset].keyfile_buf[ 4]); + w1[1] = u8add (w1[1], esalt_bufs[digests_offset].keyfile_buf[ 5]); + w1[2] = u8add (w1[2], esalt_bufs[digests_offset].keyfile_buf[ 6]); + w1[3] = u8add (w1[3], esalt_bufs[digests_offset].keyfile_buf[ 7]); + w2[0] = u8add (w2[0], esalt_bufs[digests_offset].keyfile_buf[ 8]); + w2[1] = u8add (w2[1], esalt_bufs[digests_offset].keyfile_buf[ 9]); + w2[2] = u8add (w2[2], esalt_bufs[digests_offset].keyfile_buf[10]); + w2[3] = u8add (w2[3], esalt_bufs[digests_offset].keyfile_buf[11]); + w3[0] = u8add (w3[0], esalt_bufs[digests_offset].keyfile_buf[12]); + w3[1] = u8add (w3[1], esalt_bufs[digests_offset].keyfile_buf[13]); + w3[2] = u8add (w3[2], esalt_bufs[digests_offset].keyfile_buf[14]); + w3[3] = u8add (w3[3], esalt_bufs[digests_offset].keyfile_buf[15]); + + w0[0] = swap32_S (w0[0]); + w0[1] = swap32_S (w0[1]); + w0[2] = swap32_S (w0[2]); + w0[3] = swap32_S (w0[3]); + w1[0] = swap32_S (w1[0]); + w1[1] = swap32_S (w1[1]); + w1[2] = swap32_S (w1[2]); + w1[3] = swap32_S (w1[3]); + w2[0] = swap32_S (w2[0]); + w2[1] = swap32_S (w2[1]); + w2[2] = swap32_S (w2[2]); + w2[3] = swap32_S (w2[3]); + w3[0] = swap32_S (w3[0]); + w3[1] = swap32_S (w3[1]); + w3[2] = swap32_S (w3[2]); + w3[3] = swap32_S (w3[3]); + + whirlpool_hmac_ctx_t whirlpool_hmac_ctx; + + whirlpool_hmac_init_64 (&whirlpool_hmac_ctx, w0, w1, w2, w3, s_Ch, s_Cl); + + tmps[gid].ipad[ 0] = whirlpool_hmac_ctx.ipad.h[ 0]; + tmps[gid].ipad[ 1] = whirlpool_hmac_ctx.ipad.h[ 1]; + tmps[gid].ipad[ 2] = whirlpool_hmac_ctx.ipad.h[ 2]; + tmps[gid].ipad[ 3] = whirlpool_hmac_ctx.ipad.h[ 3]; + tmps[gid].ipad[ 4] = whirlpool_hmac_ctx.ipad.h[ 4]; + tmps[gid].ipad[ 5] = whirlpool_hmac_ctx.ipad.h[ 5]; + tmps[gid].ipad[ 6] = whirlpool_hmac_ctx.ipad.h[ 6]; + tmps[gid].ipad[ 7] = whirlpool_hmac_ctx.ipad.h[ 7]; + tmps[gid].ipad[ 8] = whirlpool_hmac_ctx.ipad.h[ 8]; + tmps[gid].ipad[ 9] = whirlpool_hmac_ctx.ipad.h[ 9]; + tmps[gid].ipad[10] = whirlpool_hmac_ctx.ipad.h[10]; + tmps[gid].ipad[11] = whirlpool_hmac_ctx.ipad.h[11]; + tmps[gid].ipad[12] = whirlpool_hmac_ctx.ipad.h[12]; + tmps[gid].ipad[13] = whirlpool_hmac_ctx.ipad.h[13]; + tmps[gid].ipad[14] = whirlpool_hmac_ctx.ipad.h[14]; + tmps[gid].ipad[15] = whirlpool_hmac_ctx.ipad.h[15]; + + tmps[gid].opad[ 0] = whirlpool_hmac_ctx.opad.h[ 0]; + tmps[gid].opad[ 1] = whirlpool_hmac_ctx.opad.h[ 1]; + tmps[gid].opad[ 2] = whirlpool_hmac_ctx.opad.h[ 2]; + tmps[gid].opad[ 3] = whirlpool_hmac_ctx.opad.h[ 3]; + tmps[gid].opad[ 4] = whirlpool_hmac_ctx.opad.h[ 4]; + tmps[gid].opad[ 5] = whirlpool_hmac_ctx.opad.h[ 5]; + tmps[gid].opad[ 6] = whirlpool_hmac_ctx.opad.h[ 6]; + tmps[gid].opad[ 7] = whirlpool_hmac_ctx.opad.h[ 7]; + tmps[gid].opad[ 8] = whirlpool_hmac_ctx.opad.h[ 8]; + tmps[gid].opad[ 9] = whirlpool_hmac_ctx.opad.h[ 9]; + tmps[gid].opad[10] = whirlpool_hmac_ctx.opad.h[10]; + tmps[gid].opad[11] = whirlpool_hmac_ctx.opad.h[11]; + tmps[gid].opad[12] = whirlpool_hmac_ctx.opad.h[12]; + tmps[gid].opad[13] = whirlpool_hmac_ctx.opad.h[13]; + tmps[gid].opad[14] = whirlpool_hmac_ctx.opad.h[14]; + tmps[gid].opad[15] = whirlpool_hmac_ctx.opad.h[15]; + + whirlpool_hmac_update_global_swap (&whirlpool_hmac_ctx, esalt_bufs[digests_offset].salt_buf, 64); + + for (u32 i = 0, j = 1; i < 48; i += 16, j += 1) + { + whirlpool_hmac_ctx_t whirlpool_hmac_ctx2 = whirlpool_hmac_ctx; + + w0[0] = j; + w0[1] = 0; + w0[2] = 0; + w0[3] = 0; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; + + whirlpool_hmac_update_64 (&whirlpool_hmac_ctx2, w0, w1, w2, w3, 4); + + whirlpool_hmac_final (&whirlpool_hmac_ctx2); + + tmps[gid].dgst[i + 0] = whirlpool_hmac_ctx2.opad.h[ 0]; + tmps[gid].dgst[i + 1] = whirlpool_hmac_ctx2.opad.h[ 1]; + tmps[gid].dgst[i + 2] = whirlpool_hmac_ctx2.opad.h[ 2]; + tmps[gid].dgst[i + 3] = whirlpool_hmac_ctx2.opad.h[ 3]; + tmps[gid].dgst[i + 4] = whirlpool_hmac_ctx2.opad.h[ 4]; + tmps[gid].dgst[i + 5] = whirlpool_hmac_ctx2.opad.h[ 5]; + tmps[gid].dgst[i + 6] = whirlpool_hmac_ctx2.opad.h[ 6]; + tmps[gid].dgst[i + 7] = whirlpool_hmac_ctx2.opad.h[ 7]; + tmps[gid].dgst[i + 8] = whirlpool_hmac_ctx2.opad.h[ 8]; + tmps[gid].dgst[i + 9] = whirlpool_hmac_ctx2.opad.h[ 9]; + tmps[gid].dgst[i + 10] = whirlpool_hmac_ctx2.opad.h[10]; + tmps[gid].dgst[i + 11] = whirlpool_hmac_ctx2.opad.h[11]; + tmps[gid].dgst[i + 12] = whirlpool_hmac_ctx2.opad.h[12]; + tmps[gid].dgst[i + 13] = whirlpool_hmac_ctx2.opad.h[13]; + tmps[gid].dgst[i + 14] = whirlpool_hmac_ctx2.opad.h[14]; + tmps[gid].dgst[i + 15] = whirlpool_hmac_ctx2.opad.h[15]; + + tmps[gid].out[i + 0] = tmps[gid].dgst[i + 0]; + tmps[gid].out[i + 1] = tmps[gid].dgst[i + 1]; + tmps[gid].out[i + 2] = tmps[gid].dgst[i + 2]; + tmps[gid].out[i + 3] = tmps[gid].dgst[i + 3]; + tmps[gid].out[i + 4] = tmps[gid].dgst[i + 4]; + tmps[gid].out[i + 5] = tmps[gid].dgst[i + 5]; + tmps[gid].out[i + 6] = tmps[gid].dgst[i + 6]; + tmps[gid].out[i + 7] = tmps[gid].dgst[i + 7]; + tmps[gid].out[i + 8] = tmps[gid].dgst[i + 8]; + tmps[gid].out[i + 9] = tmps[gid].dgst[i + 9]; + tmps[gid].out[i + 10] = tmps[gid].dgst[i + 10]; + tmps[gid].out[i + 11] = tmps[gid].dgst[i + 11]; + tmps[gid].out[i + 12] = tmps[gid].dgst[i + 12]; + tmps[gid].out[i + 13] = tmps[gid].dgst[i + 13]; + tmps[gid].out[i + 14] = tmps[gid].dgst[i + 14]; + tmps[gid].out[i + 15] = tmps[gid].dgst[i + 15]; + } +} + +__kernel void m13733_loop (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * aes shared + */ + + #ifdef REAL_SHM + + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + + #endif + + /** + * Whirlpool shared + */ + + #ifdef REAL_SHM + + __local u32 s_Ch[8][256]; + __local u32 s_Cl[8][256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_Ch[0][i] = Ch[0][i]; + s_Ch[1][i] = Ch[1][i]; + s_Ch[2][i] = Ch[2][i]; + s_Ch[3][i] = Ch[3][i]; + s_Ch[4][i] = Ch[4][i]; + s_Ch[5][i] = Ch[5][i]; + s_Ch[6][i] = Ch[6][i]; + s_Ch[7][i] = Ch[7][i]; + + s_Cl[0][i] = Cl[0][i]; + s_Cl[1][i] = Cl[1][i]; + s_Cl[2][i] = Cl[2][i]; + s_Cl[3][i] = Cl[3][i]; + s_Cl[4][i] = Cl[4][i]; + s_Cl[5][i] = Cl[5][i]; + s_Cl[6][i] = Cl[6][i]; + s_Cl[7][i] = Cl[7][i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + + if (gid >= gid_max) return; + + // this is the pim range check + // it is guaranteed that only 0 or 1 innerloops will match a "pim" mark (each 1000 iterations) + // therefore the module limits the inner loop iteration count to 1000 + // if the key_pim is set, we know that we have to save and check the key for this pim + + const int pim_multi = esalt_bufs[digests_offset].pim_multi; + const int pim_start = esalt_bufs[digests_offset].pim_start; + const int pim_stop = esalt_bufs[digests_offset].pim_stop; + + int pim = 0; + int pim_at = 0; + + for (u32 j = 0; j < loop_cnt; j++) + { + const int iter_abs = 1 + loop_pos + j; + + if ((iter_abs % pim_multi) == pim_multi - 1) + { + const int pim_cur = (iter_abs / pim_multi) + 1; + + if ((pim_cur >= pim_start) && (pim_cur <= pim_stop)) + { + pim = pim_cur; + + pim_at = j; + } + } + } + + // irregular pbkdf2 from here + + u32x ipad[16]; + u32x opad[16]; + + ipad[ 0] = packv (tmps, ipad, gid, 0); + ipad[ 1] = packv (tmps, ipad, gid, 1); + ipad[ 2] = packv (tmps, ipad, gid, 2); + ipad[ 3] = packv (tmps, ipad, gid, 3); + ipad[ 4] = packv (tmps, ipad, gid, 4); + ipad[ 5] = packv (tmps, ipad, gid, 5); + ipad[ 6] = packv (tmps, ipad, gid, 6); + ipad[ 7] = packv (tmps, ipad, gid, 7); + ipad[ 8] = packv (tmps, ipad, gid, 8); + ipad[ 9] = packv (tmps, ipad, gid, 9); + ipad[10] = packv (tmps, ipad, gid, 10); + ipad[11] = packv (tmps, ipad, gid, 11); + ipad[12] = packv (tmps, ipad, gid, 12); + ipad[13] = packv (tmps, ipad, gid, 13); + ipad[14] = packv (tmps, ipad, gid, 14); + ipad[15] = packv (tmps, ipad, gid, 15); + + opad[ 0] = packv (tmps, opad, gid, 0); + opad[ 1] = packv (tmps, opad, gid, 1); + opad[ 2] = packv (tmps, opad, gid, 2); + opad[ 3] = packv (tmps, opad, gid, 3); + opad[ 4] = packv (tmps, opad, gid, 4); + opad[ 5] = packv (tmps, opad, gid, 5); + opad[ 6] = packv (tmps, opad, gid, 6); + opad[ 7] = packv (tmps, opad, gid, 7); + opad[ 8] = packv (tmps, opad, gid, 8); + opad[ 9] = packv (tmps, opad, gid, 9); + opad[10] = packv (tmps, opad, gid, 10); + opad[11] = packv (tmps, opad, gid, 11); + opad[12] = packv (tmps, opad, gid, 12); + opad[13] = packv (tmps, opad, gid, 13); + opad[14] = packv (tmps, opad, gid, 14); + opad[15] = packv (tmps, opad, gid, 15); + + for (u32 i = 0; i < 48; i += 16) + { + u32x dgst[16]; + u32x out[16]; + + dgst[ 0] = packv (tmps, dgst, gid, i + 0); + dgst[ 1] = packv (tmps, dgst, gid, i + 1); + dgst[ 2] = packv (tmps, dgst, gid, i + 2); + dgst[ 3] = packv (tmps, dgst, gid, i + 3); + dgst[ 4] = packv (tmps, dgst, gid, i + 4); + dgst[ 5] = packv (tmps, dgst, gid, i + 5); + dgst[ 6] = packv (tmps, dgst, gid, i + 6); + dgst[ 7] = packv (tmps, dgst, gid, i + 7); + dgst[ 8] = packv (tmps, dgst, gid, i + 8); + dgst[ 9] = packv (tmps, dgst, gid, i + 9); + dgst[10] = packv (tmps, dgst, gid, i + 10); + dgst[11] = packv (tmps, dgst, gid, i + 11); + dgst[12] = packv (tmps, dgst, gid, i + 12); + dgst[13] = packv (tmps, dgst, gid, i + 13); + dgst[14] = packv (tmps, dgst, gid, i + 14); + dgst[15] = packv (tmps, dgst, gid, i + 15); + + out[ 0] = packv (tmps, out, gid, i + 0); + out[ 1] = packv (tmps, out, gid, i + 1); + out[ 2] = packv (tmps, out, gid, i + 2); + out[ 3] = packv (tmps, out, gid, i + 3); + out[ 4] = packv (tmps, out, gid, i + 4); + out[ 5] = packv (tmps, out, gid, i + 5); + out[ 6] = packv (tmps, out, gid, i + 6); + out[ 7] = packv (tmps, out, gid, i + 7); + out[ 8] = packv (tmps, out, gid, i + 8); + out[ 9] = packv (tmps, out, gid, i + 9); + out[10] = packv (tmps, out, gid, i + 10); + out[11] = packv (tmps, out, gid, i + 11); + out[12] = packv (tmps, out, gid, i + 12); + out[13] = packv (tmps, out, gid, i + 13); + out[14] = packv (tmps, out, gid, i + 14); + out[15] = packv (tmps, out, gid, i + 15); + + for (u32 j = 0; j < loop_cnt; j++) + { + u32x w0[4]; + u32x w1[4]; + u32x w2[4]; + u32x w3[4]; + + w0[0] = dgst[ 0]; + w0[1] = dgst[ 1]; + w0[2] = dgst[ 2]; + w0[3] = dgst[ 3]; + w1[0] = dgst[ 4]; + w1[1] = dgst[ 5]; + w1[2] = dgst[ 6]; + w1[3] = dgst[ 7]; + w2[0] = dgst[ 8]; + w2[1] = dgst[ 9]; + w2[2] = dgst[10]; + w2[3] = dgst[11]; + w3[0] = dgst[12]; + w3[1] = dgst[13]; + w3[2] = dgst[14]; + w3[3] = dgst[15]; + + hmac_whirlpool_run_V (w0, w1, w2, w3, ipad, opad, dgst, s_Ch, s_Cl); + + 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]; + out[ 8] ^= dgst[ 8]; + out[ 9] ^= dgst[ 9]; + out[10] ^= dgst[10]; + out[11] ^= dgst[11]; + out[12] ^= dgst[12]; + out[13] ^= dgst[13]; + out[14] ^= dgst[14]; + out[15] ^= dgst[15]; + + // this iteration creates a valid pim + + if (j == pim_at) + { + tmps[gid].pim_key[i + 0] = out[ 0]; + tmps[gid].pim_key[i + 1] = out[ 1]; + tmps[gid].pim_key[i + 2] = out[ 2]; + tmps[gid].pim_key[i + 3] = out[ 3]; + tmps[gid].pim_key[i + 4] = out[ 4]; + tmps[gid].pim_key[i + 5] = out[ 5]; + tmps[gid].pim_key[i + 6] = out[ 6]; + tmps[gid].pim_key[i + 7] = out[ 7]; + tmps[gid].pim_key[i + 8] = out[ 8]; + tmps[gid].pim_key[i + 9] = out[ 9]; + tmps[gid].pim_key[i + 10] = out[10]; + tmps[gid].pim_key[i + 11] = out[11]; + tmps[gid].pim_key[i + 12] = out[12]; + tmps[gid].pim_key[i + 13] = out[13]; + tmps[gid].pim_key[i + 14] = out[14]; + tmps[gid].pim_key[i + 15] = out[15]; + } + } + + unpackv (tmps, dgst, gid, i + 0, dgst[ 0]); + unpackv (tmps, dgst, gid, i + 1, dgst[ 1]); + unpackv (tmps, dgst, gid, i + 2, dgst[ 2]); + unpackv (tmps, dgst, gid, i + 3, dgst[ 3]); + unpackv (tmps, dgst, gid, i + 4, dgst[ 4]); + unpackv (tmps, dgst, gid, i + 5, dgst[ 5]); + unpackv (tmps, dgst, gid, i + 6, dgst[ 6]); + unpackv (tmps, dgst, gid, i + 7, dgst[ 7]); + unpackv (tmps, dgst, gid, i + 8, dgst[ 8]); + unpackv (tmps, dgst, gid, i + 9, dgst[ 9]); + unpackv (tmps, dgst, gid, i + 10, dgst[10]); + unpackv (tmps, dgst, gid, i + 11, dgst[11]); + unpackv (tmps, dgst, gid, i + 12, dgst[12]); + unpackv (tmps, dgst, gid, i + 13, dgst[13]); + unpackv (tmps, dgst, gid, i + 14, dgst[14]); + unpackv (tmps, dgst, gid, i + 15, dgst[15]); + + unpackv (tmps, out, gid, i + 0, out[ 0]); + unpackv (tmps, out, gid, i + 1, out[ 1]); + unpackv (tmps, out, gid, i + 2, out[ 2]); + unpackv (tmps, out, gid, i + 3, out[ 3]); + unpackv (tmps, out, gid, i + 4, out[ 4]); + unpackv (tmps, out, gid, i + 5, out[ 5]); + unpackv (tmps, out, gid, i + 6, out[ 6]); + unpackv (tmps, out, gid, i + 7, out[ 7]); + unpackv (tmps, out, gid, i + 8, out[ 8]); + unpackv (tmps, out, gid, i + 9, out[ 9]); + unpackv (tmps, out, gid, i + 10, out[10]); + unpackv (tmps, out, gid, i + 11, out[11]); + unpackv (tmps, out, gid, i + 12, out[12]); + unpackv (tmps, out, gid, i + 13, out[13]); + unpackv (tmps, out, gid, i + 14, out[14]); + unpackv (tmps, out, gid, i + 15, out[15]); + } + + if (pim == 0) return; + + if (check_header_0512 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; + if (check_header_1024 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; + if (check_header_1536 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; +} + +__kernel void m13733_comp (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) +{ + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * aes shared + */ + + #ifdef REAL_SHM + + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + + #endif + + /** + * Whirlpool shared + */ + + #ifdef REAL_SHM + + __local u32 s_Ch[8][256]; + __local u32 s_Cl[8][256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_Ch[0][i] = Ch[0][i]; + s_Ch[1][i] = Ch[1][i]; + s_Ch[2][i] = Ch[2][i]; + s_Ch[3][i] = Ch[3][i]; + s_Ch[4][i] = Ch[4][i]; + s_Ch[5][i] = Ch[5][i]; + s_Ch[6][i] = Ch[6][i]; + s_Ch[7][i] = Ch[7][i]; + + s_Cl[0][i] = Cl[0][i]; + s_Cl[1][i] = Cl[1][i]; + s_Cl[2][i] = Cl[2][i]; + s_Cl[3][i] = Cl[3][i]; + s_Cl[4][i] = Cl[4][i]; + s_Cl[5][i] = Cl[5][i]; + s_Cl[6][i] = Cl[6][i]; + s_Cl[7][i] = Cl[7][i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_Ch = Ch; + __constant u32a *s_Cl = Cl; + + #endif + + if (gid >= gid_max) return; + + if (tmps[gid].pim) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, tmps[gid].pim, 0); + } + } + else + { + if (check_header_0512 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } + } + + if (check_header_1024 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } + } + + if (check_header_1536 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) + { + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } + } + } +} diff --git a/OpenCL/m13751-pure.cl b/OpenCL/m13751-pure.cl index b6ae0dcf3..a5448a248 100644 --- a/OpenCL/m13751-pure.cl +++ b/OpenCL/m13751-pure.cl @@ -3,7 +3,10 @@ * License.....: MIT */ -#define NEW_SIMD_CODE +//#define NEW_SIMD_CODE + +#undef LOCAL_MEM_TYPE +#define LOCAL_MEM_TYPE LOCAL_MEM_TYPE_GLOBAL #include "inc_vendor.cl" #include "inc_hash_constants.h" @@ -19,7 +22,7 @@ #include "inc_cipher_camellia.cl" #include "inc_cipher_kuznyechik.cl" -typedef struct tc +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -29,14 +32,18 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; #include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_xts.cl" #include "inc_veracrypt_xts.cl" -typedef struct tc_tmp +typedef struct vc_tmp { u32 ipad[16]; u32 opad[16]; @@ -44,7 +51,41 @@ typedef struct tc_tmp u32 dgst[64]; u32 out[64]; -} tc_tmp_t; + u32 pim_key[64]; + int pim; // marker for cracked + +} vc_tmp_t; + +DECLSPEC int check_header_0512 (__global const vc_t *esalt_bufs, __global u32 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + + key1[0] = swap32_S (key[ 0]); + key1[1] = swap32_S (key[ 1]); + key1[2] = swap32_S (key[ 2]); + key1[3] = swap32_S (key[ 3]); + key1[4] = swap32_S (key[ 4]); + key1[5] = swap32_S (key[ 5]); + key1[6] = swap32_S (key[ 6]); + key1[7] = swap32_S (key[ 7]); + key2[0] = swap32_S (key[ 8]); + key2[1] = swap32_S (key[ 9]); + key2[2] = swap32_S (key[10]); + key2[3] = swap32_S (key[11]); + key2[4] = swap32_S (key[12]); + key2[5] = swap32_S (key[13]); + key2[6] = swap32_S (key[14]); + key2[7] = swap32_S (key[15]); + + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + + return -1; +} DECLSPEC void hmac_sha256_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest) { @@ -88,7 +129,7 @@ DECLSPEC void hmac_sha256_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *i sha256_transform_vector (w0, w1, w2, w3, digest); } -__kernel void m13751_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) +__kernel void m13751_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) { const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); @@ -244,11 +285,124 @@ __kernel void m13751_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) } } -__kernel void m13751_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) +__kernel void m13751_loop (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) { const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); - if ((gid * VECT_SIZE) >= gid_max) return; + /** + * aes shared + */ + + #ifdef REAL_SHM + + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + + #endif + + if (gid >= gid_max) return; + + // this is the pim range check + // it is guaranteed that only 0 or 1 innerloops will match a "pim" mark (each 1000 iterations) + // therefore the module limits the inner loop iteration count to 1000 + // if the key_pim is set, we know that we have to save and check the key for this pim + + const int pim_multi = esalt_bufs[digests_offset].pim_multi; + const int pim_start = esalt_bufs[digests_offset].pim_start; + const int pim_stop = esalt_bufs[digests_offset].pim_stop; + + int pim = 0; + int pim_at = 0; + + for (u32 j = 0; j < loop_cnt; j++) + { + const int iter_abs = 1 + loop_pos + j; + + if ((iter_abs % pim_multi) == pim_multi - 1) + { + const int pim_cur = (iter_abs / pim_multi) + 1; + + if ((pim_cur >= pim_start) && (pim_cur <= pim_stop)) + { + pim = pim_cur; + + pim_at = j; + } + } + } + + /* this feels harder to read than the loop variant + const int j_start = 1 + loop_pos + 0; + const int j_stop = 1 + loop_pos + loop_cnt; + + const int pim_start = j_start / 1000; + const int pim_stop = j_stop / 1000; + const int at_start = j_start - (pim_start * 1000); + const int at_stop = j_stop - (pim_stop * 1000); + + const int pim_start1 = pim_start + 1; + + if ((pim_start1 >= esalt_bufs[digests_offset].pim_start) && (pim_start1 <= esalt_bufs[digests_offset].pim_stop)) + { + if (pim_start == pim_stop) + { + if (at_stop == 999) + { + pim = pim_start1; + pim_at = loop_cnt; + } + } + else + { + pim = pim_start1; + pim_at = 999 - at_start; + } + } + */ + + // irregular pbkdf2 from here u32x ipad[8]; u32x opad[8]; @@ -328,6 +482,20 @@ __kernel void m13751_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) out[5] ^= dgst[5]; out[6] ^= dgst[6]; out[7] ^= dgst[7]; + + // this iteration creates a valid pim + + if (j == pim_at) + { + tmps[gid].pim_key[i + 0] = out[0]; + tmps[gid].pim_key[i + 1] = out[1]; + tmps[gid].pim_key[i + 2] = out[2]; + tmps[gid].pim_key[i + 3] = out[3]; + tmps[gid].pim_key[i + 4] = out[4]; + tmps[gid].pim_key[i + 5] = out[5]; + tmps[gid].pim_key[i + 6] = out[6]; + tmps[gid].pim_key[i + 7] = out[7]; + } } unpackv (tmps, dgst, gid, i + 0, dgst[0]); @@ -348,9 +516,13 @@ __kernel void m13751_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) unpackv (tmps, out, gid, i + 6, out[6]); unpackv (tmps, out, gid, i + 7, out[7]); } + + if (pim == 0) return; + + if (check_header_0512 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; } -__kernel void m13751_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) +__kernel void m13751_comp (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) { const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); @@ -409,65 +581,21 @@ __kernel void m13751_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) if (gid >= gid_max) return; - u32 ukey1[8]; - - ukey1[0] = swap32_S (tmps[gid].out[ 0]); - ukey1[1] = swap32_S (tmps[gid].out[ 1]); - ukey1[2] = swap32_S (tmps[gid].out[ 2]); - ukey1[3] = swap32_S (tmps[gid].out[ 3]); - ukey1[4] = swap32_S (tmps[gid].out[ 4]); - ukey1[5] = swap32_S (tmps[gid].out[ 5]); - ukey1[6] = swap32_S (tmps[gid].out[ 6]); - ukey1[7] = swap32_S (tmps[gid].out[ 7]); - - u32 ukey2[8]; - - ukey2[0] = swap32_S (tmps[gid].out[ 8]); - ukey2[1] = swap32_S (tmps[gid].out[ 9]); - ukey2[2] = swap32_S (tmps[gid].out[10]); - ukey2[3] = swap32_S (tmps[gid].out[11]); - ukey2[4] = swap32_S (tmps[gid].out[12]); - ukey2[5] = swap32_S (tmps[gid].out[13]); - ukey2[6] = swap32_S (tmps[gid].out[14]); - ukey2[7] = swap32_S (tmps[gid].out[15]); - - if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) + if (tmps[gid].pim) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, tmps[gid].pim, 0); } } - - if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1) + else { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) + if (check_header_0512 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } } } } diff --git a/OpenCL/m13752-pure.cl b/OpenCL/m13752-pure.cl index 575940729..6996d48c1 100644 --- a/OpenCL/m13752-pure.cl +++ b/OpenCL/m13752-pure.cl @@ -3,7 +3,10 @@ * License.....: MIT */ -#define NEW_SIMD_CODE +//#define NEW_SIMD_CODE + +#undef LOCAL_MEM_TYPE +#define LOCAL_MEM_TYPE LOCAL_MEM_TYPE_GLOBAL #include "inc_vendor.cl" #include "inc_hash_constants.h" @@ -19,7 +22,7 @@ #include "inc_cipher_camellia.cl" #include "inc_cipher_kuznyechik.cl" -typedef struct tc +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -29,14 +32,18 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; #include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_xts.cl" #include "inc_veracrypt_xts.cl" -typedef struct tc_tmp +typedef struct vc_tmp { u32 ipad[16]; u32 opad[16]; @@ -44,7 +51,92 @@ typedef struct tc_tmp u32 dgst[64]; u32 out[64]; -} tc_tmp_t; + u32 pim_key[64]; + int pim; // marker for cracked + +} vc_tmp_t; + +DECLSPEC int check_header_0512 (__global const vc_t *esalt_bufs, __global u32 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + + key1[0] = swap32_S (key[ 0]); + key1[1] = swap32_S (key[ 1]); + key1[2] = swap32_S (key[ 2]); + key1[3] = swap32_S (key[ 3]); + key1[4] = swap32_S (key[ 4]); + key1[5] = swap32_S (key[ 5]); + key1[6] = swap32_S (key[ 6]); + key1[7] = swap32_S (key[ 7]); + key2[0] = swap32_S (key[ 8]); + key2[1] = swap32_S (key[ 9]); + key2[2] = swap32_S (key[10]); + key2[3] = swap32_S (key[11]); + key2[4] = swap32_S (key[12]); + key2[5] = swap32_S (key[13]); + key2[6] = swap32_S (key[14]); + key2[7] = swap32_S (key[15]); + + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + + return -1; +} + +DECLSPEC int check_header_1024 (__global const vc_t *esalt_bufs, __global u32 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + u32 key3[8]; + u32 key4[8]; + + key1[0] = swap32_S (key[ 0]); + key1[1] = swap32_S (key[ 1]); + key1[2] = swap32_S (key[ 2]); + key1[3] = swap32_S (key[ 3]); + key1[4] = swap32_S (key[ 4]); + key1[5] = swap32_S (key[ 5]); + key1[6] = swap32_S (key[ 6]); + key1[7] = swap32_S (key[ 7]); + key2[0] = swap32_S (key[ 8]); + key2[1] = swap32_S (key[ 9]); + key2[2] = swap32_S (key[10]); + key2[3] = swap32_S (key[11]); + key2[4] = swap32_S (key[12]); + key2[5] = swap32_S (key[13]); + key2[6] = swap32_S (key[14]); + key2[7] = swap32_S (key[15]); + key3[0] = swap32_S (key[16]); + key3[1] = swap32_S (key[17]); + key3[2] = swap32_S (key[18]); + key3[3] = swap32_S (key[19]); + key3[4] = swap32_S (key[20]); + key3[5] = swap32_S (key[21]); + key3[6] = swap32_S (key[22]); + key3[7] = swap32_S (key[23]); + key4[0] = swap32_S (key[24]); + key4[1] = swap32_S (key[25]); + key4[2] = swap32_S (key[26]); + key4[3] = swap32_S (key[27]); + key4[4] = swap32_S (key[28]); + key4[5] = swap32_S (key[29]); + key4[6] = swap32_S (key[30]); + key4[7] = swap32_S (key[31]); + + if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_kuznyechik_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + + return -1; +} DECLSPEC void hmac_sha256_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest) { @@ -88,7 +180,7 @@ DECLSPEC void hmac_sha256_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *i sha256_transform_vector (w0, w1, w2, w3, digest); } -__kernel void m13752_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) +__kernel void m13752_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) { const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); @@ -244,11 +336,95 @@ __kernel void m13752_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) } } -__kernel void m13752_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) +__kernel void m13752_loop (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) { const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); - if ((gid * VECT_SIZE) >= gid_max) return; + /** + * aes shared + */ + + #ifdef REAL_SHM + + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + + #endif + + if (gid >= gid_max) return; + + // this is the pim range check + // it is guaranteed that only 0 or 1 innerloops will match a "pim" mark (each 1000 iterations) + // therefore the module limits the inner loop iteration count to 1000 + // if the key_pim is set, we know that we have to save and check the key for this pim + + const int pim_multi = esalt_bufs[digests_offset].pim_multi; + const int pim_start = esalt_bufs[digests_offset].pim_start; + const int pim_stop = esalt_bufs[digests_offset].pim_stop; + + int pim = 0; + int pim_at = 0; + + for (u32 j = 0; j < loop_cnt; j++) + { + const int iter_abs = 1 + loop_pos + j; + + if ((iter_abs % pim_multi) == pim_multi - 1) + { + const int pim_cur = (iter_abs / pim_multi) + 1; + + if ((pim_cur >= pim_start) && (pim_cur <= pim_stop)) + { + pim = pim_cur; + + pim_at = j; + } + } + } + + // irregular pbkdf2 from here u32x ipad[8]; u32x opad[8]; @@ -328,6 +504,20 @@ __kernel void m13752_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) out[5] ^= dgst[5]; out[6] ^= dgst[6]; out[7] ^= dgst[7]; + + // this iteration creates a valid pim + + if (j == pim_at) + { + tmps[gid].pim_key[i + 0] = out[0]; + tmps[gid].pim_key[i + 1] = out[1]; + tmps[gid].pim_key[i + 2] = out[2]; + tmps[gid].pim_key[i + 3] = out[3]; + tmps[gid].pim_key[i + 4] = out[4]; + tmps[gid].pim_key[i + 5] = out[5]; + tmps[gid].pim_key[i + 6] = out[6]; + tmps[gid].pim_key[i + 7] = out[7]; + } } unpackv (tmps, dgst, gid, i + 0, dgst[0]); @@ -348,9 +538,14 @@ __kernel void m13752_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) unpackv (tmps, out, gid, i + 6, out[6]); unpackv (tmps, out, gid, i + 7, out[7]); } + + if (pim == 0) return; + + if (check_header_0512 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; + if (check_header_1024 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; } -__kernel void m13752_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) +__kernel void m13752_comp (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) { const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); @@ -409,143 +604,29 @@ __kernel void m13752_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) if (gid >= gid_max) return; - u32 ukey1[8]; - - ukey1[0] = swap32_S (tmps[gid].out[ 0]); - ukey1[1] = swap32_S (tmps[gid].out[ 1]); - ukey1[2] = swap32_S (tmps[gid].out[ 2]); - ukey1[3] = swap32_S (tmps[gid].out[ 3]); - ukey1[4] = swap32_S (tmps[gid].out[ 4]); - ukey1[5] = swap32_S (tmps[gid].out[ 5]); - ukey1[6] = swap32_S (tmps[gid].out[ 6]); - ukey1[7] = swap32_S (tmps[gid].out[ 7]); - - u32 ukey2[8]; - - ukey2[0] = swap32_S (tmps[gid].out[ 8]); - ukey2[1] = swap32_S (tmps[gid].out[ 9]); - ukey2[2] = swap32_S (tmps[gid].out[10]); - ukey2[3] = swap32_S (tmps[gid].out[11]); - ukey2[4] = swap32_S (tmps[gid].out[12]); - ukey2[5] = swap32_S (tmps[gid].out[13]); - ukey2[6] = swap32_S (tmps[gid].out[14]); - ukey2[7] = swap32_S (tmps[gid].out[15]); - - if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - u32 ukey3[8]; - - ukey3[0] = swap32_S (tmps[gid].out[16]); - ukey3[1] = swap32_S (tmps[gid].out[17]); - ukey3[2] = swap32_S (tmps[gid].out[18]); - ukey3[3] = swap32_S (tmps[gid].out[19]); - ukey3[4] = swap32_S (tmps[gid].out[20]); - ukey3[5] = swap32_S (tmps[gid].out[21]); - ukey3[6] = swap32_S (tmps[gid].out[22]); - ukey3[7] = swap32_S (tmps[gid].out[23]); - - u32 ukey4[8]; - - ukey4[0] = swap32_S (tmps[gid].out[24]); - ukey4[1] = swap32_S (tmps[gid].out[25]); - ukey4[2] = swap32_S (tmps[gid].out[26]); - ukey4[3] = swap32_S (tmps[gid].out[27]); - ukey4[4] = swap32_S (tmps[gid].out[28]); - ukey4[5] = swap32_S (tmps[gid].out[29]); - ukey4[6] = swap32_S (tmps[gid].out[30]); - ukey4[7] = swap32_S (tmps[gid].out[31]); - - if (verify_header_aes_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_serpent_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) + if (tmps[gid].pim) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, tmps[gid].pim, 0); } } - - if (verify_header_camellia_kuznyechik (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) + else { - if (atomic_inc (&hashes_shown[0]) == 0) + if (check_header_0512 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } } - } - - if (verify_header_camellia_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - if (verify_header_kuznyechik_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) + if (check_header_1024 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } } } } diff --git a/OpenCL/m13753-pure.cl b/OpenCL/m13753-pure.cl index 6856ab71b..5f77f3a56 100644 --- a/OpenCL/m13753-pure.cl +++ b/OpenCL/m13753-pure.cl @@ -3,7 +3,10 @@ * License.....: MIT */ -#define NEW_SIMD_CODE +//#define NEW_SIMD_CODE + +#undef LOCAL_MEM_TYPE +#define LOCAL_MEM_TYPE LOCAL_MEM_TYPE_GLOBAL #include "inc_vendor.cl" #include "inc_hash_constants.h" @@ -19,7 +22,7 @@ #include "inc_cipher_camellia.cl" #include "inc_cipher_kuznyechik.cl" -typedef struct tc +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -29,14 +32,18 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; #include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_xts.cl" #include "inc_veracrypt_xts.cl" -typedef struct tc_tmp +typedef struct vc_tmp { u32 ipad[16]; u32 opad[16]; @@ -44,7 +51,157 @@ typedef struct tc_tmp u32 dgst[64]; u32 out[64]; -} tc_tmp_t; + u32 pim_key[64]; + int pim; // marker for cracked + +} vc_tmp_t; + +DECLSPEC int check_header_0512 (__global const vc_t *esalt_bufs, __global u32 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + + key1[0] = swap32_S (key[ 0]); + key1[1] = swap32_S (key[ 1]); + key1[2] = swap32_S (key[ 2]); + key1[3] = swap32_S (key[ 3]); + key1[4] = swap32_S (key[ 4]); + key1[5] = swap32_S (key[ 5]); + key1[6] = swap32_S (key[ 6]); + key1[7] = swap32_S (key[ 7]); + key2[0] = swap32_S (key[ 8]); + key2[1] = swap32_S (key[ 9]); + key2[2] = swap32_S (key[10]); + key2[3] = swap32_S (key[11]); + key2[4] = swap32_S (key[12]); + key2[5] = swap32_S (key[13]); + key2[6] = swap32_S (key[14]); + key2[7] = swap32_S (key[15]); + + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + + return -1; +} + +DECLSPEC int check_header_1024 (__global const vc_t *esalt_bufs, __global u32 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + u32 key3[8]; + u32 key4[8]; + + key1[0] = swap32_S (key[ 0]); + key1[1] = swap32_S (key[ 1]); + key1[2] = swap32_S (key[ 2]); + key1[3] = swap32_S (key[ 3]); + key1[4] = swap32_S (key[ 4]); + key1[5] = swap32_S (key[ 5]); + key1[6] = swap32_S (key[ 6]); + key1[7] = swap32_S (key[ 7]); + key2[0] = swap32_S (key[ 8]); + key2[1] = swap32_S (key[ 9]); + key2[2] = swap32_S (key[10]); + key2[3] = swap32_S (key[11]); + key2[4] = swap32_S (key[12]); + key2[5] = swap32_S (key[13]); + key2[6] = swap32_S (key[14]); + key2[7] = swap32_S (key[15]); + key3[0] = swap32_S (key[16]); + key3[1] = swap32_S (key[17]); + key3[2] = swap32_S (key[18]); + key3[3] = swap32_S (key[19]); + key3[4] = swap32_S (key[20]); + key3[5] = swap32_S (key[21]); + key3[6] = swap32_S (key[22]); + key3[7] = swap32_S (key[23]); + key4[0] = swap32_S (key[24]); + key4[1] = swap32_S (key[25]); + key4[2] = swap32_S (key[26]); + key4[3] = swap32_S (key[27]); + key4[4] = swap32_S (key[28]); + key4[5] = swap32_S (key[29]); + key4[6] = swap32_S (key[30]); + key4[7] = swap32_S (key[31]); + + if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_kuznyechik_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + + return -1; +} + +DECLSPEC int check_header_1536 (__global const vc_t *esalt_bufs, __global u32 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + u32 key3[8]; + u32 key4[8]; + u32 key5[8]; + u32 key6[8]; + + key1[0] = swap32_S (key[ 0]); + key1[1] = swap32_S (key[ 1]); + key1[2] = swap32_S (key[ 2]); + key1[3] = swap32_S (key[ 3]); + key1[4] = swap32_S (key[ 4]); + key1[5] = swap32_S (key[ 5]); + key1[6] = swap32_S (key[ 6]); + key1[7] = swap32_S (key[ 7]); + key2[0] = swap32_S (key[ 8]); + key2[1] = swap32_S (key[ 9]); + key2[2] = swap32_S (key[10]); + key2[3] = swap32_S (key[11]); + key2[4] = swap32_S (key[12]); + key2[5] = swap32_S (key[13]); + key2[6] = swap32_S (key[14]); + key2[7] = swap32_S (key[15]); + key3[0] = swap32_S (key[16]); + key3[1] = swap32_S (key[17]); + key3[2] = swap32_S (key[18]); + key3[3] = swap32_S (key[19]); + key3[4] = swap32_S (key[20]); + key3[5] = swap32_S (key[21]); + key3[6] = swap32_S (key[22]); + key3[7] = swap32_S (key[23]); + key4[0] = swap32_S (key[24]); + key4[1] = swap32_S (key[25]); + key4[2] = swap32_S (key[26]); + key4[3] = swap32_S (key[27]); + key4[4] = swap32_S (key[28]); + key4[5] = swap32_S (key[29]); + key4[6] = swap32_S (key[30]); + key4[7] = swap32_S (key[31]); + key5[0] = swap32_S (key[32]); + key5[1] = swap32_S (key[33]); + key5[2] = swap32_S (key[34]); + key5[3] = swap32_S (key[35]); + key5[4] = swap32_S (key[36]); + key5[5] = swap32_S (key[37]); + key5[6] = swap32_S (key[38]); + key5[7] = swap32_S (key[39]); + key6[0] = swap32_S (key[40]); + key6[1] = swap32_S (key[41]); + key6[2] = swap32_S (key[42]); + key6[3] = swap32_S (key[43]); + key6[4] = swap32_S (key[44]); + key6[5] = swap32_S (key[45]); + key6[6] = swap32_S (key[46]); + key6[7] = swap32_S (key[47]); + + if (verify_header_aes_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, key5, key6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent_twofish_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, key5, key6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_kuznyechik_serpent_camellia (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, key5, key6) == 1) return 0; + + return -1; +} DECLSPEC void hmac_sha256_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest) { @@ -88,7 +245,7 @@ DECLSPEC void hmac_sha256_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *i sha256_transform_vector (w0, w1, w2, w3, digest); } -__kernel void m13753_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) +__kernel void m13753_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) { const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); @@ -244,11 +401,95 @@ __kernel void m13753_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) } } -__kernel void m13753_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) +__kernel void m13753_loop (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) { const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * aes shared + */ + + #ifdef REAL_SHM + + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + + barrier (CLK_LOCAL_MEM_FENCE); + + #else + + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + + #endif + + if (gid >= gid_max) return; + + // this is the pim range check + // it is guaranteed that only 0 or 1 innerloops will match a "pim" mark (each 1000 iterations) + // therefore the module limits the inner loop iteration count to 1000 + // if the key_pim is set, we know that we have to save and check the key for this pim + + const int pim_multi = esalt_bufs[digests_offset].pim_multi; + const int pim_start = esalt_bufs[digests_offset].pim_start; + const int pim_stop = esalt_bufs[digests_offset].pim_stop; + + int pim = 0; + int pim_at = 0; + + for (u32 j = 0; j < loop_cnt; j++) + { + const int iter_abs = 1 + loop_pos + j; + + if ((iter_abs % pim_multi) == pim_multi - 1) + { + const int pim_cur = (iter_abs / pim_multi) + 1; + + if ((pim_cur >= pim_start) && (pim_cur <= pim_stop)) + { + pim = pim_cur; + + pim_at = j; + } + } + } - if ((gid * VECT_SIZE) >= gid_max) return; + // irregular pbkdf2 from here u32x ipad[8]; u32x opad[8]; @@ -328,6 +569,20 @@ __kernel void m13753_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) out[5] ^= dgst[5]; out[6] ^= dgst[6]; out[7] ^= dgst[7]; + + // this iteration creates a valid pim + + if (j == pim_at) + { + tmps[gid].pim_key[i + 0] = out[0]; + tmps[gid].pim_key[i + 1] = out[1]; + tmps[gid].pim_key[i + 2] = out[2]; + tmps[gid].pim_key[i + 3] = out[3]; + tmps[gid].pim_key[i + 4] = out[4]; + tmps[gid].pim_key[i + 5] = out[5]; + tmps[gid].pim_key[i + 6] = out[6]; + tmps[gid].pim_key[i + 7] = out[7]; + } } unpackv (tmps, dgst, gid, i + 0, dgst[0]); @@ -348,9 +603,15 @@ __kernel void m13753_loop (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) unpackv (tmps, out, gid, i + 6, out[6]); unpackv (tmps, out, gid, i + 7, out[7]); } + + if (pim == 0) return; + + if (check_header_0512 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; + if (check_header_1024 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; + if (check_header_1536 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; } -__kernel void m13753_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) +__kernel void m13753_comp (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) { const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); @@ -409,189 +670,37 @@ __kernel void m13753_comp (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t)) if (gid >= gid_max) return; - u32 ukey1[8]; - - ukey1[0] = swap32_S (tmps[gid].out[ 0]); - ukey1[1] = swap32_S (tmps[gid].out[ 1]); - ukey1[2] = swap32_S (tmps[gid].out[ 2]); - ukey1[3] = swap32_S (tmps[gid].out[ 3]); - ukey1[4] = swap32_S (tmps[gid].out[ 4]); - ukey1[5] = swap32_S (tmps[gid].out[ 5]); - ukey1[6] = swap32_S (tmps[gid].out[ 6]); - ukey1[7] = swap32_S (tmps[gid].out[ 7]); - - u32 ukey2[8]; - - ukey2[0] = swap32_S (tmps[gid].out[ 8]); - ukey2[1] = swap32_S (tmps[gid].out[ 9]); - ukey2[2] = swap32_S (tmps[gid].out[10]); - ukey2[3] = swap32_S (tmps[gid].out[11]); - ukey2[4] = swap32_S (tmps[gid].out[12]); - ukey2[5] = swap32_S (tmps[gid].out[13]); - ukey2[6] = swap32_S (tmps[gid].out[14]); - ukey2[7] = swap32_S (tmps[gid].out[15]); - - if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) + if (tmps[gid].pim) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, tmps[gid].pim, 0); } } - - if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1) + else { - if (atomic_inc (&hashes_shown[0]) == 0) + if (check_header_0512 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } } - } - if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) + if (check_header_1024 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } } - } - - u32 ukey3[8]; - - ukey3[0] = swap32_S (tmps[gid].out[16]); - ukey3[1] = swap32_S (tmps[gid].out[17]); - ukey3[2] = swap32_S (tmps[gid].out[18]); - ukey3[3] = swap32_S (tmps[gid].out[19]); - ukey3[4] = swap32_S (tmps[gid].out[20]); - ukey3[5] = swap32_S (tmps[gid].out[21]); - ukey3[6] = swap32_S (tmps[gid].out[22]); - ukey3[7] = swap32_S (tmps[gid].out[23]); - - u32 ukey4[8]; - - ukey4[0] = swap32_S (tmps[gid].out[24]); - ukey4[1] = swap32_S (tmps[gid].out[25]); - ukey4[2] = swap32_S (tmps[gid].out[26]); - ukey4[3] = swap32_S (tmps[gid].out[27]); - ukey4[4] = swap32_S (tmps[gid].out[28]); - ukey4[5] = swap32_S (tmps[gid].out[29]); - ukey4[6] = swap32_S (tmps[gid].out[30]); - ukey4[7] = swap32_S (tmps[gid].out[31]); - - if (verify_header_aes_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_serpent_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - if (verify_header_camellia_kuznyechik (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_camellia_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - u32 ukey5[8]; - - ukey5[0] = swap32_S (tmps[gid].out[32]); - ukey5[1] = swap32_S (tmps[gid].out[33]); - ukey5[2] = swap32_S (tmps[gid].out[34]); - ukey5[3] = swap32_S (tmps[gid].out[35]); - ukey5[4] = swap32_S (tmps[gid].out[36]); - ukey5[5] = swap32_S (tmps[gid].out[37]); - ukey5[6] = swap32_S (tmps[gid].out[38]); - ukey5[7] = swap32_S (tmps[gid].out[39]); - - u32 ukey6[8]; - - ukey6[0] = swap32_S (tmps[gid].out[40]); - ukey6[1] = swap32_S (tmps[gid].out[41]); - ukey6[2] = swap32_S (tmps[gid].out[42]); - ukey6[3] = swap32_S (tmps[gid].out[43]); - ukey6[4] = swap32_S (tmps[gid].out[44]); - ukey6[5] = swap32_S (tmps[gid].out[45]); - ukey6[6] = swap32_S (tmps[gid].out[46]); - ukey6[7] = swap32_S (tmps[gid].out[47]); - - if (verify_header_aes_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_serpent_twofish_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik_serpent_camellia (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) + if (check_header_1536 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } } } } diff --git a/OpenCL/m13771-pure.cl b/OpenCL/m13771-pure.cl index ad5c454cb..bad84d31f 100644 --- a/OpenCL/m13771-pure.cl +++ b/OpenCL/m13771-pure.cl @@ -5,6 +5,9 @@ //#define NEW_SIMD_CODE +#undef LOCAL_MEM_TYPE +#define LOCAL_MEM_TYPE LOCAL_MEM_TYPE_GLOBAL + #include "inc_vendor.cl" #include "inc_hash_constants.h" #include "inc_hash_functions.cl" @@ -19,7 +22,7 @@ #include "inc_cipher_camellia.cl" #include "inc_cipher_kuznyechik.cl" -typedef struct tc +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -29,7 +32,11 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; #include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_crc32.cl" @@ -47,8 +54,42 @@ typedef struct vc64_sbog_tmp u64 dgst[32]; u64 out[32]; + u64 pim_key[32]; + int pim; // marker for cracked + } vc64_sbog_tmp_t; +DECLSPEC int check_header_0512 (__global const vc_t *esalt_bufs, __global u64 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + + key1[0] = swap32_S (h32_from_64_S (key[7])); + key1[1] = swap32_S (l32_from_64_S (key[7])); + key1[2] = swap32_S (h32_from_64_S (key[6])); + key1[3] = swap32_S (l32_from_64_S (key[6])); + key1[4] = swap32_S (h32_from_64_S (key[5])); + key1[5] = swap32_S (l32_from_64_S (key[5])); + key1[6] = swap32_S (h32_from_64_S (key[4])); + key1[7] = swap32_S (l32_from_64_S (key[4])); + key2[0] = swap32_S (h32_from_64_S (key[3])); + key2[1] = swap32_S (l32_from_64_S (key[3])); + key2[2] = swap32_S (h32_from_64_S (key[2])); + key2[3] = swap32_S (l32_from_64_S (key[2])); + key2[4] = swap32_S (h32_from_64_S (key[1])); + key2[5] = swap32_S (l32_from_64_S (key[1])); + key2[6] = swap32_S (h32_from_64_S (key[0])); + key2[7] = swap32_S (l32_from_64_S (key[0])); + + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + + return -1; +} + DECLSPEC void hmac_streebog512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u64x *ipad_hash, u64x *opad_hash, u64x *ipad_raw, u64x *opad_raw, u64x *digest, SHM_TYPE u64a (*s_sbob_sl64)[256]) { const u64x nullbuf[8] = { 0 }; @@ -134,7 +175,7 @@ DECLSPEC void hmac_streebog512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u6 streebog512_g_vector (digest, nullbuf, message, s_sbob_sl64); } -__kernel void m13771_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) +__kernel void m13771_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t)) { const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); @@ -149,6 +190,8 @@ __kernel void m13771_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i]; } + barrier (CLK_LOCAL_MEM_FENCE); + #ifdef REAL_SHM __local u64a s_sbob_sl64[8][256]; @@ -326,7 +369,7 @@ __kernel void m13771_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) } } -__kernel void m13771_loop (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) +__kernel void m13771_loop (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t)) { const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); @@ -338,6 +381,33 @@ __kernel void m13771_loop (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) #ifdef REAL_SHM + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + __local u64a s_sbob_sl64[8][256]; for (u32 i = lid; i < 256; i += lsz) @@ -356,11 +426,54 @@ __kernel void m13771_loop (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) #else + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + __constant u64a (*s_sbob_sl64)[256] = sbob_sl64; #endif - if ((gid * VECT_SIZE) >= gid_max) return; + if (gid >= gid_max) return; + + // this is the pim range check + // it is guaranteed that only 0 or 1 innerloops will match a "pim" mark (each 1000 iterations) + // therefore the module limits the inner loop iteration count to 1000 + // if the key_pim is set, we know that we have to save and check the key for this pim + + const int pim_multi = esalt_bufs[digests_offset].pim_multi; + const int pim_start = esalt_bufs[digests_offset].pim_start; + const int pim_stop = esalt_bufs[digests_offset].pim_stop; + + int pim = 0; + int pim_at = 0; + + for (u32 j = 0; j < loop_cnt; j++) + { + const int iter_abs = 1 + loop_pos + j; + + if ((iter_abs % pim_multi) == pim_multi - 1) + { + const int pim_cur = (iter_abs / pim_multi) + 1; + + if ((pim_cur >= pim_start) && (pim_cur <= pim_stop)) + { + pim = pim_cur; + + pim_at = j; + } + } + } + + // irregular pbkdf2 from here u64x ipad_hash[8]; u64x opad_hash[8]; @@ -461,6 +574,20 @@ __kernel void m13771_loop (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) out[5] ^= dgst[5]; out[6] ^= dgst[6]; out[7] ^= dgst[7]; + + // this iteration creates a valid pim + + if (j == pim_at) + { + tmps[gid].pim_key[i + 0] = out[0]; + tmps[gid].pim_key[i + 1] = out[1]; + tmps[gid].pim_key[i + 2] = out[2]; + tmps[gid].pim_key[i + 3] = out[3]; + tmps[gid].pim_key[i + 4] = out[4]; + tmps[gid].pim_key[i + 5] = out[5]; + tmps[gid].pim_key[i + 6] = out[6]; + tmps[gid].pim_key[i + 7] = out[7]; + } } unpack64v (tmps, dgst, gid, i + 0, dgst[0]); @@ -481,9 +608,13 @@ __kernel void m13771_loop (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) unpack64v (tmps, out, gid, i + 6, out[6]); unpack64v (tmps, out, gid, i + 7, out[7]); } + + if (pim == 0) return; + + if (check_header_0512 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; } -__kernel void m13771_comp (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) +__kernel void m13771_comp (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t)) { const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); @@ -542,64 +673,21 @@ __kernel void m13771_comp (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) if (gid >= gid_max) return; - u32 ukey1[8]; - u32 ukey2[8]; - - ukey1[0] = swap32_S (h32_from_64_S (tmps[gid].out[7])); - ukey1[1] = swap32_S (l32_from_64_S (tmps[gid].out[7])); - ukey1[2] = swap32_S (h32_from_64_S (tmps[gid].out[6])); - ukey1[3] = swap32_S (l32_from_64_S (tmps[gid].out[6])); - ukey1[4] = swap32_S (h32_from_64_S (tmps[gid].out[5])); - ukey1[5] = swap32_S (l32_from_64_S (tmps[gid].out[5])); - ukey1[6] = swap32_S (h32_from_64_S (tmps[gid].out[4])); - ukey1[7] = swap32_S (l32_from_64_S (tmps[gid].out[4])); - - ukey2[0] = swap32_S (h32_from_64_S (tmps[gid].out[3])); - ukey2[1] = swap32_S (l32_from_64_S (tmps[gid].out[3])); - ukey2[2] = swap32_S (h32_from_64_S (tmps[gid].out[2])); - ukey2[3] = swap32_S (l32_from_64_S (tmps[gid].out[2])); - ukey2[4] = swap32_S (h32_from_64_S (tmps[gid].out[1])); - ukey2[5] = swap32_S (l32_from_64_S (tmps[gid].out[1])); - ukey2[6] = swap32_S (h32_from_64_S (tmps[gid].out[0])); - ukey2[7] = swap32_S (l32_from_64_S (tmps[gid].out[0])); - - if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (tmps[gid].pim) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, tmps[gid].pim, 0); } } - - if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1) + else { - if (atomic_inc (&hashes_shown[0]) == 0) + if (check_header_0512 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } } } } diff --git a/OpenCL/m13772-pure.cl b/OpenCL/m13772-pure.cl index 0163c9872..8d76b560f 100644 --- a/OpenCL/m13772-pure.cl +++ b/OpenCL/m13772-pure.cl @@ -5,6 +5,9 @@ //#define NEW_SIMD_CODE +#undef LOCAL_MEM_TYPE +#define LOCAL_MEM_TYPE LOCAL_MEM_TYPE_GLOBAL + #include "inc_vendor.cl" #include "inc_hash_constants.h" #include "inc_hash_functions.cl" @@ -19,7 +22,7 @@ #include "inc_cipher_camellia.cl" #include "inc_cipher_kuznyechik.cl" -typedef struct tc +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -29,7 +32,11 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; #include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_crc32.cl" @@ -47,8 +54,93 @@ typedef struct vc64_sbog_tmp u64 dgst[32]; u64 out[32]; + u64 pim_key[32]; + int pim; // marker for cracked + } vc64_sbog_tmp_t; +DECLSPEC int check_header_0512 (__global const vc_t *esalt_bufs, __global u64 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + + key1[0] = swap32_S (h32_from_64_S (key[7])); + key1[1] = swap32_S (l32_from_64_S (key[7])); + key1[2] = swap32_S (h32_from_64_S (key[6])); + key1[3] = swap32_S (l32_from_64_S (key[6])); + key1[4] = swap32_S (h32_from_64_S (key[5])); + key1[5] = swap32_S (l32_from_64_S (key[5])); + key1[6] = swap32_S (h32_from_64_S (key[4])); + key1[7] = swap32_S (l32_from_64_S (key[4])); + key2[0] = swap32_S (h32_from_64_S (key[3])); + key2[1] = swap32_S (l32_from_64_S (key[3])); + key2[2] = swap32_S (h32_from_64_S (key[2])); + key2[3] = swap32_S (l32_from_64_S (key[2])); + key2[4] = swap32_S (h32_from_64_S (key[1])); + key2[5] = swap32_S (l32_from_64_S (key[1])); + key2[6] = swap32_S (h32_from_64_S (key[0])); + key2[7] = swap32_S (l32_from_64_S (key[0])); + + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + + return -1; +} + +DECLSPEC int check_header_1024 (__global const vc_t *esalt_bufs, __global u64 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + u32 key3[8]; + u32 key4[8]; + + key1[0] = swap32_S (h32_from_64_S (key[ 7])); + key1[1] = swap32_S (l32_from_64_S (key[ 7])); + key1[2] = swap32_S (h32_from_64_S (key[ 6])); + key1[3] = swap32_S (l32_from_64_S (key[ 6])); + key1[4] = swap32_S (h32_from_64_S (key[ 5])); + key1[5] = swap32_S (l32_from_64_S (key[ 5])); + key1[6] = swap32_S (h32_from_64_S (key[ 4])); + key1[7] = swap32_S (l32_from_64_S (key[ 4])); + key2[0] = swap32_S (h32_from_64_S (key[ 3])); + key2[1] = swap32_S (l32_from_64_S (key[ 3])); + key2[2] = swap32_S (h32_from_64_S (key[ 2])); + key2[3] = swap32_S (l32_from_64_S (key[ 2])); + key2[4] = swap32_S (h32_from_64_S (key[ 1])); + key2[5] = swap32_S (l32_from_64_S (key[ 1])); + key2[6] = swap32_S (h32_from_64_S (key[ 0])); + key2[7] = swap32_S (l32_from_64_S (key[ 0])); + key3[0] = swap32_S (h32_from_64_S (key[15])); + key3[1] = swap32_S (l32_from_64_S (key[15])); + key3[2] = swap32_S (h32_from_64_S (key[14])); + key3[3] = swap32_S (l32_from_64_S (key[14])); + key3[4] = swap32_S (h32_from_64_S (key[13])); + key3[5] = swap32_S (l32_from_64_S (key[13])); + key3[6] = swap32_S (h32_from_64_S (key[12])); + key3[7] = swap32_S (l32_from_64_S (key[12])); + key4[0] = swap32_S (h32_from_64_S (key[11])); + key4[1] = swap32_S (l32_from_64_S (key[11])); + key4[2] = swap32_S (h32_from_64_S (key[10])); + key4[3] = swap32_S (l32_from_64_S (key[10])); + key4[4] = swap32_S (h32_from_64_S (key[ 9])); + key4[5] = swap32_S (l32_from_64_S (key[ 9])); + key4[6] = swap32_S (h32_from_64_S (key[ 8])); + key4[7] = swap32_S (l32_from_64_S (key[ 8])); + + if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_kuznyechik_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + + return -1; +} + DECLSPEC void hmac_streebog512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u64x *ipad_hash, u64x *opad_hash, u64x *ipad_raw, u64x *opad_raw, u64x *digest, SHM_TYPE u64a (*s_sbob_sl64)[256]) { const u64x nullbuf[8] = { 0 }; @@ -134,7 +226,7 @@ DECLSPEC void hmac_streebog512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u6 streebog512_g_vector (digest, nullbuf, message, s_sbob_sl64); } -__kernel void m13772_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) +__kernel void m13772_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t)) { const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); @@ -149,6 +241,8 @@ __kernel void m13772_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i]; } + barrier (CLK_LOCAL_MEM_FENCE); + #ifdef REAL_SHM __local u64a s_sbob_sl64[8][256]; @@ -326,7 +420,7 @@ __kernel void m13772_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) } } -__kernel void m13772_loop (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) +__kernel void m13772_loop (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t)) { const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); @@ -338,6 +432,33 @@ __kernel void m13772_loop (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) #ifdef REAL_SHM + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + __local u64a s_sbob_sl64[8][256]; for (u32 i = lid; i < 256; i += lsz) @@ -356,11 +477,54 @@ __kernel void m13772_loop (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) #else + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + __constant u64a (*s_sbob_sl64)[256] = sbob_sl64; #endif - if ((gid * VECT_SIZE) >= gid_max) return; + if (gid >= gid_max) return; + + // this is the pim range check + // it is guaranteed that only 0 or 1 innerloops will match a "pim" mark (each 1000 iterations) + // therefore the module limits the inner loop iteration count to 1000 + // if the key_pim is set, we know that we have to save and check the key for this pim + + const int pim_multi = esalt_bufs[digests_offset].pim_multi; + const int pim_start = esalt_bufs[digests_offset].pim_start; + const int pim_stop = esalt_bufs[digests_offset].pim_stop; + + int pim = 0; + int pim_at = 0; + + for (u32 j = 0; j < loop_cnt; j++) + { + const int iter_abs = 1 + loop_pos + j; + + if ((iter_abs % pim_multi) == pim_multi - 1) + { + const int pim_cur = (iter_abs / pim_multi) + 1; + + if ((pim_cur >= pim_start) && (pim_cur <= pim_stop)) + { + pim = pim_cur; + + pim_at = j; + } + } + } + + // irregular pbkdf2 from here u64x ipad_hash[8]; u64x opad_hash[8]; @@ -461,6 +625,20 @@ __kernel void m13772_loop (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) out[5] ^= dgst[5]; out[6] ^= dgst[6]; out[7] ^= dgst[7]; + + // this iteration creates a valid pim + + if (j == pim_at) + { + tmps[gid].pim_key[i + 0] = out[0]; + tmps[gid].pim_key[i + 1] = out[1]; + tmps[gid].pim_key[i + 2] = out[2]; + tmps[gid].pim_key[i + 3] = out[3]; + tmps[gid].pim_key[i + 4] = out[4]; + tmps[gid].pim_key[i + 5] = out[5]; + tmps[gid].pim_key[i + 6] = out[6]; + tmps[gid].pim_key[i + 7] = out[7]; + } } unpack64v (tmps, dgst, gid, i + 0, dgst[0]); @@ -481,9 +659,14 @@ __kernel void m13772_loop (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) unpack64v (tmps, out, gid, i + 6, out[6]); unpack64v (tmps, out, gid, i + 7, out[7]); } + + if (pim == 0) return; + + if (check_header_0512 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; + if (check_header_1024 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; } -__kernel void m13772_comp (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) +__kernel void m13772_comp (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t)) { const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); @@ -542,143 +725,29 @@ __kernel void m13772_comp (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) if (gid >= gid_max) return; - u32 ukey1[8]; - - ukey1[0] = swap32_S (h32_from_64_S (tmps[gid].out[7])); - ukey1[1] = swap32_S (l32_from_64_S (tmps[gid].out[7])); - ukey1[2] = swap32_S (h32_from_64_S (tmps[gid].out[6])); - ukey1[3] = swap32_S (l32_from_64_S (tmps[gid].out[6])); - ukey1[4] = swap32_S (h32_from_64_S (tmps[gid].out[5])); - ukey1[5] = swap32_S (l32_from_64_S (tmps[gid].out[5])); - ukey1[6] = swap32_S (h32_from_64_S (tmps[gid].out[4])); - ukey1[7] = swap32_S (l32_from_64_S (tmps[gid].out[4])); - - u32 ukey2[8]; - - ukey2[0] = swap32_S (h32_from_64_S (tmps[gid].out[3])); - ukey2[1] = swap32_S (l32_from_64_S (tmps[gid].out[3])); - ukey2[2] = swap32_S (h32_from_64_S (tmps[gid].out[2])); - ukey2[3] = swap32_S (l32_from_64_S (tmps[gid].out[2])); - ukey2[4] = swap32_S (h32_from_64_S (tmps[gid].out[1])); - ukey2[5] = swap32_S (l32_from_64_S (tmps[gid].out[1])); - ukey2[6] = swap32_S (h32_from_64_S (tmps[gid].out[0])); - ukey2[7] = swap32_S (l32_from_64_S (tmps[gid].out[0])); - - if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - u32 ukey3[8]; - - ukey3[0] = swap32_S (h32_from_64_S (tmps[gid].out[15])); - ukey3[1] = swap32_S (l32_from_64_S (tmps[gid].out[15])); - ukey3[2] = swap32_S (h32_from_64_S (tmps[gid].out[14])); - ukey3[3] = swap32_S (l32_from_64_S (tmps[gid].out[14])); - ukey3[4] = swap32_S (h32_from_64_S (tmps[gid].out[13])); - ukey3[5] = swap32_S (l32_from_64_S (tmps[gid].out[13])); - ukey3[6] = swap32_S (h32_from_64_S (tmps[gid].out[12])); - ukey3[7] = swap32_S (l32_from_64_S (tmps[gid].out[12])); - - u32 ukey4[8]; - - ukey4[0] = swap32_S (h32_from_64_S (tmps[gid].out[11])); - ukey4[1] = swap32_S (l32_from_64_S (tmps[gid].out[11])); - ukey4[2] = swap32_S (h32_from_64_S (tmps[gid].out[10])); - ukey4[3] = swap32_S (l32_from_64_S (tmps[gid].out[10])); - ukey4[4] = swap32_S (h32_from_64_S (tmps[gid].out[ 9])); - ukey4[5] = swap32_S (l32_from_64_S (tmps[gid].out[ 9])); - ukey4[6] = swap32_S (h32_from_64_S (tmps[gid].out[ 8])); - ukey4[7] = swap32_S (l32_from_64_S (tmps[gid].out[ 8])); - - if (verify_header_aes_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_serpent_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (tmps[gid].pim) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, tmps[gid].pim, 0); } } - - if (verify_header_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) + else { - if (atomic_inc (&hashes_shown[0]) == 0) + if (check_header_0512 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } } - } - if (verify_header_camellia_kuznyechik (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_camellia_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) + if (check_header_1024 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } } } } diff --git a/OpenCL/m13773-pure.cl b/OpenCL/m13773-pure.cl index b4db2779c..854c192b3 100644 --- a/OpenCL/m13773-pure.cl +++ b/OpenCL/m13773-pure.cl @@ -5,6 +5,9 @@ //#define NEW_SIMD_CODE +#undef LOCAL_MEM_TYPE +#define LOCAL_MEM_TYPE LOCAL_MEM_TYPE_GLOBAL + #include "inc_vendor.cl" #include "inc_hash_constants.h" #include "inc_hash_functions.cl" @@ -19,7 +22,7 @@ #include "inc_cipher_camellia.cl" #include "inc_cipher_kuznyechik.cl" -typedef struct tc +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -29,7 +32,11 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; #include "inc_truecrypt_keyfile.cl" #include "inc_truecrypt_crc32.cl" @@ -47,8 +54,158 @@ typedef struct vc64_sbog_tmp u64 dgst[32]; u64 out[32]; + u64 pim_key[32]; + int pim; // marker for cracked + } vc64_sbog_tmp_t; +DECLSPEC int check_header_0512 (__global const vc_t *esalt_bufs, __global u64 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + + key1[0] = swap32_S (h32_from_64_S (key[7])); + key1[1] = swap32_S (l32_from_64_S (key[7])); + key1[2] = swap32_S (h32_from_64_S (key[6])); + key1[3] = swap32_S (l32_from_64_S (key[6])); + key1[4] = swap32_S (h32_from_64_S (key[5])); + key1[5] = swap32_S (l32_from_64_S (key[5])); + key1[6] = swap32_S (h32_from_64_S (key[4])); + key1[7] = swap32_S (l32_from_64_S (key[4])); + key2[0] = swap32_S (h32_from_64_S (key[3])); + key2[1] = swap32_S (l32_from_64_S (key[3])); + key2[2] = swap32_S (h32_from_64_S (key[2])); + key2[3] = swap32_S (l32_from_64_S (key[2])); + key2[4] = swap32_S (h32_from_64_S (key[1])); + key2[5] = swap32_S (l32_from_64_S (key[1])); + key2[6] = swap32_S (h32_from_64_S (key[0])); + key2[7] = swap32_S (l32_from_64_S (key[0])); + + if (verify_header_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2) == 1) return 0; + + return -1; +} + +DECLSPEC int check_header_1024 (__global const vc_t *esalt_bufs, __global u64 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + u32 key3[8]; + u32 key4[8]; + + key1[0] = swap32_S (h32_from_64_S (key[ 7])); + key1[1] = swap32_S (l32_from_64_S (key[ 7])); + key1[2] = swap32_S (h32_from_64_S (key[ 6])); + key1[3] = swap32_S (l32_from_64_S (key[ 6])); + key1[4] = swap32_S (h32_from_64_S (key[ 5])); + key1[5] = swap32_S (l32_from_64_S (key[ 5])); + key1[6] = swap32_S (h32_from_64_S (key[ 4])); + key1[7] = swap32_S (l32_from_64_S (key[ 4])); + key2[0] = swap32_S (h32_from_64_S (key[ 3])); + key2[1] = swap32_S (l32_from_64_S (key[ 3])); + key2[2] = swap32_S (h32_from_64_S (key[ 2])); + key2[3] = swap32_S (l32_from_64_S (key[ 2])); + key2[4] = swap32_S (h32_from_64_S (key[ 1])); + key2[5] = swap32_S (l32_from_64_S (key[ 1])); + key2[6] = swap32_S (h32_from_64_S (key[ 0])); + key2[7] = swap32_S (l32_from_64_S (key[ 0])); + key3[0] = swap32_S (h32_from_64_S (key[15])); + key3[1] = swap32_S (l32_from_64_S (key[15])); + key3[2] = swap32_S (h32_from_64_S (key[14])); + key3[3] = swap32_S (l32_from_64_S (key[14])); + key3[4] = swap32_S (h32_from_64_S (key[13])); + key3[5] = swap32_S (l32_from_64_S (key[13])); + key3[6] = swap32_S (h32_from_64_S (key[12])); + key3[7] = swap32_S (l32_from_64_S (key[12])); + key4[0] = swap32_S (h32_from_64_S (key[11])); + key4[1] = swap32_S (l32_from_64_S (key[11])); + key4[2] = swap32_S (h32_from_64_S (key[10])); + key4[3] = swap32_S (l32_from_64_S (key[10])); + key4[4] = swap32_S (h32_from_64_S (key[ 9])); + key4[5] = swap32_S (l32_from_64_S (key[ 9])); + key4[6] = swap32_S (h32_from_64_S (key[ 8])); + key4[7] = swap32_S (l32_from_64_S (key[ 8])); + + if (verify_header_aes_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_kuznyechik (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_kuznyechik_twofish (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4) == 1) return 0; + + return -1; +} + +DECLSPEC int check_header_1536 (__global const vc_t *esalt_bufs, __global u64 *key, SHM_TYPE u32 *s_te0, SHM_TYPE u32 *s_te1, SHM_TYPE u32 *s_te2, SHM_TYPE u32 *s_te3, SHM_TYPE u32 *s_te4, SHM_TYPE u32 *s_td0, SHM_TYPE u32 *s_td1, SHM_TYPE u32 *s_td2, SHM_TYPE u32 *s_td3, SHM_TYPE u32 *s_td4) +{ + u32 key1[8]; + u32 key2[8]; + u32 key3[8]; + u32 key4[8]; + u32 key5[8]; + u32 key6[8]; + + key1[0] = swap32_S (h32_from_64_S (key[ 7])); + key1[1] = swap32_S (l32_from_64_S (key[ 7])); + key1[2] = swap32_S (h32_from_64_S (key[ 6])); + key1[3] = swap32_S (l32_from_64_S (key[ 6])); + key1[4] = swap32_S (h32_from_64_S (key[ 5])); + key1[5] = swap32_S (l32_from_64_S (key[ 5])); + key1[6] = swap32_S (h32_from_64_S (key[ 4])); + key1[7] = swap32_S (l32_from_64_S (key[ 4])); + key2[0] = swap32_S (h32_from_64_S (key[ 3])); + key2[1] = swap32_S (l32_from_64_S (key[ 3])); + key2[2] = swap32_S (h32_from_64_S (key[ 2])); + key2[3] = swap32_S (l32_from_64_S (key[ 2])); + key2[4] = swap32_S (h32_from_64_S (key[ 1])); + key2[5] = swap32_S (l32_from_64_S (key[ 1])); + key2[6] = swap32_S (h32_from_64_S (key[ 0])); + key2[7] = swap32_S (l32_from_64_S (key[ 0])); + key3[0] = swap32_S (h32_from_64_S (key[15])); + key3[1] = swap32_S (l32_from_64_S (key[15])); + key3[2] = swap32_S (h32_from_64_S (key[14])); + key3[3] = swap32_S (l32_from_64_S (key[14])); + key3[4] = swap32_S (h32_from_64_S (key[13])); + key3[5] = swap32_S (l32_from_64_S (key[13])); + key3[6] = swap32_S (h32_from_64_S (key[12])); + key3[7] = swap32_S (l32_from_64_S (key[12])); + key4[0] = swap32_S (h32_from_64_S (key[11])); + key4[1] = swap32_S (l32_from_64_S (key[11])); + key4[2] = swap32_S (h32_from_64_S (key[10])); + key4[3] = swap32_S (l32_from_64_S (key[10])); + key4[4] = swap32_S (h32_from_64_S (key[ 9])); + key4[5] = swap32_S (l32_from_64_S (key[ 9])); + key4[6] = swap32_S (h32_from_64_S (key[ 8])); + key4[7] = swap32_S (l32_from_64_S (key[ 8])); + key5[0] = swap32_S (h32_from_64_S (key[23])); + key5[1] = swap32_S (l32_from_64_S (key[23])); + key5[2] = swap32_S (h32_from_64_S (key[22])); + key5[3] = swap32_S (l32_from_64_S (key[22])); + key5[4] = swap32_S (h32_from_64_S (key[21])); + key5[5] = swap32_S (l32_from_64_S (key[21])); + key5[6] = swap32_S (h32_from_64_S (key[20])); + key5[7] = swap32_S (l32_from_64_S (key[20])); + key6[0] = swap32_S (h32_from_64_S (key[19])); + key6[1] = swap32_S (l32_from_64_S (key[19])); + key6[2] = swap32_S (h32_from_64_S (key[18])); + key6[3] = swap32_S (l32_from_64_S (key[18])); + key6[4] = swap32_S (h32_from_64_S (key[17])); + key6[5] = swap32_S (l32_from_64_S (key[17])); + key6[6] = swap32_S (h32_from_64_S (key[16])); + key6[7] = swap32_S (l32_from_64_S (key[16])); + + if (verify_header_aes_twofish_serpent (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, key5, key6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_serpent_twofish_aes (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, key5, key6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) return 0; + if (verify_header_kuznyechik_serpent_camellia (esalt_bufs[0].data_buf, esalt_bufs[0].signature, key1, key2, key3, key4, key5, key6) == 1) return 0; + + return -1; +} + DECLSPEC void hmac_streebog512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u64x *ipad_hash, u64x *opad_hash, u64x *ipad_raw, u64x *opad_raw, u64x *digest, SHM_TYPE u64a (*s_sbob_sl64)[256]) { const u64x nullbuf[8] = { 0 }; @@ -134,7 +291,7 @@ DECLSPEC void hmac_streebog512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u6 streebog512_g_vector (digest, nullbuf, message, s_sbob_sl64); } -__kernel void m13773_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) +__kernel void m13773_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t)) { const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); @@ -149,6 +306,8 @@ __kernel void m13773_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) s_keyboard_layout_mapping_buf[i] = esalt_bufs[digests_offset].keyboard_layout_mapping_buf[i]; } + barrier (CLK_LOCAL_MEM_FENCE); + #ifdef REAL_SHM __local u64a s_sbob_sl64[8][256]; @@ -326,7 +485,7 @@ __kernel void m13773_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) } } -__kernel void m13773_loop (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) +__kernel void m13773_loop (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t)) { const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); @@ -338,6 +497,33 @@ __kernel void m13773_loop (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) #ifdef REAL_SHM + __local u32 s_td0[256]; + __local u32 s_td1[256]; + __local u32 s_td2[256]; + __local u32 s_td3[256]; + __local u32 s_td4[256]; + + __local u32 s_te0[256]; + __local u32 s_te1[256]; + __local u32 s_te2[256]; + __local u32 s_te3[256]; + __local u32 s_te4[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_td0[i] = td0[i]; + s_td1[i] = td1[i]; + s_td2[i] = td2[i]; + s_td3[i] = td3[i]; + s_td4[i] = td4[i]; + + s_te0[i] = te0[i]; + s_te1[i] = te1[i]; + s_te2[i] = te2[i]; + s_te3[i] = te3[i]; + s_te4[i] = te4[i]; + } + __local u64a s_sbob_sl64[8][256]; for (u32 i = lid; i < 256; i += lsz) @@ -356,11 +542,54 @@ __kernel void m13773_loop (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) #else + __constant u32a *s_td0 = td0; + __constant u32a *s_td1 = td1; + __constant u32a *s_td2 = td2; + __constant u32a *s_td3 = td3; + __constant u32a *s_td4 = td4; + + __constant u32a *s_te0 = te0; + __constant u32a *s_te1 = te1; + __constant u32a *s_te2 = te2; + __constant u32a *s_te3 = te3; + __constant u32a *s_te4 = te4; + __constant u64a (*s_sbob_sl64)[256] = sbob_sl64; #endif - if ((gid * VECT_SIZE) >= gid_max) return; + if (gid >= gid_max) return; + + // this is the pim range check + // it is guaranteed that only 0 or 1 innerloops will match a "pim" mark (each 1000 iterations) + // therefore the module limits the inner loop iteration count to 1000 + // if the key_pim is set, we know that we have to save and check the key for this pim + + const int pim_multi = esalt_bufs[digests_offset].pim_multi; + const int pim_start = esalt_bufs[digests_offset].pim_start; + const int pim_stop = esalt_bufs[digests_offset].pim_stop; + + int pim = 0; + int pim_at = 0; + + for (u32 j = 0; j < loop_cnt; j++) + { + const int iter_abs = 1 + loop_pos + j; + + if ((iter_abs % pim_multi) == pim_multi - 1) + { + const int pim_cur = (iter_abs / pim_multi) + 1; + + if ((pim_cur >= pim_start) && (pim_cur <= pim_stop)) + { + pim = pim_cur; + + pim_at = j; + } + } + } + + // irregular pbkdf2 from here u64x ipad_hash[8]; u64x opad_hash[8]; @@ -461,6 +690,20 @@ __kernel void m13773_loop (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) out[5] ^= dgst[5]; out[6] ^= dgst[6]; out[7] ^= dgst[7]; + + // this iteration creates a valid pim + + if (j == pim_at) + { + tmps[gid].pim_key[i + 0] = out[0]; + tmps[gid].pim_key[i + 1] = out[1]; + tmps[gid].pim_key[i + 2] = out[2]; + tmps[gid].pim_key[i + 3] = out[3]; + tmps[gid].pim_key[i + 4] = out[4]; + tmps[gid].pim_key[i + 5] = out[5]; + tmps[gid].pim_key[i + 6] = out[6]; + tmps[gid].pim_key[i + 7] = out[7]; + } } unpack64v (tmps, dgst, gid, i + 0, dgst[0]); @@ -481,9 +724,15 @@ __kernel void m13773_loop (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) unpack64v (tmps, out, gid, i + 6, out[6]); unpack64v (tmps, out, gid, i + 7, out[7]); } + + if (pim == 0) return; + + if (check_header_0512 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; + if (check_header_1024 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; + if (check_header_1536 (esalt_bufs, tmps[gid].pim_key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) tmps[gid].pim = pim; } -__kernel void m13773_comp (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) +__kernel void m13773_comp (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t)) { const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); @@ -542,189 +791,37 @@ __kernel void m13773_comp (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, tc_t)) if (gid >= gid_max) return; - u32 ukey1[8]; - - ukey1[0] = swap32_S (h32_from_64_S (tmps[gid].out[7])); - ukey1[1] = swap32_S (l32_from_64_S (tmps[gid].out[7])); - ukey1[2] = swap32_S (h32_from_64_S (tmps[gid].out[6])); - ukey1[3] = swap32_S (l32_from_64_S (tmps[gid].out[6])); - ukey1[4] = swap32_S (h32_from_64_S (tmps[gid].out[5])); - ukey1[5] = swap32_S (l32_from_64_S (tmps[gid].out[5])); - ukey1[6] = swap32_S (h32_from_64_S (tmps[gid].out[4])); - ukey1[7] = swap32_S (l32_from_64_S (tmps[gid].out[4])); - - u32 ukey2[8]; - - ukey2[0] = swap32_S (h32_from_64_S (tmps[gid].out[3])); - ukey2[1] = swap32_S (l32_from_64_S (tmps[gid].out[3])); - ukey2[2] = swap32_S (h32_from_64_S (tmps[gid].out[2])); - ukey2[3] = swap32_S (l32_from_64_S (tmps[gid].out[2])); - ukey2[4] = swap32_S (h32_from_64_S (tmps[gid].out[1])); - ukey2[5] = swap32_S (l32_from_64_S (tmps[gid].out[1])); - ukey2[6] = swap32_S (h32_from_64_S (tmps[gid].out[0])); - ukey2[7] = swap32_S (l32_from_64_S (tmps[gid].out[0])); - - if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) + if (tmps[gid].pim) { if (atomic_inc (&hashes_shown[0]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, tmps[gid].pim, 0); } } - - if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1) + else { - if (atomic_inc (&hashes_shown[0]) == 0) + if (check_header_0512 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } } - } - if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_camellia (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik (esalt_bufs, ukey1, ukey2) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - u32 ukey3[8]; - - ukey3[0] = swap32_S (h32_from_64_S (tmps[gid].out[15])); - ukey3[1] = swap32_S (l32_from_64_S (tmps[gid].out[15])); - ukey3[2] = swap32_S (h32_from_64_S (tmps[gid].out[14])); - ukey3[3] = swap32_S (l32_from_64_S (tmps[gid].out[14])); - ukey3[4] = swap32_S (h32_from_64_S (tmps[gid].out[13])); - ukey3[5] = swap32_S (l32_from_64_S (tmps[gid].out[13])); - ukey3[6] = swap32_S (h32_from_64_S (tmps[gid].out[12])); - ukey3[7] = swap32_S (l32_from_64_S (tmps[gid].out[12])); - - u32 ukey4[8]; - - ukey4[0] = swap32_S (h32_from_64_S (tmps[gid].out[11])); - ukey4[1] = swap32_S (l32_from_64_S (tmps[gid].out[11])); - ukey4[2] = swap32_S (h32_from_64_S (tmps[gid].out[10])); - ukey4[3] = swap32_S (l32_from_64_S (tmps[gid].out[10])); - ukey4[4] = swap32_S (h32_from_64_S (tmps[gid].out[ 9])); - ukey4[5] = swap32_S (l32_from_64_S (tmps[gid].out[ 9])); - ukey4[6] = swap32_S (h32_from_64_S (tmps[gid].out[ 8])); - ukey4[7] = swap32_S (l32_from_64_S (tmps[gid].out[ 8])); - - if (verify_header_aes_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_serpent_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) + if (check_header_1024 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } } - } - if (verify_header_camellia_kuznyechik (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_camellia_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - u32 ukey5[8]; - - ukey5[0] = swap32_S (h32_from_64_S (tmps[gid].out[23])); - ukey5[1] = swap32_S (l32_from_64_S (tmps[gid].out[23])); - ukey5[2] = swap32_S (h32_from_64_S (tmps[gid].out[22])); - ukey5[3] = swap32_S (l32_from_64_S (tmps[gid].out[22])); - ukey5[4] = swap32_S (h32_from_64_S (tmps[gid].out[21])); - ukey5[5] = swap32_S (l32_from_64_S (tmps[gid].out[21])); - ukey5[6] = swap32_S (h32_from_64_S (tmps[gid].out[20])); - ukey5[7] = swap32_S (l32_from_64_S (tmps[gid].out[20])); - - u32 ukey6[8]; - - ukey6[0] = swap32_S (h32_from_64_S (tmps[gid].out[19])); - ukey6[1] = swap32_S (l32_from_64_S (tmps[gid].out[19])); - ukey6[2] = swap32_S (h32_from_64_S (tmps[gid].out[18])); - ukey6[3] = swap32_S (l32_from_64_S (tmps[gid].out[18])); - ukey6[4] = swap32_S (h32_from_64_S (tmps[gid].out[17])); - ukey6[5] = swap32_S (l32_from_64_S (tmps[gid].out[17])); - ukey6[6] = swap32_S (h32_from_64_S (tmps[gid].out[16])); - ukey6[7] = swap32_S (l32_from_64_S (tmps[gid].out[16])); - - if (verify_header_aes_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_serpent_twofish_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) - { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); - } - } - - if (verify_header_kuznyechik_serpent_camellia (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6) == 1) - { - if (atomic_inc (&hashes_shown[0]) == 0) + if (check_header_1536 (esalt_bufs, tmps[gid].out, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) != -1) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + if (atomic_inc (&hashes_shown[0]) == 0) + { + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); + } } } } diff --git a/OpenCL/m14611-pure.cl b/OpenCL/m14611-pure.cl index dd8acc6d1..44bbbc9eb 100644 --- a/OpenCL/m14611-pure.cl +++ b/OpenCL/m14611-pure.cl @@ -362,7 +362,7 @@ __kernel void m14611_comp (KERN_ATTR_TMPS_ESALT (luks_tmp_t, luks_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m14612-pure.cl b/OpenCL/m14612-pure.cl index 783837eca..844077011 100644 --- a/OpenCL/m14612-pure.cl +++ b/OpenCL/m14612-pure.cl @@ -309,7 +309,7 @@ __kernel void m14612_comp (KERN_ATTR_TMPS_ESALT (luks_tmp_t, luks_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m14613-pure.cl b/OpenCL/m14613-pure.cl index 147ca492d..a7c3aef4d 100644 --- a/OpenCL/m14613-pure.cl +++ b/OpenCL/m14613-pure.cl @@ -309,7 +309,7 @@ __kernel void m14613_comp (KERN_ATTR_TMPS_ESALT (luks_tmp_t, luks_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m14621-pure.cl b/OpenCL/m14621-pure.cl index 6089e5d8a..d1481b27b 100644 --- a/OpenCL/m14621-pure.cl +++ b/OpenCL/m14621-pure.cl @@ -401,7 +401,7 @@ __kernel void m14621_comp (KERN_ATTR_TMPS_ESALT (luks_tmp_t, luks_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m14622-pure.cl b/OpenCL/m14622-pure.cl index 39590bd81..84c647f5a 100644 --- a/OpenCL/m14622-pure.cl +++ b/OpenCL/m14622-pure.cl @@ -348,7 +348,7 @@ __kernel void m14622_comp (KERN_ATTR_TMPS_ESALT (luks_tmp_t, luks_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m14623-pure.cl b/OpenCL/m14623-pure.cl index aa9cd1eca..56a41ae7d 100644 --- a/OpenCL/m14623-pure.cl +++ b/OpenCL/m14623-pure.cl @@ -348,7 +348,7 @@ __kernel void m14623_comp (KERN_ATTR_TMPS_ESALT (luks_tmp_t, luks_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m14631-pure.cl b/OpenCL/m14631-pure.cl index e701b6645..85930ef9f 100644 --- a/OpenCL/m14631-pure.cl +++ b/OpenCL/m14631-pure.cl @@ -457,7 +457,7 @@ __kernel void m14631_comp (KERN_ATTR_TMPS_ESALT (luks_tmp_t, luks_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m14632-pure.cl b/OpenCL/m14632-pure.cl index 02eee1be8..8bf3a7b85 100644 --- a/OpenCL/m14632-pure.cl +++ b/OpenCL/m14632-pure.cl @@ -404,7 +404,7 @@ __kernel void m14632_comp (KERN_ATTR_TMPS_ESALT (luks_tmp_t, luks_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m14633-pure.cl b/OpenCL/m14633-pure.cl index d4b6bf959..9565908b3 100644 --- a/OpenCL/m14633-pure.cl +++ b/OpenCL/m14633-pure.cl @@ -404,7 +404,7 @@ __kernel void m14633_comp (KERN_ATTR_TMPS_ESALT (luks_tmp_t, luks_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m14641-pure.cl b/OpenCL/m14641-pure.cl index 8a01443d2..f73db5d59 100644 --- a/OpenCL/m14641-pure.cl +++ b/OpenCL/m14641-pure.cl @@ -362,7 +362,7 @@ __kernel void m14641_comp (KERN_ATTR_TMPS_ESALT (luks_tmp_t, luks_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m14642-pure.cl b/OpenCL/m14642-pure.cl index 9963b0628..dd5536546 100644 --- a/OpenCL/m14642-pure.cl +++ b/OpenCL/m14642-pure.cl @@ -309,7 +309,7 @@ __kernel void m14642_comp (KERN_ATTR_TMPS_ESALT (luks_tmp_t, luks_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m14643-pure.cl b/OpenCL/m14643-pure.cl index ee5af1578..d9a02c811 100644 --- a/OpenCL/m14643-pure.cl +++ b/OpenCL/m14643-pure.cl @@ -309,7 +309,7 @@ __kernel void m14643_comp (KERN_ATTR_TMPS_ESALT (luks_tmp_t, luks_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m14700-pure.cl b/OpenCL/m14700-pure.cl index a2f71b569..0a091346d 100644 --- a/OpenCL/m14700-pure.cl +++ b/OpenCL/m14700-pure.cl @@ -380,7 +380,7 @@ __kernel void m14700_comp (KERN_ATTR_TMPS_ESALT (pbkdf2_sha1_tmp_t, itunes_backu { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, 0, 0, 0); } return; diff --git a/OpenCL/m14800-pure.cl b/OpenCL/m14800-pure.cl index d85a11100..7ee7a69b3 100644 --- a/OpenCL/m14800-pure.cl +++ b/OpenCL/m14800-pure.cl @@ -644,7 +644,7 @@ __kernel void m14800_comp (KERN_ATTR_TMPS_ESALT (pbkdf2_sha256_tmp_t, itunes_bac { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, 0, 0, 0); } return; diff --git a/OpenCL/m15300-pure.cl b/OpenCL/m15300-pure.cl index c0149b1fa..103c0338d 100644 --- a/OpenCL/m15300-pure.cl +++ b/OpenCL/m15300-pure.cl @@ -624,7 +624,7 @@ __kernel void m15300_comp (KERN_ATTR_TMPS_ESALT (dpapimk_tmp_v1_t, dpapimk_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m15900-pure.cl b/OpenCL/m15900-pure.cl index 9d9d62807..c144b2242 100644 --- a/OpenCL/m15900-pure.cl +++ b/OpenCL/m15900-pure.cl @@ -806,7 +806,7 @@ __kernel void m15900_comp (KERN_ATTR_TMPS_ESALT (dpapimk_tmp_v2_t, dpapimk_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m16100_a0-optimized.cl b/OpenCL/m16100_a0-optimized.cl index 44b90ad63..4411c8304 100644 --- a/OpenCL/m16100_a0-optimized.cl +++ b/OpenCL/m16100_a0-optimized.cl @@ -258,7 +258,7 @@ __kernel void m16100_m04 (KERN_ATTR_RULES_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -276,7 +276,7 @@ __kernel void m16100_m04 (KERN_ATTR_RULES_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -295,7 +295,7 @@ __kernel void m16100_m04 (KERN_ATTR_RULES_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -543,7 +543,7 @@ __kernel void m16100_s04 (KERN_ATTR_RULES_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -561,7 +561,7 @@ __kernel void m16100_s04 (KERN_ATTR_RULES_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -580,7 +580,7 @@ __kernel void m16100_s04 (KERN_ATTR_RULES_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m16100_a0-pure.cl b/OpenCL/m16100_a0-pure.cl index ac2e81c66..d7c6c2371 100644 --- a/OpenCL/m16100_a0-pure.cl +++ b/OpenCL/m16100_a0-pure.cl @@ -144,7 +144,7 @@ __kernel void m16100_mxx (KERN_ATTR_RULES_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -162,7 +162,7 @@ __kernel void m16100_mxx (KERN_ATTR_RULES_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -181,7 +181,7 @@ __kernel void m16100_mxx (KERN_ATTR_RULES_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -306,7 +306,7 @@ __kernel void m16100_sxx (KERN_ATTR_RULES_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -324,7 +324,7 @@ __kernel void m16100_sxx (KERN_ATTR_RULES_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -343,7 +343,7 @@ __kernel void m16100_sxx (KERN_ATTR_RULES_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m16100_a1-optimized.cl b/OpenCL/m16100_a1-optimized.cl index a24d654d1..46c45a392 100644 --- a/OpenCL/m16100_a1-optimized.cl +++ b/OpenCL/m16100_a1-optimized.cl @@ -317,7 +317,7 @@ __kernel void m16100_m04 (KERN_ATTR_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -335,7 +335,7 @@ __kernel void m16100_m04 (KERN_ATTR_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -354,7 +354,7 @@ __kernel void m16100_m04 (KERN_ATTR_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -663,7 +663,7 @@ __kernel void m16100_s04 (KERN_ATTR_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -681,7 +681,7 @@ __kernel void m16100_s04 (KERN_ATTR_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -700,7 +700,7 @@ __kernel void m16100_s04 (KERN_ATTR_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m16100_a1-pure.cl b/OpenCL/m16100_a1-pure.cl index 7eb1ee0bd..15b4ed1a0 100644 --- a/OpenCL/m16100_a1-pure.cl +++ b/OpenCL/m16100_a1-pure.cl @@ -137,7 +137,7 @@ __kernel void m16100_mxx (KERN_ATTR_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -155,7 +155,7 @@ __kernel void m16100_mxx (KERN_ATTR_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -174,7 +174,7 @@ __kernel void m16100_mxx (KERN_ATTR_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -295,7 +295,7 @@ __kernel void m16100_sxx (KERN_ATTR_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -313,7 +313,7 @@ __kernel void m16100_sxx (KERN_ATTR_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -332,7 +332,7 @@ __kernel void m16100_sxx (KERN_ATTR_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m16100_a3-optimized.cl b/OpenCL/m16100_a3-optimized.cl index 023ab906c..fcfedac74 100644 --- a/OpenCL/m16100_a3-optimized.cl +++ b/OpenCL/m16100_a3-optimized.cl @@ -232,7 +232,7 @@ DECLSPEC void m16100m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -250,7 +250,7 @@ DECLSPEC void m16100m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -269,7 +269,7 @@ DECLSPEC void m16100m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -485,7 +485,7 @@ DECLSPEC void m16100s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -503,7 +503,7 @@ DECLSPEC void m16100s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -522,7 +522,7 @@ DECLSPEC void m16100s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m16100_a3-pure.cl b/OpenCL/m16100_a3-pure.cl index 6201122b2..4e8e7b0a8 100644 --- a/OpenCL/m16100_a3-pure.cl +++ b/OpenCL/m16100_a3-pure.cl @@ -154,7 +154,7 @@ __kernel void m16100_mxx (KERN_ATTR_VECTOR_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -172,7 +172,7 @@ __kernel void m16100_mxx (KERN_ATTR_VECTOR_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -191,7 +191,7 @@ __kernel void m16100_mxx (KERN_ATTR_VECTOR_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -329,7 +329,7 @@ __kernel void m16100_sxx (KERN_ATTR_VECTOR_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -347,7 +347,7 @@ __kernel void m16100_sxx (KERN_ATTR_VECTOR_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -366,7 +366,7 @@ __kernel void m16100_sxx (KERN_ATTR_VECTOR_ESALT (tacacs_plus_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m16200-pure.cl b/OpenCL/m16200-pure.cl index 066e919e7..6039d84aa 100644 --- a/OpenCL/m16200-pure.cl +++ b/OpenCL/m16200-pure.cl @@ -395,7 +395,7 @@ __kernel void m16200_comp (KERN_ATTR_TMPS_ESALT (apple_secure_notes_tmp_t, apple { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m16600_a0-optimized.cl b/OpenCL/m16600_a0-optimized.cl index b054d1b4c..e7754fa40 100644 --- a/OpenCL/m16600_a0-optimized.cl +++ b/OpenCL/m16600_a0-optimized.cl @@ -378,7 +378,7 @@ __kernel void m16600_m04 (KERN_ATTR_RULES_ESALT (electrum_wallet_t)) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } @@ -394,7 +394,7 @@ __kernel void m16600_m04 (KERN_ATTR_RULES_ESALT (electrum_wallet_t)) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -763,7 +763,7 @@ __kernel void m16600_s04 (KERN_ATTR_RULES_ESALT (electrum_wallet_t)) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } @@ -779,7 +779,7 @@ __kernel void m16600_s04 (KERN_ATTR_RULES_ESALT (electrum_wallet_t)) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m16600_a0-pure.cl b/OpenCL/m16600_a0-pure.cl index bc2d4614c..65ecd0c35 100644 --- a/OpenCL/m16600_a0-pure.cl +++ b/OpenCL/m16600_a0-pure.cl @@ -193,7 +193,7 @@ __kernel void m16600_mxx (KERN_ATTR_RULES_ESALT (electrum_wallet_t)) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } @@ -209,7 +209,7 @@ __kernel void m16600_mxx (KERN_ATTR_RULES_ESALT (electrum_wallet_t)) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -384,7 +384,7 @@ __kernel void m16600_sxx (KERN_ATTR_RULES_ESALT (electrum_wallet_t)) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } @@ -400,7 +400,7 @@ __kernel void m16600_sxx (KERN_ATTR_RULES_ESALT (electrum_wallet_t)) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m16600_a1-optimized.cl b/OpenCL/m16600_a1-optimized.cl index e6cafb3fc..f993b520d 100644 --- a/OpenCL/m16600_a1-optimized.cl +++ b/OpenCL/m16600_a1-optimized.cl @@ -434,7 +434,7 @@ __kernel void m16600_m04 (KERN_ATTR_ESALT (electrum_wallet_t)) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } @@ -450,7 +450,7 @@ __kernel void m16600_m04 (KERN_ATTR_ESALT (electrum_wallet_t)) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -877,7 +877,7 @@ __kernel void m16600_s04 (KERN_ATTR_ESALT (electrum_wallet_t)) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } @@ -893,7 +893,7 @@ __kernel void m16600_s04 (KERN_ATTR_ESALT (electrum_wallet_t)) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m16600_a1-pure.cl b/OpenCL/m16600_a1-pure.cl index d586de48b..b818631f6 100644 --- a/OpenCL/m16600_a1-pure.cl +++ b/OpenCL/m16600_a1-pure.cl @@ -189,7 +189,7 @@ __kernel void m16600_mxx (KERN_ATTR_ESALT (electrum_wallet_t)) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } @@ -205,7 +205,7 @@ __kernel void m16600_mxx (KERN_ATTR_ESALT (electrum_wallet_t)) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -378,7 +378,7 @@ __kernel void m16600_sxx (KERN_ATTR_ESALT (electrum_wallet_t)) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } @@ -394,7 +394,7 @@ __kernel void m16600_sxx (KERN_ATTR_ESALT (electrum_wallet_t)) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m16600_a3-optimized.cl b/OpenCL/m16600_a3-optimized.cl index 7f0546ed5..96bda402b 100644 --- a/OpenCL/m16600_a3-optimized.cl +++ b/OpenCL/m16600_a3-optimized.cl @@ -296,7 +296,7 @@ DECLSPEC void m16600 (SHM_TYPE u32a *s_te0, SHM_TYPE u32a *s_te1, SHM_TYPE u32a if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } @@ -312,7 +312,7 @@ DECLSPEC void m16600 (SHM_TYPE u32a *s_te0, SHM_TYPE u32a *s_te1, SHM_TYPE u32a if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m16600_a3-pure.cl b/OpenCL/m16600_a3-pure.cl index 707474486..6120c855c 100644 --- a/OpenCL/m16600_a3-pure.cl +++ b/OpenCL/m16600_a3-pure.cl @@ -202,7 +202,7 @@ __kernel void m16600_mxx (KERN_ATTR_VECTOR_ESALT (electrum_wallet_t)) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } @@ -218,7 +218,7 @@ __kernel void m16600_mxx (KERN_ATTR_VECTOR_ESALT (electrum_wallet_t)) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -404,7 +404,7 @@ __kernel void m16600_sxx (KERN_ATTR_VECTOR_ESALT (electrum_wallet_t)) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } @@ -420,7 +420,7 @@ __kernel void m16600_sxx (KERN_ATTR_VECTOR_ESALT (electrum_wallet_t)) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m18200_a0-optimized.cl b/OpenCL/m18200_a0-optimized.cl index cd988b2de..19119e97d 100644 --- a/OpenCL/m18200_a0-optimized.cl +++ b/OpenCL/m18200_a0-optimized.cl @@ -656,7 +656,7 @@ __kernel void m18200_m04 (KERN_ATTR_RULES_ESALT (krb5asrep_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -754,7 +754,7 @@ __kernel void m18200_s04 (KERN_ATTR_RULES_ESALT (krb5asrep_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m18200_a0-pure.cl b/OpenCL/m18200_a0-pure.cl index 6b529ca5e..a44e2cbf7 100644 --- a/OpenCL/m18200_a0-pure.cl +++ b/OpenCL/m18200_a0-pure.cl @@ -440,7 +440,7 @@ __kernel void m18200_mxx (KERN_ATTR_RULES_ESALT (krb5asrep_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -502,7 +502,7 @@ __kernel void m18200_sxx (KERN_ATTR_RULES_ESALT (krb5asrep_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m18200_a1-optimized.cl b/OpenCL/m18200_a1-optimized.cl index f77b71f78..b52e99b48 100644 --- a/OpenCL/m18200_a1-optimized.cl +++ b/OpenCL/m18200_a1-optimized.cl @@ -703,7 +703,7 @@ __kernel void m18200_m04 (KERN_ATTR_ESALT (krb5asrep_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -850,7 +850,7 @@ __kernel void m18200_s04 (KERN_ATTR_ESALT (krb5asrep_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m18200_a1-pure.cl b/OpenCL/m18200_a1-pure.cl index 680bd7e5a..f4c7a6788 100644 --- a/OpenCL/m18200_a1-pure.cl +++ b/OpenCL/m18200_a1-pure.cl @@ -436,7 +436,7 @@ __kernel void m18200_mxx (KERN_ATTR_ESALT (krb5asrep_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -496,7 +496,7 @@ __kernel void m18200_sxx (KERN_ATTR_ESALT (krb5asrep_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m18200_a3-optimized.cl b/OpenCL/m18200_a3-optimized.cl index 5105a1a74..052b10ea6 100644 --- a/OpenCL/m18200_a3-optimized.cl +++ b/OpenCL/m18200_a3-optimized.cl @@ -623,7 +623,7 @@ DECLSPEC void m18200 (__local RC4_KEY *rc4_key, u32 *w0, u32 *w1, u32 *w2, u32 * { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m18200_a3-pure.cl b/OpenCL/m18200_a3-pure.cl index 4fbaac2e2..9cc85a39c 100644 --- a/OpenCL/m18200_a3-pure.cl +++ b/OpenCL/m18200_a3-pure.cl @@ -449,7 +449,7 @@ __kernel void m18200_mxx (KERN_ATTR_VECTOR_ESALT (krb5asrep_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } @@ -522,7 +522,7 @@ __kernel void m18200_sxx (KERN_ATTR_VECTOR_ESALT (krb5asrep_t)) { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m18300-pure.cl b/OpenCL/m18300-pure.cl index 5cd3cfd72..cceeb5f70 100644 --- a/OpenCL/m18300-pure.cl +++ b/OpenCL/m18300-pure.cl @@ -435,7 +435,7 @@ __kernel void m18300_comp (KERN_ATTR_TMPS_ESALT (apple_secure_notes_tmp_t, apple { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m18900-pure.cl b/OpenCL/m18900-pure.cl index 6fd861728..426a8a3d3 100644 --- a/OpenCL/m18900-pure.cl +++ b/OpenCL/m18900-pure.cl @@ -339,7 +339,7 @@ __kernel void m18900_comp (KERN_ATTR_TMPS_ESALT (android_backup_tmp_t, android_b { if (atomic_inc (&hashes_shown[digests_offset]) == 0) { - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, 0); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m19600-pure.cl b/OpenCL/m19600-pure.cl index 2949b044b..c6e323bbc 100644 --- a/OpenCL/m19600-pure.cl +++ b/OpenCL/m19600-pure.cl @@ -999,7 +999,7 @@ __kernel void m19600_comp (KERN_ATTR_TMPS_ESALT (krb5tgs_17_tmp_t, krb5tgs_17_t) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { #define il_pos 0 - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/OpenCL/m19700-pure.cl b/OpenCL/m19700-pure.cl index e17bf7186..67f9b0096 100644 --- a/OpenCL/m19700-pure.cl +++ b/OpenCL/m19700-pure.cl @@ -1063,7 +1063,7 @@ __kernel void m19700_comp (KERN_ATTR_TMPS_ESALT (krb5tgs_18_tmp_t, krb5tgs_18_t) if (atomic_inc (&hashes_shown[digests_offset]) == 0) { #define il_pos 0 - mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos); + mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, digests_offset + 0, gid, il_pos, 0, 0); } } } diff --git a/docs/changes.txt b/docs/changes.txt index cece708c2..4ae77d52c 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -1,47 +1,57 @@ * changes v5.1.0 -> v5.x.x +## +## Feature +## + +- Fully modularized hash-mode integration via plugin interface and converted all existing hash-modes +- Support for inline VeraCrypt PIM Brute-Force + ## ## Algorithms ## -- Added hash-mode 18400 (Open Document Format (ODF) 1.2 (SHA-256, AES)) -- Added hash-mode 18500 sha1(md5(md5($pass))) -- Added hash-mode 18600 (Open Document Format (ODF) 1.1 (SHA-1, Blowfish)) -- Added hash-mode 18700 Java Object hashCode() -- Added hash-mode 18800 Blockchain, My Wallet, Second Password (SHA256) -- Added hash-mode 18900 Android Backup -- Added hash-mode 19000 QNX /etc/shadow (MD5) -- Added hash-mode 19100 QNX /etc/shadow (SHA256) -- Added hash-mode 19200 QNX /etc/shadow (SHA512) -- Added hash-mode 19300 sha1($salt1.$pass.$salt2) +- Added hash-mode: Open Document Format (ODF) 1.2 (SHA-256, AES) +- Added hash-mode: Open Document Format (ODF) 1.1 (SHA-1, Blowfish) +- Added hash-mode: Java Object hashCode() +- Added hash-mode: Blockchain, My Wallet, Second Password (SHA256) +- Added hash-mode: Android Backup +- Added hash-mode: QNX /etc/shadow (MD5) +- Added hash-mode: QNX /etc/shadow (SHA256) +- Added hash-mode: QNX /etc/shadow (SHA512) +- Added hash-mode: Kerberos 5 TGS-REP etype 17 (AES128-CTS-HMAC-SHA1-96) +- Added hash-mode: Kerberos 5 TGS-REP etype 18 (AES256-CTS-HMAC-SHA1-96) +- Added hash-mode: sha1(md5(md5($pass))) +- Added hash-mode: sha1($salt1.$pass.$salt2) ## ## Bugs ## -- Fixed output of IKE PSK (mode 5300 and 5400) hashes to have separators at right position -- Fixed the validation of the --brain-client-features command line argument (only values 1, 2 or 3 are allowed) - Fixed cracking of Cisco-PIX and Cisco-ASA MD5 passwords in mask-attack mode if mask > length 16 +- Fixed cracking of Electrum Wallet Salt-Type 2 hashes - Fixed cracking of NetNTLMv1 passwords in mask-attack mode if mask > length 16 (optimized kernels only) -- Fixed the 7-Zip parser to allow the entire supported range of encrypted and decrypted data lengths -- Fixed incorrect progress-only result in a special race condition -- Fixed maximum password length limit which was announced as 256 but actually was 255 - Fixed cracking raw Streebog-HMAC 256 and 512 hashes with password of length >= 64 - Fixed cracking raw Whirlpool hashes cracking with password of length >= 32 -- Fixed cracking of Electrum Wallet Salt-Type 2 hashes +- Fixed incorrect progress-only result in a special race condition +- Fixed maximum password length limit which was announced as 256 but actually was 255 +- Fixed output of IKE PSK (mode 5300 and 5400) hashes to have separators at right position +- Fixed the 7-Zip parser to allow the entire supported range of encrypted and decrypted data lengths +- Fixed the validation of the --brain-client-features command line argument (only values 1, 2 or 3 are allowed) ## ## Improvements ## -- Building: Updated BUILD.md -- Tuning Database: Updated hashcat.hctune with new models and refreshed vector width values - Bitcoin Wallet: Be more user friendly by allowing a larger data range for ckey and public_key -- OpenCL Runtime: Workaround JiT compiler error on AMDGPU driver compiling WPA-EAPOL-PBKDF2 OpenCL kernel +- Building: Updated BUILD.md +- My Wallet: Added additional plaintext pattern used in newer versions - OpenCL Runtime: Disable OpenCL kernel cache on Apple for Intel CPU (throws CL_BUILD_PROGRAM_FAILURE for no reason) - OpenCL Runtime: Improve ROCM detection and make sure to not confuse with recent AMDGPU drivers - OpenCL Runtime: Not using amd_bytealign (amd_bitalign is fine) on AMDGPU driver drastically reduces JiT segfaults -- My Wallet: Added additional plaintext pattern used in newer versions +- OpenCL Runtime: Update unstable mode warnings for Apple and AMDGPU drivers +- OpenCL Runtime: Workaround JiT compiler error on AMDGPU driver compiling WPA-EAPOL-PBKDF2 OpenCL kernel +- Tuning Database: Updated hashcat.hctune with new models and refreshed vector width values ## ## Technical diff --git a/extra/tab_completion/hashcat.sh b/extra/tab_completion/hashcat.sh index eb9104462..482488337 100644 --- a/extra/tab_completion/hashcat.sh +++ b/extra/tab_completion/hashcat.sh @@ -189,8 +189,8 @@ _hashcat () local BUILD_IN_CHARSETS='?l ?u ?d ?a ?b ?s ?h ?H' local SHORT_OPTS="-m -a -V -v -h -b -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -i -I -s -l -O -S -z" - local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --benchmark-all --hex-salt --hex-wordlist --hex-charset --force --status --status-timer --machine-readable --loopback --markov-hcstat2 --markov-disable --markov-classic --markov-threshold --runtime --session --speed-only --progress-only --restore --restore-file-path --restore-disable --outfile --outfile-format --outfile-autohex-disable --outfile-check-timer --outfile-check-dir --wordlist-autohex-disable --separator --show --left --username --remove --remove-timer --potfile-disable --potfile-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --example-hashes --opencl-info --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-disable --hwmon-temp-abort --skip --limit --keyspace --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --self-test-disable --slow-candidates --brain-server --brain-client --brain-client-features --brain-host --brain-port --brain-session --brain-session-whitelist --brain-password" - local OPTIONS="-m -a -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -s -l --hash-type --attack-mode --status-timer --markov-hcstat2 --markov-threshold --runtime --session --timer --outfile --outfile-format --outfile-check-timer --outfile-check-dir --separator --remove-timer --potfile-path --restore-file-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-temp-abort --skip --limit --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment-min --increment-max --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --brain-client-features --brain-host --brain-password --brain-port --brain-session --brain-whitelist-session --stdin-timeout-abort" + local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --benchmark-all --hex-salt --hex-wordlist --hex-charset --force --status --status-timer --machine-readable --loopback --markov-hcstat2 --markov-disable --markov-classic --markov-threshold --runtime --session --speed-only --progress-only --restore --restore-file-path --restore-disable --outfile --outfile-format --outfile-autohex-disable --outfile-check-timer --outfile-check-dir --wordlist-autohex-disable --separator --show --left --username --remove --remove-timer --potfile-disable --potfile-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --example-hashes --opencl-info --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-disable --hwmon-temp-abort --skip --limit --keyspace --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --self-test-disable --slow-candidates --brain-server --brain-client --brain-client-features --brain-host --brain-port --brain-session --brain-session-whitelist --brain-password" + local OPTIONS="-m -a -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -s -l --hash-type --attack-mode --status-timer --markov-hcstat2 --markov-threshold --runtime --session --timer --outfile --outfile-format --outfile-check-timer --outfile-check-dir --separator --remove-timer --potfile-path --restore-file-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-temp-abort --skip --limit --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment-min --increment-max --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --brain-client-features --brain-host --brain-password --brain-port --brain-session --brain-whitelist-session --stdin-timeout-abort" COMPREPLY=() local cur="${COMP_WORDS[COMP_CWORD]}" diff --git a/include/modules.h b/include/modules.h index 3372160b5..2b4086e47 100644 --- a/include/modules.h +++ b/include/modules.h @@ -71,7 +71,7 @@ int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *ha void module_hook12 (hc_device_param_t *device_param, const void *hook_salts_buf, const u32 salt_pos, const u64 pws_cnt); void module_hook23 (hc_device_param_t *device_param, const void *hook_salts_buf, const u32 salt_pos, const u64 pws_cnt); -int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz); +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz); bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hc_device_param_t *device_param); diff --git a/include/types.h b/include/types.h index b4d381285..88605b6a5 100644 --- a/include/types.h +++ b/include/types.h @@ -728,8 +728,9 @@ typedef enum user_options_map IDX_STDIN_TIMEOUT_ABORT = 0xff42, IDX_TRUECRYPT_KEYFILES = 0xff43, IDX_USERNAME = 0xff44, - IDX_VERACRYPT_KEYFILES = 0xff46, - IDX_VERACRYPT_PIM = 0xff47, + IDX_VERACRYPT_KEYFILES = 0xff45, + IDX_VERACRYPT_PIM_START = 0xff46, + IDX_VERACRYPT_PIM_STOP = 0xff47, IDX_VERSION_LOWER = 'v', IDX_VERSION = 'V', IDX_WORDLIST_AUTOHEX_DISABLE = 0xff48, @@ -1028,6 +1029,8 @@ typedef struct plain u32 salt_pos; u32 digest_pos; u32 hash_pos; + u32 extra1; + u32 extra2; } plain_t; @@ -1872,7 +1875,8 @@ typedef struct user_options u32 segment_size; u32 status_timer; u32 stdin_timeout_abort; - u32 veracrypt_pim; + u32 veracrypt_pim_start; + u32 veracrypt_pim_stop; u32 workload_profile; u64 limit; u64 skip; @@ -2334,7 +2338,7 @@ typedef struct module_ctx void (*module_hook12) (hc_device_param_t *, const void *, const u32, const u64); void (*module_hook23) (hc_device_param_t *, const void *, const u32, const u64); - int (*module_build_plain_postprocess) (const hashconfig_t *, const hashes_t *, const u32 *, const size_t, const int, u32 *, const size_t); + int (*module_build_plain_postprocess) (const hashconfig_t *, const hashes_t *, const plain_t *, const u32 *, const size_t, const int, u32 *, const size_t); bool (*module_unstable_warning) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *, const hc_device_param_t *); diff --git a/src/brain.c b/src/brain.c index f30917a19..42e6326b8 100644 --- a/src/brain.c +++ b/src/brain.c @@ -181,9 +181,13 @@ u32 brain_compute_attack (hashcat_ctx_t *hashcat_ctx) XXH64_update (state, &nonce_error_corrections, sizeof (nonce_error_corrections)); - const int veracrypt_pim = user_options->veracrypt_pim; + const int veracrypt_pim_start = user_options->veracrypt_pim_start; - XXH64_update (state, &veracrypt_pim, sizeof (veracrypt_pim)); + XXH64_update (state, &veracrypt_pim_start, sizeof (veracrypt_pim_start)); + + const int veracrypt_pim_stop = user_options->veracrypt_pim_stop; + + XXH64_update (state, &veracrypt_pim_stop, sizeof (veracrypt_pim_stop)); if (user_options->attack_mode == ATTACK_MODE_STRAIGHT) { diff --git a/src/hashes.c b/src/hashes.c index 1de247204..d14fbb7f1 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -285,7 +285,7 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl { u32 temp_buf[64] = { 0 }; - const int temp_len = module_ctx->module_build_plain_postprocess (hashcat_ctx->hashconfig, hashcat_ctx->hashes, plain_buf, sizeof (plain_buf), plain_len, temp_buf, sizeof (temp_buf)); + const int temp_len = module_ctx->module_build_plain_postprocess (hashcat_ctx->hashconfig, hashcat_ctx->hashes, plain, plain_buf, sizeof (plain_buf), plain_len, temp_buf, sizeof (temp_buf)); if (temp_len < (int) sizeof (plain_buf)) { diff --git a/src/modules/module_06231.c b/src/modules/module_06231.c index e2907223a..7ffc0c5ee 100644 --- a/src/modules/module_06231.c +++ b/src/modules/module_06231.c @@ -196,18 +196,6 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE return 1; } -bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hc_device_param_t *device_param) -{ - // l_opencl_p_18.1.0.013: self-test failed - // note that opencl_runtime_16.1.2_x64_rh_6.4.0.37 works fine - if (device_param->device_vendor_id == VENDOR_ID_INTEL_SDK) - { - return true; - } - - return false; -} - int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) { u32 *digest = (u32 *) digest_buf; @@ -300,6 +288,6 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_st_hash = module_st_hash; module_ctx->module_st_pass = module_st_pass; module_ctx->module_tmp_size = module_tmp_size; - module_ctx->module_unstable_warning = module_unstable_warning; + module_ctx->module_unstable_warning = MODULE_DEFAULT; module_ctx->module_warmup_disable = MODULE_DEFAULT; } diff --git a/src/modules/module_06232.c b/src/modules/module_06232.c index b5d90d671..6b8103306 100644 --- a/src/modules/module_06232.c +++ b/src/modules/module_06232.c @@ -196,18 +196,6 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE return 1; } -bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hc_device_param_t *device_param) -{ - // l_opencl_p_18.1.0.013: self-test failed - // note that opencl_runtime_16.1.2_x64_rh_6.4.0.37 works fine - if (device_param->device_vendor_id == VENDOR_ID_INTEL_SDK) - { - return true; - } - - return false; -} - int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) { u32 *digest = (u32 *) digest_buf; @@ -300,6 +288,6 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_st_hash = module_st_hash; module_ctx->module_st_pass = module_st_pass; module_ctx->module_tmp_size = module_tmp_size; - module_ctx->module_unstable_warning = module_unstable_warning; + module_ctx->module_unstable_warning = MODULE_DEFAULT; module_ctx->module_warmup_disable = MODULE_DEFAULT; } diff --git a/src/modules/module_06233.c b/src/modules/module_06233.c index 7e7f2d472..9cffdf934 100644 --- a/src/modules/module_06233.c +++ b/src/modules/module_06233.c @@ -198,13 +198,6 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hc_device_param_t *hc_device_param) { - // l_opencl_p_18.1.0.013: self-test failed - // note that opencl_runtime_16.1.2_x64_rh_6.4.0.37 works fine - if (hc_device_param->device_vendor_id == VENDOR_ID_INTEL_SDK) - { - return true; - } - // amdgpu-pro-18.50-708488-ubuntu-18.04: Segmentation fault if ((hc_device_param->device_vendor_id == VENDOR_ID_AMD) && (hc_device_param->has_vperm == false)) { diff --git a/src/modules/module_06241.c b/src/modules/module_06241.c index 7885221c5..13c51e5a3 100644 --- a/src/modules/module_06241.c +++ b/src/modules/module_06241.c @@ -70,7 +70,7 @@ typedef struct tc static const int ROUNDS_TRUECRYPT_1K = 1000; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; -int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) { const tc_t *tc = (const tc_t *) hashes->esalts_buf; diff --git a/src/modules/module_06242.c b/src/modules/module_06242.c index 614cc72d7..1227fff9f 100644 --- a/src/modules/module_06242.c +++ b/src/modules/module_06242.c @@ -70,7 +70,7 @@ typedef struct tc static const int ROUNDS_TRUECRYPT_1K = 1000; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; -int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) { const tc_t *tc = (const tc_t *) hashes->esalts_buf; diff --git a/src/modules/module_06243.c b/src/modules/module_06243.c index f85439a59..cc8f6290b 100644 --- a/src/modules/module_06243.c +++ b/src/modules/module_06243.c @@ -70,7 +70,7 @@ typedef struct tc static const int ROUNDS_TRUECRYPT_1K = 1000; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; -int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) { const tc_t *tc = (const tc_t *) hashes->esalts_buf; diff --git a/src/modules/module_13711.c b/src/modules/module_13711.c index c53974d8e..c35d22b7e 100644 --- a/src/modules/module_13711.c +++ b/src/modules/module_13711.c @@ -21,9 +21,8 @@ static const u32 DGST_POS3 = 3; static const u32 DGST_SIZE = DGST_SIZE_4_5; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt RIPEMD160 + XTS 512 bit"; -static const u64 KERN_TYPE = 6211; -static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 KERN_TYPE = 13711; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_BINARY_HASHFILE; static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; @@ -45,7 +44,7 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } -typedef struct tc_tmp +typedef struct vc_tmp { u32 ipad[16]; u32 opad[16]; @@ -53,9 +52,12 @@ typedef struct tc_tmp u32 dgst[64]; u32 out[64]; -} tc_tmp_t; + u32 pim_key[64]; + int pim; // marker for cracked -typedef struct tc +} vc_tmp_t; + +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -65,11 +67,27 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; static const int ROUNDS_VERACRYPT_655331 = 655331; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + if (plain->extra1 == 0) + { + return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf); + } + else + { + return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, plain->extra1 - 15); + } +} + bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { const bool potfile_disable = true; @@ -86,18 +104,25 @@ bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 esalt_size = (const u64) sizeof (tc_t); + const u64 esalt_size = (const u64) sizeof (vc_t); return esalt_size; } u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + const u64 tmp_size = (const u64) sizeof (vc_tmp_t); return tmp_size; } +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_max = 1000; // lowest PIM multiplier + + return kernel_loops_max; +} + u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { // this overrides the reductions of PW_MAX in case optimized kernel is selected @@ -158,7 +183,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE // keyfiles - tc_t *tc = (tc_t *) hash->esalt; + vc_t *vc = (vc_t *) hash->esalt; if (user_options->veracrypt_keyfiles) { @@ -172,7 +197,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (keyfile)) { - cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); } keyfile = strtok_r ((char *) NULL, ",", &saveptr); @@ -187,7 +212,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (user_options->keyboard_layout_mapping)) { - initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, vc->keyboard_layout_mapping_buf, &vc->keyboard_layout_mapping_cnt); } } @@ -195,10 +220,12 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE salt_t *salt = hash->salt; - if (user_options->veracrypt_pim) + if ((user_options->veracrypt_pim_start) && (user_options->veracrypt_pim_stop)) { - salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + vc->pim_start = 15 + user_options->veracrypt_pim_start; + vc->pim_stop = 15 + user_options->veracrypt_pim_stop; + salt->salt_iter = vc->pim_stop * 1000; salt->salt_iter--; } @@ -209,25 +236,30 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { u32 *digest = (u32 *) digest_buf; - tc_t *tc = (tc_t *) esalt_buf; + vc_t *vc = (vc_t *) esalt_buf; const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + memcpy (vc->salt_buf, line_buf, 64); - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (vc->data_buf, line_buf + 64, 512 - 64); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_buf[0] = vc->salt_buf[0]; salt->salt_len = 4; - salt->salt_iter = ROUNDS_VERACRYPT_655331 - 1; + salt->salt_iter = ROUNDS_VERACRYPT_655331; + salt->salt_iter--; + + vc->pim_multi = 1000; + vc->pim_start = 0; + vc->pim_stop = 0; - tc->signature = 0x41524556; // "VERA" + vc->signature = 0x41524556; // "VERA" - digest[0] = tc->data_buf[0]; + digest[0] = vc->data_buf[0]; return (PARSER_OK); } @@ -242,7 +274,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; module_ctx->module_benchmark_mask = MODULE_DEFAULT; module_ctx->module_benchmark_salt = MODULE_DEFAULT; - module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; module_ctx->module_dgst_pos0 = module_dgst_pos0; module_ctx->module_dgst_pos1 = module_dgst_pos1; @@ -275,7 +307,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_jit_cache_disable = MODULE_DEFAULT; module_ctx->module_kernel_accel_max = MODULE_DEFAULT; module_ctx->module_kernel_accel_min = MODULE_DEFAULT; - module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = MODULE_DEFAULT; module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; diff --git a/src/modules/module_13712.c b/src/modules/module_13712.c index b02668321..00077c6bf 100644 --- a/src/modules/module_13712.c +++ b/src/modules/module_13712.c @@ -21,9 +21,8 @@ static const u32 DGST_POS3 = 3; static const u32 DGST_SIZE = DGST_SIZE_4_5; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt RIPEMD160 + XTS 1024 bit"; -static const u64 KERN_TYPE = 6212; -static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 KERN_TYPE = 13712; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_BINARY_HASHFILE; static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; @@ -45,7 +44,7 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } -typedef struct tc_tmp +typedef struct vc_tmp { u32 ipad[16]; u32 opad[16]; @@ -53,9 +52,12 @@ typedef struct tc_tmp u32 dgst[64]; u32 out[64]; -} tc_tmp_t; + u32 pim_key[64]; + int pim; // marker for cracked -typedef struct tc +} vc_tmp_t; + +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -65,11 +67,27 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; static const int ROUNDS_VERACRYPT_655331 = 655331; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + if (plain->extra1 == 0) + { + return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf); + } + else + { + return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, plain->extra1 - 15); + } +} + bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { const bool potfile_disable = true; @@ -86,18 +104,25 @@ bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 esalt_size = (const u64) sizeof (tc_t); + const u64 esalt_size = (const u64) sizeof (vc_t); return esalt_size; } u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + const u64 tmp_size = (const u64) sizeof (vc_tmp_t); return tmp_size; } +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_max = 1000; // lowest PIM multiplier + + return kernel_loops_max; +} + u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { // this overrides the reductions of PW_MAX in case optimized kernel is selected @@ -158,7 +183,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE // keyfiles - tc_t *tc = (tc_t *) hash->esalt; + vc_t *vc = (vc_t *) hash->esalt; if (user_options->veracrypt_keyfiles) { @@ -172,7 +197,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (keyfile)) { - cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); } keyfile = strtok_r ((char *) NULL, ",", &saveptr); @@ -187,7 +212,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (user_options->keyboard_layout_mapping)) { - initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, vc->keyboard_layout_mapping_buf, &vc->keyboard_layout_mapping_cnt); } } @@ -195,10 +220,12 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE salt_t *salt = hash->salt; - if (user_options->veracrypt_pim) + if ((user_options->veracrypt_pim_start) && (user_options->veracrypt_pim_stop)) { - salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + vc->pim_start = 15 + user_options->veracrypt_pim_start; + vc->pim_stop = 15 + user_options->veracrypt_pim_stop; + salt->salt_iter = vc->pim_stop * 1000; salt->salt_iter--; } @@ -209,25 +236,30 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { u32 *digest = (u32 *) digest_buf; - tc_t *tc = (tc_t *) esalt_buf; + vc_t *vc = (vc_t *) esalt_buf; const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + memcpy (vc->salt_buf, line_buf, 64); - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (vc->data_buf, line_buf + 64, 512 - 64); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_buf[0] = vc->salt_buf[0]; salt->salt_len = 4; - salt->salt_iter = ROUNDS_VERACRYPT_655331 - 1; + salt->salt_iter = ROUNDS_VERACRYPT_655331; + salt->salt_iter--; + + vc->pim_multi = 1000; + vc->pim_start = 0; + vc->pim_stop = 0; - tc->signature = 0x41524556; // "VERA" + vc->signature = 0x41524556; // "VERA" - digest[0] = tc->data_buf[0]; + digest[0] = vc->data_buf[0]; return (PARSER_OK); } @@ -242,7 +274,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; module_ctx->module_benchmark_mask = MODULE_DEFAULT; module_ctx->module_benchmark_salt = MODULE_DEFAULT; - module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; module_ctx->module_dgst_pos0 = module_dgst_pos0; module_ctx->module_dgst_pos1 = module_dgst_pos1; @@ -275,7 +307,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_jit_cache_disable = MODULE_DEFAULT; module_ctx->module_kernel_accel_max = MODULE_DEFAULT; module_ctx->module_kernel_accel_min = MODULE_DEFAULT; - module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = MODULE_DEFAULT; module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; diff --git a/src/modules/module_13713.c b/src/modules/module_13713.c index 72cb24887..8679dc4a6 100644 --- a/src/modules/module_13713.c +++ b/src/modules/module_13713.c @@ -21,9 +21,8 @@ static const u32 DGST_POS3 = 3; static const u32 DGST_SIZE = DGST_SIZE_4_5; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt RIPEMD160 + XTS 1536 bit"; -static const u64 KERN_TYPE = 6213; -static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 KERN_TYPE = 13713; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_BINARY_HASHFILE; static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; @@ -45,7 +44,7 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } -typedef struct tc_tmp +typedef struct vc_tmp { u32 ipad[16]; u32 opad[16]; @@ -53,9 +52,12 @@ typedef struct tc_tmp u32 dgst[64]; u32 out[64]; -} tc_tmp_t; + u32 pim_key[64]; + int pim; // marker for cracked -typedef struct tc +} vc_tmp_t; + +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -65,11 +67,27 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; static const int ROUNDS_VERACRYPT_655331 = 655331; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + if (plain->extra1 == 0) + { + return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf); + } + else + { + return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, plain->extra1 - 15); + } +} + bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { const bool potfile_disable = true; @@ -86,18 +104,25 @@ bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 esalt_size = (const u64) sizeof (tc_t); + const u64 esalt_size = (const u64) sizeof (vc_t); return esalt_size; } u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + const u64 tmp_size = (const u64) sizeof (vc_tmp_t); return tmp_size; } +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_max = 1000; // lowest PIM multiplier + + return kernel_loops_max; +} + u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { // this overrides the reductions of PW_MAX in case optimized kernel is selected @@ -158,7 +183,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE // keyfiles - tc_t *tc = (tc_t *) hash->esalt; + vc_t *vc = (vc_t *) hash->esalt; if (user_options->veracrypt_keyfiles) { @@ -172,7 +197,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (keyfile)) { - cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); } keyfile = strtok_r ((char *) NULL, ",", &saveptr); @@ -187,7 +212,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (user_options->keyboard_layout_mapping)) { - initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, vc->keyboard_layout_mapping_buf, &vc->keyboard_layout_mapping_cnt); } } @@ -195,10 +220,12 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE salt_t *salt = hash->salt; - if (user_options->veracrypt_pim) + if ((user_options->veracrypt_pim_start) && (user_options->veracrypt_pim_stop)) { - salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + vc->pim_start = 15 + user_options->veracrypt_pim_start; + vc->pim_stop = 15 + user_options->veracrypt_pim_stop; + salt->salt_iter = vc->pim_stop * 1000; salt->salt_iter--; } @@ -220,25 +247,30 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { u32 *digest = (u32 *) digest_buf; - tc_t *tc = (tc_t *) esalt_buf; + vc_t *vc = (vc_t *) esalt_buf; const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + memcpy (vc->salt_buf, line_buf, 64); - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (vc->data_buf, line_buf + 64, 512 - 64); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_buf[0] = vc->salt_buf[0]; salt->salt_len = 4; - salt->salt_iter = ROUNDS_VERACRYPT_655331 - 1; + salt->salt_iter = ROUNDS_VERACRYPT_655331; + salt->salt_iter--; + + vc->pim_multi = 1000; + vc->pim_start = 0; + vc->pim_stop = 0; - tc->signature = 0x41524556; // "VERA" + vc->signature = 0x41524556; // "VERA" - digest[0] = tc->data_buf[0]; + digest[0] = vc->data_buf[0]; return (PARSER_OK); } @@ -253,7 +285,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; module_ctx->module_benchmark_mask = MODULE_DEFAULT; module_ctx->module_benchmark_salt = MODULE_DEFAULT; - module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; module_ctx->module_dgst_pos0 = module_dgst_pos0; module_ctx->module_dgst_pos1 = module_dgst_pos1; @@ -286,7 +318,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_jit_cache_disable = MODULE_DEFAULT; module_ctx->module_kernel_accel_max = MODULE_DEFAULT; module_ctx->module_kernel_accel_min = MODULE_DEFAULT; - module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = MODULE_DEFAULT; module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; diff --git a/src/modules/module_13721.c b/src/modules/module_13721.c index a4062ba5c..8e33d2434 100644 --- a/src/modules/module_13721.c +++ b/src/modules/module_13721.c @@ -21,9 +21,8 @@ static const u32 DGST_POS3 = 3; static const u32 DGST_SIZE = DGST_SIZE_8_8; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt SHA512 + XTS 512 bit"; -static const u64 KERN_TYPE = 6221; +static const u64 KERN_TYPE = 13721; static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP | OPTI_TYPE_USES_BITS_64; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_BINARY_HASHFILE; @@ -54,9 +53,12 @@ typedef struct tc64_tmp u64 dgst[32]; u64 out[32]; -} tc64_tmp_t; + u64 pim_key[32]; + int pim; // marker for cracked -typedef struct tc +} vc64_tmp_t; + +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -66,11 +68,27 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; static const int ROUNDS_VERACRYPT_500000 = 500000; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + if (plain->extra1 == 0) + { + return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf); + } + else + { + return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, plain->extra1 - 15); + } +} + bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { const bool potfile_disable = true; @@ -87,18 +105,25 @@ bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 esalt_size = (const u64) sizeof (tc_t); + const u64 esalt_size = (const u64) sizeof (vc_t); return esalt_size; } u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 tmp_size = (const u64) sizeof (tc64_tmp_t); + const u64 tmp_size = (const u64) sizeof (vc64_tmp_t); return tmp_size; } +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_max = 1000; // lowest PIM multiplier + + return kernel_loops_max; +} + u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { // this overrides the reductions of PW_MAX in case optimized kernel is selected @@ -147,8 +172,6 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); - // parse - hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; @@ -161,7 +184,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE // keyfiles - tc_t *tc = (tc_t *) hash->esalt; + vc_t *vc = (vc_t *) hash->esalt; if (user_options->veracrypt_keyfiles) { @@ -175,7 +198,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (keyfile)) { - cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); } keyfile = strtok_r ((char *) NULL, ",", &saveptr); @@ -190,7 +213,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (user_options->keyboard_layout_mapping)) { - initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, vc->keyboard_layout_mapping_buf, &vc->keyboard_layout_mapping_cnt); } } @@ -198,10 +221,12 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE salt_t *salt = hash->salt; - if (user_options->veracrypt_pim) + if ((user_options->veracrypt_pim_start) && (user_options->veracrypt_pim_stop)) { - salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + vc->pim_start = 15 + user_options->veracrypt_pim_start; + vc->pim_stop = 15 + user_options->veracrypt_pim_stop; + salt->salt_iter = vc->pim_stop * 1000; salt->salt_iter--; } @@ -212,25 +237,30 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { u32 *digest = (u32 *) digest_buf; - tc_t *tc = (tc_t *) esalt_buf; + vc_t *vc = (vc_t *) esalt_buf; const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + memcpy (vc->salt_buf, line_buf, 64); - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (vc->data_buf, line_buf + 64, 512 - 64); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_buf[0] = vc->salt_buf[0]; salt->salt_len = 4; - salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + salt->salt_iter = ROUNDS_VERACRYPT_500000; + salt->salt_iter--; + + vc->pim_multi = 1000; + vc->pim_start = 0; + vc->pim_stop = 0; - tc->signature = 0x41524556; // "VERA" + vc->signature = 0x41524556; // "VERA" - digest[0] = tc->data_buf[0]; + digest[0] = vc->data_buf[0]; return (PARSER_OK); } @@ -245,7 +275,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; module_ctx->module_benchmark_mask = MODULE_DEFAULT; module_ctx->module_benchmark_salt = MODULE_DEFAULT; - module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; module_ctx->module_dgst_pos0 = module_dgst_pos0; module_ctx->module_dgst_pos1 = module_dgst_pos1; @@ -278,7 +308,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_jit_cache_disable = MODULE_DEFAULT; module_ctx->module_kernel_accel_max = MODULE_DEFAULT; module_ctx->module_kernel_accel_min = MODULE_DEFAULT; - module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = MODULE_DEFAULT; module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; diff --git a/src/modules/module_13722.c b/src/modules/module_13722.c index c7d889951..d2eec1f0b 100644 --- a/src/modules/module_13722.c +++ b/src/modules/module_13722.c @@ -21,9 +21,8 @@ static const u32 DGST_POS3 = 3; static const u32 DGST_SIZE = DGST_SIZE_8_8; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt SHA512 + XTS 1024 bit"; -static const u64 KERN_TYPE = 6222; +static const u64 KERN_TYPE = 13722; static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP | OPTI_TYPE_USES_BITS_64; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_BINARY_HASHFILE; @@ -54,9 +53,12 @@ typedef struct tc64_tmp u64 dgst[32]; u64 out[32]; -} tc64_tmp_t; + u64 pim_key[32]; + int pim; // marker for cracked -typedef struct tc +} vc64_tmp_t; + +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -66,11 +68,27 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; static const int ROUNDS_VERACRYPT_500000 = 500000; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + if (plain->extra1 == 0) + { + return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf); + } + else + { + return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, plain->extra1 - 15); + } +} + bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { const bool potfile_disable = true; @@ -87,18 +105,25 @@ bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 esalt_size = (const u64) sizeof (tc_t); + const u64 esalt_size = (const u64) sizeof (vc_t); return esalt_size; } u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 tmp_size = (const u64) sizeof (tc64_tmp_t); + const u64 tmp_size = (const u64) sizeof (vc64_tmp_t); return tmp_size; } +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_max = 1000; // lowest PIM multiplier + + return kernel_loops_max; +} + u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { // this overrides the reductions of PW_MAX in case optimized kernel is selected @@ -159,7 +184,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE // keyfiles - tc_t *tc = (tc_t *) hash->esalt; + vc_t *vc = (vc_t *) hash->esalt; if (user_options->veracrypt_keyfiles) { @@ -173,7 +198,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (keyfile)) { - cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); } keyfile = strtok_r ((char *) NULL, ",", &saveptr); @@ -188,7 +213,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (user_options->keyboard_layout_mapping)) { - initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, vc->keyboard_layout_mapping_buf, &vc->keyboard_layout_mapping_cnt); } } @@ -196,10 +221,12 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE salt_t *salt = hash->salt; - if (user_options->veracrypt_pim) + if ((user_options->veracrypt_pim_start) && (user_options->veracrypt_pim_stop)) { - salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + vc->pim_start = 15 + user_options->veracrypt_pim_start; + vc->pim_stop = 15 + user_options->veracrypt_pim_stop; + salt->salt_iter = vc->pim_stop * 1000; salt->salt_iter--; } @@ -210,25 +237,30 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { u32 *digest = (u32 *) digest_buf; - tc_t *tc = (tc_t *) esalt_buf; + vc_t *vc = (vc_t *) esalt_buf; const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + memcpy (vc->salt_buf, line_buf, 64); - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (vc->data_buf, line_buf + 64, 512 - 64); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_buf[0] = vc->salt_buf[0]; salt->salt_len = 4; - salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + salt->salt_iter = ROUNDS_VERACRYPT_500000; + salt->salt_iter--; + + vc->pim_multi = 1000; + vc->pim_start = 0; + vc->pim_stop = 0; - tc->signature = 0x41524556; // "VERA" + vc->signature = 0x41524556; // "VERA" - digest[0] = tc->data_buf[0]; + digest[0] = vc->data_buf[0]; return (PARSER_OK); } @@ -243,7 +275,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; module_ctx->module_benchmark_mask = MODULE_DEFAULT; module_ctx->module_benchmark_salt = MODULE_DEFAULT; - module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; module_ctx->module_dgst_pos0 = module_dgst_pos0; module_ctx->module_dgst_pos1 = module_dgst_pos1; @@ -276,7 +308,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_jit_cache_disable = MODULE_DEFAULT; module_ctx->module_kernel_accel_max = MODULE_DEFAULT; module_ctx->module_kernel_accel_min = MODULE_DEFAULT; - module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = MODULE_DEFAULT; module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; diff --git a/src/modules/module_13723.c b/src/modules/module_13723.c index 225cb5e47..6cfc06648 100644 --- a/src/modules/module_13723.c +++ b/src/modules/module_13723.c @@ -21,9 +21,8 @@ static const u32 DGST_POS3 = 3; static const u32 DGST_SIZE = DGST_SIZE_8_8; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt SHA512 + XTS 1536 bit"; -static const u64 KERN_TYPE = 6223; +static const u64 KERN_TYPE = 13723; static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP | OPTI_TYPE_USES_BITS_64; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_BINARY_HASHFILE; @@ -54,9 +53,12 @@ typedef struct tc64_tmp u64 dgst[32]; u64 out[32]; -} tc64_tmp_t; + u64 pim_key[32]; + int pim; // marker for cracked -typedef struct tc +} vc64_tmp_t; + +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -66,11 +68,27 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; static const int ROUNDS_VERACRYPT_500000 = 500000; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + if (plain->extra1 == 0) + { + return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf); + } + else + { + return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, plain->extra1 - 15); + } +} + bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { const bool potfile_disable = true; @@ -87,18 +105,25 @@ bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 esalt_size = (const u64) sizeof (tc_t); + const u64 esalt_size = (const u64) sizeof (vc_t); return esalt_size; } u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 tmp_size = (const u64) sizeof (tc64_tmp_t); + const u64 tmp_size = (const u64) sizeof (vc64_tmp_t); return tmp_size; } +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_max = 1000; // lowest PIM multiplier + + return kernel_loops_max; +} + u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { // this overrides the reductions of PW_MAX in case optimized kernel is selected @@ -159,7 +184,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE // keyfiles - tc_t *tc = (tc_t *) hash->esalt; + vc_t *vc = (vc_t *) hash->esalt; if (user_options->veracrypt_keyfiles) { @@ -173,7 +198,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (keyfile)) { - cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); } keyfile = strtok_r ((char *) NULL, ",", &saveptr); @@ -188,7 +213,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (user_options->keyboard_layout_mapping)) { - initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, vc->keyboard_layout_mapping_buf, &vc->keyboard_layout_mapping_cnt); } } @@ -196,10 +221,12 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE salt_t *salt = hash->salt; - if (user_options->veracrypt_pim) + if ((user_options->veracrypt_pim_start) && (user_options->veracrypt_pim_stop)) { - salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + vc->pim_start = 15 + user_options->veracrypt_pim_start; + vc->pim_stop = 15 + user_options->veracrypt_pim_stop; + salt->salt_iter = vc->pim_stop * 1000; salt->salt_iter--; } @@ -221,25 +248,30 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { u32 *digest = (u32 *) digest_buf; - tc_t *tc = (tc_t *) esalt_buf; + vc_t *vc = (vc_t *) esalt_buf; const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + memcpy (vc->salt_buf, line_buf, 64); - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (vc->data_buf, line_buf + 64, 512 - 64); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_buf[0] = vc->salt_buf[0]; salt->salt_len = 4; - salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + salt->salt_iter = ROUNDS_VERACRYPT_500000; + salt->salt_iter--; + + vc->pim_multi = 1000; + vc->pim_start = 0; + vc->pim_stop = 0; - tc->signature = 0x41524556; // "VERA" + vc->signature = 0x41524556; // "VERA" - digest[0] = tc->data_buf[0]; + digest[0] = vc->data_buf[0]; return (PARSER_OK); } @@ -254,7 +286,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; module_ctx->module_benchmark_mask = MODULE_DEFAULT; module_ctx->module_benchmark_salt = MODULE_DEFAULT; - module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; module_ctx->module_dgst_pos0 = module_dgst_pos0; module_ctx->module_dgst_pos1 = module_dgst_pos1; @@ -287,7 +319,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_jit_cache_disable = MODULE_DEFAULT; module_ctx->module_kernel_accel_max = MODULE_DEFAULT; module_ctx->module_kernel_accel_min = MODULE_DEFAULT; - module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = MODULE_DEFAULT; module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; diff --git a/src/modules/module_13731.c b/src/modules/module_13731.c index 7f31db24e..d2c571887 100644 --- a/src/modules/module_13731.c +++ b/src/modules/module_13731.c @@ -21,9 +21,8 @@ static const u32 DGST_POS3 = 3; static const u32 DGST_SIZE = DGST_SIZE_4_8; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt Whirlpool + XTS 512 bit"; -static const u64 KERN_TYPE = 6231; -static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 KERN_TYPE = 13731; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_BINARY_HASHFILE; static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; @@ -45,7 +44,7 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } -typedef struct tc_tmp +typedef struct vc_tmp { u32 ipad[16]; u32 opad[16]; @@ -53,9 +52,12 @@ typedef struct tc_tmp u32 dgst[64]; u32 out[64]; -} tc_tmp_t; + u32 pim_key[64]; + int pim; // marker for cracked -typedef struct tc +} vc_tmp_t; + +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -65,11 +67,27 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; static const int ROUNDS_VERACRYPT_500000 = 500000; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + if (plain->extra1 == 0) + { + return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf); + } + else + { + return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, plain->extra1 - 15); + } +} + bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { const bool potfile_disable = true; @@ -86,18 +104,25 @@ bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 esalt_size = (const u64) sizeof (tc_t); + const u64 esalt_size = (const u64) sizeof (vc_t); return esalt_size; } u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + const u64 tmp_size = (const u64) sizeof (vc_tmp_t); return tmp_size; } +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_max = 1000; // lowest PIM multiplier + + return kernel_loops_max; +} + u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { // this overrides the reductions of PW_MAX in case optimized kernel is selected @@ -158,7 +183,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE // keyfiles - tc_t *tc = (tc_t *) hash->esalt; + vc_t *vc = (vc_t *) hash->esalt; if (user_options->veracrypt_keyfiles) { @@ -172,7 +197,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (keyfile)) { - cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); } keyfile = strtok_r ((char *) NULL, ",", &saveptr); @@ -187,7 +212,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (user_options->keyboard_layout_mapping)) { - initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, vc->keyboard_layout_mapping_buf, &vc->keyboard_layout_mapping_cnt); } } @@ -195,51 +220,46 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE salt_t *salt = hash->salt; - if (user_options->veracrypt_pim) + if ((user_options->veracrypt_pim_start) && (user_options->veracrypt_pim_stop)) { - salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + vc->pim_start = 15 + user_options->veracrypt_pim_start; + vc->pim_stop = 15 + user_options->veracrypt_pim_stop; + salt->salt_iter = vc->pim_stop * 1000; salt->salt_iter--; } return 1; } -bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hc_device_param_t *device_param) -{ - // l_opencl_p_18.1.0.013: self-test failed - // note that opencl_runtime_16.1.2_x64_rh_6.4.0.37 works fine - if (device_param->device_vendor_id == VENDOR_ID_INTEL_SDK) - { - return true; - } - - return false; -} - int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) { u32 *digest = (u32 *) digest_buf; - tc_t *tc = (tc_t *) esalt_buf; + vc_t *vc = (vc_t *) esalt_buf; const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + memcpy (vc->salt_buf, line_buf, 64); - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (vc->data_buf, line_buf + 64, 512 - 64); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_buf[0] = vc->salt_buf[0]; salt->salt_len = 4; - salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + salt->salt_iter = ROUNDS_VERACRYPT_500000; + salt->salt_iter--; + + vc->pim_multi = 1000; + vc->pim_start = 0; + vc->pim_stop = 0; - tc->signature = 0x41524556; // "VERA" + vc->signature = 0x41524556; // "VERA" - digest[0] = tc->data_buf[0]; + digest[0] = vc->data_buf[0]; return (PARSER_OK); } @@ -254,7 +274,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; module_ctx->module_benchmark_mask = MODULE_DEFAULT; module_ctx->module_benchmark_salt = MODULE_DEFAULT; - module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; module_ctx->module_dgst_pos0 = module_dgst_pos0; module_ctx->module_dgst_pos1 = module_dgst_pos1; @@ -287,7 +307,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_jit_cache_disable = MODULE_DEFAULT; module_ctx->module_kernel_accel_max = MODULE_DEFAULT; module_ctx->module_kernel_accel_min = MODULE_DEFAULT; - module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = MODULE_DEFAULT; module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; @@ -309,6 +329,6 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_st_hash = module_st_hash; module_ctx->module_st_pass = module_st_pass; module_ctx->module_tmp_size = module_tmp_size; - module_ctx->module_unstable_warning = module_unstable_warning; + module_ctx->module_unstable_warning = MODULE_DEFAULT; module_ctx->module_warmup_disable = MODULE_DEFAULT; } diff --git a/src/modules/module_13732.c b/src/modules/module_13732.c index 1f296f9b8..85c95d00c 100644 --- a/src/modules/module_13732.c +++ b/src/modules/module_13732.c @@ -21,9 +21,8 @@ static const u32 DGST_POS3 = 3; static const u32 DGST_SIZE = DGST_SIZE_4_8; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt Whirlpool + XTS 1024 bit"; -static const u64 KERN_TYPE = 6232; -static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 KERN_TYPE = 13732; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_BINARY_HASHFILE; static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; @@ -45,7 +44,7 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } -typedef struct tc_tmp +typedef struct vc_tmp { u32 ipad[16]; u32 opad[16]; @@ -53,9 +52,12 @@ typedef struct tc_tmp u32 dgst[64]; u32 out[64]; -} tc_tmp_t; + u32 pim_key[64]; + int pim; // marker for cracked -typedef struct tc +} vc_tmp_t; + +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -65,11 +67,27 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; static const int ROUNDS_VERACRYPT_500000 = 500000; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + if (plain->extra1 == 0) + { + return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf); + } + else + { + return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, plain->extra1 - 15); + } +} + bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { const bool potfile_disable = true; @@ -86,18 +104,25 @@ bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 esalt_size = (const u64) sizeof (tc_t); + const u64 esalt_size = (const u64) sizeof (vc_t); return esalt_size; } u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + const u64 tmp_size = (const u64) sizeof (vc_tmp_t); return tmp_size; } +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_max = 1000; // lowest PIM multiplier + + return kernel_loops_max; +} + u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { // this overrides the reductions of PW_MAX in case optimized kernel is selected @@ -158,7 +183,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE // keyfiles - tc_t *tc = (tc_t *) hash->esalt; + vc_t *vc = (vc_t *) hash->esalt; if (user_options->veracrypt_keyfiles) { @@ -172,7 +197,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (keyfile)) { - cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); } keyfile = strtok_r ((char *) NULL, ",", &saveptr); @@ -187,7 +212,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (user_options->keyboard_layout_mapping)) { - initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, vc->keyboard_layout_mapping_buf, &vc->keyboard_layout_mapping_cnt); } } @@ -195,51 +220,46 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE salt_t *salt = hash->salt; - if (user_options->veracrypt_pim) + if ((user_options->veracrypt_pim_start) && (user_options->veracrypt_pim_stop)) { - salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + vc->pim_start = 15 + user_options->veracrypt_pim_start; + vc->pim_stop = 15 + user_options->veracrypt_pim_stop; + salt->salt_iter = vc->pim_stop * 1000; salt->salt_iter--; } return 1; } -bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hc_device_param_t *device_param) -{ - // l_opencl_p_18.1.0.013: self-test failed - // note that opencl_runtime_16.1.2_x64_rh_6.4.0.37 works fine - if (device_param->device_vendor_id == VENDOR_ID_INTEL_SDK) - { - return true; - } - - return false; -} - int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) { u32 *digest = (u32 *) digest_buf; - tc_t *tc = (tc_t *) esalt_buf; + vc_t *vc = (vc_t *) esalt_buf; const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + memcpy (vc->salt_buf, line_buf, 64); - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (vc->data_buf, line_buf + 64, 512 - 64); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_buf[0] = vc->salt_buf[0]; salt->salt_len = 4; - salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + salt->salt_iter = ROUNDS_VERACRYPT_500000; + salt->salt_iter--; + + vc->pim_multi = 1000; + vc->pim_start = 0; + vc->pim_stop = 0; - tc->signature = 0x41524556; // "VERA" + vc->signature = 0x41524556; // "VERA" - digest[0] = tc->data_buf[0]; + digest[0] = vc->data_buf[0]; return (PARSER_OK); } @@ -254,7 +274,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; module_ctx->module_benchmark_mask = MODULE_DEFAULT; module_ctx->module_benchmark_salt = MODULE_DEFAULT; - module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; module_ctx->module_dgst_pos0 = module_dgst_pos0; module_ctx->module_dgst_pos1 = module_dgst_pos1; @@ -287,7 +307,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_jit_cache_disable = MODULE_DEFAULT; module_ctx->module_kernel_accel_max = MODULE_DEFAULT; module_ctx->module_kernel_accel_min = MODULE_DEFAULT; - module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = MODULE_DEFAULT; module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; @@ -309,6 +329,6 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_st_hash = module_st_hash; module_ctx->module_st_pass = module_st_pass; module_ctx->module_tmp_size = module_tmp_size; - module_ctx->module_unstable_warning = module_unstable_warning; + module_ctx->module_unstable_warning = MODULE_DEFAULT; module_ctx->module_warmup_disable = MODULE_DEFAULT; } diff --git a/src/modules/module_13733.c b/src/modules/module_13733.c index 0f815e384..76445df5e 100644 --- a/src/modules/module_13733.c +++ b/src/modules/module_13733.c @@ -21,9 +21,8 @@ static const u32 DGST_POS3 = 3; static const u32 DGST_SIZE = DGST_SIZE_4_8; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt Whirlpool + XTS 1536 bit"; -static const u64 KERN_TYPE = 6233; -static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 KERN_TYPE = 13733; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_BINARY_HASHFILE; static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; @@ -45,7 +44,7 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } -typedef struct tc_tmp +typedef struct vc_tmp { u32 ipad[16]; u32 opad[16]; @@ -53,9 +52,12 @@ typedef struct tc_tmp u32 dgst[64]; u32 out[64]; -} tc_tmp_t; + u32 pim_key[64]; + int pim; // marker for cracked -typedef struct tc +} vc_tmp_t; + +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -65,11 +67,27 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; static const int ROUNDS_VERACRYPT_500000 = 500000; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + if (plain->extra1 == 0) + { + return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf); + } + else + { + return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, plain->extra1 - 15); + } +} + bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { const bool potfile_disable = true; @@ -86,18 +104,25 @@ bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 esalt_size = (const u64) sizeof (tc_t); + const u64 esalt_size = (const u64) sizeof (vc_t); return esalt_size; } u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + const u64 tmp_size = (const u64) sizeof (vc_tmp_t); return tmp_size; } +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_max = 1000; // lowest PIM multiplier + + return kernel_loops_max; +} + u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { // this overrides the reductions of PW_MAX in case optimized kernel is selected @@ -158,7 +183,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE // keyfiles - tc_t *tc = (tc_t *) hash->esalt; + vc_t *vc = (vc_t *) hash->esalt; if (user_options->veracrypt_keyfiles) { @@ -172,7 +197,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (keyfile)) { - cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); } keyfile = strtok_r ((char *) NULL, ",", &saveptr); @@ -187,7 +212,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (user_options->keyboard_layout_mapping)) { - initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, vc->keyboard_layout_mapping_buf, &vc->keyboard_layout_mapping_cnt); } } @@ -195,10 +220,12 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE salt_t *salt = hash->salt; - if (user_options->veracrypt_pim) + if ((user_options->veracrypt_pim_start) && (user_options->veracrypt_pim_stop)) { - salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + vc->pim_start = 15 + user_options->veracrypt_pim_start; + vc->pim_stop = 15 + user_options->veracrypt_pim_stop; + salt->salt_iter = vc->pim_stop * 1000; salt->salt_iter--; } @@ -207,13 +234,6 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hc_device_param_t *device_param) { - // l_opencl_p_18.1.0.013: self-test failed - // note that opencl_runtime_16.1.2_x64_rh_6.4.0.37 works fine - if (device_param->device_vendor_id == VENDOR_ID_INTEL_SDK) - { - return true; - } - // amdgpu-pro-18.50-708488-ubuntu-18.04: Segmentation fault if ((device_param->device_vendor_id == VENDOR_ID_AMD) && (device_param->has_vperm == false)) { @@ -227,25 +247,30 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { u32 *digest = (u32 *) digest_buf; - tc_t *tc = (tc_t *) esalt_buf; + vc_t *vc = (vc_t *) esalt_buf; const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + memcpy (vc->salt_buf, line_buf, 64); - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (vc->data_buf, line_buf + 64, 512 - 64); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_buf[0] = vc->salt_buf[0]; salt->salt_len = 4; - salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + salt->salt_iter = ROUNDS_VERACRYPT_500000; + salt->salt_iter--; + + vc->pim_multi = 1000; + vc->pim_start = 0; + vc->pim_stop = 0; - tc->signature = 0x41524556; // "VERA" + vc->signature = 0x41524556; // "VERA" - digest[0] = tc->data_buf[0]; + digest[0] = vc->data_buf[0]; return (PARSER_OK); } @@ -260,7 +285,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; module_ctx->module_benchmark_mask = MODULE_DEFAULT; module_ctx->module_benchmark_salt = MODULE_DEFAULT; - module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; module_ctx->module_dgst_pos0 = module_dgst_pos0; module_ctx->module_dgst_pos1 = module_dgst_pos1; @@ -293,7 +318,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_jit_cache_disable = MODULE_DEFAULT; module_ctx->module_kernel_accel_max = MODULE_DEFAULT; module_ctx->module_kernel_accel_min = MODULE_DEFAULT; - module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = MODULE_DEFAULT; module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; diff --git a/src/modules/module_13741.c b/src/modules/module_13741.c index 053e3ec2f..666ce4c32 100644 --- a/src/modules/module_13741.c +++ b/src/modules/module_13741.c @@ -21,9 +21,8 @@ static const u32 DGST_POS3 = 3; static const u32 DGST_SIZE = DGST_SIZE_4_5; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt RIPEMD160 + XTS 512 bit + boot-mode"; -static const u64 KERN_TYPE = 6211; -static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 KERN_TYPE = 13711; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_BINARY_HASHFILE | OPTS_TYPE_KEYBOARD_MAPPING; @@ -46,7 +45,7 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } -typedef struct tc_tmp +typedef struct vc_tmp { u32 ipad[16]; u32 opad[16]; @@ -54,9 +53,12 @@ typedef struct tc_tmp u32 dgst[64]; u32 out[64]; -} tc_tmp_t; + u32 pim_key[64]; + int pim; // marker for cracked -typedef struct tc +} vc_tmp_t; + +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -66,21 +68,33 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; static const int ROUNDS_VERACRYPT_327661 = 327661; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; -int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) { - const tc_t *tc = (const tc_t *) hashes->esalts_buf; + const vc_t *vc = (const vc_t *) hashes->esalts_buf; + + u32 tmp_buf[64] = { 0 }; + + memcpy (tmp_buf, src_buf, src_len); + + execute_keyboard_layout_mapping (tmp_buf, src_len, vc->keyboard_layout_mapping_buf, vc->keyboard_layout_mapping_cnt); - if (src_len < (int) dst_sz) + if (plain->extra1 == 0) { - memcpy (dst_buf, src_buf, src_len); + return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) tmp_buf); + } + else + { + return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) tmp_buf, plain->extra1); } - - return execute_keyboard_layout_mapping (dst_buf, src_len, tc->keyboard_layout_mapping_buf, tc->keyboard_layout_mapping_cnt); } bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) @@ -99,14 +113,14 @@ bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 esalt_size = (const u64) sizeof (tc_t); + const u64 esalt_size = (const u64) sizeof (vc_t); return esalt_size; } u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + const u64 tmp_size = (const u64) sizeof (vc_tmp_t); return tmp_size; } @@ -171,7 +185,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE // keyfiles - tc_t *tc = (tc_t *) hash->esalt; + vc_t *vc = (vc_t *) hash->esalt; if (user_options->veracrypt_keyfiles) { @@ -185,7 +199,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (keyfile)) { - cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); } keyfile = strtok_r ((char *) NULL, ",", &saveptr); @@ -200,7 +214,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (user_options->keyboard_layout_mapping)) { - initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, vc->keyboard_layout_mapping_buf, &vc->keyboard_layout_mapping_cnt); } } @@ -208,10 +222,12 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE salt_t *salt = hash->salt; - if (user_options->veracrypt_pim) + if ((user_options->veracrypt_pim_start) && (user_options->veracrypt_pim_stop)) { - salt->salt_iter = user_options->veracrypt_pim * 2048; + vc->pim_start = user_options->veracrypt_pim_start; + vc->pim_stop = user_options->veracrypt_pim_stop; + salt->salt_iter = vc->pim_stop * 2048; salt->salt_iter--; } @@ -222,25 +238,30 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { u32 *digest = (u32 *) digest_buf; - tc_t *tc = (tc_t *) esalt_buf; + vc_t *vc = (vc_t *) esalt_buf; const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + memcpy (vc->salt_buf, line_buf, 64); - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (vc->data_buf, line_buf + 64, 512 - 64); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_buf[0] = vc->salt_buf[0]; salt->salt_len = 4; - salt->salt_iter = ROUNDS_VERACRYPT_327661 - 1; + salt->salt_iter = ROUNDS_VERACRYPT_327661; + salt->salt_iter--; + + vc->pim_multi = 2048; + vc->pim_start = 0; + vc->pim_stop = 0; - tc->signature = 0x41524556; // "VERA" + vc->signature = 0x41524556; // "VERA" - digest[0] = tc->data_buf[0]; + digest[0] = vc->data_buf[0]; return (PARSER_OK); } diff --git a/src/modules/module_13742.c b/src/modules/module_13742.c index 6f8e679e3..2d0b5d598 100644 --- a/src/modules/module_13742.c +++ b/src/modules/module_13742.c @@ -21,9 +21,8 @@ static const u32 DGST_POS3 = 3; static const u32 DGST_SIZE = DGST_SIZE_4_5; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt RIPEMD160 + XTS 1024 bit + boot-mode"; -static const u64 KERN_TYPE = 6212; -static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 KERN_TYPE = 13712; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_BINARY_HASHFILE | OPTS_TYPE_KEYBOARD_MAPPING; @@ -46,7 +45,7 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } -typedef struct tc_tmp +typedef struct vc_tmp { u32 ipad[16]; u32 opad[16]; @@ -54,9 +53,12 @@ typedef struct tc_tmp u32 dgst[64]; u32 out[64]; -} tc_tmp_t; + u32 pim_key[64]; + int pim; // marker for cracked -typedef struct tc +} vc_tmp_t; + +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -66,21 +68,33 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; static const int ROUNDS_VERACRYPT_327661 = 327661; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; -int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) { - const tc_t *tc = (const tc_t *) hashes->esalts_buf; + const vc_t *vc = (const vc_t *) hashes->esalts_buf; + + u32 tmp_buf[64] = { 0 }; + + memcpy (tmp_buf, src_buf, src_len); + + execute_keyboard_layout_mapping (tmp_buf, src_len, vc->keyboard_layout_mapping_buf, vc->keyboard_layout_mapping_cnt); - if (src_len < (int) dst_sz) + if (plain->extra1 == 0) { - memcpy (dst_buf, src_buf, src_len); + return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) tmp_buf); + } + else + { + return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) tmp_buf, plain->extra1); } - - return execute_keyboard_layout_mapping (dst_buf, src_len, tc->keyboard_layout_mapping_buf, tc->keyboard_layout_mapping_cnt); } bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) @@ -99,14 +113,14 @@ bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 esalt_size = (const u64) sizeof (tc_t); + const u64 esalt_size = (const u64) sizeof (vc_t); return esalt_size; } u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + const u64 tmp_size = (const u64) sizeof (vc_tmp_t); return tmp_size; } @@ -171,7 +185,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE // keyfiles - tc_t *tc = (tc_t *) hash->esalt; + vc_t *vc = (vc_t *) hash->esalt; if (user_options->veracrypt_keyfiles) { @@ -185,7 +199,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (keyfile)) { - cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); } keyfile = strtok_r ((char *) NULL, ",", &saveptr); @@ -200,7 +214,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (user_options->keyboard_layout_mapping)) { - initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, vc->keyboard_layout_mapping_buf, &vc->keyboard_layout_mapping_cnt); } } @@ -208,10 +222,12 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE salt_t *salt = hash->salt; - if (user_options->veracrypt_pim) + if ((user_options->veracrypt_pim_start) && (user_options->veracrypt_pim_stop)) { - salt->salt_iter = user_options->veracrypt_pim * 2048; + vc->pim_start = user_options->veracrypt_pim_start; + vc->pim_stop = user_options->veracrypt_pim_stop; + salt->salt_iter = vc->pim_stop * 2048; salt->salt_iter--; } @@ -222,25 +238,30 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { u32 *digest = (u32 *) digest_buf; - tc_t *tc = (tc_t *) esalt_buf; + vc_t *vc = (vc_t *) esalt_buf; const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + memcpy (vc->salt_buf, line_buf, 64); - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (vc->data_buf, line_buf + 64, 512 - 64); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_buf[0] = vc->salt_buf[0]; salt->salt_len = 4; - salt->salt_iter = ROUNDS_VERACRYPT_327661 - 1; + salt->salt_iter = ROUNDS_VERACRYPT_327661; + salt->salt_iter--; + + vc->pim_multi = 2048; + vc->pim_start = 0; + vc->pim_stop = 0; - tc->signature = 0x41524556; // "VERA" + vc->signature = 0x41524556; // "VERA" - digest[0] = tc->data_buf[0]; + digest[0] = vc->data_buf[0]; return (PARSER_OK); } diff --git a/src/modules/module_13743.c b/src/modules/module_13743.c index cc8a6945a..53495ff4f 100644 --- a/src/modules/module_13743.c +++ b/src/modules/module_13743.c @@ -21,9 +21,8 @@ static const u32 DGST_POS3 = 3; static const u32 DGST_SIZE = DGST_SIZE_4_5; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt RIPEMD160 + XTS 1536 bit + boot-mode"; -static const u64 KERN_TYPE = 6213; -static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u64 KERN_TYPE = 13713; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_BINARY_HASHFILE | OPTS_TYPE_KEYBOARD_MAPPING; @@ -46,7 +45,7 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } -typedef struct tc_tmp +typedef struct vc_tmp { u32 ipad[16]; u32 opad[16]; @@ -54,9 +53,12 @@ typedef struct tc_tmp u32 dgst[64]; u32 out[64]; -} tc_tmp_t; + u32 pim_key[64]; + int pim; // marker for cracked -typedef struct tc +} vc_tmp_t; + +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -66,21 +68,33 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; static const int ROUNDS_VERACRYPT_327661 = 327661; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; -int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) { - const tc_t *tc = (const tc_t *) hashes->esalts_buf; + const vc_t *vc = (const vc_t *) hashes->esalts_buf; + + u32 tmp_buf[64] = { 0 }; + + memcpy (tmp_buf, src_buf, src_len); + + execute_keyboard_layout_mapping (tmp_buf, src_len, vc->keyboard_layout_mapping_buf, vc->keyboard_layout_mapping_cnt); - if (src_len < (int) dst_sz) + if (plain->extra1 == 0) { - memcpy (dst_buf, src_buf, src_len); + return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) tmp_buf); + } + else + { + return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) tmp_buf, plain->extra1); } - - return execute_keyboard_layout_mapping (dst_buf, src_len, tc->keyboard_layout_mapping_buf, tc->keyboard_layout_mapping_cnt); } bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) @@ -99,14 +113,14 @@ bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 esalt_size = (const u64) sizeof (tc_t); + const u64 esalt_size = (const u64) sizeof (vc_t); return esalt_size; } u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + const u64 tmp_size = (const u64) sizeof (vc_tmp_t); return tmp_size; } @@ -171,7 +185,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE // keyfiles - tc_t *tc = (tc_t *) hash->esalt; + vc_t *vc = (vc_t *) hash->esalt; if (user_options->veracrypt_keyfiles) { @@ -185,7 +199,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (keyfile)) { - cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); } keyfile = strtok_r ((char *) NULL, ",", &saveptr); @@ -200,7 +214,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (user_options->keyboard_layout_mapping)) { - initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, vc->keyboard_layout_mapping_buf, &vc->keyboard_layout_mapping_cnt); } } @@ -208,10 +222,12 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE salt_t *salt = hash->salt; - if (user_options->veracrypt_pim) + if ((user_options->veracrypt_pim_start) && (user_options->veracrypt_pim_stop)) { - salt->salt_iter = user_options->veracrypt_pim * 2048; + vc->pim_start = user_options->veracrypt_pim_start; + vc->pim_stop = user_options->veracrypt_pim_stop; + salt->salt_iter = vc->pim_stop * 2048; salt->salt_iter--; } @@ -233,25 +249,30 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { u32 *digest = (u32 *) digest_buf; - tc_t *tc = (tc_t *) esalt_buf; + vc_t *vc = (vc_t *) esalt_buf; const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + memcpy (vc->salt_buf, line_buf, 64); - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (vc->data_buf, line_buf + 64, 512 - 64); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_buf[0] = vc->salt_buf[0]; salt->salt_len = 4; - salt->salt_iter = ROUNDS_VERACRYPT_327661 - 1; + salt->salt_iter = ROUNDS_VERACRYPT_327661; + salt->salt_iter--; + + vc->pim_multi = 2048; + vc->pim_start = 0; + vc->pim_stop = 0; - tc->signature = 0x41524556; // "VERA" + vc->signature = 0x41524556; // "VERA" - digest[0] = tc->data_buf[0]; + digest[0] = vc->data_buf[0]; return (PARSER_OK); } diff --git a/src/modules/module_13751.c b/src/modules/module_13751.c index 01e0e86c2..5a2b89b8a 100644 --- a/src/modules/module_13751.c +++ b/src/modules/module_13751.c @@ -22,8 +22,7 @@ static const u32 DGST_SIZE = DGST_SIZE_4_8; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt SHA256 + XTS 512 bit"; static const u64 KERN_TYPE = 13751; -static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_BINARY_HASHFILE; static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; @@ -45,7 +44,7 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } -typedef struct tc_tmp +typedef struct vc_tmp { u32 ipad[16]; u32 opad[16]; @@ -53,9 +52,12 @@ typedef struct tc_tmp u32 dgst[64]; u32 out[64]; -} tc_tmp_t; + u32 pim_key[64]; + int pim; // marker for cracked -typedef struct tc +} vc_tmp_t; + +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -65,11 +67,27 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; static const int ROUNDS_VERACRYPT_500000 = 500000; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + if (plain->extra1 == 0) + { + return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf); + } + else + { + return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, plain->extra1 - 15); + } +} + bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { const bool potfile_disable = true; @@ -86,18 +104,25 @@ bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 esalt_size = (const u64) sizeof (tc_t); + const u64 esalt_size = (const u64) sizeof (vc_t); return esalt_size; } u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + const u64 tmp_size = (const u64) sizeof (vc_tmp_t); return tmp_size; } +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_max = 1000; // lowest PIM multiplier + + return kernel_loops_max; +} + u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { // this overrides the reductions of PW_MAX in case optimized kernel is selected @@ -158,7 +183,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE // keyfiles - tc_t *tc = (tc_t *) hash->esalt; + vc_t *vc = (vc_t *) hash->esalt; if (user_options->veracrypt_keyfiles) { @@ -172,7 +197,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (keyfile)) { - cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); } keyfile = strtok_r ((char *) NULL, ",", &saveptr); @@ -187,7 +212,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (user_options->keyboard_layout_mapping)) { - initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, vc->keyboard_layout_mapping_buf, &vc->keyboard_layout_mapping_cnt); } } @@ -195,10 +220,12 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE salt_t *salt = hash->salt; - if (user_options->veracrypt_pim) + if ((user_options->veracrypt_pim_start) && (user_options->veracrypt_pim_stop)) { - salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + vc->pim_start = 15 + user_options->veracrypt_pim_start; + vc->pim_stop = 15 + user_options->veracrypt_pim_stop; + salt->salt_iter = vc->pim_stop * 1000; salt->salt_iter--; } @@ -209,25 +236,30 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { u32 *digest = (u32 *) digest_buf; - tc_t *tc = (tc_t *) esalt_buf; + vc_t *vc = (vc_t *) esalt_buf; const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + memcpy (vc->salt_buf, line_buf, 64); - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (vc->data_buf, line_buf + 64, 512 - 64); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_buf[0] = vc->salt_buf[0]; salt->salt_len = 4; - salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + salt->salt_iter = ROUNDS_VERACRYPT_500000; + salt->salt_iter--; + + vc->pim_multi = 1000; + vc->pim_start = 0; + vc->pim_stop = 0; - tc->signature = 0x41524556; // "VERA" + vc->signature = 0x41524556; // "VERA" - digest[0] = tc->data_buf[0]; + digest[0] = vc->data_buf[0]; return (PARSER_OK); } @@ -242,7 +274,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; module_ctx->module_benchmark_mask = MODULE_DEFAULT; module_ctx->module_benchmark_salt = MODULE_DEFAULT; - module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; module_ctx->module_dgst_pos0 = module_dgst_pos0; module_ctx->module_dgst_pos1 = module_dgst_pos1; @@ -275,7 +307,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_jit_cache_disable = MODULE_DEFAULT; module_ctx->module_kernel_accel_max = MODULE_DEFAULT; module_ctx->module_kernel_accel_min = MODULE_DEFAULT; - module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = MODULE_DEFAULT; module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; diff --git a/src/modules/module_13752.c b/src/modules/module_13752.c index be9bb1260..41a856f2d 100644 --- a/src/modules/module_13752.c +++ b/src/modules/module_13752.c @@ -22,8 +22,7 @@ static const u32 DGST_SIZE = DGST_SIZE_4_8; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt SHA256 + XTS 1024 bit"; static const u64 KERN_TYPE = 13752; -static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_BINARY_HASHFILE; static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; @@ -45,7 +44,7 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } -typedef struct tc_tmp +typedef struct vc_tmp { u32 ipad[16]; u32 opad[16]; @@ -53,9 +52,12 @@ typedef struct tc_tmp u32 dgst[64]; u32 out[64]; -} tc_tmp_t; + u32 pim_key[64]; + int pim; // marker for cracked -typedef struct tc +} vc_tmp_t; + +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -65,11 +67,27 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; static const int ROUNDS_VERACRYPT_500000 = 500000; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + if (plain->extra1 == 0) + { + return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf); + } + else + { + return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, plain->extra1 - 15); + } +} + bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { const bool potfile_disable = true; @@ -86,18 +104,25 @@ bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 esalt_size = (const u64) sizeof (tc_t); + const u64 esalt_size = (const u64) sizeof (vc_t); return esalt_size; } u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + const u64 tmp_size = (const u64) sizeof (vc_tmp_t); return tmp_size; } +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_max = 1000; // lowest PIM multiplier + + return kernel_loops_max; +} + u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { // this overrides the reductions of PW_MAX in case optimized kernel is selected @@ -158,7 +183,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE // keyfiles - tc_t *tc = (tc_t *) hash->esalt; + vc_t *vc = (vc_t *) hash->esalt; if (user_options->veracrypt_keyfiles) { @@ -172,7 +197,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (keyfile)) { - cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); } keyfile = strtok_r ((char *) NULL, ",", &saveptr); @@ -187,7 +212,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (user_options->keyboard_layout_mapping)) { - initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, vc->keyboard_layout_mapping_buf, &vc->keyboard_layout_mapping_cnt); } } @@ -195,10 +220,12 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE salt_t *salt = hash->salt; - if (user_options->veracrypt_pim) + if ((user_options->veracrypt_pim_start) && (user_options->veracrypt_pim_stop)) { - salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + vc->pim_start = 15 + user_options->veracrypt_pim_start; + vc->pim_stop = 15 + user_options->veracrypt_pim_stop; + salt->salt_iter = vc->pim_stop * 1000; salt->salt_iter--; } @@ -209,25 +236,30 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { u32 *digest = (u32 *) digest_buf; - tc_t *tc = (tc_t *) esalt_buf; + vc_t *vc = (vc_t *) esalt_buf; const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + memcpy (vc->salt_buf, line_buf, 64); - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (vc->data_buf, line_buf + 64, 512 - 64); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_buf[0] = vc->salt_buf[0]; salt->salt_len = 4; - salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + salt->salt_iter = ROUNDS_VERACRYPT_500000; + salt->salt_iter--; + + vc->pim_multi = 1000; + vc->pim_start = 0; + vc->pim_stop = 0; - tc->signature = 0x41524556; // "VERA" + vc->signature = 0x41524556; // "VERA" - digest[0] = tc->data_buf[0]; + digest[0] = vc->data_buf[0]; return (PARSER_OK); } @@ -242,7 +274,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; module_ctx->module_benchmark_mask = MODULE_DEFAULT; module_ctx->module_benchmark_salt = MODULE_DEFAULT; - module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; module_ctx->module_dgst_pos0 = module_dgst_pos0; module_ctx->module_dgst_pos1 = module_dgst_pos1; @@ -275,7 +307,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_jit_cache_disable = MODULE_DEFAULT; module_ctx->module_kernel_accel_max = MODULE_DEFAULT; module_ctx->module_kernel_accel_min = MODULE_DEFAULT; - module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = MODULE_DEFAULT; module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; diff --git a/src/modules/module_13753.c b/src/modules/module_13753.c index c855e861e..29bf4b84c 100644 --- a/src/modules/module_13753.c +++ b/src/modules/module_13753.c @@ -22,8 +22,7 @@ static const u32 DGST_SIZE = DGST_SIZE_4_8; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt SHA256 + XTS 1536 bit"; static const u64 KERN_TYPE = 13753; -static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_BINARY_HASHFILE; static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; @@ -45,7 +44,7 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } -typedef struct tc_tmp +typedef struct vc_tmp { u32 ipad[16]; u32 opad[16]; @@ -53,9 +52,12 @@ typedef struct tc_tmp u32 dgst[64]; u32 out[64]; -} tc_tmp_t; + u32 pim_key[64]; + int pim; // marker for cracked -typedef struct tc +} vc_tmp_t; + +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -65,11 +67,27 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; static const int ROUNDS_VERACRYPT_500000 = 500000; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + if (plain->extra1 == 0) + { + return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf); + } + else + { + return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, plain->extra1 - 15); + } +} + bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { const bool potfile_disable = true; @@ -86,18 +104,25 @@ bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 esalt_size = (const u64) sizeof (tc_t); + const u64 esalt_size = (const u64) sizeof (vc_t); return esalt_size; } u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + const u64 tmp_size = (const u64) sizeof (vc_tmp_t); return tmp_size; } +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_max = 1000; // lowest PIM multiplier + + return kernel_loops_max; +} + u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { // this overrides the reductions of PW_MAX in case optimized kernel is selected @@ -158,7 +183,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE // keyfiles - tc_t *tc = (tc_t *) hash->esalt; + vc_t *vc = (vc_t *) hash->esalt; if (user_options->veracrypt_keyfiles) { @@ -172,7 +197,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (keyfile)) { - cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); } keyfile = strtok_r ((char *) NULL, ",", &saveptr); @@ -187,7 +212,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (user_options->keyboard_layout_mapping)) { - initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, vc->keyboard_layout_mapping_buf, &vc->keyboard_layout_mapping_cnt); } } @@ -195,10 +220,12 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE salt_t *salt = hash->salt; - if (user_options->veracrypt_pim) + if ((user_options->veracrypt_pim_start) && (user_options->veracrypt_pim_stop)) { - salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + vc->pim_start = 15 + user_options->veracrypt_pim_start; + vc->pim_stop = 15 + user_options->veracrypt_pim_stop; + salt->salt_iter = vc->pim_stop * 1000; salt->salt_iter--; } @@ -220,25 +247,30 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { u32 *digest = (u32 *) digest_buf; - tc_t *tc = (tc_t *) esalt_buf; + vc_t *vc = (vc_t *) esalt_buf; const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + memcpy (vc->salt_buf, line_buf, 64); - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (vc->data_buf, line_buf + 64, 512 - 64); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_buf[0] = vc->salt_buf[0]; salt->salt_len = 4; - salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + salt->salt_iter = ROUNDS_VERACRYPT_500000; + salt->salt_iter--; + + vc->pim_multi = 1000; + vc->pim_start = 0; + vc->pim_stop = 0; - tc->signature = 0x41524556; // "VERA" + vc->signature = 0x41524556; // "VERA" - digest[0] = tc->data_buf[0]; + digest[0] = vc->data_buf[0]; return (PARSER_OK); } @@ -253,7 +285,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; module_ctx->module_benchmark_mask = MODULE_DEFAULT; module_ctx->module_benchmark_salt = MODULE_DEFAULT; - module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; module_ctx->module_dgst_pos0 = module_dgst_pos0; module_ctx->module_dgst_pos1 = module_dgst_pos1; @@ -286,7 +318,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_jit_cache_disable = MODULE_DEFAULT; module_ctx->module_kernel_accel_max = MODULE_DEFAULT; module_ctx->module_kernel_accel_min = MODULE_DEFAULT; - module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = MODULE_DEFAULT; module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; diff --git a/src/modules/module_13761.c b/src/modules/module_13761.c index e99c11fca..83ce4acaf 100644 --- a/src/modules/module_13761.c +++ b/src/modules/module_13761.c @@ -22,8 +22,7 @@ static const u32 DGST_SIZE = DGST_SIZE_4_8; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt SHA256 + XTS 512 bit + boot-mode"; static const u64 KERN_TYPE = 13751; -static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_BINARY_HASHFILE | OPTS_TYPE_KEYBOARD_MAPPING; @@ -46,7 +45,7 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } -typedef struct tc_tmp +typedef struct vc_tmp { u32 ipad[16]; u32 opad[16]; @@ -54,9 +53,12 @@ typedef struct tc_tmp u32 dgst[64]; u32 out[64]; -} tc_tmp_t; + u32 pim_key[64]; + int pim; // marker for cracked -typedef struct tc +} vc_tmp_t; + +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -66,21 +68,33 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; static const int ROUNDS_VERACRYPT_200000 = 200000; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; -int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) { - const tc_t *tc = (const tc_t *) hashes->esalts_buf; + const vc_t *vc = (const vc_t *) hashes->esalts_buf; + + u32 tmp_buf[64] = { 0 }; + + memcpy (tmp_buf, src_buf, src_len); + + execute_keyboard_layout_mapping (tmp_buf, src_len, vc->keyboard_layout_mapping_buf, vc->keyboard_layout_mapping_cnt); - if (src_len < (int) dst_sz) + if (plain->extra1 == 0) { - memcpy (dst_buf, src_buf, src_len); + return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) tmp_buf); + } + else + { + return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) tmp_buf, plain->extra1); } - - return execute_keyboard_layout_mapping (dst_buf, src_len, tc->keyboard_layout_mapping_buf, tc->keyboard_layout_mapping_cnt); } bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) @@ -99,14 +113,14 @@ bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 esalt_size = (const u64) sizeof (tc_t); + const u64 esalt_size = (const u64) sizeof (vc_t); return esalt_size; } u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + const u64 tmp_size = (const u64) sizeof (vc_tmp_t); return tmp_size; } @@ -171,7 +185,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE // keyfiles - tc_t *tc = (tc_t *) hash->esalt; + vc_t *vc = (vc_t *) hash->esalt; if (user_options->veracrypt_keyfiles) { @@ -185,7 +199,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (keyfile)) { - cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); } keyfile = strtok_r ((char *) NULL, ",", &saveptr); @@ -200,7 +214,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (user_options->keyboard_layout_mapping)) { - initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, vc->keyboard_layout_mapping_buf, &vc->keyboard_layout_mapping_cnt); } } @@ -208,10 +222,12 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE salt_t *salt = hash->salt; - if (user_options->veracrypt_pim) + if ((user_options->veracrypt_pim_start) && (user_options->veracrypt_pim_stop)) { - salt->salt_iter = user_options->veracrypt_pim * 2048; + vc->pim_start = user_options->veracrypt_pim_start; + vc->pim_stop = user_options->veracrypt_pim_stop; + salt->salt_iter = vc->pim_stop * 2048; salt->salt_iter--; } @@ -222,25 +238,30 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { u32 *digest = (u32 *) digest_buf; - tc_t *tc = (tc_t *) esalt_buf; + vc_t *vc = (vc_t *) esalt_buf; const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + memcpy (vc->salt_buf, line_buf, 64); - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (vc->data_buf, line_buf + 64, 512 - 64); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_buf[0] = vc->salt_buf[0]; salt->salt_len = 4; - salt->salt_iter = ROUNDS_VERACRYPT_200000 - 1; + salt->salt_iter = ROUNDS_VERACRYPT_200000; + salt->salt_iter--; + + vc->pim_multi = 2048; + vc->pim_start = 0; + vc->pim_stop = 0; - tc->signature = 0x41524556; // "VERA" + vc->signature = 0x41524556; // "VERA" - digest[0] = tc->data_buf[0]; + digest[0] = vc->data_buf[0]; return (PARSER_OK); } diff --git a/src/modules/module_13762.c b/src/modules/module_13762.c index 078c00b2f..4b19777ab 100644 --- a/src/modules/module_13762.c +++ b/src/modules/module_13762.c @@ -22,8 +22,7 @@ static const u32 DGST_SIZE = DGST_SIZE_4_8; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt SHA256 + XTS 1024 bit + boot-mode"; static const u64 KERN_TYPE = 13752; -static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_BINARY_HASHFILE | OPTS_TYPE_KEYBOARD_MAPPING; @@ -46,7 +45,7 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } -typedef struct tc_tmp +typedef struct vc_tmp { u32 ipad[16]; u32 opad[16]; @@ -54,9 +53,12 @@ typedef struct tc_tmp u32 dgst[64]; u32 out[64]; -} tc_tmp_t; + u32 pim_key[64]; + int pim; // marker for cracked -typedef struct tc +} vc_tmp_t; + +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -66,21 +68,33 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; static const int ROUNDS_VERACRYPT_200000 = 200000; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; -int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) { - const tc_t *tc = (const tc_t *) hashes->esalts_buf; + const vc_t *vc = (const vc_t *) hashes->esalts_buf; + + u32 tmp_buf[64] = { 0 }; + + memcpy (tmp_buf, src_buf, src_len); + + execute_keyboard_layout_mapping (tmp_buf, src_len, vc->keyboard_layout_mapping_buf, vc->keyboard_layout_mapping_cnt); - if (src_len < (int) dst_sz) + if (plain->extra1 == 0) { - memcpy (dst_buf, src_buf, src_len); + return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) tmp_buf); + } + else + { + return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) tmp_buf, plain->extra1); } - - return execute_keyboard_layout_mapping (dst_buf, src_len, tc->keyboard_layout_mapping_buf, tc->keyboard_layout_mapping_cnt); } bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) @@ -99,14 +113,14 @@ bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 esalt_size = (const u64) sizeof (tc_t); + const u64 esalt_size = (const u64) sizeof (vc_t); return esalt_size; } u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + const u64 tmp_size = (const u64) sizeof (vc_tmp_t); return tmp_size; } @@ -171,7 +185,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE // keyfiles - tc_t *tc = (tc_t *) hash->esalt; + vc_t *vc = (vc_t *) hash->esalt; if (user_options->veracrypt_keyfiles) { @@ -185,7 +199,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (keyfile)) { - cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); } keyfile = strtok_r ((char *) NULL, ",", &saveptr); @@ -200,7 +214,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (user_options->keyboard_layout_mapping)) { - initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, vc->keyboard_layout_mapping_buf, &vc->keyboard_layout_mapping_cnt); } } @@ -208,10 +222,12 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE salt_t *salt = hash->salt; - if (user_options->veracrypt_pim) + if ((user_options->veracrypt_pim_start) && (user_options->veracrypt_pim_stop)) { - salt->salt_iter = user_options->veracrypt_pim * 2048; + vc->pim_start = user_options->veracrypt_pim_start; + vc->pim_stop = user_options->veracrypt_pim_stop; + salt->salt_iter = vc->pim_stop * 2048; salt->salt_iter--; } @@ -222,25 +238,30 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { u32 *digest = (u32 *) digest_buf; - tc_t *tc = (tc_t *) esalt_buf; + vc_t *vc = (vc_t *) esalt_buf; const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + memcpy (vc->salt_buf, line_buf, 64); - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (vc->data_buf, line_buf + 64, 512 - 64); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_buf[0] = vc->salt_buf[0]; salt->salt_len = 4; - salt->salt_iter = ROUNDS_VERACRYPT_200000 - 1; + salt->salt_iter = ROUNDS_VERACRYPT_200000; + salt->salt_iter--; + + vc->pim_multi = 2048; + vc->pim_start = 0; + vc->pim_stop = 0; - tc->signature = 0x41524556; // "VERA" + vc->signature = 0x41524556; // "VERA" - digest[0] = tc->data_buf[0]; + digest[0] = vc->data_buf[0]; return (PARSER_OK); } diff --git a/src/modules/module_13763.c b/src/modules/module_13763.c index 1fa2c1cf5..47daa2853 100644 --- a/src/modules/module_13763.c +++ b/src/modules/module_13763.c @@ -22,8 +22,7 @@ static const u32 DGST_SIZE = DGST_SIZE_4_8; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt SHA256 + XTS 1536 bit + boot-mode"; static const u64 KERN_TYPE = 13753; -static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_BINARY_HASHFILE | OPTS_TYPE_KEYBOARD_MAPPING; @@ -46,7 +45,7 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } -typedef struct tc_tmp +typedef struct vc_tmp { u32 ipad[16]; u32 opad[16]; @@ -54,9 +53,12 @@ typedef struct tc_tmp u32 dgst[64]; u32 out[64]; -} tc_tmp_t; + u32 pim_key[64]; + int pim; // marker for cracked -typedef struct tc +} vc_tmp_t; + +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -66,21 +68,33 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; static const int ROUNDS_VERACRYPT_200000 = 200000; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; -int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) { - const tc_t *tc = (const tc_t *) hashes->esalts_buf; + const vc_t *vc = (const vc_t *) hashes->esalts_buf; + + u32 tmp_buf[64] = { 0 }; + + memcpy (tmp_buf, src_buf, src_len); + + execute_keyboard_layout_mapping (tmp_buf, src_len, vc->keyboard_layout_mapping_buf, vc->keyboard_layout_mapping_cnt); - if (src_len < (int) dst_sz) + if (plain->extra1 == 0) { - memcpy (dst_buf, src_buf, src_len); + return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) tmp_buf); + } + else + { + return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) tmp_buf, plain->extra1); } - - return execute_keyboard_layout_mapping (dst_buf, src_len, tc->keyboard_layout_mapping_buf, tc->keyboard_layout_mapping_cnt); } bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) @@ -99,14 +113,14 @@ bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 esalt_size = (const u64) sizeof (tc_t); + const u64 esalt_size = (const u64) sizeof (vc_t); return esalt_size; } u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 tmp_size = (const u64) sizeof (tc_tmp_t); + const u64 tmp_size = (const u64) sizeof (vc_tmp_t); return tmp_size; } @@ -171,7 +185,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE // keyfiles - tc_t *tc = (tc_t *) hash->esalt; + vc_t *vc = (vc_t *) hash->esalt; if (user_options->veracrypt_keyfiles) { @@ -185,7 +199,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (keyfile)) { - cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); } keyfile = strtok_r ((char *) NULL, ",", &saveptr); @@ -200,7 +214,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (user_options->keyboard_layout_mapping)) { - initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, vc->keyboard_layout_mapping_buf, &vc->keyboard_layout_mapping_cnt); } } @@ -208,10 +222,12 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE salt_t *salt = hash->salt; - if (user_options->veracrypt_pim) + if ((user_options->veracrypt_pim_start) && (user_options->veracrypt_pim_stop)) { - salt->salt_iter = user_options->veracrypt_pim * 2048; + vc->pim_start = user_options->veracrypt_pim_start; + vc->pim_stop = user_options->veracrypt_pim_stop; + salt->salt_iter = vc->pim_stop * 2048; salt->salt_iter--; } @@ -233,25 +249,30 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { u32 *digest = (u32 *) digest_buf; - tc_t *tc = (tc_t *) esalt_buf; + vc_t *vc = (vc_t *) esalt_buf; const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + memcpy (vc->salt_buf, line_buf, 64); - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (vc->data_buf, line_buf + 64, 512 - 64); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_buf[0] = vc->salt_buf[0]; salt->salt_len = 4; - salt->salt_iter = ROUNDS_VERACRYPT_200000 - 1; + salt->salt_iter = ROUNDS_VERACRYPT_200000; + salt->salt_iter--; + + vc->pim_multi = 2048; + vc->pim_start = 0; + vc->pim_stop = 0; - tc->signature = 0x41524556; // "VERA" + vc->signature = 0x41524556; // "VERA" - digest[0] = tc->data_buf[0]; + digest[0] = vc->data_buf[0]; return (PARSER_OK); } diff --git a/src/modules/module_13771.c b/src/modules/module_13771.c index 5053ebe79..9d98681b5 100644 --- a/src/modules/module_13771.c +++ b/src/modules/module_13771.c @@ -23,7 +23,6 @@ static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt Streebog-512 + XTS 512 bit"; static const u64 KERN_TYPE = 13771; static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP | OPTI_TYPE_USES_BITS_64; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_BINARY_HASHFILE; @@ -57,9 +56,12 @@ typedef struct vc64_sbog_tmp u64 dgst[32]; u64 out[32]; + u64 pim_key[32]; + int pim; // marker for cracked + } vc64_sbog_tmp_t; -typedef struct tc +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -69,11 +71,27 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; static const int ROUNDS_VERACRYPT_500000 = 500000; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + if (plain->extra1 == 0) + { + return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf); + } + else + { + return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, plain->extra1 - 15); + } +} + bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { const bool potfile_disable = true; @@ -90,7 +108,7 @@ bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 esalt_size = (const u64) sizeof (tc_t); + const u64 esalt_size = (const u64) sizeof (vc_t); return esalt_size; } @@ -102,6 +120,13 @@ u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED c return tmp_size; } +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_max = 1000; // lowest PIM multiplier + + return kernel_loops_max; +} + u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { // this overrides the reductions of PW_MAX in case optimized kernel is selected @@ -162,7 +187,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE // keyfiles - tc_t *tc = (tc_t *) hash->esalt; + vc_t *vc = (vc_t *) hash->esalt; if (user_options->veracrypt_keyfiles) { @@ -176,7 +201,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (keyfile)) { - cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); } keyfile = strtok_r ((char *) NULL, ",", &saveptr); @@ -191,7 +216,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (user_options->keyboard_layout_mapping)) { - initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, vc->keyboard_layout_mapping_buf, &vc->keyboard_layout_mapping_cnt); } } @@ -199,10 +224,12 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE salt_t *salt = hash->salt; - if (user_options->veracrypt_pim) + if ((user_options->veracrypt_pim_start) && (user_options->veracrypt_pim_stop)) { - salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + vc->pim_start = 15 + user_options->veracrypt_pim_start; + vc->pim_stop = 15 + user_options->veracrypt_pim_stop; + salt->salt_iter = vc->pim_stop * 1000; salt->salt_iter--; } @@ -213,25 +240,30 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { u32 *digest = (u32 *) digest_buf; - tc_t *tc = (tc_t *) esalt_buf; + vc_t *vc = (vc_t *) esalt_buf; const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + memcpy (vc->salt_buf, line_buf, 64); - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (vc->data_buf, line_buf + 64, 512 - 64); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_buf[0] = vc->salt_buf[0]; salt->salt_len = 4; - salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + salt->salt_iter = ROUNDS_VERACRYPT_500000; + salt->salt_iter--; + + vc->pim_multi = 1000; + vc->pim_start = 0; + vc->pim_stop = 0; - tc->signature = 0x41524556; // "VERA" + vc->signature = 0x41524556; // "VERA" - digest[0] = tc->data_buf[0]; + digest[0] = vc->data_buf[0]; return (PARSER_OK); } @@ -246,7 +278,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; module_ctx->module_benchmark_mask = MODULE_DEFAULT; module_ctx->module_benchmark_salt = MODULE_DEFAULT; - module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; module_ctx->module_dgst_pos0 = module_dgst_pos0; module_ctx->module_dgst_pos1 = module_dgst_pos1; @@ -279,7 +311,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_jit_cache_disable = MODULE_DEFAULT; module_ctx->module_kernel_accel_max = MODULE_DEFAULT; module_ctx->module_kernel_accel_min = MODULE_DEFAULT; - module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = MODULE_DEFAULT; module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; diff --git a/src/modules/module_13772.c b/src/modules/module_13772.c index df3d0c3d0..225b7053e 100644 --- a/src/modules/module_13772.c +++ b/src/modules/module_13772.c @@ -23,7 +23,6 @@ static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt Streebog-512 + XTS 1024 bit"; static const u64 KERN_TYPE = 13772; static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP | OPTI_TYPE_USES_BITS_64; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_BINARY_HASHFILE; @@ -57,9 +56,12 @@ typedef struct vc64_sbog_tmp u64 dgst[32]; u64 out[32]; + u64 pim_key[32]; + int pim; // marker for cracked + } vc64_sbog_tmp_t; -typedef struct tc +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -69,11 +71,27 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; static const int ROUNDS_VERACRYPT_500000 = 500000; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + if (plain->extra1 == 0) + { + return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf); + } + else + { + return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, plain->extra1 - 15); + } +} + bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { const bool potfile_disable = true; @@ -90,7 +108,7 @@ bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 esalt_size = (const u64) sizeof (tc_t); + const u64 esalt_size = (const u64) sizeof (vc_t); return esalt_size; } @@ -102,6 +120,13 @@ u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED c return tmp_size; } +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_max = 1000; // lowest PIM multiplier + + return kernel_loops_max; +} + u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { // this overrides the reductions of PW_MAX in case optimized kernel is selected @@ -162,7 +187,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE // keyfiles - tc_t *tc = (tc_t *) hash->esalt; + vc_t *vc = (vc_t *) hash->esalt; if (user_options->veracrypt_keyfiles) { @@ -176,7 +201,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (keyfile)) { - cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); } keyfile = strtok_r ((char *) NULL, ",", &saveptr); @@ -191,7 +216,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (user_options->keyboard_layout_mapping)) { - initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, vc->keyboard_layout_mapping_buf, &vc->keyboard_layout_mapping_cnt); } } @@ -199,10 +224,12 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE salt_t *salt = hash->salt; - if (user_options->veracrypt_pim) + if ((user_options->veracrypt_pim_start) && (user_options->veracrypt_pim_stop)) { - salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + vc->pim_start = 15 + user_options->veracrypt_pim_start; + vc->pim_stop = 15 + user_options->veracrypt_pim_stop; + salt->salt_iter = vc->pim_stop * 1000; salt->salt_iter--; } @@ -213,25 +240,30 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { u32 *digest = (u32 *) digest_buf; - tc_t *tc = (tc_t *) esalt_buf; + vc_t *vc = (vc_t *) esalt_buf; const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + memcpy (vc->salt_buf, line_buf, 64); - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (vc->data_buf, line_buf + 64, 512 - 64); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_buf[0] = vc->salt_buf[0]; salt->salt_len = 4; - salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + salt->salt_iter = ROUNDS_VERACRYPT_500000; + salt->salt_iter--; + + vc->pim_multi = 1000; + vc->pim_start = 0; + vc->pim_stop = 0; - tc->signature = 0x41524556; // "VERA" + vc->signature = 0x41524556; // "VERA" - digest[0] = tc->data_buf[0]; + digest[0] = vc->data_buf[0]; return (PARSER_OK); } @@ -246,7 +278,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; module_ctx->module_benchmark_mask = MODULE_DEFAULT; module_ctx->module_benchmark_salt = MODULE_DEFAULT; - module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; module_ctx->module_dgst_pos0 = module_dgst_pos0; module_ctx->module_dgst_pos1 = module_dgst_pos1; @@ -279,7 +311,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_jit_cache_disable = MODULE_DEFAULT; module_ctx->module_kernel_accel_max = MODULE_DEFAULT; module_ctx->module_kernel_accel_min = MODULE_DEFAULT; - module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = MODULE_DEFAULT; module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; diff --git a/src/modules/module_13773.c b/src/modules/module_13773.c index ea6af6561..b2513fef0 100644 --- a/src/modules/module_13773.c +++ b/src/modules/module_13773.c @@ -23,7 +23,6 @@ static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt Streebog-512 + XTS 1536 bit"; static const u64 KERN_TYPE = 13773; static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE - | OPTI_TYPE_SLOW_HASH_SIMD_LOOP | OPTI_TYPE_USES_BITS_64; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_BINARY_HASHFILE; @@ -57,9 +56,12 @@ typedef struct vc64_sbog_tmp u64 dgst[32]; u64 out[32]; + u64 pim_key[32]; + int pim; // marker for cracked + } vc64_sbog_tmp_t; -typedef struct tc +typedef struct vc { u32 salt_buf[32]; u32 data_buf[112]; @@ -69,11 +71,27 @@ typedef struct tc keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; int keyboard_layout_mapping_cnt; -} tc_t; + int pim_multi; // 2048 for boot (not SHA-512 or Whirlpool), 1000 for others + int pim_start; + int pim_stop; + +} vc_t; static const int ROUNDS_VERACRYPT_500000 = 500000; static const float MIN_SUFFICIENT_ENTROPY_FILE = 7.0f; +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, MAYBE_UNUSED const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +{ + if (plain->extra1 == 0) + { + return snprintf ((char *) dst_buf, dst_sz, "%s", (char *) src_buf); + } + else + { + return snprintf ((char *) dst_buf, dst_sz, "%s (PIM=%d)", (char *) src_buf, plain->extra1 - 15); + } +} + bool module_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { const bool potfile_disable = true; @@ -90,7 +108,7 @@ bool module_outfile_check_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u64 esalt_size = (const u64) sizeof (tc_t); + const u64 esalt_size = (const u64) sizeof (vc_t); return esalt_size; } @@ -102,6 +120,13 @@ u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED c return tmp_size; } +u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 kernel_loops_max = 1000; // lowest PIM multiplier + + return kernel_loops_max; +} + u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { // this overrides the reductions of PW_MAX in case optimized kernel is selected @@ -162,7 +187,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE // keyfiles - tc_t *tc = (tc_t *) hash->esalt; + vc_t *vc = (vc_t *) hash->esalt; if (user_options->veracrypt_keyfiles) { @@ -176,7 +201,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (keyfile)) { - cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); + cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); } keyfile = strtok_r ((char *) NULL, ",", &saveptr); @@ -191,7 +216,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { if (hc_path_read (user_options->keyboard_layout_mapping)) { - initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt); + initialize_keyboard_layout_mapping (user_options->keyboard_layout_mapping, vc->keyboard_layout_mapping_buf, &vc->keyboard_layout_mapping_cnt); } } @@ -199,10 +224,12 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE salt_t *salt = hash->salt; - if (user_options->veracrypt_pim) + if ((user_options->veracrypt_pim_start) && (user_options->veracrypt_pim_stop)) { - salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000); + vc->pim_start = 15 + user_options->veracrypt_pim_start; + vc->pim_stop = 15 + user_options->veracrypt_pim_stop; + salt->salt_iter = vc->pim_stop * 1000; salt->salt_iter--; } @@ -236,25 +263,30 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { u32 *digest = (u32 *) digest_buf; - tc_t *tc = (tc_t *) esalt_buf; + vc_t *vc = (vc_t *) esalt_buf; const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (tc->salt_buf, line_buf, 64); + memcpy (vc->salt_buf, line_buf, 64); - memcpy (tc->data_buf, line_buf + 64, 512 - 64); + memcpy (vc->data_buf, line_buf + 64, 512 - 64); - salt->salt_buf[0] = tc->salt_buf[0]; + salt->salt_buf[0] = vc->salt_buf[0]; salt->salt_len = 4; - salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + salt->salt_iter = ROUNDS_VERACRYPT_500000; + salt->salt_iter--; + + vc->pim_multi = 1000; + vc->pim_start = 0; + vc->pim_stop = 0; - tc->signature = 0x41524556; // "VERA" + vc->signature = 0x41524556; // "VERA" - digest[0] = tc->data_buf[0]; + digest[0] = vc->data_buf[0]; return (PARSER_OK); } @@ -269,7 +301,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; module_ctx->module_benchmark_mask = MODULE_DEFAULT; module_ctx->module_benchmark_salt = MODULE_DEFAULT; - module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = module_build_plain_postprocess; module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; module_ctx->module_dgst_pos0 = module_dgst_pos0; module_ctx->module_dgst_pos1 = module_dgst_pos1; @@ -302,7 +334,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_jit_cache_disable = MODULE_DEFAULT; module_ctx->module_kernel_accel_max = MODULE_DEFAULT; module_ctx->module_kernel_accel_min = MODULE_DEFAULT; - module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = MODULE_DEFAULT; module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; diff --git a/src/modules/module_15300.c b/src/modules/module_15300.c index dc68768c0..240aa0d8a 100644 --- a/src/modules/module_15300.c +++ b/src/modules/module_15300.c @@ -99,7 +99,6 @@ u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED con bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hc_device_param_t *device_param) { - if (device_param->platform_vendor_id == VENDOR_ID_APPLE) { // trap 6 @@ -107,12 +106,12 @@ bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE { return true; } + } - // self-test failed - if (device_param->device_type & CL_DEVICE_TYPE_CPU) - { - return true; - } + // self-test failed + if (device_param->device_type & CL_DEVICE_TYPE_CPU) + { + return true; } return false; diff --git a/src/modules/module_18100.c b/src/modules/module_18100.c index a7c9a6b71..bb62134aa 100644 --- a/src/modules/module_18100.c +++ b/src/modules/module_18100.c @@ -45,7 +45,7 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } -int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) +int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const plain_t *plain, const u32 *src_buf, MAYBE_UNUSED const size_t src_sz, const int src_len, u32 *dst_buf, MAYBE_UNUSED const size_t dst_sz) { return base32_encode (int_to_base32, (const u8 *) src_buf, src_len, (u8 *) dst_buf); } diff --git a/src/status.c b/src/status.c index 77e489ae6..c2cff5a7b 100644 --- a/src/status.c +++ b/src/status.c @@ -872,8 +872,8 @@ char *status_get_guess_candidates_dev (const hashcat_ctx_t *hashcat_ctx, const i const u32 innerloop_first = 0; const u32 innerloop_last = device_param->innerloop_left - 1; - plain_t plain1 = { outerloop_first, innerloop_first, 0, 0, 0 }; - plain_t plain2 = { outerloop_last, innerloop_last, 0, 0, 0 }; + plain_t plain1 = { outerloop_first, innerloop_first, 0, 0, 0, 0, 0 }; + plain_t plain2 = { outerloop_last, innerloop_last, 0, 0, 0, 0, 0 }; u32 plain_buf1[(64 * 2) + 2] = { 0 }; u32 plain_buf2[(64 * 2) + 2] = { 0 }; diff --git a/src/usage.c b/src/usage.c index a6cac4569..bc4ba0d02 100644 --- a/src/usage.c +++ b/src/usage.c @@ -77,7 +77,8 @@ static const char *const USAGE_BIG_PRE_HASHMODES[] = " --keyboard-layout-mapping | File | Keyboard layout mapping table for special hash-modes | --keyb=german.hckmap", " --truecrypt-keyfiles | File | Keyfiles to use, separated with commas | --truecrypt-keyf=x.png", " --veracrypt-keyfiles | File | Keyfiles to use, separated with commas | --veracrypt-keyf=x.txt", - " --veracrypt-pim | Num | VeraCrypt personal iterations multiplier | --veracrypt-pim=1000", + " --veracrypt-pim-start | Num | VeraCrypt personal iterations multiplier start | --veracrypt-pim-start=450", + " --veracrypt-pim-stop | Num | VeraCrypt personal iterations multiplier stop | --veracrypt-pim-stop=500", " -b, --benchmark | | Run benchmark of selected hash-modes |", " --benchmark-all | | Run benchmark of all hash-modes (requires -b) |", " --speed-only | | Return expected speed of the attack, then quit |", diff --git a/src/user_options.c b/src/user_options.c index c7111bb7f..6ec74d28a 100644 --- a/src/user_options.c +++ b/src/user_options.c @@ -118,7 +118,8 @@ static const struct option long_options[] = {"truecrypt-keyfiles", required_argument, NULL, IDX_TRUECRYPT_KEYFILES}, {"username", no_argument, NULL, IDX_USERNAME}, {"veracrypt-keyfiles", required_argument, NULL, IDX_VERACRYPT_KEYFILES}, - {"veracrypt-pim", required_argument, NULL, IDX_VERACRYPT_PIM}, + {"veracrypt-pim-start", required_argument, NULL, IDX_VERACRYPT_PIM_START}, + {"veracrypt-pim-stop", required_argument, NULL, IDX_VERACRYPT_PIM_STOP}, {"version", no_argument, NULL, IDX_VERSION}, {"wordlist-autohex-disable", no_argument, NULL, IDX_WORDLIST_AUTOHEX_DISABLE}, {"workload-profile", required_argument, NULL, IDX_WORKLOAD_PROFILE}, @@ -248,7 +249,8 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx) user_options->usage = USAGE; user_options->username = USERNAME; user_options->veracrypt_keyfiles = NULL; - user_options->veracrypt_pim = 0; + user_options->veracrypt_pim_start = 0; + user_options->veracrypt_pim_stop = 0; user_options->version = VERSION; user_options->wordlist_autohex_disable = WORDLIST_AUTOHEX_DISABLE; user_options->workload_profile = WORKLOAD_PROFILE; @@ -312,7 +314,8 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv) case IDX_HWMON_TEMP_ABORT: case IDX_HCCAPX_MESSAGE_PAIR: case IDX_NONCE_ERROR_CORRECTIONS: - case IDX_VERACRYPT_PIM: + case IDX_VERACRYPT_PIM_START: + case IDX_VERACRYPT_PIM_STOP: case IDX_SEGMENT_SIZE: case IDX_SCRYPT_TMTO: case IDX_BITMAP_MIN: @@ -447,7 +450,8 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv) case IDX_KEYBOARD_LAYOUT_MAPPING: user_options->keyboard_layout_mapping = optarg; break; case IDX_TRUECRYPT_KEYFILES: user_options->truecrypt_keyfiles = optarg; break; case IDX_VERACRYPT_KEYFILES: user_options->veracrypt_keyfiles = optarg; break; - case IDX_VERACRYPT_PIM: user_options->veracrypt_pim = hc_strtoul (optarg, NULL, 10); break; + case IDX_VERACRYPT_PIM_START: user_options->veracrypt_pim_start = hc_strtoul (optarg, NULL, 10); break; + case IDX_VERACRYPT_PIM_STOP: user_options->veracrypt_pim_stop = hc_strtoul (optarg, NULL, 10); break; case IDX_SEGMENT_SIZE: user_options->segment_size = hc_strtoul (optarg, NULL, 10); user_options->segment_size_chgd = true; break; case IDX_SCRYPT_TMTO: user_options->scrypt_tmto = hc_strtoul (optarg, NULL, 10); break; @@ -669,6 +673,27 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx) return -1; } + if ((user_options->veracrypt_pim_start != 0) && (user_options->veracrypt_pim_stop == 0)) + { + event_log_error (hashcat_ctx, "If --veracrypt-pim-start is specified then --veracrypt-pim-stop needs to be specified, too."); + + return -1; + } + + if ((user_options->veracrypt_pim_start == 0) && (user_options->veracrypt_pim_stop != 0)) + { + event_log_error (hashcat_ctx, "If --veracrypt-pim-stop is specified then --veracrypt-pim-start needs to be specified, too."); + + return -1; + } + + if (user_options->veracrypt_pim_start > user_options->veracrypt_pim_stop) + { + event_log_error (hashcat_ctx, "Invalid --veracrypt-pim-start value specified."); + + return -1; + } + if (user_options->increment_min > user_options->increment_max) { event_log_error (hashcat_ctx, "Invalid --increment-min value specified - must be >= --increment-max."); @@ -2769,7 +2794,8 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx) logfile_top_uint (user_options->stdout_flag); logfile_top_uint (user_options->usage); logfile_top_uint (user_options->username); - logfile_top_uint (user_options->veracrypt_pim); + logfile_top_uint (user_options->veracrypt_pim_start); + logfile_top_uint (user_options->veracrypt_pim_stop); logfile_top_uint (user_options->version); logfile_top_uint (user_options->workload_profile); #ifdef WITH_BRAIN