Splitted DPAPI kernel in 2 to increase performances

pull/1365/head
Fist0urs 7 years ago
parent 036d4874c7
commit a6294537fd

@ -1424,7 +1424,6 @@ typedef struct keepass
typedef struct dpapimk
{
u32 version;
u32 context;
u32 SID[32];
@ -1834,9 +1833,8 @@ typedef struct keepass_tmp
} keepass_tmp_t;
typedef struct dpapimk_tmp
typedef struct dpapimk_tmp_v1
{
/* dedicated to hmac-sha1 */
u32 ipad[5];
u32 opad[5];
u32 dgst[10];
@ -1844,13 +1842,18 @@ typedef struct dpapimk_tmp
u32 userKey[5];
/* dedicated to hmac-sha512 */
} dpapimk_tmp_t_v1;
typedef struct dpapimk_tmp_v2
{
u64 ipad64[8];
u64 opad64[8];
u64 dgst64[16];
u64 out64[16];
u32 userKey[5];
} dpapimk_tmp_t;
} dpapimk_tmp_t_v2;
typedef struct bsdicrypt_tmp
{

@ -218,6 +218,9 @@
#if KERN_TYPE == 15300
#undef _unroll
#endif
#if KERN_TYPE == 15900
#undef _unroll
#endif
#endif
#endif

File diff suppressed because it is too large Load Diff

@ -0,0 +1,779 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#define NEW_SIMD_CODE
#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_md4.cl"
#include "inc_hash_sha1.cl"
#include "inc_hash_sha512.cl"
#include "inc_cipher_aes.cl"
#define COMPARE_S "inc_comp_single.cl"
#define COMPARE_M "inc_comp_multi.cl"
void hmac_sha512_run_V (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], u32x w4[4], u32x w5[4], u32x w6[4], u32x w7[4], u64x ipad[8], u64x opad[8], u64x digest[8])
{
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 m15900_init (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global dpapimk_tmp_t_v2 *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const dpapimk_t *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u64 gid_max)
{
/**
* base
*/
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
/**
* main
*/
u32 digest_context[5];
if (esalt_bufs[digests_offset].context == 1)
{
/* local credentials */
sha1_ctx_t ctx;
sha1_init (&ctx);
sha1_update_global_utf16le_swap (&ctx, pws[gid].i, pws[gid].pw_len);
sha1_final (&ctx);
digest_context[0] = ctx.h[0];
digest_context[1] = ctx.h[1];
digest_context[2] = ctx.h[2];
digest_context[3] = ctx.h[3];
digest_context[4] = ctx.h[4];
}
else if (esalt_bufs[digests_offset].context == 2)
{
/* domain credentials */
md4_ctx_t ctx;
md4_init (&ctx);
md4_update_global_utf16le (&ctx, pws[gid].i, pws[gid].pw_len);
md4_final (&ctx);
digest_context[0] = ctx.h[0];
digest_context[1] = ctx.h[1];
digest_context[2] = ctx.h[2];
digest_context[3] = ctx.h[3];
digest_context[4] = 0;
digest_context[0] = swap32_S (digest_context[0]);
digest_context[1] = swap32_S (digest_context[1]);
digest_context[2] = swap32_S (digest_context[2]);
digest_context[3] = swap32_S (digest_context[3]);
}
/* initialize hmac-sha1 */
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = digest_context[0];
w0[1] = digest_context[1];
w0[2] = digest_context[2];
w0[3] = digest_context[3];
w1[0] = digest_context[4];
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;
sha1_hmac_ctx_t ctx;
sha1_hmac_init_64 (&ctx, w0, w1, w2, w3);
sha1_hmac_update_global (&ctx, esalt_bufs[digests_offset].SID, esalt_bufs[digests_offset].SID_len);
sha1_hmac_final (&ctx);
u32 key[5];
key[0] = ctx.opad.h[0];
key[1] = ctx.opad.h[1];
key[2] = ctx.opad.h[2];
key[3] = ctx.opad.h[3];
key[4] = ctx.opad.h[4];
/* this key is used as password for pbkdf2-hmac-sha512 */
tmps[gid].userKey[0] = key[0];
tmps[gid].userKey[1] = key[1];
tmps[gid].userKey[2] = key[2];
tmps[gid].userKey[3] = key[3];
tmps[gid].userKey[4] = key[4];
u32 w4[4];
u32 w5[4];
u32 w6[4];
u32 w7[4];
w0[0] = key[0];
w0[1] = key[1];
w0[2] = key[2];
w0[3] = key[3];
w1[0] = key[4];
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_ctx_t sha512_hmac_ctx;
sha512_hmac_init_128 (&sha512_hmac_ctx, w0, w1, w2, w3, w5, w5, w6, w7);
tmps[gid].ipad64[0] = sha512_hmac_ctx.ipad.h[0];
tmps[gid].ipad64[1] = sha512_hmac_ctx.ipad.h[1];
tmps[gid].ipad64[2] = sha512_hmac_ctx.ipad.h[2];
tmps[gid].ipad64[3] = sha512_hmac_ctx.ipad.h[3];
tmps[gid].ipad64[4] = sha512_hmac_ctx.ipad.h[4];
tmps[gid].ipad64[5] = sha512_hmac_ctx.ipad.h[5];
tmps[gid].ipad64[6] = sha512_hmac_ctx.ipad.h[6];
tmps[gid].ipad64[7] = sha512_hmac_ctx.ipad.h[7];
tmps[gid].opad64[0] = sha512_hmac_ctx.opad.h[0];
tmps[gid].opad64[1] = sha512_hmac_ctx.opad.h[1];
tmps[gid].opad64[2] = sha512_hmac_ctx.opad.h[2];
tmps[gid].opad64[3] = sha512_hmac_ctx.opad.h[3];
tmps[gid].opad64[4] = sha512_hmac_ctx.opad.h[4];
tmps[gid].opad64[5] = sha512_hmac_ctx.opad.h[5];
tmps[gid].opad64[6] = sha512_hmac_ctx.opad.h[6];
tmps[gid].opad64[7] = sha512_hmac_ctx.opad.h[7];
w0[0] = esalt_bufs[digests_offset].iv[0];
w0[1] = esalt_bufs[digests_offset].iv[1];
w0[2] = esalt_bufs[digests_offset].iv[2];
w0[3] = esalt_bufs[digests_offset].iv[3];
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_ctx, w0, w1, w2, w3, w4, w5, w6, w7, 16);
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].dgst64[i + 0] = sha512_hmac_ctx2.opad.h[0];
tmps[gid].dgst64[i + 1] = sha512_hmac_ctx2.opad.h[1];
tmps[gid].dgst64[i + 2] = sha512_hmac_ctx2.opad.h[2];
tmps[gid].dgst64[i + 3] = sha512_hmac_ctx2.opad.h[3];
tmps[gid].dgst64[i + 4] = sha512_hmac_ctx2.opad.h[4];
tmps[gid].dgst64[i + 5] = sha512_hmac_ctx2.opad.h[5];
tmps[gid].dgst64[i + 6] = sha512_hmac_ctx2.opad.h[6];
tmps[gid].dgst64[i + 7] = sha512_hmac_ctx2.opad.h[7];
tmps[gid].out64[i + 0] = tmps[gid].dgst64[i + 0];
tmps[gid].out64[i + 1] = tmps[gid].dgst64[i + 1];
tmps[gid].out64[i + 2] = tmps[gid].dgst64[i + 2];
tmps[gid].out64[i + 3] = tmps[gid].dgst64[i + 3];
tmps[gid].out64[i + 4] = tmps[gid].dgst64[i + 4];
tmps[gid].out64[i + 5] = tmps[gid].dgst64[i + 5];
tmps[gid].out64[i + 6] = tmps[gid].dgst64[i + 6];
tmps[gid].out64[i + 7] = tmps[gid].dgst64[i + 7];
}
}
__kernel void m15900_loop (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global dpapimk_tmp_t_v2 *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const dpapimk_t *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u64 gid_max)
{
/**
* base
*/
const u64 gid = get_global_id (0);
if ((gid * VECT_SIZE) >= gid_max) return;
u64x ipad[8];
u64x opad[8];
ipad[0] = pack64v (tmps, ipad64, gid, 0);
ipad[1] = pack64v (tmps, ipad64, gid, 1);
ipad[2] = pack64v (tmps, ipad64, gid, 2);
ipad[3] = pack64v (tmps, ipad64, gid, 3);
ipad[4] = pack64v (tmps, ipad64, gid, 4);
ipad[5] = pack64v (tmps, ipad64, gid, 5);
ipad[6] = pack64v (tmps, ipad64, gid, 6);
ipad[7] = pack64v (tmps, ipad64, gid, 7);
opad[0] = pack64v (tmps, opad64, gid, 0);
opad[1] = pack64v (tmps, opad64, gid, 1);
opad[2] = pack64v (tmps, opad64, gid, 2);
opad[3] = pack64v (tmps, opad64, gid, 3);
opad[4] = pack64v (tmps, opad64, gid, 4);
opad[5] = pack64v (tmps, opad64, gid, 5);
opad[6] = pack64v (tmps, opad64, gid, 6);
opad[7] = pack64v (tmps, opad64, gid, 7);
for (u32 i = 0; i < 8; i += 8)
{
u64x dgst[8];
u64x out[8];
dgst[0] = pack64v (tmps, dgst64, gid, i + 0);
dgst[1] = pack64v (tmps, dgst64, gid, i + 1);
dgst[2] = pack64v (tmps, dgst64, gid, i + 2);
dgst[3] = pack64v (tmps, dgst64, gid, i + 3);
dgst[4] = pack64v (tmps, dgst64, gid, i + 4);
dgst[5] = pack64v (tmps, dgst64, gid, i + 5);
dgst[6] = pack64v (tmps, dgst64, gid, i + 6);
dgst[7] = pack64v (tmps, dgst64, gid, i + 7);
out[0] = pack64v (tmps, out64, gid, i + 0);
out[1] = pack64v (tmps, out64, gid, i + 1);
out[2] = pack64v (tmps, out64, gid, i + 2);
out[3] = pack64v (tmps, out64, gid, i + 3);
out[4] = pack64v (tmps, out64, gid, i + 4);
out[5] = pack64v (tmps, out64, gid, i + 5);
out[6] = pack64v (tmps, out64, gid, i + 6);
out[7] = pack64v (tmps, out64, 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 (out[0]);
w0[1] = l32_from_64 (out[0]);
w0[2] = h32_from_64 (out[1]);
w0[3] = l32_from_64 (out[1]);
w1[0] = h32_from_64 (out[2]);
w1[1] = l32_from_64 (out[2]);
w1[2] = h32_from_64 (out[3]);
w1[3] = l32_from_64 (out[3]);
w2[0] = h32_from_64 (out[4]);
w2[1] = l32_from_64 (out[4]);
w2[2] = h32_from_64 (out[5]);
w2[3] = l32_from_64 (out[5]);
w3[0] = h32_from_64 (out[6]);
w3[1] = l32_from_64 (out[6]);
w3[2] = h32_from_64 (out[7]);
w3[3] = l32_from_64 (out[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];
}
unpack64v (tmps, dgst64, gid, i + 0, dgst[0]);
unpack64v (tmps, dgst64, gid, i + 1, dgst[1]);
unpack64v (tmps, dgst64, gid, i + 2, dgst[2]);
unpack64v (tmps, dgst64, gid, i + 3, dgst[3]);
unpack64v (tmps, dgst64, gid, i + 4, dgst[4]);
unpack64v (tmps, dgst64, gid, i + 5, dgst[5]);
unpack64v (tmps, dgst64, gid, i + 6, dgst[6]);
unpack64v (tmps, dgst64, gid, i + 7, dgst[7]);
unpack64v (tmps, out64, gid, i + 0, out[0]);
unpack64v (tmps, out64, gid, i + 1, out[1]);
unpack64v (tmps, out64, gid, i + 2, out[2]);
unpack64v (tmps, out64, gid, i + 3, out[3]);
unpack64v (tmps, out64, gid, i + 4, out[4]);
unpack64v (tmps, out64, gid, i + 5, out[5]);
unpack64v (tmps, out64, gid, i + 6, out[6]);
unpack64v (tmps, out64, gid, i + 7, out[7]);
}
}
__kernel void m15900_comp (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global dpapimk_tmp_t_v2 *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const dpapimk_t *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u64 gid_max)
{
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;
/**
* main
*/
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
u32 w4[4];
u32 w5[4];
u32 w6[4];
u32 w7[4];
/* Construct AES key */
u32 key[8];
key[0] = h32_from_64_S (tmps[gid].out64[0]);
key[1] = l32_from_64_S (tmps[gid].out64[0]);
key[2] = h32_from_64_S (tmps[gid].out64[1]);
key[3] = l32_from_64_S (tmps[gid].out64[1]);
key[4] = h32_from_64_S (tmps[gid].out64[2]);
key[5] = l32_from_64_S (tmps[gid].out64[2]);
key[6] = h32_from_64_S (tmps[gid].out64[3]);
key[7] = l32_from_64_S (tmps[gid].out64[3]);
u32 iv[4];
iv[0] = h32_from_64_S (tmps[gid].out64[4]);
iv[1] = l32_from_64_S (tmps[gid].out64[4]);
iv[2] = h32_from_64_S (tmps[gid].out64[5]);
iv[3] = l32_from_64_S (tmps[gid].out64[5]);
#define KEYLEN 60
u32 ks[KEYLEN];
AES256_set_decrypt_key (ks, key, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4);
/* 144 bytes */
u32 decrypted[36] = { 0 };
u32 contents_pos;
u32 contents_off;
u32 wx_off;
for (wx_off = 0, contents_pos = 0, contents_off = 0; contents_pos < esalt_bufs[digests_offset].contents_len; wx_off += 4, contents_pos += 16, contents_off += 4)
{
u32 data[4];
data[0] = esalt_bufs[digests_offset].contents[contents_off + 0];
data[1] = esalt_bufs[digests_offset].contents[contents_off + 1];
data[2] = esalt_bufs[digests_offset].contents[contents_off + 2];
data[3] = esalt_bufs[digests_offset].contents[contents_off + 3];
u32 out[4];
AES256_decrypt (ks, data, out, s_td0, s_td1, s_td2, s_td3, s_td4);
out[0] ^= iv[0];
out[1] ^= iv[1];
out[2] ^= iv[2];
out[3] ^= iv[3];
decrypted[wx_off + 0] = out[0];
decrypted[wx_off + 1] = out[1];
decrypted[wx_off + 2] = out[2];
decrypted[wx_off + 3] = out[3];
iv[0] = data[0];
iv[1] = data[1];
iv[2] = data[2];
iv[3] = data[3];
}
u32 hmacSalt[4];
u32 expectedHmac[16];
u32 lastKey[16];
hmacSalt[0] = decrypted[0];
hmacSalt[1] = decrypted[1];
hmacSalt[2] = decrypted[2];
hmacSalt[3] = decrypted[3];
for(int i = 0; i < 16; i++)
{
expectedHmac[i] = decrypted[i + 4];
lastKey[i] = decrypted[i + 36 - 16];
}
w0[0] = tmps[gid].userKey[0];
w0[1] = tmps[gid].userKey[1];
w0[2] = tmps[gid].userKey[2];
w0[3] = tmps[gid].userKey[3];
w1[0] = tmps[gid].userKey[4];
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_ctx_t ctx;
sha512_hmac_init_128 (&ctx, w0, w1, w2, w3, w4, w5, w6, w7);
w0[0] = hmacSalt[0];
w0[1] = hmacSalt[1];
w0[2] = hmacSalt[2];
w0[3] = hmacSalt[3];
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 (&ctx, w0, w1, w2, w3, w4, w5, w6, w7, 16);
sha512_hmac_final (&ctx);
w0[0] = h32_from_64_S (ctx.opad.h[0]);
w0[1] = l32_from_64_S (ctx.opad.h[0]);
w0[2] = h32_from_64_S (ctx.opad.h[1]);
w0[3] = l32_from_64_S (ctx.opad.h[1]);
w1[0] = h32_from_64_S (ctx.opad.h[2]);
w1[1] = l32_from_64_S (ctx.opad.h[2]);
w1[2] = h32_from_64_S (ctx.opad.h[3]);
w1[3] = l32_from_64_S (ctx.opad.h[3]);
w2[0] = h32_from_64_S (ctx.opad.h[4]);
w2[1] = l32_from_64_S (ctx.opad.h[4]);
w2[2] = h32_from_64_S (ctx.opad.h[5]);
w2[3] = l32_from_64_S (ctx.opad.h[5]);
w3[0] = h32_from_64_S (ctx.opad.h[6]);
w3[1] = l32_from_64_S (ctx.opad.h[6]);
w3[2] = h32_from_64_S (ctx.opad.h[7]);
w3[3] = l32_from_64_S (ctx.opad.h[7]);
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_init_128 (&ctx, w0, w1, w2, w3, w4, w5, w6, w7);
w0[0] = lastKey[ 0];
w0[1] = lastKey[ 1];
w0[2] = lastKey[ 2];
w0[3] = lastKey[ 3];
w1[0] = lastKey[ 4];
w1[1] = lastKey[ 5];
w1[2] = lastKey[ 6];
w1[3] = lastKey[ 7];
w2[0] = lastKey[ 8];
w2[1] = lastKey[ 9];
w2[2] = lastKey[10];
w2[3] = lastKey[11];
w3[0] = lastKey[12];
w3[1] = lastKey[13];
w3[2] = lastKey[14];
w3[3] = lastKey[15];
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 (&ctx, w0, w1, w2, w3, w4, w5, w6, w7, 64);
sha512_hmac_final (&ctx);
#define il_pos 0
if ((expectedHmac[0] == h32_from_64_S (ctx.opad.h[0]))
&& (expectedHmac[1] == l32_from_64_S (ctx.opad.h[0]))
&& (expectedHmac[2] == h32_from_64_S (ctx.opad.h[1]))
&& (expectedHmac[3] == l32_from_64_S (ctx.opad.h[1])))
{
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);
}
}
}

