diff --git a/OpenCL/m13711-pure.cl b/OpenCL/m13711-pure.cl index a8a38daa0..36ae740a7 100644 --- a/OpenCL/m13711-pure.cl +++ b/OpenCL/m13711-pure.cl @@ -21,7 +21,6 @@ typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -58,7 +57,7 @@ typedef struct vc_tmp } vc_tmp_t; -DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -80,11 +79,11 @@ DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u32 key2[6] = key[14]; key2[7] = key[15]; - 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; - 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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } @@ -209,7 +208,7 @@ KERNEL_FQ void m13711_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) 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_HOST].salt_buf, 64); + ripemd160_hmac_update_global (&ripemd160_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 16; i += 5, j += 1) { @@ -449,7 +448,7 @@ KERNEL_FQ void m13711_loop_extended (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) if (pim_check) { - 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) + if (check_header_0512 (esalt_bufs, kernel_param, 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_check; } @@ -519,18 +518,18 @@ KERNEL_FQ void m13711_comp (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) if (tmps[gid].pim) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 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 (check_header_0512 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m13712-pure.cl b/OpenCL/m13712-pure.cl index ac5a8a932..11acc1753 100644 --- a/OpenCL/m13712-pure.cl +++ b/OpenCL/m13712-pure.cl @@ -21,7 +21,6 @@ typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -58,7 +57,7 @@ typedef struct vc_tmp } vc_tmp_t; -DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -80,16 +79,16 @@ DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u32 key2[6] = key[14]; key2[7] = key[15]; - 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; - 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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } -DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -129,13 +128,13 @@ DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u32 key4[6] = key[30]; key4[7] = key[31]; - 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_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_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_twofish (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_serpent_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_aes_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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_camellia_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } @@ -260,7 +259,7 @@ KERNEL_FQ void m13712_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) 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_HOST].salt_buf, 64); + ripemd160_hmac_update_global (&ripemd160_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 32; i += 5, j += 1) { @@ -500,12 +499,12 @@ KERNEL_FQ void m13712_loop_extended (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) if (pim_check) { - 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) + if (check_header_0512 (esalt_bufs, kernel_param, 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_check; } - 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) + if (check_header_1024 (esalt_bufs, kernel_param, 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_check; } @@ -575,26 +574,26 @@ KERNEL_FQ void m13712_comp (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) if (tmps[gid].pim) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 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 (check_header_0512 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 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 (check_header_1024 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m13713-pure.cl b/OpenCL/m13713-pure.cl index 33a998b16..e03a1e86a 100644 --- a/OpenCL/m13713-pure.cl +++ b/OpenCL/m13713-pure.cl @@ -21,7 +21,6 @@ typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -58,7 +57,7 @@ typedef struct vc_tmp } vc_tmp_t; -DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -80,16 +79,16 @@ DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u32 key2[6] = key[14]; key2[7] = key[15]; - 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; - 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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } -DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -129,18 +128,18 @@ DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u32 key4[6] = key[30]; key4[7] = key[31]; - 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_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_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_twofish (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_serpent_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_aes_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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_camellia_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } -DECLSPEC int check_header_1536 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_1536 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -198,9 +197,9 @@ DECLSPEC int check_header_1536 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u32 key6[6] = key[46]; key6[7] = key[47]; - 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; - 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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4, key5, key6) == 1) return 0; + if (verify_header_aes_twofish_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } @@ -325,7 +324,7 @@ KERNEL_FQ void m13713_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) 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_HOST].salt_buf, 64); + ripemd160_hmac_update_global (&ripemd160_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 48; i += 5, j += 1) { @@ -565,17 +564,17 @@ KERNEL_FQ void m13713_loop_extended (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) if (pim_check) { - 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) + if (check_header_0512 (esalt_bufs, kernel_param, 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_check; } - 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) + if (check_header_1024 (esalt_bufs, kernel_param, 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_check; } - 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) + if (check_header_1536 (esalt_bufs, kernel_param, 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_check; } @@ -645,34 +644,34 @@ KERNEL_FQ void m13713_comp (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) if (tmps[gid].pim) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 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 (check_header_0512 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 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 (check_header_1024 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 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 (check_header_1536 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m13721-pure.cl b/OpenCL/m13721-pure.cl index 9804ed2e9..978497b58 100644 --- a/OpenCL/m13721-pure.cl +++ b/OpenCL/m13721-pure.cl @@ -21,7 +21,6 @@ typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -58,7 +57,7 @@ typedef struct vc64_tmp } vc64_tmp_t; -DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -80,11 +79,11 @@ DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u64 key2[6] = hc_swap32_S (h32_from_64_S (key[7])); key2[7] = hc_swap32_S (l32_from_64_S (key[7])); - 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; - 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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } @@ -237,7 +236,7 @@ KERNEL_FQ void m13721_init (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t)) 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_HOST].salt_buf, 64); + sha512_hmac_update_global_swap (&sha512_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 8; i += 8, j += 1) { @@ -547,7 +546,7 @@ KERNEL_FQ void m13721_loop_extended (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t)) if (pim_check) { - 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) + if (check_header_0512 (esalt_bufs, kernel_param, 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_check; } @@ -617,18 +616,18 @@ KERNEL_FQ void m13721_comp (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t)) if (tmps[gid].pim) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 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 (check_header_0512 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m13722-pure.cl b/OpenCL/m13722-pure.cl index 7b57d1e34..12590f2fb 100644 --- a/OpenCL/m13722-pure.cl +++ b/OpenCL/m13722-pure.cl @@ -21,7 +21,6 @@ typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -58,7 +57,7 @@ typedef struct vc64_tmp } vc64_tmp_t; -DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -80,16 +79,16 @@ DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u64 key2[6] = hc_swap32_S (h32_from_64_S (key[7])); key2[7] = hc_swap32_S (l32_from_64_S (key[7])); - 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; - 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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } -DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -129,13 +128,13 @@ DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u64 key4[6] = hc_swap32_S (h32_from_64_S (key[15])); key4[7] = hc_swap32_S (l32_from_64_S (key[15])); - 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_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_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_twofish (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_serpent_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_aes_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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_camellia_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } @@ -288,7 +287,7 @@ KERNEL_FQ void m13722_init (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t)) 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_HOST].salt_buf, 64); + sha512_hmac_update_global_swap (&sha512_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 16; i += 8, j += 1) { @@ -598,12 +597,12 @@ KERNEL_FQ void m13722_loop_extended (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t)) if (pim_check) { - 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) + if (check_header_0512 (esalt_bufs, kernel_param, 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_check; } - 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) + if (check_header_1024 (esalt_bufs, kernel_param, 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_check; } @@ -673,26 +672,26 @@ KERNEL_FQ void m13722_comp (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t)) if (tmps[gid].pim) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 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 (check_header_0512 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 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 (check_header_1024 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m13723-pure.cl b/OpenCL/m13723-pure.cl index 13ab8a772..8d67e7c7a 100644 --- a/OpenCL/m13723-pure.cl +++ b/OpenCL/m13723-pure.cl @@ -21,7 +21,6 @@ typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -58,7 +57,7 @@ typedef struct vc64_tmp } vc64_tmp_t; -DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -80,16 +79,16 @@ DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u64 key2[6] = hc_swap32_S (h32_from_64_S (key[7])); key2[7] = hc_swap32_S (l32_from_64_S (key[7])); - 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; - 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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } -DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -129,18 +128,18 @@ DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u64 key4[6] = hc_swap32_S (h32_from_64_S (key[15])); key4[7] = hc_swap32_S (l32_from_64_S (key[15])); - 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_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_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_twofish (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_serpent_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_aes_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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_camellia_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } -DECLSPEC int check_header_1536 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_1536 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -198,9 +197,9 @@ DECLSPEC int check_header_1536 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u64 key6[6] = hc_swap32_S (h32_from_64_S (key[23])); key6[7] = hc_swap32_S (l32_from_64_S (key[23])); - 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; - 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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4, key5, key6) == 1) return 0; + if (verify_header_aes_twofish_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } @@ -353,7 +352,7 @@ KERNEL_FQ void m13723_init (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t)) 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_HOST].salt_buf, 64); + sha512_hmac_update_global_swap (&sha512_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 24; i += 8, j += 1) { @@ -663,17 +662,17 @@ KERNEL_FQ void m13723_loop_extended (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t)) if (pim_check) { - 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) + if (check_header_0512 (esalt_bufs, kernel_param, 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_check; } - 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) + if (check_header_1024 (esalt_bufs, kernel_param, 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_check; } - 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) + if (check_header_1536 (esalt_bufs, kernel_param, 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_check; } @@ -743,34 +742,34 @@ KERNEL_FQ void m13723_comp (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t)) if (tmps[gid].pim) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 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 (check_header_0512 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 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 (check_header_1024 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 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 (check_header_1536 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m13731-pure.cl b/OpenCL/m13731-pure.cl index 3bcee42d4..bf6109688 100644 --- a/OpenCL/m13731-pure.cl +++ b/OpenCL/m13731-pure.cl @@ -21,7 +21,6 @@ typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -58,7 +57,7 @@ typedef struct vc_tmp } vc_tmp_t; -DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -80,11 +79,11 @@ DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u32 key2[6] = hc_swap32_S (key[14]); key2[7] = hc_swap32_S (key[15]); - 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; - 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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } @@ -333,7 +332,7 @@ KERNEL_FQ void m13731_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) 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_HOST].salt_buf, 64); + whirlpool_hmac_update_global_swap (&whirlpool_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 16; i += 16, j += 1) { @@ -727,7 +726,7 @@ KERNEL_FQ void m13731_loop_extended (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) if (pim_check) { - 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) + if (check_header_0512 (esalt_bufs, kernel_param, 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_check; } @@ -797,18 +796,18 @@ KERNEL_FQ void m13731_comp (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) if (tmps[gid].pim) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 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 (check_header_0512 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m13732-pure.cl b/OpenCL/m13732-pure.cl index 6b285d227..5cebed18e 100644 --- a/OpenCL/m13732-pure.cl +++ b/OpenCL/m13732-pure.cl @@ -21,7 +21,6 @@ typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -58,7 +57,7 @@ typedef struct vc_tmp } vc_tmp_t; -DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -80,16 +79,16 @@ DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u32 key2[6] = hc_swap32_S (key[14]); key2[7] = hc_swap32_S (key[15]); - 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; - 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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } -DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -129,13 +128,13 @@ DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u32 key4[6] = hc_swap32_S (key[30]); key4[7] = hc_swap32_S (key[31]); - 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_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_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_twofish (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_serpent_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_aes_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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_camellia_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } @@ -384,7 +383,7 @@ KERNEL_FQ void m13732_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) 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_HOST].salt_buf, 64); + whirlpool_hmac_update_global_swap (&whirlpool_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 32; i += 16, j += 1) { @@ -778,12 +777,12 @@ KERNEL_FQ void m13732_loop_extended (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) if (pim_check) { - 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) + if (check_header_0512 (esalt_bufs, kernel_param, 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_check; } - 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) + if (check_header_1024 (esalt_bufs, kernel_param, 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_check; } @@ -853,26 +852,26 @@ KERNEL_FQ void m13732_comp (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) if (tmps[gid].pim) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 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 (check_header_0512 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 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 (check_header_1024 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m13733-pure.cl b/OpenCL/m13733-pure.cl index 2b914ccb2..a16ee5740 100644 --- a/OpenCL/m13733-pure.cl +++ b/OpenCL/m13733-pure.cl @@ -21,7 +21,6 @@ typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -58,7 +57,7 @@ typedef struct vc_tmp } vc_tmp_t; -DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -80,16 +79,16 @@ DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u32 key2[6] = hc_swap32_S (key[14]); key2[7] = hc_swap32_S (key[15]); - 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; - 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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } -DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -129,18 +128,18 @@ DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u32 key4[6] = hc_swap32_S (key[30]); key4[7] = hc_swap32_S (key[31]); - 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_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_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_twofish (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_serpent_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_aes_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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_camellia_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } -DECLSPEC int check_header_1536 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_1536 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -198,9 +197,9 @@ DECLSPEC int check_header_1536 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u32 key6[6] = hc_swap32_S (key[46]); key6[7] = hc_swap32_S (key[47]); - 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; - 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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4, key5, key6) == 1) return 0; + if (verify_header_aes_twofish_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } @@ -449,7 +448,7 @@ KERNEL_FQ void m13733_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) 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_HOST].salt_buf, 64); + whirlpool_hmac_update_global_swap (&whirlpool_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 48; i += 16, j += 1) { @@ -843,17 +842,17 @@ KERNEL_FQ void m13733_loop_extended (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) if (pim_check) { - 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) + if (check_header_0512 (esalt_bufs, kernel_param, 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_check; } - 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) + if (check_header_1024 (esalt_bufs, kernel_param, 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_check; } - 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) + if (check_header_1536 (esalt_bufs, kernel_param, 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_check; } @@ -923,34 +922,34 @@ KERNEL_FQ void m13733_comp (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) if (tmps[gid].pim) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 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 (check_header_0512 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 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 (check_header_1024 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 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 (check_header_1536 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m13751-pure.cl b/OpenCL/m13751-pure.cl index 18a3d07ac..cd7a2dbd8 100644 --- a/OpenCL/m13751-pure.cl +++ b/OpenCL/m13751-pure.cl @@ -21,7 +21,6 @@ typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -58,7 +57,7 @@ typedef struct vc_tmp } vc_tmp_t; -DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -80,11 +79,11 @@ DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u32 key2[6] = hc_swap32_S (key[14]); key2[7] = hc_swap32_S (key[15]); - 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; - 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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } @@ -221,7 +220,7 @@ KERNEL_FQ void m13751_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) tmps[gid].opad[6] = sha256_hmac_ctx.opad.h[6]; tmps[gid].opad[7] = sha256_hmac_ctx.opad.h[7]; - sha256_hmac_update_global_swap (&sha256_hmac_ctx, esalt_bufs[DIGESTS_OFFSET_HOST].salt_buf, 64); + sha256_hmac_update_global_swap (&sha256_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 16; i += 8, j += 1) { @@ -524,7 +523,7 @@ KERNEL_FQ void m13751_loop_extended (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) if (pim_check) { - 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) + if (check_header_0512 (esalt_bufs, kernel_param, 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_check; } @@ -594,18 +593,18 @@ KERNEL_FQ void m13751_comp (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) if (tmps[gid].pim) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 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 (check_header_0512 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m13752-pure.cl b/OpenCL/m13752-pure.cl index a40842f95..a7a977e31 100644 --- a/OpenCL/m13752-pure.cl +++ b/OpenCL/m13752-pure.cl @@ -21,7 +21,6 @@ typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -58,7 +57,7 @@ typedef struct vc_tmp } vc_tmp_t; -DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -80,16 +79,16 @@ DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u32 key2[6] = hc_swap32_S (key[14]); key2[7] = hc_swap32_S (key[15]); - 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; - 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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } -DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -129,13 +128,13 @@ DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u32 key4[6] = hc_swap32_S (key[30]); key4[7] = hc_swap32_S (key[31]); - 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_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_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_twofish (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_serpent_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_aes_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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_camellia_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } @@ -272,7 +271,7 @@ KERNEL_FQ void m13752_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) tmps[gid].opad[6] = sha256_hmac_ctx.opad.h[6]; tmps[gid].opad[7] = sha256_hmac_ctx.opad.h[7]; - sha256_hmac_update_global_swap (&sha256_hmac_ctx, esalt_bufs[DIGESTS_OFFSET_HOST].salt_buf, 64); + sha256_hmac_update_global_swap (&sha256_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 32; i += 8, j += 1) { @@ -546,12 +545,12 @@ KERNEL_FQ void m13752_loop_extended (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) if (pim_check) { - 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) + if (check_header_0512 (esalt_bufs, kernel_param, 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_check; } - 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) + if (check_header_1024 (esalt_bufs, kernel_param, 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_check; } @@ -621,26 +620,26 @@ KERNEL_FQ void m13752_comp (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) if (tmps[gid].pim) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 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 (check_header_0512 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 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 (check_header_1024 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m13753-pure.cl b/OpenCL/m13753-pure.cl index 0ef5f5cd7..7df35f839 100644 --- a/OpenCL/m13753-pure.cl +++ b/OpenCL/m13753-pure.cl @@ -21,7 +21,6 @@ typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -58,7 +57,7 @@ typedef struct vc_tmp } vc_tmp_t; -DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -80,16 +79,16 @@ DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u32 key2[6] = hc_swap32_S (key[14]); key2[7] = hc_swap32_S (key[15]); - 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; - 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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } -DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -129,18 +128,18 @@ DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u32 key4[6] = hc_swap32_S (key[30]); key4[7] = hc_swap32_S (key[31]); - 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_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_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_twofish (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_serpent_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_aes_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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_camellia_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } -DECLSPEC int check_header_1536 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_1536 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -198,9 +197,9 @@ DECLSPEC int check_header_1536 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u32 key6[6] = hc_swap32_S (key[46]); key6[7] = hc_swap32_S (key[47]); - 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; - 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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4, key5, key6) == 1) return 0; + if (verify_header_aes_twofish_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } @@ -337,7 +336,7 @@ KERNEL_FQ void m13753_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) tmps[gid].opad[6] = sha256_hmac_ctx.opad.h[6]; tmps[gid].opad[7] = sha256_hmac_ctx.opad.h[7]; - sha256_hmac_update_global_swap (&sha256_hmac_ctx, esalt_bufs[DIGESTS_OFFSET_HOST].salt_buf, 64); + sha256_hmac_update_global_swap (&sha256_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 48; i += 8, j += 1) { @@ -611,17 +610,17 @@ KERNEL_FQ void m13753_loop_extended (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) if (pim_check) { - 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) + if (check_header_0512 (esalt_bufs, kernel_param, 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_check; } - 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) + if (check_header_1024 (esalt_bufs, kernel_param, 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_check; } - 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) + if (check_header_1536 (esalt_bufs, kernel_param, 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_check; } @@ -691,34 +690,34 @@ KERNEL_FQ void m13753_comp (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t)) if (tmps[gid].pim) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 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 (check_header_0512 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 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 (check_header_1024 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 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 (check_header_1536 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m13771-pure.cl b/OpenCL/m13771-pure.cl index 9425b689e..e212dfacb 100644 --- a/OpenCL/m13771-pure.cl +++ b/OpenCL/m13771-pure.cl @@ -21,7 +21,6 @@ typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -61,7 +60,7 @@ typedef struct vc64_sbog_tmp } vc64_sbog_tmp_t; -DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -83,11 +82,11 @@ DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u64 key2[6] = hc_swap32_S (h32_from_64_S (key[0])); key2[7] = hc_swap32_S (l32_from_64_S (key[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; - 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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } @@ -305,7 +304,7 @@ KERNEL_FQ void m13771_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t)) tmps[gid].opad_raw[6] = streebog512_hmac_ctx.opad.s[6]; tmps[gid].opad_raw[7] = streebog512_hmac_ctx.opad.s[7]; - streebog512_hmac_update_global_swap (&streebog512_hmac_ctx, esalt_bufs[DIGESTS_OFFSET_HOST].salt_buf, 64); + streebog512_hmac_update_global_swap (&streebog512_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 8; i += 8, j += 1) { @@ -626,7 +625,7 @@ KERNEL_FQ void m13771_loop_extended (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t if (pim_check) { - 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) + if (check_header_0512 (esalt_bufs, kernel_param, 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_check; } @@ -696,18 +695,18 @@ KERNEL_FQ void m13771_comp (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t)) if (tmps[gid].pim) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 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 (check_header_0512 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m13772-pure.cl b/OpenCL/m13772-pure.cl index d423ac1f7..f1fce4e9a 100644 --- a/OpenCL/m13772-pure.cl +++ b/OpenCL/m13772-pure.cl @@ -21,7 +21,6 @@ typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -61,7 +60,7 @@ typedef struct vc64_sbog_tmp } vc64_sbog_tmp_t; -DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -83,16 +82,16 @@ DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u64 key2[6] = hc_swap32_S (h32_from_64_S (key[0])); key2[7] = hc_swap32_S (l32_from_64_S (key[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; - 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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } -DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -132,13 +131,13 @@ DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u64 key4[6] = hc_swap32_S (h32_from_64_S (key[ 8])); key4[7] = hc_swap32_S (l32_from_64_S (key[ 8])); - 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_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_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_twofish (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_serpent_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_aes_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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_camellia_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } @@ -356,7 +355,7 @@ KERNEL_FQ void m13772_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t)) tmps[gid].opad_raw[6] = streebog512_hmac_ctx.opad.s[6]; tmps[gid].opad_raw[7] = streebog512_hmac_ctx.opad.s[7]; - streebog512_hmac_update_global_swap (&streebog512_hmac_ctx, esalt_bufs[DIGESTS_OFFSET_HOST].salt_buf, 64); + streebog512_hmac_update_global_swap (&streebog512_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 16; i += 8, j += 1) { @@ -677,12 +676,12 @@ KERNEL_FQ void m13772_loop_extended (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t if (pim_check) { - 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) + if (check_header_0512 (esalt_bufs, kernel_param, 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_check; } - 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) + if (check_header_1024 (esalt_bufs, kernel_param, 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_check; } @@ -752,26 +751,26 @@ KERNEL_FQ void m13772_comp (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t)) if (tmps[gid].pim) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 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 (check_header_0512 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 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 (check_header_1024 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/OpenCL/m13773-pure.cl b/OpenCL/m13773-pure.cl index c5344a62c..3551d5560 100644 --- a/OpenCL/m13773-pure.cl +++ b/OpenCL/m13773-pure.cl @@ -21,7 +21,6 @@ typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -61,7 +60,7 @@ typedef struct vc64_sbog_tmp } vc64_sbog_tmp_t; -DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -83,16 +82,16 @@ DECLSPEC int check_header_0512 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u64 key2[6] = hc_swap32_S (h32_from_64_S (key[0])); key2[7] = hc_swap32_S (l32_from_64_S (key[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; - 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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_camellia (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2) == 1) return 0; + if (verify_header_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } -DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -132,18 +131,18 @@ DECLSPEC int check_header_1024 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u64 key4[6] = hc_swap32_S (h32_from_64_S (key[ 8])); key4[7] = hc_swap32_S (l32_from_64_S (key[ 8])); - 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_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_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_twofish (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_serpent_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_aes_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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_camellia_kuznyechik (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_camellia_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_twofish (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4) == 1) return 0; + if (verify_header_kuznyechik_aes (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } -DECLSPEC int check_header_1536 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS 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) +DECLSPEC int check_header_1536 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS const kernel_param_t *kernel_param, GLOBAL_AS 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]; @@ -201,9 +200,9 @@ DECLSPEC int check_header_1536 (GLOBAL_AS const vc_t *esalt_bufs, GLOBAL_AS u64 key6[6] = hc_swap32_S (h32_from_64_S (key[16])); key6[7] = hc_swap32_S (l32_from_64_S (key[16])); - 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; - 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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].signature, key1, key2, key3, key4, key5, key6) == 1) return 0; + if (verify_header_aes_twofish_serpent (esalt_bufs[DIGESTS_OFFSET_HOST].data_buf, esalt_bufs[DIGESTS_OFFSET_HOST].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; return -1; } @@ -421,7 +420,7 @@ KERNEL_FQ void m13773_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t)) tmps[gid].opad_raw[6] = streebog512_hmac_ctx.opad.s[6]; tmps[gid].opad_raw[7] = streebog512_hmac_ctx.opad.s[7]; - streebog512_hmac_update_global_swap (&streebog512_hmac_ctx, esalt_bufs[DIGESTS_OFFSET_HOST].salt_buf, 64); + streebog512_hmac_update_global_swap (&streebog512_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, 64); for (u32 i = 0, j = 1; i < 24; i += 8, j += 1) { @@ -742,17 +741,17 @@ KERNEL_FQ void m13773_loop_extended (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t if (pim_check) { - 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) + if (check_header_0512 (esalt_bufs, kernel_param, 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_check; } - 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) + if (check_header_1024 (esalt_bufs, kernel_param, 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_check; } - 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) + if (check_header_1536 (esalt_bufs, kernel_param, 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_check; } @@ -822,34 +821,34 @@ KERNEL_FQ void m13773_comp (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t)) if (tmps[gid].pim) { - if (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 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 (check_header_0512 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 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 (check_header_1024 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 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 (check_header_1536 (esalt_bufs, kernel_param, 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 (hc_atomic_inc (&hashes_shown[0]) == 0) + if (hc_atomic_inc (&hashes_shown[DIGESTS_OFFSET_HOST]) == 0) { - mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, 0, gid, 0, 0, 0); + mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, 0, DIGESTS_OFFSET_HOST + 0, gid, 0, 0, 0); } } } diff --git a/src/modules/module_13711.c b/src/modules/module_13711.c index 892632f6e..29a47ff9f 100644 --- a/src/modules/module_13711.c +++ b/src/modules/module_13711.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt RIPEMD160 + XTS 512 bit"; static const u64 KERN_TYPE = 13711; @@ -49,6 +49,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + typedef struct vc_tmp { u32 ipad[16]; @@ -65,7 +69,6 @@ typedef struct vc_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -185,21 +188,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -252,8 +253,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = 15 + user_options->veracrypt_pim_start; vc->pim_stop = 15 + user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 1000; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 1000 - 1; } return 1; @@ -265,28 +265,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_655331; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_655331 - 1; + + // pim vc->pim_multi = 1000; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13712.c b/src/modules/module_13712.c index 141f68f96..16c5bf49a 100644 --- a/src/modules/module_13712.c +++ b/src/modules/module_13712.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt RIPEMD160 + XTS 1024 bit"; static const u64 KERN_TYPE = 13712; @@ -49,6 +49,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + typedef struct vc_tmp { u32 ipad[16]; @@ -65,7 +69,6 @@ typedef struct vc_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -185,21 +188,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -252,8 +253,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = 15 + user_options->veracrypt_pim_start; vc->pim_stop = 15 + user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 1000; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 1000 - 1; } return 1; @@ -265,28 +265,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_655331; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_655331 - 1; + + // pim vc->pim_multi = 1000; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13713.c b/src/modules/module_13713.c index 2d8a7774d..f93ba6819 100644 --- a/src/modules/module_13713.c +++ b/src/modules/module_13713.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt RIPEMD160 + XTS 1536 bit"; static const u64 KERN_TYPE = 13713; @@ -49,6 +49,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + typedef struct vc_tmp { u32 ipad[16]; @@ -65,7 +69,6 @@ typedef struct vc_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -185,21 +188,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -252,8 +253,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = 15 + user_options->veracrypt_pim_start; vc->pim_stop = 15 + user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 1000; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 1000 - 1; } return 1; @@ -265,28 +265,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_655331; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_655331 - 1; + + // pim vc->pim_multi = 1000; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13721.c b/src/modules/module_13721.c index 82b8dac13..775c294ac 100644 --- a/src/modules/module_13721.c +++ b/src/modules/module_13721.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt SHA512 + XTS 512 bit"; static const u64 KERN_TYPE = 13721; @@ -50,7 +50,11 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } -typedef struct tc64_tmp +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + +typedef struct vc64_tmp { u64 ipad[8]; u64 opad[8]; @@ -66,7 +70,6 @@ typedef struct tc64_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -195,21 +198,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -262,8 +263,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = 15 + user_options->veracrypt_pim_start; vc->pim_stop = 15 + user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 1000; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 1000 - 1; } return 1; @@ -275,28 +275,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_500000; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + // pim vc->pim_multi = 1000; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13722.c b/src/modules/module_13722.c index 1e8195ce2..80c2a990f 100644 --- a/src/modules/module_13722.c +++ b/src/modules/module_13722.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt SHA512 + XTS 1024 bit"; static const u64 KERN_TYPE = 13722; @@ -50,7 +50,11 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } -typedef struct tc64_tmp +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + +typedef struct vc64_tmp { u64 ipad[8]; u64 opad[8]; @@ -66,7 +70,6 @@ typedef struct tc64_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -195,21 +198,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -262,8 +263,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = 15 + user_options->veracrypt_pim_start; vc->pim_stop = 15 + user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 1000; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 1000 - 1; } return 1; @@ -275,28 +275,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_500000; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + // pim vc->pim_multi = 1000; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13723.c b/src/modules/module_13723.c index 735e5ffd0..582b9257b 100644 --- a/src/modules/module_13723.c +++ b/src/modules/module_13723.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt SHA512 + XTS 1536 bit"; static const u64 KERN_TYPE = 13723; @@ -50,7 +50,11 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } -typedef struct tc64_tmp +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + +typedef struct vc64_tmp { u64 ipad[8]; u64 opad[8]; @@ -66,7 +70,6 @@ typedef struct tc64_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -195,21 +198,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -262,8 +263,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = 15 + user_options->veracrypt_pim_start; vc->pim_stop = 15 + user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 1000; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 1000 - 1; } return 1; @@ -275,28 +275,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_500000; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + // pim vc->pim_multi = 1000; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13731.c b/src/modules/module_13731.c index d05d58c8c..b78635f8e 100644 --- a/src/modules/module_13731.c +++ b/src/modules/module_13731.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt Whirlpool + XTS 512 bit"; static const u64 KERN_TYPE = 13731; @@ -50,6 +50,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + typedef struct vc_tmp { u32 ipad[16]; @@ -66,7 +70,6 @@ typedef struct vc_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -172,21 +175,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -239,8 +240,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = 15 + user_options->veracrypt_pim_start; vc->pim_stop = 15 + user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 1000; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 1000 - 1; } return 1; @@ -252,28 +252,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_500000; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + // pim vc->pim_multi = 1000; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13732.c b/src/modules/module_13732.c index dbbc5bec4..d7b435874 100644 --- a/src/modules/module_13732.c +++ b/src/modules/module_13732.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt Whirlpool + XTS 1024 bit"; static const u64 KERN_TYPE = 13732; @@ -50,6 +50,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + typedef struct vc_tmp { u32 ipad[16]; @@ -66,7 +70,6 @@ typedef struct vc_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -172,21 +175,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -239,8 +240,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = 15 + user_options->veracrypt_pim_start; vc->pim_stop = 15 + user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 1000; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 1000 - 1; } return 1; @@ -252,28 +252,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_500000; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + // pim vc->pim_multi = 1000; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13733.c b/src/modules/module_13733.c index 09e587be5..0e7368900 100644 --- a/src/modules/module_13733.c +++ b/src/modules/module_13733.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt Whirlpool + XTS 1536 bit"; static const u64 KERN_TYPE = 13733; @@ -50,6 +50,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + typedef struct vc_tmp { u32 ipad[16]; @@ -66,7 +70,6 @@ typedef struct vc_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -186,21 +189,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -253,8 +254,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = 15 + user_options->veracrypt_pim_start; vc->pim_stop = 15 + user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 1000; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 1000 - 1; } return 1; @@ -266,28 +266,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_500000; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + // pim vc->pim_multi = 1000; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13741.c b/src/modules/module_13741.c index 6ee52938c..3cc9fa3c3 100644 --- a/src/modules/module_13741.c +++ b/src/modules/module_13741.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt RIPEMD160 + XTS 512 bit + boot-mode"; static const u64 KERN_TYPE = 13711; @@ -50,6 +50,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + typedef struct vc_tmp { u32 ipad[16]; @@ -66,7 +70,6 @@ typedef struct vc_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -187,21 +190,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -254,8 +255,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = user_options->veracrypt_pim_start; vc->pim_stop = user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 2048; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 2048 - 1; } return 1; @@ -267,28 +267,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_327661; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_327661 - 1; + + // pim vc->pim_multi = 2048; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13742.c b/src/modules/module_13742.c index 682b6f40a..ca7b93caf 100644 --- a/src/modules/module_13742.c +++ b/src/modules/module_13742.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt RIPEMD160 + XTS 1024 bit + boot-mode"; static const u64 KERN_TYPE = 13712; @@ -50,6 +50,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + typedef struct vc_tmp { u32 ipad[16]; @@ -66,7 +70,6 @@ typedef struct vc_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -187,21 +190,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -254,8 +255,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = user_options->veracrypt_pim_start; vc->pim_stop = user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 2048; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 2048 - 1; } return 1; @@ -267,28 +267,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_327661; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_327661 - 1; + + // pim vc->pim_multi = 2048; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13743.c b/src/modules/module_13743.c index d095eeaa3..422f730d0 100644 --- a/src/modules/module_13743.c +++ b/src/modules/module_13743.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_5; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt RIPEMD160 + XTS 1536 bit + boot-mode"; static const u64 KERN_TYPE = 13713; @@ -50,6 +50,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + typedef struct vc_tmp { u32 ipad[16]; @@ -66,7 +70,6 @@ typedef struct vc_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -187,21 +190,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -254,8 +255,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = user_options->veracrypt_pim_start; vc->pim_stop = user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 2048; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 2048 - 1; } return 1; @@ -267,28 +267,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_327661; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_327661 - 1; + + // pim vc->pim_multi = 2048; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13751.c b/src/modules/module_13751.c index e30b27cb5..032661821 100644 --- a/src/modules/module_13751.c +++ b/src/modules/module_13751.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt SHA256 + XTS 512 bit"; static const u64 KERN_TYPE = 13751; @@ -49,6 +49,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + typedef struct vc_tmp { u32 ipad[16]; @@ -65,7 +69,6 @@ typedef struct vc_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -204,21 +207,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -271,8 +272,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = 15 + user_options->veracrypt_pim_start; vc->pim_stop = 15 + user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 1000; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 1000 - 1; } return 1; @@ -284,28 +284,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_500000; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + // pim vc->pim_multi = 1000; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13752.c b/src/modules/module_13752.c index a8283a34f..56f5bd1d4 100644 --- a/src/modules/module_13752.c +++ b/src/modules/module_13752.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt SHA256 + XTS 1024 bit"; static const u64 KERN_TYPE = 13752; @@ -49,6 +49,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + typedef struct vc_tmp { u32 ipad[16]; @@ -65,7 +69,6 @@ typedef struct vc_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -204,21 +207,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -271,8 +272,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = 15 + user_options->veracrypt_pim_start; vc->pim_stop = 15 + user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 1000; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 1000 - 1; } return 1; @@ -284,28 +284,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_500000; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + // pim vc->pim_multi = 1000; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13753.c b/src/modules/module_13753.c index b056e2fc6..a883ba328 100644 --- a/src/modules/module_13753.c +++ b/src/modules/module_13753.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt SHA256 + XTS 1536 bit"; static const u64 KERN_TYPE = 13753; @@ -49,6 +49,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + typedef struct vc_tmp { u32 ipad[16]; @@ -65,7 +69,6 @@ typedef struct vc_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -204,21 +207,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -271,8 +272,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = 15 + user_options->veracrypt_pim_start; vc->pim_stop = 15 + user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 1000; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 1000 - 1; } return 1; @@ -284,28 +284,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_500000; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + // pim vc->pim_multi = 1000; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13761.c b/src/modules/module_13761.c index bb91db6ba..417a29d65 100644 --- a/src/modules/module_13761.c +++ b/src/modules/module_13761.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt SHA256 + XTS 512 bit + boot-mode"; static const u64 KERN_TYPE = 13751; @@ -50,6 +50,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + typedef struct vc_tmp { u32 ipad[16]; @@ -66,7 +70,6 @@ typedef struct vc_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -206,21 +209,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -273,8 +274,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = user_options->veracrypt_pim_start; vc->pim_stop = user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 2048; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 2048 - 1; } return 1; @@ -286,28 +286,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_200000; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_200000 - 1; + + // pim vc->pim_multi = 2048; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13762.c b/src/modules/module_13762.c index bcc1b6a23..31dc9f3ce 100644 --- a/src/modules/module_13762.c +++ b/src/modules/module_13762.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt SHA256 + XTS 1024 bit + boot-mode"; static const u64 KERN_TYPE = 13752; @@ -50,6 +50,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + typedef struct vc_tmp { u32 ipad[16]; @@ -66,7 +70,6 @@ typedef struct vc_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -206,21 +209,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -273,8 +274,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = user_options->veracrypt_pim_start; vc->pim_stop = user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 2048; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 2048 - 1; } return 1; @@ -286,28 +286,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_200000; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_200000 - 1; + + // pim vc->pim_multi = 2048; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13763.c b/src/modules/module_13763.c index 2a88f6352..aafc6a836 100644 --- a/src/modules/module_13763.c +++ b/src/modules/module_13763.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_4_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt SHA256 + XTS 1536 bit + boot-mode"; static const u64 KERN_TYPE = 13753; @@ -50,6 +50,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + typedef struct vc_tmp { u32 ipad[16]; @@ -66,7 +70,6 @@ typedef struct vc_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -206,21 +209,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -273,8 +274,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = user_options->veracrypt_pim_start; vc->pim_stop = user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 2048; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 2048 - 1; } return 1; @@ -286,28 +286,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_200000; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_200000 - 1; + + // pim vc->pim_multi = 2048; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13771.c b/src/modules/module_13771.c index 8d4a4eb4a..73ec6a7d2 100644 --- a/src/modules/module_13771.c +++ b/src/modules/module_13771.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt Streebog-512 + XTS 512 bit"; static const u64 KERN_TYPE = 13771; @@ -51,6 +51,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + typedef struct vc64_sbog_tmp { u64 ipad_raw[8]; @@ -70,7 +74,6 @@ typedef struct vc64_sbog_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -196,21 +199,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -263,8 +264,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = 15 + user_options->veracrypt_pim_start; vc->pim_stop = 15 + user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 1000; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 1000 - 1; } return 1; @@ -276,28 +276,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_500000; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + // pim vc->pim_multi = 1000; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13772.c b/src/modules/module_13772.c index e1592d21d..9baeea1a7 100644 --- a/src/modules/module_13772.c +++ b/src/modules/module_13772.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt Streebog-512 + XTS 1024 bit"; static const u64 KERN_TYPE = 13772; @@ -51,6 +51,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + typedef struct vc64_sbog_tmp { u64 ipad_raw[8]; @@ -70,7 +74,6 @@ typedef struct vc64_sbog_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -196,21 +199,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -263,8 +264,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = 15 + user_options->veracrypt_pim_start; vc->pim_stop = 15 + user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 1000; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 1000 - 1; } return 1; @@ -276,28 +276,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_500000; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + // pim vc->pim_multi = 1000; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13773.c b/src/modules/module_13773.c index 79284aac4..07376b66b 100644 --- a/src/modules/module_13773.c +++ b/src/modules/module_13773.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt Streebog-512 + XTS 1536 bit"; static const u64 KERN_TYPE = 13773; @@ -51,6 +51,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + typedef struct vc64_sbog_tmp { u64 ipad_raw[8]; @@ -70,7 +74,6 @@ typedef struct vc64_sbog_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -202,21 +205,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -269,8 +270,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = 15 + user_options->veracrypt_pim_start; vc->pim_stop = 15 + user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 1000; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 1000 - 1; } return 1; @@ -282,28 +282,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_500000; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1; + + // pim vc->pim_multi = 1000; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13781.c b/src/modules/module_13781.c index f03ba864e..8df17aa33 100644 --- a/src/modules/module_13781.c +++ b/src/modules/module_13781.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt Streebog-512 + XTS 512 bit + boot-mode"; static const u64 KERN_TYPE = 13771; @@ -52,6 +52,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + typedef struct vc64_sbog_tmp { u64 ipad_raw[8]; @@ -71,7 +75,6 @@ typedef struct vc64_sbog_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -198,21 +201,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -265,8 +266,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = user_options->veracrypt_pim_start; vc->pim_stop = user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 2048; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 2048 - 1; } return 1; @@ -278,28 +278,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_200000; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_200000 - 1; + + // pim vc->pim_multi = 2048; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13782.c b/src/modules/module_13782.c index b9746e285..cc3952c40 100644 --- a/src/modules/module_13782.c +++ b/src/modules/module_13782.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt Streebog-512 + XTS 1024 bit + boot-mode"; static const u64 KERN_TYPE = 13772; @@ -52,6 +52,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + typedef struct vc64_sbog_tmp { u64 ipad_raw[8]; @@ -71,7 +75,6 @@ typedef struct vc64_sbog_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -198,21 +201,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -265,8 +266,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = user_options->veracrypt_pim_start; vc->pim_stop = user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 2048; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 2048 - 1; } return 1; @@ -278,28 +278,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_200000; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_200000 - 1; + + // pim vc->pim_multi = 2048; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); } diff --git a/src/modules/module_13783.c b/src/modules/module_13783.c index 3f385b223..690d7c640 100644 --- a/src/modules/module_13783.c +++ b/src/modules/module_13783.c @@ -18,7 +18,7 @@ static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; static const u32 DGST_POS3 = 3; -static const u32 DGST_SIZE = DGST_SIZE_8_8; +static const u32 DGST_SIZE = DGST_SIZE_4_32; static const u32 HASH_CATEGORY = HASH_CATEGORY_FDE; static const char *HASH_NAME = "VeraCrypt Streebog-512 + XTS 1536 bit + boot-mode"; static const u64 KERN_TYPE = 13773; @@ -52,6 +52,10 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +#define VC_SALT_LEN 64 +#define VC_DATA_LEN 448 +#define VC_HEADER_LEN 512 + typedef struct vc64_sbog_tmp { u64 ipad_raw[8]; @@ -71,7 +75,6 @@ typedef struct vc64_sbog_tmp typedef struct vc { - u32 salt_buf[32]; u32 data_buf[112]; u32 keyfile_buf16[16]; u32 keyfile_buf32[32]; @@ -198,21 +201,19 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HAVE_ERRNO); - #define VC_HEADER_SIZE 512 + char *in = (char *) hcmalloc (VC_HEADER_LEN); - char *in = (char *) hcmalloc (VC_HEADER_SIZE); - - const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp); + const size_t n = hc_fread (in, 1, VC_HEADER_LEN, &fp); hc_fclose (&fp); - if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); + if (n != VC_HEADER_LEN) return (PARSER_VC_FILE_SIZE); hash_t *hashes_buf = hashes->hashes_buf; hash_t *hash = &hashes_buf[0]; - const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_SIZE); + const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, in, VC_HEADER_LEN); if (parser_status != PARSER_OK) return 0; @@ -265,8 +266,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE vc->pim_start = user_options->veracrypt_pim_start; vc->pim_stop = user_options->veracrypt_pim_stop; - salt->salt_iter = vc->pim_stop * 2048; - salt->salt_iter--; + salt->salt_iter = vc->pim_stop * 2048 - 1; } return 1; @@ -278,28 +278,39 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE vc_t *vc = (vc_t *) esalt_buf; + // entropy + const float entropy = get_entropy ((const u8 *) line_buf, line_len); if (entropy < MIN_SUFFICIENT_ENTROPY_FILE) return (PARSER_INSUFFICIENT_ENTROPY); - memcpy (vc->salt_buf, line_buf, 64); + // salt - memcpy (vc->data_buf, line_buf + 64, 512 - 64); + memcpy (salt->salt_buf, line_buf, VC_SALT_LEN); - salt->salt_buf[0] = vc->salt_buf[0]; + salt->salt_len = VC_SALT_LEN; - salt->salt_len = 4; + // iter - salt->salt_iter = ROUNDS_VERACRYPT_200000; - salt->salt_iter--; + salt->salt_iter = ROUNDS_VERACRYPT_200000 - 1; + + // pim vc->pim_multi = 2048; vc->pim_start = 0; vc->pim_stop = 0; + // data + + memcpy (vc->data_buf, line_buf + VC_SALT_LEN, VC_DATA_LEN); + + // signature + vc->signature = 0x41524556; // "VERA" - digest[0] = vc->data_buf[0]; + // fake digest + + memcpy (digest, vc->data_buf, 112); return (PARSER_OK); }