1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-07-04 13:52:40 +00:00
This commit is contained in:
Royce Williams 2021-06-21 07:48:13 -08:00
commit e4626dc471
151 changed files with 7806 additions and 3816 deletions

View File

@ -7,10 +7,10 @@ assignees: ''
--- ---
**Is your request based on a publicly know cryptographic schema and where can we find information about?** **Is your request based on a publicly known cryptographic schema and where can we find information about?**
For instance: For instance:
- The hashing function XY is a public known hash algorithm on Wikipedia. - The hashing function XY is a public known hash algorithm on Wikipedia.
- The password protection for the application XY was made by public by security researcher XY and there's a paper called ... - The password protection for the application XY was made public by security researcher XY and there's a paper called ...
- The cryptographic schema used in protocol XY can be found in the OSS code on it's GitHub repository. - The cryptographic schema used in protocol XY can be found in the OSS code on it's GitHub repository.
**Describe alternatives you've considered** **Describe alternatives you've considered**

View File

@ -2627,34 +2627,15 @@ DECLSPEC int hc_find_keyboard_layout_map (const u32 search, const int search_len
return -1; return -1;
} }
DECLSPEC int hc_execute_keyboard_layout_mapping (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int pw_len, LOCAL_AS keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt) DECLSPEC int hc_execute_keyboard_layout_mapping (u32 *w, const int pw_len, LOCAL_AS keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt)
{ {
u32 out_buf[16] = { 0 }; u32 out_buf[32] = { 0 };
u8 *out_ptr = (u8 *) out_buf; u8 *out_ptr = (u8 *) out_buf;
int out_len = 0; int out_len = 0;
// TC/VC passwords are limited to 64 // TC/VC passwords are limited to 128
u32 w[16];
w[ 0] = w0[0];
w[ 1] = w0[1];
w[ 2] = w0[2];
w[ 3] = w0[3];
w[ 4] = w1[0];
w[ 5] = w1[1];
w[ 6] = w1[2];
w[ 7] = w1[3];
w[ 8] = w2[0];
w[ 9] = w2[1];
w[10] = w2[2];
w[11] = w2[3];
w[12] = w3[0];
w[13] = w3[1];
w[14] = w3[2];
w[15] = w3[3];
u8 *w_ptr = (u8 *) w; u8 *w_ptr = (u8 *) w;
@ -2733,22 +2714,38 @@ DECLSPEC int hc_execute_keyboard_layout_mapping (u32 *w0, u32 *w1, u32 *w2, u32
} }
} }
w0[0] = out_buf[ 0]; w[ 0] = out_buf[ 0];
w0[1] = out_buf[ 1]; w[ 1] = out_buf[ 1];
w0[2] = out_buf[ 2]; w[ 2] = out_buf[ 2];
w0[3] = out_buf[ 3]; w[ 3] = out_buf[ 3];
w1[0] = out_buf[ 4]; w[ 4] = out_buf[ 4];
w1[1] = out_buf[ 5]; w[ 5] = out_buf[ 5];
w1[2] = out_buf[ 6]; w[ 6] = out_buf[ 6];
w1[3] = out_buf[ 7]; w[ 7] = out_buf[ 7];
w2[0] = out_buf[ 8]; w[ 8] = out_buf[ 8];
w2[1] = out_buf[ 9]; w[ 9] = out_buf[ 9];
w2[2] = out_buf[10]; w[10] = out_buf[10];
w2[3] = out_buf[11]; w[11] = out_buf[11];
w3[0] = out_buf[12]; w[12] = out_buf[12];
w3[1] = out_buf[13]; w[13] = out_buf[13];
w3[2] = out_buf[14]; w[14] = out_buf[14];
w3[3] = out_buf[15]; w[15] = out_buf[15];
w[16] = out_buf[16];
w[17] = out_buf[17];
w[18] = out_buf[18];
w[19] = out_buf[19];
w[20] = out_buf[20];
w[21] = out_buf[21];
w[22] = out_buf[22];
w[23] = out_buf[23];
w[24] = out_buf[24];
w[25] = out_buf[25];
w[26] = out_buf[26];
w[27] = out_buf[27];
w[28] = out_buf[28];
w[29] = out_buf[29];
w[30] = out_buf[30];
w[31] = out_buf[31];
return out_len; return out_len;
} }

View File

@ -256,7 +256,7 @@ DECLSPEC int is_valid_hex_32 (const u32 v);
DECLSPEC int is_valid_base58_8 (const u8 v); DECLSPEC int is_valid_base58_8 (const u8 v);
DECLSPEC int is_valid_base58_32 (const u32 v); DECLSPEC int is_valid_base58_32 (const u32 v);
DECLSPEC int hc_find_keyboard_layout_map (const u32 search, const int search_len, LOCAL_AS keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt); DECLSPEC int hc_find_keyboard_layout_map (const u32 search, const int search_len, LOCAL_AS keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt);
DECLSPEC int hc_execute_keyboard_layout_mapping (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int pw_len, LOCAL_AS keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt); DECLSPEC int hc_execute_keyboard_layout_mapping (u32 *w, const int pw_len, LOCAL_AS keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt);
DECLSPEC void make_utf16be (const u32x *in, u32x *out1, u32x *out2); DECLSPEC void make_utf16be (const u32x *in, u32x *out1, u32x *out2);
DECLSPEC void make_utf16beN (const u32x *in, u32x *out1, u32x *out2); DECLSPEC void make_utf16beN (const u32x *in, u32x *out1, u32x *out2);
DECLSPEC void make_utf16le (const u32x *in, u32x *out1, u32x *out2); DECLSPEC void make_utf16le (const u32x *in, u32x *out1, u32x *out2);

View File

@ -688,7 +688,9 @@ DECLSPEC int mangle_dupeblock_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const
DECLSPEC int mangle_title_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len) DECLSPEC int mangle_title_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len)
{ {
if ((len + 4) >= RP_PASSWORD_SIZE) return (len); // cheap way to not need to check for overflow of i + 1 if (len >= RP_PASSWORD_SIZE) return (len);
u32 rem = 0xff;
for (int i = 0, idx = 0; i < len; i += 4, idx += 1) for (int i = 0, idx = 0; i < len; i += 4, idx += 1)
{ {
@ -696,22 +698,18 @@ DECLSPEC int mangle_title_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p
buf[idx] = t | generate_cmask (t); buf[idx] = t | generate_cmask (t);
u32 out0 = 0; u32 out = rem;
u32 out1 = 0;
if (((t >> 0) & 0xff) == p0) out0 |= 0x0000ff00; rem = 0;
if (((t >> 8) & 0xff) == p0) out0 |= 0x00ff0000;
if (((t >> 16) & 0xff) == p0) out0 |= 0xff000000;
if (((t >> 24) & 0xff) == p0) out1 |= 0x000000ff;
buf[idx + 0] &= ~(generate_cmask (buf[idx + 0]) & out0); if (((t >> 0) & 0xff) == p0) out |= 0x0000ff00;
buf[idx + 1] &= ~(generate_cmask (buf[idx + 1]) & out1); if (((t >> 8) & 0xff) == p0) out |= 0x00ff0000;
if (((t >> 16) & 0xff) == p0) out |= 0xff000000;
if (((t >> 24) & 0xff) == p0) rem |= 0x000000ff;
buf[idx] &= ~(generate_cmask (buf[idx]) & out);
} }
const u32 t = buf[0];
buf[0] = t & ~(0x00000020 & generate_cmask (t));
return (len); return (len);
} }

View File

@ -33,3 +33,67 @@ DECLSPEC u32 u8add (const u32 a, const u32 b)
return r; return r;
} }
DECLSPEC u32 hc_apply_keyfile_tc (u32 *w, const int pw_len, const GLOBAL_AS tc_t *tc)
{
if (tc->keyfile_enabled == 0) return pw_len;
if (pw_len > 64)
{
w[ 0] = u8add (w[ 0], tc->keyfile_buf32[ 0]);
w[ 1] = u8add (w[ 1], tc->keyfile_buf32[ 1]);
w[ 2] = u8add (w[ 2], tc->keyfile_buf32[ 2]);
w[ 3] = u8add (w[ 3], tc->keyfile_buf32[ 3]);
w[ 4] = u8add (w[ 4], tc->keyfile_buf32[ 4]);
w[ 5] = u8add (w[ 5], tc->keyfile_buf32[ 5]);
w[ 6] = u8add (w[ 6], tc->keyfile_buf32[ 6]);
w[ 7] = u8add (w[ 7], tc->keyfile_buf32[ 7]);
w[ 8] = u8add (w[ 8], tc->keyfile_buf32[ 8]);
w[ 9] = u8add (w[ 9], tc->keyfile_buf32[ 9]);
w[10] = u8add (w[10], tc->keyfile_buf32[10]);
w[11] = u8add (w[11], tc->keyfile_buf32[11]);
w[12] = u8add (w[12], tc->keyfile_buf32[12]);
w[13] = u8add (w[13], tc->keyfile_buf32[13]);
w[14] = u8add (w[14], tc->keyfile_buf32[14]);
w[15] = u8add (w[15], tc->keyfile_buf32[15]);
w[16] = u8add (w[16], tc->keyfile_buf32[16]);
w[17] = u8add (w[17], tc->keyfile_buf32[17]);
w[18] = u8add (w[18], tc->keyfile_buf32[18]);
w[19] = u8add (w[19], tc->keyfile_buf32[19]);
w[20] = u8add (w[20], tc->keyfile_buf32[20]);
w[21] = u8add (w[21], tc->keyfile_buf32[21]);
w[22] = u8add (w[22], tc->keyfile_buf32[22]);
w[23] = u8add (w[23], tc->keyfile_buf32[23]);
w[24] = u8add (w[24], tc->keyfile_buf32[24]);
w[25] = u8add (w[25], tc->keyfile_buf32[25]);
w[26] = u8add (w[26], tc->keyfile_buf32[26]);
w[27] = u8add (w[27], tc->keyfile_buf32[27]);
w[28] = u8add (w[28], tc->keyfile_buf32[28]);
w[29] = u8add (w[29], tc->keyfile_buf32[29]);
w[30] = u8add (w[30], tc->keyfile_buf32[30]);
w[31] = u8add (w[31], tc->keyfile_buf32[31]);
return 128;
}
else
{
w[ 0] = u8add (w[ 0], tc->keyfile_buf16[ 0]);
w[ 1] = u8add (w[ 1], tc->keyfile_buf16[ 1]);
w[ 2] = u8add (w[ 2], tc->keyfile_buf16[ 2]);
w[ 3] = u8add (w[ 3], tc->keyfile_buf16[ 3]);
w[ 4] = u8add (w[ 4], tc->keyfile_buf16[ 4]);
w[ 5] = u8add (w[ 5], tc->keyfile_buf16[ 5]);
w[ 6] = u8add (w[ 6], tc->keyfile_buf16[ 6]);
w[ 7] = u8add (w[ 7], tc->keyfile_buf16[ 7]);
w[ 8] = u8add (w[ 8], tc->keyfile_buf16[ 8]);
w[ 9] = u8add (w[ 9], tc->keyfile_buf16[ 9]);
w[10] = u8add (w[10], tc->keyfile_buf16[10]);
w[11] = u8add (w[11], tc->keyfile_buf16[11]);
w[12] = u8add (w[12], tc->keyfile_buf16[12]);
w[13] = u8add (w[13], tc->keyfile_buf16[13]);
w[14] = u8add (w[14], tc->keyfile_buf16[14]);
w[15] = u8add (w[15], tc->keyfile_buf16[15]);
return 64;
}
}

View File

@ -7,5 +7,6 @@
#define _INC_TRUECRYPT_KEYFILE_H #define _INC_TRUECRYPT_KEYFILE_H
DECLSPEC u32 u8add (const u32 a, const u32 b); DECLSPEC u32 u8add (const u32 a, const u32 b);
DECLSPEC u32 hc_apply_keyfile_tc (u32 *w, const int pw_len, const GLOBAL_AS tc_t *tc);
#endif // _INC_TRUECRYPT_KEYFILE_H #endif // _INC_TRUECRYPT_KEYFILE_H

View File

@ -0,0 +1,99 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#include "inc_vendor.h"
#include "inc_types.h"
#include "inc_platform.h"
#include "inc_common.h"
#include "inc_veracrypt_keyfile.h"
DECLSPEC u32 u8add (const u32 a, const u32 b)
{
const u32 a1 = (a >> 0) & 0xff;
const u32 a2 = (a >> 8) & 0xff;
const u32 a3 = (a >> 16) & 0xff;
const u32 a4 = (a >> 24) & 0xff;
const u32 b1 = (b >> 0) & 0xff;
const u32 b2 = (b >> 8) & 0xff;
const u32 b3 = (b >> 16) & 0xff;
const u32 b4 = (b >> 24) & 0xff;
const u32 r1 = (a1 + b1) & 0xff;
const u32 r2 = (a2 + b2) & 0xff;
const u32 r3 = (a3 + b3) & 0xff;
const u32 r4 = (a4 + b4) & 0xff;
const u32 r = r1 << 0
| r2 << 8
| r3 << 16
| r4 << 24;
return r;
}
DECLSPEC u32 hc_apply_keyfile_vc (u32 *w, const int pw_len, const GLOBAL_AS vc_t *vc)
{
if (vc->keyfile_enabled == 0) return pw_len;
if (pw_len > 64)
{
w[ 0] = u8add (w[ 0], vc->keyfile_buf32[ 0]);
w[ 1] = u8add (w[ 1], vc->keyfile_buf32[ 1]);
w[ 2] = u8add (w[ 2], vc->keyfile_buf32[ 2]);
w[ 3] = u8add (w[ 3], vc->keyfile_buf32[ 3]);
w[ 4] = u8add (w[ 4], vc->keyfile_buf32[ 4]);
w[ 5] = u8add (w[ 5], vc->keyfile_buf32[ 5]);
w[ 6] = u8add (w[ 6], vc->keyfile_buf32[ 6]);
w[ 7] = u8add (w[ 7], vc->keyfile_buf32[ 7]);
w[ 8] = u8add (w[ 8], vc->keyfile_buf32[ 8]);
w[ 9] = u8add (w[ 9], vc->keyfile_buf32[ 9]);
w[10] = u8add (w[10], vc->keyfile_buf32[10]);
w[11] = u8add (w[11], vc->keyfile_buf32[11]);
w[12] = u8add (w[12], vc->keyfile_buf32[12]);
w[13] = u8add (w[13], vc->keyfile_buf32[13]);
w[14] = u8add (w[14], vc->keyfile_buf32[14]);
w[15] = u8add (w[15], vc->keyfile_buf32[15]);
w[16] = u8add (w[16], vc->keyfile_buf32[16]);
w[17] = u8add (w[17], vc->keyfile_buf32[17]);
w[18] = u8add (w[18], vc->keyfile_buf32[18]);
w[19] = u8add (w[19], vc->keyfile_buf32[19]);
w[20] = u8add (w[20], vc->keyfile_buf32[20]);
w[21] = u8add (w[21], vc->keyfile_buf32[21]);
w[22] = u8add (w[22], vc->keyfile_buf32[22]);
w[23] = u8add (w[23], vc->keyfile_buf32[23]);
w[24] = u8add (w[24], vc->keyfile_buf32[24]);
w[25] = u8add (w[25], vc->keyfile_buf32[25]);
w[26] = u8add (w[26], vc->keyfile_buf32[26]);
w[27] = u8add (w[27], vc->keyfile_buf32[27]);
w[28] = u8add (w[28], vc->keyfile_buf32[28]);
w[29] = u8add (w[29], vc->keyfile_buf32[29]);
w[30] = u8add (w[30], vc->keyfile_buf32[30]);
w[31] = u8add (w[31], vc->keyfile_buf32[31]);
return 128;
}
else
{
w[ 0] = u8add (w[ 0], vc->keyfile_buf16[ 0]);
w[ 1] = u8add (w[ 1], vc->keyfile_buf16[ 1]);
w[ 2] = u8add (w[ 2], vc->keyfile_buf16[ 2]);
w[ 3] = u8add (w[ 3], vc->keyfile_buf16[ 3]);
w[ 4] = u8add (w[ 4], vc->keyfile_buf16[ 4]);
w[ 5] = u8add (w[ 5], vc->keyfile_buf16[ 5]);
w[ 6] = u8add (w[ 6], vc->keyfile_buf16[ 6]);
w[ 7] = u8add (w[ 7], vc->keyfile_buf16[ 7]);
w[ 8] = u8add (w[ 8], vc->keyfile_buf16[ 8]);
w[ 9] = u8add (w[ 9], vc->keyfile_buf16[ 9]);
w[10] = u8add (w[10], vc->keyfile_buf16[10]);
w[11] = u8add (w[11], vc->keyfile_buf16[11]);
w[12] = u8add (w[12], vc->keyfile_buf16[12]);
w[13] = u8add (w[13], vc->keyfile_buf16[13]);
w[14] = u8add (w[14], vc->keyfile_buf16[14]);
w[15] = u8add (w[15], vc->keyfile_buf16[15]);
return 64;
}
}

View File

@ -0,0 +1,12 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#ifndef _INC_VERACRYPT_KEYFILE_H
#define _INC_VERACRYPT_KEYFILE_H
DECLSPEC u32 u8add (const u32 a, const u32 b);
DECLSPEC u32 hc_apply_keyfile_vc (u32 *w, const int pw_len, const GLOBAL_AS vc_t *vc);
#endif // _INC_VERACRYPT_KEYFILE_H

View File

