1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-29 19:38:18 +00:00

Cleanup -m 131xx kernels to latest standard

This commit is contained in:
Jens Steube 2016-04-18 16:52:11 +02:00
parent 3066fbf00d
commit 23efa03209
3 changed files with 150 additions and 220 deletions

View File

@ -8,6 +8,9 @@
#define _KRB5TGS_ #define _KRB5TGS_
//too much register pressure
//#define NEW_SIMD_CODE
#include "include/constants.h" #include "include/constants.h"
#include "include/kernel_vendor.h" #include "include/kernel_vendor.h"
@ -21,6 +24,7 @@
#include "OpenCL/common.c" #include "OpenCL/common.c"
#include "include/rp_kernel.h" #include "include/rp_kernel.h"
#include "OpenCL/rp.c" #include "OpenCL/rp.c"
#include "OpenCL/simd.c"
typedef struct typedef struct
{ {
@ -784,8 +788,6 @@ __kernel void m13100_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
* modifier * modifier
*/ */
__local RC4_KEY rc4_keys[64];
const u32 lid = get_local_id (0); const u32 lid = get_local_id (0);
const u32 gid = get_global_id (0); const u32 gid = get_global_id (0);
@ -811,6 +813,12 @@ __kernel void m13100_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
const u32 pw_len = pws[gid].pw_len; const u32 pw_len = pws[gid].pw_len;
/**
* shared
*/
__local RC4_KEY rc4_keys[64];
/** /**
* salt * salt
*/ */
@ -826,37 +834,14 @@ __kernel void m13100_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
* loop * loop
*/ */
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{ {
u32 w0[4]; u32x w0[4] = { 0 };
u32x w1[4] = { 0 };
u32x w2[4] = { 0 };
u32x w3[4] = { 0 };
w0[0] = pw_buf0[0]; const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
w0[1] = pw_buf0[1];
w0[2] = pw_buf0[2];
w0[3] = pw_buf0[3];
u32 w1[4];
w1[0] = pw_buf1[0];
w1[1] = pw_buf1[1];
w1[2] = pw_buf1[2];
w1[3] = pw_buf1[3];
u32 w2[4];
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
u32 w3[4];
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = 0;
const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
/** /**
* kerberos * kerberos
@ -866,7 +851,7 @@ __kernel void m13100_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
u32 K2[4]; u32 K2[4];
kerb_prepare (w0, w1, pw_len, checksum, digest, K2); kerb_prepare (w0, w1, out_len, checksum, digest, K2);
u32 tmp[4]; u32 tmp[4];
@ -898,8 +883,6 @@ __kernel void m13100_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
* modifier * modifier
*/ */
__local RC4_KEY rc4_keys[64];
const u32 lid = get_local_id (0); const u32 lid = get_local_id (0);
const u32 gid = get_global_id (0); const u32 gid = get_global_id (0);
@ -925,6 +908,12 @@ __kernel void m13100_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
const u32 pw_len = pws[gid].pw_len; const u32 pw_len = pws[gid].pw_len;
/**
* shared
*/
__local RC4_KEY rc4_keys[64];
/** /**
* salt * salt
*/ */
@ -940,37 +929,14 @@ __kernel void m13100_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
* loop * loop
*/ */
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{ {
u32 w0[4]; u32x w0[4] = { 0 };
u32x w1[4] = { 0 };
u32x w2[4] = { 0 };
u32x w3[4] = { 0 };
w0[0] = pw_buf0[0]; const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
w0[1] = pw_buf0[1];
w0[2] = pw_buf0[2];
w0[3] = pw_buf0[3];
u32 w1[4];
w1[0] = pw_buf1[0];
w1[1] = pw_buf1[1];
w1[2] = pw_buf1[2];
w1[3] = pw_buf1[3];
u32 w2[4];
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
u32 w3[4];
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = 0;
const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
/** /**
* kerberos * kerberos
@ -980,7 +946,7 @@ __kernel void m13100_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
u32 K2[4]; u32 K2[4];
kerb_prepare (w0, w1, pw_len, checksum, digest, K2); kerb_prepare (w0, w1, out_len, checksum, digest, K2);
u32 tmp[4]; u32 tmp[4];

View File

@ -8,6 +8,9 @@
#define _KRB5TGS_ #define _KRB5TGS_
//too much register pressure
//#define NEW_SIMD_CODE
#include "include/constants.h" #include "include/constants.h"
#include "include/kernel_vendor.h" #include "include/kernel_vendor.h"
@ -19,6 +22,7 @@
#include "include/kernel_functions.c" #include "include/kernel_functions.c"
#include "OpenCL/types_ocl.c" #include "OpenCL/types_ocl.c"
#include "OpenCL/common.c" #include "OpenCL/common.c"
#include "OpenCL/simd.c"
typedef struct typedef struct
{ {
@ -728,51 +732,35 @@ __kernel void m13100_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
* modifier * modifier
*/ */
__local RC4_KEY rc4_keys[64];
const u32 gid = get_global_id (0);
const u32 lid = get_local_id (0); const u32 lid = get_local_id (0);
if (gid >= gid_max) return;
/** /**
* base * base
*/ */
u32 wordl0[4]; const u32 gid = get_global_id (0);
wordl0[0] = pws[gid].i[ 0]; if (gid >= gid_max) return;
wordl0[1] = pws[gid].i[ 1];
wordl0[2] = pws[gid].i[ 2];
wordl0[3] = pws[gid].i[ 3];
u32 wordl1[4]; u32 pw_buf0[4];
u32 pw_buf1[4];
wordl1[0] = pws[gid].i[ 4]; pw_buf0[0] = pws[gid].i[0];
wordl1[1] = pws[gid].i[ 5]; pw_buf0[1] = pws[gid].i[1];
wordl1[2] = pws[gid].i[ 6]; pw_buf0[2] = pws[gid].i[2];
wordl1[3] = pws[gid].i[ 7]; pw_buf0[3] = pws[gid].i[3];
pw_buf1[0] = pws[gid].i[4];
u32 wordl2[4]; pw_buf1[1] = pws[gid].i[5];
pw_buf1[2] = pws[gid].i[6];
wordl2[0] = 0; pw_buf1[3] = pws[gid].i[7];
wordl2[1] = 0;
wordl2[2] = 0;
wordl2[3] = 0;
u32 wordl3[4];
wordl3[0] = 0;
wordl3[1] = 0;
wordl3[2] = 0;
wordl3[3] = 0;
const u32 pw_l_len = pws[gid].pw_len; const u32 pw_l_len = pws[gid].pw_len;
if (combs_mode == COMBINATOR_MODE_BASE_RIGHT) /**
{ * shared
switch_buffer_by_offset_le (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len); */
}
__local RC4_KEY rc4_keys[64];
/** /**
* salt * salt
@ -789,73 +777,65 @@ __kernel void m13100_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
* loop * loop
*/ */
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{ {
const u32 pw_r_len = combs_buf[il_pos].pw_len; const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
const u32 pw_len = pw_l_len + pw_r_len; const u32x pw_len = pw_l_len + pw_r_len;
u32 wordr0[4]; /**
* concat password candidate
*/
wordr0[0] = combs_buf[il_pos].i[0]; u32x wordl0[4] = { 0 };
wordr0[1] = combs_buf[il_pos].i[1]; u32x wordl1[4] = { 0 };
wordr0[2] = combs_buf[il_pos].i[2]; u32x wordl2[4] = { 0 };
wordr0[3] = combs_buf[il_pos].i[3]; u32x wordl3[4] = { 0 };
u32 wordr1[4]; wordl0[0] = pw_buf0[0];
wordl0[1] = pw_buf0[1];
wordl0[2] = pw_buf0[2];
wordl0[3] = pw_buf0[3];
wordl1[0] = pw_buf1[0];
wordl1[1] = pw_buf1[1];
wordl1[2] = pw_buf1[2];
wordl1[3] = pw_buf1[3];
wordr1[0] = combs_buf[il_pos].i[4]; u32x wordr0[4] = { 0 };
wordr1[1] = combs_buf[il_pos].i[5]; u32x wordr1[4] = { 0 };
wordr1[2] = combs_buf[il_pos].i[6]; u32x wordr2[4] = { 0 };
wordr1[3] = combs_buf[il_pos].i[7]; u32x wordr3[4] = { 0 };
u32 wordr2[4]; wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
wordr2[0] = 0; wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
wordr2[1] = 0; wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
wordr2[2] = 0; wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
wordr2[3] = 0; wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
u32 wordr3[4]; wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
wordr3[0] = 0;
wordr3[1] = 0;
wordr3[2] = 0;
wordr3[3] = 0;
if (combs_mode == COMBINATOR_MODE_BASE_LEFT) if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
{ {
switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len); 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]; u32x w0[4];
u32x w1[4];
w0[0] = wordl0[0] | wordr0[0]; w0[0] = wordl0[0] | wordr0[0];
w0[1] = wordl0[1] | wordr0[1]; w0[1] = wordl0[1] | wordr0[1];
w0[2] = wordl0[2] | wordr0[2]; w0[2] = wordl0[2] | wordr0[2];
w0[3] = wordl0[3] | wordr0[3]; w0[3] = wordl0[3] | wordr0[3];
u32 w1[4];
w1[0] = wordl1[0] | wordr1[0]; w1[0] = wordl1[0] | wordr1[0];
w1[1] = wordl1[1] | wordr1[1]; w1[1] = wordl1[1] | wordr1[1];
w1[2] = wordl1[2] | wordr1[2]; w1[2] = wordl1[2] | wordr1[2];
w1[3] = wordl1[3] | wordr1[3]; w1[3] = wordl1[3] | wordr1[3];
u32 w2[4];
w2[0] = wordl2[0] | wordr2[0];
w2[1] = wordl2[1] | wordr2[1];
w2[2] = wordl2[2] | wordr2[2];
w2[3] = wordl2[3] | wordr2[3];
u32 w3[4];
w3[0] = wordl3[0] | wordr3[0];
w3[1] = wordl3[1] | wordr3[1];
w3[2] = 0;
w3[3] = 0;
/** /**
* kerberos * kerberos
*/ */
@ -896,51 +876,35 @@ __kernel void m13100_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
* modifier * modifier
*/ */
__local RC4_KEY rc4_keys[64];
const u32 gid = get_global_id (0);
const u32 lid = get_local_id (0); const u32 lid = get_local_id (0);
if (gid >= gid_max) return;
/** /**
* base * base
*/ */
u32 wordl0[4]; const u32 gid = get_global_id (0);
wordl0[0] = pws[gid].i[ 0]; if (gid >= gid_max) return;
wordl0[1] = pws[gid].i[ 1];
wordl0[2] = pws[gid].i[ 2];
wordl0[3] = pws[gid].i[ 3];
u32 wordl1[4]; u32 pw_buf0[4];
u32 pw_buf1[4];
wordl1[0] = pws[gid].i[ 4]; pw_buf0[0] = pws[gid].i[0];
wordl1[1] = pws[gid].i[ 5]; pw_buf0[1] = pws[gid].i[1];
wordl1[2] = pws[gid].i[ 6]; pw_buf0[2] = pws[gid].i[2];
wordl1[3] = pws[gid].i[ 7]; pw_buf0[3] = pws[gid].i[3];
pw_buf1[0] = pws[gid].i[4];
u32 wordl2[4]; pw_buf1[1] = pws[gid].i[5];
pw_buf1[2] = pws[gid].i[6];
wordl2[0] = 0; pw_buf1[3] = pws[gid].i[7];
wordl2[1] = 0;
wordl2[2] = 0;
wordl2[3] = 0;
u32 wordl3[4];
wordl3[0] = 0;
wordl3[1] = 0;
wordl3[2] = 0;
wordl3[3] = 0;
const u32 pw_l_len = pws[gid].pw_len; const u32 pw_l_len = pws[gid].pw_len;
if (combs_mode == COMBINATOR_MODE_BASE_RIGHT) /**
{ * shared
switch_buffer_by_offset_le (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len); */
}
__local RC4_KEY rc4_keys[64];
/** /**
* salt * salt
@ -957,73 +921,65 @@ __kernel void m13100_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
* loop * loop
*/ */
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{ {
const u32 pw_r_len = combs_buf[il_pos].pw_len; const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
const u32 pw_len = pw_l_len + pw_r_len; const u32x pw_len = pw_l_len + pw_r_len;
u32 wordr0[4]; /**
* concat password candidate
*/
wordr0[0] = combs_buf[il_pos].i[0]; u32x wordl0[4] = { 0 };
wordr0[1] = combs_buf[il_pos].i[1]; u32x wordl1[4] = { 0 };
wordr0[2] = combs_buf[il_pos].i[2]; u32x wordl2[4] = { 0 };
wordr0[3] = combs_buf[il_pos].i[3]; u32x wordl3[4] = { 0 };
u32 wordr1[4]; wordl0[0] = pw_buf0[0];
wordl0[1] = pw_buf0[1];
wordl0[2] = pw_buf0[2];
wordl0[3] = pw_buf0[3];
wordl1[0] = pw_buf1[0];
wordl1[1] = pw_buf1[1];
wordl1[2] = pw_buf1[2];
wordl1[3] = pw_buf1[3];
wordr1[0] = combs_buf[il_pos].i[4]; u32x wordr0[4] = { 0 };
wordr1[1] = combs_buf[il_pos].i[5]; u32x wordr1[4] = { 0 };
wordr1[2] = combs_buf[il_pos].i[6]; u32x wordr2[4] = { 0 };
wordr1[3] = combs_buf[il_pos].i[7]; u32x wordr3[4] = { 0 };
u32 wordr2[4]; wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
wordr2[0] = 0; wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
wordr2[1] = 0; wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
wordr2[2] = 0; wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
wordr2[3] = 0; wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
u32 wordr3[4]; wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
wordr3[0] = 0;
wordr3[1] = 0;
wordr3[2] = 0;
wordr3[3] = 0;
if (combs_mode == COMBINATOR_MODE_BASE_LEFT) if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
{ {
switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len); 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]; u32x w0[4];
u32x w1[4];
w0[0] = wordl0[0] | wordr0[0]; w0[0] = wordl0[0] | wordr0[0];
w0[1] = wordl0[1] | wordr0[1]; w0[1] = wordl0[1] | wordr0[1];
w0[2] = wordl0[2] | wordr0[2]; w0[2] = wordl0[2] | wordr0[2];
w0[3] = wordl0[3] | wordr0[3]; w0[3] = wordl0[3] | wordr0[3];
u32 w1[4];
w1[0] = wordl1[0] | wordr1[0]; w1[0] = wordl1[0] | wordr1[0];
w1[1] = wordl1[1] | wordr1[1]; w1[1] = wordl1[1] | wordr1[1];
w1[2] = wordl1[2] | wordr1[2]; w1[2] = wordl1[2] | wordr1[2];
w1[3] = wordl1[3] | wordr1[3]; w1[3] = wordl1[3] | wordr1[3];
u32 w2[4];
w2[0] = wordl2[0] | wordr2[0];
w2[1] = wordl2[1] | wordr2[1];
w2[2] = wordl2[2] | wordr2[2];
w2[3] = wordl2[3] | wordr2[3];
u32 w3[4];
w3[0] = wordl3[0] | wordr3[0];
w3[1] = wordl3[1] | wordr3[1];
w3[2] = 0;
w3[3] = 0;
/** /**
* kerberos * kerberos
*/ */

View File

@ -8,6 +8,9 @@
#define _KRB5TGS_ #define _KRB5TGS_
//too much register pressure
//#define NEW_SIMD_CODE
#include "include/constants.h" #include "include/constants.h"
#include "include/kernel_vendor.h" #include "include/kernel_vendor.h"
@ -19,6 +22,7 @@
#include "include/kernel_functions.c" #include "include/kernel_functions.c"
#include "OpenCL/types_ocl.c" #include "OpenCL/types_ocl.c"
#include "OpenCL/common.c" #include "OpenCL/common.c"
#include "OpenCL/simd.c"
typedef struct typedef struct
{ {
@ -754,6 +758,10 @@ static void m13100 (__local RC4_KEY *rc4_keys, u32 w0[4], u32 w1[4], u32 w2[4],
w0[0] = w0l | w0r; w0[0] = w0l | w0r;
/**
* kerberos
*/
u32 digest[4]; u32 digest[4];
u32 K2[4]; u32 K2[4];