@ -176,7 +176,7 @@ _hashcat ()
{
local VERSION=4.0.0
local HASH_MODES="0 10 11 12 20 21 22 23 30 40 50 60 100 101 110 111 112 120 121 122 124 130 131 132 133 140 141 150 160 200 300 400 500 501 600 900 1000 1100 1400 1410 1411 1420 1421 1430 1440 1441 1450 1460 1500 1600 1700 1710 1711 1720 1722 1730 1731 1740 1750 1760 1800 2100 2400 2410 2500 2501 2600 2611 2612 2711 2811 3000 3100 3200 3710 3711 3800 3910 4010 4110 4300 4400 4500 4520 4521 4522 4700 4800 4900 5000 5100 5200 5300 5400 5500 5600 5700 5800 6000 6100 6211 6212 6213 6221 6222 6223 6231 6232 6233 6241 6242 6243 6300 6400 6500 6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7700 7800 7900 8000 8100 8200 8300 8400 8500 8600 8700 8800 8900 9000 9100 9200 9300 9400 9500 9600 9700 9710 9720 9800 9810 9820 9900 10000 10100 10200 10300 10400 10410 10420 10500 10600 10700 10800 10900 11000 11100 11200 11300 11400 11500 11600 11700 11800 11900 12000 12001 12100 12200 12300 12400 12500 12600 12700 12800 12900 13000 13100 13200 13300 13400 13500 13600 13800 13900 14000 14100 14700 14800 14900 15000 15100 15200 15300 15400 15500 15600 15700"
local HASH_MODES="0 10 11 12 20 21 22 23 30 40 50 60 100 101 110 111 112 120 121 122 124 130 131 132 133 140 141 150 160 200 300 400 500 501 600 900 1000 1100 1400 1410 1411 1420 1421 1430 1440 1441 1450 1460 1500 1600 1700 1710 1711 1720 1722 1730 1731 1740 1750 1760 1800 2100 2400 2410 2500 2501 2600 2611 2612 2711 2811 3000 3100 3200 3710 3711 3800 3910 4010 4110 4300 4400 4500 4520 4521 4522 4700 4800 4900 5000 5100 5200 5300 5400 5500 5600 5700 5800 6000 6100 6211 6212 6213 6221 6222 6223 6231 6232 6233 6241 6242 6243 6300 6400 6500 6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7700 7800 7900 8000 8100 8200 8300 8400 8500 8600 8700 8800 8900 9000 9100 9200 9300 9400 9500 9600 9700 9710 9720 9800 9810 9820 9900 10000 10100 10200 10300 10400 10410 10420 10500 10600 10700 10800 10900 11000 11100 11200 11300 11400 11500 11600 11700 11800 11900 12000 12001 12100 12200 12300 12400 12500 12600 12700 12800 12900 13000 13100 13200 13300 13400 13500 13600 13800 13900 14000 14100 14700 14800 14900 15000 15100 15200 15300 15400 15500 15600 15700 15900"
local ATTACK_MODES="0 1 3 6 7"
local HCCAPX_MESSAGE_PAIR="0 1 2 3 4 5"
local OUTFILE_FORMATS="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"

@ -426,7 +426,6 @@ typedef struct psafe3
typedef struct dpapimk
{
u32 version;
u32 context;
u32 SID[32];
@ -882,9 +881,8 @@ typedef struct keepass_tmp
} keepass_tmp_t;
typedef struct dpapimk_tmp
typedef struct dpapimk_tmp_v1
{
/* dedicated to hmac-sha1 */
u32 ipad[5];
u32 opad[5];
u32 dgst[10];
@ -892,13 +890,18 @@ typedef struct dpapimk_tmp
u32 userKey[5];
/* dedicated to hmac-sha512 */
} dpapimk_tmp_t_v1;
typedef struct dpapimk_tmp_v2
{
u64 ipad64[8];
u64 opad64[8];
u64 dgst64[16];
u64 out64[16];
u32 userKey[5];
} dpapimk_tmp_t;
} dpapimk_tmp_t_v2;
typedef struct seven_zip_hook
{
@ -1276,6 +1279,8 @@ typedef enum display_len
DISPLAY_LEN_MAX_15600 = 11 + 1 + 6 + 1 + 64 + 1 + 64 + 1 + 64,
DISPLAY_LEN_MIN_15700 = 11 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 64 + 1 + 64 + 1 + 64,
DISPLAY_LEN_MAX_15700 = 11 + 1 + 6 + 1 + 1 + 1 + 1 + 1 + 64 + 1 + 64 + 1 + 64,
DISPLAY_LEN_MIN_15900 = 1 + 7 + 1 + 1 + 1 + 1 + 1 + 10 + 1 + 4 + 1 + 4 + 1 + 1 + 1 + 32 + 1 + 3 + 1 + 128,
DISPLAY_LEN_MAX_15900 = 1 + 7 + 1 + 1 + 1 + 1 + 1 + 100 + 1 + 6 + 1 + 6 + 1 + 10 + 1 + 32 + 1 + 4 + 1 + 512,
DISPLAY_LEN_MIN_99999 = 1,
DISPLAY_LEN_MAX_99999 = 55,
@ -1594,11 +1599,12 @@ typedef enum kern_type
KERN_TYPE_SKIP32 = 14900,
KERN_TYPE_FILEZILLA_SERVER = 15000,
KERN_TYPE_NETBSD_SHA1CRYPT = 15100,
KERN_TYPE_DPAPIMK = 15300,
KERN_TYPE_DPAPIMK_V1 = 15300,
KERN_TYPE_CHACHA20 = 15400,
KERN_TYPE_JKS_SHA1 = 15500,
KERN_TYPE_ETHEREUM_PBKDF2 = 15600,
KERN_TYPE_ETHEREUM_SCRYPT = 15700,
KERN_TYPE_DPAPIMK_V2 = 15900,
KERN_TYPE_PLAINTEXT = 99999,
} kern_type_t;
@ -1670,7 +1676,8 @@ typedef enum rounds_count
ROUNDS_ITUNES102_BACKUP = 10000,
ROUNDS_ATLASSIAN = 10000,
ROUNDS_NETBSD_SHA1CRYPT = 20000,
ROUNDS_DPAPIMK = 24000 - 1, // from 4000 to 24000 (possibly more)
ROUNDS_DPAPIMK_V1 = 24000 - 1, // from 4000 to 24000 (possibly more)
ROUNDS_DPAPIMK_V2 = 8000 - 1, // from 4000 to 24000 (possibly more)
ROUNDS_ETHEREUM_PBKDF2 = 262144 - 1,
ROUNDS_STDOUT = 0