@ -2229,9 +2229,7 @@ KERNEL_FQ void m01500_mxx (KERN_ATTR_BITSLICE ())
u32 tmpResult = 0; u32 tmpResult = 0;
#ifdef _unroll
#pragma unroll #pragma unroll
#endif
for (int i = 0; i < 32; i++) for (int i = 0; i < 32; i++)
{ {
const u32 b0 = -((search[0] >> i) & 1); const u32 b0 = -((search[0] >> i) & 1);
@ -2247,12 +2245,12 @@ KERNEL_FQ void m01500_mxx (KERN_ATTR_BITSLICE ())
const u32 r0 = search[0]; const u32 r0 = search[0];
const u32 r1 = search[1]; const u32 r1 = search[1];
#ifdef KERNEL_STATIC
const u32 r2 = 0; const u32 r2 = 0;
const u32 r3 = 0; const u32 r3 = 0;
#ifdef KERNEL_STATIC
#include COMPARE_M
#endif #endif
#include COMPARE_M
} }
} }
else else
@ -2260,9 +2258,7 @@ KERNEL_FQ void m01500_mxx (KERN_ATTR_BITSLICE ())
u32 out0[32]; u32 out0[32];
u32 out1[32]; u32 out1[32];
#ifdef _unroll
#pragma unroll #pragma unroll
#endif
for (int i = 0; i < 32; i++) for (int i = 0; i < 32; i++)
{ {
out0[i] = out[ 0 + 31 - i]; out0[i] = out[ 0 + 31 - i];
@ -2272,15 +2268,13 @@ KERNEL_FQ void m01500_mxx (KERN_ATTR_BITSLICE ())
transpose32c (out0); transpose32c (out0);
transpose32c (out1); transpose32c (out1);
#ifdef _unroll
#pragma unroll #pragma unroll
#endif
for (int slice = 0; slice < 32; slice++) for (int slice = 0; slice < 32; slice++)
{ {
const u32 r0 = out0[31 - slice]; const u32 r0 = out0[31 - slice];
const u32 r1 = out1[31 - slice]; const u32 r1 = out1[31 - slice];
const u32 r2 = 0;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
const u32 r2 = 0;
const u32 r3 = 0; const u32 r3 = 0;
#endif #endif

View File

@ -2070,9 +2070,7 @@ KERNEL_FQ void m03000_mxx (KERN_ATTR_BITSLICE ())
u32 tmpResult = 0; u32 tmpResult = 0;
#ifdef _unroll
#pragma unroll #pragma unroll
#endif
for (int i = 0; i < 32; i++) for (int i = 0; i < 32; i++)
{ {
const u32 b0 = -((search[0] >> i) & 1); const u32 b0 = -((search[0] >> i) & 1);
@ -2088,8 +2086,8 @@ KERNEL_FQ void m03000_mxx (KERN_ATTR_BITSLICE ())
const u32 r0 = search[0]; const u32 r0 = search[0];
const u32 r1 = search[1]; const u32 r1 = search[1];
const u32 r2 = 0;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
const u32 r2 = 0;
const u32 r3 = 0; const u32 r3 = 0;
#endif #endif
@ -2101,9 +2099,7 @@ KERNEL_FQ void m03000_mxx (KERN_ATTR_BITSLICE ())
u32 out0[32]; u32 out0[32];
u32 out1[32]; u32 out1[32];
#ifdef _unroll
#pragma unroll #pragma unroll
#endif
for (int i = 0; i < 32; i++) for (int i = 0; i < 32; i++)
{ {
out0[i] = out[ 0 + 31 - i]; out0[i] = out[ 0 + 31 - i];
@ -2113,15 +2109,13 @@ KERNEL_FQ void m03000_mxx (KERN_ATTR_BITSLICE ())
transpose32c (out0); transpose32c (out0);
transpose32c (out1); transpose32c (out1);
#ifdef _unroll
#pragma unroll #pragma unroll
#endif
for (int slice = 0; slice < 32; slice++) for (int slice = 0; slice < 32; slice++)
{ {
const u32 r0 = out0[31 - slice]; const u32 r0 = out0[31 - slice];
const u32 r1 = out1[31 - slice]; const u32 r1 = out1[31 - slice];
const u32 r2 = 0;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
const u32 r2 = 0;
const u32 r3 = 0; const u32 r3 = 0;
#endif #endif

View File

@ -21,7 +21,9 @@ typedef struct tc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -30,9 +32,9 @@ typedef struct tc
} tc_t; } tc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_truecrypt_keyfile.cl"
#endif #endif
typedef struct tc_tmp typedef struct tc_tmp
@ -108,52 +110,50 @@ KERNEL_FQ void m06211_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w[16] = pws[gid].i[16];
w[17] = pws[gid].i[17];
w[18] = pws[gid].i[18];
w[19] = pws[gid].i[19];
w[20] = pws[gid].i[20];
w[21] = pws[gid].i[21];
w[22] = pws[gid].i[22];
w[23] = pws[gid].i[23];
w[24] = pws[gid].i[24];
w[25] = pws[gid].i[25];
w[26] = pws[gid].i[26];
w[27] = pws[gid].i[27];
w[28] = pws[gid].i[28];
w[29] = pws[gid].i[29];
w[30] = pws[gid].i[30];
w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_tc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
ripemd160_hmac_ctx_t ripemd160_hmac_ctx; ripemd160_hmac_ctx_t ripemd160_hmac_ctx;
ripemd160_hmac_init_64 (&ripemd160_hmac_ctx, w0, w1, w2, w3); ripemd160_hmac_init (&ripemd160_hmac_ctx, w, pw_len);
tmps[gid].ipad[0] = ripemd160_hmac_ctx.ipad.h[0]; tmps[gid].ipad[0] = ripemd160_hmac_ctx.ipad.h[0];
tmps[gid].ipad[1] = ripemd160_hmac_ctx.ipad.h[1]; tmps[gid].ipad[1] = ripemd160_hmac_ctx.ipad.h[1];
@ -173,6 +173,11 @@ KERNEL_FQ void m06211_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
{ {
ripemd160_hmac_ctx_t ripemd160_hmac_ctx2 = ripemd160_hmac_ctx; ripemd160_hmac_ctx_t ripemd160_hmac_ctx2 = ripemd160_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = j << 24; w0[0] = j << 24;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -21,7 +21,9 @@ typedef struct tc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -30,9 +32,9 @@ typedef struct tc
} tc_t; } tc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_truecrypt_keyfile.cl"
#endif #endif
typedef struct tc_tmp typedef struct tc_tmp
@ -108,52 +110,50 @@ KERNEL_FQ void m06212_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w[16] = pws[gid].i[16];
w[17] = pws[gid].i[17];
w[18] = pws[gid].i[18];
w[19] = pws[gid].i[19];
w[20] = pws[gid].i[20];
w[21] = pws[gid].i[21];
w[22] = pws[gid].i[22];
w[23] = pws[gid].i[23];
w[24] = pws[gid].i[24];
w[25] = pws[gid].i[25];
w[26] = pws[gid].i[26];
w[27] = pws[gid].i[27];
w[28] = pws[gid].i[28];
w[29] = pws[gid].i[29];
w[30] = pws[gid].i[30];
w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_tc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
ripemd160_hmac_ctx_t ripemd160_hmac_ctx; ripemd160_hmac_ctx_t ripemd160_hmac_ctx;
ripemd160_hmac_init_64 (&ripemd160_hmac_ctx, w0, w1, w2, w3); ripemd160_hmac_init (&ripemd160_hmac_ctx, w, pw_len);
tmps[gid].ipad[0] = ripemd160_hmac_ctx.ipad.h[0]; tmps[gid].ipad[0] = ripemd160_hmac_ctx.ipad.h[0];
tmps[gid].ipad[1] = ripemd160_hmac_ctx.ipad.h[1]; tmps[gid].ipad[1] = ripemd160_hmac_ctx.ipad.h[1];
@ -173,6 +173,11 @@ KERNEL_FQ void m06212_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
{ {
ripemd160_hmac_ctx_t ripemd160_hmac_ctx2 = ripemd160_hmac_ctx; ripemd160_hmac_ctx_t ripemd160_hmac_ctx2 = ripemd160_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = j << 24; w0[0] = j << 24;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -21,7 +21,9 @@ typedef struct tc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -30,9 +32,9 @@ typedef struct tc
} tc_t; } tc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_truecrypt_keyfile.cl"
#endif #endif
typedef struct tc_tmp typedef struct tc_tmp
@ -108,52 +110,50 @@ KERNEL_FQ void m06213_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w[16] = pws[gid].i[16];
w[17] = pws[gid].i[17];
w[18] = pws[gid].i[18];
w[19] = pws[gid].i[19];
w[20] = pws[gid].i[20];
w[21] = pws[gid].i[21];
w[22] = pws[gid].i[22];
w[23] = pws[gid].i[23];
w[24] = pws[gid].i[24];
w[25] = pws[gid].i[25];
w[26] = pws[gid].i[26];
w[27] = pws[gid].i[27];
w[28] = pws[gid].i[28];
w[29] = pws[gid].i[29];
w[30] = pws[gid].i[30];
w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_tc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
ripemd160_hmac_ctx_t ripemd160_hmac_ctx; ripemd160_hmac_ctx_t ripemd160_hmac_ctx;
ripemd160_hmac_init_64 (&ripemd160_hmac_ctx, w0, w1, w2, w3); ripemd160_hmac_init (&ripemd160_hmac_ctx, w, pw_len);
tmps[gid].ipad[0] = ripemd160_hmac_ctx.ipad.h[0]; tmps[gid].ipad[0] = ripemd160_hmac_ctx.ipad.h[0];
tmps[gid].ipad[1] = ripemd160_hmac_ctx.ipad.h[1]; tmps[gid].ipad[1] = ripemd160_hmac_ctx.ipad.h[1];
@ -173,6 +173,11 @@ KERNEL_FQ void m06213_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
{ {
ripemd160_hmac_ctx_t ripemd160_hmac_ctx2 = ripemd160_hmac_ctx; ripemd160_hmac_ctx_t ripemd160_hmac_ctx2 = ripemd160_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = j << 24; w0[0] = j << 24;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -21,7 +21,9 @@ typedef struct tc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -30,9 +32,9 @@ typedef struct tc
} tc_t; } tc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_truecrypt_keyfile.cl"
#endif #endif
typedef struct tc64_tmp typedef struct tc64_tmp
@ -130,105 +132,50 @@ KERNEL_FQ void m06221_init (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
u32 w4[4];
u32 w5[4];
u32 w6[4];
u32 w7[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w4[0] = pws[gid].i[16]; w[16] = pws[gid].i[16];
w4[1] = pws[gid].i[17]; w[17] = pws[gid].i[17];
w4[2] = pws[gid].i[18]; w[18] = pws[gid].i[18];
w4[3] = pws[gid].i[19]; w[19] = pws[gid].i[19];
w5[0] = pws[gid].i[20]; w[20] = pws[gid].i[20];
w5[1] = pws[gid].i[21]; w[21] = pws[gid].i[21];
w5[2] = pws[gid].i[22]; w[22] = pws[gid].i[22];
w5[3] = pws[gid].i[23]; w[23] = pws[gid].i[23];
w6[0] = pws[gid].i[24]; w[24] = pws[gid].i[24];
w6[1] = pws[gid].i[25]; w[25] = pws[gid].i[25];
w6[2] = pws[gid].i[26]; w[26] = pws[gid].i[26];
w6[3] = pws[gid].i[27]; w[27] = pws[gid].i[27];
w7[0] = pws[gid].i[28]; w[28] = pws[gid].i[28];
w7[1] = pws[gid].i[29]; w[29] = pws[gid].i[29];
w7[2] = pws[gid].i[30]; w[30] = pws[gid].i[30];
w7[3] = pws[gid].i[31]; w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_tc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
w0[0] = hc_swap32_S (w0[0]);
w0[1] = hc_swap32_S (w0[1]);
w0[2] = hc_swap32_S (w0[2]);
w0[3] = hc_swap32_S (w0[3]);
w1[0] = hc_swap32_S (w1[0]);
w1[1] = hc_swap32_S (w1[1]);
w1[2] = hc_swap32_S (w1[2]);
w1[3] = hc_swap32_S (w1[3]);
w2[0] = hc_swap32_S (w2[0]);
w2[1] = hc_swap32_S (w2[1]);
w2[2] = hc_swap32_S (w2[2]);
w2[3] = hc_swap32_S (w2[3]);
w3[0] = hc_swap32_S (w3[0]);
w3[1] = hc_swap32_S (w3[1]);
w3[2] = hc_swap32_S (w3[2]);
w3[3] = hc_swap32_S (w3[3]);
w4[0] = hc_swap32_S (w4[0]);
w4[1] = hc_swap32_S (w4[1]);
w4[2] = hc_swap32_S (w4[2]);
w4[3] = hc_swap32_S (w4[3]);
w5[0] = hc_swap32_S (w5[0]);
w5[1] = hc_swap32_S (w5[1]);
w5[2] = hc_swap32_S (w5[2]);
w5[3] = hc_swap32_S (w5[3]);
w6[0] = hc_swap32_S (w6[0]);
w6[1] = hc_swap32_S (w6[1]);
w6[2] = hc_swap32_S (w6[2]);
w6[3] = hc_swap32_S (w6[3]);
w7[0] = hc_swap32_S (w7[0]);
w7[1] = hc_swap32_S (w7[1]);
w7[2] = hc_swap32_S (w7[2]);
w7[3] = hc_swap32_S (w7[3]);
sha512_hmac_ctx_t sha512_hmac_ctx; sha512_hmac_ctx_t sha512_hmac_ctx;
sha512_hmac_init_128 (&sha512_hmac_ctx, w0, w1, w2, w3, w5, w5, w6, w7); sha512_hmac_init_swap (&sha512_hmac_ctx, w, pw_len);
tmps[gid].ipad[0] = sha512_hmac_ctx.ipad.h[0]; tmps[gid].ipad[0] = sha512_hmac_ctx.ipad.h[0];
tmps[gid].ipad[1] = sha512_hmac_ctx.ipad.h[1]; tmps[gid].ipad[1] = sha512_hmac_ctx.ipad.h[1];
@ -254,6 +201,15 @@ KERNEL_FQ void m06221_init (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t))
{ {
sha512_hmac_ctx_t sha512_hmac_ctx2 = sha512_hmac_ctx; sha512_hmac_ctx_t sha512_hmac_ctx2 = sha512_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
u32 w4[4];
u32 w5[4];
u32 w6[4];
u32 w7[4];
w0[0] = j; w0[0] = j;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -21,7 +21,9 @@ typedef struct tc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -30,9 +32,9 @@ typedef struct tc
} tc_t; } tc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_truecrypt_keyfile.cl"
#endif #endif
typedef struct tc64_tmp typedef struct tc64_tmp
@ -130,105 +132,50 @@ KERNEL_FQ void m06222_init (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
u32 w4[4];
u32 w5[4];
u32 w6[4];
u32 w7[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w4[0] = pws[gid].i[16]; w[16] = pws[gid].i[16];
w4[1] = pws[gid].i[17]; w[17] = pws[gid].i[17];
w4[2] = pws[gid].i[18]; w[18] = pws[gid].i[18];
w4[3] = pws[gid].i[19]; w[19] = pws[gid].i[19];
w5[0] = pws[gid].i[20]; w[20] = pws[gid].i[20];
w5[1] = pws[gid].i[21]; w[21] = pws[gid].i[21];
w5[2] = pws[gid].i[22]; w[22] = pws[gid].i[22];
w5[3] = pws[gid].i[23]; w[23] = pws[gid].i[23];
w6[0] = pws[gid].i[24]; w[24] = pws[gid].i[24];
w6[1] = pws[gid].i[25]; w[25] = pws[gid].i[25];
w6[2] = pws[gid].i[26]; w[26] = pws[gid].i[26];
w6[3] = pws[gid].i[27]; w[27] = pws[gid].i[27];
w7[0] = pws[gid].i[28]; w[28] = pws[gid].i[28];
w7[1] = pws[gid].i[29]; w[29] = pws[gid].i[29];
w7[2] = pws[gid].i[30]; w[30] = pws[gid].i[30];
w7[3] = pws[gid].i[31]; w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_tc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
w0[0] = hc_swap32_S (w0[0]);
w0[1] = hc_swap32_S (w0[1]);
w0[2] = hc_swap32_S (w0[2]);
w0[3] = hc_swap32_S (w0[3]);
w1[0] = hc_swap32_S (w1[0]);
w1[1] = hc_swap32_S (w1[1]);
w1[2] = hc_swap32_S (w1[2]);
w1[3] = hc_swap32_S (w1[3]);
w2[0] = hc_swap32_S (w2[0]);
w2[1] = hc_swap32_S (w2[1]);
w2[2] = hc_swap32_S (w2[2]);
w2[3] = hc_swap32_S (w2[3]);
w3[0] = hc_swap32_S (w3[0]);
w3[1] = hc_swap32_S (w3[1]);
w3[2] = hc_swap32_S (w3[2]);
w3[3] = hc_swap32_S (w3[3]);
w4[0] = hc_swap32_S (w4[0]);
w4[1] = hc_swap32_S (w4[1]);
w4[2] = hc_swap32_S (w4[2]);
w4[3] = hc_swap32_S (w4[3]);
w5[0] = hc_swap32_S (w5[0]);
w5[1] = hc_swap32_S (w5[1]);
w5[2] = hc_swap32_S (w5[2]);
w5[3] = hc_swap32_S (w5[3]);
w6[0] = hc_swap32_S (w6[0]);
w6[1] = hc_swap32_S (w6[1]);
w6[2] = hc_swap32_S (w6[2]);
w6[3] = hc_swap32_S (w6[3]);
w7[0] = hc_swap32_S (w7[0]);
w7[1] = hc_swap32_S (w7[1]);
w7[2] = hc_swap32_S (w7[2]);
w7[3] = hc_swap32_S (w7[3]);
sha512_hmac_ctx_t sha512_hmac_ctx; sha512_hmac_ctx_t sha512_hmac_ctx;
sha512_hmac_init_128 (&sha512_hmac_ctx, w0, w1, w2, w3, w5, w5, w6, w7); sha512_hmac_init_swap (&sha512_hmac_ctx, w, pw_len);
tmps[gid].ipad[0] = sha512_hmac_ctx.ipad.h[0]; tmps[gid].ipad[0] = sha512_hmac_ctx.ipad.h[0];
tmps[gid].ipad[1] = sha512_hmac_ctx.ipad.h[1]; tmps[gid].ipad[1] = sha512_hmac_ctx.ipad.h[1];
@ -254,6 +201,15 @@ KERNEL_FQ void m06222_init (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t))
{ {
sha512_hmac_ctx_t sha512_hmac_ctx2 = sha512_hmac_ctx; sha512_hmac_ctx_t sha512_hmac_ctx2 = sha512_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
u32 w4[4];
u32 w5[4];
u32 w6[4];
u32 w7[4];
w0[0] = j; w0[0] = j;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -21,7 +21,9 @@ typedef struct tc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -30,9 +32,9 @@ typedef struct tc
} tc_t; } tc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_truecrypt_keyfile.cl"
#endif #endif
typedef struct tc64_tmp typedef struct tc64_tmp
@ -130,105 +132,50 @@ KERNEL_FQ void m06223_init (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
u32 w4[4];
u32 w5[4];
u32 w6[4];
u32 w7[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w4[0] = pws[gid].i[16]; w[16] = pws[gid].i[16];
w4[1] = pws[gid].i[17]; w[17] = pws[gid].i[17];
w4[2] = pws[gid].i[18]; w[18] = pws[gid].i[18];
w4[3] = pws[gid].i[19]; w[19] = pws[gid].i[19];
w5[0] = pws[gid].i[20]; w[20] = pws[gid].i[20];
w5[1] = pws[gid].i[21]; w[21] = pws[gid].i[21];
w5[2] = pws[gid].i[22]; w[22] = pws[gid].i[22];
w5[3] = pws[gid].i[23]; w[23] = pws[gid].i[23];
w6[0] = pws[gid].i[24]; w[24] = pws[gid].i[24];
w6[1] = pws[gid].i[25]; w[25] = pws[gid].i[25];
w6[2] = pws[gid].i[26]; w[26] = pws[gid].i[26];
w6[3] = pws[gid].i[27]; w[27] = pws[gid].i[27];
w7[0] = pws[gid].i[28]; w[28] = pws[gid].i[28];
w7[1] = pws[gid].i[29]; w[29] = pws[gid].i[29];
w7[2] = pws[gid].i[30]; w[30] = pws[gid].i[30];
w7[3] = pws[gid].i[31]; w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_tc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
w0[0] = hc_swap32_S (w0[0]);
w0[1] = hc_swap32_S (w0[1]);
w0[2] = hc_swap32_S (w0[2]);
w0[3] = hc_swap32_S (w0[3]);
w1[0] = hc_swap32_S (w1[0]);
w1[1] = hc_swap32_S (w1[1]);
w1[2] = hc_swap32_S (w1[2]);
w1[3] = hc_swap32_S (w1[3]);
w2[0] = hc_swap32_S (w2[0]);
w2[1] = hc_swap32_S (w2[1]);
w2[2] = hc_swap32_S (w2[2]);
w2[3] = hc_swap32_S (w2[3]);
w3[0] = hc_swap32_S (w3[0]);
w3[1] = hc_swap32_S (w3[1]);
w3[2] = hc_swap32_S (w3[2]);
w3[3] = hc_swap32_S (w3[3]);
w4[0] = hc_swap32_S (w4[0]);
w4[1] = hc_swap32_S (w4[1]);
w4[2] = hc_swap32_S (w4[2]);
w4[3] = hc_swap32_S (w4[3]);
w5[0] = hc_swap32_S (w5[0]);
w5[1] = hc_swap32_S (w5[1]);
w5[2] = hc_swap32_S (w5[2]);
w5[3] = hc_swap32_S (w5[3]);
w6[0] = hc_swap32_S (w6[0]);
w6[1] = hc_swap32_S (w6[1]);
w6[2] = hc_swap32_S (w6[2]);
w6[3] = hc_swap32_S (w6[3]);
w7[0] = hc_swap32_S (w7[0]);
w7[1] = hc_swap32_S (w7[1]);
w7[2] = hc_swap32_S (w7[2]);
w7[3] = hc_swap32_S (w7[3]);
sha512_hmac_ctx_t sha512_hmac_ctx; sha512_hmac_ctx_t sha512_hmac_ctx;
sha512_hmac_init_128 (&sha512_hmac_ctx, w0, w1, w2, w3, w5, w5, w6, w7); sha512_hmac_init_swap (&sha512_hmac_ctx, w, pw_len);
tmps[gid].ipad[0] = sha512_hmac_ctx.ipad.h[0]; tmps[gid].ipad[0] = sha512_hmac_ctx.ipad.h[0];
tmps[gid].ipad[1] = sha512_hmac_ctx.ipad.h[1]; tmps[gid].ipad[1] = sha512_hmac_ctx.ipad.h[1];
@ -254,6 +201,15 @@ KERNEL_FQ void m06223_init (KERN_ATTR_TMPS_ESALT (tc64_tmp_t, tc_t))
{ {
sha512_hmac_ctx_t sha512_hmac_ctx2 = sha512_hmac_ctx; sha512_hmac_ctx_t sha512_hmac_ctx2 = sha512_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
u32 w4[4];
u32 w5[4];
u32 w6[4];
u32 w7[4];
w0[0] = j; w0[0] = j;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -21,7 +21,9 @@ typedef struct tc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -30,9 +32,9 @@ typedef struct tc
} tc_t; } tc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_truecrypt_keyfile.cl"
#endif #endif
typedef struct tc_tmp typedef struct tc_tmp
@ -210,69 +212,50 @@ KERNEL_FQ void m06231_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w[16] = pws[gid].i[16];
w[17] = pws[gid].i[17];
w[18] = pws[gid].i[18];
w[19] = pws[gid].i[19];
w[20] = pws[gid].i[20];
w[21] = pws[gid].i[21];
w[22] = pws[gid].i[22];
w[23] = pws[gid].i[23];
w[24] = pws[gid].i[24];
w[25] = pws[gid].i[25];
w[26] = pws[gid].i[26];
w[27] = pws[gid].i[27];
w[28] = pws[gid].i[28];
w[29] = pws[gid].i[29];
w[30] = pws[gid].i[30];
w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_tc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
w0[0] = hc_swap32_S (w0[0]);
w0[1] = hc_swap32_S (w0[1]);
w0[2] = hc_swap32_S (w0[2]);
w0[3] = hc_swap32_S (w0[3]);
w1[0] = hc_swap32_S (w1[0]);
w1[1] = hc_swap32_S (w1[1]);
w1[2] = hc_swap32_S (w1[2]);
w1[3] = hc_swap32_S (w1[3]);
w2[0] = hc_swap32_S (w2[0]);
w2[1] = hc_swap32_S (w2[1]);
w2[2] = hc_swap32_S (w2[2]);
w2[3] = hc_swap32_S (w2[3]);
w3[0] = hc_swap32_S (w3[0]);
w3[1] = hc_swap32_S (w3[1]);
w3[2] = hc_swap32_S (w3[2]);
w3[3] = hc_swap32_S (w3[3]);
whirlpool_hmac_ctx_t whirlpool_hmac_ctx; whirlpool_hmac_ctx_t whirlpool_hmac_ctx;
whirlpool_hmac_init_64 (&whirlpool_hmac_ctx, w0, w1, w2, w3, s_MT0, s_MT1, s_MT2, s_MT3, s_MT4, s_MT5, s_MT6, s_MT7); whirlpool_hmac_init_swap (&whirlpool_hmac_ctx, w, pw_len, s_MT0, s_MT1, s_MT2, s_MT3, s_MT4, s_MT5, s_MT6, s_MT7);
tmps[gid].ipad[ 0] = whirlpool_hmac_ctx.ipad.h[ 0]; tmps[gid].ipad[ 0] = whirlpool_hmac_ctx.ipad.h[ 0];
tmps[gid].ipad[ 1] = whirlpool_hmac_ctx.ipad.h[ 1]; tmps[gid].ipad[ 1] = whirlpool_hmac_ctx.ipad.h[ 1];
@ -314,6 +297,11 @@ KERNEL_FQ void m06231_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
{ {
whirlpool_hmac_ctx_t whirlpool_hmac_ctx2 = whirlpool_hmac_ctx; whirlpool_hmac_ctx_t whirlpool_hmac_ctx2 = whirlpool_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = j; w0[0] = j;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -21,7 +21,9 @@ typedef struct tc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -30,9 +32,9 @@ typedef struct tc
} tc_t; } tc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_truecrypt_keyfile.cl"
#endif #endif
typedef struct tc_tmp typedef struct tc_tmp
@ -210,69 +212,50 @@ KERNEL_FQ void m06232_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w[16] = pws[gid].i[16];
w[17] = pws[gid].i[17];
w[18] = pws[gid].i[18];
w[19] = pws[gid].i[19];
w[20] = pws[gid].i[20];
w[21] = pws[gid].i[21];
w[22] = pws[gid].i[22];
w[23] = pws[gid].i[23];
w[24] = pws[gid].i[24];
w[25] = pws[gid].i[25];
w[26] = pws[gid].i[26];
w[27] = pws[gid].i[27];
w[28] = pws[gid].i[28];
w[29] = pws[gid].i[29];
w[30] = pws[gid].i[30];
w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_tc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
w0[0] = hc_swap32_S (w0[0]);
w0[1] = hc_swap32_S (w0[1]);
w0[2] = hc_swap32_S (w0[2]);
w0[3] = hc_swap32_S (w0[3]);
w1[0] = hc_swap32_S (w1[0]);
w1[1] = hc_swap32_S (w1[1]);
w1[2] = hc_swap32_S (w1[2]);
w1[3] = hc_swap32_S (w1[3]);
w2[0] = hc_swap32_S (w2[0]);
w2[1] = hc_swap32_S (w2[1]);
w2[2] = hc_swap32_S (w2[2]);
w2[3] = hc_swap32_S (w2[3]);
w3[0] = hc_swap32_S (w3[0]);
w3[1] = hc_swap32_S (w3[1]);
w3[2] = hc_swap32_S (w3[2]);
w3[3] = hc_swap32_S (w3[3]);
whirlpool_hmac_ctx_t whirlpool_hmac_ctx; whirlpool_hmac_ctx_t whirlpool_hmac_ctx;
whirlpool_hmac_init_64 (&whirlpool_hmac_ctx, w0, w1, w2, w3, s_MT0, s_MT1, s_MT2, s_MT3, s_MT4, s_MT5, s_MT6, s_MT7); whirlpool_hmac_init_swap (&whirlpool_hmac_ctx, w, pw_len, s_MT0, s_MT1, s_MT2, s_MT3, s_MT4, s_MT5, s_MT6, s_MT7);
tmps[gid].ipad[ 0] = whirlpool_hmac_ctx.ipad.h[ 0]; tmps[gid].ipad[ 0] = whirlpool_hmac_ctx.ipad.h[ 0];
tmps[gid].ipad[ 1] = whirlpool_hmac_ctx.ipad.h[ 1]; tmps[gid].ipad[ 1] = whirlpool_hmac_ctx.ipad.h[ 1];
@ -314,6 +297,11 @@ KERNEL_FQ void m06232_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
{ {
whirlpool_hmac_ctx_t whirlpool_hmac_ctx2 = whirlpool_hmac_ctx; whirlpool_hmac_ctx_t whirlpool_hmac_ctx2 = whirlpool_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = j; w0[0] = j;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -21,7 +21,9 @@ typedef struct tc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -30,9 +32,9 @@ typedef struct tc
} tc_t; } tc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_truecrypt_keyfile.cl"
#endif #endif
typedef struct tc_tmp typedef struct tc_tmp
@ -210,69 +212,50 @@ KERNEL_FQ void m06233_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w[16] = pws[gid].i[16];
w[17] = pws[gid].i[17];
w[18] = pws[gid].i[18];
w[19] = pws[gid].i[19];
w[20] = pws[gid].i[20];
w[21] = pws[gid].i[21];
w[22] = pws[gid].i[22];
w[23] = pws[gid].i[23];
w[24] = pws[gid].i[24];
w[25] = pws[gid].i[25];
w[26] = pws[gid].i[26];
w[27] = pws[gid].i[27];
w[28] = pws[gid].i[28];
w[29] = pws[gid].i[29];
w[30] = pws[gid].i[30];
w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_tc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
w0[0] = hc_swap32_S (w0[0]);
w0[1] = hc_swap32_S (w0[1]);
w0[2] = hc_swap32_S (w0[2]);
w0[3] = hc_swap32_S (w0[3]);
w1[0] = hc_swap32_S (w1[0]);
w1[1] = hc_swap32_S (w1[1]);
w1[2] = hc_swap32_S (w1[2]);
w1[3] = hc_swap32_S (w1[3]);
w2[0] = hc_swap32_S (w2[0]);
w2[1] = hc_swap32_S (w2[1]);
w2[2] = hc_swap32_S (w2[2]);
w2[3] = hc_swap32_S (w2[3]);
w3[0] = hc_swap32_S (w3[0]);
w3[1] = hc_swap32_S (w3[1]);
w3[2] = hc_swap32_S (w3[2]);
w3[3] = hc_swap32_S (w3[3]);
whirlpool_hmac_ctx_t whirlpool_hmac_ctx; whirlpool_hmac_ctx_t whirlpool_hmac_ctx;
whirlpool_hmac_init_64 (&whirlpool_hmac_ctx, w0, w1, w2, w3, s_MT0, s_MT1, s_MT2, s_MT3, s_MT4, s_MT5, s_MT6, s_MT7); whirlpool_hmac_init_swap (&whirlpool_hmac_ctx, w, pw_len, s_MT0, s_MT1, s_MT2, s_MT3, s_MT4, s_MT5, s_MT6, s_MT7);
tmps[gid].ipad[ 0] = whirlpool_hmac_ctx.ipad.h[ 0]; tmps[gid].ipad[ 0] = whirlpool_hmac_ctx.ipad.h[ 0];
tmps[gid].ipad[ 1] = whirlpool_hmac_ctx.ipad.h[ 1]; tmps[gid].ipad[ 1] = whirlpool_hmac_ctx.ipad.h[ 1];
@ -314,6 +297,11 @@ KERNEL_FQ void m06233_init (KERN_ATTR_TMPS_ESALT (tc_tmp_t, tc_t))
{ {
whirlpool_hmac_ctx_t whirlpool_hmac_ctx2 = whirlpool_hmac_ctx; whirlpool_hmac_ctx_t whirlpool_hmac_ctx2 = whirlpool_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = j; w0[0] = j;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -23,7 +23,9 @@ typedef struct vc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -36,10 +38,10 @@ typedef struct vc
} vc_t; } vc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl" #include "inc_veracrypt_xts.cl"
#include "inc_veracrypt_keyfile.cl"
#endif #endif
typedef struct vc_tmp typedef struct vc_tmp
@ -150,52 +152,50 @@ KERNEL_FQ void m13711_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w[16] = pws[gid].i[16];
w[17] = pws[gid].i[17];
w[18] = pws[gid].i[18];
w[19] = pws[gid].i[19];
w[20] = pws[gid].i[20];
w[21] = pws[gid].i[21];
w[22] = pws[gid].i[22];
w[23] = pws[gid].i[23];
w[24] = pws[gid].i[24];
w[25] = pws[gid].i[25];
w[26] = pws[gid].i[26];
w[27] = pws[gid].i[27];
w[28] = pws[gid].i[28];
w[29] = pws[gid].i[29];
w[30] = pws[gid].i[30];
w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_vc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
ripemd160_hmac_ctx_t ripemd160_hmac_ctx; ripemd160_hmac_ctx_t ripemd160_hmac_ctx;
ripemd160_hmac_init_64 (&ripemd160_hmac_ctx, w0, w1, w2, w3); ripemd160_hmac_init (&ripemd160_hmac_ctx, w, pw_len);
tmps[gid].ipad[0] = ripemd160_hmac_ctx.ipad.h[0]; tmps[gid].ipad[0] = ripemd160_hmac_ctx.ipad.h[0];
tmps[gid].ipad[1] = ripemd160_hmac_ctx.ipad.h[1]; tmps[gid].ipad[1] = ripemd160_hmac_ctx.ipad.h[1];
@ -215,6 +215,11 @@ KERNEL_FQ void m13711_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t))
{ {
ripemd160_hmac_ctx_t ripemd160_hmac_ctx2 = ripemd160_hmac_ctx; ripemd160_hmac_ctx_t ripemd160_hmac_ctx2 = ripemd160_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = j << 24; w0[0] = j << 24;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -23,7 +23,9 @@ typedef struct vc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -36,10 +38,10 @@ typedef struct vc
} vc_t; } vc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl" #include "inc_veracrypt_xts.cl"
#include "inc_veracrypt_keyfile.cl"
#endif #endif
typedef struct vc_tmp typedef struct vc_tmp
@ -201,52 +203,50 @@ KERNEL_FQ void m13712_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w[16] = pws[gid].i[16];
w[17] = pws[gid].i[17];
w[18] = pws[gid].i[18];
w[19] = pws[gid].i[19];
w[20] = pws[gid].i[20];
w[21] = pws[gid].i[21];
w[22] = pws[gid].i[22];
w[23] = pws[gid].i[23];
w[24] = pws[gid].i[24];
w[25] = pws[gid].i[25];
w[26] = pws[gid].i[26];
w[27] = pws[gid].i[27];
w[28] = pws[gid].i[28];
w[29] = pws[gid].i[29];
w[30] = pws[gid].i[30];
w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_vc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
ripemd160_hmac_ctx_t ripemd160_hmac_ctx; ripemd160_hmac_ctx_t ripemd160_hmac_ctx;
ripemd160_hmac_init_64 (&ripemd160_hmac_ctx, w0, w1, w2, w3); ripemd160_hmac_init (&ripemd160_hmac_ctx, w, pw_len);
tmps[gid].ipad[0] = ripemd160_hmac_ctx.ipad.h[0]; tmps[gid].ipad[0] = ripemd160_hmac_ctx.ipad.h[0];
tmps[gid].ipad[1] = ripemd160_hmac_ctx.ipad.h[1]; tmps[gid].ipad[1] = ripemd160_hmac_ctx.ipad.h[1];
@ -266,6 +266,11 @@ KERNEL_FQ void m13712_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t))
{ {
ripemd160_hmac_ctx_t ripemd160_hmac_ctx2 = ripemd160_hmac_ctx; ripemd160_hmac_ctx_t ripemd160_hmac_ctx2 = ripemd160_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = j << 24; w0[0] = j << 24;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -23,7 +23,9 @@ typedef struct vc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -36,10 +38,10 @@ typedef struct vc
} vc_t; } vc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl" #include "inc_veracrypt_xts.cl"
#include "inc_veracrypt_keyfile.cl"
#endif #endif
typedef struct vc_tmp typedef struct vc_tmp
@ -266,52 +268,50 @@ KERNEL_FQ void m13713_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w[16] = pws[gid].i[16];
w[17] = pws[gid].i[17];
w[18] = pws[gid].i[18];
w[19] = pws[gid].i[19];
w[20] = pws[gid].i[20];
w[21] = pws[gid].i[21];
w[22] = pws[gid].i[22];
w[23] = pws[gid].i[23];
w[24] = pws[gid].i[24];
w[25] = pws[gid].i[25];
w[26] = pws[gid].i[26];
w[27] = pws[gid].i[27];
w[28] = pws[gid].i[28];
w[29] = pws[gid].i[29];
w[30] = pws[gid].i[30];
w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_vc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
ripemd160_hmac_ctx_t ripemd160_hmac_ctx; ripemd160_hmac_ctx_t ripemd160_hmac_ctx;
ripemd160_hmac_init_64 (&ripemd160_hmac_ctx, w0, w1, w2, w3); ripemd160_hmac_init (&ripemd160_hmac_ctx, w, pw_len);
tmps[gid].ipad[0] = ripemd160_hmac_ctx.ipad.h[0]; tmps[gid].ipad[0] = ripemd160_hmac_ctx.ipad.h[0];
tmps[gid].ipad[1] = ripemd160_hmac_ctx.ipad.h[1]; tmps[gid].ipad[1] = ripemd160_hmac_ctx.ipad.h[1];
@ -331,6 +331,11 @@ KERNEL_FQ void m13713_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t))
{ {
ripemd160_hmac_ctx_t ripemd160_hmac_ctx2 = ripemd160_hmac_ctx; ripemd160_hmac_ctx_t ripemd160_hmac_ctx2 = ripemd160_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = j << 24; w0[0] = j << 24;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -23,7 +23,9 @@ typedef struct vc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -36,10 +38,10 @@ typedef struct vc
} vc_t; } vc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl" #include "inc_veracrypt_xts.cl"
#include "inc_veracrypt_keyfile.cl"
#endif #endif
typedef struct vc64_tmp typedef struct vc64_tmp
@ -172,105 +174,50 @@ KERNEL_FQ void m13721_init (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
u32 w4[4];
u32 w5[4];
u32 w6[4];
u32 w7[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w4[0] = pws[gid].i[16]; w[16] = pws[gid].i[16];
w4[1] = pws[gid].i[17]; w[17] = pws[gid].i[17];
w4[2] = pws[gid].i[18]; w[18] = pws[gid].i[18];
w4[3] = pws[gid].i[19]; w[19] = pws[gid].i[19];
w5[0] = pws[gid].i[20]; w[20] = pws[gid].i[20];
w5[1] = pws[gid].i[21]; w[21] = pws[gid].i[21];
w5[2] = pws[gid].i[22]; w[22] = pws[gid].i[22];
w5[3] = pws[gid].i[23]; w[23] = pws[gid].i[23];
w6[0] = pws[gid].i[24]; w[24] = pws[gid].i[24];
w6[1] = pws[gid].i[25]; w[25] = pws[gid].i[25];
w6[2] = pws[gid].i[26]; w[26] = pws[gid].i[26];
w6[3] = pws[gid].i[27]; w[27] = pws[gid].i[27];
w7[0] = pws[gid].i[28]; w[28] = pws[gid].i[28];
w7[1] = pws[gid].i[29]; w[29] = pws[gid].i[29];
w7[2] = pws[gid].i[30]; w[30] = pws[gid].i[30];
w7[3] = pws[gid].i[31]; w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_vc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
w0[0] = hc_swap32_S (w0[0]);
w0[1] = hc_swap32_S (w0[1]);
w0[2] = hc_swap32_S (w0[2]);
w0[3] = hc_swap32_S (w0[3]);
w1[0] = hc_swap32_S (w1[0]);
w1[1] = hc_swap32_S (w1[1]);
w1[2] = hc_swap32_S (w1[2]);
w1[3] = hc_swap32_S (w1[3]);
w2[0] = hc_swap32_S (w2[0]);
w2[1] = hc_swap32_S (w2[1]);
w2[2] = hc_swap32_S (w2[2]);
w2[3] = hc_swap32_S (w2[3]);
w3[0] = hc_swap32_S (w3[0]);
w3[1] = hc_swap32_S (w3[1]);
w3[2] = hc_swap32_S (w3[2]);
w3[3] = hc_swap32_S (w3[3]);
w4[0] = hc_swap32_S (w4[0]);
w4[1] = hc_swap32_S (w4[1]);
w4[2] = hc_swap32_S (w4[2]);
w4[3] = hc_swap32_S (w4[3]);
w5[0] = hc_swap32_S (w5[0]);
w5[1] = hc_swap32_S (w5[1]);
w5[2] = hc_swap32_S (w5[2]);
w5[3] = hc_swap32_S (w5[3]);
w6[0] = hc_swap32_S (w6[0]);
w6[1] = hc_swap32_S (w6[1]);
w6[2] = hc_swap32_S (w6[2]);
w6[3] = hc_swap32_S (w6[3]);
w7[0] = hc_swap32_S (w7[0]);
w7[1] = hc_swap32_S (w7[1]);
w7[2] = hc_swap32_S (w7[2]);
w7[3] = hc_swap32_S (w7[3]);
sha512_hmac_ctx_t sha512_hmac_ctx; sha512_hmac_ctx_t sha512_hmac_ctx;
sha512_hmac_init_128 (&sha512_hmac_ctx, w0, w1, w2, w3, w5, w5, w6, w7); sha512_hmac_init_swap (&sha512_hmac_ctx, w, pw_len);
tmps[gid].ipad[0] = sha512_hmac_ctx.ipad.h[0]; tmps[gid].ipad[0] = sha512_hmac_ctx.ipad.h[0];
tmps[gid].ipad[1] = sha512_hmac_ctx.ipad.h[1]; tmps[gid].ipad[1] = sha512_hmac_ctx.ipad.h[1];
@ -296,6 +243,15 @@ KERNEL_FQ void m13721_init (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t))
{ {
sha512_hmac_ctx_t sha512_hmac_ctx2 = sha512_hmac_ctx; sha512_hmac_ctx_t sha512_hmac_ctx2 = sha512_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
u32 w4[4];
u32 w5[4];
u32 w6[4];
u32 w7[4];
w0[0] = j; w0[0] = j;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -23,7 +23,9 @@ typedef struct vc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -36,10 +38,10 @@ typedef struct vc
} vc_t; } vc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl" #include "inc_veracrypt_xts.cl"
#include "inc_veracrypt_keyfile.cl"
#endif #endif
typedef struct vc64_tmp typedef struct vc64_tmp
@ -223,105 +225,50 @@ KERNEL_FQ void m13722_init (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
u32 w4[4];
u32 w5[4];
u32 w6[4];
u32 w7[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w4[0] = pws[gid].i[16]; w[16] = pws[gid].i[16];
w4[1] = pws[gid].i[17]; w[17] = pws[gid].i[17];
w4[2] = pws[gid].i[18]; w[18] = pws[gid].i[18];
w4[3] = pws[gid].i[19]; w[19] = pws[gid].i[19];
w5[0] = pws[gid].i[20]; w[20] = pws[gid].i[20];
w5[1] = pws[gid].i[21]; w[21] = pws[gid].i[21];
w5[2] = pws[gid].i[22]; w[22] = pws[gid].i[22];
w5[3] = pws[gid].i[23]; w[23] = pws[gid].i[23];
w6[0] = pws[gid].i[24]; w[24] = pws[gid].i[24];
w6[1] = pws[gid].i[25]; w[25] = pws[gid].i[25];
w6[2] = pws[gid].i[26]; w[26] = pws[gid].i[26];
w6[3] = pws[gid].i[27]; w[27] = pws[gid].i[27];
w7[0] = pws[gid].i[28]; w[28] = pws[gid].i[28];
w7[1] = pws[gid].i[29]; w[29] = pws[gid].i[29];
w7[2] = pws[gid].i[30]; w[30] = pws[gid].i[30];
w7[3] = pws[gid].i[31]; w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_vc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
w0[0] = hc_swap32_S (w0[0]);
w0[1] = hc_swap32_S (w0[1]);
w0[2] = hc_swap32_S (w0[2]);
w0[3] = hc_swap32_S (w0[3]);
w1[0] = hc_swap32_S (w1[0]);
w1[1] = hc_swap32_S (w1[1]);
w1[2] = hc_swap32_S (w1[2]);
w1[3] = hc_swap32_S (w1[3]);
w2[0] = hc_swap32_S (w2[0]);
w2[1] = hc_swap32_S (w2[1]);
w2[2] = hc_swap32_S (w2[2]);
w2[3] = hc_swap32_S (w2[3]);
w3[0] = hc_swap32_S (w3[0]);
w3[1] = hc_swap32_S (w3[1]);
w3[2] = hc_swap32_S (w3[2]);
w3[3] = hc_swap32_S (w3[3]);
w4[0] = hc_swap32_S (w4[0]);
w4[1] = hc_swap32_S (w4[1]);
w4[2] = hc_swap32_S (w4[2]);
w4[3] = hc_swap32_S (w4[3]);
w5[0] = hc_swap32_S (w5[0]);
w5[1] = hc_swap32_S (w5[1]);
w5[2] = hc_swap32_S (w5[2]);
w5[3] = hc_swap32_S (w5[3]);
w6[0] = hc_swap32_S (w6[0]);
w6[1] = hc_swap32_S (w6[1]);
w6[2] = hc_swap32_S (w6[2]);
w6[3] = hc_swap32_S (w6[3]);
w7[0] = hc_swap32_S (w7[0]);
w7[1] = hc_swap32_S (w7[1]);
w7[2] = hc_swap32_S (w7[2]);
w7[3] = hc_swap32_S (w7[3]);
sha512_hmac_ctx_t sha512_hmac_ctx; sha512_hmac_ctx_t sha512_hmac_ctx;
sha512_hmac_init_128 (&sha512_hmac_ctx, w0, w1, w2, w3, w5, w5, w6, w7); sha512_hmac_init_swap (&sha512_hmac_ctx, w, pw_len);
tmps[gid].ipad[0] = sha512_hmac_ctx.ipad.h[0]; tmps[gid].ipad[0] = sha512_hmac_ctx.ipad.h[0];
tmps[gid].ipad[1] = sha512_hmac_ctx.ipad.h[1]; tmps[gid].ipad[1] = sha512_hmac_ctx.ipad.h[1];
@ -347,6 +294,15 @@ KERNEL_FQ void m13722_init (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t))
{ {
sha512_hmac_ctx_t sha512_hmac_ctx2 = sha512_hmac_ctx; sha512_hmac_ctx_t sha512_hmac_ctx2 = sha512_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
u32 w4[4];
u32 w5[4];
u32 w6[4];
u32 w7[4];
w0[0] = j; w0[0] = j;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -23,7 +23,9 @@ typedef struct vc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -36,10 +38,10 @@ typedef struct vc
} vc_t; } vc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl" #include "inc_veracrypt_xts.cl"
#include "inc_veracrypt_keyfile.cl"
#endif #endif
typedef struct vc64_tmp typedef struct vc64_tmp
@ -288,105 +290,50 @@ KERNEL_FQ void m13723_init (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
u32 w4[4];
u32 w5[4];
u32 w6[4];
u32 w7[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w4[0] = pws[gid].i[16]; w[16] = pws[gid].i[16];
w4[1] = pws[gid].i[17]; w[17] = pws[gid].i[17];
w4[2] = pws[gid].i[18]; w[18] = pws[gid].i[18];
w4[3] = pws[gid].i[19]; w[19] = pws[gid].i[19];
w5[0] = pws[gid].i[20]; w[20] = pws[gid].i[20];
w5[1] = pws[gid].i[21]; w[21] = pws[gid].i[21];
w5[2] = pws[gid].i[22]; w[22] = pws[gid].i[22];
w5[3] = pws[gid].i[23]; w[23] = pws[gid].i[23];
w6[0] = pws[gid].i[24]; w[24] = pws[gid].i[24];
w6[1] = pws[gid].i[25]; w[25] = pws[gid].i[25];
w6[2] = pws[gid].i[26]; w[26] = pws[gid].i[26];
w6[3] = pws[gid].i[27]; w[27] = pws[gid].i[27];
w7[0] = pws[gid].i[28]; w[28] = pws[gid].i[28];
w7[1] = pws[gid].i[29]; w[29] = pws[gid].i[29];
w7[2] = pws[gid].i[30]; w[30] = pws[gid].i[30];
w7[3] = pws[gid].i[31]; w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_vc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
w0[0] = hc_swap32_S (w0[0]);
w0[1] = hc_swap32_S (w0[1]);
w0[2] = hc_swap32_S (w0[2]);
w0[3] = hc_swap32_S (w0[3]);
w1[0] = hc_swap32_S (w1[0]);
w1[1] = hc_swap32_S (w1[1]);
w1[2] = hc_swap32_S (w1[2]);
w1[3] = hc_swap32_S (w1[3]);
w2[0] = hc_swap32_S (w2[0]);
w2[1] = hc_swap32_S (w2[1]);
w2[2] = hc_swap32_S (w2[2]);
w2[3] = hc_swap32_S (w2[3]);
w3[0] = hc_swap32_S (w3[0]);
w3[1] = hc_swap32_S (w3[1]);
w3[2] = hc_swap32_S (w3[2]);
w3[3] = hc_swap32_S (w3[3]);
w4[0] = hc_swap32_S (w4[0]);
w4[1] = hc_swap32_S (w4[1]);
w4[2] = hc_swap32_S (w4[2]);
w4[3] = hc_swap32_S (w4[3]);
w5[0] = hc_swap32_S (w5[0]);
w5[1] = hc_swap32_S (w5[1]);
w5[2] = hc_swap32_S (w5[2]);
w5[3] = hc_swap32_S (w5[3]);
w6[0] = hc_swap32_S (w6[0]);
w6[1] = hc_swap32_S (w6[1]);
w6[2] = hc_swap32_S (w6[2]);
w6[3] = hc_swap32_S (w6[3]);
w7[0] = hc_swap32_S (w7[0]);
w7[1] = hc_swap32_S (w7[1]);
w7[2] = hc_swap32_S (w7[2]);
w7[3] = hc_swap32_S (w7[3]);
sha512_hmac_ctx_t sha512_hmac_ctx; sha512_hmac_ctx_t sha512_hmac_ctx;
sha512_hmac_init_128 (&sha512_hmac_ctx, w0, w1, w2, w3, w5, w5, w6, w7); sha512_hmac_init_swap (&sha512_hmac_ctx, w, pw_len);
tmps[gid].ipad[0] = sha512_hmac_ctx.ipad.h[0]; tmps[gid].ipad[0] = sha512_hmac_ctx.ipad.h[0];
tmps[gid].ipad[1] = sha512_hmac_ctx.ipad.h[1]; tmps[gid].ipad[1] = sha512_hmac_ctx.ipad.h[1];
@ -412,6 +359,15 @@ KERNEL_FQ void m13723_init (KERN_ATTR_TMPS_ESALT (vc64_tmp_t, vc_t))
{ {
sha512_hmac_ctx_t sha512_hmac_ctx2 = sha512_hmac_ctx; sha512_hmac_ctx_t sha512_hmac_ctx2 = sha512_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
u32 w4[4];
u32 w5[4];
u32 w6[4];
u32 w7[4];
w0[0] = j; w0[0] = j;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -23,7 +23,9 @@ typedef struct vc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -36,10 +38,10 @@ typedef struct vc
} vc_t; } vc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl" #include "inc_veracrypt_xts.cl"
#include "inc_veracrypt_keyfile.cl"
#endif #endif
typedef struct vc_tmp typedef struct vc_tmp
@ -252,69 +254,50 @@ KERNEL_FQ void m13731_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w[16] = pws[gid].i[16];
w[17] = pws[gid].i[17];
w[18] = pws[gid].i[18];
w[19] = pws[gid].i[19];
w[20] = pws[gid].i[20];
w[21] = pws[gid].i[21];
w[22] = pws[gid].i[22];
w[23] = pws[gid].i[23];
w[24] = pws[gid].i[24];
w[25] = pws[gid].i[25];
w[26] = pws[gid].i[26];
w[27] = pws[gid].i[27];
w[28] = pws[gid].i[28];
w[29] = pws[gid].i[29];
w[30] = pws[gid].i[30];
w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_vc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
w0[0] = hc_swap32_S (w0[0]);
w0[1] = hc_swap32_S (w0[1]);
w0[2] = hc_swap32_S (w0[2]);
w0[3] = hc_swap32_S (w0[3]);
w1[0] = hc_swap32_S (w1[0]);
w1[1] = hc_swap32_S (w1[1]);
w1[2] = hc_swap32_S (w1[2]);
w1[3] = hc_swap32_S (w1[3]);
w2[0] = hc_swap32_S (w2[0]);
w2[1] = hc_swap32_S (w2[1]);
w2[2] = hc_swap32_S (w2[2]);
w2[3] = hc_swap32_S (w2[3]);
w3[0] = hc_swap32_S (w3[0]);
w3[1] = hc_swap32_S (w3[1]);
w3[2] = hc_swap32_S (w3[2]);
w3[3] = hc_swap32_S (w3[3]);
whirlpool_hmac_ctx_t whirlpool_hmac_ctx; whirlpool_hmac_ctx_t whirlpool_hmac_ctx;
whirlpool_hmac_init_64 (&whirlpool_hmac_ctx, w0, w1, w2, w3, s_MT0, s_MT1, s_MT2, s_MT3, s_MT4, s_MT5, s_MT6, s_MT7); whirlpool_hmac_init_swap (&whirlpool_hmac_ctx, w, pw_len, s_MT0, s_MT1, s_MT2, s_MT3, s_MT4, s_MT5, s_MT6, s_MT7);
tmps[gid].ipad[ 0] = whirlpool_hmac_ctx.ipad.h[ 0]; tmps[gid].ipad[ 0] = whirlpool_hmac_ctx.ipad.h[ 0];
tmps[gid].ipad[ 1] = whirlpool_hmac_ctx.ipad.h[ 1]; tmps[gid].ipad[ 1] = whirlpool_hmac_ctx.ipad.h[ 1];
@ -356,6 +339,11 @@ KERNEL_FQ void m13731_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t))
{ {
whirlpool_hmac_ctx_t whirlpool_hmac_ctx2 = whirlpool_hmac_ctx; whirlpool_hmac_ctx_t whirlpool_hmac_ctx2 = whirlpool_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = j; w0[0] = j;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -23,7 +23,9 @@ typedef struct vc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -36,10 +38,10 @@ typedef struct vc
} vc_t; } vc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl" #include "inc_veracrypt_xts.cl"
#include "inc_veracrypt_keyfile.cl"
#endif #endif
typedef struct vc_tmp typedef struct vc_tmp
@ -303,69 +305,50 @@ KERNEL_FQ void m13732_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w[16] = pws[gid].i[16];
w[17] = pws[gid].i[17];
w[18] = pws[gid].i[18];
w[19] = pws[gid].i[19];
w[20] = pws[gid].i[20];
w[21] = pws[gid].i[21];
w[22] = pws[gid].i[22];
w[23] = pws[gid].i[23];
w[24] = pws[gid].i[24];
w[25] = pws[gid].i[25];
w[26] = pws[gid].i[26];
w[27] = pws[gid].i[27];
w[28] = pws[gid].i[28];
w[29] = pws[gid].i[29];
w[30] = pws[gid].i[30];
w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_vc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
w0[0] = hc_swap32_S (w0[0]);
w0[1] = hc_swap32_S (w0[1]);
w0[2] = hc_swap32_S (w0[2]);
w0[3] = hc_swap32_S (w0[3]);
w1[0] = hc_swap32_S (w1[0]);
w1[1] = hc_swap32_S (w1[1]);
w1[2] = hc_swap32_S (w1[2]);
w1[3] = hc_swap32_S (w1[3]);
w2[0] = hc_swap32_S (w2[0]);
w2[1] = hc_swap32_S (w2[1]);
w2[2] = hc_swap32_S (w2[2]);
w2[3] = hc_swap32_S (w2[3]);
w3[0] = hc_swap32_S (w3[0]);
w3[1] = hc_swap32_S (w3[1]);
w3[2] = hc_swap32_S (w3[2]);
w3[3] = hc_swap32_S (w3[3]);
whirlpool_hmac_ctx_t whirlpool_hmac_ctx; whirlpool_hmac_ctx_t whirlpool_hmac_ctx;
whirlpool_hmac_init_64 (&whirlpool_hmac_ctx, w0, w1, w2, w3, s_MT0, s_MT1, s_MT2, s_MT3, s_MT4, s_MT5, s_MT6, s_MT7); whirlpool_hmac_init_swap (&whirlpool_hmac_ctx, w, pw_len, s_MT0, s_MT1, s_MT2, s_MT3, s_MT4, s_MT5, s_MT6, s_MT7);
tmps[gid].ipad[ 0] = whirlpool_hmac_ctx.ipad.h[ 0]; tmps[gid].ipad[ 0] = whirlpool_hmac_ctx.ipad.h[ 0];
tmps[gid].ipad[ 1] = whirlpool_hmac_ctx.ipad.h[ 1]; tmps[gid].ipad[ 1] = whirlpool_hmac_ctx.ipad.h[ 1];
@ -407,6 +390,11 @@ KERNEL_FQ void m13732_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t))
{ {
whirlpool_hmac_ctx_t whirlpool_hmac_ctx2 = whirlpool_hmac_ctx; whirlpool_hmac_ctx_t whirlpool_hmac_ctx2 = whirlpool_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = j; w0[0] = j;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -23,7 +23,9 @@ typedef struct vc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -36,10 +38,10 @@ typedef struct vc
} vc_t; } vc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl" #include "inc_veracrypt_xts.cl"
#include "inc_veracrypt_keyfile.cl"
#endif #endif
typedef struct vc_tmp typedef struct vc_tmp
@ -368,69 +370,50 @@ KERNEL_FQ void m13733_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w[16] = pws[gid].i[16];
w[17] = pws[gid].i[17];
w[18] = pws[gid].i[18];
w[19] = pws[gid].i[19];
w[20] = pws[gid].i[20];
w[21] = pws[gid].i[21];
w[22] = pws[gid].i[22];
w[23] = pws[gid].i[23];
w[24] = pws[gid].i[24];
w[25] = pws[gid].i[25];
w[26] = pws[gid].i[26];
w[27] = pws[gid].i[27];
w[28] = pws[gid].i[28];
w[29] = pws[gid].i[29];
w[30] = pws[gid].i[30];
w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_vc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
w0[0] = hc_swap32_S (w0[0]);
w0[1] = hc_swap32_S (w0[1]);
w0[2] = hc_swap32_S (w0[2]);
w0[3] = hc_swap32_S (w0[3]);
w1[0] = hc_swap32_S (w1[0]);
w1[1] = hc_swap32_S (w1[1]);
w1[2] = hc_swap32_S (w1[2]);
w1[3] = hc_swap32_S (w1[3]);
w2[0] = hc_swap32_S (w2[0]);
w2[1] = hc_swap32_S (w2[1]);
w2[2] = hc_swap32_S (w2[2]);
w2[3] = hc_swap32_S (w2[3]);
w3[0] = hc_swap32_S (w3[0]);
w3[1] = hc_swap32_S (w3[1]);
w3[2] = hc_swap32_S (w3[2]);
w3[3] = hc_swap32_S (w3[3]);
whirlpool_hmac_ctx_t whirlpool_hmac_ctx; whirlpool_hmac_ctx_t whirlpool_hmac_ctx;
whirlpool_hmac_init_64 (&whirlpool_hmac_ctx, w0, w1, w2, w3, s_MT0, s_MT1, s_MT2, s_MT3, s_MT4, s_MT5, s_MT6, s_MT7); whirlpool_hmac_init_swap (&whirlpool_hmac_ctx, w, pw_len, s_MT0, s_MT1, s_MT2, s_MT3, s_MT4, s_MT5, s_MT6, s_MT7);
tmps[gid].ipad[ 0] = whirlpool_hmac_ctx.ipad.h[ 0]; tmps[gid].ipad[ 0] = whirlpool_hmac_ctx.ipad.h[ 0];
tmps[gid].ipad[ 1] = whirlpool_hmac_ctx.ipad.h[ 1]; tmps[gid].ipad[ 1] = whirlpool_hmac_ctx.ipad.h[ 1];
@ -472,6 +455,11 @@ KERNEL_FQ void m13733_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t))
{ {
whirlpool_hmac_ctx_t whirlpool_hmac_ctx2 = whirlpool_hmac_ctx; whirlpool_hmac_ctx_t whirlpool_hmac_ctx2 = whirlpool_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = j; w0[0] = j;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -23,7 +23,9 @@ typedef struct vc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -36,10 +38,10 @@ typedef struct vc
} vc_t; } vc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl" #include "inc_veracrypt_xts.cl"
#include "inc_veracrypt_keyfile.cl"
#endif #endif
typedef struct vc_tmp typedef struct vc_tmp
@ -156,69 +158,50 @@ KERNEL_FQ void m13751_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w[16] = pws[gid].i[16];
w[17] = pws[gid].i[17];
w[18] = pws[gid].i[18];
w[19] = pws[gid].i[19];
w[20] = pws[gid].i[20];
w[21] = pws[gid].i[21];
w[22] = pws[gid].i[22];
w[23] = pws[gid].i[23];
w[24] = pws[gid].i[24];
w[25] = pws[gid].i[25];
w[26] = pws[gid].i[26];
w[27] = pws[gid].i[27];
w[28] = pws[gid].i[28];
w[29] = pws[gid].i[29];
w[30] = pws[gid].i[30];
w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_vc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
w0[0] = hc_swap32_S (w0[0]);
w0[1] = hc_swap32_S (w0[1]);
w0[2] = hc_swap32_S (w0[2]);
w0[3] = hc_swap32_S (w0[3]);
w1[0] = hc_swap32_S (w1[0]);
w1[1] = hc_swap32_S (w1[1]);
w1[2] = hc_swap32_S (w1[2]);
w1[3] = hc_swap32_S (w1[3]);
w2[0] = hc_swap32_S (w2[0]);
w2[1] = hc_swap32_S (w2[1]);
w2[2] = hc_swap32_S (w2[2]);
w2[3] = hc_swap32_S (w2[3]);
w3[0] = hc_swap32_S (w3[0]);
w3[1] = hc_swap32_S (w3[1]);
w3[2] = hc_swap32_S (w3[2]);
w3[3] = hc_swap32_S (w3[3]);
sha256_hmac_ctx_t sha256_hmac_ctx; sha256_hmac_ctx_t sha256_hmac_ctx;
sha256_hmac_init_64 (&sha256_hmac_ctx, w0, w1, w2, w3); sha256_hmac_init_swap (&sha256_hmac_ctx, w, pw_len);
tmps[gid].ipad[0] = sha256_hmac_ctx.ipad.h[0]; tmps[gid].ipad[0] = sha256_hmac_ctx.ipad.h[0];
tmps[gid].ipad[1] = sha256_hmac_ctx.ipad.h[1]; tmps[gid].ipad[1] = sha256_hmac_ctx.ipad.h[1];
@ -244,6 +227,15 @@ KERNEL_FQ void m13751_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t))
{ {
sha256_hmac_ctx_t sha256_hmac_ctx2 = sha256_hmac_ctx; sha256_hmac_ctx_t sha256_hmac_ctx2 = sha256_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
u32 w4[4];
u32 w5[4];
u32 w6[4];
u32 w7[4];
w0[0] = j; w0[0] = j;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -23,7 +23,9 @@ typedef struct vc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -36,10 +38,10 @@ typedef struct vc
} vc_t; } vc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl" #include "inc_veracrypt_xts.cl"
#include "inc_veracrypt_keyfile.cl"
#endif #endif
typedef struct vc_tmp typedef struct vc_tmp
@ -207,69 +209,50 @@ KERNEL_FQ void m13752_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w[16] = pws[gid].i[16];
w[17] = pws[gid].i[17];
w[18] = pws[gid].i[18];
w[19] = pws[gid].i[19];
w[20] = pws[gid].i[20];
w[21] = pws[gid].i[21];
w[22] = pws[gid].i[22];
w[23] = pws[gid].i[23];
w[24] = pws[gid].i[24];
w[25] = pws[gid].i[25];
w[26] = pws[gid].i[26];
w[27] = pws[gid].i[27];
w[28] = pws[gid].i[28];
w[29] = pws[gid].i[29];
w[30] = pws[gid].i[30];
w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_vc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
w0[0] = hc_swap32_S (w0[0]);
w0[1] = hc_swap32_S (w0[1]);
w0[2] = hc_swap32_S (w0[2]);
w0[3] = hc_swap32_S (w0[3]);
w1[0] = hc_swap32_S (w1[0]);
w1[1] = hc_swap32_S (w1[1]);
w1[2] = hc_swap32_S (w1[2]);
w1[3] = hc_swap32_S (w1[3]);
w2[0] = hc_swap32_S (w2[0]);
w2[1] = hc_swap32_S (w2[1]);
w2[2] = hc_swap32_S (w2[2]);
w2[3] = hc_swap32_S (w2[3]);
w3[0] = hc_swap32_S (w3[0]);
w3[1] = hc_swap32_S (w3[1]);
w3[2] = hc_swap32_S (w3[2]);
w3[3] = hc_swap32_S (w3[3]);
sha256_hmac_ctx_t sha256_hmac_ctx; sha256_hmac_ctx_t sha256_hmac_ctx;
sha256_hmac_init_64 (&sha256_hmac_ctx, w0, w1, w2, w3); sha256_hmac_init_swap (&sha256_hmac_ctx, w, pw_len);
tmps[gid].ipad[0] = sha256_hmac_ctx.ipad.h[0]; tmps[gid].ipad[0] = sha256_hmac_ctx.ipad.h[0];
tmps[gid].ipad[1] = sha256_hmac_ctx.ipad.h[1]; tmps[gid].ipad[1] = sha256_hmac_ctx.ipad.h[1];
@ -295,6 +278,15 @@ KERNEL_FQ void m13752_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t))
{ {
sha256_hmac_ctx_t sha256_hmac_ctx2 = sha256_hmac_ctx; sha256_hmac_ctx_t sha256_hmac_ctx2 = sha256_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
u32 w4[4];
u32 w5[4];
u32 w6[4];
u32 w7[4];
w0[0] = j; w0[0] = j;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -23,7 +23,9 @@ typedef struct vc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -36,10 +38,10 @@ typedef struct vc
} vc_t; } vc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl" #include "inc_veracrypt_xts.cl"
#include "inc_veracrypt_keyfile.cl"
#endif #endif
typedef struct vc_tmp typedef struct vc_tmp
@ -272,69 +274,50 @@ KERNEL_FQ void m13753_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w[16] = pws[gid].i[16];
w[17] = pws[gid].i[17];
w[18] = pws[gid].i[18];
w[19] = pws[gid].i[19];
w[20] = pws[gid].i[20];
w[21] = pws[gid].i[21];
w[22] = pws[gid].i[22];
w[23] = pws[gid].i[23];
w[24] = pws[gid].i[24];
w[25] = pws[gid].i[25];
w[26] = pws[gid].i[26];
w[27] = pws[gid].i[27];
w[28] = pws[gid].i[28];
w[29] = pws[gid].i[29];
w[30] = pws[gid].i[30];
w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_vc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
w0[0] = hc_swap32_S (w0[0]);
w0[1] = hc_swap32_S (w0[1]);
w0[2] = hc_swap32_S (w0[2]);
w0[3] = hc_swap32_S (w0[3]);
w1[0] = hc_swap32_S (w1[0]);
w1[1] = hc_swap32_S (w1[1]);
w1[2] = hc_swap32_S (w1[2]);
w1[3] = hc_swap32_S (w1[3]);
w2[0] = hc_swap32_S (w2[0]);
w2[1] = hc_swap32_S (w2[1]);
w2[2] = hc_swap32_S (w2[2]);
w2[3] = hc_swap32_S (w2[3]);
w3[0] = hc_swap32_S (w3[0]);
w3[1] = hc_swap32_S (w3[1]);
w3[2] = hc_swap32_S (w3[2]);
w3[3] = hc_swap32_S (w3[3]);
sha256_hmac_ctx_t sha256_hmac_ctx; sha256_hmac_ctx_t sha256_hmac_ctx;
sha256_hmac_init_64 (&sha256_hmac_ctx, w0, w1, w2, w3); sha256_hmac_init_swap (&sha256_hmac_ctx, w, pw_len);
tmps[gid].ipad[0] = sha256_hmac_ctx.ipad.h[0]; tmps[gid].ipad[0] = sha256_hmac_ctx.ipad.h[0];
tmps[gid].ipad[1] = sha256_hmac_ctx.ipad.h[1]; tmps[gid].ipad[1] = sha256_hmac_ctx.ipad.h[1];
@ -360,6 +343,15 @@ KERNEL_FQ void m13753_init (KERN_ATTR_TMPS_ESALT (vc_tmp_t, vc_t))
{ {
sha256_hmac_ctx_t sha256_hmac_ctx2 = sha256_hmac_ctx; sha256_hmac_ctx_t sha256_hmac_ctx2 = sha256_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
u32 w4[4];
u32 w5[4];
u32 w6[4];
u32 w7[4];
w0[0] = j; w0[0] = j;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -23,7 +23,9 @@ typedef struct vc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -36,10 +38,10 @@ typedef struct vc
} vc_t; } vc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl" #include "inc_veracrypt_xts.cl"
#include "inc_veracrypt_keyfile.cl"
#endif #endif
typedef struct vc64_sbog_tmp typedef struct vc64_sbog_tmp
@ -222,69 +224,50 @@ KERNEL_FQ void m13771_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w[16] = pws[gid].i[16];
w[17] = pws[gid].i[17];
w[18] = pws[gid].i[18];
w[19] = pws[gid].i[19];
w[20] = pws[gid].i[20];
w[21] = pws[gid].i[21];
w[22] = pws[gid].i[22];
w[23] = pws[gid].i[23];
w[24] = pws[gid].i[24];
w[25] = pws[gid].i[25];
w[26] = pws[gid].i[26];
w[27] = pws[gid].i[27];
w[28] = pws[gid].i[28];
w[29] = pws[gid].i[29];
w[30] = pws[gid].i[30];
w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_vc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
w0[0] = hc_swap32_S (w0[0]);
w0[1] = hc_swap32_S (w0[1]);
w0[2] = hc_swap32_S (w0[2]);
w0[3] = hc_swap32_S (w0[3]);
w1[0] = hc_swap32_S (w1[0]);
w1[1] = hc_swap32_S (w1[1]);
w1[2] = hc_swap32_S (w1[2]);
w1[3] = hc_swap32_S (w1[3]);
w2[0] = hc_swap32_S (w2[0]);
w2[1] = hc_swap32_S (w2[1]);
w2[2] = hc_swap32_S (w2[2]);
w2[3] = hc_swap32_S (w2[3]);
w3[0] = hc_swap32_S (w3[0]);
w3[1] = hc_swap32_S (w3[1]);
w3[2] = hc_swap32_S (w3[2]);
w3[3] = hc_swap32_S (w3[3]);
streebog512_hmac_ctx_t streebog512_hmac_ctx; streebog512_hmac_ctx_t streebog512_hmac_ctx;
streebog512_hmac_init_64 (&streebog512_hmac_ctx, w0, w1, w2, w3, s_sbob_sl64); streebog512_hmac_init_swap (&streebog512_hmac_ctx, w, pw_len, s_sbob_sl64);
tmps[gid].ipad_hash[0] = streebog512_hmac_ctx.ipad.h[0]; tmps[gid].ipad_hash[0] = streebog512_hmac_ctx.ipad.h[0];
tmps[gid].ipad_hash[1] = streebog512_hmac_ctx.ipad.h[1]; tmps[gid].ipad_hash[1] = streebog512_hmac_ctx.ipad.h[1];
@ -328,6 +311,11 @@ KERNEL_FQ void m13771_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t))
{ {
streebog512_hmac_ctx_t streebog512_hmac_ctx2 = streebog512_hmac_ctx; streebog512_hmac_ctx_t streebog512_hmac_ctx2 = streebog512_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = j; w0[0] = j;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -23,7 +23,9 @@ typedef struct vc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -36,10 +38,10 @@ typedef struct vc
} vc_t; } vc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl" #include "inc_veracrypt_xts.cl"
#include "inc_veracrypt_keyfile.cl"
#endif #endif
typedef struct vc64_sbog_tmp typedef struct vc64_sbog_tmp
@ -273,69 +275,50 @@ KERNEL_FQ void m13772_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w[16] = pws[gid].i[16];
w[17] = pws[gid].i[17];
w[18] = pws[gid].i[18];
w[19] = pws[gid].i[19];
w[20] = pws[gid].i[20];
w[21] = pws[gid].i[21];
w[22] = pws[gid].i[22];
w[23] = pws[gid].i[23];
w[24] = pws[gid].i[24];
w[25] = pws[gid].i[25];
w[26] = pws[gid].i[26];
w[27] = pws[gid].i[27];
w[28] = pws[gid].i[28];
w[29] = pws[gid].i[29];
w[30] = pws[gid].i[30];
w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_vc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
w0[0] = hc_swap32_S (w0[0]);
w0[1] = hc_swap32_S (w0[1]);
w0[2] = hc_swap32_S (w0[2]);
w0[3] = hc_swap32_S (w0[3]);
w1[0] = hc_swap32_S (w1[0]);
w1[1] = hc_swap32_S (w1[1]);
w1[2] = hc_swap32_S (w1[2]);
w1[3] = hc_swap32_S (w1[3]);
w2[0] = hc_swap32_S (w2[0]);
w2[1] = hc_swap32_S (w2[1]);
w2[2] = hc_swap32_S (w2[2]);
w2[3] = hc_swap32_S (w2[3]);
w3[0] = hc_swap32_S (w3[0]);
w3[1] = hc_swap32_S (w3[1]);
w3[2] = hc_swap32_S (w3[2]);
w3[3] = hc_swap32_S (w3[3]);
streebog512_hmac_ctx_t streebog512_hmac_ctx; streebog512_hmac_ctx_t streebog512_hmac_ctx;
streebog512_hmac_init_64 (&streebog512_hmac_ctx, w0, w1, w2, w3, s_sbob_sl64); streebog512_hmac_init_swap (&streebog512_hmac_ctx, w, pw_len, s_sbob_sl64);
tmps[gid].ipad_hash[0] = streebog512_hmac_ctx.ipad.h[0]; tmps[gid].ipad_hash[0] = streebog512_hmac_ctx.ipad.h[0];
tmps[gid].ipad_hash[1] = streebog512_hmac_ctx.ipad.h[1]; tmps[gid].ipad_hash[1] = streebog512_hmac_ctx.ipad.h[1];
@ -379,6 +362,11 @@ KERNEL_FQ void m13772_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t))
{ {
streebog512_hmac_ctx_t streebog512_hmac_ctx2 = streebog512_hmac_ctx; streebog512_hmac_ctx_t streebog512_hmac_ctx2 = streebog512_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = j; w0[0] = j;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -23,7 +23,9 @@ typedef struct vc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -36,10 +38,10 @@ typedef struct vc
} vc_t; } vc_t;
#ifdef KERNEL_STATIC #ifdef KERNEL_STATIC
#include "inc_truecrypt_keyfile.cl"
#include "inc_truecrypt_crc32.cl" #include "inc_truecrypt_crc32.cl"
#include "inc_truecrypt_xts.cl" #include "inc_truecrypt_xts.cl"
#include "inc_veracrypt_xts.cl" #include "inc_veracrypt_xts.cl"
#include "inc_veracrypt_keyfile.cl"
#endif #endif
typedef struct vc64_sbog_tmp typedef struct vc64_sbog_tmp
@ -338,69 +340,50 @@ KERNEL_FQ void m13773_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t))
* base * base
*/ */
u32 w0[4]; u32 w[32];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = pws[gid].i[ 0]; w[ 0] = pws[gid].i[ 0];
w0[1] = pws[gid].i[ 1]; w[ 1] = pws[gid].i[ 1];
w0[2] = pws[gid].i[ 2]; w[ 2] = pws[gid].i[ 2];
w0[3] = pws[gid].i[ 3]; w[ 3] = pws[gid].i[ 3];
w1[0] = pws[gid].i[ 4]; w[ 4] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5]; w[ 5] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6]; w[ 6] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7]; w[ 7] = pws[gid].i[ 7];
w2[0] = pws[gid].i[ 8]; w[ 8] = pws[gid].i[ 8];
w2[1] = pws[gid].i[ 9]; w[ 9] = pws[gid].i[ 9];
w2[2] = pws[gid].i[10]; w[10] = pws[gid].i[10];
w2[3] = pws[gid].i[11]; w[11] = pws[gid].i[11];
w3[0] = pws[gid].i[12]; w[12] = pws[gid].i[12];
w3[1] = pws[gid].i[13]; w[13] = pws[gid].i[13];
w3[2] = pws[gid].i[14]; w[14] = pws[gid].i[14];
w3[3] = pws[gid].i[15]; w[15] = pws[gid].i[15];
w[16] = pws[gid].i[16];
w[17] = pws[gid].i[17];
w[18] = pws[gid].i[18];
w[19] = pws[gid].i[19];
w[20] = pws[gid].i[20];
w[21] = pws[gid].i[21];
w[22] = pws[gid].i[22];
w[23] = pws[gid].i[23];
w[24] = pws[gid].i[24];
w[25] = pws[gid].i[25];
w[26] = pws[gid].i[26];
w[27] = pws[gid].i[27];
w[28] = pws[gid].i[28];
w[29] = pws[gid].i[29];
w[30] = pws[gid].i[30];
w[31] = pws[gid].i[31];
const u32 pw_len = pws[gid].pw_len; u32 pw_len = pws[gid].pw_len;
hc_execute_keyboard_layout_mapping (w0, w1, w2, w3, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt); hc_execute_keyboard_layout_mapping (w, pw_len, s_keyboard_layout_mapping_buf, keyboard_layout_mapping_cnt);
w0[0] = u8add (w0[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 0]); pw_len = hc_apply_keyfile_vc (w, pw_len, &esalt_bufs[DIGESTS_OFFSET]);
w0[1] = u8add (w0[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 1]);
w0[2] = u8add (w0[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 2]);
w0[3] = u8add (w0[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 3]);
w1[0] = u8add (w1[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 4]);
w1[1] = u8add (w1[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 5]);
w1[2] = u8add (w1[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 6]);
w1[3] = u8add (w1[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 7]);
w2[0] = u8add (w2[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 8]);
w2[1] = u8add (w2[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[ 9]);
w2[2] = u8add (w2[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[10]);
w2[3] = u8add (w2[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[11]);
w3[0] = u8add (w3[0], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[12]);
w3[1] = u8add (w3[1], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[13]);
w3[2] = u8add (w3[2], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[14]);
w3[3] = u8add (w3[3], esalt_bufs[DIGESTS_OFFSET].keyfile_buf[15]);
w0[0] = hc_swap32_S (w0[0]);
w0[1] = hc_swap32_S (w0[1]);
w0[2] = hc_swap32_S (w0[2]);
w0[3] = hc_swap32_S (w0[3]);
w1[0] = hc_swap32_S (w1[0]);
w1[1] = hc_swap32_S (w1[1]);
w1[2] = hc_swap32_S (w1[2]);
w1[3] = hc_swap32_S (w1[3]);
w2[0] = hc_swap32_S (w2[0]);
w2[1] = hc_swap32_S (w2[1]);
w2[2] = hc_swap32_S (w2[2]);
w2[3] = hc_swap32_S (w2[3]);
w3[0] = hc_swap32_S (w3[0]);
w3[1] = hc_swap32_S (w3[1]);
w3[2] = hc_swap32_S (w3[2]);
w3[3] = hc_swap32_S (w3[3]);
streebog512_hmac_ctx_t streebog512_hmac_ctx; streebog512_hmac_ctx_t streebog512_hmac_ctx;
streebog512_hmac_init_64 (&streebog512_hmac_ctx, w0, w1, w2, w3, s_sbob_sl64); streebog512_hmac_init_swap (&streebog512_hmac_ctx, w, pw_len, s_sbob_sl64);
tmps[gid].ipad_hash[0] = streebog512_hmac_ctx.ipad.h[0]; tmps[gid].ipad_hash[0] = streebog512_hmac_ctx.ipad.h[0];
tmps[gid].ipad_hash[1] = streebog512_hmac_ctx.ipad.h[1]; tmps[gid].ipad_hash[1] = streebog512_hmac_ctx.ipad.h[1];
@ -444,6 +427,11 @@ KERNEL_FQ void m13773_init (KERN_ATTR_TMPS_ESALT (vc64_sbog_tmp_t, vc_t))
{ {
streebog512_hmac_ctx_t streebog512_hmac_ctx2 = streebog512_hmac_ctx; streebog512_hmac_ctx_t streebog512_hmac_ctx2 = streebog512_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = j; w0[0] = j;
w0[1] = 0; w0[1] = 0;
w0[2] = 0; w0[2] = 0;

View File

@ -255,7 +255,7 @@ KERNEL_FQ void m15900_init (KERN_ATTR_TMPS_ESALT (dpapimk_tmp_v2_t, dpapimk_t))
sha512_hmac_ctx_t sha512_hmac_ctx; sha512_hmac_ctx_t sha512_hmac_ctx;
sha512_hmac_init_128 (&sha512_hmac_ctx, w0, w1, w2, w3, w5, w5, w6, w7); sha512_hmac_init_128 (&sha512_hmac_ctx, w0, w1, w2, w3, w4, w5, w6, w7);
tmps[gid].ipad64[0] = sha512_hmac_ctx.ipad.h[0]; tmps[gid].ipad64[0] = sha512_hmac_ctx.ipad.h[0];
tmps[gid].ipad64[1] = sha512_hmac_ctx.ipad.h[1]; tmps[gid].ipad64[1] = sha512_hmac_ctx.ipad.h[1];

View File

@ -1,455 +0,0 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#define NEW_SIMD_CODE
#ifdef KERNEL_STATIC
#include "inc_vendor.h"
#include "inc_types.h"
#include "inc_platform.cl"
#include "inc_common.cl"
#include "inc_simd.cl"
#include "inc_hash_sha256.cl"
#include "inc_cipher_aes.cl"
#include "inc_cipher_aes-gcm.cl"
#endif
#define COMPARE_S "inc_comp_single.cl"
#define COMPARE_M "inc_comp_multi.cl"
typedef struct pbkdf2_sha256_tmp
{
u32 ipad[8];
u32 opad[8];
u32 dgst[32];
u32 out[32];
} pbkdf2_sha256_tmp_t;
typedef struct pbkdf2_sha256_aes_gcm
{
u32 salt_buf[64];
u32 iv_buf[4];
u32 iv_len;
u32 ct_buf[16];
u32 ct_len;
} pbkdf2_sha256_aes_gcm_t;
DECLSPEC void hmac_sha256_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
{
digest[0] = ipad[0];
digest[1] = ipad[1];
digest[2] = ipad[2];
digest[3] = ipad[3];
digest[4] = ipad[4];
digest[5] = ipad[5];
digest[6] = ipad[6];
digest[7] = ipad[7];
sha256_transform_vector (w0, w1, w2, w3, digest);
w0[0] = digest[0];
w0[1] = digest[1];
w0[2] = digest[2];
w0[3] = digest[3];
w1[0] = digest[4];
w1[1] = digest[5];
w1[2] = digest[6];
w1[3] = digest[7];
w2[0] = 0x80000000;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = (64 + 32) * 8;
digest[0] = opad[0];
digest[1] = opad[1];
digest[2] = opad[2];
digest[3] = opad[3];
digest[4] = opad[4];
digest[5] = opad[5];
digest[6] = opad[6];
digest[7] = opad[7];
sha256_transform_vector (w0, w1, w2, w3, digest);
}
KERNEL_FQ void m25500_init (KERN_ATTR_TMPS_ESALT (pbkdf2_sha256_tmp_t, pbkdf2_sha256_aes_gcm_t))
{
/**
* base
*/
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
sha256_hmac_ctx_t sha256_hmac_ctx;
sha256_hmac_init_global_swap (&sha256_hmac_ctx, pws[gid].i, pws[gid].pw_len);
tmps[gid].ipad[0] = sha256_hmac_ctx.ipad.h[0];
tmps[gid].ipad[1] = sha256_hmac_ctx.ipad.h[1];
tmps[gid].ipad[2] = sha256_hmac_ctx.ipad.h[2];
tmps[gid].ipad[3] = sha256_hmac_ctx.ipad.h[3];
tmps[gid].ipad[4] = sha256_hmac_ctx.ipad.h[4];
tmps[gid].ipad[5] = sha256_hmac_ctx.ipad.h[5];
tmps[gid].ipad[6] = sha256_hmac_ctx.ipad.h[6];
tmps[gid].ipad[7] = sha256_hmac_ctx.ipad.h[7];
tmps[gid].opad[0] = sha256_hmac_ctx.opad.h[0];
tmps[gid].opad[1] = sha256_hmac_ctx.opad.h[1];
tmps[gid].opad[2] = sha256_hmac_ctx.opad.h[2];
tmps[gid].opad[3] = sha256_hmac_ctx.opad.h[3];
tmps[gid].opad[4] = sha256_hmac_ctx.opad.h[4];
tmps[gid].opad[5] = sha256_hmac_ctx.opad.h[5];
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].salt_buf, salt_bufs[SALT_POS].salt_len);
for (u32 i = 0, j = 1; i < 8; i += 8, j += 1)
{
sha256_hmac_ctx_t sha256_hmac_ctx2 = sha256_hmac_ctx;
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = j;
w0[1] = 0;
w0[2] = 0;
w0[3] = 0;
w1[0] = 0;
w1[1] = 0;
w1[2] = 0;
w1[3] = 0;
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = 0;
sha256_hmac_update_64 (&sha256_hmac_ctx2, w0, w1, w2, w3, 4);
sha256_hmac_final (&sha256_hmac_ctx2);
tmps[gid].dgst[i + 0] = sha256_hmac_ctx2.opad.h[0];
tmps[gid].dgst[i + 1] = sha256_hmac_ctx2.opad.h[1];
tmps[gid].dgst[i + 2] = sha256_hmac_ctx2.opad.h[2];
tmps[gid].dgst[i + 3] = sha256_hmac_ctx2.opad.h[3];
tmps[gid].dgst[i + 4] = sha256_hmac_ctx2.opad.h[4];
tmps[gid].dgst[i + 5] = sha256_hmac_ctx2.opad.h[5];
tmps[gid].dgst[i + 6] = sha256_hmac_ctx2.opad.h[6];
tmps[gid].dgst[i + 7] = sha256_hmac_ctx2.opad.h[7];
tmps[gid].out[i + 0] = tmps[gid].dgst[i + 0];
tmps[gid].out[i + 1] = tmps[gid].dgst[i + 1];
tmps[gid].out[i + 2] = tmps[gid].dgst[i + 2];
tmps[gid].out[i + 3] = tmps[gid].dgst[i + 3];
tmps[gid].out[i + 4] = tmps[gid].dgst[i + 4];
tmps[gid].out[i + 5] = tmps[gid].dgst[i + 5];
tmps[gid].out[i + 6] = tmps[gid].dgst[i + 6];
tmps[gid].out[i + 7] = tmps[gid].dgst[i + 7];
}
}
KERNEL_FQ void m25500_loop (KERN_ATTR_TMPS_ESALT (pbkdf2_sha256_tmp_t, pbkdf2_sha256_aes_gcm_t))
{
const u64 gid = get_global_id (0);
if ((gid * VECT_SIZE) >= gid_max) return;
u32x ipad[8];
u32x opad[8];
ipad[0] = packv (tmps, ipad, gid, 0);
ipad[1] = packv (tmps, ipad, gid, 1);
ipad[2] = packv (tmps, ipad, gid, 2);
ipad[3] = packv (tmps, ipad, gid, 3);
ipad[4] = packv (tmps, ipad, gid, 4);
ipad[5] = packv (tmps, ipad, gid, 5);
ipad[6] = packv (tmps, ipad, gid, 6);
ipad[7] = packv (tmps, ipad, gid, 7);
opad[0] = packv (tmps, opad, gid, 0);
opad[1] = packv (tmps, opad, gid, 1);
opad[2] = packv (tmps, opad, gid, 2);
opad[3] = packv (tmps, opad, gid, 3);
opad[4] = packv (tmps, opad, gid, 4);
opad[5] = packv (tmps, opad, gid, 5);
opad[6] = packv (tmps, opad, gid, 6);
opad[7] = packv (tmps, opad, gid, 7);
for (u32 i = 0; i < 8; i += 8)
{
u32x dgst[8];
u32x out[8];
dgst[0] = packv (tmps, dgst, gid, i + 0);
dgst[1] = packv (tmps, dgst, gid, i + 1);
dgst[2] = packv (tmps, dgst, gid, i + 2);
dgst[3] = packv (tmps, dgst, gid, i + 3);
dgst[4] = packv (tmps, dgst, gid, i + 4);
dgst[5] = packv (tmps, dgst, gid, i + 5);
dgst[6] = packv (tmps, dgst, gid, i + 6);
dgst[7] = packv (tmps, dgst, gid, i + 7);
out[0] = packv (tmps, out, gid, i + 0);
out[1] = packv (tmps, out, gid, i + 1);
out[2] = packv (tmps, out, gid, i + 2);
out[3] = packv (tmps, out, gid, i + 3);
out[4] = packv (tmps, out, gid, i + 4);
out[5] = packv (tmps, out, gid, i + 5);
out[6] = packv (tmps, out, gid, i + 6);
out[7] = packv (tmps, out, gid, i + 7);
for (u32 j = 0; j < loop_cnt; j++)
{
u32x w0[4];
u32x w1[4];
u32x w2[4];
u32x w3[4];
w0[0] = dgst[0];
w0[1] = dgst[1];
w0[2] = dgst[2];
w0[3] = dgst[3];
w1[0] = dgst[4];
w1[1] = dgst[5];
w1[2] = dgst[6];
w1[3] = dgst[7];
w2[0] = 0x80000000;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = (64 + 32) * 8;
hmac_sha256_run_V (w0, w1, w2, w3, ipad, opad, dgst);
out[0] ^= dgst[0];
out[1] ^= dgst[1];
out[2] ^= dgst[2];
out[3] ^= dgst[3];
out[4] ^= dgst[4];
out[5] ^= dgst[5];
out[6] ^= dgst[6];
out[7] ^= dgst[7];
}
unpackv (tmps, dgst, gid, i + 0, dgst[0]);
unpackv (tmps, dgst, gid, i + 1, dgst[1]);
unpackv (tmps, dgst, gid, i + 2, dgst[2]);
unpackv (tmps, dgst, gid, i + 3, dgst[3]);
unpackv (tmps, dgst, gid, i + 4, dgst[4]);
unpackv (tmps, dgst, gid, i + 5, dgst[5]);
unpackv (tmps, dgst, gid, i + 6, dgst[6]);
unpackv (tmps, dgst, gid, i + 7, dgst[7]);
unpackv (tmps, out, gid, i + 0, out[0]);
unpackv (tmps, out, gid, i + 1, out[1]);
unpackv (tmps, out, gid, i + 2, out[2]);
unpackv (tmps, out, gid, i + 3, out[3]);
unpackv (tmps, out, gid, i + 4, out[4]);
unpackv (tmps, out, gid, i + 5, out[5]);
unpackv (tmps, out, gid, i + 6, out[6]);
unpackv (tmps, out, gid, i + 7, out[7]);
}
}
KERNEL_FQ void m25500_comp (KERN_ATTR_TMPS_ESALT (pbkdf2_sha256_tmp_t, pbkdf2_sha256_aes_gcm_t))
{
const u64 gid = get_global_id (0);
const u64 lid = get_local_id (0);
const u64 lsz = get_local_size (0);
/**
* aes shared
*/
#ifdef REAL_SHM
LOCAL_VK u32 s_te0[256];
LOCAL_VK u32 s_te1[256];
LOCAL_VK u32 s_te2[256];
LOCAL_VK u32 s_te3[256];
LOCAL_VK u32 s_te4[256];
for (u32 i = lid; i < 256; i += lsz)
{
s_te0[i] = te0[i];
s_te1[i] = te1[i];
s_te2[i] = te2[i];
s_te3[i] = te3[i];
s_te4[i] = te4[i];
}
SYNC_THREADS ();
#else
CONSTANT_AS u32a *s_te0 = te0;
CONSTANT_AS u32a *s_te1 = te1;
CONSTANT_AS u32a *s_te2 = te2;
CONSTANT_AS u32a *s_te3 = te3;
CONSTANT_AS u32a *s_te4 = te4;
#endif
if (gid >= gid_max) return;
// keys
u32 ukey[8];
ukey[0] = tmps[gid].out[0];
ukey[1] = tmps[gid].out[1];
ukey[2] = tmps[gid].out[2];
ukey[3] = tmps[gid].out[3];
ukey[4] = tmps[gid].out[4];
ukey[5] = tmps[gid].out[5];
ukey[6] = tmps[gid].out[6];
ukey[7] = tmps[gid].out[7];
u32 key[60] = { 0 };
u32 subKey[4] = { 0 };
AES256_set_encrypt_key (key, ukey, s_te0, s_te1, s_te2, s_te3);
AES256_encrypt (key, subKey, subKey, s_te0, s_te1, s_te2, s_te3, s_te4);
// iv
const u32 iv[4] = {
esalt_bufs[DIGESTS_OFFSET].iv_buf[0],
esalt_bufs[DIGESTS_OFFSET].iv_buf[1],
esalt_bufs[DIGESTS_OFFSET].iv_buf[2],
esalt_bufs[DIGESTS_OFFSET].iv_buf[3]
};
u32 J0[4] = {
iv[0],
iv[1],
iv[2],
0x00000001
};
// ct
u32 enc[14] = { 0 };
enc[ 0] = esalt_bufs[DIGESTS_OFFSET].ct_buf[ 0];
enc[ 1] = esalt_bufs[DIGESTS_OFFSET].ct_buf[ 1];
enc[ 2] = esalt_bufs[DIGESTS_OFFSET].ct_buf[ 2];
enc[ 3] = esalt_bufs[DIGESTS_OFFSET].ct_buf[ 3];
enc[ 4] = esalt_bufs[DIGESTS_OFFSET].ct_buf[ 4];
enc[ 5] = esalt_bufs[DIGESTS_OFFSET].ct_buf[ 5];
enc[ 6] = esalt_bufs[DIGESTS_OFFSET].ct_buf[ 6];
enc[ 7] = esalt_bufs[DIGESTS_OFFSET].ct_buf[ 7];
enc[ 8] = esalt_bufs[DIGESTS_OFFSET].ct_buf[ 8];
enc[ 9] = esalt_bufs[DIGESTS_OFFSET].ct_buf[ 9];
enc[10] = esalt_bufs[DIGESTS_OFFSET].ct_buf[10];
enc[11] = esalt_bufs[DIGESTS_OFFSET].ct_buf[11];
enc[12] = esalt_bufs[DIGESTS_OFFSET].ct_buf[12];
enc[13] = esalt_bufs[DIGESTS_OFFSET].ct_buf[13];
u32 enc_len = esalt_bufs[DIGESTS_OFFSET].ct_len;
u32 S[4] = { 0 };
u32 t[4] = { 0 };
S[0] ^= enc[0];
S[1] ^= enc[1];
S[2] ^= enc[2];
S[3] ^= enc[3];
AES_GCM_gf_mult (S, subKey, t);
S[0] = t[0] ^ enc[4];
S[1] = t[1] ^ enc[5];
S[2] = t[2] ^ enc[6];
S[3] = t[3] ^ enc[7];
AES_GCM_gf_mult (S, subKey, t);
S[0] = t[0] ^ enc[8];
S[1] = t[1] ^ enc[9];
S[2] = t[2] ^ enc[10];
S[3] = t[3] ^ enc[11];
AES_GCM_gf_mult (S, subKey, t);
S[0] = t[0];
S[1] = t[1];
S[2] = t[2];
S[3] = t[3];
t[0] = enc[12];
t[1] = enc[13];
t[2] = 0;
t[3] = 0;
S[0] ^= t[0];
S[1] ^= t[1];
S[2] ^= t[2];
S[3] ^= t[3];
AES_GCM_gf_mult (S, subKey, t);
S[0] = t[0];
S[1] = t[1];
S[2] = t[2];
S[3] = t[3];
u32 len_buf[4] = { 0 };
len_buf[0] = 0;
len_buf[3] = enc_len * 8;
S[0] ^= len_buf[0];
S[1] ^= len_buf[1];
S[2] ^= len_buf[2];
S[3] ^= len_buf[3];
AES_GCM_gf_mult (S, subKey, t);
S[0] = t[0];
S[1] = t[1];
S[2] = t[2];
S[3] = t[3];
J0[3] = 0x00000001;
u32 T[4] = { 0 };
AES256_encrypt (key, J0, T, s_te0, s_te1, s_te2, s_te3, s_te4);
/* compare tag */
const u32 r0 = T[0] ^ S[0];
const u32 r1 = T[1] ^ S[1];
const u32 r2 = T[2] ^ S[2];
const u32 r3 = T[3] ^ S[3];
#define il_pos 0
#ifdef KERNEL_STATIC
#include COMPARE_M
#endif
}

View File

@ -403,3 +403,185 @@ KERNEL_FQ void m25500_comp (KERN_ATTR_TMPS_ESALT (pbkdf2_sha256_tmp_t, pbkdf2_sh
#include COMPARE_M #include COMPARE_M
#endif #endif
} }
/*
Optimized GCM: No real speed benefit. For documentation purpose
KERNEL_FQ void m25500_comp (KERN_ATTR_TMPS_ESALT (pbkdf2_sha256_tmp_t, pbkdf2_sha256_aes_gcm_t))
{
const u64 gid = get_global_id (0);
const u64 lid = get_local_id (0);
const u64 lsz = get_local_size (0);
#ifdef REAL_SHM
LOCAL_VK u32 s_te0[256];
LOCAL_VK u32 s_te1[256];
LOCAL_VK u32 s_te2[256];
LOCAL_VK u32 s_te3[256];
LOCAL_VK u32 s_te4[256];
for (u32 i = lid; i < 256; i += lsz)
{
s_te0[i] = te0[i];
s_te1[i] = te1[i];
s_te2[i] = te2[i];
s_te3[i] = te3[i];
s_te4[i] = te4[i];
}
SYNC_THREADS ();
#else
CONSTANT_AS u32a *s_te0 = te0;
CONSTANT_AS u32a *s_te1 = te1;
CONSTANT_AS u32a *s_te2 = te2;
CONSTANT_AS u32a *s_te3 = te3;
CONSTANT_AS u32a *s_te4 = te4;
#endif
if (gid >= gid_max) return;
// keys
u32 ukey[8];
ukey[0] = tmps[gid].out[0];
ukey[1] = tmps[gid].out[1];
ukey[2] = tmps[gid].out[2];
ukey[3] = tmps[gid].out[3];
ukey[4] = tmps[gid].out[4];
ukey[5] = tmps[gid].out[5];
ukey[6] = tmps[gid].out[6];
ukey[7] = tmps[gid].out[7];
u32 key[60] = { 0 };
u32 subKey[4] = { 0 };
AES256_set_encrypt_key (key, ukey, s_te0, s_te1, s_te2, s_te3);
AES256_encrypt (key, subKey, subKey, s_te0, s_te1, s_te2, s_te3, s_te4);
// iv
const u32 iv[4] = {
esalt_bufs[DIGESTS_OFFSET].iv_buf[0],
esalt_bufs[DIGESTS_OFFSET].iv_buf[1],
esalt_bufs[DIGESTS_OFFSET].iv_buf[2],
esalt_bufs[DIGESTS_OFFSET].iv_buf[3]
};
u32 J0[4] = {
iv[0],
iv[1],
iv[2],
0x00000001
};
// ct
u32 enc[14] = { 0 };
enc[ 0] = esalt_bufs[DIGESTS_OFFSET].ct_buf[ 0];
enc[ 1] = esalt_bufs[DIGESTS_OFFSET].ct_buf[ 1];
enc[ 2] = esalt_bufs[DIGESTS_OFFSET].ct_buf[ 2];
enc[ 3] = esalt_bufs[DIGESTS_OFFSET].ct_buf[ 3];
enc[ 4] = esalt_bufs[DIGESTS_OFFSET].ct_buf[ 4];
enc[ 5] = esalt_bufs[DIGESTS_OFFSET].ct_buf[ 5];
enc[ 6] = esalt_bufs[DIGESTS_OFFSET].ct_buf[ 6];
enc[ 7] = esalt_bufs[DIGESTS_OFFSET].ct_buf[ 7];
enc[ 8] = esalt_bufs[DIGESTS_OFFSET].ct_buf[ 8];
enc[ 9] = esalt_bufs[DIGESTS_OFFSET].ct_buf[ 9];
enc[10] = esalt_bufs[DIGESTS_OFFSET].ct_buf[10];
enc[11] = esalt_bufs[DIGESTS_OFFSET].ct_buf[11];
enc[12] = esalt_bufs[DIGESTS_OFFSET].ct_buf[12];
enc[13] = esalt_bufs[DIGESTS_OFFSET].ct_buf[13];
u32 enc_len = esalt_bufs[DIGESTS_OFFSET].ct_len;
u32 S[4] = { 0 };
u32 t[4] = { 0 };
S[0] ^= enc[0];
S[1] ^= enc[1];
S[2] ^= enc[2];
S[3] ^= enc[3];
AES_GCM_gf_mult (S, subKey, t);
S[0] = t[0] ^ enc[4];
S[1] = t[1] ^ enc[5];
S[2] = t[2] ^ enc[6];
S[3] = t[3] ^ enc[7];
AES_GCM_gf_mult (S, subKey, t);
S[0] = t[0] ^ enc[8];
S[1] = t[1] ^ enc[9];
S[2] = t[2] ^ enc[10];
S[3] = t[3] ^ enc[11];
AES_GCM_gf_mult (S, subKey, t);
S[0] = t[0];
S[1] = t[1];
S[2] = t[2];
S[3] = t[3];
t[0] = enc[12];
t[1] = enc[13];
t[2] = 0;
t[3] = 0;
S[0] ^= t[0];
S[1] ^= t[1];
S[2] ^= t[2];
S[3] ^= t[3];
AES_GCM_gf_mult (S, subKey, t);
S[0] = t[0];
S[1] = t[1];
S[2] = t[2];
S[3] = t[3];
u32 len_buf[4] = { 0 };
len_buf[0] = 0;
len_buf[3] = enc_len * 8;
S[0] ^= len_buf[0];
S[1] ^= len_buf[1];
S[2] ^= len_buf[2];
S[3] ^= len_buf[3];
AES_GCM_gf_mult (S, subKey, t);
S[0] = t[0];
S[1] = t[1];
S[2] = t[2];
S[3] = t[3];
J0[3] = 0x00000001;
u32 T[4] = { 0 };
AES256_encrypt (key, J0, T, s_te0, s_te1, s_te2, s_te3, s_te4);
const u32 r0 = T[0] ^ S[0];
const u32 r1 = T[1] ^ S[1];
const u32 r2 = T[2] ^ S[2];
const u32 r3 = T[3] ^ S[3];
#define il_pos 0
#ifdef KERNEL_STATIC
#include COMPARE_M
#endif
}
*/

234
OpenCL/m26200_a0-pure.cl Normal file
View File

@ -0,0 +1,234 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
//#define NEW_SIMD_CODE
#ifdef KERNEL_STATIC
#include "inc_vendor.h"
#include "inc_types.h"
#include "inc_platform.cl"
#include "inc_common.cl"
#include "inc_rp.h"
#include "inc_rp.cl"
#include "inc_scalar.cl"
#endif
CONSTANT_VK u32a PE_CONST[256] =
{
0, 49345, 49537, 320, 49921, 960, 640, 49729, 50689, 1728, 1920, 51009, 1280, 50625, 50305, 1088,
52225, 3264, 3456, 52545, 3840, 53185, 52865, 3648, 2560, 51905, 52097, 2880, 51457, 2496, 2176, 51265,
55297, 6336, 6528, 55617, 6912, 56257, 55937, 6720, 7680, 57025, 57217, 8000, 56577, 7616, 7296, 56385,
5120, 54465, 54657, 5440, 55041, 6080, 5760, 54849, 53761, 4800, 4992, 54081, 4352, 53697, 53377, 4160,
61441, 12480, 12672, 61761, 13056, 62401, 62081, 12864, 13824, 63169, 63361, 14144, 62721, 13760, 13440, 62529,
15360, 64705, 64897, 15680, 65281, 16320, 16000, 65089, 64001, 15040, 15232, 64321, 14592, 63937, 63617, 14400,
10240, 59585, 59777, 10560, 60161, 11200, 10880, 59969, 60929, 11968, 12160, 61249, 11520, 60865, 60545, 11328,
58369, 9408, 9600, 58689, 9984, 59329, 59009, 9792, 8704, 58049, 58241, 9024, 57601, 8640, 8320, 57409,
40961, 24768, 24960, 41281, 25344, 41921, 41601, 25152, 26112, 42689, 42881, 26432, 42241, 26048, 25728, 42049,
27648, 44225, 44417, 27968, 44801, 28608, 28288, 44609, 43521, 27328, 27520, 43841, 26880, 43457, 43137, 26688,
30720, 47297, 47489, 31040, 47873, 31680, 31360, 47681, 48641, 32448, 32640, 48961, 32000, 48577, 48257, 31808,
46081, 29888, 30080, 46401, 30464, 47041, 46721, 30272, 29184, 45761, 45953, 29504, 45313, 29120, 28800, 45121,
20480, 37057, 37249, 20800, 37633, 21440, 21120, 37441, 38401, 22208, 22400, 38721, 21760, 38337, 38017, 21568,
39937, 23744, 23936, 40257, 24320, 40897, 40577, 24128, 23040, 39617, 39809, 23360, 39169, 22976, 22656, 38977,
34817, 18624, 18816, 35137, 19200, 35777, 35457, 19008, 19968, 36545, 36737, 20288, 36097, 19904, 19584, 35905,
17408, 33985, 34177, 17728, 34561, 18368, 18048, 34369, 33281, 17088, 17280, 33601, 16640, 33217, 32897, 16448
};
KERNEL_FQ void m26200_mxx (KERN_ATTR_RULES ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
/**
* base
*/
COPY_PW (pws[gid]);
/**
* loop
*/
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
pw_t tmp = PASTE_PW;
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
u32 hash = 17;
u8 scratch[16] = { 0 };
u8 *input = (u8 *) tmp.i;
for (u32 i = 0; i < 5; i++)
{
for (u32 j = 0; j < tmp.pw_len; j++)
{
int idx = 15 - (j & 15);
scratch[idx] ^= input[j];
}
for (u32 j = 0; j < 16; j += 2)
{
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[15]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[14]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[13]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[12]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[11]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[10]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 9]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 8]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 7]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 6]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 5]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 4]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 3]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 2]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 1]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 0]]);
scratch[j] = (unsigned char)( hash & 0xff);
scratch[j + 1] = (unsigned char)((hash >> 8) & 0xff);
}
}
u8 target[16] = { 0 };
for (u32 i = 0; i < 16; i++)
{
u8 lower = (scratch[i] & 0x7f);
if ((lower >= 'A' && lower <= 'Z') || (lower >= 'a' && lower <= 'z'))
{
target[i] = lower;
}
else
{
target[i] = (u8)((scratch[i] >> 4) + 0x61);
}
}
u32 *digest = (u32 *) target;
const u32 r0 = digest[DGST_R0];
const u32 r1 = digest[DGST_R1];
const u32 r2 = digest[DGST_R2];
const u32 r3 = digest[DGST_R3];
COMPARE_M_SCALAR (r0, r1, r2, r3);
}
}
KERNEL_FQ void m26200_sxx (KERN_ATTR_RULES ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
/**
* digest
*/
const u32 search[4] =
{
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
* base
*/
COPY_PW (pws[gid]);
/**
* loop
*/
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
pw_t tmp = PASTE_PW;
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
u32 hash = 17;
u8 scratch[16] = { 0 };
u8 *input = (u8 *) tmp.i;
for (u32 i = 0; i < 5; i++)
{
for (u32 j = 0; j < tmp.pw_len; j++)
{
int idx = 15 - (j & 15);
scratch[idx] ^= input[j];
}
for (u32 j = 0; j < 16; j += 2)
{
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[15]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[14]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[13]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[12]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[11]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[10]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 9]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 8]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 7]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 6]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 5]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 4]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 3]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 2]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 1]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 0]]);
scratch[j] = (unsigned char)( hash & 0xff);
scratch[j + 1] = (unsigned char)((hash >> 8) & 0xff);
}
}
u8 target[16] = { 0 };
for (u32 i = 0; i < 16; i++)
{
u8 lower = (scratch[i] & 0x7f);
if ((lower >= 'A' && lower <= 'Z') || (lower >= 'a' && lower <= 'z'))
{
target[i] = lower;
}
else
{
target[i] = (u8)((scratch[i] >> 4) + 0x61);
}
}
u32 *digest = (u32 *) target;
const u32 r0 = digest[DGST_R0];
const u32 r1 = digest[DGST_R1];
const u32 r2 = digest[DGST_R2];
const u32 r3 = digest[DGST_R3];
COMPARE_S_SCALAR (r0, r1, r2, r3);
}
}

