Support for inline VeraCrypt PIM Brute-Force

pull/1939/head^2
jsteube 5 years ago
parent bbae1b53d1
commit 218322f630

@ -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);

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}

@ -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);
}
}

@ -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];

@ -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); \
} \
} \
} \

@ -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); \
} \
} \
} \

@ -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);

@ -1413,6 +1413,8 @@ typedef struct plain
u32 salt_pos;
u32 digest_pos;
u32 hash_pos;
u32 extra1;
u32 extra2;
} plain_t;

@ -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);

@ -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);
}
}
}

@ -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);
}
}
}

@ -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;
/**

@ -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;
/**

@ -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;
/**

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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;

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}
}

@ -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);
}
}
}
}

@ -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);
}
}
}
}

@ -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);
}
}
}
}

@ -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);
}
}
}
}

@ -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);
}
}
}
}

@ -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);
}
}
}
}

@ -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);
}
}
}
}

@ -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);
}
}
}
}

@ -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);
}
}
}
}

@ -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);
}
}
}
}

@ -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);
}
}
}
}

@ -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);
}
}
}
}

@ -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);
}
}
}
}

@ -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);
}
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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;

@ -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;

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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);
}
}
}

@ -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

@ -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]}"

@ -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);

@ -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 *);

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save