@ -6,7 +6,7 @@
#include "common.h"
#include "benchmark.h"
const unsigned int DEFAULT_BENCHMARK_ALGORITHMS_CNT = 155;
const unsigned int DEFAULT_BENCHMARK_ALGORITHMS_CNT = 156;
const unsigned int DEFAULT_BENCHMARK_ALGORITHMS_BUF[] =
{
@ -87,6 +87,7 @@ const unsigned int DEFAULT_BENCHMARK_ALGORITHMS_BUF[] =
1100,
2100,
15300,
15900,
12800,
1500,
12400,

@ -259,11 +259,12 @@ static char ST_HASH_14900[] = "7090b6b9:04223875";
static char ST_HASH_15000[] = "bfa9fe5a404faff8b0d200385e26b783a163e475869336029d3ebaccaf02b5f16e4949279e8a33b942ab647f8f19a83dbe89a6d39dd6d8f84812de7d2e556767:6422386434050716105781561510557063652302782465168686858312232148";
static char ST_HASH_15100[] = "$sha1$20000$75552156$HhYMDdaEHiK3eMIzTldOFPnw.s2Q";
static char ST_HASH_15200[] = "$blockchain$v2$5000$288$324724252428471806184866704068819419467b2b32fd9593fd1a274e0b68bf2c72e5a1f5e748fd319056d1e47ca7b40767136a2d97d7133d14faaeca50986f66cdbc0faec0a3fabbd0ba5d08d5322b6b53da021aacfc439c45bec0e9fe02ad81db82f94e9bd36a7d4d76b505c2339fcd46565d3abab958fbeb1de8bfc53beb96cde8fe44128965477c9ef0762c62bbb1d66532b4888e174ea949db54374a2ed9686a63eb0b5b17ae293f7410bb4ae5106f108314a259c5fd097d558515d79350713412159103a8a174cd384a14f3da45efe18044e1146036000231f6042577d0add98fc959d265368e398dc1550b0bc693e9023cd9d51b40e701bd786e19c3a281a90465aa6ea3f9e756d430164ab2eb43be5b6796d7ac15b2fe99217410f2";
static char ST_HASH_15300[] = "$DPAPImk$2*1*S-15-21-439882973-489230393-482956683-1522*aes256*sha512*12900*79f7ca399f2626e21aad108c3922af7c*288*c47bc8a985ca6aa708b01c97b004bff20cc52379dc2635b4acf59ce17970a2cb47ace98c7e8de977f265243c5c03d0a97e4b954b494d9e38d9158d0c1e729d16a28ba69e2e7c6c3bc0e3afc9c9b6306b83372ccb35d89b98925728fd36315b8ee95b4d4eccdcb31564769f9a4b9ee10828184e16d4af336675d5e31d987dd87233d34fbbb98880c5e1f64cbb9b043ad8";
static char ST_HASH_15300[] = "$DPAPImk$1*1*S-15-21-466364039-425773974-453930460-1925*des3*sha1*24000*b038489dee5ad04e3e3cab4d957258b5*208*cb9b5b7d96a0d2a00305ca403d3fd9c47c561e35b4b2cf3aebfd1d3199a6481d56972be7ebd6c291b199e6f1c2ffaee91978706737e9b1209e6c7d3aa3d8c3c3e38ad1ccfa39400d62c2415961c17fd0bd6b0f7bbd49cc1de1a394e64b7237f56244238da8d37d78";
static char ST_HASH_15400[] = "$chacha20$*0400000000000003*35*0200000000000001*3961626364656667*8a152c57a7a856a8";
static char ST_HASH_15500[] = "$jksprivk$*338BD2FBEBA7B3EF198A4CBFC6E18AFF1E229367*5225850113575146134463704406336350011656*D5253EB151EB92DC73E542D8C0A4D7A848A5B0C0E370E625E6547D4E6F23416FC85A27BC295731B8021CDFBD003551C66C434FFBC87DACAD1FDF39022320034A2F86E779F2B1B3325428A666518FA89507AD63E15FD9C57B9E36EF5B642A2F448A9A3F09B79AD93D65F46B8692CD07539FD140146F8F219DC262971AF019E18EDC16C3C240569E1673F4D98BC818CCF28298D5A7BFF038A663DD10FE5E48643C3217C237D342164E2D41EF15075431FBD5B34800E5AE7EB80FAA5AE9982A55F35379AA7B31217E7F1C5F1964A15024A305AE4B3981FE1C80C163BC38ECA5581F11867E5C34C5D124D0367B3737E5E5BB14D2CAB26A698C8DAAB755C82BA6B823BCAECDD4A89C831651ACE5A6029FD0D3515C5D1D53AD8B9062CE8C445373862035CBBF60D490CA2E4975EE6E0358EC32E871FAB15347E3032E21F30F543BAAB01D779BA833CA0B8C7591B42C7C59A8FDD46D7DECEC0E91ADBF331177605E7830ABED62FAD7D5D806D8EFD01C38765940B7F97168FC72C39BF4C98F944FFC310CA8F4EB1D0F960F352CC5E2BB23A1EB221072A5471EDA2CE81C04595B8D37088CFB5C14F6A4A881AD12125DEFBB8154EB4C130AB7FD9933FD36DF1A6A26B51AB169866788678FCED988C8E017CA84354F487A5508210181AFB8B3AD0753E3E28BE674DFBD4E4FBDFD1E30D592F4EA3A77A2F0F5CF9A175DBC590EF5D42971A39918F12B92DCD8BFD56BE9A3459856B5587603C7B53062663A4C8894BBC9894FB1663BF30F32D907664328138B7A50EAC7F8E3183D74562A5C90FE1889AC4C5FE43EBEB8974563B6682F92591ECA4FA0DA72236C3851DA102DB6BA0CC07BFD32F7E962AB0EDCF4A8DEA6525174F5BB5C021E2A9A3F7F761E9CA90B6E27FB7E55CD91DA184FAC5E534E8AD25314C56CE5796506A0CA70881782F9C5147D87705065D68BD67D2B0344205BA6445D562273690004CA5A303274FB283A75F49BA968D7947943AA98F2AF9CB8253B425B86225E7395A331AC4CB1B1700C64D4F458D5D642C54148AE6DA41D9E26657D331B157D76042C2CF3057B83997C23D8BF68FB3C7337CAFB8B324AD0DF7A80B554B4D7F9AD6ED527E7932F1741A573C152A41610F6517E3F4A3BC6B66685871A7CE3795C559BD47CDB8E34CB2C1DFE980518D79E2078C258C54F312EB38609F640E7DC013E0F2A16A25BB5971882B4308D27930CA99FEC231AE927B62215A1B56098C362B7F20593953B29428681875070E84BF5B60BEA3948127151634123DA77C814AAD54CE10905763C8C19BC191C0C40458C809402E1957C4C05C4EAE27576B2D30593F7FDCC9A248DB5DB23CF2FA22A92C016090F611690BF0AB5B8B2866ED25F345EFE85DF3311C9E91C37CEE709CF16E7CB09D01BECD2961D094C02D42EC85BF47FAB1B67A13B9A1741C15F7156D57A71BFFABB03B71E69707913A5C136B3D69CE3F71ABFE376F0A21D723FFA2E60AC180689D3E8AF4348C9F555CD897387327FC8BA2B9C51A7298547E556A11A60441EF5331A1BFB847A3D23DD9F7C50E636A2C6309BC82E1A8852F5A8569B6D93*14*78D6A2424484CF5149932B7EA8BF*test";
static char ST_HASH_15600[] = "$ethereum$p*1024*38353131353831333338313138363430*a8b4dfe92687dbc0afeb5dae7863f18964241e96b264f09959903c8c924583fc*0a9252861d1e235994ce33dbca91c98231764d8ecb4950015a8ae20d6415b986";
static char ST_HASH_15700[] = "$ethereum$s*1024*1*1*3033363133373132373638333437323331383637383437333631373038323434*69eaf081695cf971ef7ee5a49997c1a3922e7efef59068109e83853755ee31c3*64a1adec1750ee4416b22b81111dd2a3c2fede820d6da8bf788dca2641d5b181";
static char ST_HASH_15900[] = "$DPAPImk$2*1*S-15-21-439882973-489230393-482956683-1522*aes256*sha512*12900*79f7ca399f2626e21aad108c3922af7c*288*c47bc8a985ca6aa708b01c97b004bff20cc52379dc2635b4acf59ce17970a2cb47ace98c7e8de977f265243c5c03d0a97e4b954b494d9e38d9158d0c1e729d16a28ba69e2e7c6c3bc0e3afc9c9b6306b83372ccb35d89b98925728fd36315b8ee95b4d4eccdcb31564769f9a4b9ee10828184e16d4af336675d5e31d987dd87233d34fbbb98880c5e1f64cbb9b043ad8";
static char ST_HASH_99999[] = "hashcat";
static const char OPTI_STR_OPTIMIZED_KERNEL[] = "Optimized-Kernel";
@ -490,11 +491,12 @@ static const char HT_14900[] = "Skip32 (PT = $salt, key = $pass)";
static const char HT_15000[] = "FileZilla Server >= 0.9.55";
static const char HT_15100[] = "Juniper/NetBSD sha1crypt";
static const char HT_15200[] = "Blockchain, My Wallet, V2";
static const char HT_15300[] = "DPAPI masterkey file v1 and v2";
static const char HT_15300[] = "DPAPI masterkey file v1";
static const char HT_15400[] = "ChaCha20";
static const char HT_15500[] = "JKS Java Key Store Private Keys (SHA1)";
static const char HT_15600[] = "Ethereum Wallet, PBKDF2-HMAC-SHA256";
static const char HT_15700[] = "Ethereum Wallet, SCRYPT";
static const char HT_15900[] = "DPAPI masterkey file v2";
static const char HT_99999[] = "Plaintext";
static const char HT_00011[] = "Joomla < 2.5.18";
@ -3098,6 +3100,7 @@ int dcc2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSE
int dpapimk_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig)
{
/* 15300 and 15900 share the same input format */
if ((input_len < DISPLAY_LEN_MIN_15300) || (input_len > DISPLAY_LEN_MAX_15300)) return (PARSER_GLOBAL_LENGTH);
if (memcmp (SIGNATURE_DPAPIMK, input_buf, 9)) return (PARSER_SIGNATURE_UNMATCHED);
@ -3195,8 +3198,6 @@ int dpapimk_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN
if (effective_contents_len != contents_len) return (PARSER_SALT_LENGTH);
dpapimk->version = version;
dpapimk->context = atoll ((const char *) context_pos);
salt->salt_iter = (atoll ((const char *) rounds_pos)) - 1;
@ -16109,6 +16110,7 @@ char *strhashtype (const u32 hash_mode)
case 15500: return ((char *) HT_15500);
case 15600: return ((char *) HT_15600);
case 15700: return ((char *) HT_15700);
case 15900: return ((char *) HT_15900);
case 99999: return ((char *) HT_99999);
}
@ -19229,7 +19231,7 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const size_t out_le
dpapimk_t *dpapimk = &dpapimks[digest_cur];
u32 version = (u32) dpapimk->version;
u32 version = 1;
u32 context = (u32) dpapimk->context;
u32 rounds = salt.salt_iter + 1;
u32 contents_len = (u32) dpapimk->contents_len;
@ -19288,21 +19290,9 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const size_t out_le
u32_to_hex_lower (u32_contents[i], contents + i * 8);
}
if (version == 1)
{
contents[208] = 0;
}
else
{
contents[288] = 0;
}
contents[208] = 0;
if (contents_len == 288 && version == 2)
{
memcpy(cipher_algorithm, "aes256", strlen("aes256"));
memcpy(hash_algorithm, "sha512", strlen("sha512"));
}
else if (contents_len == 208 && version == 1)
if (contents_len == 208)
{
memcpy(cipher_algorithm, "des3", strlen("des3"));
memcpy(hash_algorithm, "sha1", strlen("sha1"));
@ -19424,6 +19414,91 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const size_t out_le
digest_buf[7]
);
}
else if (hash_mode == 15900)
{
dpapimk_t *dpapimks = (dpapimk_t *) esalts_buf;
dpapimk_t *dpapimk = &dpapimks[digest_cur];
u32 version = 2;
u32 context = (u32) dpapimk->context;
u32 rounds = salt.salt_iter + 1;
u32 contents_len = (u32) dpapimk->contents_len;
u32 SID_len = (u32) dpapimk->SID_len;
u32 iv_len = 32;
u8 cipher_algorithm[8] = { 0 };
u8 hash_algorithm[8] = { 0 };
u8 SID[512] = { 0 };
u8* SID_tmp;
u32 *ptr_SID = (u32 *) dpapimk->SID;
u32 *ptr_iv = (u32 *) dpapimk->iv;
u32 *ptr_contents = (u32 *) dpapimk->contents;
u32 u32_iv[4];
u8 iv[32 + 1];
/* convert back SID */
SID_tmp = (u8 *) hcmalloc ((SID_len + 1) * sizeof(u8));
for (u32 i = 0; i < (SID_len / 4) + 1; i++)
{
u8 hex[8] = { 0 };
u32_to_hex_lower (byte_swap_32 (ptr_SID[i]), hex);
for (u32 j = 0, k = 0; j < 8; j += 2, k++)
{
SID_tmp[i * 4 + k] = hex_to_u8 (&hex[j]);
}
}
/* overwrite trailing 0x80 */
SID_tmp[SID_len] = 0;
for (u32 i = 0, j = 0 ; j < SID_len ; i++, j += 2)
{
SID[i] = SID_tmp[j];
}
hcfree(SID_tmp);
for (u32 i = 0; i < iv_len / 8; i++)
{
u32_iv[i] = byte_swap_32 (ptr_iv[i]);
u32_to_hex_lower (u32_iv[i], iv + i * 8);
}
iv[32] = 0;
u32 u32_contents[36];
u8 contents[288 + 1];
for (u32 i = 0; i < contents_len / 8; i++)
{
u32_contents[i] = byte_swap_32 (ptr_contents[i]);
u32_to_hex_lower (u32_contents[i], contents + i * 8);
}
contents[288] = 0;
if (contents_len == 288)
{
memcpy(cipher_algorithm, "aes256", strlen("aes256"));
memcpy(hash_algorithm, "sha512", strlen("sha512"));
}
snprintf (out_buf, out_len - 1, "%s%d*%d*%s*%s*%s*%d*%s*%d*%s",
SIGNATURE_DPAPIMK,
version,
context,
SID,
cipher_algorithm,
hash_algorithm,
rounds,
iv,
contents_len,
contents);
}
else if (hash_mode == 99999)
{
char *ptr = (char *) digest_buf;
@ -24262,7 +24337,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->salt_type = SALT_TYPE_EMBEDDED;
hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL;
hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE;
hashconfig->kern_type = KERN_TYPE_DPAPIMK;
hashconfig->kern_type = KERN_TYPE_DPAPIMK_V1;
hashconfig->dgst_size = DGST_SIZE_4_4;
hashconfig->parse_func = dpapimk_parse_hash;
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
@ -24350,6 +24425,23 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN;
break;
case 15900: hashconfig->hash_type = HASH_TYPE_DPAPIMK;
hashconfig->salt_type = SALT_TYPE_EMBEDDED;
hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL;
hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE;
hashconfig->kern_type = KERN_TYPE_DPAPIMK_V2;
hashconfig->dgst_size = DGST_SIZE_4_4;
hashconfig->parse_func = dpapimk_parse_hash;
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP;
hashconfig->dgst_pos0 = 0;
hashconfig->dgst_pos1 = 1;
hashconfig->dgst_pos2 = 2;
hashconfig->dgst_pos3 = 3;
hashconfig->st_hash = ST_HASH_15900;
hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN;
break;
case 99999: hashconfig->hash_type = HASH_TYPE_PLAINTEXT;
hashconfig->salt_type = SALT_TYPE_NONE;
hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL;
@ -24557,6 +24649,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
case 15500: hashconfig->esalt_size = sizeof (jks_sha1_t); break;
case 15600: hashconfig->esalt_size = sizeof (ethereum_pbkdf2_t); break;
case 15700: hashconfig->esalt_size = sizeof (ethereum_scrypt_t); break;
case 15900: hashconfig->esalt_size = sizeof (dpapimk_t); break;
}
// hook_salt_size
@ -24661,8 +24754,9 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
case 14800: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break;
case 15100: hashconfig->tmp_size = sizeof (pbkdf1_sha1_tmp_t); break;
case 15200: hashconfig->tmp_size = sizeof (mywallet_tmp_t); break;
case 15300: hashconfig->tmp_size = sizeof (dpapimk_tmp_t); break;
case 15300: hashconfig->tmp_size = sizeof (dpapimk_tmp_t_v1); break;
case 15600: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break;
case 15900: hashconfig->tmp_size = sizeof (dpapimk_tmp_t_v2); break;
};
// hook_size
@ -24900,6 +24994,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
case 15400: hashconfig->pw_max = 32; break; // Underlaying ChaCha20 fixed
case 15600: hashconfig->pw_max = PW_MAX; break;
case 15700: hashconfig->pw_max = PW_MAX; break;
case 15900: hashconfig->pw_max = PW_MAX; break;
}
// salt_min and salt_max : this limit is only interessting for generic hash types that support a salt
@ -25338,8 +25433,6 @@ void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, vo
((luks_t *) esalt)->cipher_type = HC_LUKS_CIPHER_TYPE_AES;
((luks_t *) esalt)->cipher_mode = HC_LUKS_CIPHER_MODE_XTS_PLAIN;
break;
case 15300: ((dpapimk_t *) esalt)->version = 1;
break;
}
// special hook salt handling
@ -25536,12 +25629,14 @@ void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, vo
break;
case 15200: salt->salt_iter = ROUNDS_MYWALLETV2;
break;
case 15300: salt->salt_iter = ROUNDS_DPAPIMK;
case 15300: salt->salt_iter = ROUNDS_DPAPIMK_V1;
break;
case 15600: salt->salt_iter = ROUNDS_ETHEREUM_PBKDF2;
break;
case 15700: salt->salt_iter = 1;
break;
case 15900: salt->salt_iter = ROUNDS_DPAPIMK_V2;
break;
}
}