367
OpenCL/m26200_a1-pure.cl Normal file
View File

@ -0,0 +1,367 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
//#define NEW_SIMD_CODE
#ifdef KERNEL_STATIC
#include "inc_vendor.h"
#include "inc_types.h"
#include "inc_platform.cl"
#include "inc_common.cl"
#include "inc_simd.cl"
#endif
CONSTANT_VK u32a PE_CONST[256] =
{
0, 49345, 49537, 320, 49921, 960, 640, 49729, 50689, 1728, 1920, 51009, 1280, 50625, 50305, 1088,
52225, 3264, 3456, 52545, 3840, 53185, 52865, 3648, 2560, 51905, 52097, 2880, 51457, 2496, 2176, 51265,
55297, 6336, 6528, 55617, 6912, 56257, 55937, 6720, 7680, 57025, 57217, 8000, 56577, 7616, 7296, 56385,
5120, 54465, 54657, 5440, 55041, 6080, 5760, 54849, 53761, 4800, 4992, 54081, 4352, 53697, 53377, 4160,
61441, 12480, 12672, 61761, 13056, 62401, 62081, 12864, 13824, 63169, 63361, 14144, 62721, 13760, 13440, 62529,
15360, 64705, 64897, 15680, 65281, 16320, 16000, 65089, 64001, 15040, 15232, 64321, 14592, 63937, 63617, 14400,
10240, 59585, 59777, 10560, 60161, 11200, 10880, 59969, 60929, 11968, 12160, 61249, 11520, 60865, 60545, 11328,
58369, 9408, 9600, 58689, 9984, 59329, 59009, 9792, 8704, 58049, 58241, 9024, 57601, 8640, 8320, 57409,
40961, 24768, 24960, 41281, 25344, 41921, 41601, 25152, 26112, 42689, 42881, 26432, 42241, 26048, 25728, 42049,
27648, 44225, 44417, 27968, 44801, 28608, 28288, 44609, 43521, 27328, 27520, 43841, 26880, 43457, 43137, 26688,
30720, 47297, 47489, 31040, 47873, 31680, 31360, 47681, 48641, 32448, 32640, 48961, 32000, 48577, 48257, 31808,
46081, 29888, 30080, 46401, 30464, 47041, 46721, 30272, 29184, 45761, 45953, 29504, 45313, 29120, 28800, 45121,
20480, 37057, 37249, 20800, 37633, 21440, 21120, 37441, 38401, 22208, 22400, 38721, 21760, 38337, 38017, 21568,
39937, 23744, 23936, 40257, 24320, 40897, 40577, 24128, 23040, 39617, 39809, 23360, 39169, 22976, 22656, 38977,
34817, 18624, 18816, 35137, 19200, 35777, 35457, 19008, 19968, 36545, 36737, 20288, 36097, 19904, 19584, 35905,
17408, 33985, 34177, 17728, 34561, 18368, 18048, 34369, 33281, 17088, 17280, 33601, 16640, 33217, 32897, 16448
};
KERNEL_FQ void m26200_mxx (KERN_ATTR_BASIC ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
/**
* base
*/
u32 pw_buf0[4];
pw_buf0[0] = pws[gid].i[0];
pw_buf0[1] = pws[gid].i[1];
pw_buf0[2] = pws[gid].i[2];
pw_buf0[3] = pws[gid].i[3];
const u32 pw_l_len = pws[gid].pw_len & 63;
/**
* loop
*/
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
const u32 pw_r_len = pwlenx_create_combt (combs_buf, il_pos) & 63;
const u32 pw_len = (pw_l_len + pw_r_len) & 63;
/**
* concat password candidate
*/
u32 wordl0[4] = { 0 };
u32 wordl1[4] = { 0 };
u32 wordl2[4] = { 0 };
u32 wordl3[4] = { 0 };
wordl0[0] = pw_buf0[0];
wordl0[1] = pw_buf0[1];
wordl0[2] = pw_buf0[2];
wordl0[3] = pw_buf0[3];
u32 wordr0[4] = { 0 };
u32 wordr1[4] = { 0 };
u32 wordr2[4] = { 0 };
u32 wordr3[4] = { 0 };
wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
{
switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
}
else
{
switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
}
u32 w0[4];
u32 w1[4];
w0[0] = wordl0[0] | wordr0[0];
w0[1] = wordl0[1] | wordr0[1];
w0[2] = wordl0[2] | wordr0[2];
w0[3] = wordl0[3] | wordr0[3];
w1[0] = wordl1[0] | wordr1[0];
w1[1] = wordl1[1] | wordr1[1];
w1[2] = wordl1[2] | wordr1[2];
w1[3] = wordl1[3] | wordr1[3];
u32 w[8] = { 0 };
w[ 0] = w0[0];
w[ 1] = w0[1];
w[ 2] = w0[2];
w[ 3] = w0[3];
w[ 4] = w1[0];
w[ 5] = w1[1];
w[ 6] = w1[2];
w[ 7] = w1[3];
u32 hash = 17;
u8 scratch[16] = { 0 };
u8 *input = (u8 *) w;
for (u32 i = 0; i < 5; i++)
{
for (u32 j = 0; j < pw_len; j++)
{
int idx = 15 - (j & 15);
scratch[idx] ^= input[j];
}
for (u32 j = 0; j < 16; j += 2)
{
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[15]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[14]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[13]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[12]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[11]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[10]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 9]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 8]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 7]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 6]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 5]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 4]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 3]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 2]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 1]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 0]]);
scratch[j] = (unsigned char)( hash & 0xff);
scratch[j + 1] = (unsigned char)((hash >> 8) & 0xff);
}
}
u8 target[16] = { 0 };
for (u32 i = 0; i < 16; i++)
{
u8 lower = (scratch[i] & 0x7f);
if ((lower >= 'A' && lower <= 'Z') || (lower >= 'a' && lower <= 'z'))
{
target[i] = lower;
}
else
{
target[i] = (u8)((scratch[i] >> 4) + 0x61);
}
}
u32 *digest = (u32 *) target;
const u32 r0 = digest[DGST_R0];
const u32 r1 = digest[DGST_R1];
const u32 r2 = digest[DGST_R2];
const u32 r3 = digest[DGST_R3];
COMPARE_M_SIMD (r0, r1, r2, r3);
}
}
KERNEL_FQ void m26200_sxx (KERN_ATTR_BASIC ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
/**
* digest
*/
const u32 search[4] =
{
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
* base
*/
u32 pw_buf0[4];
pw_buf0[0] = pws[gid].i[0];
pw_buf0[1] = pws[gid].i[1];
pw_buf0[2] = pws[gid].i[2];
pw_buf0[3] = pws[gid].i[3];
const u32 pw_l_len = pws[gid].pw_len & 63;
/**
* loop
*/
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
const u32 pw_r_len = pwlenx_create_combt (combs_buf, il_pos) & 63;
const u32 pw_len = (pw_l_len + pw_r_len) & 63;
/**
* concat password candidate
*/
u32 wordl0[4] = { 0 };
u32 wordl1[4] = { 0 };
u32 wordl2[4] = { 0 };
u32 wordl3[4] = { 0 };
wordl0[0] = pw_buf0[0];
wordl0[1] = pw_buf0[1];
wordl0[2] = pw_buf0[2];
wordl0[3] = pw_buf0[3];
u32 wordr0[4] = { 0 };
u32 wordr1[4] = { 0 };
u32 wordr2[4] = { 0 };
u32 wordr3[4] = { 0 };
wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
{
switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
}
else
{
switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
}
u32 w0[4];
u32 w1[4];
w0[0] = wordl0[0] | wordr0[0];
w0[1] = wordl0[1] | wordr0[1];
w0[2] = wordl0[2] | wordr0[2];
w0[3] = wordl0[3] | wordr0[3];
w1[0] = wordl1[0] | wordr1[0];
w1[1] = wordl1[1] | wordr1[1];
w1[2] = wordl1[2] | wordr1[2];
w1[3] = wordl1[3] | wordr1[3];
u32 w[8] = { 0 };
w[ 0] = w0[0];
w[ 1] = w0[1];
w[ 2] = w0[2];
w[ 3] = w0[3];
w[ 4] = w1[0];
w[ 5] = w1[1];
w[ 6] = w1[2];
w[ 7] = w1[3];
u32 hash = 17;
u8 scratch[16] = { 0 };
u8 *input = (u8 *) w;
for (u32 i = 0; i < 5; i++)
{
for (u32 j = 0; j < pw_len; j++)
{
int idx = 15 - (j & 15);
scratch[idx] ^= input[j];
}
for (u32 j = 0; j < 16; j += 2)
{
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[15]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[14]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[13]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[12]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[11]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[10]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 9]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 8]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 7]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 6]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 5]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 4]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 3]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 2]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 1]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 0]]);
scratch[j] = (unsigned char)( hash & 0xff);
scratch[j + 1] = (unsigned char)((hash >> 8) & 0xff);
}
}
u8 target[16] = { 0 };
for (u32 i = 0; i < 16; i++)
{
u8 lower = (scratch[i] & 0x7f);
if ((lower >= 'A' && lower <= 'Z') || (lower >= 'a' && lower <= 'z'))
{
target[i] = lower;
}
else
{
target[i] = (u8)((scratch[i] >> 4) + 0x61);
}
}
u32 *digest = (u32 *) target;
const u32 r0 = digest[DGST_R0];
const u32 r1 = digest[DGST_R1];
const u32 r2 = digest[DGST_R2];
const u32 r3 = digest[DGST_R3];
COMPARE_S_SIMD (r0, r1, r2, r3);
}
}

254
OpenCL/m26200_a3-pure.cl Normal file
View File

@ -0,0 +1,254 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
//#define NEW_SIMD_CODE
#ifdef KERNEL_STATIC
#include "inc_vendor.h"
#include "inc_types.h"
#include "inc_platform.cl"
#include "inc_common.cl"
#include "inc_simd.cl"
#endif
CONSTANT_VK u32a PE_CONST[256] =
{
0, 49345, 49537, 320, 49921, 960, 640, 49729, 50689, 1728, 1920, 51009, 1280, 50625, 50305, 1088,
52225, 3264, 3456, 52545, 3840, 53185, 52865, 3648, 2560, 51905, 52097, 2880, 51457, 2496, 2176, 51265,
55297, 6336, 6528, 55617, 6912, 56257, 55937, 6720, 7680, 57025, 57217, 8000, 56577, 7616, 7296, 56385,
5120, 54465, 54657, 5440, 55041, 6080, 5760, 54849, 53761, 4800, 4992, 54081, 4352, 53697, 53377, 4160,
61441, 12480, 12672, 61761, 13056, 62401, 62081, 12864, 13824, 63169, 63361, 14144, 62721, 13760, 13440, 62529,
15360, 64705, 64897, 15680, 65281, 16320, 16000, 65089, 64001, 15040, 15232, 64321, 14592, 63937, 63617, 14400,
10240, 59585, 59777, 10560, 60161, 11200, 10880, 59969, 60929, 11968, 12160, 61249, 11520, 60865, 60545, 11328,
58369, 9408, 9600, 58689, 9984, 59329, 59009, 9792, 8704, 58049, 58241, 9024, 57601, 8640, 8320, 57409,
40961, 24768, 24960, 41281, 25344, 41921, 41601, 25152, 26112, 42689, 42881, 26432, 42241, 26048, 25728, 42049,
27648, 44225, 44417, 27968, 44801, 28608, 28288, 44609, 43521, 27328, 27520, 43841, 26880, 43457, 43137, 26688,
30720, 47297, 47489, 31040, 47873, 31680, 31360, 47681, 48641, 32448, 32640, 48961, 32000, 48577, 48257, 31808,
46081, 29888, 30080, 46401, 30464, 47041, 46721, 30272, 29184, 45761, 45953, 29504, 45313, 29120, 28800, 45121,
20480, 37057, 37249, 20800, 37633, 21440, 21120, 37441, 38401, 22208, 22400, 38721, 21760, 38337, 38017, 21568,
39937, 23744, 23936, 40257, 24320, 40897, 40577, 24128, 23040, 39617, 39809, 23360, 39169, 22976, 22656, 38977,
34817, 18624, 18816, 35137, 19200, 35777, 35457, 19008, 19968, 36545, 36737, 20288, 36097, 19904, 19584, 35905,
17408, 33985, 34177, 17728, 34561, 18368, 18048, 34369, 33281, 17088, 17280, 33601, 16640, 33217, 32897, 16448
};
KERNEL_FQ void m26200_mxx (KERN_ATTR_BASIC ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
/**
* base
*/
const u32 pw_len = pws[gid].pw_len;
u32 w[64] = { 0 };
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
/**
* loop
*/
u32 w0l = w[0];
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{
const u32 w0r = ix_create_bft (bfs_buf, il_pos);
const u32 w0 = w0l | w0r;
w[0] = w0;
u32 hash = 17;
u8 scratch[16] = { 0 };
u8 *input = (u8 *) w;
for (u32 i = 0; i < 5; i++)
{
for (u32 j = 0; j < pw_len; j++)
{
int idx = 15 - (j & 15);
scratch[idx] ^= input[j];
}
for (u32 j = 0; j < 16; j += 2)
{
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[15]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[14]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[13]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[12]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[11]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[10]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 9]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 8]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 7]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 6]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 5]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 4]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 3]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 2]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 1]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 0]]);
scratch[j] = (unsigned char)( hash & 0xff);
scratch[j + 1] = (unsigned char)((hash >> 8) & 0xff);
}
}
u8 target[16] = { 0 };
for (u32 i = 0; i < 16; i++)
{
u8 lower = (scratch[i] & 0x7f);
if ((lower >= 'A' && lower <= 'Z') || (lower >= 'a' && lower <= 'z'))
{
target[i] = lower;
}
else
{
target[i] = (u8)((scratch[i] >> 4) + 0x61);
}
}
u32 *digest = (u32 *) target;
const u32 r0 = digest[DGST_R0];
const u32 r1 = digest[DGST_R1];
const u32 r2 = digest[DGST_R2];
const u32 r3 = digest[DGST_R3];
COMPARE_M_SIMD (r0, r1, r2, r3);
}
}
KERNEL_FQ void m26200_sxx (KERN_ATTR_BASIC ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
/**
* digest
*/
const u32 search[4] =
{
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
* base
*/
const u32 pw_len = pws[gid].pw_len;
u32 w[64] = { 0 };
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
/**
* loop
*/
u32 w0l = w[0];
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{
const u32 w0r = ix_create_bft (bfs_buf, il_pos);
const u32 w0 = w0l | w0r;
w[0] = w0;
u32 hash = 17;
u8 scratch[16] = { 0 };
u8 *input = (u8 *) w;
for (u32 i = 0; i < 5; i++)
{
for (u32 j = 0; j < pw_len; j++)
{
int idx = 15 - (j & 15);
scratch[idx] ^= input[j];
}
for (u32 j = 0; j < 16; j += 2)
{
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[15]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[14]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[13]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[12]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[11]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[10]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 9]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 8]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 7]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 6]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 5]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 4]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 3]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 2]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 1]]);
hash = (hash >> 8 ^ PE_CONST[hash & 0xff] ^ PE_CONST[scratch[ 0]]);
scratch[j] = (unsigned char)( hash & 0xff);
scratch[j + 1] = (unsigned char)((hash >> 8) & 0xff);
}
}
u8 target[16] = { 0 };
for (u32 i = 0; i < 16; i++)
{
u8 lower = (scratch[i] & 0x7f);
if ((lower >= 'A' && lower <= 'Z') || (lower >= 'a' && lower <= 'z'))
{
target[i] = lower;
}
else
{
target[i] = (u8)((scratch[i] >> 4) + 0x61);
}
}
u32 *digest = (u32 *) target;
const u32 r0 = digest[DGST_R0];
const u32 r1 = digest[DGST_R1];
const u32 r2 = digest[DGST_R2];
const u32 r3 = digest[DGST_R3];
COMPARE_S_SIMD (r0, r1, r2, r3);
}
}

181
OpenCL/m26300_a0-pure.cl Normal file
View File