@ -248,7 +248,8 @@ static const char *USAGE_BIG[] =
" 1000 | NTLM | Operating Systems",
" 1100 | Domain Cached Credentials (DCC), MS Cache | Operating Systems",
" 2100 | Domain Cached Credentials 2 (DCC2), MS Cache 2 | Operating Systems",
" 15300 | DPAPI masterkey file v1 and v2 | Operating Systems",
" 15300 | DPAPI masterkey file v1 | Operating Systems",
" 15900 | DPAPI masterkey file v2 | Operating Systems",
" 12800 | MS-AzureSync PBKDF2-HMAC-SHA256 | Operating Systems",
" 1500 | descrypt, DES (Unix), Traditional DES | Operating Systems",
" 12400 | BSDi Crypt, Extended DES | Operating Systems",

@ -9,7 +9,7 @@ TDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# missing hash types: 5200,6251,6261,6271,6281
HASH_TYPES="0 10 11 12 20 21 22 23 30 40 50 60 100 101 110 111 112 120 121 122 125 130 131 132 133 140 141 150 160 200 300 400 500 600 900 1000 1100 1300 1400 1410 1411 1420 1430 1440 1441 1450 1460 1500 1600 1700 1710 1711 1720 1722 1730 1731 1740 1750 1760 1800 2100 2400 2410 2500 2600 2611 2612 2711 2811 3000 3100 3200 3710 3711 3800 3910 4010 4110 4300 4400 4500 4520 4521 4522 4700 4800 4900 5000 5100 5300 5400 5500 5600 5700 5800 6000 6100 6211 6212 6213 6221 6222 6223 6231 6232 6233 6241 6242 6243 6300 6400 6500 6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7700 7800 7900 8000 8100 8200 8300 8400 8500 8600 8700 8900 9100 9200 9300 9400 9500 9600 9700 9800 9900 10000 10100 10200 10300 10400 10500 10600 10700 10800 10900 11000 11100 11200 11300 11400 11500 11600 11900 12000 12001 12100 12200 12300 12400 12600 12700 12800 12900 13000 13100 13200 13300 13400 13500 13600 13800 13900 14000 14100 14400 14600 14700 14800 14900 15000 15100 15200 15300 15400 15500 15600 15700 99999"
HASH_TYPES="0 10 11 12 20 21 22 23 30 40 50 60 100 101 110 111 112 120 121 122 125 130 131 132 133 140 141 150 160 200 300 400 500 600 900 1000 1100 1300 1400 1410 1411 1420 1430 1440 1441 1450 1460 1500 1600 1700 1710 1711 1720 1722 1730 1731 1740 1750 1760 1800 2100 2400 2410 2500 2600 2611 2612 2711 2811 3000 3100 3200 3710 3711 3800 3910 4010 4110 4300 4400 4500 4520 4521 4522 4700 4800 4900 5000 5100 5300 5400 5500 5600 5700 5800 6000 6100 6211 6212 6213 6221 6222 6223 6231 6232 6233 6241 6242 6243 6300 6400 6500 6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7700 7800 7900 8000 8100 8200 8300 8400 8500 8600 8700 8900 9100 9200 9300 9400 9500 9600 9700 9800 9900 10000 10100 10200 10300 10400 10500 10600 10700 10800 10900 11000 11100 11200 11300 11400 11500 11600 11900 12000 12001 12100 12200 12300 12400 12600 12700 12800 12900 13000 13100 13200 13300 13400 13500 13600 13800 13900 14000 14100 14400 14600 14700 14800 14900 15000 15100 15200 15300 15400 15500 15600 15700 15900 99999"
#ATTACK_MODES="0 1 3 6 7"
ATTACK_MODES="0 1 3 7"
@ -22,7 +22,7 @@ HASHFILE_ONLY="2500"
NEVER_CRACK="11600 14900"
SLOW_ALGOS="400 500 501 1600 1800 2100 2500 3200 5200 5800 6211 6212 6213 6221 6222 6223 6231 6232 6233 6241 6242 6243 6251 6261 6271 6281 6300 6400 6500 6600 6700 6800 7100 7200 7400 7900 8200 8800 8900 9000 9100 9200 9300 9400 9500 9600 10000 10300 10500 10700 10900 11300 11600 11900 12000 12001 12100 12200 12300 12400 12500 12700 12800 12900 13000 13200 13400 13600 14600 14700 14800 15100 15200 15300 15600 15700"
SLOW_ALGOS="400 500 501 1600 1800 2100 2500 3200 5200 5800 6211 6212 6213 6221 6222 6223 6231 6232 6233 6241 6242 6243 6251 6261 6271 6281 6300 6400 6500 6600 6700 6800 7100 7200 7400 7900 8200 8800 8900 9000 9100 9200 9300 9400 9500 9600 10000 10300 10500 10700 10900 11300 11600 11900 12000 12001 12100 12200 12300 12400 12500 12700 12800 12900 13000 13200 13400 13600 14600 14700 14800 15100 15200 15300 15600 15700 15900"
OPTS="--quiet --force --potfile-disable --runtime 400 --gpu-temp-disable"

Loading…
Cancel
Save