@ -0,0 +1,181 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
//#define NEW_SIMD_CODE
#ifdef KERNEL_STATIC
#include "inc_vendor.h"
#include "inc_types.h"
#include "inc_platform.cl"
#include "inc_common.cl"
#include "inc_rp.h"
#include "inc_rp.cl"
#include "inc_scalar.cl"
#include "inc_hash_sha256.cl"
#endif
KERNEL_FQ void m26300_mxx (KERN_ATTR_RULES ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
/**
* base
*/
COPY_PW (pws[gid]);
sha256_ctx_t ctx0;
sha256_init (&ctx0);
sha256_update_global_swap (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len);
/**
* loop
*/
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
pw_t tmp = PASTE_PW;
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
sha256_ctx_t ctx = ctx0;
sha256_update_swap (&ctx, tmp.i, tmp.pw_len);
/**
* pepper
*/
u32 p0[4];
u32 p1[4];
u32 p2[4];
u32 p3[4];
p0[0] = hc_swap32_S (FORTIGATE_A);
p0[1] = hc_swap32_S (FORTIGATE_B);
p0[2] = hc_swap32_S (FORTIGATE_C);
p0[3] = hc_swap32_S (FORTIGATE_D);
p1[0] = hc_swap32_S (FORTIGATE_E);
p1[1] = hc_swap32_S (FORTIGATE_F);
p1[2] = 0;
p1[3] = 0;
p2[0] = 0;
p2[1] = 0;
p2[2] = 0;
p2[3] = 0;
p3[0] = 0;
p3[1] = 0;
p3[2] = 0;
p3[3] = 0;
sha256_update_64 (&ctx, p0, p1, p2, p3, 24);
sha256_final (&ctx);
const u32 r0 = ctx.h[DGST_R0];
const u32 r1 = ctx.h[DGST_R1];
const u32 r2 = ctx.h[DGST_R2];
const u32 r3 = ctx.h[DGST_R3];
COMPARE_M_SCALAR (r0, r1, r2, r3);
}
}
KERNEL_FQ void m26300_sxx (KERN_ATTR_RULES ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
/**
* digest
*/
const u32 search[4] =
{
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
* base
*/
COPY_PW (pws[gid]);
sha256_ctx_t ctx0;
sha256_init (&ctx0);
sha256_update_global_swap (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len);
/**
* loop
*/
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
pw_t tmp = PASTE_PW;
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
sha256_ctx_t ctx = ctx0;
sha256_update_swap (&ctx, tmp.i, tmp.pw_len);
/**
* pepper
*/
u32 p0[4];
u32 p1[4];
u32 p2[4];
u32 p3[4];
p0[0] = hc_swap32_S (FORTIGATE_A);
p0[1] = hc_swap32_S (FORTIGATE_B);
p0[2] = hc_swap32_S (FORTIGATE_C);
p0[3] = hc_swap32_S (FORTIGATE_D);
p1[0] = hc_swap32_S (FORTIGATE_E);
p1[1] = hc_swap32_S (FORTIGATE_F);
p1[2] = 0;
p1[3] = 0;
p2[0] = 0;
p2[1] = 0;
p2[2] = 0;
p2[3] = 0;
p3[0] = 0;
p3[1] = 0;
p3[2] = 0;
p3[3] = 0;
sha256_update_64 (&ctx, p0, p1, p2, p3, 24);
sha256_final (&ctx);
const u32 r0 = ctx.h[DGST_R0];
const u32 r1 = ctx.h[DGST_R1];
const u32 r2 = ctx.h[DGST_R2];
const u32 r3 = ctx.h[DGST_R3];
COMPARE_S_SCALAR (r0, r1, r2, r3);
}
}

171
OpenCL/m26300_a1-pure.cl Normal file
View File

@ -0,0 +1,171 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
//#define NEW_SIMD_CODE
#ifdef KERNEL_STATIC
#include "inc_vendor.h"
#include "inc_types.h"
#include "inc_platform.cl"
#include "inc_common.cl"
#include "inc_scalar.cl"
#include "inc_hash_sha256.cl"
#endif
KERNEL_FQ void m26300_mxx (KERN_ATTR_BASIC ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
/**
* base
*/
sha256_ctx_t ctx0;
sha256_init (&ctx0);
sha256_update_global_swap (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len);
sha256_update_global_swap (&ctx0, pws[gid].i, pws[gid].pw_len);
/**
* loop
*/
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
sha256_ctx_t ctx = ctx0;
sha256_update_global_swap (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
/**
* pepper
*/
u32 p0[4];
u32 p1[4];
u32 p2[4];
u32 p3[4];
p0[0] = hc_swap32_S (FORTIGATE_A);
p0[1] = hc_swap32_S (FORTIGATE_B);
p0[2] = hc_swap32_S (FORTIGATE_C);
p0[3] = hc_swap32_S (FORTIGATE_D);
p1[0] = hc_swap32_S (FORTIGATE_E);
p1[1] = hc_swap32_S (FORTIGATE_F);
p1[2] = 0;
p1[3] = 0;
p2[0] = 0;
p2[1] = 0;
p2[2] = 0;
p2[3] = 0;
p3[0] = 0;
p3[1] = 0;
p3[2] = 0;
p3[3] = 0;
sha256_update_64 (&ctx, p0, p1, p2, p3, 24);
sha256_final (&ctx);
const u32 r0 = ctx.h[DGST_R0];
const u32 r1 = ctx.h[DGST_R1];
const u32 r2 = ctx.h[DGST_R2];
const u32 r3 = ctx.h[DGST_R3];
COMPARE_M_SCALAR (r0, r1, r2, r3);
}
}
KERNEL_FQ void m26300_sxx (KERN_ATTR_BASIC ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
/**
* digest
*/
const u32 search[4] =
{
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
* base
*/
sha256_ctx_t ctx0;
sha256_init (&ctx0);
sha256_update_global_swap (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len);
sha256_update_global_swap (&ctx0, pws[gid].i, pws[gid].pw_len);
/**
* loop
*/
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
sha256_ctx_t ctx = ctx0;
sha256_update_global_swap (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
/**
* pepper
*/
u32 p0[4];
u32 p1[4];
u32 p2[4];
u32 p3[4];
p0[0] = hc_swap32_S (FORTIGATE_A);
p0[1] = hc_swap32_S (FORTIGATE_B);
p0[2] = hc_swap32_S (FORTIGATE_C);
p0[3] = hc_swap32_S (FORTIGATE_D);
p1[0] = hc_swap32_S (FORTIGATE_E);
p1[1] = hc_swap32_S (FORTIGATE_F);
p1[2] = 0;
p1[3] = 0;
p2[0] = 0;
p2[1] = 0;
p2[2] = 0;
p2[3] = 0;
p3[0] = 0;
p3[1] = 0;
p3[2] = 0;
p3[3] = 0;
sha256_update_64 (&ctx, p0, p1, p2, p3, 24);
sha256_final (&ctx);
const u32 r0 = ctx.h[DGST_R0];
const u32 r1 = ctx.h[DGST_R1];
const u32 r2 = ctx.h[DGST_R2];
const u32 r3 = ctx.h[DGST_R3];
COMPARE_S_SCALAR (r0, r1, r2, r3);
}
}

205
OpenCL/m26300_a3-pure.cl Normal file
View File

@ -0,0 +1,205 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#define NEW_SIMD_CODE
#ifdef KERNEL_STATIC
#include "inc_vendor.h"
#include "inc_types.h"
#include "inc_platform.cl"
#include "inc_common.cl"
#include "inc_simd.cl"
#include "inc_hash_sha256.cl"
#endif
KERNEL_FQ void m26300_mxx (KERN_ATTR_VECTOR ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
/**
* base
*/
const u32 pw_len = pws[gid].pw_len;
u32x w[64] = { 0 };
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
sha256_ctx_t ctx0;
sha256_init (&ctx0);
sha256_update_global_swap (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len);
/**
* loop
*/
u32x w0l = w[0];
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{
const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
const u32x w0 = w0l | w0r;
w[0] = w0;
sha256_ctx_vector_t ctx;
sha256_init_vector_from_scalar (&ctx, &ctx0);
sha256_update_vector (&ctx, w, pw_len);
/**
* pepper
*/
u32x p0[4];
u32x p1[4];
u32x p2[4];
u32x p3[4];
p0[0] = hc_swap32 (FORTIGATE_A);
p0[1] = hc_swap32 (FORTIGATE_B);
p0[2] = hc_swap32 (FORTIGATE_C);
p0[3] = hc_swap32 (FORTIGATE_D);
p1[0] = hc_swap32 (FORTIGATE_E);
p1[1] = hc_swap32 (FORTIGATE_F);
p1[2] = 0;
p1[3] = 0;
p2[0] = 0;
p2[1] = 0;
p2[2] = 0;
p2[3] = 0;
p3[0] = 0;
p3[1] = 0;
p3[2] = 0;
p3[3] = 0;
sha256_update_vector_64 (&ctx, p0, p1, p2, p3, 24);
sha256_final_vector (&ctx);
const u32x r0 = ctx.h[DGST_R0];
const u32x r1 = ctx.h[DGST_R1];
const u32x r2 = ctx.h[DGST_R2];
const u32x r3 = ctx.h[DGST_R3];
COMPARE_M_SIMD (r0, r1, r2, r3);
}
}
KERNEL_FQ void m26300_sxx (KERN_ATTR_VECTOR ())
{
/**
* modifier
*/
const u64 lid = get_local_id (0);
const u64 gid = get_global_id (0);
if (gid >= gid_max) return;
/**
* digest
*/
const u32 search[4] =
{
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R0],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R1],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R2],
digests_buf[DIGESTS_OFFSET].digest_buf[DGST_R3]
};
/**
* base
*/
const u32 pw_len = pws[gid].pw_len;
u32x w[64] = { 0 };
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
sha256_ctx_t ctx0;
sha256_init (&ctx0);
sha256_update_global_swap (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len);
/**
* loop
*/
u32x w0l = w[0];
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{
const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
const u32x w0 = w0l | w0r;
w[0] = w0;
sha256_ctx_vector_t ctx;
sha256_init_vector_from_scalar (&ctx, &ctx0);
sha256_update_vector (&ctx, w, pw_len);
/**
* pepper
*/
u32x p0[4];
u32x p1[4];
u32x p2[4];
u32x p3[4];
p0[0] = hc_swap32 (FORTIGATE_A);
p0[1] = hc_swap32 (FORTIGATE_B);
p0[2] = hc_swap32 (FORTIGATE_C);
p0[3] = hc_swap32 (FORTIGATE_D);
p1[0] = hc_swap32 (FORTIGATE_E);
p1[1] = hc_swap32 (FORTIGATE_F);
p1[2] = 0;
p1[3] = 0;
p2[0] = 0;
p2[1] = 0;
p2[2] = 0;
p2[3] = 0;
p3[0] = 0;
p3[1] = 0;
p3[2] = 0;
p3[3] = 0;
sha256_update_vector_64 (&ctx, p0, p1, p2, p3, 24);
sha256_final_vector (&ctx);
const u32x r0 = ctx.h[DGST_R0];
const u32x r1 = ctx.h[DGST_R1];
const u32x r2 = ctx.h[DGST_R2];
const u32x r3 = ctx.h[DGST_R3];
COMPARE_S_SIMD (r0, r1, r2, r3);
}
}

View File

@ -0,0 +1 @@
€亗儎厗噲墛媽崕彁憭摂晼棙櫄洔潪煚、¥ウЖ┆<EFBFBD><EFBFBD><EFBFBD>徕沅彐玷殛腱眍镳顸

View File

@ -1 +1 @@
ǜ估谅媚牌侨墒颂臀闲岩釉罩棕仝圮蒉哙徕沅彐玷殛腱眍镳耱篝貊鼬<EFBFBD><EFBFBD><EFBFBD><EFBFBD> ǜ懒旅呐魄壬仕掏蜗醒矣哉肿刭谯茌捱噌忏溴骁栝觌祉铒瘃蝮趱鲼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>

View File

@ -0,0 +1 @@
€亗儎厗噲墛媽崕彁憭摂晼棙櫄洔潪煚、¥ウЖ┆<EFBFBD><EFBFBD><EFBFBD>徕沅彐玷殛腱眍镳<EFBFBD>

View File

@ -1,4 +1,44 @@
* changes v6.2.1 -> v6.x.x * changes v6.2.2 -> v6.2.x
##
## Algorithms
##
- Added hash-mode: VeraCrypt PBKDF2-HMAC-Streebog-512 + XTS 512 bit + boot-mode
- Added hash-mode: VeraCrypt PBKDF2-HMAC-Streebog-512 + XTS 1024 bit + boot-mode
- Added hash-mode: VeraCrypt PBKDF2-HMAC-Streebog-512 + XTS 1536 bit + boot-mode
##
## Bugs
##
- Fixed 'E' rule in pure kernel mode which was ignoring letters that are in positions that are multiples of 4
- Fixed false negative in hash-mode 15900 (DPAPI masterkey file v2) if password was longer than 64 characters
- Fixed integer overflow in Recovered/Time status view column caused by division > 0 but < 1
##
## Features
##
- Added temperature watchdog and fanspeed readings for CPU and GPU on macOS using iokit
##
## Improvements
##
- Alias Devices: Show a warning in case the user specifically listed a device to use which in a later step is skipped because it is an alias of another active device
- Backend Information: Added new column showing the PCI Address per CUDA/OpenCL device to easier identify broken cards
- VeraCrypt: Increase password length support for non-boot volumes from 64 to 128
##
## Technical
##
- Autodetect: Limit the number of errors per hash-mode try to 100 to avoid long startup time
- LM: Workaround JiT compiler bug in -m 3000 on NV leading to false negatives with large amount of hashes
- Tests: Changed tests for VeraCrypt from -a 0 to -a 3, because password extension is not available to all shells
* changes v6.2.1 -> v6.2.2
## ##
## Algorithms ## Algorithms
@ -6,8 +46,10 @@
- Added hash-mode: bcrypt(md5($pass)) / bcryptmd5 - Added hash-mode: bcrypt(md5($pass)) / bcryptmd5
- Added hash-mode: bcrypt(sha1($pass)) / bcryptsha1 - Added hash-mode: bcrypt(sha1($pass)) / bcryptsha1
- Added hash-mode: FortiGate256 (FortiOS256)
- Added hash-mode: Linux Kernel Crypto API (2.4) - Added hash-mode: Linux Kernel Crypto API (2.4)
- Added hash-mode: MurmurHash - Added hash-mode: MurmurHash
- Added hash-mode: OpenEdge Progress Encode
- Added hash-mode: md5(utf16le($pass)) - Added hash-mode: md5(utf16le($pass))
- Added hash-mode: sha1(utf16le($pass)) - Added hash-mode: sha1(utf16le($pass))
- Added hash-mode: sha256(utf16le($pass)) - Added hash-mode: sha256(utf16le($pass))
@ -25,29 +67,33 @@
## Features ## Features
## ##
- Autodetect hash-type: performs an automatic analysis of the input hash(es), associating compatible algorithms, or executing the attack if only one compatible format is found. - Autodetect hash-type: performs an automatic analysis of input hash(es), either listing compatible algorithms, or executing the attack (if only one compatible format is found)
- Autodetect hash-type: added option --identify to only perform autodetection of hash-type, without back-end device initialization
## ##
## Bugs ## Bugs
## ##
- Fixed error message in -a 9 mode with rules in case number of words from wordlist are not in sync with number of unique salts - Fixed error message in -a 9 mode with rules when number of words from wordlist is not in sync with number of unique salts
- Fixed false negatives with TrueCrypt/VeraCrypt in case zip or gzip compressed files were used as keyfiles - Fixed error-handling logic in monitor thread to not return in case of error (disk full, permission error, ...) but to retry instead
- Fixed error handling logic in monitor thread to not return in case of error (disc full, permission error, ...) but to retry instead - Fixed false negatives with TrueCrypt/VeraCrypt when zip- or gzip-compressed files were used as keyfiles
- Fixed free memory-size output for skipped GPU (both automatic and manual) of --backend-info information screen
## ##
## Improvements ## Improvements
## ##
- AES Crypt Plugin: Reduced max password length from 256 to 128 which improved performance by 22% - AES Crypt Plugin: Reduced max password length from 256 to 128 which improved performance by 22%
- CUDA Backend: Do not warn about missing CUDA SDK installation if --stdout is used - CUDA Backend: If --stdout is used, do not warn about missing CUDA SDK
- Folder Management: Add support for XDG Base Directory specification if hashcat was installed using make install - Folder Management: Add support for XDG Base Directory specification when hashcat is installed using 'make install'
- OpenCL Backend: Use CL_DEVICE_BOARD_NAME_AMD instead of CL_DEVICE_NAME for device name in case OpenCL runtime supports this query - Hardware Monitor: Add support for GPU device utilization readings from sysfs (AMD on Linux)
- Performance Monitor: Add -S as a user suggestion to improve cracking performance in specific attack configurations - OpenCL Backend: Use CL_DEVICE_BOARD_NAME_AMD instead of CL_DEVICE_NAME for device name (when supported by OpenCL runtime)
- Performance Monitor: Suggest -S to improve cracking performance in specific attack configurations
- RAR3-p (Compressed): Fix workaround in unrar library in AES constant table generation to enable multi-threading support - RAR3-p (Compressed): Fix workaround in unrar library in AES constant table generation to enable multi-threading support
- RC4 Kernels: Improved performance by 20%+ for hash-modes Kerberos 5 (etype 23), MS Office (<= 2003) and PDF (<= 1.6) by using new RC4 code - RC4 Kernels: Improved performance by 20%+ with new RC4 code in hash-modes Kerberos 5 (etype 23), MS Office (<= 2003) and PDF (<= 1.6)
- Status Screen: Show currently running kernel type (pure, optimized) and generator type (host, device) - Scrypt Kernels: Re-enable use of kernel cache in scrypt-based kernels
- UTF8-to-UTF16: Replaced naive UTF8 to UTF16 conversion with true conversion for RAR3, AES Crypt, MultiBit HD (scrypt) and Umbraco HMAC-SHA1 - Status Screen: Show currently-running kernel type (pure, optimized) and generator type (host, device)
- UTF8-to-UTF16: Replaced naive UTF8-to-UTF16 conversion with true conversion for RAR3, AES Crypt, MultiBit HD (scrypt) and Umbraco HMAC-SHA1
## ##
## Technical ## Technical
@ -56,10 +102,15 @@
- Dependencies: Updated LZMA SDK from 19.00 to 21.02 alpha - Dependencies: Updated LZMA SDK from 19.00 to 21.02 alpha
- Dependencies: Updated xxHash from 0.1.0 to v0.8.0 - Stable XXH3 - Dependencies: Updated xxHash from 0.1.0 to v0.8.0 - Stable XXH3
- Documentation: Update missing documentation in plugin developer guide for OPTS_TYPE_MP_MULTI_DISABLE and OPTS_TYPE_NATIVE_THREADS - Documentation: Update missing documentation in plugin developer guide for OPTS_TYPE_MP_MULTI_DISABLE and OPTS_TYPE_NATIVE_THREADS
- Hashrate: Update inner-loop hashrate prediction to handle new salt_repeats feature and also respect _loop2 kernel runtime
- Kernels: Add RC4 cipher to crypto library with optimized shared memory access pattern which will not cause any bank conflicts if -u <= 32 - Kernels: Add RC4 cipher to crypto library with optimized shared memory access pattern which will not cause any bank conflicts if -u <= 32
- Kernels: Add standalone true UTF8 to UTF16 converter kernel that runs after amplifier. Use OPTS_TYPE_POST_AMP_UTF16LE from plugin - Kernels: Add standalone true UTF8-to-UTF16 converter kernel that runs after amplifier. Use OPTS_TYPE_POST_AMP_UTF16LE from plugin
- Kernel Cache: Add module_jit_build_options() string from modules to kernel cache checksum calculation
- Modules: Recategorized HASH_CATEGORY option in various modules - Modules: Recategorized HASH_CATEGORY option in various modules
- Modules: Added hash categories HASH_CATEGORY_IMS and HASH_CATEGORY_CRYPTOCURRENCY_WALLET - Modules: Added hash categories HASH_CATEGORY_IMS and HASH_CATEGORY_CRYPTOCURRENCY_WALLET
- Modules: Changed hash category of Python passlib from HASH_CATEGORY_GENERIC_KDF to HASH_CATEGORY_FRAMEWORK
- Unit-Tests: Added missing support for OPTS_TYPE_LOOP_PREPARE, OPTS_TYPE_LOOP_PREPARE2 and salt_repeats in self-test
- Unit-Tests: Added missing unit-test for Stargazer Stellar Wallet XLM
* changes v6.2.0 -> v6.2.1 * changes v6.2.0 -> v6.2.1

View File

@ -22,7 +22,7 @@ Gabriele "matrix" Gristina <matrix@hashcat.net> (@gm4tr1x)
* Compressed wordlist feature * Compressed wordlist feature
* OpenCL Info feature * OpenCL Info feature
* Apple macOS port * Apple macOS port
* Hardware monitor initial code base * Hardware monitor initial code base and maintenance
* Test suite initial code base * Test suite initial code base
* Makefile initial code base * Makefile initial code base
* Multithreading initial code base * Multithreading initial code base

View File

@ -26,6 +26,8 @@ It only means the filename itself.
## Hashing algorithms that internally use UTF-16 characters could in special cases lead to false negatives ## Hashing algorithms that internally use UTF-16 characters could in special cases lead to false negatives
## ##
For optimized kernels only (-O): Since hashcat v6.2.1 there's true UTF16 support for pure kernels:
The UTF-16 conversion implementation used within the kernel code is very elementary and for performance The UTF-16 conversion implementation used within the kernel code is very elementary and for performance
reasons does not respect all complicated encoding rules required to correctly convert, for instance, ASCII reasons does not respect all complicated encoding rules required to correctly convert, for instance, ASCII
or UTF-8 to UTF-16LE (or UTF-16BE). or UTF-8 to UTF-16LE (or UTF-16BE).
@ -33,6 +35,8 @@ or UTF-8 to UTF-16LE (or UTF-16BE).
The implementation most likely fails with multi-byte characters, because we basically add a zero byte every The implementation most likely fails with multi-byte characters, because we basically add a zero byte every
second byte within the kernel conversion code. second byte within the kernel conversion code.
Since hashcat v6.2.1 there's true UTF16 support for pure kernels.
## ##
## The use of --keep-guessing eventually skips reporting duplicate passwords ## The use of --keep-guessing eventually skips reporting duplicate passwords
## ##

View File

@ -7,7 +7,7 @@
|_____| /___________/ |_____| /_____/ /_______| |_____| /___________/ |_____| /_____/ /_______|
: : : : : :
hashcat v6.2.1 hashcat v6.2.2
============== ==============
AMD GPUs on Linux require "RadeonOpenCompute (ROCm)" Software Platform (3.1 or later) AMD GPUs on Linux require "RadeonOpenCompute (ROCm)" Software Platform (3.1 or later)
@ -146,9 +146,6 @@ NVIDIA GPUs require "NVIDIA Driver" (440.64 or later) and "CUDA Toolkit" (9.0 or
- PBKDF2-HMAC-SHA1 - PBKDF2-HMAC-SHA1
- PBKDF2-HMAC-SHA256 - PBKDF2-HMAC-SHA256
- PBKDF2-HMAC-SHA512 - PBKDF2-HMAC-SHA512
- Python passlib pbkdf2-sha512
- Python passlib pbkdf2-sha256
- Python passlib pbkdf2-sha1
- scrypt - scrypt
- phpass - phpass
- TACACS+ - TACACS+
@ -202,6 +199,7 @@ NVIDIA GPUs require "NVIDIA Driver" (440.64 or later) and "CUDA Toolkit" (9.0 or
- Domain Cached Credentials (DCC), MS Cache - Domain Cached Credentials (DCC), MS Cache
- Domain Cached Credentials 2 (DCC2), MS Cache 2 - Domain Cached Credentials 2 (DCC2), MS Cache 2
- FortiGate (FortiOS) - FortiGate (FortiOS)
- FortiGate256 (FortiOS256)
- ArubaOS - ArubaOS
- Juniper IVE - Juniper IVE
- Juniper NetScreen/SSG (ScreenOS) - Juniper NetScreen/SSG (ScreenOS)
@ -258,6 +256,7 @@ NVIDIA GPUs require "NVIDIA Driver" (440.64 or later) and "CUDA Toolkit" (9.0 or
- Lotus Notes/Domino 5 - Lotus Notes/Domino 5
- Lotus Notes/Domino 6 - Lotus Notes/Domino 6
- Lotus Notes/Domino 8 - Lotus Notes/Domino 8
- OpenEdge Progress Encode
- Oracle Transportation Management (SHA256) - Oracle Transportation Management (SHA256)
- Huawei sha1(md5($pass).$salt) - Huawei sha1(md5($pass).$salt)
- AuthMe sha256 - AuthMe sha256
@ -355,6 +354,9 @@ NVIDIA GPUs require "NVIDIA Driver" (440.64 or later) and "CUDA Toolkit" (9.0 or
- Django (SHA-1) - Django (SHA-1)
- Atlassian (PBKDF2-HMAC-SHA1) - Atlassian (PBKDF2-HMAC-SHA1)
- Ruby on Rails Restful-Authentication - Ruby on Rails Restful-Authentication
- Python passlib pbkdf2-sha512
- Python passlib pbkdf2-sha256
- Python passlib pbkdf2-sha1
- PKCS#8 Private Keys (PBKDF2-HMAC-SHA1 + 3DES/AES) - PKCS#8 Private Keys (PBKDF2-HMAC-SHA1 + 3DES/AES)
- PKCS#8 Private Keys (PBKDF2-HMAC-SHA256 + 3DES/AES) - PKCS#8 Private Keys (PBKDF2-HMAC-SHA256 + 3DES/AES)
- JKS Java Key Store Private Keys (SHA1) - JKS Java Key Store Private Keys (SHA1)

View File

@ -411,7 +411,7 @@ _hashcat_contains ()
_hashcat () _hashcat ()
{ {
local VERSION=6.2.1 local VERSION=6.2.2
local ATTACK_MODES="0 1 3 6 7 9" local ATTACK_MODES="0 1 3 6 7 9"
local HCCAPX_MESSAGE_PAIRS="0 1 2 3 4 5" local HCCAPX_MESSAGE_PAIRS="0 1 2 3 4 5"
@ -426,7 +426,7 @@ _hashcat ()
local BUILD_IN_CHARSETS='?l ?u ?d ?a ?b ?s ?h ?H' local BUILD_IN_CHARSETS='?l ?u ?d ?a ?b ?s ?h ?H'
local SHORT_OPTS="-m -a -V -h -b -t -T -o -p -c -d -D -w -n -u -j -k -r -g -1 -2 -3 -4 -i -I -s -l -O -S -z" local SHORT_OPTS="-m -a -V -h -b -t -T -o -p -c -d -D -w -n -u -j -k -r -g -1 -2 -3 -4 -i -I -s -l -O -S -z"
local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --benchmark-all --hex-salt --hex-wordlist --hex-charset --force --status --status-json --status-timer --stdin-timeout-abort --machine-readable --loopback --markov-hcstat2 --markov-disable --markov-classic --markov-threshold --runtime --session --speed-only --progress-only --restore --restore-file-path --restore-disable --outfile --outfile-format --outfile-autohex-disable --outfile-check-timer --outfile-check-dir --wordlist-autohex-disable --separator --show --left --username --remove --remove-timer --potfile-disable --potfile-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --example-hashes --hash-info --backend-ignore-cuda --backend-ignore-opencl --backend-info --backend-devices --opencl-device-types --backend-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-disable --hwmon-temp-abort --skip --limit --keyspace --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --hook-threads --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --self-test-disable --slow-candidates --brain-server --brain-server-timer --brain-client --brain-client-features --brain-host --brain-port --brain-session --brain-session-whitelist --brain-password" local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --benchmark-all --hex-salt --hex-wordlist --hex-charset --force --status --status-json --status-timer --stdin-timeout-abort --machine-readable --loopback --markov-hcstat2 --markov-disable --markov-classic --markov-threshold --runtime --session --speed-only --progress-only --restore --restore-file-path --restore-disable --outfile --outfile-format --outfile-autohex-disable --outfile-check-timer --outfile-check-dir --wordlist-autohex-disable --separator --show --left --username --remove --remove-timer --potfile-disable --potfile-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --example-hashes --hash-info --backend-ignore-cuda --backend-ignore-opencl --backend-info --backend-devices --opencl-device-types --backend-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-disable --hwmon-temp-abort --skip --limit --keyspace --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --hook-threads --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --self-test-disable --slow-candidates --brain-server --brain-server-timer --brain-client --brain-client-features --brain-host --brain-port --brain-session --brain-session-whitelist --brain-password --identify"
local OPTIONS="-m -a -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -s -l --hash-type --attack-mode --status-timer --stdin-timeout-abort --markov-hcstat2 --markov-threshold --runtime --session --timer --outfile --outfile-format --outfile-check-timer --outfile-check-dir --separator --remove-timer --potfile-path --restore-file-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --backend-devices --opencl-device-types --backend-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-temp-abort --skip --limit --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --hook-threads --increment-min --increment-max --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --brain-server-timer --brain-client-features --brain-host --brain-password --brain-port --brain-session --brain-session-whitelist" local OPTIONS="-m -a -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -s -l --hash-type --attack-mode --status-timer --stdin-timeout-abort --markov-hcstat2 --markov-threshold --runtime --session --timer --outfile --outfile-format --outfile-check-timer --outfile-check-dir --separator --remove-timer --potfile-path --restore-file-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --backend-devices --opencl-device-types --backend-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-temp-abort --skip --limit --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --hook-threads --increment-min --increment-max --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --brain-server-timer --brain-client-features --brain-host --brain-password --brain-port --brain-session --brain-session-whitelist"
COMPREPLY=() COMPREPLY=()

View File

@ -9,7 +9,7 @@
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
int cpu_crc32 (const char *filename, u8 keytab[64]); int cpu_crc32 (const char *filename, u8 *keytab, const size_t keytabsz);
u32 cpu_crc32_buffer (const u8 *buf, const size_t length); u32 cpu_crc32_buffer (const u8 *buf, const size_t length);
#endif // _CPU_CRC32_H #endif // _CPU_CRC32_H

View File

@ -314,4 +314,18 @@ typedef hm_adl_lib_t ADL_PTR;
void *HC_API_CALL ADL_Main_Memory_Alloc (const int iSize); void *HC_API_CALL ADL_Main_Memory_Alloc (const int iSize);
int adl_init (void *hashcat_ctx);
void adl_close (void *hashcat_ctx);
int hm_ADL_Main_Control_Destroy (void *hashcat_ctx);
int hm_ADL_Main_Control_Create (void *hashcat_ctx, ADL_MAIN_MALLOC_CALLBACK callback, int iEnumConnectedAdapters);
int hm_ADL_Adapter_NumberOfAdapters_Get (void *hashcat_ctx, int *lpNumAdapters);
int hm_ADL_Adapter_AdapterInfo_Get (void *hashcat_ctx, LPAdapterInfo lpInfo, int iInputSize);
int hm_ADL_Overdrive5_Temperature_Get (void *hashcat_ctx, int iAdapterIndex, int iThermalControllerIndex, ADLTemperature *lpTemperature);
int hm_ADL_Overdrive6_Temperature_Get (void *hashcat_ctx, int iAdapterIndex, int *iTemperature);
int hm_ADL_Overdrive_CurrentActivity_Get (void *hashcat_ctx, int iAdapterIndex, ADLPMActivity *lpActivity);
int hm_ADL_Overdrive5_FanSpeed_Get (void *hashcat_ctx, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue);
int hm_ADL_Overdrive6_FanSpeed_Get (void *hashcat_ctx, int iAdapterIndex, ADLOD6FanSpeedInfo *lpFanSpeedInfo);
int hm_ADL_Overdrive_Caps (void *hashcat_ctx, int iAdapterIndex, int *od_supported, int *od_enabled, int *od_version);
int hm_ADL_Overdrive6_TargetTemperatureData_Get (void *hashcat_ctx, int iAdapterIndex, int *cur_temp, int *default_temp);
#endif // _EXT_ADL_H #endif // _EXT_ADL_H

128
include/ext_iokit.h Normal file
View File

@ -0,0 +1,128 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#ifndef _EXT_IOKIT_H
#define _EXT_IOKIT_H
#if defined(__APPLE__)
#include <IOKit/IOKitLib.h>
// Apple SMC Keys
#define HM_IOKIT_SMC_SENSOR_GRAPHICS_HOT "SGHT"
#define HM_IOKIT_SMC_CPU_PROXIMITY "TC0P"
#define HM_IOKIT_SMC_GPU_PROXIMITY "TG0P"
#define HM_IOKIT_SMC_PECI_GPU "TCGC"
#define KERNEL_INDEX_SMC 2
#define DATATYPE_FPE2 "fpe2"
#define DATATYPE_FLT "flt "
#define DATATYPE_UINT8 "ui8 "
#define DATATYPE_UINT16 "ui16"
#define DATATYPE_UINT32 "ui32"
#define DATATYPE_SP78 "sp78"
typedef enum
{
SMC_CMD_READ_BYTES = 5,
SMC_CMD_WRITE_BYTES = 6,
SMC_CMD_READ_INDEX = 8,
SMC_CMD_READ_KEYINFO = 9,
SMC_CMD_READ_PLIMIT = 11,
SMC_CMD_READ_VERS = 12
} SMCCommands_t;
typedef struct
{
char major;
char minor;
char build;
char reserved[1];
UInt16 release;
} SMCKeyData_vers_t;
typedef struct
{
UInt16 version;
UInt16 length;
UInt32 cpuPLimit;
UInt32 gpuPLimit;
UInt32 memPLimit;
} SMCKeyData_pLimitData_t;
typedef struct
{
UInt32 dataSize;
UInt32 dataType;
char dataAttributes;
} SMCKeyData_keyInfo_t;
typedef char SMCBytes_t[32];
typedef struct
{
UInt32 key;
SMCKeyData_vers_t vers;
SMCKeyData_pLimitData_t pLimitData;
SMCKeyData_keyInfo_t keyInfo;
char result;
char status;
char data8;
UInt32 data32;
SMCBytes_t bytes;
} SMCKeyData_t;
typedef char UInt32Char_t[5];
typedef struct
{
UInt32Char_t key;
UInt32 dataSize;
UInt32Char_t dataType;
SMCBytes_t bytes;
} SMCVal_t;
#endif // __APPLE__
typedef int HM_ADAPTER_IOKIT;
typedef void *IOKIT_LIB;
typedef struct hm_iokit_lib
{
#if defined(__APPLE__)
io_connect_t conn;
#endif // __APPLE__
} hm_iokit_lib_t;
typedef hm_iokit_lib_t IOKIT_PTR;
#if defined(__APPLE__)
UInt32 hm_IOKIT_strtoul (char *str, int size, int base);
void hm_IOKIT_ultostr (char *str, UInt32 val);
kern_return_t hm_IOKIT_SMCOpen (void *hashcat_ctx, io_connect_t *conn);
kern_return_t hm_IOKIT_SMCClose (io_connect_t conn);
kern_return_t hm_IOKIT_SMCCall (int index, SMCKeyData_t *inData, SMCKeyData_t *outData, io_connect_t conn);
kern_return_t hm_IOKIT_SMCReadKey (UInt32Char_t key, SMCVal_t *val, io_connect_t conn);
int hm_IOKIT_SMCGetSensorGraphicHot (void *hashcat_ctx);
int hm_IOKIT_SMCGetTemperature (void *hashcat_ctx, char *key, double *temp);
bool hm_IOKIT_SMCGetFanRPM (char *key, io_connect_t conn, float *ret);
int hm_IOKIT_get_fan_speed_current (void *hashcat_ctx, char *fan_speed_buf);
bool iokit_init (void *hashcat_ctx);
bool iokit_close (void *hashcat_ctx);
#endif // __APPLE__
#endif // _EXT_IOKIT_H

View File

@ -239,4 +239,15 @@ typedef struct hm_nvapi_lib
typedef hm_nvapi_lib_t NVAPI_PTR; typedef hm_nvapi_lib_t NVAPI_PTR;
int nvapi_init (void *hashcat_ctx);
void nvapi_close (void *hashcat_ctx);
void hm_NvAPI_GetErrorMessage (NVAPI_PTR *nvapi, const NvAPI_Status NvAPI_rc, NvAPI_ShortString string);
int hm_NvAPI_Initialize (void *hashcat_ctx);
int hm_NvAPI_Unload (void *hashcat_ctx);
int hm_NvAPI_EnumPhysicalGPUs (void *hashcat_ctx, NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount);
int hm_NvAPI_GPU_GetPerfPoliciesInfo (void *hashcat_ctx, NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_PERF_POLICIES_INFO_PARAMS_V1 *perfPolicies_info);
int hm_NvAPI_GPU_GetPerfPoliciesStatus (void *hashcat_ctx, NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 *perfPolicies_status);
int hm_NvAPI_GPU_GetBusId (void *hashcat_ctx, NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pBusId);
int hm_NvAPI_GPU_GetBusSlotId (void *hashcat_ctx, NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pBusSlotId);
#endif // _EXT_NVAPI_H #endif // _EXT_NVAPI_H

View File

@ -217,4 +217,20 @@ typedef struct hm_nvml_lib
typedef hm_nvml_lib_t NVML_PTR; typedef hm_nvml_lib_t NVML_PTR;
int nvml_init (void *hashcat_ctx);
void nvml_close (void *hashcat_ctx);
const char *hm_NVML_nvmlErrorString (NVML_PTR *nvml, const nvmlReturn_t nvml_rc);
int hm_NVML_nvmlInit (void *hashcat_ctx);
int hm_NVML_nvmlShutdown (void *hashcat_ctx);
int hm_NVML_nvmlDeviceGetCount (void *hashcat_ctx, unsigned int *deviceCount);
int hm_NVML_nvmlDeviceGetHandleByIndex (void *hashcat_ctx, unsigned int device_index, nvmlDevice_t *device);
int hm_NVML_nvmlDeviceGetTemperature (void *hashcat_ctx, nvmlDevice_t device, nvmlTemperatureSensors_t sensorType, unsigned int *temp);
int hm_NVML_nvmlDeviceGetFanSpeed (void *hashcat_ctx, nvmlDevice_t device, unsigned int *speed);
int hm_NVML_nvmlDeviceGetUtilizationRates (void *hashcat_ctx, nvmlDevice_t device, nvmlUtilization_t *utilization);
int hm_NVML_nvmlDeviceGetClockInfo (void *hashcat_ctx, nvmlDevice_t device, nvmlClockType_t type, unsigned int *clockfreq);
int hm_NVML_nvmlDeviceGetTemperatureThreshold (void *hashcat_ctx, nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, unsigned int *temp);
int hm_NVML_nvmlDeviceGetCurrPcieLinkWidth (void *hashcat_ctx, nvmlDevice_t device, unsigned int *currLinkWidth);
int hm_NVML_nvmlDeviceGetPciInfo (void *hashcat_ctx, nvmlDevice_t device, nvmlPciInfo_t *pci);
#endif // _NVML_H #endif // _NVML_H

View File

@ -6,6 +6,8 @@
#ifndef _EXT_SYSFS_H #ifndef _EXT_SYSFS_H
#define _EXT_SYSFS_H #define _EXT_SYSFS_H
#include <stdbool.h>
static const char SYS_BUS_PCI_DEVICES[] = "/sys/bus/pci/devices"; static const char SYS_BUS_PCI_DEVICES[] = "/sys/bus/pci/devices";
typedef int HM_ADAPTER_SYSFS; typedef int HM_ADAPTER_SYSFS;
@ -22,4 +24,15 @@ typedef struct hm_sysfs_lib
typedef hm_sysfs_lib_t SYSFS_PTR; typedef hm_sysfs_lib_t SYSFS_PTR;
bool sysfs_init (void *hashcat_ctx);
void sysfs_close (void *hashcat_ctx);
char *hm_SYSFS_get_syspath_device (void *hashcat_ctx, const int backend_device_idx);
char *hm_SYSFS_get_syspath_hwmon (void *hashcat_ctx, const int backend_device_idx);
int hm_SYSFS_get_fan_speed_current (void *hashcat_ctx, const int backend_device_idx, int *val);
int hm_SYSFS_get_temperature_current (void *hashcat_ctx, const int backend_device_idx, int *val);
int hm_SYSFS_get_pp_dpm_sclk (void *hashcat_ctx, const int backend_device_idx, int *val);
int hm_SYSFS_get_pp_dpm_mclk (void *hashcat_ctx, const int backend_device_idx, int *val);
int hm_SYSFS_get_pp_dpm_pcie (void *hashcat_ctx, const int backend_device_idx, int *val);
int hm_SYSFS_get_gpu_busy_percent (void *hashcat_ctx, const int backend_device_idx, int *val);
#endif // _EXT_SYSFS_H #endif // _EXT_SYSFS_H

View File

@ -16,6 +16,9 @@ int hm_get_threshold_shutdown_with_devices_idx (hashcat_ctx_t *hashcat_ctx, cons
int hm_get_temperature_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx); int hm_get_temperature_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx);
int hm_get_fanpolicy_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx); int hm_get_fanpolicy_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx);
int hm_get_fanspeed_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx); int hm_get_fanspeed_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx);
#if defined(__APPLE__)
int hm_get_fanspeed_apple (hashcat_ctx_t *hashcat_ctx, char *fan_speed_buf);
#endif
int hm_get_buslanes_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx); int hm_get_buslanes_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx);
int hm_get_utilization_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx); int hm_get_utilization_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx);
int hm_get_memoryspeed_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx); int hm_get_memoryspeed_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int backend_device_idx);

View File

@ -77,9 +77,9 @@ char *status_get_speed_sec_dev (const hashcat_ctx_t *hash
int status_get_cpt_cur_min (const hashcat_ctx_t *hashcat_ctx); int status_get_cpt_cur_min (const hashcat_ctx_t *hashcat_ctx);
int status_get_cpt_cur_hour (const hashcat_ctx_t *hashcat_ctx); int status_get_cpt_cur_hour (const hashcat_ctx_t *hashcat_ctx);
int status_get_cpt_cur_day (const hashcat_ctx_t *hashcat_ctx); int status_get_cpt_cur_day (const hashcat_ctx_t *hashcat_ctx);
int status_get_cpt_avg_min (const hashcat_ctx_t *hashcat_ctx); double status_get_cpt_avg_min (const hashcat_ctx_t *hashcat_ctx);
int status_get_cpt_avg_hour (const hashcat_ctx_t *hashcat_ctx); double status_get_cpt_avg_hour (const hashcat_ctx_t *hashcat_ctx);
int status_get_cpt_avg_day (const hashcat_ctx_t *hashcat_ctx); double status_get_cpt_avg_day (const hashcat_ctx_t *hashcat_ctx);
char *status_get_cpt (const hashcat_ctx_t *hashcat_ctx); char *status_get_cpt (const hashcat_ctx_t *hashcat_ctx);
int status_get_salt_pos_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx); int status_get_salt_pos_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
int status_get_innerloop_pos_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx); int status_get_innerloop_pos_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
@ -98,6 +98,9 @@ char *status_get_brain_link_send_bytes_sec_dev (const hashcat_ctx_t *hash
char *status_get_brain_rx_all (const hashcat_ctx_t *hashcat_ctx); char *status_get_brain_rx_all (const hashcat_ctx_t *hashcat_ctx);
char *status_get_brain_tx_all (const hashcat_ctx_t *hashcat_ctx); char *status_get_brain_tx_all (const hashcat_ctx_t *hashcat_ctx);
#endif #endif
#if defined(__APPLE__)
char *status_get_hwmon_fan_dev (const hashcat_ctx_t *hashcat_ctx);
#endif
char *status_get_hwmon_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx); char *status_get_hwmon_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
int status_get_corespeed_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx); int status_get_corespeed_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);
int status_get_memoryspeed_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx); int status_get_memoryspeed_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx);

View File

@ -611,7 +611,11 @@ typedef enum user_options_defaults
DEBUG_MODE = 0, DEBUG_MODE = 0,
FORCE = false, FORCE = false,
HWMON_DISABLE = false, HWMON_DISABLE = false,
#if defined (__APPLE__)
HWMON_TEMP_ABORT = 100,
#else
HWMON_TEMP_ABORT = 90, HWMON_TEMP_ABORT = 90,
#endif
HASH_INFO = false, HASH_INFO = false,
HASH_MODE = 0, HASH_MODE = 0,
HCCAPX_MESSAGE_PAIR = 0, HCCAPX_MESSAGE_PAIR = 0,
@ -619,6 +623,7 @@ typedef enum user_options_defaults
HEX_SALT = false, HEX_SALT = false,
HEX_WORDLIST = false, HEX_WORDLIST = false,
HOOK_THREADS = 0, HOOK_THREADS = 0,
IDENTIFY = false,
INCREMENT = false, INCREMENT = false,
INCREMENT_MAX = PW_MAX, INCREMENT_MAX = PW_MAX,
INCREMENT_MIN = 1, INCREMENT_MIN = 1,
@ -725,73 +730,74 @@ typedef enum user_options_map
IDX_HEX_SALT = 0xff1a, IDX_HEX_SALT = 0xff1a,
IDX_HEX_WORDLIST = 0xff1b, IDX_HEX_WORDLIST = 0xff1b,
IDX_HOOK_THREADS = 0xff1c, IDX_HOOK_THREADS = 0xff1c,
IDX_IDENTIFY = 0xff1d,
IDX_INCREMENT = 'i', IDX_INCREMENT = 'i',
IDX_INCREMENT_MAX = 0xff1d, IDX_INCREMENT_MAX = 0xff1e,
IDX_INCREMENT_MIN = 0xff1e, IDX_INCREMENT_MIN = 0xff1f,
IDX_INDUCTION_DIR = 0xff1f, IDX_INDUCTION_DIR = 0xff20,
IDX_KEEP_GUESSING = 0xff20, IDX_KEEP_GUESSING = 0xff21,
IDX_KERNEL_ACCEL = 'n', IDX_KERNEL_ACCEL = 'n',
IDX_KERNEL_LOOPS = 'u', IDX_KERNEL_LOOPS = 'u',
IDX_KERNEL_THREADS = 'T', IDX_KERNEL_THREADS = 'T',
IDX_KEYBOARD_LAYOUT_MAPPING = 0xff21, IDX_KEYBOARD_LAYOUT_MAPPING = 0xff22,
IDX_KEYSPACE = 0xff22, IDX_KEYSPACE = 0xff23,
IDX_LEFT = 0xff23, IDX_LEFT = 0xff24,
IDX_LIMIT = 'l', IDX_LIMIT = 'l',
IDX_LOGFILE_DISABLE = 0xff24, IDX_LOGFILE_DISABLE = 0xff25,
IDX_LOOPBACK = 0xff25, IDX_LOOPBACK = 0xff26,
IDX_MACHINE_READABLE = 0xff26, IDX_MACHINE_READABLE = 0xff27,
IDX_MARKOV_CLASSIC = 0xff27, IDX_MARKOV_CLASSIC = 0xff28,
IDX_MARKOV_DISABLE = 0xff28, IDX_MARKOV_DISABLE = 0xff29,
IDX_MARKOV_HCSTAT2 = 0xff29, IDX_MARKOV_HCSTAT2 = 0xff2a,
IDX_MARKOV_THRESHOLD = 't', IDX_MARKOV_THRESHOLD = 't',
IDX_NONCE_ERROR_CORRECTIONS = 0xff2a, IDX_NONCE_ERROR_CORRECTIONS = 0xff2b,
IDX_OPENCL_DEVICE_TYPES = 'D', IDX_OPENCL_DEVICE_TYPES = 'D',
IDX_OPTIMIZED_KERNEL_ENABLE = 'O', IDX_OPTIMIZED_KERNEL_ENABLE = 'O',
IDX_OUTFILE_AUTOHEX_DISABLE = 0xff2b, IDX_OUTFILE_AUTOHEX_DISABLE = 0xff2c,
IDX_OUTFILE_CHECK_DIR = 0xff2c, IDX_OUTFILE_CHECK_DIR = 0xff2d,
IDX_OUTFILE_CHECK_TIMER = 0xff2d, IDX_OUTFILE_CHECK_TIMER = 0xff2e,
IDX_OUTFILE_FORMAT = 0xff2e, IDX_OUTFILE_FORMAT = 0xff2f,
IDX_OUTFILE = 'o', IDX_OUTFILE = 'o',
IDX_POTFILE_DISABLE = 0xff2f, IDX_POTFILE_DISABLE = 0xff30,
IDX_POTFILE_PATH = 0xff30, IDX_POTFILE_PATH = 0xff31,
IDX_PROGRESS_ONLY = 0xff31, IDX_PROGRESS_ONLY = 0xff32,
IDX_QUIET = 0xff32, IDX_QUIET = 0xff33,
IDX_REMOVE = 0xff33, IDX_REMOVE = 0xff34,
IDX_REMOVE_TIMER = 0xff34, IDX_REMOVE_TIMER = 0xff35,
IDX_RESTORE = 0xff35, IDX_RESTORE = 0xff36,
IDX_RESTORE_DISABLE = 0xff36, IDX_RESTORE_DISABLE = 0xff37,
IDX_RESTORE_FILE_PATH = 0xff37, IDX_RESTORE_FILE_PATH = 0xff38,
IDX_RP_FILE = 'r', IDX_RP_FILE = 'r',
IDX_RP_GEN_FUNC_MAX = 0xff38, IDX_RP_GEN_FUNC_MAX = 0xff39,
IDX_RP_GEN_FUNC_MIN = 0xff39, IDX_RP_GEN_FUNC_MIN = 0xff3a,
IDX_RP_GEN = 'g', IDX_RP_GEN = 'g',
IDX_RP_GEN_SEED = 0xff3a, IDX_RP_GEN_SEED = 0xff3b,
IDX_RULE_BUF_L = 'j', IDX_RULE_BUF_L = 'j',
IDX_RULE_BUF_R = 'k', IDX_RULE_BUF_R = 'k',
IDX_RUNTIME = 0xff3b, IDX_RUNTIME = 0xff3c,
IDX_SCRYPT_TMTO = 0xff3c, IDX_SCRYPT_TMTO = 0xff3d,
IDX_SEGMENT_SIZE = 'c', IDX_SEGMENT_SIZE = 'c',
IDX_SELF_TEST_DISABLE = 0xff3d, IDX_SELF_TEST_DISABLE = 0xff3e,
IDX_SEPARATOR = 'p', IDX_SEPARATOR = 'p',
IDX_SESSION = 0xff3e, IDX_SESSION = 0xff3f,
IDX_SHOW = 0xff3f, IDX_SHOW = 0xff40,
IDX_SKIP = 's', IDX_SKIP = 's',
IDX_SLOW_CANDIDATES = 'S', IDX_SLOW_CANDIDATES = 'S',
IDX_SPEED_ONLY = 0xff40, IDX_SPEED_ONLY = 0xff41,
IDX_SPIN_DAMP = 0xff41, IDX_SPIN_DAMP = 0xff42,
IDX_STATUS = 0xff42, IDX_STATUS = 0xff43,
IDX_STATUS_JSON = 0xff43, IDX_STATUS_JSON = 0xff44,
IDX_STATUS_TIMER = 0xff44, IDX_STATUS_TIMER = 0xff45,
IDX_STDOUT_FLAG = 0xff45, IDX_STDOUT_FLAG = 0xff46,
IDX_STDIN_TIMEOUT_ABORT = 0xff46, IDX_STDIN_TIMEOUT_ABORT = 0xff47,
IDX_TRUECRYPT_KEYFILES = 0xff47, IDX_TRUECRYPT_KEYFILES = 0xff48,
IDX_USERNAME = 0xff48, IDX_USERNAME = 0xff49,
IDX_VERACRYPT_KEYFILES = 0xff49, IDX_VERACRYPT_KEYFILES = 0xff4a,
IDX_VERACRYPT_PIM_START = 0xff4a, IDX_VERACRYPT_PIM_START = 0xff4b,
IDX_VERACRYPT_PIM_STOP = 0xff4b, IDX_VERACRYPT_PIM_STOP = 0xff4c,
IDX_VERSION_LOWER = 'v', IDX_VERSION_LOWER = 'v',
IDX_VERSION = 'V', IDX_VERSION = 'V',
IDX_WORDLIST_AUTOHEX_DISABLE = 0xff4c, IDX_WORDLIST_AUTOHEX_DISABLE = 0xff4d,
IDX_WORKLOAD_PROFILE = 'w', IDX_WORKLOAD_PROFILE = 'w',
} user_options_map_t; } user_options_map_t;
@ -1587,6 +1593,7 @@ typedef struct backend_ctx
bool need_nvml; bool need_nvml;
bool need_nvapi; bool need_nvapi;
bool need_sysfs; bool need_sysfs;
bool need_iokit;
int comptime; int comptime;
@ -1630,6 +1637,7 @@ typedef enum kernel_workload
#include "ext_nvapi.h" #include "ext_nvapi.h"
#include "ext_nvml.h" #include "ext_nvml.h"
#include "ext_sysfs.h" #include "ext_sysfs.h"
#include "ext_iokit.h"
typedef struct hm_attrs typedef struct hm_attrs
{ {
@ -1637,6 +1645,7 @@ typedef struct hm_attrs
HM_ADAPTER_NVML nvml; HM_ADAPTER_NVML nvml;
HM_ADAPTER_NVAPI nvapi; HM_ADAPTER_NVAPI nvapi;
HM_ADAPTER_SYSFS sysfs; HM_ADAPTER_SYSFS sysfs;
HM_ADAPTER_IOKIT iokit;
int od_version; int od_version;
@ -1661,6 +1670,7 @@ typedef struct hwmon_ctx
void *hm_nvml; void *hm_nvml;
void *hm_nvapi; void *hm_nvapi;
void *hm_sysfs; void *hm_sysfs;
void *hm_iokit;
hm_attrs_t *hm_device; hm_attrs_t *hm_device;
@ -1951,6 +1961,7 @@ typedef struct user_options
#endif #endif
bool hash_mode_chgd; bool hash_mode_chgd;
bool hccapx_message_pair_chgd; bool hccapx_message_pair_chgd;
bool identify;
bool increment_max_chgd; bool increment_max_chgd;
bool increment_min_chgd; bool increment_min_chgd;
bool kernel_accel_chgd; bool kernel_accel_chgd;
@ -2240,6 +2251,9 @@ typedef struct device_info
double exec_msec_dev; double exec_msec_dev;
char *speed_sec_dev; char *speed_sec_dev;
char *guess_candidates_dev; char *guess_candidates_dev;
#if defined(__APPLE__)
char *hwmon_fan_dev;
#endif
char *hwmon_dev; char *hwmon_dev;
int corespeed_dev; int corespeed_dev;
int memoryspeed_dev; int memoryspeed_dev;
@ -2682,7 +2696,7 @@ typedef enum hash_category
HASH_CATEGORY_PRIVATE_KEY = 20, HASH_CATEGORY_PRIVATE_KEY = 20,
HASH_CATEGORY_IMS = 21, HASH_CATEGORY_IMS = 21,
HASH_CATEGORY_CRYPTOCURRENCY_WALLET = 22, HASH_CATEGORY_CRYPTOCURRENCY_WALLET = 22,
HASH_CATEGORY_FBE = 23
} hash_category_t; } hash_category_t;
// hash specific // hash specific

View File

@ -6,7 +6,7 @@
SHARED ?= 0 SHARED ?= 0
DEBUG := 0 DEBUG := 0
PRODUCTION := 0 PRODUCTION := 0
PRODUCTION_VERSION := v6.2.1 PRODUCTION_VERSION := v6.2.2
ENABLE_CUBIN ?= 1 ENABLE_CUBIN ?= 1
ENABLE_BRAIN ?= 1 ENABLE_BRAIN ?= 1
ENABLE_UNRAR ?= 1 ENABLE_UNRAR ?= 1
@ -189,6 +189,7 @@ endif
## because LZMA SDK ## because LZMA SDK
ifeq ($(CC),clang) ifeq ($(CC),clang)
CFLAGS += -Wno-enum-conversion CFLAGS += -Wno-enum-conversion
CFLAGS += -Wno-typedef-redefinition
endif endif
## because ZLIB ## because ZLIB
@ -314,6 +315,7 @@ endif # FreeBSD
ifeq ($(UNAME),Darwin) ifeq ($(UNAME),Darwin)
export MACOSX_DEPLOYMENT_TARGET=10.9 export MACOSX_DEPLOYMENT_TARGET=10.9
CFLAGS_NATIVE := $(CFLAGS) CFLAGS_NATIVE := $(CFLAGS)
CFLAGS_NATIVE += -DWITH_HWMON
ifeq ($(shell test $(DARWIN_VERSION) -le 15; echo $$?), 0) ifeq ($(shell test $(DARWIN_VERSION) -le 15; echo $$?), 0)
CFLAGS_NATIVE += -DMISSING_CLOCK_GETTIME CFLAGS_NATIVE += -DMISSING_CLOCK_GETTIME
@ -321,6 +323,7 @@ endif
LFLAGS_NATIVE := $(LFLAGS) LFLAGS_NATIVE := $(LFLAGS)
LFLAGS_NATIVE += -framework OpenCL LFLAGS_NATIVE += -framework OpenCL
LFLAGS_NATIVE += -framework IOKit
LFLAGS_NATIVE += -lpthread LFLAGS_NATIVE += -lpthread
LFLAGS_NATIVE += -liconv LFLAGS_NATIVE += -liconv
endif # Darwin endif # Darwin
@ -359,11 +362,10 @@ CXXFLAGS :=
EMU_OBJS_ALL := emu_general emu_inc_common emu_inc_platform emu_inc_scalar emu_inc_simd EMU_OBJS_ALL := emu_general emu_inc_common emu_inc_platform emu_inc_scalar emu_inc_simd
EMU_OBJS_ALL += emu_inc_rp emu_inc_rp_optimized EMU_OBJS_ALL += emu_inc_rp emu_inc_rp_optimized
EMU_OBJS_ALL += emu_inc_truecrypt_crc32 emu_inc_truecrypt_keyfile emu_inc_truecrypt_xts emu_inc_veracrypt_xts
EMU_OBJS_ALL += emu_inc_hash_md4 emu_inc_hash_md5 emu_inc_hash_ripemd160 emu_inc_hash_sha1 emu_inc_hash_sha256 emu_inc_hash_sha384 emu_inc_hash_sha512 emu_inc_hash_streebog256 emu_inc_hash_streebog512 emu_inc_ecc_secp256k1 EMU_OBJS_ALL += emu_inc_hash_md4 emu_inc_hash_md5 emu_inc_hash_ripemd160 emu_inc_hash_sha1 emu_inc_hash_sha256 emu_inc_hash_sha384 emu_inc_hash_sha512 emu_inc_hash_streebog256 emu_inc_hash_streebog512 emu_inc_ecc_secp256k1
EMU_OBJS_ALL += emu_inc_cipher_aes emu_inc_cipher_camellia emu_inc_cipher_des emu_inc_cipher_kuznyechik emu_inc_cipher_serpent emu_inc_cipher_twofish EMU_OBJS_ALL += emu_inc_cipher_aes emu_inc_cipher_camellia emu_inc_cipher_des emu_inc_cipher_kuznyechik emu_inc_cipher_serpent emu_inc_cipher_twofish
OBJS_ALL := affinity autotune backend benchmark bitmap bitops combinator common convert cpt cpu_crc32 debugfile dictstat dispatch dynloader event ext_ADL ext_cuda ext_nvapi ext_nvml ext_nvrtc ext_OpenCL ext_sysfs ext_lzma filehandling folder hashcat hashes hlfmt hwmon induct interface keyboard_layout locking logfile loopback memory monitor mpsp outfile_check outfile pidfile potfile restore rp rp_cpu selftest slow_candidates shared status stdout straight terminal thread timer tuningdb usage user_options wordlist $(EMU_OBJS_ALL) OBJS_ALL := affinity autotune backend benchmark bitmap bitops combinator common convert cpt cpu_crc32 debugfile dictstat dispatch dynloader event ext_ADL ext_cuda ext_nvapi ext_nvml ext_nvrtc ext_OpenCL ext_sysfs ext_iokit ext_lzma filehandling folder hashcat hashes hlfmt hwmon induct interface keyboard_layout locking logfile loopback memory monitor mpsp outfile_check outfile pidfile potfile restore rp rp_cpu selftest slow_candidates shared status stdout straight terminal thread timer tuningdb usage user_options wordlist $(EMU_OBJS_ALL)
ifeq ($(ENABLE_BRAIN),1) ifeq ($(ENABLE_BRAIN),1)
OBJS_ALL += brain OBJS_ALL += brain

View File

@ -131,6 +131,17 @@ static int backend_ctx_find_alias_devices (hashcat_ctx_t *hashcat_ctx)
backend_ctx->opencl_devices_active--; backend_ctx->opencl_devices_active--;
backend_ctx->backend_devices_active--; backend_ctx->backend_devices_active--;
// show a warning for specifically listed devices if they are an alias
if (backend_ctx->backend_devices_filter != (u64) -1)
{
if (backend_ctx->backend_devices_filter & (1ULL << alias_device->device_id))
{
event_log_warning (hashcat_ctx, "The device #%d specifically listed was skipped because it is an alias of device #%d", alias_device->device_id + 1, backend_device->device_id + 1);
event_log_warning (hashcat_ctx, NULL);
}
}
} }
} }
@ -3017,6 +3028,28 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
} }
else else
{ {
// innerloop prediction to get a speed estimation is hard, because we don't know in advance how much
// time the different kernels take and if their weightnings are equally distributed.
// - for instance, a regular _loop kernel is likely to be the slowest, but _loop2 kernel can also be slow.
// in fact, _loop2 can be even slower (see iTunes backup >= 10.0).
// - hooks can have a large influence depending on the OS.
// spawning threads and memory allocations take a lot of time on windows (compared to linux).
// - the kernel execution can take shortcuts based on intermediate values
// while these intermediate valus depend on input values.
// - if we meassure runtimes of different kernels to find out about their weightning
// we need to call them with real input values otherwise we miss the shortcuts inside the kernel.
// - the problem is that these real input values could crack the hash which makes the chaos perfect.
//
// so the innerloop prediction is not perfectly accurate, because we:
//
// 1. completely ignore hooks and the time they take.
// 2. assume that the code in _loop and _loop2 is similar,
// but we respect the different iteration counts in _loop and _loop2.
// 3. ignore _comp kernel runtimes (probably irrelevant).
//
// as soon as the first restore checkpoint is reached the prediction is accurate.
// also the closer it gets to that point.
if (true) if (true)
{ {
if (device_param->is_cuda == true) if (device_param->is_cuda == true)
@ -3160,7 +3193,10 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
* speed * speed
*/ */
const float iter_part = (float) (loop_pos + loop_left) / iter; const u32 iter1r = hashes->salts_buf[salt_pos].salt_iter * (salt_repeats + 1);
const u32 iter2r = hashes->salts_buf[salt_pos].salt_iter2 * (salt_repeats + 1);
const double iter_part = (double) ((iter * salt_repeat) + loop_pos + loop_left) / (double) (iter1r + iter2r);
const u64 perf_sum_all = (u64) (pws_cnt * iter_part); const u64 perf_sum_all = (u64) (pws_cnt * iter_part);
@ -3176,7 +3212,7 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
{ {
if (speed_msec > 4000) if (speed_msec > 4000)
{ {
device_param->outerloop_multi *= (double) iter / (double) (loop_pos + loop_left); device_param->outerloop_multi *= 1 / iter_part;
device_param->speed_pos = 1; device_param->speed_pos = 1;
@ -3295,6 +3331,25 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
//bug? //bug?
//while (status_ctx->run_thread_level2 == false) break; //while (status_ctx->run_thread_level2 == false) break;
if (status_ctx->run_thread_level2 == false) break; if (status_ctx->run_thread_level2 == false) break;
/**
* speed
*/
const u32 iter1r = hashes->salts_buf[salt_pos].salt_iter * (salt_repeats + 1);
const u32 iter2r = hashes->salts_buf[salt_pos].salt_iter2 * (salt_repeats + 1);
const double iter_part = (double) (iter1r + (iter * salt_repeat) + loop_pos + loop_left) / (double) (iter1r + iter2r);
const u64 perf_sum_all = (u64) (pws_cnt * iter_part);
double speed_msec = hc_timer_get (device_param->timer_speed);
const u32 speed_pos = device_param->speed_pos;
device_param->speed_cnt[speed_pos] = perf_sum_all;
device_param->speed_msec[speed_pos] = speed_msec;
} }
} }
} }
@ -5119,6 +5174,7 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->show == true) return 0; if (user_options->show == true) return 0;
if (user_options->usage == true) return 0; if (user_options->usage == true) return 0;
if (user_options->version == true) return 0; if (user_options->version == true) return 0;
if (user_options->identify == true) return 0;
hc_device_param_t *devices_param = (hc_device_param_t *) hccalloc (DEVICES_MAX, sizeof (hc_device_param_t)); hc_device_param_t *devices_param = (hc_device_param_t *) hccalloc (DEVICES_MAX, sizeof (hc_device_param_t));
@ -5608,6 +5664,7 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
bool need_nvml = false; bool need_nvml = false;
bool need_nvapi = false; bool need_nvapi = false;
bool need_sysfs = false; bool need_sysfs = false;
bool need_iokit = false;
int backend_devices_idx = 0; int backend_devices_idx = 0;
@ -5856,10 +5913,12 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
device_param->skipped = true; device_param->skipped = true;
} }
#if !defined (__APPLE__)
if ((backend_ctx->opencl_device_types_filter & CL_DEVICE_TYPE_GPU) == 0) if ((backend_ctx->opencl_device_types_filter & CL_DEVICE_TYPE_GPU) == 0)
{ {
device_param->skipped = true; device_param->skipped = true;
} }
#endif
if ((device_param->opencl_platform_vendor_id == VENDOR_ID_NV) && (device_param->opencl_device_vendor_id == VENDOR_ID_NV)) if ((device_param->opencl_platform_vendor_id == VENDOR_ID_NV) && (device_param->opencl_device_vendor_id == VENDOR_ID_NV))
{ {
@ -6614,6 +6673,13 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
// vendor specific // vendor specific
#if defined (__APPLE__)
if (device_param->opencl_platform_vendor_id == VENDOR_ID_APPLE)
{
if (device_param->skipped == false) need_iokit = true;
}
#endif
if (device_param->opencl_device_type & CL_DEVICE_TYPE_GPU) if (device_param->opencl_device_type & CL_DEVICE_TYPE_GPU)
{ {
if ((device_param->opencl_platform_vendor_id == VENDOR_ID_AMD) && (device_param->opencl_device_vendor_id == VENDOR_ID_AMD)) if ((device_param->opencl_platform_vendor_id == VENDOR_ID_AMD) && (device_param->opencl_device_vendor_id == VENDOR_ID_AMD))
@ -7059,7 +7125,12 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
if (device_param->is_opencl == false) continue; if (device_param->is_opencl == false) continue;
if (user_options->backend_info == false)
{
// do not ignore in case -I because user expects a value also for skipped devices
if (device_param->skipped == true) continue; if (device_param->skipped == true) continue;
}
/** /**
* create context for each device * create context for each device
@ -7283,6 +7354,7 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
backend_ctx->need_nvml = need_nvml; backend_ctx->need_nvml = need_nvml;
backend_ctx->need_nvapi = need_nvapi; backend_ctx->need_nvapi = need_nvapi;
backend_ctx->need_sysfs = need_sysfs; backend_ctx->need_sysfs = need_sysfs;
backend_ctx->need_iokit = need_iokit;
backend_ctx->comptime = comptime; backend_ctx->comptime = comptime;
@ -8626,29 +8698,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
#endif #endif
/** /**
* device_name_chksum * device_name_chksum_amp_mp
*/ */
char *device_name_chksum = (char *) hcmalloc (HCBUFSIZ_TINY);
char *device_name_chksum_amp_mp = (char *) hcmalloc (HCBUFSIZ_TINY); char *device_name_chksum_amp_mp = (char *) hcmalloc (HCBUFSIZ_TINY);
// The kernel source can depend on some JiT compiler macros which themself depend on the attack_modes.
// ATM this is relevant only for ATTACK_MODE_ASSOCIATION which slightly modifies ATTACK_MODE_STRAIGHT kernels.
const u32 extra_value = (user_options->attack_mode == ATTACK_MODE_ASSOCIATION) ? ATTACK_MODE_ASSOCIATION : ATTACK_MODE_NONE;
const size_t dnclen = snprintf (device_name_chksum, HCBUFSIZ_TINY, "%d-%d-%d-%u-%s-%s-%s-%d-%u-%u",
backend_ctx->comptime,
backend_ctx->cuda_driver_version,
device_param->is_opencl,
device_param->opencl_platform_vendor_id,
device_param->device_name,
device_param->opencl_device_version,
device_param->opencl_driver_version,
device_param->vector_width,
hashconfig->kern_type,
extra_value);
const size_t dnclen_amp_mp = snprintf (device_name_chksum_amp_mp, HCBUFSIZ_TINY, "%d-%d-%d-%u-%s-%s-%s", const size_t dnclen_amp_mp = snprintf (device_name_chksum_amp_mp, HCBUFSIZ_TINY, "%d-%d-%d-%u-%s-%s-%s",
backend_ctx->comptime, backend_ctx->comptime,
backend_ctx->cuda_driver_version, backend_ctx->cuda_driver_version,
@ -8660,12 +8714,6 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
md5_ctx_t md5_ctx; md5_ctx_t md5_ctx;
md5_init (&md5_ctx);
md5_update (&md5_ctx, (u32 *) device_name_chksum, dnclen);
md5_final (&md5_ctx);
snprintf (device_name_chksum, HCBUFSIZ_TINY, "%08x", md5_ctx.h[0]);
md5_init (&md5_ctx); md5_init (&md5_ctx);
md5_update (&md5_ctx, (u32 *) device_name_chksum_amp_mp, dnclen_amp_mp); md5_update (&md5_ctx, (u32 *) device_name_chksum_amp_mp, dnclen_amp_mp);
md5_final (&md5_ctx); md5_final (&md5_ctx);
@ -8884,6 +8932,38 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
if (user_options->quiet == false) event_log_warning (hashcat_ctx, "* Device #%u: build_options_module '%s'", device_id + 1, build_options_module_buf); if (user_options->quiet == false) event_log_warning (hashcat_ctx, "* Device #%u: build_options_module '%s'", device_id + 1, build_options_module_buf);
#endif #endif
/**
* device_name_chksum
*/
char *device_name_chksum = (char *) hcmalloc (HCBUFSIZ_TINY);
// The kernel source can depend on some JiT compiler macros which themself depend on the attack_modes.
// ATM this is relevant only for ATTACK_MODE_ASSOCIATION which slightly modifies ATTACK_MODE_STRAIGHT kernels.
const u32 extra_value = (user_options->attack_mode == ATTACK_MODE_ASSOCIATION) ? ATTACK_MODE_ASSOCIATION : ATTACK_MODE_NONE;
const size_t dnclen = snprintf (device_name_chksum, HCBUFSIZ_TINY, "%d-%d-%d-%u-%s-%s-%s-%d-%u-%u-%s",
backend_ctx->comptime,
backend_ctx->cuda_driver_version,
device_param->is_opencl,
device_param->opencl_platform_vendor_id,
device_param->device_name,
device_param->opencl_device_version,
device_param->opencl_driver_version,
device_param->vector_width,
hashconfig->kern_type,
extra_value,
build_options_module_buf);
md5_ctx_t md5_ctx;
md5_init (&md5_ctx);
md5_update (&md5_ctx, (u32 *) device_name_chksum, dnclen);
md5_final (&md5_ctx);
snprintf (device_name_chksum, HCBUFSIZ_TINY, "%08x", md5_ctx.h[0]);
/** /**
* kernel source filename * kernel source filename
*/ */
@ -8921,6 +9001,8 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
} }
hcfree (build_options_module_buf); hcfree (build_options_module_buf);
hcfree (device_name_chksum);
} }
/** /**
@ -9032,7 +9114,6 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
if (hc_clUnloadPlatformCompiler (hashcat_ctx, platform_id) == -1) return -1; if (hc_clUnloadPlatformCompiler (hashcat_ctx, platform_id) == -1) return -1;
} }
hcfree (device_name_chksum);
hcfree (device_name_chksum_amp_mp); hcfree (device_name_chksum_amp_mp);
// some algorithm collide too fast, make that impossible // some algorithm collide too fast, make that impossible

View File

@ -86,6 +86,7 @@ int bitmap_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->show == true) return 0; if (user_options->show == true) return 0;
if (user_options->usage == true) return 0; if (user_options->usage == true) return 0;
if (user_options->version == true) return 0; if (user_options->version == true) return 0;
if (user_options->identify == true) return 0;
bitmap_ctx->enabled = true; bitmap_ctx->enabled = true;

View File

@ -22,6 +22,7 @@ int cpt_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->show == true) return 0; if (user_options->show == true) return 0;
if (user_options->usage == true) return 0; if (user_options->usage == true) return 0;
if (user_options->version == true) return 0; if (user_options->version == true) return 0;
if (user_options->identify == true) return 0;
cpt_ctx->enabled = true; cpt_ctx->enabled = true;

View File

@ -88,7 +88,7 @@ u32 cpu_crc32_buffer (const u8 *buf, const size_t length)
return crc ^ 0xffffffff; return crc ^ 0xffffffff;
} }
int cpu_crc32 (const char *filename, u8 keytab[64]) int cpu_crc32 (const char *filename, u8 *keytab, const size_t keytabsz)
{ {
u32 crc = ~0U; u32 crc = ~0U;
@ -110,10 +110,10 @@ int cpu_crc32 (const char *filename, u8 keytab[64])
{ {
crc = crc32tab[(crc ^ buf[fpos]) & 0xff] ^ (crc >> 8); crc = crc32tab[(crc ^ buf[fpos]) & 0xff] ^ (crc >> 8);
keytab[kpos++] += (crc >> 24) & 0xff; if (kpos >= 64) kpos = 0; keytab[kpos++] += (crc >> 24) & 0xff; if (kpos >= keytabsz) kpos = 0;
keytab[kpos++] += (crc >> 16) & 0xff; if (kpos >= 64) kpos = 0; keytab[kpos++] += (crc >> 16) & 0xff; if (kpos >= keytabsz) kpos = 0;
keytab[kpos++] += (crc >> 8) & 0xff; if (kpos >= 64) kpos = 0; keytab[kpos++] += (crc >> 8) & 0xff; if (kpos >= keytabsz) kpos = 0;
keytab[kpos++] += (crc >> 0) & 0xff; if (kpos >= 64) kpos = 0; keytab[kpos++] += (crc >> 0) & 0xff; if (kpos >= keytabsz) kpos = 0;
} }
hcfree (buf); hcfree (buf);

View File

@ -97,6 +97,7 @@ int debugfile_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->progress_only == true) return 0; if (user_options->progress_only == true) return 0;
if (user_options->usage == true) return 0; if (user_options->usage == true) return 0;
if (user_options->version == true) return 0; if (user_options->version == true) return 0;
if (user_options->identify == true) return 0;
if (user_options->debug_mode == 0) return 0; if (user_options->debug_mode == 0) return 0;
debugfile_ctx->enabled = true; debugfile_ctx->enabled = true;

View File

@ -64,6 +64,7 @@ int dictstat_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->show == true) return 0; if (user_options->show == true) return 0;
if (user_options->usage == true) return 0; if (user_options->usage == true) return 0;
if (user_options->version == true) return 0; if (user_options->version == true) return 0;
if (user_options->identify == true) return 0;
if (user_options->attack_mode == ATTACK_MODE_BF) return 0; if (user_options->attack_mode == ATTACK_MODE_BF) return 0;

View File

@ -1,11 +0,0 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#include "common.h"
#include "types.h"
#include "emu_general.h"
#include "inc_truecrypt_crc32.cl"

View File

@ -1,11 +0,0 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#include "common.h"
#include "types.h"
#include "emu_general.h"
#include "inc_truecrypt_keyfile.cl"

View File

@ -1,11 +0,0 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#include "common.h"
#include "types.h"
#include "emu_general.h"
#include "inc_truecrypt_xts.cl"

View File

@ -1,11 +0,0 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#include "common.h"
#include "types.h"
#include "emu_general.h"
#include "inc_veracrypt_xts.cl"

View File

@ -5,9 +5,285 @@
#include "common.h" #include "common.h"
#include "types.h" #include "types.h"
#include "memory.h"
#include "event.h"
#include "ext_ADL.h" #include "ext_ADL.h"
#include "dynloader.h"
void *HC_API_CALL ADL_Main_Memory_Alloc (const int iSize) void *HC_API_CALL ADL_Main_Memory_Alloc (const int iSize)
{ {
return malloc ((size_t) iSize); return malloc ((size_t) iSize);
} }
int adl_init (void *hashcat_ctx)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl;
memset (adl, 0, sizeof (ADL_PTR));
#if defined (_WIN)
adl->lib = hc_dlopen ("atiadlxx.dll");
if (!adl->lib)
{
adl->lib = hc_dlopen ("atiadlxy.dll");
}
#elif defined (__CYGWIN__)
adl->lib = hc_dlopen ("atiadlxx.dll");
if (!adl->lib)
{
adl->lib = hc_dlopen ("atiadlxy.dll");
}
#elif defined (_POSIX)
adl->lib = hc_dlopen ("libatiadlxx.so");
#endif
if (!adl->lib)
{
//if (user_options->quiet == false)
// event_log_error (hashcat_ctx, "Load of ADL library failed. Proceeding without ADL HWMon enabled.");
return -1;
}
HC_LOAD_FUNC(adl, ADL_Main_Control_Destroy, ADL_MAIN_CONTROL_DESTROY, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Main_Control_Create, ADL_MAIN_CONTROL_CREATE, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Adapter_NumberOfAdapters_Get, ADL_ADAPTER_NUMBEROFADAPTERS_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Adapter_AdapterInfo_Get, ADL_ADAPTER_ADAPTERINFO_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Display_DisplayInfo_Get, ADL_DISPLAY_DISPLAYINFO_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Adapter_ID_Get, ADL_ADAPTER_ID_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Adapter_VideoBiosInfo_Get, ADL_ADAPTER_VIDEOBIOSINFO_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive5_ThermalDevices_Enum, ADL_OVERDRIVE5_THERMALDEVICES_ENUM, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive5_Temperature_Get, ADL_OVERDRIVE5_TEMPERATURE_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive6_Temperature_Get, ADL_OVERDRIVE6_TEMPERATURE_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive5_CurrentActivity_Get, ADL_OVERDRIVE5_CURRENTACTIVITY_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive5_FanSpeedInfo_Get, ADL_OVERDRIVE5_FANSPEEDINFO_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive5_FanSpeed_Get, ADL_OVERDRIVE5_FANSPEED_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive6_FanSpeed_Get, ADL_OVERDRIVE6_FANSPEED_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Adapter_Active_Get, ADL_ADAPTER_ACTIVE_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive_Caps, ADL_OVERDRIVE_CAPS, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive6_Capabilities_Get, ADL_OVERDRIVE6_CAPABILITIES_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive6_StateInfo_Get, ADL_OVERDRIVE6_STATEINFO_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive6_CurrentStatus_Get, ADL_OVERDRIVE6_CURRENTSTATUS_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive6_TargetTemperatureData_Get, ADL_OVERDRIVE6_TARGETTEMPERATUREDATA_GET, ADL, 0);
HC_LOAD_FUNC(adl, ADL_Overdrive6_TargetTemperatureRangeInfo_Get, ADL_OVERDRIVE6_TARGETTEMPERATURERANGEINFO_GET, ADL, 0);
return 0;
}
void adl_close (void *hashcat_ctx)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl;
if (adl)
{
if (adl->lib)
hc_dlclose (adl->lib);
hcfree (adl);
}
}
int hm_ADL_Main_Control_Destroy (void *hashcat_ctx)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl;
const int ADL_rc = adl->ADL_Main_Control_Destroy ();
if (ADL_rc != ADL_OK)
{
event_log_error (hashcat_ctx, "ADL_Main_Control_Destroy(): %d", ADL_rc);
return -1;
}
return 0;
}
int hm_ADL_Main_Control_Create (void *hashcat_ctx, ADL_MAIN_MALLOC_CALLBACK callback, int iEnumConnectedAdapters)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl;
const int ADL_rc = adl->ADL_Main_Control_Create (callback, iEnumConnectedAdapters);
if (ADL_rc != ADL_OK)
{
event_log_error (hashcat_ctx, "ADL_Main_Control_Create(): %d", ADL_rc);
return -1;
}
return 0;
}
int hm_ADL_Adapter_NumberOfAdapters_Get (void *hashcat_ctx, int *lpNumAdapters)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl;
const int ADL_rc = adl->ADL_Adapter_NumberOfAdapters_Get (lpNumAdapters);
if (ADL_rc != ADL_OK)
{
event_log_error (hashcat_ctx, "ADL_Adapter_NumberOfAdapters_Get(): %d", ADL_rc);
return -1;
}
return 0;
}
int hm_ADL_Adapter_AdapterInfo_Get (void *hashcat_ctx, LPAdapterInfo lpInfo, int iInputSize)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl;
const int ADL_rc = adl->ADL_Adapter_AdapterInfo_Get (lpInfo, iInputSize);
if (ADL_rc != ADL_OK)
{
event_log_error (hashcat_ctx, "ADL_Adapter_AdapterInfo_Get(): %d", ADL_rc);
return -1;
}
return 0;
}
int hm_ADL_Overdrive5_Temperature_Get (void *hashcat_ctx, int iAdapterIndex, int iThermalControllerIndex, ADLTemperature *lpTemperature)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl;
const int ADL_rc = adl->ADL_Overdrive5_Temperature_Get (iAdapterIndex, iThermalControllerIndex, lpTemperature);
if (ADL_rc != ADL_OK)
{
event_log_error (hashcat_ctx, "ADL_Overdrive5_Temperature_Get(): %d", ADL_rc);
return -1;
}
return 0;
}
int hm_ADL_Overdrive6_Temperature_Get (void *hashcat_ctx, int iAdapterIndex, int *iTemperature)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl;
const int ADL_rc = adl->ADL_Overdrive6_Temperature_Get (iAdapterIndex, iTemperature);
if (ADL_rc != ADL_OK)
{
event_log_error (hashcat_ctx, "ADL_Overdrive6_Temperature_Get(): %d", ADL_rc);
return -1;
}
return 0;
}
int hm_ADL_Overdrive_CurrentActivity_Get (void *hashcat_ctx, int iAdapterIndex, ADLPMActivity *lpActivity)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl;
const int ADL_rc = adl->ADL_Overdrive5_CurrentActivity_Get (iAdapterIndex, lpActivity);
if (ADL_rc != ADL_OK)
{
event_log_error (hashcat_ctx, "ADL_Overdrive5_CurrentActivity_Get(): %d", ADL_rc);
return -1;
}
return 0;
}
int hm_ADL_Overdrive5_FanSpeed_Get (void *hashcat_ctx, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl;
const int ADL_rc = adl->ADL_Overdrive5_FanSpeed_Get (iAdapterIndex, iThermalControllerIndex, lpFanSpeedValue);
if ((ADL_rc != ADL_OK) && (ADL_rc != ADL_ERR_NOT_SUPPORTED)) // exception allowed only here
{
event_log_error (hashcat_ctx, "ADL_Overdrive5_FanSpeed_Get(): %d", ADL_rc);
return -1;
}
return 0;
}
int hm_ADL_Overdrive6_FanSpeed_Get (void *hashcat_ctx, int iAdapterIndex, ADLOD6FanSpeedInfo *lpFanSpeedInfo)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl;
const int ADL_rc = adl->ADL_Overdrive6_FanSpeed_Get (iAdapterIndex, lpFanSpeedInfo);
if ((ADL_rc != ADL_OK) && (ADL_rc != ADL_ERR_NOT_SUPPORTED)) // exception allowed only here
{
event_log_error (hashcat_ctx, "ADL_Overdrive6_FanSpeed_Get(): %d", ADL_rc);
return -1;
}
return 0;
}
int hm_ADL_Overdrive_Caps (void *hashcat_ctx, int iAdapterIndex, int *od_supported, int *od_enabled, int *od_version)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl;
const int ADL_rc = adl->ADL_Overdrive_Caps (iAdapterIndex, od_supported, od_enabled, od_version);
if (ADL_rc != ADL_OK)
{
event_log_error (hashcat_ctx, "ADL_Overdrive_Caps(): %d", ADL_rc);
return -1;
}
return 0;
}
int hm_ADL_Overdrive6_TargetTemperatureData_Get (void *hashcat_ctx, int iAdapterIndex, int *cur_temp, int *default_temp)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl;
const int ADL_rc = adl->ADL_Overdrive6_TargetTemperatureData_Get (iAdapterIndex, cur_temp, default_temp);
if (ADL_rc != ADL_OK)
{
event_log_error (hashcat_ctx, "ADL_Overdrive6_TargetTemperatureData_Get(): %d", ADL_rc);
return -1;
}
return 0;
}

305
src/ext_iokit.c Normal file
View File

@ -0,0 +1,305 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#include "common.h"
#include "types.h"
#include "memory.h"
#include "shared.h"
#include "event.h"
#include "ext_iokit.h"
#if defined (__APPLE__)
#include <IOKit/IOKitLib.h>
UInt32 hm_IOKIT_strtoul (char *str, int size, int base)
{
int i;
UInt32 total = 0;
for (i = 0; i < size; i++)
{
if (base == 16)
{
total += str[i] << (size - 1 - i) * 8;
}
else
{
total += (unsigned char)(str[i] << (size - 1 - i) * 8);
}
}
return total;
}
void hm_IOKIT_ultostr (char *str, UInt32 val)
{
str[0] = '\0';
sprintf (str, "%c%c%c%c", (unsigned int)(val >> 24), (unsigned int)(val >> 16), (unsigned int)(val >> 8), (unsigned int)(val));
}
kern_return_t hm_IOKIT_SMCOpen (void *hashcat_ctx, io_connect_t *conn)
{
kern_return_t result;
io_iterator_t iterator;
io_object_t device;
CFMutableDictionaryRef matchingDictionary = IOServiceMatching ("AppleSMC");
result = IOServiceGetMatchingServices (kIOMasterPortDefault, matchingDictionary, &iterator);
if (result != kIOReturnSuccess)
{
event_log_error (hashcat_ctx, "IOServiceGetMatchingServices(): %08x", result);
return 1;
}
device = IOIteratorNext (iterator);
IOObjectRelease (iterator);
if (device == 0)
{
event_log_error (hashcat_ctx, "hm_IOKIT_SMCOpen(): no SMC found.");
return 1;
}
result = IOServiceOpen (device, mach_task_self(), 0, conn);
IOObjectRelease (device);
if (result != kIOReturnSuccess)
{
event_log_error (hashcat_ctx, "IOServiceOpen(): %08x", result);
return 1;
}
return kIOReturnSuccess;
}
kern_return_t hm_IOKIT_SMCClose (io_connect_t conn)
{
return IOServiceClose (conn);
}
kern_return_t hm_IOKIT_SMCCall (int index, SMCKeyData_t *inData, SMCKeyData_t *outData, io_connect_t conn)
{
size_t inDataSize = sizeof (SMCKeyData_t);
size_t outDataSize = sizeof (SMCKeyData_t);
#if MAC_OS_X_VERSION_10_5
return IOConnectCallStructMethod (conn, index, inData, inDataSize, outData, &outDataSize);
#else
return IOConnectMethodStructureIStructureO (conn, index, inDataSize, &outDataSize, inData, outData);
#endif
}
kern_return_t hm_IOKIT_SMCReadKey (UInt32Char_t key, SMCVal_t *val, io_connect_t conn)
{
SMCKeyData_t inData;
SMCKeyData_t outData;
memset (&inData, 0, sizeof (SMCKeyData_t));
memset (&outData, 0, sizeof (SMCKeyData_t));
memset (val, 0, sizeof (SMCVal_t));
inData.key = hm_IOKIT_strtoul (key, 4, 16);
inData.data8 = SMC_CMD_READ_KEYINFO;
if (hm_IOKIT_SMCCall (KERNEL_INDEX_SMC, &inData, &outData, conn) != kIOReturnSuccess) return 1;
val->dataSize = outData.keyInfo.dataSize;
hm_IOKIT_ultostr (val->dataType, outData.keyInfo.dataType);
inData.keyInfo.dataSize = val->dataSize;
inData.data8 = SMC_CMD_READ_BYTES;
if (hm_IOKIT_SMCCall (KERNEL_INDEX_SMC, &inData, &outData, conn) != kIOReturnSuccess) return 1;
memcpy(val->bytes, outData.bytes, sizeof(outData.bytes));
return kIOReturnSuccess;
}
int hm_IOKIT_SMCGetSensorGraphicHot (void *hashcat_ctx)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
IOKIT_PTR *iokit = hwmon_ctx->hm_iokit;
SMCVal_t val;
memset (&val, 0, sizeof (SMCVal_t));
if (hm_IOKIT_SMCReadKey (HM_IOKIT_SMC_SENSOR_GRAPHICS_HOT, &val, iokit->conn) == kIOReturnSuccess)
{
int alarm = -1;
if (val.dataSize > 0)
{
if (strcmp(val.dataType, DATATYPE_UINT8) == 0)
{
alarm = hm_IOKIT_strtoul ((char *)val.bytes, val.dataSize, 10);
}
}
return alarm;
}
return -1;
}
int hm_IOKIT_SMCGetTemperature (void *hashcat_ctx, char *key, double *temp)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
IOKIT_PTR *iokit = hwmon_ctx->hm_iokit;
SMCVal_t val;
memset (&val, 0, sizeof (SMCVal_t));
if (hm_IOKIT_SMCReadKey (key, &val, iokit->conn) == kIOReturnSuccess)
{
if (val.dataSize > 0)
{
if (strcmp(val.dataType, DATATYPE_SP78) == 0)
{
// convert sp78 value to temperature
int intValue = val.bytes[0] * 256 + (unsigned char)val.bytes[1];
*temp = (intValue / 256.0);
return 1;
}
}
}
// read failed
*temp = 0.0;
return -1;
}
bool hm_IOKIT_SMCGetFanRPM (char *key, io_connect_t conn, float *ret)
{
SMCVal_t val;
memset (&val, 0, sizeof (SMCVal_t));
if (hm_IOKIT_SMCReadKey (key, &val, conn) == kIOReturnSuccess)
{
if (val.dataSize > 0)
{
if (strcmp(val.dataType, DATATYPE_FLT) == 0)
{
*ret = *(float *) val.bytes;
return true;
}
if (strcmp(val.dataType, DATATYPE_FPE2) == 0)
{
// convert fpe2 value to RPM
*ret = ntohs (*(UInt16*)val.bytes) / 4.0;
return true;
}
}
}
// read failed
*ret = -1.f;
return false;
}
int hm_IOKIT_get_fan_speed_current (void *hashcat_ctx, char *fan_speed_buf)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
IOKIT_PTR *iokit = hwmon_ctx->hm_iokit;
SMCVal_t val;
UInt32Char_t key;
memset (&val, 0, sizeof (SMCVal_t));
if (hm_IOKIT_SMCReadKey ("FNum", &val, iokit->conn) == kIOReturnSuccess)
{
int totalFans = hm_IOKIT_strtoul ((char *)val.bytes, val.dataSize, 10);
if (totalFans <= 0) return -1;
char tmp_buf[16];
for (int i = 0; i < totalFans; i++)
{
int fan_speed = 0;
float actual_speed = 0.0f;
float maximum_speed = 0.0f;
memset (&key, 0, sizeof (UInt32Char_t));
sprintf (key, "F%dAc", i);
hm_IOKIT_SMCGetFanRPM (key, iokit->conn, &actual_speed);
if (actual_speed < 0.f) continue;
memset (&key, 0, sizeof (UInt32Char_t));
sprintf (key, "F%dMx", i);
hm_IOKIT_SMCGetFanRPM (key, iokit->conn, &maximum_speed);
if (maximum_speed < 0.f) continue;
fan_speed = (actual_speed / maximum_speed) * 100.f;
memset (tmp_buf, 0, sizeof (tmp_buf));
snprintf (tmp_buf, sizeof (tmp_buf) - 1, "Fan%d: %d%%, ", i, fan_speed);
strncat (fan_speed_buf, tmp_buf, strlen (tmp_buf));
}
// remove last two bytes
size_t out_len = strlen (fan_speed_buf);
if (out_len > 2) fan_speed_buf[out_len-2] = '\0';
}
return 1;
}
bool iokit_init (void *hashcat_ctx)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
IOKIT_PTR *iokit = hwmon_ctx->hm_iokit;
memset (iokit, 0, sizeof (IOKIT_PTR));
if (hm_IOKIT_SMCOpen (hashcat_ctx, &iokit->conn) == kIOReturnSuccess) return true;
hcfree (hwmon_ctx->hm_iokit);
hwmon_ctx->hm_iokit = NULL;
return false;
}
bool iokit_close (void *hashcat_ctx)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
IOKIT_PTR *iokit = hwmon_ctx->hm_iokit;
hm_IOKIT_SMCClose (iokit->conn);
return true;
}
#endif // __APPLE__

View File

@ -5,4 +5,237 @@
#include "common.h" #include "common.h"
#include "types.h" #include "types.h"
#include "memory.h"
#include "event.h"
#include "ext_nvapi.h" #include "ext_nvapi.h"
#include "dynloader.h"
int nvapi_init (void *hashcat_ctx)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVAPI_PTR *nvapi = (NVAPI_PTR *) hwmon_ctx->hm_nvapi;
memset (nvapi, 0, sizeof (NVAPI_PTR));
#if defined (_WIN)
#if defined (_WIN64)
nvapi->lib = hc_dlopen ("nvapi64.dll");
#else
nvapi->lib = hc_dlopen ("nvapi.dll");
#endif
#else
#if defined (__CYGWIN__)
#if defined (__x86_x64__)
nvapi->lib = hc_dlopen ("nvapi64.dll");
#else
nvapi->lib = hc_dlopen ("nvapi.dll");
#endif
#else
nvapi->lib = hc_dlopen ("nvapi.so"); // uhm yes, but .. yeah
#endif
#endif
if (!nvapi->lib)
{
//if (user_options->quiet == false)
// event_log_error (hashcat_ctx, "Load of NVAPI library failed. Proceeding without NVAPI HWMon enabled.");
return -1;
}
HC_LOAD_FUNC(nvapi, nvapi_QueryInterface, NVAPI_QUERYINTERFACE, NVAPI, 0);
HC_LOAD_ADDR(nvapi, NvAPI_Initialize, NVAPI_INITIALIZE, nvapi_QueryInterface, 0x0150E828U, NVAPI, 0);
HC_LOAD_ADDR(nvapi, NvAPI_Unload, NVAPI_UNLOAD, nvapi_QueryInterface, 0xD22BDD7EU, NVAPI, 0);
HC_LOAD_ADDR(nvapi, NvAPI_GetErrorMessage, NVAPI_GETERRORMESSAGE, nvapi_QueryInterface, 0x6C2D048CU, NVAPI, 0);
HC_LOAD_ADDR(nvapi, NvAPI_EnumPhysicalGPUs, NVAPI_ENUMPHYSICALGPUS, nvapi_QueryInterface, 0xE5AC921FU, NVAPI, 0);
HC_LOAD_ADDR(nvapi, NvAPI_GPU_GetPerfPoliciesInfo, NVAPI_GPU_GETPERFPOLICIESINFO, nvapi_QueryInterface, 0x409D9841U, NVAPI, 0);
HC_LOAD_ADDR(nvapi, NvAPI_GPU_GetPerfPoliciesStatus, NVAPI_GPU_GETPERFPOLICIESSTATUS, nvapi_QueryInterface, 0x3D358A0CU, NVAPI, 0);
HC_LOAD_ADDR(nvapi, NvAPI_GPU_GetBusId, NVAPI_GPU_GETBUSID, nvapi_QueryInterface, 0x1BE0B8E5U, NVAPI, 0);
HC_LOAD_ADDR(nvapi, NvAPI_GPU_GetBusSlotId, NVAPI_GPU_GETBUSSLOTID, nvapi_QueryInterface, 0x2A0A350FU, NVAPI, 0);
return 0;
}
void nvapi_close (void *hashcat_ctx)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVAPI_PTR *nvapi = (NVAPI_PTR *) hwmon_ctx->hm_nvapi;
if (nvapi)
{
if (nvapi->lib)
hc_dlclose (nvapi->lib);
hcfree (nvapi);
}
}
void hm_NvAPI_GetErrorMessage (NVAPI_PTR *nvapi, const NvAPI_Status NvAPI_rc, NvAPI_ShortString string)
{
nvapi->NvAPI_GetErrorMessage (NvAPI_rc, string);
}
int hm_NvAPI_Initialize (void *hashcat_ctx)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVAPI_PTR *nvapi = (NVAPI_PTR *) hwmon_ctx->hm_nvapi;
const NvAPI_Status NvAPI_rc = (NvAPI_Status) nvapi->NvAPI_Initialize ();
if (NvAPI_rc == NVAPI_LIBRARY_NOT_FOUND) return -1;
if (NvAPI_rc != NVAPI_OK)
{
NvAPI_ShortString string = { 0 };
hm_NvAPI_GetErrorMessage (nvapi, NvAPI_rc, string);
event_log_error (hashcat_ctx, "NvAPI_Initialize(): %s", string);
return -1;
}
return 0;
}
int hm_NvAPI_Unload (void *hashcat_ctx)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVAPI_PTR *nvapi = (NVAPI_PTR *) hwmon_ctx->hm_nvapi;
const NvAPI_Status NvAPI_rc = (NvAPI_Status) nvapi->NvAPI_Unload ();
if (NvAPI_rc != NVAPI_OK)
{
NvAPI_ShortString string = { 0 };
hm_NvAPI_GetErrorMessage (nvapi, NvAPI_rc, string);
event_log_error (hashcat_ctx, "NvAPI_Unload(): %s", string);
return -1;
}
return 0;
}
int hm_NvAPI_EnumPhysicalGPUs (void *hashcat_ctx, NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVAPI_PTR *nvapi = (NVAPI_PTR *) hwmon_ctx->hm_nvapi;
const NvAPI_Status NvAPI_rc = (NvAPI_Status) nvapi->NvAPI_EnumPhysicalGPUs (nvGPUHandle, pGpuCount);
if (NvAPI_rc != NVAPI_OK)
{
NvAPI_ShortString string = { 0 };
hm_NvAPI_GetErrorMessage (nvapi, NvAPI_rc, string);
event_log_error (hashcat_ctx, "NvAPI_EnumPhysicalGPUs(): %s", string);
return -1;
}
return 0;
}
int hm_NvAPI_GPU_GetPerfPoliciesInfo (void *hashcat_ctx, NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_PERF_POLICIES_INFO_PARAMS_V1 *perfPolicies_info)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVAPI_PTR *nvapi = (NVAPI_PTR *) hwmon_ctx->hm_nvapi;
const NvAPI_Status NvAPI_rc = (NvAPI_Status) nvapi->NvAPI_GPU_GetPerfPoliciesInfo (hPhysicalGpu, perfPolicies_info);
if (NvAPI_rc != NVAPI_OK)
{
NvAPI_ShortString string = { 0 };
hm_NvAPI_GetErrorMessage (nvapi, NvAPI_rc, string);
event_log_error (hashcat_ctx, "NvAPI_GPU_GetPerfPoliciesInfo(): %s", string);
return -1;
}
return 0;
}
int hm_NvAPI_GPU_GetPerfPoliciesStatus (void *hashcat_ctx, NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 *perfPolicies_status)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVAPI_PTR *nvapi = (NVAPI_PTR *) hwmon_ctx->hm_nvapi;
const NvAPI_Status NvAPI_rc = (NvAPI_Status) nvapi->NvAPI_GPU_GetPerfPoliciesStatus (hPhysicalGpu, perfPolicies_status);
if (NvAPI_rc != NVAPI_OK)
{
NvAPI_ShortString string = { 0 };
hm_NvAPI_GetErrorMessage (nvapi, NvAPI_rc, string);
event_log_error (hashcat_ctx, "NvAPI_GPU_GetPerfPoliciesStatus(): %s", string);
return -1;
}
return 0;
}
int hm_NvAPI_GPU_GetBusId (void *hashcat_ctx, NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pBusId)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVAPI_PTR *nvapi = (NVAPI_PTR *) hwmon_ctx->hm_nvapi;
const NvAPI_Status NvAPI_rc = (NvAPI_Status) nvapi->NvAPI_GPU_GetBusId (hPhysicalGpu, pBusId);
if (NvAPI_rc != NVAPI_OK)
{
NvAPI_ShortString string = { 0 };
hm_NvAPI_GetErrorMessage (nvapi, NvAPI_rc, string);
event_log_error (hashcat_ctx, "NvAPI_GPU_GetBusId(): %s", string);
return -1;
}
return 0;
}
int hm_NvAPI_GPU_GetBusSlotId (void *hashcat_ctx, NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pBusSlotId)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVAPI_PTR *nvapi = (NVAPI_PTR *) hwmon_ctx->hm_nvapi;
const NvAPI_Status NvAPI_rc = (NvAPI_Status) nvapi->NvAPI_GPU_GetBusSlotId (hPhysicalGpu, pBusSlotId);
if (NvAPI_rc != NVAPI_OK)
{
NvAPI_ShortString string = { 0 };
hm_NvAPI_GetErrorMessage (nvapi, NvAPI_rc, string);
event_log_error (hashcat_ctx, "NvAPI_GPU_GetBusSlotId(): %s", string);
return -1;
}
return 0;
}

View File

@ -5,4 +5,390 @@
#include "common.h" #include "common.h"
#include "types.h" #include "types.h"
#include "memory.h"
#include "shared.h"
#include "event.h"
#include "ext_nvml.h" #include "ext_nvml.h"
#include "dynloader.h"
#if defined (__CYGWIN__)
#include <sys/cygwin.h>
#endif
int nvml_init (void *hashcat_ctx)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml;
memset (nvml, 0, sizeof (NVML_PTR));
#if defined (_WIN)
nvml->lib = hc_dlopen ("nvml.dll");
if (!nvml->lib)
{
DWORD BufferSize = 1024;
DWORD Type = REG_SZ;
char *Buffer = (char *) hcmalloc (BufferSize + 1);
HKEY hKey = 0;
if (RegOpenKeyExA (HKEY_LOCAL_MACHINE, "SOFTWARE\\NVIDIA Corporation\\Global\\NVSMI", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
{
if (RegQueryValueExA (hKey, "NVSMIPATH", NULL, &Type, (LPBYTE)Buffer, &BufferSize) == ERROR_SUCCESS)
{
Buffer[BufferSize] = 0;
}
else
{
//if (user_options->quiet == false)
// event_log_error (hashcat_ctx, "NVML library load failed. Proceeding without NVML HWMon enabled.");
return -1;
}
RegCloseKey (hKey);
}
else
{
//if (user_options->quiet == false)
// event_log_error (hashcat_ctx, "NVML library load failed. Proceeding without NVML HWMon enabled.");
return -1;
}
strcat (Buffer, "\\nvml.dll");
nvml->lib = hc_dlopen (Buffer);
hcfree (Buffer);
}
#elif defined (__CYGWIN__)
nvml->lib = hc_dlopen ("nvml.dll");
if (!nvml->lib)
{
HCFILE nvml_lib;
if (hc_fopen (&nvml_lib, "/proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/NVIDIA Corporation/Global/NVSMI/NVSMIPATH", "rb") == false)
{
//if (user_options->quiet == false)
// event_log_error (hashcat_ctx, "NVML library load failed: %m. Proceeding without NVML HWMon enabled.");
return -1;
}
char *nvml_winpath, *nvml_cygpath;
nvml_winpath = (char *) hcmalloc (100);
hc_fread (nvml_winpath, 100, 1, &nvml_lib);
hc_fclose (&nvml_lib);
ssize_t size = cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_PROC_CYGDRIVE, nvml_winpath, NULL, 0);
if (size > 0)
{
nvml_cygpath = (char *) hcmalloc (size + 9);
cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_PROC_CYGDRIVE, nvml_winpath, nvml_cygpath, size);
}
else
{
//if (user_options->quiet == false)
// event_log_error (hashcat_ctx, "Could not find NVML on this system. Proceeding without NVML HWMon enabled.");
return -1;
}
strcat (nvml_cygpath, "/nvml.dll");
nvml->lib = hc_dlopen (nvml_cygpath);
}
#elif defined (_POSIX)
nvml->lib = hc_dlopen ("libnvidia-ml.so");
if (!nvml->lib)
{
nvml->lib = hc_dlopen ("libnvidia-ml.so.1");
}
#endif
if (!nvml->lib)
{
//if (user_options->quiet == false)
// event_log_error (hashcat_ctx, "NVML library load failed. Proceeding without NVML HWMon enabled.");
return -1;
}
HC_LOAD_FUNC(nvml, nvmlErrorString, NVML_ERROR_STRING, NVML, 0);
HC_LOAD_FUNC(nvml, nvmlInit, NVML_INIT, NVML, 0);
HC_LOAD_FUNC(nvml, nvmlShutdown, NVML_SHUTDOWN, NVML, 0);
HC_LOAD_FUNC(nvml, nvmlDeviceGetCount, NVML_DEVICE_GET_COUNT, NVML, 0);
HC_LOAD_FUNC(nvml, nvmlDeviceGetName, NVML_DEVICE_GET_NAME, NVML, 0);
HC_LOAD_FUNC(nvml, nvmlDeviceGetHandleByIndex, NVML_DEVICE_GET_HANDLE_BY_INDEX, NVML, 0);
HC_LOAD_FUNC(nvml, nvmlDeviceGetTemperature, NVML_DEVICE_GET_TEMPERATURE, NVML, 0);
HC_LOAD_FUNC(nvml, nvmlDeviceGetFanSpeed, NVML_DEVICE_GET_FAN_SPEED, NVML, 0);
HC_LOAD_FUNC(nvml, nvmlDeviceGetUtilizationRates, NVML_DEVICE_GET_UTILIZATION_RATES, NVML, 0);
HC_LOAD_FUNC(nvml, nvmlDeviceGetClockInfo, NVML_DEVICE_GET_CLOCKINFO, NVML, 0);
HC_LOAD_FUNC(nvml, nvmlDeviceGetTemperatureThreshold, NVML_DEVICE_GET_THRESHOLD, NVML, 0);
HC_LOAD_FUNC(nvml, nvmlDeviceGetCurrPcieLinkGeneration, NVML_DEVICE_GET_CURRPCIELINKGENERATION, NVML, 0);
HC_LOAD_FUNC(nvml, nvmlDeviceGetCurrPcieLinkWidth, NVML_DEVICE_GET_CURRPCIELINKWIDTH, NVML, 0);
HC_LOAD_FUNC(nvml, nvmlDeviceGetCurrentClocksThrottleReasons, NVML_DEVICE_GET_CURRENTCLOCKSTHROTTLEREASONS, NVML, 0);
HC_LOAD_FUNC(nvml, nvmlDeviceGetSupportedClocksThrottleReasons, NVML_DEVICE_GET_SUPPORTEDCLOCKSTHROTTLEREASONS, NVML, 0);
HC_LOAD_FUNC(nvml, nvmlDeviceGetPciInfo, NVML_DEVICE_GET_PCIINFO, NVML, 0);
return 0;
}
void nvml_close (void *hashcat_ctx)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml;
if (nvml)
{
if (nvml->lib)
hc_dlclose (nvml->lib);
hcfree (nvml);
}
}
const char *hm_NVML_nvmlErrorString (NVML_PTR *nvml, const nvmlReturn_t nvml_rc)
{
return nvml->nvmlErrorString (nvml_rc);
}
int hm_NVML_nvmlInit (void *hashcat_ctx)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml;
const nvmlReturn_t nvml_rc = (nvmlReturn_t) nvml->nvmlInit ();
if (nvml_rc != NVML_SUCCESS && nvml_rc != NVML_ERROR_DRIVER_NOT_LOADED)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
event_log_error (hashcat_ctx, "nvmlInit(): %s", string);
return -1;
}
return 0;
}
int hm_NVML_nvmlShutdown (void *hashcat_ctx)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml;
const nvmlReturn_t nvml_rc = (nvmlReturn_t) nvml->nvmlShutdown ();
if (nvml_rc != NVML_SUCCESS && nvml_rc != NVML_ERROR_DRIVER_NOT_LOADED)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
event_log_error (hashcat_ctx, "nvmlShutdown(): %s", string);
return -1;
}
return 0;
}
int hm_NVML_nvmlDeviceGetCount (void *hashcat_ctx, unsigned int *deviceCount)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml;
const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetCount (deviceCount);
if (nvml_rc != NVML_SUCCESS && nvml_rc != NVML_ERROR_DRIVER_NOT_LOADED)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
event_log_error (hashcat_ctx, "nvmlDeviceGetCount(): %s", string);
return -1;
}
return 0;
}
int hm_NVML_nvmlDeviceGetHandleByIndex (void *hashcat_ctx, unsigned int device_index, nvmlDevice_t *device)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml;
const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetHandleByIndex (device_index, device);
if (nvml_rc != NVML_SUCCESS)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
event_log_error (hashcat_ctx, "nvmlDeviceGetHandleByIndex(): %s", string);
return -1;
}
return 0;
}
int hm_NVML_nvmlDeviceGetTemperature (void *hashcat_ctx, nvmlDevice_t device, nvmlTemperatureSensors_t sensorType, unsigned int *temp)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml;
const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetTemperature (device, sensorType, temp);
if (nvml_rc != NVML_SUCCESS)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
event_log_error (hashcat_ctx, "nvmlDeviceGetTemperature(): %s", string);
return -1;
}
return 0;
}
int hm_NVML_nvmlDeviceGetFanSpeed (void *hashcat_ctx, nvmlDevice_t device, unsigned int *speed)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml;
const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetFanSpeed (device, speed);
if (nvml_rc != NVML_SUCCESS)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
event_log_error (hashcat_ctx, "nvmlDeviceGetFanSpeed(): %s", string);
return -1;
}
return 0;
}
int hm_NVML_nvmlDeviceGetUtilizationRates (void *hashcat_ctx, nvmlDevice_t device, nvmlUtilization_t *utilization)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml;
const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetUtilizationRates (device, utilization);
if (nvml_rc != NVML_SUCCESS)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
event_log_error (hashcat_ctx, "nvmlDeviceGetUtilizationRates(): %s", string);
return -1;
}
return 0;
}
int hm_NVML_nvmlDeviceGetClockInfo (void *hashcat_ctx, nvmlDevice_t device, nvmlClockType_t type, unsigned int *clockfreq)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml;
const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetClockInfo (device, type, clockfreq);
if (nvml_rc != NVML_SUCCESS)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
event_log_error (hashcat_ctx, "nvmlDeviceGetClockInfo(): %s", string);
return -1;
}
return 0;
}
int hm_NVML_nvmlDeviceGetTemperatureThreshold (void *hashcat_ctx, nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, unsigned int *temp)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml;
const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetTemperatureThreshold (device, thresholdType, temp);
if (nvml_rc != NVML_SUCCESS)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
event_log_error (hashcat_ctx, "nvmlDeviceGetTemperatureThreshold(): %s", string);
return -1;
}
return 0;
}
int hm_NVML_nvmlDeviceGetCurrPcieLinkWidth (void *hashcat_ctx, nvmlDevice_t device, unsigned int *currLinkWidth)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml;
const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetCurrPcieLinkWidth (device, currLinkWidth);
if (nvml_rc != NVML_SUCCESS)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
event_log_error (hashcat_ctx, "nvmlDeviceGetCurrPcieLinkWidth(): %s", string);
return -1;
}
return 0;
}
int hm_NVML_nvmlDeviceGetPciInfo (void *hashcat_ctx, nvmlDevice_t device, nvmlPciInfo_t *pci)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml;
const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetPciInfo (device, pci);
if (nvml_rc != NVML_SUCCESS)
{
const char *string = hm_NVML_nvmlErrorString (nvml, nvml_rc);
event_log_error (hashcat_ctx, "nvmlDeviceGetPciInfo(): %s", string);
return -1;
}
return 0;
}

View File

@ -4,4 +4,440 @@
*/ */
#include "common.h" #include "common.h"
#include "types.h"
#include "memory.h"
#include "shared.h"
#include "event.h"
#include "folder.h"
#include "ext_sysfs.h" #include "ext_sysfs.h"
bool sysfs_init (void *hashcat_ctx)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
SYSFS_PTR *sysfs = (SYSFS_PTR *) hwmon_ctx->hm_sysfs;
memset (sysfs, 0, sizeof (SYSFS_PTR));
char *path;
hc_asprintf (&path, "%s", SYS_BUS_PCI_DEVICES);
const bool r = hc_path_read (path);
hcfree (path);
return r;
}
void sysfs_close (void *hashcat_ctx)
{
hwmon_ctx_t *hwmon_ctx = ((hashcat_ctx_t *) hashcat_ctx)->hwmon_ctx;
SYSFS_PTR *sysfs = (SYSFS_PTR *) hwmon_ctx->hm_sysfs;
if (sysfs)
{
hcfree (sysfs);
}
}
char *hm_SYSFS_get_syspath_device (void *hashcat_ctx, const int backend_device_idx)
{
backend_ctx_t *backend_ctx = ((hashcat_ctx_t *) hashcat_ctx)->backend_ctx;
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_device_idx];
char *syspath;
hc_asprintf (&syspath, "%s/0000:%02x:%02x.%01x", SYS_BUS_PCI_DEVICES, device_param->pcie_bus, device_param->pcie_device, device_param->pcie_function);
return syspath;
}
char *hm_SYSFS_get_syspath_hwmon (void *hashcat_ctx, const int backend_device_idx)
{
char *syspath = hm_SYSFS_get_syspath_device (hashcat_ctx, backend_device_idx);
if (syspath == NULL)
{
event_log_error (hashcat_ctx, "hm_SYSFS_get_syspath_device() failed.");
return NULL;
}
char *hwmon = (char *) hcmalloc (HCBUFSIZ_TINY);
snprintf (hwmon, HCBUFSIZ_TINY, "%s/hwmon", syspath);
char *hwmonN = first_file_in_directory (hwmon);
if (hwmonN == NULL)
{
event_log_error (hashcat_ctx, "First_file_in_directory() failed.");
hcfree (syspath);
hcfree (hwmon);
hcfree (hwmonN);
return NULL;
}
snprintf (hwmon, HCBUFSIZ_TINY, "%s/hwmon/%s", syspath, hwmonN);
hcfree (syspath);
hcfree (hwmonN);
return hwmon;
}
int hm_SYSFS_get_fan_speed_current (void *hashcat_ctx, const int backend_device_idx, int *val)
{
char *syspath = hm_SYSFS_get_syspath_hwmon (hashcat_ctx, backend_device_idx);
if (syspath == NULL) return -1;
char *path_cur;
char *path_max;
hc_asprintf (&path_cur, "%s/pwm1", syspath);
hc_asprintf (&path_max, "%s/pwm1_max", syspath);
hcfree (syspath);
HCFILE fp_cur;
if (hc_fopen (&fp_cur, path_cur, "r") == false)
{
event_log_error (hashcat_ctx, "%s: %s", path_cur, strerror (errno));
hcfree (path_cur);
hcfree (path_max);
return -1;
}
int pwm1_cur = 0;
if (hc_fscanf (&fp_cur, "%d", &pwm1_cur) != 1)
{
hc_fclose (&fp_cur);
event_log_error (hashcat_ctx, "%s: unexpected data.", path_cur);
hcfree (path_cur);
hcfree (path_max);
return -1;
}
hc_fclose (&fp_cur);
HCFILE fp_max;
if (hc_fopen (&fp_max, path_max, "r") == false)
{
event_log_error (hashcat_ctx, "%s: %s", path_max, strerror (errno));
hcfree (path_cur);
hcfree (path_max);
return -1;
}
int pwm1_max = 0;
if (hc_fscanf (&fp_max, "%d", &pwm1_max) != 1)
{
hc_fclose (&fp_max);
event_log_error (hashcat_ctx, "%s: unexpected data.", path_max);
hcfree (path_cur);
hcfree (path_max);
return -1;
}
hc_fclose (&fp_max);
if (pwm1_max == 0)
{
event_log_error (hashcat_ctx, "%s: pwm1_max cannot be 0.", path_max);
hcfree (path_cur);
hcfree (path_max);
return -1;
}
const float p1 = (float) pwm1_max / 100.0F;
const float pwm1_percent = (float) pwm1_cur / p1;
*val = (int) pwm1_percent;
hcfree (path_cur);
hcfree (path_max);
return 0;
}
int hm_SYSFS_get_temperature_current (void *hashcat_ctx, const int backend_device_idx, int *val)
{
char *syspath = hm_SYSFS_get_syspath_hwmon (hashcat_ctx, backend_device_idx);
if (syspath == NULL) return -1;
char *path;
hc_asprintf (&path, "%s/temp1_input", syspath);
hcfree (syspath);
HCFILE fp;
if (hc_fopen (&fp, path, "r") == false)
{
event_log_error (hashcat_ctx, "%s: %s", path, strerror (errno));
hcfree (path);
return -1;
}
int temperature = 0;
if (hc_fscanf (&fp, "%d", &temperature) != 1)
{
hc_fclose (&fp);
event_log_error (hashcat_ctx, "%s: unexpected data.", path);
hcfree (path);
return -1;
}
hc_fclose (&fp);
*val = temperature / 1000;
hcfree (path);
return 0;
}
int hm_SYSFS_get_pp_dpm_sclk (void *hashcat_ctx, const int backend_device_idx, int *val)
{
char *syspath = hm_SYSFS_get_syspath_device (hashcat_ctx, backend_device_idx);
if (syspath == NULL) return -1;
char *path;
hc_asprintf (&path, "%s/pp_dpm_sclk", syspath);
hcfree (syspath);
HCFILE fp;
if (hc_fopen (&fp, path, "r") == false)
{
event_log_error (hashcat_ctx, "%s: %s", path, strerror (errno));
hcfree (path);
return -1;
}
int clockfreq = 0;
while (!hc_feof (&fp))
{
char buf[HCBUFSIZ_TINY] = { 0 };
char *ptr = hc_fgets (buf, sizeof (buf), &fp);
if (ptr == NULL) continue;
size_t len = strlen (ptr);
if (len < 2) continue;
if (ptr[len - 2] != '*') continue;
int profile = 0;
int rc = sscanf (ptr, "%d: %dMHz", &profile, &clockfreq);
if (rc == 2) break;
}
hc_fclose (&fp);
*val = clockfreq;
hcfree (path);
return 0;
}
int hm_SYSFS_get_pp_dpm_mclk (void *hashcat_ctx, const int backend_device_idx, int *val)
{
char *syspath = hm_SYSFS_get_syspath_device (hashcat_ctx, backend_device_idx);
if (syspath == NULL) return -1;
char *path;
hc_asprintf (&path, "%s/pp_dpm_mclk", syspath);
hcfree (syspath);
HCFILE fp;
if (hc_fopen (&fp, path, "r") == false)
{
event_log_error (hashcat_ctx, "%s: %s", path, strerror (errno));
hcfree (path);
return -1;
}
int clockfreq = 0;
while (!hc_feof (&fp))
{
char buf[HCBUFSIZ_TINY];
char *ptr = hc_fgets (buf, sizeof (buf), &fp);
if (ptr == NULL) continue;
size_t len = strlen (ptr);
if (len < 2) continue;
if (ptr[len - 2] != '*') continue;
int profile = 0;
int rc = sscanf (ptr, "%d: %dMHz", &profile, &clockfreq);
if (rc == 2) break;
}
hc_fclose (&fp);
*val = clockfreq;
hcfree (path);
return 0;
}
int hm_SYSFS_get_pp_dpm_pcie (void *hashcat_ctx, const int backend_device_idx, int *val)
{
char *syspath = hm_SYSFS_get_syspath_device (hashcat_ctx, backend_device_idx);
if (syspath == NULL) return -1;
char *path;
hc_asprintf (&path, "%s/current_link_width", syspath);
hcfree (syspath);
HCFILE fp;
if (hc_fopen (&fp, path, "r") == false)
{
event_log_error (hashcat_ctx, "%s: %s", path, strerror (errno));
hcfree (path);
return -1;
}
int lanes = 0;
while (!hc_feof (&fp))
{
char buf[HCBUFSIZ_TINY];
char *ptr = hc_fgets (buf, sizeof (buf), &fp);
if (ptr == NULL) continue;
size_t len = strlen (ptr);
if (len < 2) continue;
int rc = sscanf (ptr, "%d", &lanes);
if (rc == 1) break;
}
hc_fclose (&fp);
*val = lanes;
hcfree (path);
return 0;
}
int hm_SYSFS_get_gpu_busy_percent (void *hashcat_ctx, const int backend_device_idx, int *val)
{
char *syspath = hm_SYSFS_get_syspath_device (hashcat_ctx, backend_device_idx);
if (syspath == NULL) return -1;
char *path;
hc_asprintf (&path, "%s/gpu_busy_percent", syspath);
hcfree (syspath);
HCFILE fp;
if (hc_fopen (&fp, path, "r") == false)
{
event_log_error (hashcat_ctx, "%s: %s", path, strerror (errno));
hcfree (path);
return -1;
}
int util = 0;
while (!hc_feof (&fp))
{
char buf[HCBUFSIZ_TINY];
char *ptr = hc_fgets (buf, sizeof (buf), &fp);
if (ptr == NULL) continue;
size_t len = strlen (ptr);
if (len < 1) continue;
int rc = sscanf (ptr, "%d", &util);
if (rc == 1) break;
}
hc_fclose (&fp);
*val = util;
hcfree (path);
return 0;
}

View File

@ -1271,6 +1271,8 @@ bool autodetect_hashmode_test (hashcat_ctx_t *hashcat_ctx)
{ {
HCFILE fp; HCFILE fp;
int error_count = 0;
if (hc_fopen (&fp, hashfile, "rb") == false) return false; if (hc_fopen (&fp, hashfile, "rb") == false) return false;
char *line_buf = (char *) hcmalloc (HCBUFSIZ_LARGE); char *line_buf = (char *) hcmalloc (HCBUFSIZ_LARGE);
@ -1301,6 +1303,17 @@ bool autodetect_hashmode_test (hashcat_ctx_t *hashcat_ctx)
break; break;
} }
// abort this list after 100 errors
if (error_count == 100)
{
break;
}
else
{
error_count++;
}
} }
hcfree (line_buf); hcfree (line_buf);
@ -1463,43 +1476,87 @@ int hashcat_session_execute (hashcat_ctx_t *hashcat_ctx)
} }
if (modes_cnt > 1) if (modes_cnt > 1)
{
if (user_options->machine_readable == false)
{ {
event_log_info (hashcat_ctx, "The following %d hash-modes match the structure of your input hash:", modes_cnt); event_log_info (hashcat_ctx, "The following %d hash-modes match the structure of your input hash:", modes_cnt);
event_log_info (hashcat_ctx, NULL); event_log_info (hashcat_ctx, NULL);
event_log_info (hashcat_ctx, " # | Name | Category"); event_log_info (hashcat_ctx, " # | Name | Category");
event_log_info (hashcat_ctx, " ======+=====================================================+======================================"); event_log_info (hashcat_ctx, " ======+=====================================================+======================================");
}
for (int i = 0; i < modes_cnt; i++) for (int i = 0; i < modes_cnt; i++)
{
if (user_options->machine_readable == false)
{ {
event_log_info (hashcat_ctx, "%7u | %-51s | %s", usage_sort_buf[i].hash_mode, usage_sort_buf[i].hash_name, strhashcategory (usage_sort_buf[i].hash_category)); event_log_info (hashcat_ctx, "%7u | %-51s | %s", usage_sort_buf[i].hash_mode, usage_sort_buf[i].hash_name, strhashcategory (usage_sort_buf[i].hash_category));
}
else
{
event_log_info (hashcat_ctx, "%u", usage_sort_buf[i].hash_mode);
}
hcfree (usage_sort_buf[i].hash_name); hcfree (usage_sort_buf[i].hash_name);
} }
event_log_info (hashcat_ctx, NULL);
event_log_error (hashcat_ctx, "Please specify the hash-mode with -m [hash-mode].");
hcfree (usage_sort_buf); hcfree (usage_sort_buf);
if (user_options->machine_readable == false) event_log_info (hashcat_ctx, NULL);
if (user_options->identify == false)
{
event_log_error (hashcat_ctx, "Please specify the hash-mode with -m [hash-mode].");
return -1; return -1;
} }
return 0;
}
// modes_cnt == 1 // modes_cnt == 1
if (user_options->identify == false)
{
event_log_warning (hashcat_ctx, "Hash-mode was not specified with -m. Attempting to auto-detect hash mode."); event_log_warning (hashcat_ctx, "Hash-mode was not specified with -m. Attempting to auto-detect hash mode.");
event_log_warning (hashcat_ctx, "The following mode was auto-detected as the only one matching your input hash:"); event_log_warning (hashcat_ctx, "The following mode was auto-detected as the only one matching your input hash:");
event_log_warning (hashcat_ctx, "\n%u | %s | %s\n", usage_sort_buf[0].hash_mode, usage_sort_buf[0].hash_name, strhashcategory (usage_sort_buf[0].hash_category)); }
if (user_options->identify == true)
{
if (user_options->machine_readable == true)
{
event_log_info (hashcat_ctx, "%u", usage_sort_buf[0].hash_mode);
}
else
{
event_log_info (hashcat_ctx, "The following hash-mode match the structure of your input hash:");
event_log_info (hashcat_ctx, NULL);
event_log_info (hashcat_ctx, " # | Name | Category");
event_log_info (hashcat_ctx, " ======+=====================================================+======================================");
event_log_info (hashcat_ctx, "%7u | %-51s | %s", usage_sort_buf[0].hash_mode, usage_sort_buf[0].hash_name, strhashcategory (usage_sort_buf[0].hash_category));
event_log_info (hashcat_ctx, NULL);
}
}
else
{
event_log_info (hashcat_ctx, "\n%u | %s | %s\n", usage_sort_buf[0].hash_mode, usage_sort_buf[0].hash_name, strhashcategory (usage_sort_buf[0].hash_category));
}
if (user_options->identify == false)
{
event_log_warning (hashcat_ctx, "NOTE: Auto-detect is best effort. The correct hash-mode is NOT guaranteed!"); event_log_warning (hashcat_ctx, "NOTE: Auto-detect is best effort. The correct hash-mode is NOT guaranteed!");
event_log_warning (hashcat_ctx, "Do NOT report auto-detect issues unless you are certain of the hash type."); event_log_warning (hashcat_ctx, "Do NOT report auto-detect issues unless you are certain of the hash type.");
event_log_warning (hashcat_ctx, NULL); event_log_warning (hashcat_ctx, NULL);
}
user_options->autodetect = false;
user_options->hash_mode = usage_sort_buf[0].hash_mode; user_options->hash_mode = usage_sort_buf[0].hash_mode;
hcfree (usage_sort_buf[0].hash_name); hcfree (usage_sort_buf[0].hash_name);
hcfree (usage_sort_buf); hcfree (usage_sort_buf);
if (user_options->identify == true) return 0;
user_options->autodetect = false;
} }
/** /**
@ -1731,6 +1788,8 @@ int hashcat_get_status (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_st
#ifdef WITH_BRAIN #ifdef WITH_BRAIN
hashcat_status->brain_session = status_get_brain_session (hashcat_ctx); hashcat_status->brain_session = status_get_brain_session (hashcat_ctx);
hashcat_status->brain_attack = status_get_brain_attack (hashcat_ctx); hashcat_status->brain_attack = status_get_brain_attack (hashcat_ctx);
hashcat_status->brain_rx_all = status_get_brain_rx_all (hashcat_ctx);
hashcat_status->brain_tx_all = status_get_brain_tx_all (hashcat_ctx);
#endif #endif
hashcat_status->status_string = status_get_status_string (hashcat_ctx); hashcat_status->status_string = status_get_status_string (hashcat_ctx);
hashcat_status->status_number = status_get_status_number (hashcat_ctx); hashcat_status->status_number = status_get_status_number (hashcat_ctx);
@ -1762,6 +1821,9 @@ int hashcat_get_status (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_st
device_info->exec_msec_dev = status_get_exec_msec_dev (hashcat_ctx, device_id); device_info->exec_msec_dev = status_get_exec_msec_dev (hashcat_ctx, device_id);
device_info->speed_sec_dev = status_get_speed_sec_dev (hashcat_ctx, device_id); device_info->speed_sec_dev = status_get_speed_sec_dev (hashcat_ctx, device_id);
device_info->guess_candidates_dev = status_get_guess_candidates_dev (hashcat_ctx, device_id); device_info->guess_candidates_dev = status_get_guess_candidates_dev (hashcat_ctx, device_id);
#if defined(__APPLE__)
device_info->hwmon_fan_dev = status_get_hwmon_fan_dev (hashcat_ctx);
#endif
device_info->hwmon_dev = status_get_hwmon_dev (hashcat_ctx, device_id); device_info->hwmon_dev = status_get_hwmon_dev (hashcat_ctx, device_id);
device_info->corespeed_dev = status_get_corespeed_dev (hashcat_ctx, device_id); device_info->corespeed_dev = status_get_corespeed_dev (hashcat_ctx, device_id);
device_info->memoryspeed_dev = status_get_memoryspeed_dev (hashcat_ctx, device_id); device_info->memoryspeed_dev = status_get_memoryspeed_dev (hashcat_ctx, device_id);
@ -1783,8 +1845,6 @@ int hashcat_get_status (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_st
device_info->brain_link_send_bytes_dev = status_get_brain_link_send_bytes_dev (hashcat_ctx, device_id); device_info->brain_link_send_bytes_dev = status_get_brain_link_send_bytes_dev (hashcat_ctx, device_id);
device_info->brain_link_recv_bytes_sec_dev = status_get_brain_link_recv_bytes_sec_dev (hashcat_ctx, device_id); device_info->brain_link_recv_bytes_sec_dev = status_get_brain_link_recv_bytes_sec_dev (hashcat_ctx, device_id);
device_info->brain_link_send_bytes_sec_dev = status_get_brain_link_send_bytes_sec_dev (hashcat_ctx, device_id); device_info->brain_link_send_bytes_sec_dev = status_get_brain_link_send_bytes_sec_dev (hashcat_ctx, device_id);
hashcat_status->brain_rx_all = status_get_brain_rx_all (hashcat_ctx);
hashcat_status->brain_tx_all = status_get_brain_tx_all (hashcat_ctx);
#endif #endif
} }

File diff suppressed because it is too large Load Diff

View File

@ -50,6 +50,7 @@ int induct_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->progress_only == true) return 0; if (user_options->progress_only == true) return 0;
if (user_options->usage == true) return 0; if (user_options->usage == true) return 0;
if (user_options->version == true) return 0; if (user_options->version == true) return 0;
if (user_options->identify == true) return 0;
if ((user_options->attack_mode != ATTACK_MODE_STRAIGHT) if ((user_options->attack_mode != ATTACK_MODE_STRAIGHT)
&& (user_options->attack_mode != ATTACK_MODE_ASSOCIATION)) return 0; && (user_options->attack_mode != ATTACK_MODE_ASSOCIATION)) return 0;

View File

@ -71,6 +71,7 @@ int loopback_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->progress_only == true) return 0; if (user_options->progress_only == true) return 0;
if (user_options->usage == true) return 0; if (user_options->usage == true) return 0;
if (user_options->version == true) return 0; if (user_options->version == true) return 0;
if (user_options->identify == true) return 0;
loopback_ctx->enabled = true; loopback_ctx->enabled = true;
loopback_ctx->fp.pfp = NULL; loopback_ctx->fp.pfp = NULL;

View File

@ -189,6 +189,7 @@ static void main_outerloop_starting (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MA
if (user_options->stdout_flag == true) return; if (user_options->stdout_flag == true) return;
if (user_options->backend_info == true) return; if (user_options->backend_info == true) return;
if (user_options->speed_only == true) return; if (user_options->speed_only == true) return;
if (user_options->identify == true) return;
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK)) if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
{ {

View File

@ -59,7 +59,9 @@ typedef struct tc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -204,13 +206,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
if (hc_path_read (keyfile)) if (hc_path_read (keyfile))
{ {
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf16, 64);
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf32, 128);
} }
keyfile = strtok_r ((char *) NULL, ",", &saveptr); keyfile = strtok_r ((char *) NULL, ",", &saveptr);
} }
hcfree (keyfiles); hcfree (keyfiles);
tc->keyfile_enabled = 1;
} }
// keyboard layout mapping // keyboard layout mapping

View File

@ -59,7 +59,9 @@ typedef struct tc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -204,13 +206,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
if (hc_path_read (keyfile)) if (hc_path_read (keyfile))
{ {
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf16, 64);
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf32, 128);
} }
keyfile = strtok_r ((char *) NULL, ",", &saveptr); keyfile = strtok_r ((char *) NULL, ",", &saveptr);
} }
hcfree (keyfiles); hcfree (keyfiles);
tc->keyfile_enabled = 1;
} }
// keyboard layout mapping // keyboard layout mapping

View File

@ -59,7 +59,9 @@ typedef struct tc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -202,13 +204,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
if (hc_path_read (keyfile)) if (hc_path_read (keyfile))
{ {
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf16, 64);
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf32, 128);
} }
keyfile = strtok_r ((char *) NULL, ",", &saveptr); keyfile = strtok_r ((char *) NULL, ",", &saveptr);
} }
hcfree (keyfiles); hcfree (keyfiles);
tc->keyfile_enabled = 1;
} }
// keyboard layout mapping // keyboard layout mapping

View File

@ -60,7 +60,9 @@ typedef struct tc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -138,8 +140,6 @@ int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash
const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2);
hcfree (tmpdata); hcfree (tmpdata);
return parser_status; return parser_status;
@ -189,13 +189,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
if (hc_path_read (keyfile)) if (hc_path_read (keyfile))
{ {
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf16, 64);
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf32, 128);
} }
keyfile = strtok_r ((char *) NULL, ",", &saveptr); keyfile = strtok_r ((char *) NULL, ",", &saveptr);
} }
hcfree (keyfiles); hcfree (keyfiles);
tc->keyfile_enabled = 1;
} }
// keyboard layout mapping // keyboard layout mapping

View File

@ -60,7 +60,9 @@ typedef struct tc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -138,8 +140,6 @@ int module_hash_init_selftest (MAYBE_UNUSED const hashconfig_t *hashconfig, hash
const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2); const int parser_status = module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, tmpdata, st_hash_len / 2);
hcfree (tmpdata); hcfree (tmpdata);
return parser_status; return parser_status;
@ -189,13 +189,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
if (hc_path_read (keyfile)) if (hc_path_read (keyfile))
{ {
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf16, 64);
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf32, 128);
} }
keyfile = strtok_r ((char *) NULL, ",", &saveptr); keyfile = strtok_r ((char *) NULL, ",", &saveptr);
} }
hcfree (keyfiles); hcfree (keyfiles);
tc->keyfile_enabled = 1;
} }
// keyboard layout mapping // keyboard layout mapping

View File

@ -60,7 +60,9 @@ typedef struct tc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -187,13 +189,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
if (hc_path_read (keyfile)) if (hc_path_read (keyfile))
{ {
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf16, 64);
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf32, 128);
} }
keyfile = strtok_r ((char *) NULL, ",", &saveptr); keyfile = strtok_r ((char *) NULL, ",", &saveptr);
} }
hcfree (keyfiles); hcfree (keyfiles);
tc->keyfile_enabled = 1;
} }
// keyboard layout mapping // keyboard layout mapping

View File

@ -59,7 +59,9 @@ typedef struct tc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -197,13 +199,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
if (hc_path_read (keyfile)) if (hc_path_read (keyfile))
{ {
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf16, 64);
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf32, 128);
} }
keyfile = strtok_r ((char *) NULL, ",", &saveptr); keyfile = strtok_r ((char *) NULL, ",", &saveptr);
} }
hcfree (keyfiles); hcfree (keyfiles);
tc->keyfile_enabled = 1;
} }
// keyboard layout mapping // keyboard layout mapping

View File

@ -59,7 +59,9 @@ typedef struct tc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -197,13 +199,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
if (hc_path_read (keyfile)) if (hc_path_read (keyfile))
{ {
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf16, 64);
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf32, 128);
} }
keyfile = strtok_r ((char *) NULL, ",", &saveptr); keyfile = strtok_r ((char *) NULL, ",", &saveptr);
} }
hcfree (keyfiles); hcfree (keyfiles);
tc->keyfile_enabled = 1;
} }
// keyboard layout mapping // keyboard layout mapping

View File

@ -59,7 +59,9 @@ typedef struct tc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -193,13 +195,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
if (hc_path_read (keyfile)) if (hc_path_read (keyfile))
{ {
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf16, 64);
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf32, 128);
} }
keyfile = strtok_r ((char *) NULL, ",", &saveptr); keyfile = strtok_r ((char *) NULL, ",", &saveptr);
} }
hcfree (keyfiles); hcfree (keyfiles);
tc->keyfile_enabled = 1;
} }
// keyboard layout mapping // keyboard layout mapping

View File

@ -60,7 +60,9 @@ typedef struct tc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -198,13 +200,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
if (hc_path_read (keyfile)) if (hc_path_read (keyfile))
{ {
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf16, 64);
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf32, 128);
} }
keyfile = strtok_r ((char *) NULL, ",", &saveptr); keyfile = strtok_r ((char *) NULL, ",", &saveptr);
} }
hcfree (keyfiles); hcfree (keyfiles);
tc->keyfile_enabled = 1;
} }
// keyboard layout mapping // keyboard layout mapping

View File

@ -60,7 +60,9 @@ typedef struct tc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -198,13 +200,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
if (hc_path_read (keyfile)) if (hc_path_read (keyfile))
{ {
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf16, 64);
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf32, 128);
} }
keyfile = strtok_r ((char *) NULL, ",", &saveptr); keyfile = strtok_r ((char *) NULL, ",", &saveptr);
} }
hcfree (keyfiles); hcfree (keyfiles);
tc->keyfile_enabled = 1;
} }
// keyboard layout mapping // keyboard layout mapping

View File

@ -60,7 +60,9 @@ typedef struct tc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -198,13 +200,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
if (hc_path_read (keyfile)) if (hc_path_read (keyfile))
{ {
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf); cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf16, 64);
cpu_crc32 (keyfile, (u8 *) tc->keyfile_buf32, 128);
} }
keyfile = strtok_r ((char *) NULL, ",", &saveptr); keyfile = strtok_r ((char *) NULL, ",", &saveptr);
} }
hcfree (keyfiles); hcfree (keyfiles);
tc->keyfile_enabled = 1;
} }
// keyboard layout mapping // keyboard layout mapping

View File

@ -243,7 +243,7 @@ void module_init (module_ctx_t *module_ctx)
module_ctx->module_potfile_disable = MODULE_DEFAULT; module_ctx->module_potfile_disable = MODULE_DEFAULT;
module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT;
module_ctx->module_pwdump_column = MODULE_DEFAULT; module_ctx->module_pwdump_column = MODULE_DEFAULT;
module_ctx->module_pw_max = MODULE_DEFAULT; module_ctx->module_pw_max = module_pw_max;
module_ctx->module_pw_min = MODULE_DEFAULT; module_ctx->module_pw_min = MODULE_DEFAULT;
module_ctx->module_salt_max = MODULE_DEFAULT; module_ctx->module_salt_max = MODULE_DEFAULT;
module_ctx->module_salt_min = MODULE_DEFAULT; module_ctx->module_salt_min = MODULE_DEFAULT;

View File

@ -413,7 +413,7 @@ void module_init (module_ctx_t *module_ctx)
module_ctx->module_potfile_disable = MODULE_DEFAULT; module_ctx->module_potfile_disable = MODULE_DEFAULT;
module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT;
module_ctx->module_pwdump_column = MODULE_DEFAULT; module_ctx->module_pwdump_column = MODULE_DEFAULT;
module_ctx->module_pw_max = MODULE_DEFAULT; module_ctx->module_pw_max = module_pw_max;
module_ctx->module_pw_min = MODULE_DEFAULT; module_ctx->module_pw_min = MODULE_DEFAULT;
module_ctx->module_salt_max = MODULE_DEFAULT; module_ctx->module_salt_max = MODULE_DEFAULT;
module_ctx->module_salt_min = MODULE_DEFAULT; module_ctx->module_salt_min = MODULE_DEFAULT;

View File

@ -458,7 +458,7 @@ void module_init (module_ctx_t *module_ctx)
module_ctx->module_potfile_disable = MODULE_DEFAULT; module_ctx->module_potfile_disable = MODULE_DEFAULT;
module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT;
module_ctx->module_pwdump_column = MODULE_DEFAULT; module_ctx->module_pwdump_column = MODULE_DEFAULT;
module_ctx->module_pw_max = MODULE_DEFAULT; module_ctx->module_pw_max = module_pw_max;
module_ctx->module_pw_min = MODULE_DEFAULT; module_ctx->module_pw_min = MODULE_DEFAULT;
module_ctx->module_salt_max = MODULE_DEFAULT; module_ctx->module_salt_max = MODULE_DEFAULT;
module_ctx->module_salt_min = MODULE_DEFAULT; module_ctx->module_salt_min = MODULE_DEFAULT;

View File

@ -219,7 +219,7 @@ void module_init (module_ctx_t *module_ctx)
module_ctx->module_potfile_disable = MODULE_DEFAULT; module_ctx->module_potfile_disable = MODULE_DEFAULT;
module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT;
module_ctx->module_pwdump_column = MODULE_DEFAULT; module_ctx->module_pwdump_column = MODULE_DEFAULT;
module_ctx->module_pw_max = MODULE_DEFAULT; module_ctx->module_pw_max = module_pw_max;
module_ctx->module_pw_min = MODULE_DEFAULT; module_ctx->module_pw_min = MODULE_DEFAULT;
module_ctx->module_salt_max = MODULE_DEFAULT; module_ctx->module_salt_max = MODULE_DEFAULT;
module_ctx->module_salt_min = MODULE_DEFAULT; module_ctx->module_salt_min = MODULE_DEFAULT;

View File

@ -243,11 +243,6 @@ u64 module_extra_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UN
return tmp_size; return tmp_size;
} }
bool module_jit_cache_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param)
{
return true;
}
bool module_warmup_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) bool module_warmup_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
{ {
return true; return true;
@ -438,7 +433,7 @@ void module_init (module_ctx_t *module_ctx)
module_ctx->module_hook_salt_size = MODULE_DEFAULT; module_ctx->module_hook_salt_size = MODULE_DEFAULT;
module_ctx->module_hook_size = MODULE_DEFAULT; module_ctx->module_hook_size = MODULE_DEFAULT;
module_ctx->module_jit_build_options = module_jit_build_options; module_ctx->module_jit_build_options = module_jit_build_options;
module_ctx->module_jit_cache_disable = module_jit_cache_disable; module_ctx->module_jit_cache_disable = MODULE_DEFAULT;
module_ctx->module_kernel_accel_max = MODULE_DEFAULT; module_ctx->module_kernel_accel_max = MODULE_DEFAULT;
module_ctx->module_kernel_accel_min = MODULE_DEFAULT; module_ctx->module_kernel_accel_min = MODULE_DEFAULT;
module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_max = module_kernel_loops_max;

View File

@ -235,11 +235,6 @@ u64 module_extra_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UN
return tmp_size; return tmp_size;
} }
bool module_jit_cache_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param)
{
return true;
}
bool module_warmup_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) bool module_warmup_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
{ {
return true; return true;
@ -395,7 +390,7 @@ void module_init (module_ctx_t *module_ctx)
module_ctx->module_hook_salt_size = MODULE_DEFAULT; module_ctx->module_hook_salt_size = MODULE_DEFAULT;
module_ctx->module_hook_size = MODULE_DEFAULT; module_ctx->module_hook_size = MODULE_DEFAULT;
module_ctx->module_jit_build_options = module_jit_build_options; module_ctx->module_jit_build_options = module_jit_build_options;
module_ctx->module_jit_cache_disable = module_jit_cache_disable; module_ctx->module_jit_cache_disable = MODULE_DEFAULT;
module_ctx->module_kernel_accel_max = MODULE_DEFAULT; module_ctx->module_kernel_accel_max = MODULE_DEFAULT;
module_ctx->module_kernel_accel_min = MODULE_DEFAULT; module_ctx->module_kernel_accel_min = MODULE_DEFAULT;
module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_max = module_kernel_loops_max;

View File

@ -65,7 +65,9 @@ typedef struct vc
{ {
u32 salt_buf[32]; u32 salt_buf[32];
u32 data_buf[112]; u32 data_buf[112];
u32 keyfile_buf[16]; u32 keyfile_buf16[16];
u32 keyfile_buf32[32];
u32 keyfile_enabled;
u32 signature; u32 signature;
keyboard_layout_mapping_t keyboard_layout_mapping_buf[256]; keyboard_layout_mapping_t keyboard_layout_mapping_buf[256];
@ -145,7 +147,7 @@ u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED con
// this overrides the reductions of PW_MAX in case optimized kernel is selected // this overrides the reductions of PW_MAX in case optimized kernel is selected
// IOW, even in optimized kernel mode it support length 64 // IOW, even in optimized kernel mode it support length 64
const u32 pw_max = 64; const u32 pw_max = 64; // VC nowadays support 128, but RipeMD160 for container were removed before update from 64->128
return pw_max; return pw_max;
} }
@ -214,13 +216,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
if (hc_path_read (keyfile)) if (hc_path_read (keyfile))
{ {
cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf); cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf16, 64);
cpu_crc32 (keyfile, (u8 *) vc->keyfile_buf32, 128);
} }
keyfile = strtok_r ((char *) NULL, ",", &saveptr); keyfile = strtok_r ((char *) NULL, ",", &saveptr);
} }
hcfree (keyfiles); hcfree (keyfiles);
vc->keyfile_enabled = 1;
} }
// keyboard layout mapping // keyboard layout mapping

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