From 611c73d294a1ccee848107d8dc5357ec97ee7ffb Mon Sep 17 00:00:00 2001 From: Michael Kruger Date: Fri, 6 Nov 2020 23:28:05 +0200 Subject: [PATCH 01/64] NetNTLM bypass NT --- OpenCL/m05510_a0-optimized.cl | 779 ++++++++++++++++++++++++++++++++++ OpenCL/m05510_a0-pure.cl | 757 +++++++++++++++++++++++++++++++++ OpenCL/m05610_a0-optimized.cl | 610 ++++++++++++++++++++++++++ OpenCL/m05610_a0-pure.cl | 214 ++++++++++ src/modules/module_05510.c | 492 +++++++++++++++++++++ src/modules/module_05610.c | 388 +++++++++++++++++ 6 files changed, 3240 insertions(+) create mode 100644 OpenCL/m05510_a0-optimized.cl create mode 100644 OpenCL/m05510_a0-pure.cl create mode 100644 OpenCL/m05610_a0-optimized.cl create mode 100644 OpenCL/m05610_a0-pure.cl create mode 100644 src/modules/module_05510.c create mode 100644 src/modules/module_05610.c diff --git a/OpenCL/m05510_a0-optimized.cl b/OpenCL/m05510_a0-optimized.cl new file mode 100644 index 000000000..c82c816bc --- /dev/null +++ b/OpenCL/m05510_a0-optimized.cl @@ -0,0 +1,779 @@ +/** + * 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_optimized.h" +#include "inc_rp_optimized.cl" +#include "inc_simd.cl" +#include "inc_hash_md4.cl" +#endif + +typedef struct netntlm +{ + u32 user_len; + u32 domain_len; + u32 srvchall_len; + u32 clichall_len; + + u32 userdomain_buf[64]; + u32 chall_buf[256]; + +} netntlm_t; + +#define PERM_OP(a,b,tt,n,m) \ +{ \ + tt = a >> n; \ + tt = tt ^ b; \ + tt = tt & m; \ + b = b ^ tt; \ + tt = tt << n; \ + a = a ^ tt; \ +} + +#define HPERM_OP(a,tt,n,m) \ +{ \ + tt = a << (16 + n); \ + tt = tt ^ a; \ + tt = tt & m; \ + a = a ^ tt; \ + tt = tt >> (16 + n); \ + a = a ^ tt; \ +} + +CONSTANT_VK u32a c_SPtrans[8][64] = +{ + { + 0x02080800, 0x00080000, 0x02000002, 0x02080802, + 0x02000000, 0x00080802, 0x00080002, 0x02000002, + 0x00080802, 0x02080800, 0x02080000, 0x00000802, + 0x02000802, 0x02000000, 0x00000000, 0x00080002, + 0x00080000, 0x00000002, 0x02000800, 0x00080800, + 0x02080802, 0x02080000, 0x00000802, 0x02000800, + 0x00000002, 0x00000800, 0x00080800, 0x02080002, + 0x00000800, 0x02000802, 0x02080002, 0x00000000, + 0x00000000, 0x02080802, 0x02000800, 0x00080002, + 0x02080800, 0x00080000, 0x00000802, 0x02000800, + 0x02080002, 0x00000800, 0x00080800, 0x02000002, + 0x00080802, 0x00000002, 0x02000002, 0x02080000, + 0x02080802, 0x00080800, 0x02080000, 0x02000802, + 0x02000000, 0x00000802, 0x00080002, 0x00000000, + 0x00080000, 0x02000000, 0x02000802, 0x02080800, + 0x00000002, 0x02080002, 0x00000800, 0x00080802, + }, + { + 0x40108010, 0x00000000, 0x00108000, 0x40100000, + 0x40000010, 0x00008010, 0x40008000, 0x00108000, + 0x00008000, 0x40100010, 0x00000010, 0x40008000, + 0x00100010, 0x40108000, 0x40100000, 0x00000010, + 0x00100000, 0x40008010, 0x40100010, 0x00008000, + 0x00108010, 0x40000000, 0x00000000, 0x00100010, + 0x40008010, 0x00108010, 0x40108000, 0x40000010, + 0x40000000, 0x00100000, 0x00008010, 0x40108010, + 0x00100010, 0x40108000, 0x40008000, 0x00108010, + 0x40108010, 0x00100010, 0x40000010, 0x00000000, + 0x40000000, 0x00008010, 0x00100000, 0x40100010, + 0x00008000, 0x40000000, 0x00108010, 0x40008010, + 0x40108000, 0x00008000, 0x00000000, 0x40000010, + 0x00000010, 0x40108010, 0x00108000, 0x40100000, + 0x40100010, 0x00100000, 0x00008010, 0x40008000, + 0x40008010, 0x00000010, 0x40100000, 0x00108000, + }, + { + 0x04000001, 0x04040100, 0x00000100, 0x04000101, + 0x00040001, 0x04000000, 0x04000101, 0x00040100, + 0x04000100, 0x00040000, 0x04040000, 0x00000001, + 0x04040101, 0x00000101, 0x00000001, 0x04040001, + 0x00000000, 0x00040001, 0x04040100, 0x00000100, + 0x00000101, 0x04040101, 0x00040000, 0x04000001, + 0x04040001, 0x04000100, 0x00040101, 0x04040000, + 0x00040100, 0x00000000, 0x04000000, 0x00040101, + 0x04040100, 0x00000100, 0x00000001, 0x00040000, + 0x00000101, 0x00040001, 0x04040000, 0x04000101, + 0x00000000, 0x04040100, 0x00040100, 0x04040001, + 0x00040001, 0x04000000, 0x04040101, 0x00000001, + 0x00040101, 0x04000001, 0x04000000, 0x04040101, + 0x00040000, 0x04000100, 0x04000101, 0x00040100, + 0x04000100, 0x00000000, 0x04040001, 0x00000101, + 0x04000001, 0x00040101, 0x00000100, 0x04040000, + }, + { + 0x00401008, 0x10001000, 0x00000008, 0x10401008, + 0x00000000, 0x10400000, 0x10001008, 0x00400008, + 0x10401000, 0x10000008, 0x10000000, 0x00001008, + 0x10000008, 0x00401008, 0x00400000, 0x10000000, + 0x10400008, 0x00401000, 0x00001000, 0x00000008, + 0x00401000, 0x10001008, 0x10400000, 0x00001000, + 0x00001008, 0x00000000, 0x00400008, 0x10401000, + 0x10001000, 0x10400008, 0x10401008, 0x00400000, + 0x10400008, 0x00001008, 0x00400000, 0x10000008, + 0x00401000, 0x10001000, 0x00000008, 0x10400000, + 0x10001008, 0x00000000, 0x00001000, 0x00400008, + 0x00000000, 0x10400008, 0x10401000, 0x00001000, + 0x10000000, 0x10401008, 0x00401008, 0x00400000, + 0x10401008, 0x00000008, 0x10001000, 0x00401008, + 0x00400008, 0x00401000, 0x10400000, 0x10001008, + 0x00001008, 0x10000000, 0x10000008, 0x10401000, + }, + { + 0x08000000, 0x00010000, 0x00000400, 0x08010420, + 0x08010020, 0x08000400, 0x00010420, 0x08010000, + 0x00010000, 0x00000020, 0x08000020, 0x00010400, + 0x08000420, 0x08010020, 0x08010400, 0x00000000, + 0x00010400, 0x08000000, 0x00010020, 0x00000420, + 0x08000400, 0x00010420, 0x00000000, 0x08000020, + 0x00000020, 0x08000420, 0x08010420, 0x00010020, + 0x08010000, 0x00000400, 0x00000420, 0x08010400, + 0x08010400, 0x08000420, 0x00010020, 0x08010000, + 0x00010000, 0x00000020, 0x08000020, 0x08000400, + 0x08000000, 0x00010400, 0x08010420, 0x00000000, + 0x00010420, 0x08000000, 0x00000400, 0x00010020, + 0x08000420, 0x00000400, 0x00000000, 0x08010420, + 0x08010020, 0x08010400, 0x00000420, 0x00010000, + 0x00010400, 0x08010020, 0x08000400, 0x00000420, + 0x00000020, 0x00010420, 0x08010000, 0x08000020, + }, + { + 0x80000040, 0x00200040, 0x00000000, 0x80202000, + 0x00200040, 0x00002000, 0x80002040, 0x00200000, + 0x00002040, 0x80202040, 0x00202000, 0x80000000, + 0x80002000, 0x80000040, 0x80200000, 0x00202040, + 0x00200000, 0x80002040, 0x80200040, 0x00000000, + 0x00002000, 0x00000040, 0x80202000, 0x80200040, + 0x80202040, 0x80200000, 0x80000000, 0x00002040, + 0x00000040, 0x00202000, 0x00202040, 0x80002000, + 0x00002040, 0x80000000, 0x80002000, 0x00202040, + 0x80202000, 0x00200040, 0x00000000, 0x80002000, + 0x80000000, 0x00002000, 0x80200040, 0x00200000, + 0x00200040, 0x80202040, 0x00202000, 0x00000040, + 0x80202040, 0x00202000, 0x00200000, 0x80002040, + 0x80000040, 0x80200000, 0x00202040, 0x00000000, + 0x00002000, 0x80000040, 0x80002040, 0x80202000, + 0x80200000, 0x00002040, 0x00000040, 0x80200040, + }, + { + 0x00004000, 0x00000200, 0x01000200, 0x01000004, + 0x01004204, 0x00004004, 0x00004200, 0x00000000, + 0x01000000, 0x01000204, 0x00000204, 0x01004000, + 0x00000004, 0x01004200, 0x01004000, 0x00000204, + 0x01000204, 0x00004000, 0x00004004, 0x01004204, + 0x00000000, 0x01000200, 0x01000004, 0x00004200, + 0x01004004, 0x00004204, 0x01004200, 0x00000004, + 0x00004204, 0x01004004, 0x00000200, 0x01000000, + 0x00004204, 0x01004000, 0x01004004, 0x00000204, + 0x00004000, 0x00000200, 0x01000000, 0x01004004, + 0x01000204, 0x00004204, 0x00004200, 0x00000000, + 0x00000200, 0x01000004, 0x00000004, 0x01000200, + 0x00000000, 0x01000204, 0x01000200, 0x00004200, + 0x00000204, 0x00004000, 0x01004204, 0x01000000, + 0x01004200, 0x00000004, 0x00004004, 0x01004204, + 0x01000004, 0x01004200, 0x01004000, 0x00004004, + }, + { + 0x20800080, 0x20820000, 0x00020080, 0x00000000, + 0x20020000, 0x00800080, 0x20800000, 0x20820080, + 0x00000080, 0x20000000, 0x00820000, 0x00020080, + 0x00820080, 0x20020080, 0x20000080, 0x20800000, + 0x00020000, 0x00820080, 0x00800080, 0x20020000, + 0x20820080, 0x20000080, 0x00000000, 0x00820000, + 0x20000000, 0x00800000, 0x20020080, 0x20800080, + 0x00800000, 0x00020000, 0x20820000, 0x00000080, + 0x00800000, 0x00020000, 0x20000080, 0x20820080, + 0x00020080, 0x20000000, 0x00000000, 0x00820000, + 0x20800080, 0x20020080, 0x20020000, 0x00800080, + 0x20820000, 0x00000080, 0x00800080, 0x20020000, + 0x20820080, 0x00800000, 0x20800000, 0x20000080, + 0x00820000, 0x00020080, 0x20020080, 0x20800000, + 0x00000080, 0x20820000, 0x00820080, 0x00000000, + 0x20000000, 0x20800080, 0x00020000, 0x00820080, + } +}; + +CONSTANT_VK u32a c_skb[8][64] = +{ + { + 0x00000000, 0x00000010, 0x20000000, 0x20000010, + 0x00010000, 0x00010010, 0x20010000, 0x20010010, + 0x00000800, 0x00000810, 0x20000800, 0x20000810, + 0x00010800, 0x00010810, 0x20010800, 0x20010810, + 0x00000020, 0x00000030, 0x20000020, 0x20000030, + 0x00010020, 0x00010030, 0x20010020, 0x20010030, + 0x00000820, 0x00000830, 0x20000820, 0x20000830, + 0x00010820, 0x00010830, 0x20010820, 0x20010830, + 0x00080000, 0x00080010, 0x20080000, 0x20080010, + 0x00090000, 0x00090010, 0x20090000, 0x20090010, + 0x00080800, 0x00080810, 0x20080800, 0x20080810, + 0x00090800, 0x00090810, 0x20090800, 0x20090810, + 0x00080020, 0x00080030, 0x20080020, 0x20080030, + 0x00090020, 0x00090030, 0x20090020, 0x20090030, + 0x00080820, 0x00080830, 0x20080820, 0x20080830, + 0x00090820, 0x00090830, 0x20090820, 0x20090830, + }, + { + 0x00000000, 0x02000000, 0x00002000, 0x02002000, + 0x00200000, 0x02200000, 0x00202000, 0x02202000, + 0x00000004, 0x02000004, 0x00002004, 0x02002004, + 0x00200004, 0x02200004, 0x00202004, 0x02202004, + 0x00000400, 0x02000400, 0x00002400, 0x02002400, + 0x00200400, 0x02200400, 0x00202400, 0x02202400, + 0x00000404, 0x02000404, 0x00002404, 0x02002404, + 0x00200404, 0x02200404, 0x00202404, 0x02202404, + 0x10000000, 0x12000000, 0x10002000, 0x12002000, + 0x10200000, 0x12200000, 0x10202000, 0x12202000, + 0x10000004, 0x12000004, 0x10002004, 0x12002004, + 0x10200004, 0x12200004, 0x10202004, 0x12202004, + 0x10000400, 0x12000400, 0x10002400, 0x12002400, + 0x10200400, 0x12200400, 0x10202400, 0x12202400, + 0x10000404, 0x12000404, 0x10002404, 0x12002404, + 0x10200404, 0x12200404, 0x10202404, 0x12202404, + }, + { + 0x00000000, 0x00000001, 0x00040000, 0x00040001, + 0x01000000, 0x01000001, 0x01040000, 0x01040001, + 0x00000002, 0x00000003, 0x00040002, 0x00040003, + 0x01000002, 0x01000003, 0x01040002, 0x01040003, + 0x00000200, 0x00000201, 0x00040200, 0x00040201, + 0x01000200, 0x01000201, 0x01040200, 0x01040201, + 0x00000202, 0x00000203, 0x00040202, 0x00040203, + 0x01000202, 0x01000203, 0x01040202, 0x01040203, + 0x08000000, 0x08000001, 0x08040000, 0x08040001, + 0x09000000, 0x09000001, 0x09040000, 0x09040001, + 0x08000002, 0x08000003, 0x08040002, 0x08040003, + 0x09000002, 0x09000003, 0x09040002, 0x09040003, + 0x08000200, 0x08000201, 0x08040200, 0x08040201, + 0x09000200, 0x09000201, 0x09040200, 0x09040201, + 0x08000202, 0x08000203, 0x08040202, 0x08040203, + 0x09000202, 0x09000203, 0x09040202, 0x09040203, + }, + { + 0x00000000, 0x00100000, 0x00000100, 0x00100100, + 0x00000008, 0x00100008, 0x00000108, 0x00100108, + 0x00001000, 0x00101000, 0x00001100, 0x00101100, + 0x00001008, 0x00101008, 0x00001108, 0x00101108, + 0x04000000, 0x04100000, 0x04000100, 0x04100100, + 0x04000008, 0x04100008, 0x04000108, 0x04100108, + 0x04001000, 0x04101000, 0x04001100, 0x04101100, + 0x04001008, 0x04101008, 0x04001108, 0x04101108, + 0x00020000, 0x00120000, 0x00020100, 0x00120100, + 0x00020008, 0x00120008, 0x00020108, 0x00120108, + 0x00021000, 0x00121000, 0x00021100, 0x00121100, + 0x00021008, 0x00121008, 0x00021108, 0x00121108, + 0x04020000, 0x04120000, 0x04020100, 0x04120100, + 0x04020008, 0x04120008, 0x04020108, 0x04120108, + 0x04021000, 0x04121000, 0x04021100, 0x04121100, + 0x04021008, 0x04121008, 0x04021108, 0x04121108, + }, + { + 0x00000000, 0x10000000, 0x00010000, 0x10010000, + 0x00000004, 0x10000004, 0x00010004, 0x10010004, + 0x20000000, 0x30000000, 0x20010000, 0x30010000, + 0x20000004, 0x30000004, 0x20010004, 0x30010004, + 0x00100000, 0x10100000, 0x00110000, 0x10110000, + 0x00100004, 0x10100004, 0x00110004, 0x10110004, + 0x20100000, 0x30100000, 0x20110000, 0x30110000, + 0x20100004, 0x30100004, 0x20110004, 0x30110004, + 0x00001000, 0x10001000, 0x00011000, 0x10011000, + 0x00001004, 0x10001004, 0x00011004, 0x10011004, + 0x20001000, 0x30001000, 0x20011000, 0x30011000, + 0x20001004, 0x30001004, 0x20011004, 0x30011004, + 0x00101000, 0x10101000, 0x00111000, 0x10111000, + 0x00101004, 0x10101004, 0x00111004, 0x10111004, + 0x20101000, 0x30101000, 0x20111000, 0x30111000, + 0x20101004, 0x30101004, 0x20111004, 0x30111004, + }, + { + 0x00000000, 0x08000000, 0x00000008, 0x08000008, + 0x00000400, 0x08000400, 0x00000408, 0x08000408, + 0x00020000, 0x08020000, 0x00020008, 0x08020008, + 0x00020400, 0x08020400, 0x00020408, 0x08020408, + 0x00000001, 0x08000001, 0x00000009, 0x08000009, + 0x00000401, 0x08000401, 0x00000409, 0x08000409, + 0x00020001, 0x08020001, 0x00020009, 0x08020009, + 0x00020401, 0x08020401, 0x00020409, 0x08020409, + 0x02000000, 0x0A000000, 0x02000008, 0x0A000008, + 0x02000400, 0x0A000400, 0x02000408, 0x0A000408, + 0x02020000, 0x0A020000, 0x02020008, 0x0A020008, + 0x02020400, 0x0A020400, 0x02020408, 0x0A020408, + 0x02000001, 0x0A000001, 0x02000009, 0x0A000009, + 0x02000401, 0x0A000401, 0x02000409, 0x0A000409, + 0x02020001, 0x0A020001, 0x02020009, 0x0A020009, + 0x02020401, 0x0A020401, 0x02020409, 0x0A020409, + }, + { + 0x00000000, 0x00000100, 0x00080000, 0x00080100, + 0x01000000, 0x01000100, 0x01080000, 0x01080100, + 0x00000010, 0x00000110, 0x00080010, 0x00080110, + 0x01000010, 0x01000110, 0x01080010, 0x01080110, + 0x00200000, 0x00200100, 0x00280000, 0x00280100, + 0x01200000, 0x01200100, 0x01280000, 0x01280100, + 0x00200010, 0x00200110, 0x00280010, 0x00280110, + 0x01200010, 0x01200110, 0x01280010, 0x01280110, + 0x00000200, 0x00000300, 0x00080200, 0x00080300, + 0x01000200, 0x01000300, 0x01080200, 0x01080300, + 0x00000210, 0x00000310, 0x00080210, 0x00080310, + 0x01000210, 0x01000310, 0x01080210, 0x01080310, + 0x00200200, 0x00200300, 0x00280200, 0x00280300, + 0x01200200, 0x01200300, 0x01280200, 0x01280300, + 0x00200210, 0x00200310, 0x00280210, 0x00280310, + 0x01200210, 0x01200310, 0x01280210, 0x01280310, + }, + { + 0x00000000, 0x04000000, 0x00040000, 0x04040000, + 0x00000002, 0x04000002, 0x00040002, 0x04040002, + 0x00002000, 0x04002000, 0x00042000, 0x04042000, + 0x00002002, 0x04002002, 0x00042002, 0x04042002, + 0x00000020, 0x04000020, 0x00040020, 0x04040020, + 0x00000022, 0x04000022, 0x00040022, 0x04040022, + 0x00002020, 0x04002020, 0x00042020, 0x04042020, + 0x00002022, 0x04002022, 0x00042022, 0x04042022, + 0x00000800, 0x04000800, 0x00040800, 0x04040800, + 0x00000802, 0x04000802, 0x00040802, 0x04040802, + 0x00002800, 0x04002800, 0x00042800, 0x04042800, + 0x00002802, 0x04002802, 0x00042802, 0x04042802, + 0x00000820, 0x04000820, 0x00040820, 0x04040820, + 0x00000822, 0x04000822, 0x00040822, 0x04040822, + 0x00002820, 0x04002820, 0x00042820, 0x04042820, + 0x00002822, 0x04002822, 0x00042822, 0x04042822 + } +}; + +#if VECT_SIZE == 1 +#define BOX(i,n,S) (S)[(n)][(i)] +#elif VECT_SIZE == 2 +#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1]) +#elif VECT_SIZE == 4 +#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3]) +#elif VECT_SIZE == 8 +#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7]) +#elif VECT_SIZE == 16 +#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7], (S)[(n)][(i).s8], (S)[(n)][(i).s9], (S)[(n)][(i).sa], (S)[(n)][(i).sb], (S)[(n)][(i).sc], (S)[(n)][(i).sd], (S)[(n)][(i).se], (S)[(n)][(i).sf]) +#endif + +DECLSPEC void _des_crypt_encrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64]) +{ + u32x r = data[0]; + u32x l = data[1]; + + #ifdef _unroll + #pragma unroll + #endif + for (u32 i = 0; i < 16; i += 2) + { + u32x u; + u32x t; + + u = Kc[i + 0] ^ hc_rotl32 (r, 30u); + t = Kd[i + 0] ^ hc_rotl32 (r, 26u); + + l ^= BOX (((u >> 0) & 0x3f), 0, s_SPtrans) + | BOX (((u >> 8) & 0x3f), 2, s_SPtrans) + | BOX (((u >> 16) & 0x3f), 4, s_SPtrans) + | BOX (((u >> 24) & 0x3f), 6, s_SPtrans) + | BOX (((t >> 0) & 0x3f), 1, s_SPtrans) + | BOX (((t >> 8) & 0x3f), 3, s_SPtrans) + | BOX (((t >> 16) & 0x3f), 5, s_SPtrans) + | BOX (((t >> 24) & 0x3f), 7, s_SPtrans); + + u = Kc[i + 1] ^ hc_rotl32 (l, 30u); + t = Kd[i + 1] ^ hc_rotl32 (l, 26u); + + r ^= BOX (((u >> 0) & 0x3f), 0, s_SPtrans) + | BOX (((u >> 8) & 0x3f), 2, s_SPtrans) + | BOX (((u >> 16) & 0x3f), 4, s_SPtrans) + | BOX (((u >> 24) & 0x3f), 6, s_SPtrans) + | BOX (((t >> 0) & 0x3f), 1, s_SPtrans) + | BOX (((t >> 8) & 0x3f), 3, s_SPtrans) + | BOX (((t >> 16) & 0x3f), 5, s_SPtrans) + | BOX (((t >> 24) & 0x3f), 7, s_SPtrans); + } + + iv[0] = l; + iv[1] = r; +} + +DECLSPEC void _des_crypt_keysetup (u32x c, u32x d, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_skb)[64]) +{ + u32x tt; + + PERM_OP (d, c, tt, 4, 0x0f0f0f0f); + HPERM_OP (c, tt, 2, 0xcccc0000); + HPERM_OP (d, tt, 2, 0xcccc0000); + PERM_OP (d, c, tt, 1, 0x55555555); + PERM_OP (c, d, tt, 8, 0x00ff00ff); + PERM_OP (d, c, tt, 1, 0x55555555); + + d = ((d & 0x000000ff) << 16) + | ((d & 0x0000ff00) << 0) + | ((d & 0x00ff0000) >> 16) + | ((c & 0xf0000000) >> 4); + + c = c & 0x0fffffff; + + #ifdef _unroll + #pragma unroll + #endif + for (u32 i = 0; i < 16; i++) + { + if ((i < 2) || (i == 8) || (i == 15)) + { + c = ((c >> 1) | (c << 27)); + d = ((d >> 1) | (d << 27)); + } + else + { + c = ((c >> 2) | (c << 26)); + d = ((d >> 2) | (d << 26)); + } + + c = c & 0x0fffffff; + d = d & 0x0fffffff; + + const u32x c00 = (c >> 0) & 0x0000003f; + const u32x c06 = (c >> 6) & 0x00383003; + const u32x c07 = (c >> 7) & 0x0000003c; + const u32x c13 = (c >> 13) & 0x0000060f; + const u32x c20 = (c >> 20) & 0x00000001; + + u32x s = BOX (((c00 >> 0) & 0xff), 0, s_skb) + | BOX (((c06 >> 0) & 0xff) + |((c07 >> 0) & 0xff), 1, s_skb) + | BOX (((c13 >> 0) & 0xff) + |((c06 >> 8) & 0xff), 2, s_skb) + | BOX (((c20 >> 0) & 0xff) + |((c13 >> 8) & 0xff) + |((c06 >> 16) & 0xff), 3, s_skb); + + const u32x d00 = (d >> 0) & 0x00003c3f; + const u32x d07 = (d >> 7) & 0x00003f03; + const u32x d21 = (d >> 21) & 0x0000000f; + const u32x d22 = (d >> 22) & 0x00000030; + + u32x t = BOX (((d00 >> 0) & 0xff), 4, s_skb) + | BOX (((d07 >> 0) & 0xff) + |((d00 >> 8) & 0xff), 5, s_skb) + | BOX (((d07 >> 8) & 0xff), 6, s_skb) + | BOX (((d21 >> 0) & 0xff) + |((d22 >> 0) & 0xff), 7, s_skb); + + Kc[i] = ((t << 16) | (s & 0x0000ffff)); + Kd[i] = ((s >> 16) | (t & 0xffff0000)); + } +} + +DECLSPEC void transform_netntlmv1_key (const u32x w0, const u32x w1, u32x *out) +{ + u32x t[8]; + + t[0] = (w0 >> 0) & 0xff; + t[1] = (w0 >> 8) & 0xff; + t[2] = (w0 >> 16) & 0xff; + t[3] = (w0 >> 24) & 0xff; + t[4] = (w1 >> 0) & 0xff; + t[5] = (w1 >> 8) & 0xff; + t[6] = (w1 >> 16) & 0xff; + t[7] = (w1 >> 24) & 0xff; + + u32x k[8]; + + k[0] = (t[0] >> 0); + k[1] = (t[0] << 7) | (t[1] >> 1); + k[2] = (t[1] << 6) | (t[2] >> 2); + k[3] = (t[2] << 5) | (t[3] >> 3); + k[4] = (t[3] << 4) | (t[4] >> 4); + k[5] = (t[4] << 3) | (t[5] >> 5); + k[6] = (t[5] << 2) | (t[6] >> 6); + k[7] = (t[6] << 1); + + out[0] = ((k[0] & 0xff) << 0) + | ((k[1] & 0xff) << 8) + | ((k[2] & 0xff) << 16) + | ((k[3] & 0xff) << 24); + + out[1] = ((k[4] & 0xff) << 0) + | ((k[5] & 0xff) << 8) + | ((k[6] & 0xff) << 16) + | ((k[7] & 0xff) << 24); +} + +KERNEL_FQ void m05510_m04 (KERN_ATTR_RULES ()) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * sbox, kbox + */ + + #ifdef REAL_SHM + + LOCAL_VK u32 s_SPtrans[8][64]; + LOCAL_VK u32 s_skb[8][64]; + + for (u32 i = lid; i < 64; i += lsz) + { + s_SPtrans[0][i] = c_SPtrans[0][i]; + s_SPtrans[1][i] = c_SPtrans[1][i]; + s_SPtrans[2][i] = c_SPtrans[2][i]; + s_SPtrans[3][i] = c_SPtrans[3][i]; + s_SPtrans[4][i] = c_SPtrans[4][i]; + s_SPtrans[5][i] = c_SPtrans[5][i]; + s_SPtrans[6][i] = c_SPtrans[6][i]; + s_SPtrans[7][i] = c_SPtrans[7][i]; + + s_skb[0][i] = c_skb[0][i]; + s_skb[1][i] = c_skb[1][i]; + s_skb[2][i] = c_skb[2][i]; + s_skb[3][i] = c_skb[3][i]; + s_skb[4][i] = c_skb[4][i]; + s_skb[5][i] = c_skb[5][i]; + s_skb[6][i] = c_skb[6][i]; + s_skb[7][i] = c_skb[7][i]; + } + + SYNC_THREADS (); + + #else + + CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; + CONSTANT_AS u32a (*s_skb)[64] = c_skb; + + #endif + + if (gid >= gid_max) return; + + /** + * base + */ + + /** + * salt + */ + + const u32 s0 = salt_bufs[SALT_POS].salt_buf[0]; + const u32 s1 = salt_bufs[SALT_POS].salt_buf[1]; + const u32 s2 = salt_bufs[SALT_POS].salt_buf[2]; + + u32 data[2]; + + data[0] = s0; + data[1] = s1; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE) + { + + u32x a = pws[gid].i[ 0]; + u32x b = pws[gid].i[ 1]; + u32x c = pws[gid].i[ 2]; + u32x d = pws[gid].i[ 3]; + + /** + * DES1 + */ + + u32x key[2]; + + transform_netntlmv1_key (a, b, key); + + u32x Kc[16]; + u32x Kd[16]; + + _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); + + u32x data[2]; + + data[0] = s0; + data[1] = s1; + + u32x iv1[2]; + + _des_crypt_encrypt (iv1, data, Kc, Kd, s_SPtrans); + + /** + * DES2 + */ + + transform_netntlmv1_key (((b >> 24) | (c << 8)), ((c >> 24) | (d << 8)), key); + + _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); + + u32x iv2[2]; + + _des_crypt_encrypt (iv2, data, Kc, Kd, s_SPtrans); + + /** + * compare + */ + + COMPARE_M_SIMD (iv1[0], iv1[1], iv2[0], iv2[1]); + } +} + +KERNEL_FQ void m05510_m08 (KERN_ATTR_RULES ()) +{ +} + +KERNEL_FQ void m05510_m16 (KERN_ATTR_RULES ()) +{ +} + +KERNEL_FQ void m05510_s04 (KERN_ATTR_RULES ()) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * sbox, kbox + */ + + #ifdef REAL_SHM + + LOCAL_VK u32 s_SPtrans[8][64]; + LOCAL_VK u32 s_skb[8][64]; + + for (u32 i = lid; i < 64; i += lsz) + { + s_SPtrans[0][i] = c_SPtrans[0][i]; + s_SPtrans[1][i] = c_SPtrans[1][i]; + s_SPtrans[2][i] = c_SPtrans[2][i]; + s_SPtrans[3][i] = c_SPtrans[3][i]; + s_SPtrans[4][i] = c_SPtrans[4][i]; + s_SPtrans[5][i] = c_SPtrans[5][i]; + s_SPtrans[6][i] = c_SPtrans[6][i]; + s_SPtrans[7][i] = c_SPtrans[7][i]; + + s_skb[0][i] = c_skb[0][i]; + s_skb[1][i] = c_skb[1][i]; + s_skb[2][i] = c_skb[2][i]; + s_skb[3][i] = c_skb[3][i]; + s_skb[4][i] = c_skb[4][i]; + s_skb[5][i] = c_skb[5][i]; + s_skb[6][i] = c_skb[6][i]; + s_skb[7][i] = c_skb[7][i]; + } + + SYNC_THREADS (); + + #else + + CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; + CONSTANT_AS u32a (*s_skb)[64] = c_skb; + + #endif + + if (gid >= gid_max) return; + + /** + * base + */ + + + + /** + * salt + */ + + const u32 s0 = salt_bufs[SALT_POS].salt_buf[0]; + const u32 s1 = salt_bufs[SALT_POS].salt_buf[1]; + const u32 s2 = salt_bufs[SALT_POS].salt_buf[2]; + + /** + * 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] + }; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE) + { + + u32x a = pws[gid].i[ 0]; + u32x b = pws[gid].i[ 1]; + u32x c = pws[gid].i[ 2]; + u32x d = pws[gid].i[ 3]; + + /** + * DES1 + */ + + u32x key[2]; + + transform_netntlmv1_key (a, b, key); + + u32x Kc[16]; + u32x Kd[16]; + + _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); + + u32x data[2]; + + data[0] = s0; + data[1] = s1; + + u32x iv1[2]; + + _des_crypt_encrypt (iv1, data, Kc, Kd, s_SPtrans); + + /** + * DES2 + */ + + /* + transform_netntlmv1_key (((b >> 24) | (c << 8)), ((c >> 24) | (d << 8)), key); + + _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); + + u32x iv2[2]; + + _des_crypt_encrypt (iv2, data, Kc, Kd, s_SPtrans); + */ + + u32x iv2[2]; + + iv2[0] = search[2]; + iv2[1] = search[3]; + + /** + * compare + */ + + COMPARE_S_SIMD (iv1[0], iv1[1], iv2[0], iv2[1]); + } +} + +KERNEL_FQ void m05510_s08 (KERN_ATTR_RULES ()) +{ +} + +KERNEL_FQ void m05510_s16 (KERN_ATTR_RULES ()) +{ +} diff --git a/OpenCL/m05510_a0-pure.cl b/OpenCL/m05510_a0-pure.cl new file mode 100644 index 000000000..aa436a5a1 --- /dev/null +++ b/OpenCL/m05510_a0-pure.cl @@ -0,0 +1,757 @@ +/** + * 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_md4.cl" +#endif + +typedef struct netntlm +{ + u32 user_len; + u32 domain_len; + u32 srvchall_len; + u32 clichall_len; + + u32 userdomain_buf[64]; + u32 chall_buf[256]; + +} netntlm_t; + +#define PERM_OP(a,b,tt,n,m) \ +{ \ + tt = a >> n; \ + tt = tt ^ b; \ + tt = tt & m; \ + b = b ^ tt; \ + tt = tt << n; \ + a = a ^ tt; \ +} + +#define HPERM_OP(a,tt,n,m) \ +{ \ + tt = a << (16 + n); \ + tt = tt ^ a; \ + tt = tt & m; \ + a = a ^ tt; \ + tt = tt >> (16 + n); \ + a = a ^ tt; \ +} + +CONSTANT_VK u32a c_SPtrans[8][64] = +{ + { + 0x02080800, 0x00080000, 0x02000002, 0x02080802, + 0x02000000, 0x00080802, 0x00080002, 0x02000002, + 0x00080802, 0x02080800, 0x02080000, 0x00000802, + 0x02000802, 0x02000000, 0x00000000, 0x00080002, + 0x00080000, 0x00000002, 0x02000800, 0x00080800, + 0x02080802, 0x02080000, 0x00000802, 0x02000800, + 0x00000002, 0x00000800, 0x00080800, 0x02080002, + 0x00000800, 0x02000802, 0x02080002, 0x00000000, + 0x00000000, 0x02080802, 0x02000800, 0x00080002, + 0x02080800, 0x00080000, 0x00000802, 0x02000800, + 0x02080002, 0x00000800, 0x00080800, 0x02000002, + 0x00080802, 0x00000002, 0x02000002, 0x02080000, + 0x02080802, 0x00080800, 0x02080000, 0x02000802, + 0x02000000, 0x00000802, 0x00080002, 0x00000000, + 0x00080000, 0x02000000, 0x02000802, 0x02080800, + 0x00000002, 0x02080002, 0x00000800, 0x00080802, + }, + { + 0x40108010, 0x00000000, 0x00108000, 0x40100000, + 0x40000010, 0x00008010, 0x40008000, 0x00108000, + 0x00008000, 0x40100010, 0x00000010, 0x40008000, + 0x00100010, 0x40108000, 0x40100000, 0x00000010, + 0x00100000, 0x40008010, 0x40100010, 0x00008000, + 0x00108010, 0x40000000, 0x00000000, 0x00100010, + 0x40008010, 0x00108010, 0x40108000, 0x40000010, + 0x40000000, 0x00100000, 0x00008010, 0x40108010, + 0x00100010, 0x40108000, 0x40008000, 0x00108010, + 0x40108010, 0x00100010, 0x40000010, 0x00000000, + 0x40000000, 0x00008010, 0x00100000, 0x40100010, + 0x00008000, 0x40000000, 0x00108010, 0x40008010, + 0x40108000, 0x00008000, 0x00000000, 0x40000010, + 0x00000010, 0x40108010, 0x00108000, 0x40100000, + 0x40100010, 0x00100000, 0x00008010, 0x40008000, + 0x40008010, 0x00000010, 0x40100000, 0x00108000, + }, + { + 0x04000001, 0x04040100, 0x00000100, 0x04000101, + 0x00040001, 0x04000000, 0x04000101, 0x00040100, + 0x04000100, 0x00040000, 0x04040000, 0x00000001, + 0x04040101, 0x00000101, 0x00000001, 0x04040001, + 0x00000000, 0x00040001, 0x04040100, 0x00000100, + 0x00000101, 0x04040101, 0x00040000, 0x04000001, + 0x04040001, 0x04000100, 0x00040101, 0x04040000, + 0x00040100, 0x00000000, 0x04000000, 0x00040101, + 0x04040100, 0x00000100, 0x00000001, 0x00040000, + 0x00000101, 0x00040001, 0x04040000, 0x04000101, + 0x00000000, 0x04040100, 0x00040100, 0x04040001, + 0x00040001, 0x04000000, 0x04040101, 0x00000001, + 0x00040101, 0x04000001, 0x04000000, 0x04040101, + 0x00040000, 0x04000100, 0x04000101, 0x00040100, + 0x04000100, 0x00000000, 0x04040001, 0x00000101, + 0x04000001, 0x00040101, 0x00000100, 0x04040000, + }, + { + 0x00401008, 0x10001000, 0x00000008, 0x10401008, + 0x00000000, 0x10400000, 0x10001008, 0x00400008, + 0x10401000, 0x10000008, 0x10000000, 0x00001008, + 0x10000008, 0x00401008, 0x00400000, 0x10000000, + 0x10400008, 0x00401000, 0x00001000, 0x00000008, + 0x00401000, 0x10001008, 0x10400000, 0x00001000, + 0x00001008, 0x00000000, 0x00400008, 0x10401000, + 0x10001000, 0x10400008, 0x10401008, 0x00400000, + 0x10400008, 0x00001008, 0x00400000, 0x10000008, + 0x00401000, 0x10001000, 0x00000008, 0x10400000, + 0x10001008, 0x00000000, 0x00001000, 0x00400008, + 0x00000000, 0x10400008, 0x10401000, 0x00001000, + 0x10000000, 0x10401008, 0x00401008, 0x00400000, + 0x10401008, 0x00000008, 0x10001000, 0x00401008, + 0x00400008, 0x00401000, 0x10400000, 0x10001008, + 0x00001008, 0x10000000, 0x10000008, 0x10401000, + }, + { + 0x08000000, 0x00010000, 0x00000400, 0x08010420, + 0x08010020, 0x08000400, 0x00010420, 0x08010000, + 0x00010000, 0x00000020, 0x08000020, 0x00010400, + 0x08000420, 0x08010020, 0x08010400, 0x00000000, + 0x00010400, 0x08000000, 0x00010020, 0x00000420, + 0x08000400, 0x00010420, 0x00000000, 0x08000020, + 0x00000020, 0x08000420, 0x08010420, 0x00010020, + 0x08010000, 0x00000400, 0x00000420, 0x08010400, + 0x08010400, 0x08000420, 0x00010020, 0x08010000, + 0x00010000, 0x00000020, 0x08000020, 0x08000400, + 0x08000000, 0x00010400, 0x08010420, 0x00000000, + 0x00010420, 0x08000000, 0x00000400, 0x00010020, + 0x08000420, 0x00000400, 0x00000000, 0x08010420, + 0x08010020, 0x08010400, 0x00000420, 0x00010000, + 0x00010400, 0x08010020, 0x08000400, 0x00000420, + 0x00000020, 0x00010420, 0x08010000, 0x08000020, + }, + { + 0x80000040, 0x00200040, 0x00000000, 0x80202000, + 0x00200040, 0x00002000, 0x80002040, 0x00200000, + 0x00002040, 0x80202040, 0x00202000, 0x80000000, + 0x80002000, 0x80000040, 0x80200000, 0x00202040, + 0x00200000, 0x80002040, 0x80200040, 0x00000000, + 0x00002000, 0x00000040, 0x80202000, 0x80200040, + 0x80202040, 0x80200000, 0x80000000, 0x00002040, + 0x00000040, 0x00202000, 0x00202040, 0x80002000, + 0x00002040, 0x80000000, 0x80002000, 0x00202040, + 0x80202000, 0x00200040, 0x00000000, 0x80002000, + 0x80000000, 0x00002000, 0x80200040, 0x00200000, + 0x00200040, 0x80202040, 0x00202000, 0x00000040, + 0x80202040, 0x00202000, 0x00200000, 0x80002040, + 0x80000040, 0x80200000, 0x00202040, 0x00000000, + 0x00002000, 0x80000040, 0x80002040, 0x80202000, + 0x80200000, 0x00002040, 0x00000040, 0x80200040, + }, + { + 0x00004000, 0x00000200, 0x01000200, 0x01000004, + 0x01004204, 0x00004004, 0x00004200, 0x00000000, + 0x01000000, 0x01000204, 0x00000204, 0x01004000, + 0x00000004, 0x01004200, 0x01004000, 0x00000204, + 0x01000204, 0x00004000, 0x00004004, 0x01004204, + 0x00000000, 0x01000200, 0x01000004, 0x00004200, + 0x01004004, 0x00004204, 0x01004200, 0x00000004, + 0x00004204, 0x01004004, 0x00000200, 0x01000000, + 0x00004204, 0x01004000, 0x01004004, 0x00000204, + 0x00004000, 0x00000200, 0x01000000, 0x01004004, + 0x01000204, 0x00004204, 0x00004200, 0x00000000, + 0x00000200, 0x01000004, 0x00000004, 0x01000200, + 0x00000000, 0x01000204, 0x01000200, 0x00004200, + 0x00000204, 0x00004000, 0x01004204, 0x01000000, + 0x01004200, 0x00000004, 0x00004004, 0x01004204, + 0x01000004, 0x01004200, 0x01004000, 0x00004004, + }, + { + 0x20800080, 0x20820000, 0x00020080, 0x00000000, + 0x20020000, 0x00800080, 0x20800000, 0x20820080, + 0x00000080, 0x20000000, 0x00820000, 0x00020080, + 0x00820080, 0x20020080, 0x20000080, 0x20800000, + 0x00020000, 0x00820080, 0x00800080, 0x20020000, + 0x20820080, 0x20000080, 0x00000000, 0x00820000, + 0x20000000, 0x00800000, 0x20020080, 0x20800080, + 0x00800000, 0x00020000, 0x20820000, 0x00000080, + 0x00800000, 0x00020000, 0x20000080, 0x20820080, + 0x00020080, 0x20000000, 0x00000000, 0x00820000, + 0x20800080, 0x20020080, 0x20020000, 0x00800080, + 0x20820000, 0x00000080, 0x00800080, 0x20020000, + 0x20820080, 0x00800000, 0x20800000, 0x20000080, + 0x00820000, 0x00020080, 0x20020080, 0x20800000, + 0x00000080, 0x20820000, 0x00820080, 0x00000000, + 0x20000000, 0x20800080, 0x00020000, 0x00820080, + } +}; + +CONSTANT_VK u32a c_skb[8][64] = +{ + { + 0x00000000, 0x00000010, 0x20000000, 0x20000010, + 0x00010000, 0x00010010, 0x20010000, 0x20010010, + 0x00000800, 0x00000810, 0x20000800, 0x20000810, + 0x00010800, 0x00010810, 0x20010800, 0x20010810, + 0x00000020, 0x00000030, 0x20000020, 0x20000030, + 0x00010020, 0x00010030, 0x20010020, 0x20010030, + 0x00000820, 0x00000830, 0x20000820, 0x20000830, + 0x00010820, 0x00010830, 0x20010820, 0x20010830, + 0x00080000, 0x00080010, 0x20080000, 0x20080010, + 0x00090000, 0x00090010, 0x20090000, 0x20090010, + 0x00080800, 0x00080810, 0x20080800, 0x20080810, + 0x00090800, 0x00090810, 0x20090800, 0x20090810, + 0x00080020, 0x00080030, 0x20080020, 0x20080030, + 0x00090020, 0x00090030, 0x20090020, 0x20090030, + 0x00080820, 0x00080830, 0x20080820, 0x20080830, + 0x00090820, 0x00090830, 0x20090820, 0x20090830, + }, + { + 0x00000000, 0x02000000, 0x00002000, 0x02002000, + 0x00200000, 0x02200000, 0x00202000, 0x02202000, + 0x00000004, 0x02000004, 0x00002004, 0x02002004, + 0x00200004, 0x02200004, 0x00202004, 0x02202004, + 0x00000400, 0x02000400, 0x00002400, 0x02002400, + 0x00200400, 0x02200400, 0x00202400, 0x02202400, + 0x00000404, 0x02000404, 0x00002404, 0x02002404, + 0x00200404, 0x02200404, 0x00202404, 0x02202404, + 0x10000000, 0x12000000, 0x10002000, 0x12002000, + 0x10200000, 0x12200000, 0x10202000, 0x12202000, + 0x10000004, 0x12000004, 0x10002004, 0x12002004, + 0x10200004, 0x12200004, 0x10202004, 0x12202004, + 0x10000400, 0x12000400, 0x10002400, 0x12002400, + 0x10200400, 0x12200400, 0x10202400, 0x12202400, + 0x10000404, 0x12000404, 0x10002404, 0x12002404, + 0x10200404, 0x12200404, 0x10202404, 0x12202404, + }, + { + 0x00000000, 0x00000001, 0x00040000, 0x00040001, + 0x01000000, 0x01000001, 0x01040000, 0x01040001, + 0x00000002, 0x00000003, 0x00040002, 0x00040003, + 0x01000002, 0x01000003, 0x01040002, 0x01040003, + 0x00000200, 0x00000201, 0x00040200, 0x00040201, + 0x01000200, 0x01000201, 0x01040200, 0x01040201, + 0x00000202, 0x00000203, 0x00040202, 0x00040203, + 0x01000202, 0x01000203, 0x01040202, 0x01040203, + 0x08000000, 0x08000001, 0x08040000, 0x08040001, + 0x09000000, 0x09000001, 0x09040000, 0x09040001, + 0x08000002, 0x08000003, 0x08040002, 0x08040003, + 0x09000002, 0x09000003, 0x09040002, 0x09040003, + 0x08000200, 0x08000201, 0x08040200, 0x08040201, + 0x09000200, 0x09000201, 0x09040200, 0x09040201, + 0x08000202, 0x08000203, 0x08040202, 0x08040203, + 0x09000202, 0x09000203, 0x09040202, 0x09040203, + }, + { + 0x00000000, 0x00100000, 0x00000100, 0x00100100, + 0x00000008, 0x00100008, 0x00000108, 0x00100108, + 0x00001000, 0x00101000, 0x00001100, 0x00101100, + 0x00001008, 0x00101008, 0x00001108, 0x00101108, + 0x04000000, 0x04100000, 0x04000100, 0x04100100, + 0x04000008, 0x04100008, 0x04000108, 0x04100108, + 0x04001000, 0x04101000, 0x04001100, 0x04101100, + 0x04001008, 0x04101008, 0x04001108, 0x04101108, + 0x00020000, 0x00120000, 0x00020100, 0x00120100, + 0x00020008, 0x00120008, 0x00020108, 0x00120108, + 0x00021000, 0x00121000, 0x00021100, 0x00121100, + 0x00021008, 0x00121008, 0x00021108, 0x00121108, + 0x04020000, 0x04120000, 0x04020100, 0x04120100, + 0x04020008, 0x04120008, 0x04020108, 0x04120108, + 0x04021000, 0x04121000, 0x04021100, 0x04121100, + 0x04021008, 0x04121008, 0x04021108, 0x04121108, + }, + { + 0x00000000, 0x10000000, 0x00010000, 0x10010000, + 0x00000004, 0x10000004, 0x00010004, 0x10010004, + 0x20000000, 0x30000000, 0x20010000, 0x30010000, + 0x20000004, 0x30000004, 0x20010004, 0x30010004, + 0x00100000, 0x10100000, 0x00110000, 0x10110000, + 0x00100004, 0x10100004, 0x00110004, 0x10110004, + 0x20100000, 0x30100000, 0x20110000, 0x30110000, + 0x20100004, 0x30100004, 0x20110004, 0x30110004, + 0x00001000, 0x10001000, 0x00011000, 0x10011000, + 0x00001004, 0x10001004, 0x00011004, 0x10011004, + 0x20001000, 0x30001000, 0x20011000, 0x30011000, + 0x20001004, 0x30001004, 0x20011004, 0x30011004, + 0x00101000, 0x10101000, 0x00111000, 0x10111000, + 0x00101004, 0x10101004, 0x00111004, 0x10111004, + 0x20101000, 0x30101000, 0x20111000, 0x30111000, + 0x20101004, 0x30101004, 0x20111004, 0x30111004, + }, + { + 0x00000000, 0x08000000, 0x00000008, 0x08000008, + 0x00000400, 0x08000400, 0x00000408, 0x08000408, + 0x00020000, 0x08020000, 0x00020008, 0x08020008, + 0x00020400, 0x08020400, 0x00020408, 0x08020408, + 0x00000001, 0x08000001, 0x00000009, 0x08000009, + 0x00000401, 0x08000401, 0x00000409, 0x08000409, + 0x00020001, 0x08020001, 0x00020009, 0x08020009, + 0x00020401, 0x08020401, 0x00020409, 0x08020409, + 0x02000000, 0x0A000000, 0x02000008, 0x0A000008, + 0x02000400, 0x0A000400, 0x02000408, 0x0A000408, + 0x02020000, 0x0A020000, 0x02020008, 0x0A020008, + 0x02020400, 0x0A020400, 0x02020408, 0x0A020408, + 0x02000001, 0x0A000001, 0x02000009, 0x0A000009, + 0x02000401, 0x0A000401, 0x02000409, 0x0A000409, + 0x02020001, 0x0A020001, 0x02020009, 0x0A020009, + 0x02020401, 0x0A020401, 0x02020409, 0x0A020409, + }, + { + 0x00000000, 0x00000100, 0x00080000, 0x00080100, + 0x01000000, 0x01000100, 0x01080000, 0x01080100, + 0x00000010, 0x00000110, 0x00080010, 0x00080110, + 0x01000010, 0x01000110, 0x01080010, 0x01080110, + 0x00200000, 0x00200100, 0x00280000, 0x00280100, + 0x01200000, 0x01200100, 0x01280000, 0x01280100, + 0x00200010, 0x00200110, 0x00280010, 0x00280110, + 0x01200010, 0x01200110, 0x01280010, 0x01280110, + 0x00000200, 0x00000300, 0x00080200, 0x00080300, + 0x01000200, 0x01000300, 0x01080200, 0x01080300, + 0x00000210, 0x00000310, 0x00080210, 0x00080310, + 0x01000210, 0x01000310, 0x01080210, 0x01080310, + 0x00200200, 0x00200300, 0x00280200, 0x00280300, + 0x01200200, 0x01200300, 0x01280200, 0x01280300, + 0x00200210, 0x00200310, 0x00280210, 0x00280310, + 0x01200210, 0x01200310, 0x01280210, 0x01280310, + }, + { + 0x00000000, 0x04000000, 0x00040000, 0x04040000, + 0x00000002, 0x04000002, 0x00040002, 0x04040002, + 0x00002000, 0x04002000, 0x00042000, 0x04042000, + 0x00002002, 0x04002002, 0x00042002, 0x04042002, + 0x00000020, 0x04000020, 0x00040020, 0x04040020, + 0x00000022, 0x04000022, 0x00040022, 0x04040022, + 0x00002020, 0x04002020, 0x00042020, 0x04042020, + 0x00002022, 0x04002022, 0x00042022, 0x04042022, + 0x00000800, 0x04000800, 0x00040800, 0x04040800, + 0x00000802, 0x04000802, 0x00040802, 0x04040802, + 0x00002800, 0x04002800, 0x00042800, 0x04042800, + 0x00002802, 0x04002802, 0x00042802, 0x04042802, + 0x00000820, 0x04000820, 0x00040820, 0x04040820, + 0x00000822, 0x04000822, 0x00040822, 0x04040822, + 0x00002820, 0x04002820, 0x00042820, 0x04042820, + 0x00002822, 0x04002822, 0x00042822, 0x04042822 + } +}; + +#if VECT_SIZE == 1 +#define BOX(i,n,S) (S)[(n)][(i)] +#elif VECT_SIZE == 2 +#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1]) +#elif VECT_SIZE == 4 +#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3]) +#elif VECT_SIZE == 8 +#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7]) +#elif VECT_SIZE == 16 +#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7], (S)[(n)][(i).s8], (S)[(n)][(i).s9], (S)[(n)][(i).sa], (S)[(n)][(i).sb], (S)[(n)][(i).sc], (S)[(n)][(i).sd], (S)[(n)][(i).se], (S)[(n)][(i).sf]) +#endif + +DECLSPEC void _des_crypt_encrypt (u32 *iv, u32 *data, u32 *Kc, u32 *Kd, SHM_TYPE u32 (*s_SPtrans)[64]) +{ + u32 r = data[0]; + u32 l = data[1]; + + #ifdef _unroll + #pragma unroll + #endif + for (u32 i = 0; i < 16; i += 2) + { + u32 u; + u32 t; + + u = Kc[i + 0] ^ hc_rotl32 (r, 30u); + t = Kd[i + 0] ^ hc_rotl32 (r, 26u); + + l ^= BOX (((u >> 0) & 0x3f), 0, s_SPtrans) + | BOX (((u >> 8) & 0x3f), 2, s_SPtrans) + | BOX (((u >> 16) & 0x3f), 4, s_SPtrans) + | BOX (((u >> 24) & 0x3f), 6, s_SPtrans) + | BOX (((t >> 0) & 0x3f), 1, s_SPtrans) + | BOX (((t >> 8) & 0x3f), 3, s_SPtrans) + | BOX (((t >> 16) & 0x3f), 5, s_SPtrans) + | BOX (((t >> 24) & 0x3f), 7, s_SPtrans); + + u = Kc[i + 1] ^ hc_rotl32 (l, 30u); + t = Kd[i + 1] ^ hc_rotl32 (l, 26u); + + r ^= BOX (((u >> 0) & 0x3f), 0, s_SPtrans) + | BOX (((u >> 8) & 0x3f), 2, s_SPtrans) + | BOX (((u >> 16) & 0x3f), 4, s_SPtrans) + | BOX (((u >> 24) & 0x3f), 6, s_SPtrans) + | BOX (((t >> 0) & 0x3f), 1, s_SPtrans) + | BOX (((t >> 8) & 0x3f), 3, s_SPtrans) + | BOX (((t >> 16) & 0x3f), 5, s_SPtrans) + | BOX (((t >> 24) & 0x3f), 7, s_SPtrans); + } + + iv[0] = l; + iv[1] = r; +} + +DECLSPEC void _des_crypt_keysetup (u32 c, u32 d, u32 *Kc, u32 *Kd, SHM_TYPE u32 (*s_skb)[64]) +{ + u32 tt; + + PERM_OP (d, c, tt, 4, 0x0f0f0f0f); + HPERM_OP (c, tt, 2, 0xcccc0000); + HPERM_OP (d, tt, 2, 0xcccc0000); + PERM_OP (d, c, tt, 1, 0x55555555); + PERM_OP (c, d, tt, 8, 0x00ff00ff); + PERM_OP (d, c, tt, 1, 0x55555555); + + d = ((d & 0x000000ff) << 16) + | ((d & 0x0000ff00) << 0) + | ((d & 0x00ff0000) >> 16) + | ((c & 0xf0000000) >> 4); + + c = c & 0x0fffffff; + + #ifdef _unroll + #pragma unroll + #endif + for (u32 i = 0; i < 16; i++) + { + if ((i < 2) || (i == 8) || (i == 15)) + { + c = ((c >> 1) | (c << 27)); + d = ((d >> 1) | (d << 27)); + } + else + { + c = ((c >> 2) | (c << 26)); + d = ((d >> 2) | (d << 26)); + } + + c = c & 0x0fffffff; + d = d & 0x0fffffff; + + const u32 c00 = (c >> 0) & 0x0000003f; + const u32 c06 = (c >> 6) & 0x00383003; + const u32 c07 = (c >> 7) & 0x0000003c; + const u32 c13 = (c >> 13) & 0x0000060f; + const u32 c20 = (c >> 20) & 0x00000001; + + u32 s = BOX (((c00 >> 0) & 0xff), 0, s_skb) + | BOX (((c06 >> 0) & 0xff) + |((c07 >> 0) & 0xff), 1, s_skb) + | BOX (((c13 >> 0) & 0xff) + |((c06 >> 8) & 0xff), 2, s_skb) + | BOX (((c20 >> 0) & 0xff) + |((c13 >> 8) & 0xff) + |((c06 >> 16) & 0xff), 3, s_skb); + + const u32 d00 = (d >> 0) & 0x00003c3f; + const u32 d07 = (d >> 7) & 0x00003f03; + const u32 d21 = (d >> 21) & 0x0000000f; + const u32 d22 = (d >> 22) & 0x00000030; + + u32 t = BOX (((d00 >> 0) & 0xff), 4, s_skb) + | BOX (((d07 >> 0) & 0xff) + |((d00 >> 8) & 0xff), 5, s_skb) + | BOX (((d07 >> 8) & 0xff), 6, s_skb) + | BOX (((d21 >> 0) & 0xff) + |((d22 >> 0) & 0xff), 7, s_skb); + + Kc[i] = ((t << 16) | (s & 0x0000ffff)); + Kd[i] = ((s >> 16) | (t & 0xffff0000)); + } +} + +DECLSPEC void transform_netntlmv1_key (const u32 w0, const u32 w1, u32 *out) +{ + u32 t[8]; + + t[0] = (w0 >> 0) & 0xff; + t[1] = (w0 >> 8) & 0xff; + t[2] = (w0 >> 16) & 0xff; + t[3] = (w0 >> 24) & 0xff; + t[4] = (w1 >> 0) & 0xff; + t[5] = (w1 >> 8) & 0xff; + t[6] = (w1 >> 16) & 0xff; + t[7] = (w1 >> 24) & 0xff; + + u32 k[8]; + + k[0] = (t[0] >> 0); + k[1] = (t[0] << 7) | (t[1] >> 1); + k[2] = (t[1] << 6) | (t[2] >> 2); + k[3] = (t[2] << 5) | (t[3] >> 3); + k[4] = (t[3] << 4) | (t[4] >> 4); + k[5] = (t[4] << 3) | (t[5] >> 5); + k[6] = (t[5] << 2) | (t[6] >> 6); + k[7] = (t[6] << 1); + + out[0] = ((k[0] & 0xff) << 0) + | ((k[1] & 0xff) << 8) + | ((k[2] & 0xff) << 16) + | ((k[3] & 0xff) << 24); + + out[1] = ((k[4] & 0xff) << 0) + | ((k[5] & 0xff) << 8) + | ((k[6] & 0xff) << 16) + | ((k[7] & 0xff) << 24); +} + +KERNEL_FQ void m05510_mxx (KERN_ATTR_RULES ()) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * sbox, kbox + */ + + #ifdef REAL_SHM + + LOCAL_VK u32 s_SPtrans[8][64]; + LOCAL_VK u32 s_skb[8][64]; + + for (u32 i = lid; i < 64; i += lsz) + { + s_SPtrans[0][i] = c_SPtrans[0][i]; + s_SPtrans[1][i] = c_SPtrans[1][i]; + s_SPtrans[2][i] = c_SPtrans[2][i]; + s_SPtrans[3][i] = c_SPtrans[3][i]; + s_SPtrans[4][i] = c_SPtrans[4][i]; + s_SPtrans[5][i] = c_SPtrans[5][i]; + s_SPtrans[6][i] = c_SPtrans[6][i]; + s_SPtrans[7][i] = c_SPtrans[7][i]; + + s_skb[0][i] = c_skb[0][i]; + s_skb[1][i] = c_skb[1][i]; + s_skb[2][i] = c_skb[2][i]; + s_skb[3][i] = c_skb[3][i]; + s_skb[4][i] = c_skb[4][i]; + s_skb[5][i] = c_skb[5][i]; + s_skb[6][i] = c_skb[6][i]; + s_skb[7][i] = c_skb[7][i]; + } + + SYNC_THREADS (); + + #else + + CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; + CONSTANT_AS u32a (*s_skb)[64] = c_skb; + + #endif + + if (gid >= gid_max) return; + + /** + * salt + */ + + const u32 s0 = salt_bufs[SALT_POS].salt_buf[0]; + const u32 s1 = salt_bufs[SALT_POS].salt_buf[1]; + const u32 s2 = salt_bufs[SALT_POS].salt_buf[2]; + + /** + * base + */ + + const u32 a = pws[gid].i[ 0]; + const u32 b = pws[gid].i[ 1]; + const u32 c = pws[gid].i[ 2]; + const u32 d = pws[gid].i[ 3]; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) + { + + if ((d >> 16) != s2) continue; + + /** + * DES1 + */ + + u32 key[2]; + + transform_netntlmv1_key (a, b, key); + + u32 Kc[16]; + u32 Kd[16]; + + _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); + + u32 data[2]; + + data[0] = s0; + data[1] = s1; + + u32 out1[2]; + + _des_crypt_encrypt (out1, data, Kc, Kd, s_SPtrans); + + /** + * DES2 + */ + + transform_netntlmv1_key (((b >> 24) | (c << 8)), ((c >> 24) | (d << 8)), key); + + _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); + + u32 out2[2]; + + _des_crypt_encrypt (out2, data, Kc, Kd, s_SPtrans); + + const u32 r0 = out1[0]; + const u32 r1 = out1[1]; + const u32 r2 = out2[0]; + const u32 r3 = out2[1]; + + COMPARE_M_SCALAR (r0, r1, r2, r3); + } +} + +KERNEL_FQ void m05510_sxx (KERN_ATTR_RULES ()) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * sbox, kbox + */ + + #ifdef REAL_SHM + + LOCAL_VK u32 s_SPtrans[8][64]; + LOCAL_VK u32 s_skb[8][64]; + + for (u32 i = lid; i < 64; i += lsz) + { + s_SPtrans[0][i] = c_SPtrans[0][i]; + s_SPtrans[1][i] = c_SPtrans[1][i]; + s_SPtrans[2][i] = c_SPtrans[2][i]; + s_SPtrans[3][i] = c_SPtrans[3][i]; + s_SPtrans[4][i] = c_SPtrans[4][i]; + s_SPtrans[5][i] = c_SPtrans[5][i]; + s_SPtrans[6][i] = c_SPtrans[6][i]; + s_SPtrans[7][i] = c_SPtrans[7][i]; + + s_skb[0][i] = c_skb[0][i]; + s_skb[1][i] = c_skb[1][i]; + s_skb[2][i] = c_skb[2][i]; + s_skb[3][i] = c_skb[3][i]; + s_skb[4][i] = c_skb[4][i]; + s_skb[5][i] = c_skb[5][i]; + s_skb[6][i] = c_skb[6][i]; + s_skb[7][i] = c_skb[7][i]; + } + + SYNC_THREADS (); + + #else + + CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; + CONSTANT_AS u32a (*s_skb)[64] = c_skb; + + #endif + + 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] + }; + + /** + * salt + */ + + const u32 s0 = salt_bufs[SALT_POS].salt_buf[0]; + const u32 s1 = salt_bufs[SALT_POS].salt_buf[1]; + const u32 s2 = salt_bufs[SALT_POS].salt_buf[2]; + + /** + * base + */ + + const u32 a = pws[gid].i[ 0]; + const u32 b = pws[gid].i[ 1]; + const u32 c = pws[gid].i[ 2]; + const u32 d = pws[gid].i[ 3]; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) + { + + if ((d >> 16) != s2) continue; + + /** + * DES1 + */ + + u32 key[2]; + + transform_netntlmv1_key (a, b, key); + + u32 Kc[16]; + u32 Kd[16]; + + _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); + + u32 data[2]; + + data[0] = s0; + data[1] = s1; + + u32 out1[2]; + + _des_crypt_encrypt (out1, data, Kc, Kd, s_SPtrans); + + /** + * DES2 + */ + + /* + transform_netntlmv1_key (((b >> 24) | (c << 8)), ((c >> 24) | (d << 8)), key); + + _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); + + u32 out2[2]; + + _des_crypt_encrypt (out2, data, Kc, Kd, s_SPtrans); + */ + + const u32 r0 = out1[0]; + const u32 r1 = out1[1]; + const u32 r2 = search[2]; + const u32 r3 = search[3]; + + COMPARE_S_SCALAR (r0, r1, r2, r3); + } +} diff --git a/OpenCL/m05610_a0-optimized.cl b/OpenCL/m05610_a0-optimized.cl new file mode 100644 index 000000000..8260b9159 --- /dev/null +++ b/OpenCL/m05610_a0-optimized.cl @@ -0,0 +1,610 @@ +/** + * 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_optimized.h" +#include "inc_rp_optimized.cl" +#include "inc_simd.cl" +#include "inc_hash_md4.cl" +#include "inc_hash_md5.cl" +#endif + +typedef struct netntlm +{ + u32 user_len; + u32 domain_len; + u32 srvchall_len; + u32 clichall_len; + + u32 userdomain_buf[64]; + u32 chall_buf[256]; + +} netntlm_t; + +DECLSPEC void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad) +{ + w0[0] = w0[0] ^ 0x36363636; + w0[1] = w0[1] ^ 0x36363636; + w0[2] = w0[2] ^ 0x36363636; + w0[3] = w0[3] ^ 0x36363636; + w1[0] = w1[0] ^ 0x36363636; + w1[1] = w1[1] ^ 0x36363636; + w1[2] = w1[2] ^ 0x36363636; + w1[3] = w1[3] ^ 0x36363636; + w2[0] = w2[0] ^ 0x36363636; + w2[1] = w2[1] ^ 0x36363636; + w2[2] = w2[2] ^ 0x36363636; + w2[3] = w2[3] ^ 0x36363636; + w3[0] = w3[0] ^ 0x36363636; + w3[1] = w3[1] ^ 0x36363636; + w3[2] = w3[2] ^ 0x36363636; + w3[3] = w3[3] ^ 0x36363636; + + ipad[0] = MD5M_A; + ipad[1] = MD5M_B; + ipad[2] = MD5M_C; + ipad[3] = MD5M_D; + + md5_transform_vector (w0, w1, w2, w3, ipad); + + w0[0] = w0[0] ^ 0x6a6a6a6a; + w0[1] = w0[1] ^ 0x6a6a6a6a; + w0[2] = w0[2] ^ 0x6a6a6a6a; + w0[3] = w0[3] ^ 0x6a6a6a6a; + w1[0] = w1[0] ^ 0x6a6a6a6a; + w1[1] = w1[1] ^ 0x6a6a6a6a; + w1[2] = w1[2] ^ 0x6a6a6a6a; + w1[3] = w1[3] ^ 0x6a6a6a6a; + w2[0] = w2[0] ^ 0x6a6a6a6a; + w2[1] = w2[1] ^ 0x6a6a6a6a; + w2[2] = w2[2] ^ 0x6a6a6a6a; + w2[3] = w2[3] ^ 0x6a6a6a6a; + w3[0] = w3[0] ^ 0x6a6a6a6a; + w3[1] = w3[1] ^ 0x6a6a6a6a; + w3[2] = w3[2] ^ 0x6a6a6a6a; + w3[3] = w3[3] ^ 0x6a6a6a6a; + + opad[0] = MD5M_A; + opad[1] = MD5M_B; + opad[2] = MD5M_C; + opad[3] = MD5M_D; + + md5_transform_vector (w0, w1, w2, w3, opad); +} + +DECLSPEC void hmac_md5_run (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]; + + md5_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] = 0x80; + 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] = (64 + 16) * 8; + w3[3] = 0; + + digest[0] = opad[0]; + digest[1] = opad[1]; + digest[2] = opad[2]; + digest[3] = opad[3]; + + md5_transform_vector (w0, w1, w2, w3, digest); +} + +KERNEL_FQ void m05610_m04 (KERN_ATTR_RULES_ESALT (netntlm_t)) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * salt + */ + + LOCAL_VK u32 s_userdomain_buf[64]; + + for (u32 i = lid; i < 64; i += lsz) + { + s_userdomain_buf[i] = esalt_bufs[DIGESTS_OFFSET].userdomain_buf[i]; + } + + LOCAL_VK u32 s_chall_buf[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_chall_buf[i] = esalt_bufs[DIGESTS_OFFSET].chall_buf[i]; + } + + SYNC_THREADS (); + + if (gid >= gid_max) return; + + const u32 userdomain_len = esalt_bufs[DIGESTS_OFFSET].user_len + + esalt_bufs[DIGESTS_OFFSET].domain_len; + + const u32 chall_len = esalt_bufs[DIGESTS_OFFSET].srvchall_len + + esalt_bufs[DIGESTS_OFFSET].clichall_len; + + /** + * base + */ + + // u32 pw_buf0[4]; + // u32 pw_buf1[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]; + // pw_buf1[0] = pws[gid].i[4]; + // pw_buf1[1] = pws[gid].i[5]; + // pw_buf1[2] = pws[gid].i[6]; + // pw_buf1[3] = pws[gid].i[7]; + + // const u32 pw_len = pws[gid].pw_len & 63; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE) + { + // u32x w0[4] = { 0 }; + // u32x w1[4] = { 0 }; + // u32x w2[4] = { 0 }; + // u32x w3[4] = { 0 }; + + // const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); + + // append_0x80_2x4_VV (w0, w1, out_len); + + u32x w0_t[4]; + u32x w1_t[4]; + u32x w2_t[4]; + u32x w3_t[4]; + + // make_utf16le (w0, w0_t, w1_t); + // make_utf16le (w1, w2_t, w3_t); + + // w3_t[2] = out_len * 8 * 2; + // w3_t[3] = 0; + + + // digest[0] = pws[gid].i[ 0]; + // digest[1] = pws[gid].i[ 1];; + // digest[2] = pws[gid].i[ 2];; + // digest[3] = pws[gid].i[ 3];; + + + // md4_transform_vector (w0_t, w1_t, w2_t, w3_t, digest); + + w0_t[0] = pws[gid].i[ 0]; + w0_t[1] = pws[gid].i[ 1]; + w0_t[2] = pws[gid].i[ 2]; + w0_t[3] = pws[gid].i[ 3]; + w1_t[0] = 0; + w1_t[1] = 0; + w1_t[2] = 0; + w1_t[3] = 0; + w2_t[0] = 0; + w2_t[1] = 0; + w2_t[2] = 0; + w2_t[3] = 0; + w3_t[0] = 0; + w3_t[1] = 0; + w3_t[2] = 0; + w3_t[3] = 0; + + u32x digest[4]; + + digest[0] = MD5M_A; + digest[1] = MD5M_B; + digest[2] = MD5M_C; + digest[3] = MD5M_D; + + u32x ipad[4]; + u32x opad[4]; + + hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad); + + int left; + int off; + + for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16) + { + w0_t[0] = s_userdomain_buf[off + 0]; + w0_t[1] = s_userdomain_buf[off + 1]; + w0_t[2] = s_userdomain_buf[off + 2]; + w0_t[3] = s_userdomain_buf[off + 3]; + w1_t[0] = s_userdomain_buf[off + 4]; + w1_t[1] = s_userdomain_buf[off + 5]; + w1_t[2] = s_userdomain_buf[off + 6]; + w1_t[3] = s_userdomain_buf[off + 7]; + w2_t[0] = s_userdomain_buf[off + 8]; + w2_t[1] = s_userdomain_buf[off + 9]; + w2_t[2] = s_userdomain_buf[off + 10]; + w2_t[3] = s_userdomain_buf[off + 11]; + w3_t[0] = s_userdomain_buf[off + 12]; + w3_t[1] = s_userdomain_buf[off + 13]; + w3_t[2] = s_userdomain_buf[off + 14]; + w3_t[3] = s_userdomain_buf[off + 15]; + + md5_transform_vector (w0_t, w1_t, w2_t, w3_t, ipad); + } + + w0_t[0] = s_userdomain_buf[off + 0]; + w0_t[1] = s_userdomain_buf[off + 1]; + w0_t[2] = s_userdomain_buf[off + 2]; + w0_t[3] = s_userdomain_buf[off + 3]; + w1_t[0] = s_userdomain_buf[off + 4]; + w1_t[1] = s_userdomain_buf[off + 5]; + w1_t[2] = s_userdomain_buf[off + 6]; + w1_t[3] = s_userdomain_buf[off + 7]; + w2_t[0] = s_userdomain_buf[off + 8]; + w2_t[1] = s_userdomain_buf[off + 9]; + w2_t[2] = s_userdomain_buf[off + 10]; + w2_t[3] = s_userdomain_buf[off + 11]; + w3_t[0] = s_userdomain_buf[off + 12]; + w3_t[1] = s_userdomain_buf[off + 13]; + w3_t[2] = (64 + userdomain_len) * 8; + w3_t[3] = 0; + + hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest); + + w0_t[0] = digest[0]; + w0_t[1] = digest[1]; + w0_t[2] = digest[2]; + w0_t[3] = digest[3]; + w1_t[0] = 0; + w1_t[1] = 0; + w1_t[2] = 0; + w1_t[3] = 0; + w2_t[0] = 0; + w2_t[1] = 0; + w2_t[2] = 0; + w2_t[3] = 0; + w3_t[0] = 0; + w3_t[1] = 0; + w3_t[2] = 0; + w3_t[3] = 0; + + digest[0] = MD5M_A; + digest[1] = MD5M_B; + digest[2] = MD5M_C; + digest[3] = MD5M_D; + + hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad); + + for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16) + { + w0_t[0] = s_chall_buf[off + 0]; + w0_t[1] = s_chall_buf[off + 1]; + w0_t[2] = s_chall_buf[off + 2]; + w0_t[3] = s_chall_buf[off + 3]; + w1_t[0] = s_chall_buf[off + 4]; + w1_t[1] = s_chall_buf[off + 5]; + w1_t[2] = s_chall_buf[off + 6]; + w1_t[3] = s_chall_buf[off + 7]; + w2_t[0] = s_chall_buf[off + 8]; + w2_t[1] = s_chall_buf[off + 9]; + w2_t[2] = s_chall_buf[off + 10]; + w2_t[3] = s_chall_buf[off + 11]; + w3_t[0] = s_chall_buf[off + 12]; + w3_t[1] = s_chall_buf[off + 13]; + w3_t[2] = s_chall_buf[off + 14]; + w3_t[3] = s_chall_buf[off + 15]; + + md5_transform_vector (w0_t, w1_t, w2_t, w3_t, ipad); + } + + w0_t[0] = s_chall_buf[off + 0]; + w0_t[1] = s_chall_buf[off + 1]; + w0_t[2] = s_chall_buf[off + 2]; + w0_t[3] = s_chall_buf[off + 3]; + w1_t[0] = s_chall_buf[off + 4]; + w1_t[1] = s_chall_buf[off + 5]; + w1_t[2] = s_chall_buf[off + 6]; + w1_t[3] = s_chall_buf[off + 7]; + w2_t[0] = s_chall_buf[off + 8]; + w2_t[1] = s_chall_buf[off + 9]; + w2_t[2] = s_chall_buf[off + 10]; + w2_t[3] = s_chall_buf[off + 11]; + w3_t[0] = s_chall_buf[off + 12]; + w3_t[1] = s_chall_buf[off + 13]; + w3_t[2] = (64 + chall_len) * 8; + w3_t[3] = 0; + + hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest); + + COMPARE_M_SIMD (digest[0], digest[3], digest[2], digest[1]); + } +} + +KERNEL_FQ void m05610_m08 (KERN_ATTR_RULES_ESALT (netntlm_t)) +{ +} + +KERNEL_FQ void m05610_m16 (KERN_ATTR_RULES_ESALT (netntlm_t)) +{ +} + +KERNEL_FQ void m05610_s04 (KERN_ATTR_RULES_ESALT (netntlm_t)) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * salt + */ + + LOCAL_VK u32 s_userdomain_buf[64]; + + for (u32 i = lid; i < 64; i += lsz) + { + s_userdomain_buf[i] = esalt_bufs[DIGESTS_OFFSET].userdomain_buf[i]; + } + + LOCAL_VK u32 s_chall_buf[256]; + + for (u32 i = lid; i < 256; i += lsz) + { + s_chall_buf[i] = esalt_bufs[DIGESTS_OFFSET].chall_buf[i]; + } + + SYNC_THREADS (); + + if (gid >= gid_max) return; + + const u32 userdomain_len = esalt_bufs[DIGESTS_OFFSET].user_len + + esalt_bufs[DIGESTS_OFFSET].domain_len; + + const u32 chall_len = esalt_bufs[DIGESTS_OFFSET].srvchall_len + + esalt_bufs[DIGESTS_OFFSET].clichall_len; + + /** + * base + */ + + // u32 pw_buf0[4]; + // u32 pw_buf1[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]; + // pw_buf1[0] = pws[gid].i[4]; + // pw_buf1[1] = pws[gid].i[5]; + // pw_buf1[2] = pws[gid].i[6]; + // pw_buf1[3] = pws[gid].i[7]; + + // const u32 pw_len = pws[gid].pw_len & 63; + + /** + * 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] + }; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE) + { + // u32x w0[4] = { 0 }; + // u32x w1[4] = { 0 }; + // u32x w2[4] = { 0 }; + // u32x w3[4] = { 0 }; + + // const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); + + // append_0x80_2x4_VV (w0, w1, out_len); + + u32x w0_t[4]; + u32x w1_t[4]; + u32x w2_t[4]; + u32x w3_t[4]; + + // make_utf16le (w0, w0_t, w1_t); + // make_utf16le (w1, w2_t, w3_t); + + // w3_t[2] = out_len * 8 * 2; + // w3_t[3] = 0; + + // u32x digest[4]; + + // digest[0] = pws[gid].i[ 0]; + // digest[1] = pws[gid].i[ 1]; + // digest[2] = pws[gid].i[ 2]; + // digest[3] = pws[gid].i[ 3]; + + // md4_transform_vector (w0_t, w1_t, w2_t, w3_t, digest); + + w0_t[0] = pws[gid].i[ 0]; + w0_t[1] = pws[gid].i[ 1]; + w0_t[2] = pws[gid].i[ 2]; + w0_t[3] = pws[gid].i[ 3]; + w1_t[0] = 0; + w1_t[1] = 0; + w1_t[2] = 0; + w1_t[3] = 0; + w2_t[0] = 0; + w2_t[1] = 0; + w2_t[2] = 0; + w2_t[3] = 0; + w3_t[0] = 0; + w3_t[1] = 0; + w3_t[2] = 0; + w3_t[3] = 0; + + u32x digest[4]; + + digest[0] = MD5M_A; + digest[1] = MD5M_B; + digest[2] = MD5M_C; + digest[3] = MD5M_D; + + + u32x ipad[4]; + u32x opad[4]; + + hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad); + + int left; + int off; + + for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16) + { + w0_t[0] = s_userdomain_buf[off + 0]; + w0_t[1] = s_userdomain_buf[off + 1]; + w0_t[2] = s_userdomain_buf[off + 2]; + w0_t[3] = s_userdomain_buf[off + 3]; + w1_t[0] = s_userdomain_buf[off + 4]; + w1_t[1] = s_userdomain_buf[off + 5]; + w1_t[2] = s_userdomain_buf[off + 6]; + w1_t[3] = s_userdomain_buf[off + 7]; + w2_t[0] = s_userdomain_buf[off + 8]; + w2_t[1] = s_userdomain_buf[off + 9]; + w2_t[2] = s_userdomain_buf[off + 10]; + w2_t[3] = s_userdomain_buf[off + 11]; + w3_t[0] = s_userdomain_buf[off + 12]; + w3_t[1] = s_userdomain_buf[off + 13]; + w3_t[2] = s_userdomain_buf[off + 14]; + w3_t[3] = s_userdomain_buf[off + 15]; + + md5_transform_vector (w0_t, w1_t, w2_t, w3_t, ipad); + } + + w0_t[0] = s_userdomain_buf[off + 0]; + w0_t[1] = s_userdomain_buf[off + 1]; + w0_t[2] = s_userdomain_buf[off + 2]; + w0_t[3] = s_userdomain_buf[off + 3]; + w1_t[0] = s_userdomain_buf[off + 4]; + w1_t[1] = s_userdomain_buf[off + 5]; + w1_t[2] = s_userdomain_buf[off + 6]; + w1_t[3] = s_userdomain_buf[off + 7]; + w2_t[0] = s_userdomain_buf[off + 8]; + w2_t[1] = s_userdomain_buf[off + 9]; + w2_t[2] = s_userdomain_buf[off + 10]; + w2_t[3] = s_userdomain_buf[off + 11]; + w3_t[0] = s_userdomain_buf[off + 12]; + w3_t[1] = s_userdomain_buf[off + 13]; + w3_t[2] = (64 + userdomain_len) * 8; + w3_t[3] = 0; + + hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest); + + w0_t[0] = digest[0]; + w0_t[1] = digest[1]; + w0_t[2] = digest[2]; + w0_t[3] = digest[3]; + w1_t[0] = 0; + w1_t[1] = 0; + w1_t[2] = 0; + w1_t[3] = 0; + w2_t[0] = 0; + w2_t[1] = 0; + w2_t[2] = 0; + w2_t[3] = 0; + w3_t[0] = 0; + w3_t[1] = 0; + w3_t[2] = 0; + w3_t[3] = 0; + + digest[0] = MD5M_A; + digest[1] = MD5M_B; + digest[2] = MD5M_C; + digest[3] = MD5M_D; + + hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad); + + for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16) + { + w0_t[0] = s_chall_buf[off + 0]; + w0_t[1] = s_chall_buf[off + 1]; + w0_t[2] = s_chall_buf[off + 2]; + w0_t[3] = s_chall_buf[off + 3]; + w1_t[0] = s_chall_buf[off + 4]; + w1_t[1] = s_chall_buf[off + 5]; + w1_t[2] = s_chall_buf[off + 6]; + w1_t[3] = s_chall_buf[off + 7]; + w2_t[0] = s_chall_buf[off + 8]; + w2_t[1] = s_chall_buf[off + 9]; + w2_t[2] = s_chall_buf[off + 10]; + w2_t[3] = s_chall_buf[off + 11]; + w3_t[0] = s_chall_buf[off + 12]; + w3_t[1] = s_chall_buf[off + 13]; + w3_t[2] = s_chall_buf[off + 14]; + w3_t[3] = s_chall_buf[off + 15]; + + md5_transform_vector (w0_t, w1_t, w2_t, w3_t, ipad); + } + + w0_t[0] = s_chall_buf[off + 0]; + w0_t[1] = s_chall_buf[off + 1]; + w0_t[2] = s_chall_buf[off + 2]; + w0_t[3] = s_chall_buf[off + 3]; + w1_t[0] = s_chall_buf[off + 4]; + w1_t[1] = s_chall_buf[off + 5]; + w1_t[2] = s_chall_buf[off + 6]; + w1_t[3] = s_chall_buf[off + 7]; + w2_t[0] = s_chall_buf[off + 8]; + w2_t[1] = s_chall_buf[off + 9]; + w2_t[2] = s_chall_buf[off + 10]; + w2_t[3] = s_chall_buf[off + 11]; + w3_t[0] = s_chall_buf[off + 12]; + w3_t[1] = s_chall_buf[off + 13]; + w3_t[2] = (64 + chall_len) * 8; + w3_t[3] = 0; + + hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest); + + COMPARE_S_SIMD (digest[0], digest[3], digest[2], digest[1]); + } +} + +KERNEL_FQ void m05610_s08 (KERN_ATTR_RULES_ESALT (netntlm_t)) +{ +} + +KERNEL_FQ void m05610_s16 (KERN_ATTR_RULES_ESALT (netntlm_t)) +{ +} diff --git a/OpenCL/m05610_a0-pure.cl b/OpenCL/m05610_a0-pure.cl new file mode 100644 index 000000000..69feb2c3e --- /dev/null +++ b/OpenCL/m05610_a0-pure.cl @@ -0,0 +1,214 @@ +/** + * 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_md4.cl" +#include "inc_hash_md5.cl" +#endif + +typedef struct netntlm +{ + u32 user_len; + u32 domain_len; + u32 srvchall_len; + u32 clichall_len; + + u32 userdomain_buf[64]; + u32 chall_buf[256]; + +} netntlm_t; + +KERNEL_FQ void m05610_mxx (KERN_ATTR_RULES_ESALT (netntlm_t)) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + /** + * base + */ + + u32 w0[4]; + u32 w1[4]; + u32 w2[4]; + u32 w3[4]; + + w0[0] = pws[gid].i[ 0]; + w0[1] = pws[gid].i[ 1]; + w0[2] = pws[gid].i[ 2]; + w0[3] = pws[gid].i[ 3]; + w1[0] = 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; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) + { + + md5_hmac_ctx_t ctx0; + + md5_hmac_init_64 (&ctx0, w0, w1, w2, w3); + + md5_hmac_update_global (&ctx0, esalt_bufs[DIGESTS_OFFSET].userdomain_buf, esalt_bufs[DIGESTS_OFFSET].user_len + esalt_bufs[DIGESTS_OFFSET].domain_len); + + md5_hmac_final (&ctx0); + + w0[0] = ctx0.opad.h[0]; + w0[1] = ctx0.opad.h[1]; + w0[2] = ctx0.opad.h[2]; + w0[3] = ctx0.opad.h[3]; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; + + md5_hmac_ctx_t ctx; + + md5_hmac_init_64 (&ctx, w0, w1, w2, w3); + + md5_hmac_update_global (&ctx, esalt_bufs[DIGESTS_OFFSET].chall_buf, esalt_bufs[DIGESTS_OFFSET].srvchall_len + esalt_bufs[DIGESTS_OFFSET].clichall_len); + + md5_hmac_final (&ctx); + + const u32 r0 = ctx.opad.h[DGST_R0]; + const u32 r1 = ctx.opad.h[DGST_R1]; + const u32 r2 = ctx.opad.h[DGST_R2]; + const u32 r3 = ctx.opad.h[DGST_R3]; + + COMPARE_M_SCALAR (r0, r1, r2, r3); + } +} + +KERNEL_FQ void m05610_sxx (KERN_ATTR_RULES_ESALT (netntlm_t)) +{ + /** + * 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 w0[4]; + u32 w1[4]; + u32 w2[4]; + u32 w3[4]; + + w0[0] = pws[gid].i[ 0]; + w0[1] = pws[gid].i[ 1]; + w0[2] = pws[gid].i[ 2]; + w0[3] = pws[gid].i[ 3]; + w1[0] = 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; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) + { + + md5_hmac_ctx_t ctx0; + + md5_hmac_init_64 (&ctx0, w0, w1, w2, w3); + + md5_hmac_update_global (&ctx0, esalt_bufs[DIGESTS_OFFSET].userdomain_buf, esalt_bufs[DIGESTS_OFFSET].user_len + esalt_bufs[DIGESTS_OFFSET].domain_len); + + md5_hmac_final (&ctx0); + + w0[0] = ctx0.opad.h[0]; + w0[1] = ctx0.opad.h[1]; + w0[2] = ctx0.opad.h[2]; + w0[3] = ctx0.opad.h[3]; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; + + md5_hmac_ctx_t ctx; + + md5_hmac_init_64 (&ctx, w0, w1, w2, w3); + + md5_hmac_update_global (&ctx, esalt_bufs[DIGESTS_OFFSET].chall_buf, esalt_bufs[DIGESTS_OFFSET].srvchall_len + esalt_bufs[DIGESTS_OFFSET].clichall_len); + + md5_hmac_final (&ctx); + + const u32 r0 = ctx.opad.h[DGST_R0]; + const u32 r1 = ctx.opad.h[DGST_R1]; + const u32 r2 = ctx.opad.h[DGST_R2]; + const u32 r3 = ctx.opad.h[DGST_R3]; + + COMPARE_S_SCALAR (r0, r1, r2, r3); + } +} diff --git a/src/modules/module_05510.c b/src/modules/module_05510.c new file mode 100644 index 000000000..5692b7daf --- /dev/null +++ b/src/modules/module_05510.c @@ -0,0 +1,492 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "emu_inc_cipher_des.h" +#include "emu_inc_hash_md5.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "NetNTLMv1 / NetNTLMv1+ESS (NT)"; +static const u64 KERN_TYPE = 5510; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14 + | OPTS_TYPE_PT_UTF16LE + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "\xb4\xb9\xb0\x2e\x6f\x09\xa9\xbd\x76\x0f\x38\x8b\x67\x35\x1e\x2b"; +static const char *ST_HASH = "::5V4T:ada06359242920a500000000000000000000000000000000:0556d5297b5daa70eaffde82ef99293a3f3bb59b7c9704ea:9c23f6c094853920"; + +typedef struct netntlm +{ + int user_len; + int domain_len; + int srvchall_len; + int clichall_len; + + u32 userdomain_buf[64]; + u32 chall_buf[256]; + +} netntlm_t; + +u32 module_attack_exec (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 ATTACK_EXEC; } +u32 module_dgst_pos0 (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 DGST_POS0; } +u32 module_dgst_pos1 (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 DGST_POS1; } +u32 module_dgst_pos2 (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 DGST_POS2; } +u32 module_dgst_pos3 (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 DGST_POS3; } +u32 module_dgst_size (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 DGST_SIZE; } +u32 module_hash_category (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 HASH_CATEGORY; } +const char *module_hash_name (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 HASH_NAME; } +u64 module_kern_type (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 KERN_TYPE; } +u32 module_opti_type (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 OPTI_TYPE; } +u64 module_opts_type (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 OPTS_TYPE; } +u32 module_salt_type (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 SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +static void transform_netntlmv1_key (const u8 *nthash, u8 *key) +{ + key[0] = (nthash[0] >> 0); + key[1] = (nthash[0] << 7) | (nthash[1] >> 1); + key[2] = (nthash[1] << 6) | (nthash[2] >> 2); + key[3] = (nthash[2] << 5) | (nthash[3] >> 3); + key[4] = (nthash[3] << 4) | (nthash[4] >> 4); + key[5] = (nthash[4] << 3) | (nthash[5] >> 5); + key[6] = (nthash[5] << 2) | (nthash[6] >> 6); + key[7] = (nthash[6] << 1); + + key[0] |= 0x01; + key[1] |= 0x01; + key[2] |= 0x01; + key[3] |= 0x01; + key[4] |= 0x01; + key[5] |= 0x01; + key[6] |= 0x01; + key[7] |= 0x01; +} + +char *module_jit_build_options (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) +{ + char *jit_build_options = NULL; + + // Extra treatment for Apple systems + if (device_param->opencl_platform_vendor_id == VENDOR_ID_APPLE) + { + return jit_build_options; + } + + // Intel CPU + if ((device_param->opencl_device_vendor_id == VENDOR_ID_INTEL_SDK) && (device_param->opencl_device_type & CL_DEVICE_TYPE_CPU)) + { + hc_asprintf (&jit_build_options, "-D _unroll"); + } + + return jit_build_options; +} + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (netntlm_t); + + return esalt_size; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + netntlm_t *netntlm = (netntlm_t *) esalt_buf; + + token_t token; + + token.token_cnt = 6; + + // username + token.len_min[0] = 0; + token.len_max[0] = 60; + token.sep[0] = ':'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH; + + // unused + token.len_min[1] = 0; + token.len_max[1] = 0; + token.sep[1] = ':'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + // domain + token.len_min[2] = 0; + token.len_max[2] = 45; + token.sep[2] = ':'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + // lm response + token.len_min[3] = 0; + token.len_max[3] = 48; + token.sep[3] = ':'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + // ntlm response + token.len_min[4] = 48; + token.len_max[4] = 48; + token.sep[4] = ':'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + // challenge + token.len_min[5] = 16; + token.len_max[5] = 16; + token.sep[5] = ':'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *user_pos = token.buf[0]; + const u8 *domain_pos = token.buf[2]; + const u8 *srvchall_pos = token.buf[3]; + const u8 *hash_pos = token.buf[4]; + const u8 *clichall_pos = token.buf[5]; + + const int user_len = token.len[0]; + const int domain_len = token.len[2]; + const int srvchall_len = token.len[3]; + const int clichall_len = token.len[5]; + + /** + * store some data for later use + */ + + netntlm->user_len = user_len * 2; + netntlm->domain_len = domain_len * 2; + netntlm->srvchall_len = srvchall_len / 2; + netntlm->clichall_len = clichall_len / 2; + + u8 *userdomain_ptr = (u8 *) netntlm->userdomain_buf; + u8 *chall_ptr = (u8 *) netntlm->chall_buf; + + /** + * handle username and domainname + */ + + for (int i = 0; i < user_len; i++) + { + *userdomain_ptr++ = user_pos[i]; + *userdomain_ptr++ = 0; + } + + for (int i = 0; i < domain_len; i++) + { + *userdomain_ptr++ = domain_pos[i]; + *userdomain_ptr++ = 0; + } + + /** + * handle server challenge encoding + */ + + for (int i = 0; i < srvchall_len; i += 2) + { + const u8 p0 = srvchall_pos[i + 0]; + const u8 p1 = srvchall_pos[i + 1]; + + *chall_ptr++ = hex_convert (p1) << 0 + | hex_convert (p0) << 4; + } + + /** + * handle client challenge encoding + */ + + for (int i = 0; i < clichall_len; i += 2) + { + const u8 p0 = clichall_pos[i + 0]; + const u8 p1 = clichall_pos[i + 1]; + + *chall_ptr++ = hex_convert (p1) << 0 + | hex_convert (p0) << 4; + } + + /** + * store data + */ + + const bool parse_rc = generic_salt_decode (hashconfig, clichall_pos, clichall_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); + + if (parse_rc == false) return (PARSER_SALT_LENGTH); + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + /* special case, last 8 byte do not need to be checked since they are brute-forced next */ + + u32 digest_tmp[2]; + + digest_tmp[0] = hex_to_u32 (hash_pos + 32); + digest_tmp[1] = hex_to_u32 (hash_pos + 40); + + /* special case 2: ESS */ + + if (srvchall_len == 48) + { + if ((netntlm->chall_buf[2] == 0) && (netntlm->chall_buf[3] == 0) && (netntlm->chall_buf[4] == 0) && (netntlm->chall_buf[5] == 0)) + { + u32 w[16] = { 0 }; + + w[ 0] = salt->salt_buf[0]; + w[ 1] = salt->salt_buf[1]; + w[ 2] = netntlm->chall_buf[0]; + w[ 3] = netntlm->chall_buf[1]; + w[ 4] = 0x80; + w[14] = 16 * 8; + + u32 dgst[4] = { 0 }; + + dgst[0] = MD5M_A; + dgst[1] = MD5M_B; + dgst[2] = MD5M_C; + dgst[3] = MD5M_D; + + md5_transform (w + 0, w + 4, w + 8, w + 12, dgst); + + salt->salt_buf[0] = dgst[0]; + salt->salt_buf[1] = dgst[1]; + } + } + + /* precompute netntlmv1 exploit start */ + + for (u32 i = 0; i < 0x10000; i++) + { + u32 key_md4[2] = { 0 }; + u32 key_des[2] = { 0 }; + + key_md4[0] = i; + + transform_netntlmv1_key ((const u8 *) key_md4, (u8 *) key_des); + + u32 Kc[16] = { 0 }; + u32 Kd[16] = { 0 }; + + _des_crypt_keysetup (key_des[0], key_des[1], Kc, Kd, (u32 (*)[64]) c_skb); + + u32 data3[2] = { salt->salt_buf[0], salt->salt_buf[1] }; + + _des_crypt_encrypt (data3, data3, Kc, Kd, (u32 (*)[64]) c_SPtrans); + + if (data3[0] != digest_tmp[0]) continue; + if (data3[1] != digest_tmp[1]) continue; + + salt->salt_buf[2] = i; + + salt->salt_len = 24; + + break; + } + + salt->salt_buf_pc[0] = digest_tmp[0]; + salt->salt_buf_pc[1] = digest_tmp[1]; + + /* precompute netntlmv1 exploit stop */ + + DES_IP (digest[0], digest[1]); + DES_IP (digest[2], digest[3]); + + digest[0] = rotr32 (digest[0], 29); + digest[1] = rotr32 (digest[1], 29); + digest[2] = rotr32 (digest[2], 29); + digest[3] = rotr32 (digest[3], 29); + + DES_IP (salt->salt_buf[0], salt->salt_buf[1]); + + salt->salt_buf[0] = rotl32 (salt->salt_buf[0], 3); + salt->salt_buf[1] = rotl32 (salt->salt_buf[1], 3); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const netntlm_t *netntlm = (const netntlm_t *) esalt_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + tmp[0] = rotl32 (tmp[0], 29); + tmp[1] = rotl32 (tmp[1], 29); + tmp[2] = rotl32 (tmp[2], 29); + tmp[3] = rotl32 (tmp[3], 29); + + DES_FP (tmp[1], tmp[0]); + DES_FP (tmp[3], tmp[2]); + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u8 *ptr; + + ptr = (u8 *) netntlm->userdomain_buf; + + for (int i = 0; i < netntlm->user_len; i += 2) + { + out_buf[out_len++] = ptr[i]; + } + + out_buf[out_len++] = ':'; + out_buf[out_len++] = ':'; + + ptr += netntlm->user_len; + + for (int i = 0; i < netntlm->domain_len; i += 2) + { + out_buf[out_len++] = ptr[i]; + } + + out_buf[out_len++] = ':'; + + ptr = (u8 *) netntlm->chall_buf; + + for (int i = 0; i < netntlm->srvchall_len; i++) + { + u8_to_hex (ptr[i], out_buf + out_len); out_len += 2; + } + + out_buf[out_len++] = ':'; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + u32_to_hex (salt->salt_buf_pc[0], out_buf + out_len); out_len += 8; + u32_to_hex (salt->salt_buf_pc[1], out_buf + out_len); out_len += 8; + + out_buf[out_len++] = ':'; + + ptr += netntlm->srvchall_len; + + for (int i = 0; i < netntlm->clichall_len; i++) + { + u8_to_hex (ptr[i], out_buf + out_len); out_len += 2; + } + + return out_len; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 16; // Length of a NT hash + + return pw_max; +} + +u32 module_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_min = 16; // Length of a NT hash + + return pw_min; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_potfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode_potfile = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hashes_count_min = MODULE_DEFAULT; + module_ctx->module_hashes_count_max = MODULE_DEFAULT; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook_extra_param_size = MODULE_DEFAULT; + module_ctx->module_hook_extra_param_init = MODULE_DEFAULT; + module_ctx->module_hook_extra_param_term = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = module_jit_build_options; + module_ctx->module_jit_cache_disable = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_custom_check = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = module_pw_min; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_05610.c b/src/modules/module_05610.c new file mode 100644 index 000000000..5d1eeb585 --- /dev/null +++ b/src/modules/module_05610.c @@ -0,0 +1,388 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" +#include "emu_inc_cipher_des.h" +#include "emu_inc_hash_md5.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 3; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 1; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; +static const char *HASH_NAME = "NetNTLMv2 (NT)"; +static const u64 KERN_TYPE = 5610; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_PT_ADD80 + | OPTS_TYPE_PT_ADDBITS14 + | OPTS_TYPE_PT_UTF16LE + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "\xb4\xb9\xb0\x2e\x6f\x09\xa9\xbd\x76\x0f\x38\x8b\x67\x35\x1e\x2b"; +static const char *ST_HASH = "0UL5G37JOI0SX::6VB1IS0KA74:ebe1afa18b7fbfa6:aab8bf8675658dd2a939458a1077ba08:010100000000000031c8aa092510945398b9f7b7dde1a9fb00000000f7876f2b04b700"; + +typedef struct netntlm +{ + int user_len; + int domain_len; + int srvchall_len; + int clichall_len; + + u32 userdomain_buf[64]; + u32 chall_buf[256]; + +} netntlm_t; + +u32 module_attack_exec (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 ATTACK_EXEC; } +u32 module_dgst_pos0 (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 DGST_POS0; } +u32 module_dgst_pos1 (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 DGST_POS1; } +u32 module_dgst_pos2 (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 DGST_POS2; } +u32 module_dgst_pos3 (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 DGST_POS3; } +u32 module_dgst_size (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 DGST_SIZE; } +u32 module_hash_category (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 HASH_CATEGORY; } +const char *module_hash_name (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 HASH_NAME; } +u64 module_kern_type (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 KERN_TYPE; } +u32 module_opti_type (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 OPTI_TYPE; } +u64 module_opts_type (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 OPTS_TYPE; } +u32 module_salt_type (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 SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 esalt_size = (const u64) sizeof (netntlm_t); + + return esalt_size; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + netntlm_t *netntlm = (netntlm_t *) esalt_buf; + + token_t token; + + token.token_cnt = 6; + + // username + token.len_min[0] = 0; + token.len_max[0] = 60; + token.sep[0] = ':'; + token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH; + + // unused + token.len_min[1] = 0; + token.len_max[1] = 0; + token.sep[1] = ':'; + token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; + + // domain + token.len_min[2] = 0; + token.len_max[2] = 45; + token.sep[2] = ':'; + token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; + + // lm response + token.len_min[3] = 16; + token.len_max[3] = 16; + token.sep[3] = ':'; + token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + // ntlm response + token.len_min[4] = 32; + token.len_max[4] = 32; + token.sep[4] = ':'; + token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + // challenge + token.len_min[5] = 2; + token.len_max[5] = 1024; + token.sep[5] = ':'; + token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + const u8 *user_pos = token.buf[0]; + const u8 *domain_pos = token.buf[2]; + const u8 *srvchall_pos = token.buf[3]; + const u8 *hash_pos = token.buf[4]; + const u8 *clichall_pos = token.buf[5]; + + const int user_len = token.len[0]; + const int domain_len = token.len[2]; + const int srvchall_len = token.len[3]; + const int clichall_len = token.len[5]; + + /** + * store some data for later use + */ + + netntlm->user_len = user_len * 2; + netntlm->domain_len = domain_len * 2; + netntlm->srvchall_len = srvchall_len / 2; + netntlm->clichall_len = clichall_len / 2; + + u8 *userdomain_ptr = (u8 *) netntlm->userdomain_buf; + u8 *chall_ptr = (u8 *) netntlm->chall_buf; + + /** + * handle username and domainname + */ + + for (int i = 0; i < user_len; i++) + { + *userdomain_ptr++ = toupper (user_pos[i]); + *userdomain_ptr++ = 0; + } + + for (int i = 0; i < domain_len; i++) + { + *userdomain_ptr++ = domain_pos[i]; + *userdomain_ptr++ = 0; + } + + *userdomain_ptr++ = 0x80; + + /** + * handle server challenge encoding + */ + + for (int i = 0; i < srvchall_len; i += 2) + { + const u8 p0 = srvchall_pos[i + 0]; + const u8 p1 = srvchall_pos[i + 1]; + + *chall_ptr++ = hex_convert (p1) << 0 + | hex_convert (p0) << 4; + } + + /** + * handle client challenge encoding + */ + + for (int i = 0; i < clichall_len; i += 2) + { + const u8 p0 = clichall_pos[i + 0]; + const u8 p1 = clichall_pos[i + 1]; + + *chall_ptr++ = hex_convert (p1) << 0 + | hex_convert (p0) << 4; + } + + *chall_ptr++ = 0x80; + + /** + * handle hash itself + */ + + digest[0] = hex_to_u32 (hash_pos + 0); + digest[1] = hex_to_u32 (hash_pos + 8); + digest[2] = hex_to_u32 (hash_pos + 16); + digest[3] = hex_to_u32 (hash_pos + 24); + + /** + * reuse challange data as salt_buf, its the buffer that is most likely unique + */ + + salt->salt_buf[0] = 0; + salt->salt_buf[1] = 0; + salt->salt_buf[2] = 0; + salt->salt_buf[3] = 0; + salt->salt_buf[4] = 0; + salt->salt_buf[5] = 0; + salt->salt_buf[6] = 0; + salt->salt_buf[7] = 0; + + u32 *uptr; + + uptr = (u32 *) netntlm->userdomain_buf; + + for (u32 i = 0; i < 64; i += 16, uptr += 16) + { + md5_transform (uptr + 0, uptr + 4, uptr + 8, uptr + 12, salt->salt_buf); + } + + uptr = (u32 *) netntlm->chall_buf; + + for (u32 i = 0; i < 256; i += 16, uptr += 16) + { + md5_transform (uptr + 0, uptr + 4, uptr + 8, uptr + 12, salt->salt_buf); + } + + salt->salt_len = 16; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + const netntlm_t *netntlm = (const netntlm_t *) esalt_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u32 tmp[4]; + + tmp[0] = digest[0]; + tmp[1] = digest[1]; + tmp[2] = digest[2]; + tmp[3] = digest[3]; + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + u8 *ptr; + + ptr = (u8 *) netntlm->userdomain_buf; + + for (int i = 0; i < netntlm->user_len; i += 2) + { + out_buf[out_len++] = ptr[i]; + } + + out_buf[out_len++] = ':'; + out_buf[out_len++] = ':'; + + ptr += netntlm->user_len; + + for (int i = 0; i < netntlm->domain_len; i += 2) + { + out_buf[out_len++] = ptr[i]; + } + + out_buf[out_len++] = ':'; + + ptr = (u8 *) netntlm->chall_buf; + + for (int i = 0; i < netntlm->srvchall_len; i++) + { + u8_to_hex (ptr[i], out_buf + out_len); out_len += 2; + } + + out_buf[out_len++] = ':'; + + u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; + u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; + + out_buf[out_len++] = ':'; + + ptr += netntlm->srvchall_len; + + for (int i = 0; i < netntlm->clichall_len; i++) + { + u8_to_hex (ptr[i], out_buf + out_len); out_len += 2; + } + + return out_len; +} + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_max = 16; // Length of a NT hash + + return pw_max; +} + +u32 module_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 pw_min = 16; // Length of a NT hash + + return pw_min; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = module_esalt_size; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_potfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode_potfile = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hashes_count_min = MODULE_DEFAULT; + module_ctx->module_hashes_count_max = MODULE_DEFAULT; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook_extra_param_size = MODULE_DEFAULT; + module_ctx->module_hook_extra_param_init = MODULE_DEFAULT; + module_ctx->module_hook_extra_param_term = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_jit_cache_disable = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_custom_check = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = module_pw_min; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} From 83dba45c85e5fc4b5f688e6b1b40289dc611b003 Mon Sep 17 00:00:00 2001 From: Michael Kruger Date: Sat, 7 Nov 2020 10:38:02 +0200 Subject: [PATCH 02/64] 5510/5510 Addition of a3. Remove half DES optimisation from a3 --- OpenCL/m05510_a0-pure.cl | 2 +- OpenCL/m05510_a3-optimized.cl | 1332 +++++++++++++++++++++++++++++++++ OpenCL/m05510_a3-pure.cl | 803 ++++++++++++++++++++ OpenCL/m05610_a3-pure.cl | 260 +++++++ 4 files changed, 2396 insertions(+), 1 deletion(-) create mode 100644 OpenCL/m05510_a3-optimized.cl create mode 100644 OpenCL/m05510_a3-pure.cl create mode 100644 OpenCL/m05610_a3-pure.cl diff --git a/OpenCL/m05510_a0-pure.cl b/OpenCL/m05510_a0-pure.cl index aa436a5a1..366988aaa 100644 --- a/OpenCL/m05510_a0-pure.cl +++ b/OpenCL/m05510_a0-pure.cl @@ -577,7 +577,7 @@ KERNEL_FQ void m05510_mxx (KERN_ATTR_RULES ()) for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) { - if ((d >> 16) != s2) continue; + // if ((d >> 16) != s2) continue; /** * DES1 diff --git a/OpenCL/m05510_a3-optimized.cl b/OpenCL/m05510_a3-optimized.cl new file mode 100644 index 000000000..ab1cc39e9 --- /dev/null +++ b/OpenCL/m05510_a3-optimized.cl @@ -0,0 +1,1332 @@ +/** + * 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_md4.cl" +#endif + +typedef struct netntlm +{ + u32 user_len; + u32 domain_len; + u32 srvchall_len; + u32 clichall_len; + + u32 userdomain_buf[64]; + u32 chall_buf[256]; + +} netntlm_t; + +#define PERM_OP(a,b,tt,n,m) \ +{ \ + tt = a >> n; \ + tt = tt ^ b; \ + tt = tt & m; \ + b = b ^ tt; \ + tt = tt << n; \ + a = a ^ tt; \ +} + +#define HPERM_OP(a,tt,n,m) \ +{ \ + tt = a << (16 + n); \ + tt = tt ^ a; \ + tt = tt & m; \ + a = a ^ tt; \ + tt = tt >> (16 + n); \ + a = a ^ tt; \ +} + +CONSTANT_VK u32a c_SPtrans[8][64] = +{ + { + 0x02080800, 0x00080000, 0x02000002, 0x02080802, + 0x02000000, 0x00080802, 0x00080002, 0x02000002, + 0x00080802, 0x02080800, 0x02080000, 0x00000802, + 0x02000802, 0x02000000, 0x00000000, 0x00080002, + 0x00080000, 0x00000002, 0x02000800, 0x00080800, + 0x02080802, 0x02080000, 0x00000802, 0x02000800, + 0x00000002, 0x00000800, 0x00080800, 0x02080002, + 0x00000800, 0x02000802, 0x02080002, 0x00000000, + 0x00000000, 0x02080802, 0x02000800, 0x00080002, + 0x02080800, 0x00080000, 0x00000802, 0x02000800, + 0x02080002, 0x00000800, 0x00080800, 0x02000002, + 0x00080802, 0x00000002, 0x02000002, 0x02080000, + 0x02080802, 0x00080800, 0x02080000, 0x02000802, + 0x02000000, 0x00000802, 0x00080002, 0x00000000, + 0x00080000, 0x02000000, 0x02000802, 0x02080800, + 0x00000002, 0x02080002, 0x00000800, 0x00080802, + }, + { + 0x40108010, 0x00000000, 0x00108000, 0x40100000, + 0x40000010, 0x00008010, 0x40008000, 0x00108000, + 0x00008000, 0x40100010, 0x00000010, 0x40008000, + 0x00100010, 0x40108000, 0x40100000, 0x00000010, + 0x00100000, 0x40008010, 0x40100010, 0x00008000, + 0x00108010, 0x40000000, 0x00000000, 0x00100010, + 0x40008010, 0x00108010, 0x40108000, 0x40000010, + 0x40000000, 0x00100000, 0x00008010, 0x40108010, + 0x00100010, 0x40108000, 0x40008000, 0x00108010, + 0x40108010, 0x00100010, 0x40000010, 0x00000000, + 0x40000000, 0x00008010, 0x00100000, 0x40100010, + 0x00008000, 0x40000000, 0x00108010, 0x40008010, + 0x40108000, 0x00008000, 0x00000000, 0x40000010, + 0x00000010, 0x40108010, 0x00108000, 0x40100000, + 0x40100010, 0x00100000, 0x00008010, 0x40008000, + 0x40008010, 0x00000010, 0x40100000, 0x00108000, + }, + { + 0x04000001, 0x04040100, 0x00000100, 0x04000101, + 0x00040001, 0x04000000, 0x04000101, 0x00040100, + 0x04000100, 0x00040000, 0x04040000, 0x00000001, + 0x04040101, 0x00000101, 0x00000001, 0x04040001, + 0x00000000, 0x00040001, 0x04040100, 0x00000100, + 0x00000101, 0x04040101, 0x00040000, 0x04000001, + 0x04040001, 0x04000100, 0x00040101, 0x04040000, + 0x00040100, 0x00000000, 0x04000000, 0x00040101, + 0x04040100, 0x00000100, 0x00000001, 0x00040000, + 0x00000101, 0x00040001, 0x04040000, 0x04000101, + 0x00000000, 0x04040100, 0x00040100, 0x04040001, + 0x00040001, 0x04000000, 0x04040101, 0x00000001, + 0x00040101, 0x04000001, 0x04000000, 0x04040101, + 0x00040000, 0x04000100, 0x04000101, 0x00040100, + 0x04000100, 0x00000000, 0x04040001, 0x00000101, + 0x04000001, 0x00040101, 0x00000100, 0x04040000, + }, + { + 0x00401008, 0x10001000, 0x00000008, 0x10401008, + 0x00000000, 0x10400000, 0x10001008, 0x00400008, + 0x10401000, 0x10000008, 0x10000000, 0x00001008, + 0x10000008, 0x00401008, 0x00400000, 0x10000000, + 0x10400008, 0x00401000, 0x00001000, 0x00000008, + 0x00401000, 0x10001008, 0x10400000, 0x00001000, + 0x00001008, 0x00000000, 0x00400008, 0x10401000, + 0x10001000, 0x10400008, 0x10401008, 0x00400000, + 0x10400008, 0x00001008, 0x00400000, 0x10000008, + 0x00401000, 0x10001000, 0x00000008, 0x10400000, + 0x10001008, 0x00000000, 0x00001000, 0x00400008, + 0x00000000, 0x10400008, 0x10401000, 0x00001000, + 0x10000000, 0x10401008, 0x00401008, 0x00400000, + 0x10401008, 0x00000008, 0x10001000, 0x00401008, + 0x00400008, 0x00401000, 0x10400000, 0x10001008, + 0x00001008, 0x10000000, 0x10000008, 0x10401000, + }, + { + 0x08000000, 0x00010000, 0x00000400, 0x08010420, + 0x08010020, 0x08000400, 0x00010420, 0x08010000, + 0x00010000, 0x00000020, 0x08000020, 0x00010400, + 0x08000420, 0x08010020, 0x08010400, 0x00000000, + 0x00010400, 0x08000000, 0x00010020, 0x00000420, + 0x08000400, 0x00010420, 0x00000000, 0x08000020, + 0x00000020, 0x08000420, 0x08010420, 0x00010020, + 0x08010000, 0x00000400, 0x00000420, 0x08010400, + 0x08010400, 0x08000420, 0x00010020, 0x08010000, + 0x00010000, 0x00000020, 0x08000020, 0x08000400, + 0x08000000, 0x00010400, 0x08010420, 0x00000000, + 0x00010420, 0x08000000, 0x00000400, 0x00010020, + 0x08000420, 0x00000400, 0x00000000, 0x08010420, + 0x08010020, 0x08010400, 0x00000420, 0x00010000, + 0x00010400, 0x08010020, 0x08000400, 0x00000420, + 0x00000020, 0x00010420, 0x08010000, 0x08000020, + }, + { + 0x80000040, 0x00200040, 0x00000000, 0x80202000, + 0x00200040, 0x00002000, 0x80002040, 0x00200000, + 0x00002040, 0x80202040, 0x00202000, 0x80000000, + 0x80002000, 0x80000040, 0x80200000, 0x00202040, + 0x00200000, 0x80002040, 0x80200040, 0x00000000, + 0x00002000, 0x00000040, 0x80202000, 0x80200040, + 0x80202040, 0x80200000, 0x80000000, 0x00002040, + 0x00000040, 0x00202000, 0x00202040, 0x80002000, + 0x00002040, 0x80000000, 0x80002000, 0x00202040, + 0x80202000, 0x00200040, 0x00000000, 0x80002000, + 0x80000000, 0x00002000, 0x80200040, 0x00200000, + 0x00200040, 0x80202040, 0x00202000, 0x00000040, + 0x80202040, 0x00202000, 0x00200000, 0x80002040, + 0x80000040, 0x80200000, 0x00202040, 0x00000000, + 0x00002000, 0x80000040, 0x80002040, 0x80202000, + 0x80200000, 0x00002040, 0x00000040, 0x80200040, + }, + { + 0x00004000, 0x00000200, 0x01000200, 0x01000004, + 0x01004204, 0x00004004, 0x00004200, 0x00000000, + 0x01000000, 0x01000204, 0x00000204, 0x01004000, + 0x00000004, 0x01004200, 0x01004000, 0x00000204, + 0x01000204, 0x00004000, 0x00004004, 0x01004204, + 0x00000000, 0x01000200, 0x01000004, 0x00004200, + 0x01004004, 0x00004204, 0x01004200, 0x00000004, + 0x00004204, 0x01004004, 0x00000200, 0x01000000, + 0x00004204, 0x01004000, 0x01004004, 0x00000204, + 0x00004000, 0x00000200, 0x01000000, 0x01004004, + 0x01000204, 0x00004204, 0x00004200, 0x00000000, + 0x00000200, 0x01000004, 0x00000004, 0x01000200, + 0x00000000, 0x01000204, 0x01000200, 0x00004200, + 0x00000204, 0x00004000, 0x01004204, 0x01000000, + 0x01004200, 0x00000004, 0x00004004, 0x01004204, + 0x01000004, 0x01004200, 0x01004000, 0x00004004, + }, + { + 0x20800080, 0x20820000, 0x00020080, 0x00000000, + 0x20020000, 0x00800080, 0x20800000, 0x20820080, + 0x00000080, 0x20000000, 0x00820000, 0x00020080, + 0x00820080, 0x20020080, 0x20000080, 0x20800000, + 0x00020000, 0x00820080, 0x00800080, 0x20020000, + 0x20820080, 0x20000080, 0x00000000, 0x00820000, + 0x20000000, 0x00800000, 0x20020080, 0x20800080, + 0x00800000, 0x00020000, 0x20820000, 0x00000080, + 0x00800000, 0x00020000, 0x20000080, 0x20820080, + 0x00020080, 0x20000000, 0x00000000, 0x00820000, + 0x20800080, 0x20020080, 0x20020000, 0x00800080, + 0x20820000, 0x00000080, 0x00800080, 0x20020000, + 0x20820080, 0x00800000, 0x20800000, 0x20000080, + 0x00820000, 0x00020080, 0x20020080, 0x20800000, + 0x00000080, 0x20820000, 0x00820080, 0x00000000, + 0x20000000, 0x20800080, 0x00020000, 0x00820080, + } +}; + +CONSTANT_VK u32a c_skb[8][64] = +{ + { + 0x00000000, 0x00000010, 0x20000000, 0x20000010, + 0x00010000, 0x00010010, 0x20010000, 0x20010010, + 0x00000800, 0x00000810, 0x20000800, 0x20000810, + 0x00010800, 0x00010810, 0x20010800, 0x20010810, + 0x00000020, 0x00000030, 0x20000020, 0x20000030, + 0x00010020, 0x00010030, 0x20010020, 0x20010030, + 0x00000820, 0x00000830, 0x20000820, 0x20000830, + 0x00010820, 0x00010830, 0x20010820, 0x20010830, + 0x00080000, 0x00080010, 0x20080000, 0x20080010, + 0x00090000, 0x00090010, 0x20090000, 0x20090010, + 0x00080800, 0x00080810, 0x20080800, 0x20080810, + 0x00090800, 0x00090810, 0x20090800, 0x20090810, + 0x00080020, 0x00080030, 0x20080020, 0x20080030, + 0x00090020, 0x00090030, 0x20090020, 0x20090030, + 0x00080820, 0x00080830, 0x20080820, 0x20080830, + 0x00090820, 0x00090830, 0x20090820, 0x20090830, + }, + { + 0x00000000, 0x02000000, 0x00002000, 0x02002000, + 0x00200000, 0x02200000, 0x00202000, 0x02202000, + 0x00000004, 0x02000004, 0x00002004, 0x02002004, + 0x00200004, 0x02200004, 0x00202004, 0x02202004, + 0x00000400, 0x02000400, 0x00002400, 0x02002400, + 0x00200400, 0x02200400, 0x00202400, 0x02202400, + 0x00000404, 0x02000404, 0x00002404, 0x02002404, + 0x00200404, 0x02200404, 0x00202404, 0x02202404, + 0x10000000, 0x12000000, 0x10002000, 0x12002000, + 0x10200000, 0x12200000, 0x10202000, 0x12202000, + 0x10000004, 0x12000004, 0x10002004, 0x12002004, + 0x10200004, 0x12200004, 0x10202004, 0x12202004, + 0x10000400, 0x12000400, 0x10002400, 0x12002400, + 0x10200400, 0x12200400, 0x10202400, 0x12202400, + 0x10000404, 0x12000404, 0x10002404, 0x12002404, + 0x10200404, 0x12200404, 0x10202404, 0x12202404, + }, + { + 0x00000000, 0x00000001, 0x00040000, 0x00040001, + 0x01000000, 0x01000001, 0x01040000, 0x01040001, + 0x00000002, 0x00000003, 0x00040002, 0x00040003, + 0x01000002, 0x01000003, 0x01040002, 0x01040003, + 0x00000200, 0x00000201, 0x00040200, 0x00040201, + 0x01000200, 0x01000201, 0x01040200, 0x01040201, + 0x00000202, 0x00000203, 0x00040202, 0x00040203, + 0x01000202, 0x01000203, 0x01040202, 0x01040203, + 0x08000000, 0x08000001, 0x08040000, 0x08040001, + 0x09000000, 0x09000001, 0x09040000, 0x09040001, + 0x08000002, 0x08000003, 0x08040002, 0x08040003, + 0x09000002, 0x09000003, 0x09040002, 0x09040003, + 0x08000200, 0x08000201, 0x08040200, 0x08040201, + 0x09000200, 0x09000201, 0x09040200, 0x09040201, + 0x08000202, 0x08000203, 0x08040202, 0x08040203, + 0x09000202, 0x09000203, 0x09040202, 0x09040203, + }, + { + 0x00000000, 0x00100000, 0x00000100, 0x00100100, + 0x00000008, 0x00100008, 0x00000108, 0x00100108, + 0x00001000, 0x00101000, 0x00001100, 0x00101100, + 0x00001008, 0x00101008, 0x00001108, 0x00101108, + 0x04000000, 0x04100000, 0x04000100, 0x04100100, + 0x04000008, 0x04100008, 0x04000108, 0x04100108, + 0x04001000, 0x04101000, 0x04001100, 0x04101100, + 0x04001008, 0x04101008, 0x04001108, 0x04101108, + 0x00020000, 0x00120000, 0x00020100, 0x00120100, + 0x00020008, 0x00120008, 0x00020108, 0x00120108, + 0x00021000, 0x00121000, 0x00021100, 0x00121100, + 0x00021008, 0x00121008, 0x00021108, 0x00121108, + 0x04020000, 0x04120000, 0x04020100, 0x04120100, + 0x04020008, 0x04120008, 0x04020108, 0x04120108, + 0x04021000, 0x04121000, 0x04021100, 0x04121100, + 0x04021008, 0x04121008, 0x04021108, 0x04121108, + }, + { + 0x00000000, 0x10000000, 0x00010000, 0x10010000, + 0x00000004, 0x10000004, 0x00010004, 0x10010004, + 0x20000000, 0x30000000, 0x20010000, 0x30010000, + 0x20000004, 0x30000004, 0x20010004, 0x30010004, + 0x00100000, 0x10100000, 0x00110000, 0x10110000, + 0x00100004, 0x10100004, 0x00110004, 0x10110004, + 0x20100000, 0x30100000, 0x20110000, 0x30110000, + 0x20100004, 0x30100004, 0x20110004, 0x30110004, + 0x00001000, 0x10001000, 0x00011000, 0x10011000, + 0x00001004, 0x10001004, 0x00011004, 0x10011004, + 0x20001000, 0x30001000, 0x20011000, 0x30011000, + 0x20001004, 0x30001004, 0x20011004, 0x30011004, + 0x00101000, 0x10101000, 0x00111000, 0x10111000, + 0x00101004, 0x10101004, 0x00111004, 0x10111004, + 0x20101000, 0x30101000, 0x20111000, 0x30111000, + 0x20101004, 0x30101004, 0x20111004, 0x30111004, + }, + { + 0x00000000, 0x08000000, 0x00000008, 0x08000008, + 0x00000400, 0x08000400, 0x00000408, 0x08000408, + 0x00020000, 0x08020000, 0x00020008, 0x08020008, + 0x00020400, 0x08020400, 0x00020408, 0x08020408, + 0x00000001, 0x08000001, 0x00000009, 0x08000009, + 0x00000401, 0x08000401, 0x00000409, 0x08000409, + 0x00020001, 0x08020001, 0x00020009, 0x08020009, + 0x00020401, 0x08020401, 0x00020409, 0x08020409, + 0x02000000, 0x0A000000, 0x02000008, 0x0A000008, + 0x02000400, 0x0A000400, 0x02000408, 0x0A000408, + 0x02020000, 0x0A020000, 0x02020008, 0x0A020008, + 0x02020400, 0x0A020400, 0x02020408, 0x0A020408, + 0x02000001, 0x0A000001, 0x02000009, 0x0A000009, + 0x02000401, 0x0A000401, 0x02000409, 0x0A000409, + 0x02020001, 0x0A020001, 0x02020009, 0x0A020009, + 0x02020401, 0x0A020401, 0x02020409, 0x0A020409, + }, + { + 0x00000000, 0x00000100, 0x00080000, 0x00080100, + 0x01000000, 0x01000100, 0x01080000, 0x01080100, + 0x00000010, 0x00000110, 0x00080010, 0x00080110, + 0x01000010, 0x01000110, 0x01080010, 0x01080110, + 0x00200000, 0x00200100, 0x00280000, 0x00280100, + 0x01200000, 0x01200100, 0x01280000, 0x01280100, + 0x00200010, 0x00200110, 0x00280010, 0x00280110, + 0x01200010, 0x01200110, 0x01280010, 0x01280110, + 0x00000200, 0x00000300, 0x00080200, 0x00080300, + 0x01000200, 0x01000300, 0x01080200, 0x01080300, + 0x00000210, 0x00000310, 0x00080210, 0x00080310, + 0x01000210, 0x01000310, 0x01080210, 0x01080310, + 0x00200200, 0x00200300, 0x00280200, 0x00280300, + 0x01200200, 0x01200300, 0x01280200, 0x01280300, + 0x00200210, 0x00200310, 0x00280210, 0x00280310, + 0x01200210, 0x01200310, 0x01280210, 0x01280310, + }, + { + 0x00000000, 0x04000000, 0x00040000, 0x04040000, + 0x00000002, 0x04000002, 0x00040002, 0x04040002, + 0x00002000, 0x04002000, 0x00042000, 0x04042000, + 0x00002002, 0x04002002, 0x00042002, 0x04042002, + 0x00000020, 0x04000020, 0x00040020, 0x04040020, + 0x00000022, 0x04000022, 0x00040022, 0x04040022, + 0x00002020, 0x04002020, 0x00042020, 0x04042020, + 0x00002022, 0x04002022, 0x00042022, 0x04042022, + 0x00000800, 0x04000800, 0x00040800, 0x04040800, + 0x00000802, 0x04000802, 0x00040802, 0x04040802, + 0x00002800, 0x04002800, 0x00042800, 0x04042800, + 0x00002802, 0x04002802, 0x00042802, 0x04042802, + 0x00000820, 0x04000820, 0x00040820, 0x04040820, + 0x00000822, 0x04000822, 0x00040822, 0x04040822, + 0x00002820, 0x04002820, 0x00042820, 0x04042820, + 0x00002822, 0x04002822, 0x00042822, 0x04042822 + } +}; + +#if VECT_SIZE == 1 +#define BOX(i,n,S) (S)[(n)][(i)] +#elif VECT_SIZE == 2 +#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1]) +#elif VECT_SIZE == 4 +#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3]) +#elif VECT_SIZE == 8 +#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7]) +#elif VECT_SIZE == 16 +#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7], (S)[(n)][(i).s8], (S)[(n)][(i).s9], (S)[(n)][(i).sa], (S)[(n)][(i).sb], (S)[(n)][(i).sc], (S)[(n)][(i).sd], (S)[(n)][(i).se], (S)[(n)][(i).sf]) +#endif + +DECLSPEC void _des_crypt_encrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64]) +{ + u32x r = data[0]; + u32x l = data[1]; + + #ifdef _unroll + #pragma unroll + #endif + for (u32 i = 0; i < 16; i += 2) + { + u32x u; + u32x t; + + u = Kc[i + 0] ^ hc_rotl32 (r, 30u); + t = Kd[i + 0] ^ hc_rotl32 (r, 26u); + + l ^= BOX (((u >> 0) & 0x3f), 0, s_SPtrans) + | BOX (((u >> 8) & 0x3f), 2, s_SPtrans) + | BOX (((u >> 16) & 0x3f), 4, s_SPtrans) + | BOX (((u >> 24) & 0x3f), 6, s_SPtrans) + | BOX (((t >> 0) & 0x3f), 1, s_SPtrans) + | BOX (((t >> 8) & 0x3f), 3, s_SPtrans) + | BOX (((t >> 16) & 0x3f), 5, s_SPtrans) + | BOX (((t >> 24) & 0x3f), 7, s_SPtrans); + + u = Kc[i + 1] ^ hc_rotl32 (l, 30u); + t = Kd[i + 1] ^ hc_rotl32 (l, 26u); + + r ^= BOX (((u >> 0) & 0x3f), 0, s_SPtrans) + | BOX (((u >> 8) & 0x3f), 2, s_SPtrans) + | BOX (((u >> 16) & 0x3f), 4, s_SPtrans) + | BOX (((u >> 24) & 0x3f), 6, s_SPtrans) + | BOX (((t >> 0) & 0x3f), 1, s_SPtrans) + | BOX (((t >> 8) & 0x3f), 3, s_SPtrans) + | BOX (((t >> 16) & 0x3f), 5, s_SPtrans) + | BOX (((t >> 24) & 0x3f), 7, s_SPtrans); + } + + iv[0] = l; + iv[1] = r; +} + +DECLSPEC void _des_crypt_keysetup (u32x c, u32x d, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_skb)[64]) +{ + u32x tt; + + PERM_OP (d, c, tt, 4, 0x0f0f0f0f); + HPERM_OP (c, tt, 2, 0xcccc0000); + HPERM_OP (d, tt, 2, 0xcccc0000); + PERM_OP (d, c, tt, 1, 0x55555555); + PERM_OP (c, d, tt, 8, 0x00ff00ff); + PERM_OP (d, c, tt, 1, 0x55555555); + + d = ((d & 0x000000ff) << 16) + | ((d & 0x0000ff00) << 0) + | ((d & 0x00ff0000) >> 16) + | ((c & 0xf0000000) >> 4); + + c = c & 0x0fffffff; + + #ifdef _unroll + #pragma unroll + #endif + for (u32 i = 0; i < 16; i++) + { + if ((i < 2) || (i == 8) || (i == 15)) + { + c = ((c >> 1) | (c << 27)); + d = ((d >> 1) | (d << 27)); + } + else + { + c = ((c >> 2) | (c << 26)); + d = ((d >> 2) | (d << 26)); + } + + c = c & 0x0fffffff; + d = d & 0x0fffffff; + + const u32x c00 = (c >> 0) & 0x0000003f; + const u32x c06 = (c >> 6) & 0x00383003; + const u32x c07 = (c >> 7) & 0x0000003c; + const u32x c13 = (c >> 13) & 0x0000060f; + const u32x c20 = (c >> 20) & 0x00000001; + + u32x s = BOX (((c00 >> 0) & 0xff), 0, s_skb) + | BOX (((c06 >> 0) & 0xff) + |((c07 >> 0) & 0xff), 1, s_skb) + | BOX (((c13 >> 0) & 0xff) + |((c06 >> 8) & 0xff), 2, s_skb) + | BOX (((c20 >> 0) & 0xff) + |((c13 >> 8) & 0xff) + |((c06 >> 16) & 0xff), 3, s_skb); + + const u32x d00 = (d >> 0) & 0x00003c3f; + const u32x d07 = (d >> 7) & 0x00003f03; + const u32x d21 = (d >> 21) & 0x0000000f; + const u32x d22 = (d >> 22) & 0x00000030; + + u32x t = BOX (((d00 >> 0) & 0xff), 4, s_skb) + | BOX (((d07 >> 0) & 0xff) + |((d00 >> 8) & 0xff), 5, s_skb) + | BOX (((d07 >> 8) & 0xff), 6, s_skb) + | BOX (((d21 >> 0) & 0xff) + |((d22 >> 0) & 0xff), 7, s_skb); + + Kc[i] = ((t << 16) | (s & 0x0000ffff)); + Kd[i] = ((s >> 16) | (t & 0xffff0000)); + } +} + +DECLSPEC void transform_netntlmv1_key (const u32x w0, const u32x w1, u32x *out) +{ + u32x t[8]; + + t[0] = (w0 >> 0) & 0xff; + t[1] = (w0 >> 8) & 0xff; + t[2] = (w0 >> 16) & 0xff; + t[3] = (w0 >> 24) & 0xff; + t[4] = (w1 >> 0) & 0xff; + t[5] = (w1 >> 8) & 0xff; + t[6] = (w1 >> 16) & 0xff; + t[7] = (w1 >> 24) & 0xff; + + u32x k[8]; + + k[0] = (t[0] >> 0); + k[1] = (t[0] << 7) | (t[1] >> 1); + k[2] = (t[1] << 6) | (t[2] >> 2); + k[3] = (t[2] << 5) | (t[3] >> 3); + k[4] = (t[3] << 4) | (t[4] >> 4); + k[5] = (t[4] << 3) | (t[5] >> 5); + k[6] = (t[5] << 2) | (t[6] >> 6); + k[7] = (t[6] << 1); + + out[0] = ((k[0] & 0xff) << 0) + | ((k[1] & 0xff) << 8) + | ((k[2] & 0xff) << 16) + | ((k[3] & 0xff) << 24); + + out[1] = ((k[4] & 0xff) << 0) + | ((k[5] & 0xff) << 8) + | ((k[6] & 0xff) << 16) + | ((k[7] & 0xff) << 24); +} + +DECLSPEC void m05510m (SHM_TYPE u32 (*s_SPtrans)[64], SHM_TYPE u32 (*s_skb)[64], u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ()) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + + /** + * salt + */ + + const u32 s0 = salt_bufs[SALT_POS].salt_buf[0]; + const u32 s1 = salt_bufs[SALT_POS].salt_buf[1]; + const u32 s2 = salt_bufs[SALT_POS].salt_buf[2]; + + /** + * loop + */ + + u32 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; + + u32x w0_t[4]; + u32x w1_t[4]; + u32x w2_t[4]; + u32x w3_t[4]; + + w0_t[0] = w0; + w0_t[1] = w[ 1]; + w0_t[2] = w[ 2]; + w0_t[3] = w[ 3]; + w1_t[0] = w[ 4]; + w1_t[1] = w[ 5]; + w1_t[2] = w[ 6]; + w1_t[3] = w[ 7]; + w2_t[0] = w[ 8]; + w2_t[1] = w[ 9]; + w2_t[2] = w[10]; + w2_t[3] = w[11]; + w3_t[0] = w[12]; + w3_t[1] = w[13]; + w3_t[2] = w[14]; + w3_t[3] = w[15]; + + u32x a = w0; + u32x b = w[ 1]; + u32x c = w[ 2]; + u32x d = w[ 3]; + + // MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00); + // MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01); + // MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02); + // MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03); + // MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00); + // MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01); + // MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02); + // MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03); + // MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00); + // MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01); + // MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02); + // MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03); + // MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00); + // MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01); + // MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02); + // MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03); + + // MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10); + // MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11); + // MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12); + // MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13); + // MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10); + // MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11); + // MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12); + // MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13); + // MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10); + // MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11); + // MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12); + // MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13); + // MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10); + // MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11); + // MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12); + // MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13); + + // MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20); + // MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21); + // MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22); + // MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23); + // MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20); + // MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21); + // MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22); + // MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23); + // MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20); + // MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21); + // MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22); + // MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23); + // MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20); + // MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21); + + // if (MATCHES_NONE_VS (((d + MD4M_D) >> 16), s2)) continue; + + // MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22); + // MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23); + + // a += MD4M_A; + // b += MD4M_B; + // c += MD4M_C; + // d += MD4M_D; + + /** + * DES1 + */ + + u32x key[2]; + + transform_netntlmv1_key (a, b, key); + + u32x Kc[16]; + u32x Kd[16]; + + _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); + + u32x data[2]; + + data[0] = s0; + data[1] = s1; + + u32x iv1[2]; + + _des_crypt_encrypt (iv1, data, Kc, Kd, s_SPtrans); + + /** + * DES2 + */ + + transform_netntlmv1_key (((b >> 24) | (c << 8)), ((c >> 24) | (d << 8)), key); + + _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); + + u32x iv2[2]; + + _des_crypt_encrypt (iv2, data, Kc, Kd, s_SPtrans); + + /** + * compare + */ + + COMPARE_M_SIMD (iv1[0], iv1[1], iv2[0], iv2[1]); + } +} + +DECLSPEC void m05510s (SHM_TYPE u32 (*s_SPtrans)[64], SHM_TYPE u32 (*s_skb)[64], u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ()) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + + /** + * salt + */ + + const u32 s0 = salt_bufs[SALT_POS].salt_buf[0]; + const u32 s1 = salt_bufs[SALT_POS].salt_buf[1]; + const u32 s2 = salt_bufs[SALT_POS].salt_buf[2]; + + /** + * 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] + }; + + /** + * loop + */ + + u32 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; + + u32x w0_t[4]; + u32x w1_t[4]; + u32x w2_t[4]; + u32x w3_t[4]; + + w0_t[0] = w0; + w0_t[1] = w[ 1]; + w0_t[2] = w[ 2]; + w0_t[3] = w[ 3]; + w1_t[0] = w[ 4]; + w1_t[1] = w[ 5]; + w1_t[2] = w[ 6]; + w1_t[3] = w[ 7]; + w2_t[0] = w[ 8]; + w2_t[1] = w[ 9]; + w2_t[2] = w[10]; + w2_t[3] = w[11]; + w3_t[0] = w[12]; + w3_t[1] = w[13]; + w3_t[2] = w[14]; + w3_t[3] = w[15]; + + u32x a = w0; + u32x b = w[ 1]; + u32x c = w[ 2]; + u32x d = w[ 3]; + + // MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00); + // MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01); + // MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02); + // MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03); + // MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00); + // MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01); + // MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02); + // MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03); + // MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00); + // MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01); + // MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02); + // MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03); + // MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00); + // MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01); + // MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02); + // MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03); + + // MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10); + // MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11); + // MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12); + // MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13); + // MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10); + // MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11); + // MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12); + // MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13); + // MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10); + // MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11); + // MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12); + // MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13); + // MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10); + // MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11); + // MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12); + // MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13); + + // MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20); + // MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21); + // MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22); + // MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23); + // MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20); + // MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21); + // MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22); + // MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23); + // MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20); + // MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21); + // MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22); + // MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23); + // MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20); + // MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21); + + // if (MATCHES_NONE_VS (((d + MD4M_D) >> 16), s2)) continue; + + // MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22); + // MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23); + + // a += MD4M_A; + // b += MD4M_B; + // c += MD4M_C; + // d += MD4M_D; + + /** + * DES1 + */ + + u32x key[2]; + + transform_netntlmv1_key (a, b, key); + + u32x Kc[16]; + u32x Kd[16]; + + _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); + + u32x data[2]; + + data[0] = s0; + data[1] = s1; + + u32x iv1[2]; + + _des_crypt_encrypt (iv1, data, Kc, Kd, s_SPtrans); + + /** + * DES2 + */ + + /* + transform_netntlmv1_key (((b >> 24) | (c << 8)), ((c >> 24) | (d << 8)), key); + + _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); + + u32x iv2[2]; + + _des_crypt_encrypt (iv2, data, Kc, Kd, s_SPtrans); + */ + + u32x iv2[2]; + + iv2[0] = search[2]; + iv2[1] = search[3]; + + /** + * compare + */ + + COMPARE_S_SIMD (iv1[0], iv1[1], iv2[0], iv2[1]); + } +} + +KERNEL_FQ void m05510_m04 (KERN_ATTR_VECTOR ()) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * sbox, kbox + */ + + #ifdef REAL_SHM + + LOCAL_VK u32 s_SPtrans[8][64]; + LOCAL_VK u32 s_skb[8][64]; + + for (u32 i = lid; i < 64; i += lsz) + { + s_SPtrans[0][i] = c_SPtrans[0][i]; + s_SPtrans[1][i] = c_SPtrans[1][i]; + s_SPtrans[2][i] = c_SPtrans[2][i]; + s_SPtrans[3][i] = c_SPtrans[3][i]; + s_SPtrans[4][i] = c_SPtrans[4][i]; + s_SPtrans[5][i] = c_SPtrans[5][i]; + s_SPtrans[6][i] = c_SPtrans[6][i]; + s_SPtrans[7][i] = c_SPtrans[7][i]; + + s_skb[0][i] = c_skb[0][i]; + s_skb[1][i] = c_skb[1][i]; + s_skb[2][i] = c_skb[2][i]; + s_skb[3][i] = c_skb[3][i]; + s_skb[4][i] = c_skb[4][i]; + s_skb[5][i] = c_skb[5][i]; + s_skb[6][i] = c_skb[6][i]; + s_skb[7][i] = c_skb[7][i]; + } + + SYNC_THREADS (); + + #else + + CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; + CONSTANT_AS u32a (*s_skb)[64] = c_skb; + + #endif + + if (gid >= gid_max) return; + + /** + * base + */ + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = 0; + w[ 5] = 0; + w[ 6] = 0; + w[ 7] = 0; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = pws[gid].i[14]; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * main + */ + + m05510m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, pws_pos, gid_max); +} + +KERNEL_FQ void m05510_m08 (KERN_ATTR_VECTOR ()) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * sbox, kbox + */ + + #ifdef REAL_SHM + + LOCAL_VK u32 s_SPtrans[8][64]; + LOCAL_VK u32 s_skb[8][64]; + + for (u32 i = lid; i < 64; i += lsz) + { + s_SPtrans[0][i] = c_SPtrans[0][i]; + s_SPtrans[1][i] = c_SPtrans[1][i]; + s_SPtrans[2][i] = c_SPtrans[2][i]; + s_SPtrans[3][i] = c_SPtrans[3][i]; + s_SPtrans[4][i] = c_SPtrans[4][i]; + s_SPtrans[5][i] = c_SPtrans[5][i]; + s_SPtrans[6][i] = c_SPtrans[6][i]; + s_SPtrans[7][i] = c_SPtrans[7][i]; + + s_skb[0][i] = c_skb[0][i]; + s_skb[1][i] = c_skb[1][i]; + s_skb[2][i] = c_skb[2][i]; + s_skb[3][i] = c_skb[3][i]; + s_skb[4][i] = c_skb[4][i]; + s_skb[5][i] = c_skb[5][i]; + s_skb[6][i] = c_skb[6][i]; + s_skb[7][i] = c_skb[7][i]; + } + + SYNC_THREADS (); + + #else + + CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; + CONSTANT_AS u32a (*s_skb)[64] = c_skb; + + #endif + + if (gid >= gid_max) return; + + /** + * base + */ + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = pws[gid].i[14]; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * main + */ + + m05510m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, pws_pos, gid_max); +} + +KERNEL_FQ void m05510_m16 (KERN_ATTR_VECTOR ()) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * sbox, kbox + */ + + #ifdef REAL_SHM + + LOCAL_VK u32 s_SPtrans[8][64]; + LOCAL_VK u32 s_skb[8][64]; + + for (u32 i = lid; i < 64; i += lsz) + { + s_SPtrans[0][i] = c_SPtrans[0][i]; + s_SPtrans[1][i] = c_SPtrans[1][i]; + s_SPtrans[2][i] = c_SPtrans[2][i]; + s_SPtrans[3][i] = c_SPtrans[3][i]; + s_SPtrans[4][i] = c_SPtrans[4][i]; + s_SPtrans[5][i] = c_SPtrans[5][i]; + s_SPtrans[6][i] = c_SPtrans[6][i]; + s_SPtrans[7][i] = c_SPtrans[7][i]; + + s_skb[0][i] = c_skb[0][i]; + s_skb[1][i] = c_skb[1][i]; + s_skb[2][i] = c_skb[2][i]; + s_skb[3][i] = c_skb[3][i]; + s_skb[4][i] = c_skb[4][i]; + s_skb[5][i] = c_skb[5][i]; + s_skb[6][i] = c_skb[6][i]; + s_skb[7][i] = c_skb[7][i]; + } + + SYNC_THREADS (); + + #else + + CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; + CONSTANT_AS u32a (*s_skb)[64] = c_skb; + + #endif + + if (gid >= gid_max) return; + + /** + * base + */ + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = pws[gid].i[ 8]; + w[ 9] = pws[gid].i[ 9]; + w[10] = pws[gid].i[10]; + w[11] = pws[gid].i[11]; + w[12] = pws[gid].i[12]; + w[13] = pws[gid].i[13]; + w[14] = pws[gid].i[14]; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * main + */ + + m05510m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, pws_pos, gid_max); +} + +KERNEL_FQ void m05510_s04 (KERN_ATTR_VECTOR ()) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * sbox, kbox + */ + + #ifdef REAL_SHM + + LOCAL_VK u32 s_SPtrans[8][64]; + LOCAL_VK u32 s_skb[8][64]; + + for (u32 i = lid; i < 64; i += lsz) + { + s_SPtrans[0][i] = c_SPtrans[0][i]; + s_SPtrans[1][i] = c_SPtrans[1][i]; + s_SPtrans[2][i] = c_SPtrans[2][i]; + s_SPtrans[3][i] = c_SPtrans[3][i]; + s_SPtrans[4][i] = c_SPtrans[4][i]; + s_SPtrans[5][i] = c_SPtrans[5][i]; + s_SPtrans[6][i] = c_SPtrans[6][i]; + s_SPtrans[7][i] = c_SPtrans[7][i]; + + s_skb[0][i] = c_skb[0][i]; + s_skb[1][i] = c_skb[1][i]; + s_skb[2][i] = c_skb[2][i]; + s_skb[3][i] = c_skb[3][i]; + s_skb[4][i] = c_skb[4][i]; + s_skb[5][i] = c_skb[5][i]; + s_skb[6][i] = c_skb[6][i]; + s_skb[7][i] = c_skb[7][i]; + } + + SYNC_THREADS (); + + #else + + CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; + CONSTANT_AS u32a (*s_skb)[64] = c_skb; + + #endif + + if (gid >= gid_max) return; + + /** + * base + */ + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = 0; + w[ 5] = 0; + w[ 6] = 0; + w[ 7] = 0; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = pws[gid].i[14]; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * main + */ + + m05510s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, pws_pos, gid_max); +} + +KERNEL_FQ void m05510_s08 (KERN_ATTR_VECTOR ()) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * sbox, kbox + */ + + #ifdef REAL_SHM + + LOCAL_VK u32 s_SPtrans[8][64]; + LOCAL_VK u32 s_skb[8][64]; + + for (u32 i = lid; i < 64; i += lsz) + { + s_SPtrans[0][i] = c_SPtrans[0][i]; + s_SPtrans[1][i] = c_SPtrans[1][i]; + s_SPtrans[2][i] = c_SPtrans[2][i]; + s_SPtrans[3][i] = c_SPtrans[3][i]; + s_SPtrans[4][i] = c_SPtrans[4][i]; + s_SPtrans[5][i] = c_SPtrans[5][i]; + s_SPtrans[6][i] = c_SPtrans[6][i]; + s_SPtrans[7][i] = c_SPtrans[7][i]; + + s_skb[0][i] = c_skb[0][i]; + s_skb[1][i] = c_skb[1][i]; + s_skb[2][i] = c_skb[2][i]; + s_skb[3][i] = c_skb[3][i]; + s_skb[4][i] = c_skb[4][i]; + s_skb[5][i] = c_skb[5][i]; + s_skb[6][i] = c_skb[6][i]; + s_skb[7][i] = c_skb[7][i]; + } + + SYNC_THREADS (); + + #else + + CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; + CONSTANT_AS u32a (*s_skb)[64] = c_skb; + + #endif + + if (gid >= gid_max) return; + + /** + * base + */ + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = pws[gid].i[14]; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * main + */ + + m05510s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, pws_pos, gid_max); +} + +KERNEL_FQ void m05510_s16 (KERN_ATTR_VECTOR ()) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * sbox, kbox + */ + + #ifdef REAL_SHM + + LOCAL_VK u32 s_SPtrans[8][64]; + LOCAL_VK u32 s_skb[8][64]; + + for (u32 i = lid; i < 64; i += lsz) + { + s_SPtrans[0][i] = c_SPtrans[0][i]; + s_SPtrans[1][i] = c_SPtrans[1][i]; + s_SPtrans[2][i] = c_SPtrans[2][i]; + s_SPtrans[3][i] = c_SPtrans[3][i]; + s_SPtrans[4][i] = c_SPtrans[4][i]; + s_SPtrans[5][i] = c_SPtrans[5][i]; + s_SPtrans[6][i] = c_SPtrans[6][i]; + s_SPtrans[7][i] = c_SPtrans[7][i]; + + s_skb[0][i] = c_skb[0][i]; + s_skb[1][i] = c_skb[1][i]; + s_skb[2][i] = c_skb[2][i]; + s_skb[3][i] = c_skb[3][i]; + s_skb[4][i] = c_skb[4][i]; + s_skb[5][i] = c_skb[5][i]; + s_skb[6][i] = c_skb[6][i]; + s_skb[7][i] = c_skb[7][i]; + } + + SYNC_THREADS (); + + #else + + CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; + CONSTANT_AS u32a (*s_skb)[64] = c_skb; + + #endif + + if (gid >= gid_max) return; + + /** + * base + */ + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = pws[gid].i[ 8]; + w[ 9] = pws[gid].i[ 9]; + w[10] = pws[gid].i[10]; + w[11] = pws[gid].i[11]; + w[12] = pws[gid].i[12]; + w[13] = pws[gid].i[13]; + w[14] = pws[gid].i[14]; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len & 63; + + /** + * main + */ + + m05510s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, pws_pos, gid_max); +} diff --git a/OpenCL/m05510_a3-pure.cl b/OpenCL/m05510_a3-pure.cl new file mode 100644 index 000000000..9cb5d9730 --- /dev/null +++ b/OpenCL/m05510_a3-pure.cl @@ -0,0 +1,803 @@ +/** + * 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_md4.cl" +#endif + +typedef struct netntlm +{ + u32 user_len; + u32 domain_len; + u32 srvchall_len; + u32 clichall_len; + + u32 userdomain_buf[64]; + u32 chall_buf[256]; + +} netntlm_t; + +#define PERM_OP(a,b,tt,n,m) \ +{ \ + tt = a >> n; \ + tt = tt ^ b; \ + tt = tt & m; \ + b = b ^ tt; \ + tt = tt << n; \ + a = a ^ tt; \ +} + +#define HPERM_OP(a,tt,n,m) \ +{ \ + tt = a << (16 + n); \ + tt = tt ^ a; \ + tt = tt & m; \ + a = a ^ tt; \ + tt = tt >> (16 + n); \ + a = a ^ tt; \ +} + +CONSTANT_VK u32a c_SPtrans[8][64] = +{ + { + 0x02080800, 0x00080000, 0x02000002, 0x02080802, + 0x02000000, 0x00080802, 0x00080002, 0x02000002, + 0x00080802, 0x02080800, 0x02080000, 0x00000802, + 0x02000802, 0x02000000, 0x00000000, 0x00080002, + 0x00080000, 0x00000002, 0x02000800, 0x00080800, + 0x02080802, 0x02080000, 0x00000802, 0x02000800, + 0x00000002, 0x00000800, 0x00080800, 0x02080002, + 0x00000800, 0x02000802, 0x02080002, 0x00000000, + 0x00000000, 0x02080802, 0x02000800, 0x00080002, + 0x02080800, 0x00080000, 0x00000802, 0x02000800, + 0x02080002, 0x00000800, 0x00080800, 0x02000002, + 0x00080802, 0x00000002, 0x02000002, 0x02080000, + 0x02080802, 0x00080800, 0x02080000, 0x02000802, + 0x02000000, 0x00000802, 0x00080002, 0x00000000, + 0x00080000, 0x02000000, 0x02000802, 0x02080800, + 0x00000002, 0x02080002, 0x00000800, 0x00080802, + }, + { + 0x40108010, 0x00000000, 0x00108000, 0x40100000, + 0x40000010, 0x00008010, 0x40008000, 0x00108000, + 0x00008000, 0x40100010, 0x00000010, 0x40008000, + 0x00100010, 0x40108000, 0x40100000, 0x00000010, + 0x00100000, 0x40008010, 0x40100010, 0x00008000, + 0x00108010, 0x40000000, 0x00000000, 0x00100010, + 0x40008010, 0x00108010, 0x40108000, 0x40000010, + 0x40000000, 0x00100000, 0x00008010, 0x40108010, + 0x00100010, 0x40108000, 0x40008000, 0x00108010, + 0x40108010, 0x00100010, 0x40000010, 0x00000000, + 0x40000000, 0x00008010, 0x00100000, 0x40100010, + 0x00008000, 0x40000000, 0x00108010, 0x40008010, + 0x40108000, 0x00008000, 0x00000000, 0x40000010, + 0x00000010, 0x40108010, 0x00108000, 0x40100000, + 0x40100010, 0x00100000, 0x00008010, 0x40008000, + 0x40008010, 0x00000010, 0x40100000, 0x00108000, + }, + { + 0x04000001, 0x04040100, 0x00000100, 0x04000101, + 0x00040001, 0x04000000, 0x04000101, 0x00040100, + 0x04000100, 0x00040000, 0x04040000, 0x00000001, + 0x04040101, 0x00000101, 0x00000001, 0x04040001, + 0x00000000, 0x00040001, 0x04040100, 0x00000100, + 0x00000101, 0x04040101, 0x00040000, 0x04000001, + 0x04040001, 0x04000100, 0x00040101, 0x04040000, + 0x00040100, 0x00000000, 0x04000000, 0x00040101, + 0x04040100, 0x00000100, 0x00000001, 0x00040000, + 0x00000101, 0x00040001, 0x04040000, 0x04000101, + 0x00000000, 0x04040100, 0x00040100, 0x04040001, + 0x00040001, 0x04000000, 0x04040101, 0x00000001, + 0x00040101, 0x04000001, 0x04000000, 0x04040101, + 0x00040000, 0x04000100, 0x04000101, 0x00040100, + 0x04000100, 0x00000000, 0x04040001, 0x00000101, + 0x04000001, 0x00040101, 0x00000100, 0x04040000, + }, + { + 0x00401008, 0x10001000, 0x00000008, 0x10401008, + 0x00000000, 0x10400000, 0x10001008, 0x00400008, + 0x10401000, 0x10000008, 0x10000000, 0x00001008, + 0x10000008, 0x00401008, 0x00400000, 0x10000000, + 0x10400008, 0x00401000, 0x00001000, 0x00000008, + 0x00401000, 0x10001008, 0x10400000, 0x00001000, + 0x00001008, 0x00000000, 0x00400008, 0x10401000, + 0x10001000, 0x10400008, 0x10401008, 0x00400000, + 0x10400008, 0x00001008, 0x00400000, 0x10000008, + 0x00401000, 0x10001000, 0x00000008, 0x10400000, + 0x10001008, 0x00000000, 0x00001000, 0x00400008, + 0x00000000, 0x10400008, 0x10401000, 0x00001000, + 0x10000000, 0x10401008, 0x00401008, 0x00400000, + 0x10401008, 0x00000008, 0x10001000, 0x00401008, + 0x00400008, 0x00401000, 0x10400000, 0x10001008, + 0x00001008, 0x10000000, 0x10000008, 0x10401000, + }, + { + 0x08000000, 0x00010000, 0x00000400, 0x08010420, + 0x08010020, 0x08000400, 0x00010420, 0x08010000, + 0x00010000, 0x00000020, 0x08000020, 0x00010400, + 0x08000420, 0x08010020, 0x08010400, 0x00000000, + 0x00010400, 0x08000000, 0x00010020, 0x00000420, + 0x08000400, 0x00010420, 0x00000000, 0x08000020, + 0x00000020, 0x08000420, 0x08010420, 0x00010020, + 0x08010000, 0x00000400, 0x00000420, 0x08010400, + 0x08010400, 0x08000420, 0x00010020, 0x08010000, + 0x00010000, 0x00000020, 0x08000020, 0x08000400, + 0x08000000, 0x00010400, 0x08010420, 0x00000000, + 0x00010420, 0x08000000, 0x00000400, 0x00010020, + 0x08000420, 0x00000400, 0x00000000, 0x08010420, + 0x08010020, 0x08010400, 0x00000420, 0x00010000, + 0x00010400, 0x08010020, 0x08000400, 0x00000420, + 0x00000020, 0x00010420, 0x08010000, 0x08000020, + }, + { + 0x80000040, 0x00200040, 0x00000000, 0x80202000, + 0x00200040, 0x00002000, 0x80002040, 0x00200000, + 0x00002040, 0x80202040, 0x00202000, 0x80000000, + 0x80002000, 0x80000040, 0x80200000, 0x00202040, + 0x00200000, 0x80002040, 0x80200040, 0x00000000, + 0x00002000, 0x00000040, 0x80202000, 0x80200040, + 0x80202040, 0x80200000, 0x80000000, 0x00002040, + 0x00000040, 0x00202000, 0x00202040, 0x80002000, + 0x00002040, 0x80000000, 0x80002000, 0x00202040, + 0x80202000, 0x00200040, 0x00000000, 0x80002000, + 0x80000000, 0x00002000, 0x80200040, 0x00200000, + 0x00200040, 0x80202040, 0x00202000, 0x00000040, + 0x80202040, 0x00202000, 0x00200000, 0x80002040, + 0x80000040, 0x80200000, 0x00202040, 0x00000000, + 0x00002000, 0x80000040, 0x80002040, 0x80202000, + 0x80200000, 0x00002040, 0x00000040, 0x80200040, + }, + { + 0x00004000, 0x00000200, 0x01000200, 0x01000004, + 0x01004204, 0x00004004, 0x00004200, 0x00000000, + 0x01000000, 0x01000204, 0x00000204, 0x01004000, + 0x00000004, 0x01004200, 0x01004000, 0x00000204, + 0x01000204, 0x00004000, 0x00004004, 0x01004204, + 0x00000000, 0x01000200, 0x01000004, 0x00004200, + 0x01004004, 0x00004204, 0x01004200, 0x00000004, + 0x00004204, 0x01004004, 0x00000200, 0x01000000, + 0x00004204, 0x01004000, 0x01004004, 0x00000204, + 0x00004000, 0x00000200, 0x01000000, 0x01004004, + 0x01000204, 0x00004204, 0x00004200, 0x00000000, + 0x00000200, 0x01000004, 0x00000004, 0x01000200, + 0x00000000, 0x01000204, 0x01000200, 0x00004200, + 0x00000204, 0x00004000, 0x01004204, 0x01000000, + 0x01004200, 0x00000004, 0x00004004, 0x01004204, + 0x01000004, 0x01004200, 0x01004000, 0x00004004, + }, + { + 0x20800080, 0x20820000, 0x00020080, 0x00000000, + 0x20020000, 0x00800080, 0x20800000, 0x20820080, + 0x00000080, 0x20000000, 0x00820000, 0x00020080, + 0x00820080, 0x20020080, 0x20000080, 0x20800000, + 0x00020000, 0x00820080, 0x00800080, 0x20020000, + 0x20820080, 0x20000080, 0x00000000, 0x00820000, + 0x20000000, 0x00800000, 0x20020080, 0x20800080, + 0x00800000, 0x00020000, 0x20820000, 0x00000080, + 0x00800000, 0x00020000, 0x20000080, 0x20820080, + 0x00020080, 0x20000000, 0x00000000, 0x00820000, + 0x20800080, 0x20020080, 0x20020000, 0x00800080, + 0x20820000, 0x00000080, 0x00800080, 0x20020000, + 0x20820080, 0x00800000, 0x20800000, 0x20000080, + 0x00820000, 0x00020080, 0x20020080, 0x20800000, + 0x00000080, 0x20820000, 0x00820080, 0x00000000, + 0x20000000, 0x20800080, 0x00020000, 0x00820080, + } +}; + +CONSTANT_VK u32a c_skb[8][64] = +{ + { + 0x00000000, 0x00000010, 0x20000000, 0x20000010, + 0x00010000, 0x00010010, 0x20010000, 0x20010010, + 0x00000800, 0x00000810, 0x20000800, 0x20000810, + 0x00010800, 0x00010810, 0x20010800, 0x20010810, + 0x00000020, 0x00000030, 0x20000020, 0x20000030, + 0x00010020, 0x00010030, 0x20010020, 0x20010030, + 0x00000820, 0x00000830, 0x20000820, 0x20000830, + 0x00010820, 0x00010830, 0x20010820, 0x20010830, + 0x00080000, 0x00080010, 0x20080000, 0x20080010, + 0x00090000, 0x00090010, 0x20090000, 0x20090010, + 0x00080800, 0x00080810, 0x20080800, 0x20080810, + 0x00090800, 0x00090810, 0x20090800, 0x20090810, + 0x00080020, 0x00080030, 0x20080020, 0x20080030, + 0x00090020, 0x00090030, 0x20090020, 0x20090030, + 0x00080820, 0x00080830, 0x20080820, 0x20080830, + 0x00090820, 0x00090830, 0x20090820, 0x20090830, + }, + { + 0x00000000, 0x02000000, 0x00002000, 0x02002000, + 0x00200000, 0x02200000, 0x00202000, 0x02202000, + 0x00000004, 0x02000004, 0x00002004, 0x02002004, + 0x00200004, 0x02200004, 0x00202004, 0x02202004, + 0x00000400, 0x02000400, 0x00002400, 0x02002400, + 0x00200400, 0x02200400, 0x00202400, 0x02202400, + 0x00000404, 0x02000404, 0x00002404, 0x02002404, + 0x00200404, 0x02200404, 0x00202404, 0x02202404, + 0x10000000, 0x12000000, 0x10002000, 0x12002000, + 0x10200000, 0x12200000, 0x10202000, 0x12202000, + 0x10000004, 0x12000004, 0x10002004, 0x12002004, + 0x10200004, 0x12200004, 0x10202004, 0x12202004, + 0x10000400, 0x12000400, 0x10002400, 0x12002400, + 0x10200400, 0x12200400, 0x10202400, 0x12202400, + 0x10000404, 0x12000404, 0x10002404, 0x12002404, + 0x10200404, 0x12200404, 0x10202404, 0x12202404, + }, + { + 0x00000000, 0x00000001, 0x00040000, 0x00040001, + 0x01000000, 0x01000001, 0x01040000, 0x01040001, + 0x00000002, 0x00000003, 0x00040002, 0x00040003, + 0x01000002, 0x01000003, 0x01040002, 0x01040003, + 0x00000200, 0x00000201, 0x00040200, 0x00040201, + 0x01000200, 0x01000201, 0x01040200, 0x01040201, + 0x00000202, 0x00000203, 0x00040202, 0x00040203, + 0x01000202, 0x01000203, 0x01040202, 0x01040203, + 0x08000000, 0x08000001, 0x08040000, 0x08040001, + 0x09000000, 0x09000001, 0x09040000, 0x09040001, + 0x08000002, 0x08000003, 0x08040002, 0x08040003, + 0x09000002, 0x09000003, 0x09040002, 0x09040003, + 0x08000200, 0x08000201, 0x08040200, 0x08040201, + 0x09000200, 0x09000201, 0x09040200, 0x09040201, + 0x08000202, 0x08000203, 0x08040202, 0x08040203, + 0x09000202, 0x09000203, 0x09040202, 0x09040203, + }, + { + 0x00000000, 0x00100000, 0x00000100, 0x00100100, + 0x00000008, 0x00100008, 0x00000108, 0x00100108, + 0x00001000, 0x00101000, 0x00001100, 0x00101100, + 0x00001008, 0x00101008, 0x00001108, 0x00101108, + 0x04000000, 0x04100000, 0x04000100, 0x04100100, + 0x04000008, 0x04100008, 0x04000108, 0x04100108, + 0x04001000, 0x04101000, 0x04001100, 0x04101100, + 0x04001008, 0x04101008, 0x04001108, 0x04101108, + 0x00020000, 0x00120000, 0x00020100, 0x00120100, + 0x00020008, 0x00120008, 0x00020108, 0x00120108, + 0x00021000, 0x00121000, 0x00021100, 0x00121100, + 0x00021008, 0x00121008, 0x00021108, 0x00121108, + 0x04020000, 0x04120000, 0x04020100, 0x04120100, + 0x04020008, 0x04120008, 0x04020108, 0x04120108, + 0x04021000, 0x04121000, 0x04021100, 0x04121100, + 0x04021008, 0x04121008, 0x04021108, 0x04121108, + }, + { + 0x00000000, 0x10000000, 0x00010000, 0x10010000, + 0x00000004, 0x10000004, 0x00010004, 0x10010004, + 0x20000000, 0x30000000, 0x20010000, 0x30010000, + 0x20000004, 0x30000004, 0x20010004, 0x30010004, + 0x00100000, 0x10100000, 0x00110000, 0x10110000, + 0x00100004, 0x10100004, 0x00110004, 0x10110004, + 0x20100000, 0x30100000, 0x20110000, 0x30110000, + 0x20100004, 0x30100004, 0x20110004, 0x30110004, + 0x00001000, 0x10001000, 0x00011000, 0x10011000, + 0x00001004, 0x10001004, 0x00011004, 0x10011004, + 0x20001000, 0x30001000, 0x20011000, 0x30011000, + 0x20001004, 0x30001004, 0x20011004, 0x30011004, + 0x00101000, 0x10101000, 0x00111000, 0x10111000, + 0x00101004, 0x10101004, 0x00111004, 0x10111004, + 0x20101000, 0x30101000, 0x20111000, 0x30111000, + 0x20101004, 0x30101004, 0x20111004, 0x30111004, + }, + { + 0x00000000, 0x08000000, 0x00000008, 0x08000008, + 0x00000400, 0x08000400, 0x00000408, 0x08000408, + 0x00020000, 0x08020000, 0x00020008, 0x08020008, + 0x00020400, 0x08020400, 0x00020408, 0x08020408, + 0x00000001, 0x08000001, 0x00000009, 0x08000009, + 0x00000401, 0x08000401, 0x00000409, 0x08000409, + 0x00020001, 0x08020001, 0x00020009, 0x08020009, + 0x00020401, 0x08020401, 0x00020409, 0x08020409, + 0x02000000, 0x0A000000, 0x02000008, 0x0A000008, + 0x02000400, 0x0A000400, 0x02000408, 0x0A000408, + 0x02020000, 0x0A020000, 0x02020008, 0x0A020008, + 0x02020400, 0x0A020400, 0x02020408, 0x0A020408, + 0x02000001, 0x0A000001, 0x02000009, 0x0A000009, + 0x02000401, 0x0A000401, 0x02000409, 0x0A000409, + 0x02020001, 0x0A020001, 0x02020009, 0x0A020009, + 0x02020401, 0x0A020401, 0x02020409, 0x0A020409, + }, + { + 0x00000000, 0x00000100, 0x00080000, 0x00080100, + 0x01000000, 0x01000100, 0x01080000, 0x01080100, + 0x00000010, 0x00000110, 0x00080010, 0x00080110, + 0x01000010, 0x01000110, 0x01080010, 0x01080110, + 0x00200000, 0x00200100, 0x00280000, 0x00280100, + 0x01200000, 0x01200100, 0x01280000, 0x01280100, + 0x00200010, 0x00200110, 0x00280010, 0x00280110, + 0x01200010, 0x01200110, 0x01280010, 0x01280110, + 0x00000200, 0x00000300, 0x00080200, 0x00080300, + 0x01000200, 0x01000300, 0x01080200, 0x01080300, + 0x00000210, 0x00000310, 0x00080210, 0x00080310, + 0x01000210, 0x01000310, 0x01080210, 0x01080310, + 0x00200200, 0x00200300, 0x00280200, 0x00280300, + 0x01200200, 0x01200300, 0x01280200, 0x01280300, + 0x00200210, 0x00200310, 0x00280210, 0x00280310, + 0x01200210, 0x01200310, 0x01280210, 0x01280310, + }, + { + 0x00000000, 0x04000000, 0x00040000, 0x04040000, + 0x00000002, 0x04000002, 0x00040002, 0x04040002, + 0x00002000, 0x04002000, 0x00042000, 0x04042000, + 0x00002002, 0x04002002, 0x00042002, 0x04042002, + 0x00000020, 0x04000020, 0x00040020, 0x04040020, + 0x00000022, 0x04000022, 0x00040022, 0x04040022, + 0x00002020, 0x04002020, 0x00042020, 0x04042020, + 0x00002022, 0x04002022, 0x00042022, 0x04042022, + 0x00000800, 0x04000800, 0x00040800, 0x04040800, + 0x00000802, 0x04000802, 0x00040802, 0x04040802, + 0x00002800, 0x04002800, 0x00042800, 0x04042800, + 0x00002802, 0x04002802, 0x00042802, 0x04042802, + 0x00000820, 0x04000820, 0x00040820, 0x04040820, + 0x00000822, 0x04000822, 0x00040822, 0x04040822, + 0x00002820, 0x04002820, 0x00042820, 0x04042820, + 0x00002822, 0x04002822, 0x00042822, 0x04042822 + } +}; + +#if VECT_SIZE == 1 +#define BOX(i,n,S) (S)[(n)][(i)] +#elif VECT_SIZE == 2 +#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1]) +#elif VECT_SIZE == 4 +#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3]) +#elif VECT_SIZE == 8 +#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7]) +#elif VECT_SIZE == 16 +#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7], (S)[(n)][(i).s8], (S)[(n)][(i).s9], (S)[(n)][(i).sa], (S)[(n)][(i).sb], (S)[(n)][(i).sc], (S)[(n)][(i).sd], (S)[(n)][(i).se], (S)[(n)][(i).sf]) +#endif + +DECLSPEC void _des_crypt_encrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64]) +{ + u32x r = data[0]; + u32x l = data[1]; + + #ifdef _unroll + #pragma unroll + #endif + for (u32 i = 0; i < 16; i += 2) + { + u32x u; + u32x t; + + u = Kc[i + 0] ^ hc_rotl32 (r, 30u); + t = Kd[i + 0] ^ hc_rotl32 (r, 26u); + + l ^= BOX (((u >> 0) & 0x3f), 0, s_SPtrans) + | BOX (((u >> 8) & 0x3f), 2, s_SPtrans) + | BOX (((u >> 16) & 0x3f), 4, s_SPtrans) + | BOX (((u >> 24) & 0x3f), 6, s_SPtrans) + | BOX (((t >> 0) & 0x3f), 1, s_SPtrans) + | BOX (((t >> 8) & 0x3f), 3, s_SPtrans) + | BOX (((t >> 16) & 0x3f), 5, s_SPtrans) + | BOX (((t >> 24) & 0x3f), 7, s_SPtrans); + + u = Kc[i + 1] ^ hc_rotl32 (l, 30u); + t = Kd[i + 1] ^ hc_rotl32 (l, 26u); + + r ^= BOX (((u >> 0) & 0x3f), 0, s_SPtrans) + | BOX (((u >> 8) & 0x3f), 2, s_SPtrans) + | BOX (((u >> 16) & 0x3f), 4, s_SPtrans) + | BOX (((u >> 24) & 0x3f), 6, s_SPtrans) + | BOX (((t >> 0) & 0x3f), 1, s_SPtrans) + | BOX (((t >> 8) & 0x3f), 3, s_SPtrans) + | BOX (((t >> 16) & 0x3f), 5, s_SPtrans) + | BOX (((t >> 24) & 0x3f), 7, s_SPtrans); + } + + iv[0] = l; + iv[1] = r; +} + +DECLSPEC void _des_crypt_keysetup (u32x c, u32x d, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_skb)[64]) +{ + u32x tt; + + PERM_OP (d, c, tt, 4, 0x0f0f0f0f); + HPERM_OP (c, tt, 2, 0xcccc0000); + HPERM_OP (d, tt, 2, 0xcccc0000); + PERM_OP (d, c, tt, 1, 0x55555555); + PERM_OP (c, d, tt, 8, 0x00ff00ff); + PERM_OP (d, c, tt, 1, 0x55555555); + + d = ((d & 0x000000ff) << 16) + | ((d & 0x0000ff00) << 0) + | ((d & 0x00ff0000) >> 16) + | ((c & 0xf0000000) >> 4); + + c = c & 0x0fffffff; + + #ifdef _unroll + #pragma unroll + #endif + for (u32 i = 0; i < 16; i++) + { + if ((i < 2) || (i == 8) || (i == 15)) + { + c = ((c >> 1) | (c << 27)); + d = ((d >> 1) | (d << 27)); + } + else + { + c = ((c >> 2) | (c << 26)); + d = ((d >> 2) | (d << 26)); + } + + c = c & 0x0fffffff; + d = d & 0x0fffffff; + + const u32x c00 = (c >> 0) & 0x0000003f; + const u32x c06 = (c >> 6) & 0x00383003; + const u32x c07 = (c >> 7) & 0x0000003c; + const u32x c13 = (c >> 13) & 0x0000060f; + const u32x c20 = (c >> 20) & 0x00000001; + + u32x s = BOX (((c00 >> 0) & 0xff), 0, s_skb) + | BOX (((c06 >> 0) & 0xff) + |((c07 >> 0) & 0xff), 1, s_skb) + | BOX (((c13 >> 0) & 0xff) + |((c06 >> 8) & 0xff), 2, s_skb) + | BOX (((c20 >> 0) & 0xff) + |((c13 >> 8) & 0xff) + |((c06 >> 16) & 0xff), 3, s_skb); + + const u32x d00 = (d >> 0) & 0x00003c3f; + const u32x d07 = (d >> 7) & 0x00003f03; + const u32x d21 = (d >> 21) & 0x0000000f; + const u32x d22 = (d >> 22) & 0x00000030; + + u32x t = BOX (((d00 >> 0) & 0xff), 4, s_skb) + | BOX (((d07 >> 0) & 0xff) + |((d00 >> 8) & 0xff), 5, s_skb) + | BOX (((d07 >> 8) & 0xff), 6, s_skb) + | BOX (((d21 >> 0) & 0xff) + |((d22 >> 0) & 0xff), 7, s_skb); + + Kc[i] = ((t << 16) | (s & 0x0000ffff)); + Kd[i] = ((s >> 16) | (t & 0xffff0000)); + } +} + +DECLSPEC void transform_netntlmv1_key (const u32x w0, const u32x w1, u32x *out) +{ + u32x t[8]; + + t[0] = (w0 >> 0) & 0xff; + t[1] = (w0 >> 8) & 0xff; + t[2] = (w0 >> 16) & 0xff; + t[3] = (w0 >> 24) & 0xff; + t[4] = (w1 >> 0) & 0xff; + t[5] = (w1 >> 8) & 0xff; + t[6] = (w1 >> 16) & 0xff; + t[7] = (w1 >> 24) & 0xff; + + u32x k[8]; + + k[0] = (t[0] >> 0); + k[1] = (t[0] << 7) | (t[1] >> 1); + k[2] = (t[1] << 6) | (t[2] >> 2); + k[3] = (t[2] << 5) | (t[3] >> 3); + k[4] = (t[3] << 4) | (t[4] >> 4); + k[5] = (t[4] << 3) | (t[5] >> 5); + k[6] = (t[5] << 2) | (t[6] >> 6); + k[7] = (t[6] << 1); + + out[0] = ((k[0] & 0xff) << 0) + | ((k[1] & 0xff) << 8) + | ((k[2] & 0xff) << 16) + | ((k[3] & 0xff) << 24); + + out[1] = ((k[4] & 0xff) << 0) + | ((k[5] & 0xff) << 8) + | ((k[6] & 0xff) << 16) + | ((k[7] & 0xff) << 24); +} + +KERNEL_FQ void m05510_mxx (KERN_ATTR_VECTOR ()) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * sbox, kbox + */ + + #ifdef REAL_SHM + + LOCAL_VK u32 s_SPtrans[8][64]; + LOCAL_VK u32 s_skb[8][64]; + + for (u32 i = lid; i < 64; i += lsz) + { + s_SPtrans[0][i] = c_SPtrans[0][i]; + s_SPtrans[1][i] = c_SPtrans[1][i]; + s_SPtrans[2][i] = c_SPtrans[2][i]; + s_SPtrans[3][i] = c_SPtrans[3][i]; + s_SPtrans[4][i] = c_SPtrans[4][i]; + s_SPtrans[5][i] = c_SPtrans[5][i]; + s_SPtrans[6][i] = c_SPtrans[6][i]; + s_SPtrans[7][i] = c_SPtrans[7][i]; + + s_skb[0][i] = c_skb[0][i]; + s_skb[1][i] = c_skb[1][i]; + s_skb[2][i] = c_skb[2][i]; + s_skb[3][i] = c_skb[3][i]; + s_skb[4][i] = c_skb[4][i]; + s_skb[5][i] = c_skb[5][i]; + s_skb[6][i] = c_skb[6][i]; + s_skb[7][i] = c_skb[7][i]; + } + + SYNC_THREADS (); + + #else + + CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; + CONSTANT_AS u32a (*s_skb)[64] = c_skb; + + #endif + + if (gid >= gid_max) return; + + /** + * salt + */ + + const u32 s0 = salt_bufs[SALT_POS].salt_buf[0]; + const u32 s1 = salt_bufs[SALT_POS].salt_buf[1]; + const u32 s2 = salt_bufs[SALT_POS].salt_buf[2]; + + /** + * 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]; + } + + /** + * 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; + + // md4_ctx_vector_t ctx; + + // md4_init_vector (&ctx); + + // md4_update_vector_utf16le (&ctx, w, pw_len); + + // md4_final_vector (&ctx); + + const u32x a = w[0]; + const u32x b = w[1]; + const u32x c = w[2]; + const u32x d = w[3]; + + if (MATCHES_NONE_VS ((d >> 16), s2)) continue; + + /** + * DES1 + */ + + u32x key[2]; + + transform_netntlmv1_key (a, b, key); + + u32x Kc[16]; + u32x Kd[16]; + + _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); + + u32x data[2]; + + data[0] = s0; + data[1] = s1; + + u32x out1[2]; + + _des_crypt_encrypt (out1, data, Kc, Kd, s_SPtrans); + + /** + * DES2 + */ + + transform_netntlmv1_key (((b >> 24) | (c << 8)), ((c >> 24) | (d << 8)), key); + + _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); + + u32x out2[2]; + + _des_crypt_encrypt (out2, data, Kc, Kd, s_SPtrans); + + const u32x r0 = out1[0]; + const u32x r1 = out1[1]; + const u32x r2 = out2[0]; + const u32x r3 = out2[1]; + + COMPARE_M_SIMD (r0, r1, r2, r3); + } +} + +KERNEL_FQ void m05510_sxx (KERN_ATTR_VECTOR ()) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + /** + * sbox, kbox + */ + + #ifdef REAL_SHM + + LOCAL_VK u32 s_SPtrans[8][64]; + LOCAL_VK u32 s_skb[8][64]; + + for (u32 i = lid; i < 64; i += lsz) + { + s_SPtrans[0][i] = c_SPtrans[0][i]; + s_SPtrans[1][i] = c_SPtrans[1][i]; + s_SPtrans[2][i] = c_SPtrans[2][i]; + s_SPtrans[3][i] = c_SPtrans[3][i]; + s_SPtrans[4][i] = c_SPtrans[4][i]; + s_SPtrans[5][i] = c_SPtrans[5][i]; + s_SPtrans[6][i] = c_SPtrans[6][i]; + s_SPtrans[7][i] = c_SPtrans[7][i]; + + s_skb[0][i] = c_skb[0][i]; + s_skb[1][i] = c_skb[1][i]; + s_skb[2][i] = c_skb[2][i]; + s_skb[3][i] = c_skb[3][i]; + s_skb[4][i] = c_skb[4][i]; + s_skb[5][i] = c_skb[5][i]; + s_skb[6][i] = c_skb[6][i]; + s_skb[7][i] = c_skb[7][i]; + } + + SYNC_THREADS (); + + #else + + CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; + CONSTANT_AS u32a (*s_skb)[64] = c_skb; + + #endif + + 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] + }; + + /** + * salt + */ + + const u32 s0 = salt_bufs[SALT_POS].salt_buf[0]; + const u32 s1 = salt_bufs[SALT_POS].salt_buf[1]; + const u32 s2 = salt_bufs[SALT_POS].salt_buf[2]; + + /** + * 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]; + } + + /** + * 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; + + // md4_ctx_vector_t ctx; + + // md4_init_vector (&ctx); + + // md4_update_vector_utf16le (&ctx, w, pw_len); + + // md4_final_vector (&ctx); + + const u32x a = w[0]; + const u32x b = w[1]; + const u32x c = w[2]; + const u32x d = w[3]; + + if (MATCHES_NONE_VS ((d >> 16), s2)) continue; + + /** + * DES1 + */ + + u32x key[2]; + + transform_netntlmv1_key (a, b, key); + + u32x Kc[16]; + u32x Kd[16]; + + _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); + + u32x data[2]; + + data[0] = s0; + data[1] = s1; + + u32x out1[2]; + + _des_crypt_encrypt (out1, data, Kc, Kd, s_SPtrans); + + /** + * DES2 + */ + + + transform_netntlmv1_key (((b >> 24) | (c << 8)), ((c >> 24) | (d << 8)), key); + + _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); + + u32x out2[2]; + + _des_crypt_encrypt (out2, data, Kc, Kd, s_SPtrans); + + + const u32x r0 = out1[0]; + const u32x r1 = out1[1]; + const u32x r2 = out2[0]; + const u32x r3 = out2[1]; + + COMPARE_S_SIMD (r0, r1, r2, r3); + } +} diff --git a/OpenCL/m05610_a3-pure.cl b/OpenCL/m05610_a3-pure.cl new file mode 100644 index 000000000..5599674d9 --- /dev/null +++ b/OpenCL/m05610_a3-pure.cl @@ -0,0 +1,260 @@ +/** + * 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_md4.cl" +#include "inc_hash_md5.cl" +#endif + +typedef struct netntlm +{ + u32 user_len; + u32 domain_len; + u32 srvchall_len; + u32 clichall_len; + + u32 userdomain_buf[64]; + u32 chall_buf[256]; + +} netntlm_t; + +KERNEL_FQ void m05610_mxx (KERN_ATTR_VECTOR_ESALT (netntlm_t)) +{ + /** + * 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 = words_buf_r[il_pos / VECT_SIZE]; + + const u32 w0lr = w0l | w0r; + + w[0] = w0lr; + + // md4_ctx_t ctx1; + + // md4_init (&ctx1); + + // md4_update_utf16le (&ctx1, w, pw_len); + + // md4_final (&ctx1); + + u32 w0[4]; + u32 w1[4]; + u32 w2[4]; + u32 w3[4]; + + w0[0] = w[0]; + w0[1] = w[1]; + w0[2] = w[2]; + w0[3] = w[3]; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; + + md5_hmac_ctx_t ctx0; + + md5_hmac_init_64 (&ctx0, w0, w1, w2, w3); + + md5_hmac_update_global (&ctx0, esalt_bufs[DIGESTS_OFFSET].userdomain_buf, esalt_bufs[DIGESTS_OFFSET].user_len + esalt_bufs[DIGESTS_OFFSET].domain_len); + + md5_hmac_final (&ctx0); + + w0[0] = ctx0.opad.h[0]; + w0[1] = ctx0.opad.h[1]; + w0[2] = ctx0.opad.h[2]; + w0[3] = ctx0.opad.h[3]; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; + + md5_hmac_ctx_t ctx; + + md5_hmac_init_64 (&ctx, w0, w1, w2, w3); + + md5_hmac_update_global (&ctx, esalt_bufs[DIGESTS_OFFSET].chall_buf, esalt_bufs[DIGESTS_OFFSET].srvchall_len + esalt_bufs[DIGESTS_OFFSET].clichall_len); + + md5_hmac_final (&ctx); + + const u32 r0 = ctx.opad.h[DGST_R0]; + const u32 r1 = ctx.opad.h[DGST_R1]; + const u32 r2 = ctx.opad.h[DGST_R2]; + const u32 r3 = ctx.opad.h[DGST_R3]; + + COMPARE_M_SCALAR (r0, r1, r2, r3); + } +} + +KERNEL_FQ void m05610_sxx (KERN_ATTR_VECTOR_ESALT (netntlm_t)) +{ + /** + * 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 = words_buf_r[il_pos / VECT_SIZE]; + + const u32 w0lr = w0l | w0r; + + w[0] = w0lr; + + // md4_ctx_t ctx1; + + // md4_init (&ctx1); + + // md4_update_utf16le (&ctx1, w, pw_len); + + // md4_final (&ctx1); + + u32 w0[4]; + u32 w1[4]; + u32 w2[4]; + u32 w3[4]; + + w0[0] = w[0]; + w0[1] = w[1]; + w0[2] = w[2]; + w0[3] = w[3]; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; + + md5_hmac_ctx_t ctx0; + + md5_hmac_init_64 (&ctx0, w0, w1, w2, w3); + + md5_hmac_update_global (&ctx0, esalt_bufs[DIGESTS_OFFSET].userdomain_buf, esalt_bufs[DIGESTS_OFFSET].user_len + esalt_bufs[DIGESTS_OFFSET].domain_len); + + md5_hmac_final (&ctx0); + + w0[0] = ctx0.opad.h[0]; + w0[1] = ctx0.opad.h[1]; + w0[2] = ctx0.opad.h[2]; + w0[3] = ctx0.opad.h[3]; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; + + md5_hmac_ctx_t ctx; + + md5_hmac_init_64 (&ctx, w0, w1, w2, w3); + + md5_hmac_update_global (&ctx, esalt_bufs[DIGESTS_OFFSET].chall_buf, esalt_bufs[DIGESTS_OFFSET].srvchall_len + esalt_bufs[DIGESTS_OFFSET].clichall_len); + + md5_hmac_final (&ctx); + + const u32 r0 = ctx.opad.h[DGST_R0]; + const u32 r1 = ctx.opad.h[DGST_R1]; + const u32 r2 = ctx.opad.h[DGST_R2]; + const u32 r3 = ctx.opad.h[DGST_R3]; + + COMPARE_S_SCALAR (r0, r1, r2, r3); + } +} From f2d40df22f927659b1abf79f46b576062481cc08 Mon Sep 17 00:00:00 2001 From: Michael Kruger Date: Sat, 7 Nov 2020 11:29:07 +0200 Subject: [PATCH 03/64] Delete m05510_a3-optimized.cl Mistake, optimized a3 5510 does not work yet --- OpenCL/m05510_a3-optimized.cl | 1332 --------------------------------- 1 file changed, 1332 deletions(-) delete mode 100644 OpenCL/m05510_a3-optimized.cl diff --git a/OpenCL/m05510_a3-optimized.cl b/OpenCL/m05510_a3-optimized.cl deleted file mode 100644 index ab1cc39e9..000000000 --- a/OpenCL/m05510_a3-optimized.cl +++ /dev/null @@ -1,1332 +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_md4.cl" -#endif - -typedef struct netntlm -{ - u32 user_len; - u32 domain_len; - u32 srvchall_len; - u32 clichall_len; - - u32 userdomain_buf[64]; - u32 chall_buf[256]; - -} netntlm_t; - -#define PERM_OP(a,b,tt,n,m) \ -{ \ - tt = a >> n; \ - tt = tt ^ b; \ - tt = tt & m; \ - b = b ^ tt; \ - tt = tt << n; \ - a = a ^ tt; \ -} - -#define HPERM_OP(a,tt,n,m) \ -{ \ - tt = a << (16 + n); \ - tt = tt ^ a; \ - tt = tt & m; \ - a = a ^ tt; \ - tt = tt >> (16 + n); \ - a = a ^ tt; \ -} - -CONSTANT_VK u32a c_SPtrans[8][64] = -{ - { - 0x02080800, 0x00080000, 0x02000002, 0x02080802, - 0x02000000, 0x00080802, 0x00080002, 0x02000002, - 0x00080802, 0x02080800, 0x02080000, 0x00000802, - 0x02000802, 0x02000000, 0x00000000, 0x00080002, - 0x00080000, 0x00000002, 0x02000800, 0x00080800, - 0x02080802, 0x02080000, 0x00000802, 0x02000800, - 0x00000002, 0x00000800, 0x00080800, 0x02080002, - 0x00000800, 0x02000802, 0x02080002, 0x00000000, - 0x00000000, 0x02080802, 0x02000800, 0x00080002, - 0x02080800, 0x00080000, 0x00000802, 0x02000800, - 0x02080002, 0x00000800, 0x00080800, 0x02000002, - 0x00080802, 0x00000002, 0x02000002, 0x02080000, - 0x02080802, 0x00080800, 0x02080000, 0x02000802, - 0x02000000, 0x00000802, 0x00080002, 0x00000000, - 0x00080000, 0x02000000, 0x02000802, 0x02080800, - 0x00000002, 0x02080002, 0x00000800, 0x00080802, - }, - { - 0x40108010, 0x00000000, 0x00108000, 0x40100000, - 0x40000010, 0x00008010, 0x40008000, 0x00108000, - 0x00008000, 0x40100010, 0x00000010, 0x40008000, - 0x00100010, 0x40108000, 0x40100000, 0x00000010, - 0x00100000, 0x40008010, 0x40100010, 0x00008000, - 0x00108010, 0x40000000, 0x00000000, 0x00100010, - 0x40008010, 0x00108010, 0x40108000, 0x40000010, - 0x40000000, 0x00100000, 0x00008010, 0x40108010, - 0x00100010, 0x40108000, 0x40008000, 0x00108010, - 0x40108010, 0x00100010, 0x40000010, 0x00000000, - 0x40000000, 0x00008010, 0x00100000, 0x40100010, - 0x00008000, 0x40000000, 0x00108010, 0x40008010, - 0x40108000, 0x00008000, 0x00000000, 0x40000010, - 0x00000010, 0x40108010, 0x00108000, 0x40100000, - 0x40100010, 0x00100000, 0x00008010, 0x40008000, - 0x40008010, 0x00000010, 0x40100000, 0x00108000, - }, - { - 0x04000001, 0x04040100, 0x00000100, 0x04000101, - 0x00040001, 0x04000000, 0x04000101, 0x00040100, - 0x04000100, 0x00040000, 0x04040000, 0x00000001, - 0x04040101, 0x00000101, 0x00000001, 0x04040001, - 0x00000000, 0x00040001, 0x04040100, 0x00000100, - 0x00000101, 0x04040101, 0x00040000, 0x04000001, - 0x04040001, 0x04000100, 0x00040101, 0x04040000, - 0x00040100, 0x00000000, 0x04000000, 0x00040101, - 0x04040100, 0x00000100, 0x00000001, 0x00040000, - 0x00000101, 0x00040001, 0x04040000, 0x04000101, - 0x00000000, 0x04040100, 0x00040100, 0x04040001, - 0x00040001, 0x04000000, 0x04040101, 0x00000001, - 0x00040101, 0x04000001, 0x04000000, 0x04040101, - 0x00040000, 0x04000100, 0x04000101, 0x00040100, - 0x04000100, 0x00000000, 0x04040001, 0x00000101, - 0x04000001, 0x00040101, 0x00000100, 0x04040000, - }, - { - 0x00401008, 0x10001000, 0x00000008, 0x10401008, - 0x00000000, 0x10400000, 0x10001008, 0x00400008, - 0x10401000, 0x10000008, 0x10000000, 0x00001008, - 0x10000008, 0x00401008, 0x00400000, 0x10000000, - 0x10400008, 0x00401000, 0x00001000, 0x00000008, - 0x00401000, 0x10001008, 0x10400000, 0x00001000, - 0x00001008, 0x00000000, 0x00400008, 0x10401000, - 0x10001000, 0x10400008, 0x10401008, 0x00400000, - 0x10400008, 0x00001008, 0x00400000, 0x10000008, - 0x00401000, 0x10001000, 0x00000008, 0x10400000, - 0x10001008, 0x00000000, 0x00001000, 0x00400008, - 0x00000000, 0x10400008, 0x10401000, 0x00001000, - 0x10000000, 0x10401008, 0x00401008, 0x00400000, - 0x10401008, 0x00000008, 0x10001000, 0x00401008, - 0x00400008, 0x00401000, 0x10400000, 0x10001008, - 0x00001008, 0x10000000, 0x10000008, 0x10401000, - }, - { - 0x08000000, 0x00010000, 0x00000400, 0x08010420, - 0x08010020, 0x08000400, 0x00010420, 0x08010000, - 0x00010000, 0x00000020, 0x08000020, 0x00010400, - 0x08000420, 0x08010020, 0x08010400, 0x00000000, - 0x00010400, 0x08000000, 0x00010020, 0x00000420, - 0x08000400, 0x00010420, 0x00000000, 0x08000020, - 0x00000020, 0x08000420, 0x08010420, 0x00010020, - 0x08010000, 0x00000400, 0x00000420, 0x08010400, - 0x08010400, 0x08000420, 0x00010020, 0x08010000, - 0x00010000, 0x00000020, 0x08000020, 0x08000400, - 0x08000000, 0x00010400, 0x08010420, 0x00000000, - 0x00010420, 0x08000000, 0x00000400, 0x00010020, - 0x08000420, 0x00000400, 0x00000000, 0x08010420, - 0x08010020, 0x08010400, 0x00000420, 0x00010000, - 0x00010400, 0x08010020, 0x08000400, 0x00000420, - 0x00000020, 0x00010420, 0x08010000, 0x08000020, - }, - { - 0x80000040, 0x00200040, 0x00000000, 0x80202000, - 0x00200040, 0x00002000, 0x80002040, 0x00200000, - 0x00002040, 0x80202040, 0x00202000, 0x80000000, - 0x80002000, 0x80000040, 0x80200000, 0x00202040, - 0x00200000, 0x80002040, 0x80200040, 0x00000000, - 0x00002000, 0x00000040, 0x80202000, 0x80200040, - 0x80202040, 0x80200000, 0x80000000, 0x00002040, - 0x00000040, 0x00202000, 0x00202040, 0x80002000, - 0x00002040, 0x80000000, 0x80002000, 0x00202040, - 0x80202000, 0x00200040, 0x00000000, 0x80002000, - 0x80000000, 0x00002000, 0x80200040, 0x00200000, - 0x00200040, 0x80202040, 0x00202000, 0x00000040, - 0x80202040, 0x00202000, 0x00200000, 0x80002040, - 0x80000040, 0x80200000, 0x00202040, 0x00000000, - 0x00002000, 0x80000040, 0x80002040, 0x80202000, - 0x80200000, 0x00002040, 0x00000040, 0x80200040, - }, - { - 0x00004000, 0x00000200, 0x01000200, 0x01000004, - 0x01004204, 0x00004004, 0x00004200, 0x00000000, - 0x01000000, 0x01000204, 0x00000204, 0x01004000, - 0x00000004, 0x01004200, 0x01004000, 0x00000204, - 0x01000204, 0x00004000, 0x00004004, 0x01004204, - 0x00000000, 0x01000200, 0x01000004, 0x00004200, - 0x01004004, 0x00004204, 0x01004200, 0x00000004, - 0x00004204, 0x01004004, 0x00000200, 0x01000000, - 0x00004204, 0x01004000, 0x01004004, 0x00000204, - 0x00004000, 0x00000200, 0x01000000, 0x01004004, - 0x01000204, 0x00004204, 0x00004200, 0x00000000, - 0x00000200, 0x01000004, 0x00000004, 0x01000200, - 0x00000000, 0x01000204, 0x01000200, 0x00004200, - 0x00000204, 0x00004000, 0x01004204, 0x01000000, - 0x01004200, 0x00000004, 0x00004004, 0x01004204, - 0x01000004, 0x01004200, 0x01004000, 0x00004004, - }, - { - 0x20800080, 0x20820000, 0x00020080, 0x00000000, - 0x20020000, 0x00800080, 0x20800000, 0x20820080, - 0x00000080, 0x20000000, 0x00820000, 0x00020080, - 0x00820080, 0x20020080, 0x20000080, 0x20800000, - 0x00020000, 0x00820080, 0x00800080, 0x20020000, - 0x20820080, 0x20000080, 0x00000000, 0x00820000, - 0x20000000, 0x00800000, 0x20020080, 0x20800080, - 0x00800000, 0x00020000, 0x20820000, 0x00000080, - 0x00800000, 0x00020000, 0x20000080, 0x20820080, - 0x00020080, 0x20000000, 0x00000000, 0x00820000, - 0x20800080, 0x20020080, 0x20020000, 0x00800080, - 0x20820000, 0x00000080, 0x00800080, 0x20020000, - 0x20820080, 0x00800000, 0x20800000, 0x20000080, - 0x00820000, 0x00020080, 0x20020080, 0x20800000, - 0x00000080, 0x20820000, 0x00820080, 0x00000000, - 0x20000000, 0x20800080, 0x00020000, 0x00820080, - } -}; - -CONSTANT_VK u32a c_skb[8][64] = -{ - { - 0x00000000, 0x00000010, 0x20000000, 0x20000010, - 0x00010000, 0x00010010, 0x20010000, 0x20010010, - 0x00000800, 0x00000810, 0x20000800, 0x20000810, - 0x00010800, 0x00010810, 0x20010800, 0x20010810, - 0x00000020, 0x00000030, 0x20000020, 0x20000030, - 0x00010020, 0x00010030, 0x20010020, 0x20010030, - 0x00000820, 0x00000830, 0x20000820, 0x20000830, - 0x00010820, 0x00010830, 0x20010820, 0x20010830, - 0x00080000, 0x00080010, 0x20080000, 0x20080010, - 0x00090000, 0x00090010, 0x20090000, 0x20090010, - 0x00080800, 0x00080810, 0x20080800, 0x20080810, - 0x00090800, 0x00090810, 0x20090800, 0x20090810, - 0x00080020, 0x00080030, 0x20080020, 0x20080030, - 0x00090020, 0x00090030, 0x20090020, 0x20090030, - 0x00080820, 0x00080830, 0x20080820, 0x20080830, - 0x00090820, 0x00090830, 0x20090820, 0x20090830, - }, - { - 0x00000000, 0x02000000, 0x00002000, 0x02002000, - 0x00200000, 0x02200000, 0x00202000, 0x02202000, - 0x00000004, 0x02000004, 0x00002004, 0x02002004, - 0x00200004, 0x02200004, 0x00202004, 0x02202004, - 0x00000400, 0x02000400, 0x00002400, 0x02002400, - 0x00200400, 0x02200400, 0x00202400, 0x02202400, - 0x00000404, 0x02000404, 0x00002404, 0x02002404, - 0x00200404, 0x02200404, 0x00202404, 0x02202404, - 0x10000000, 0x12000000, 0x10002000, 0x12002000, - 0x10200000, 0x12200000, 0x10202000, 0x12202000, - 0x10000004, 0x12000004, 0x10002004, 0x12002004, - 0x10200004, 0x12200004, 0x10202004, 0x12202004, - 0x10000400, 0x12000400, 0x10002400, 0x12002400, - 0x10200400, 0x12200400, 0x10202400, 0x12202400, - 0x10000404, 0x12000404, 0x10002404, 0x12002404, - 0x10200404, 0x12200404, 0x10202404, 0x12202404, - }, - { - 0x00000000, 0x00000001, 0x00040000, 0x00040001, - 0x01000000, 0x01000001, 0x01040000, 0x01040001, - 0x00000002, 0x00000003, 0x00040002, 0x00040003, - 0x01000002, 0x01000003, 0x01040002, 0x01040003, - 0x00000200, 0x00000201, 0x00040200, 0x00040201, - 0x01000200, 0x01000201, 0x01040200, 0x01040201, - 0x00000202, 0x00000203, 0x00040202, 0x00040203, - 0x01000202, 0x01000203, 0x01040202, 0x01040203, - 0x08000000, 0x08000001, 0x08040000, 0x08040001, - 0x09000000, 0x09000001, 0x09040000, 0x09040001, - 0x08000002, 0x08000003, 0x08040002, 0x08040003, - 0x09000002, 0x09000003, 0x09040002, 0x09040003, - 0x08000200, 0x08000201, 0x08040200, 0x08040201, - 0x09000200, 0x09000201, 0x09040200, 0x09040201, - 0x08000202, 0x08000203, 0x08040202, 0x08040203, - 0x09000202, 0x09000203, 0x09040202, 0x09040203, - }, - { - 0x00000000, 0x00100000, 0x00000100, 0x00100100, - 0x00000008, 0x00100008, 0x00000108, 0x00100108, - 0x00001000, 0x00101000, 0x00001100, 0x00101100, - 0x00001008, 0x00101008, 0x00001108, 0x00101108, - 0x04000000, 0x04100000, 0x04000100, 0x04100100, - 0x04000008, 0x04100008, 0x04000108, 0x04100108, - 0x04001000, 0x04101000, 0x04001100, 0x04101100, - 0x04001008, 0x04101008, 0x04001108, 0x04101108, - 0x00020000, 0x00120000, 0x00020100, 0x00120100, - 0x00020008, 0x00120008, 0x00020108, 0x00120108, - 0x00021000, 0x00121000, 0x00021100, 0x00121100, - 0x00021008, 0x00121008, 0x00021108, 0x00121108, - 0x04020000, 0x04120000, 0x04020100, 0x04120100, - 0x04020008, 0x04120008, 0x04020108, 0x04120108, - 0x04021000, 0x04121000, 0x04021100, 0x04121100, - 0x04021008, 0x04121008, 0x04021108, 0x04121108, - }, - { - 0x00000000, 0x10000000, 0x00010000, 0x10010000, - 0x00000004, 0x10000004, 0x00010004, 0x10010004, - 0x20000000, 0x30000000, 0x20010000, 0x30010000, - 0x20000004, 0x30000004, 0x20010004, 0x30010004, - 0x00100000, 0x10100000, 0x00110000, 0x10110000, - 0x00100004, 0x10100004, 0x00110004, 0x10110004, - 0x20100000, 0x30100000, 0x20110000, 0x30110000, - 0x20100004, 0x30100004, 0x20110004, 0x30110004, - 0x00001000, 0x10001000, 0x00011000, 0x10011000, - 0x00001004, 0x10001004, 0x00011004, 0x10011004, - 0x20001000, 0x30001000, 0x20011000, 0x30011000, - 0x20001004, 0x30001004, 0x20011004, 0x30011004, - 0x00101000, 0x10101000, 0x00111000, 0x10111000, - 0x00101004, 0x10101004, 0x00111004, 0x10111004, - 0x20101000, 0x30101000, 0x20111000, 0x30111000, - 0x20101004, 0x30101004, 0x20111004, 0x30111004, - }, - { - 0x00000000, 0x08000000, 0x00000008, 0x08000008, - 0x00000400, 0x08000400, 0x00000408, 0x08000408, - 0x00020000, 0x08020000, 0x00020008, 0x08020008, - 0x00020400, 0x08020400, 0x00020408, 0x08020408, - 0x00000001, 0x08000001, 0x00000009, 0x08000009, - 0x00000401, 0x08000401, 0x00000409, 0x08000409, - 0x00020001, 0x08020001, 0x00020009, 0x08020009, - 0x00020401, 0x08020401, 0x00020409, 0x08020409, - 0x02000000, 0x0A000000, 0x02000008, 0x0A000008, - 0x02000400, 0x0A000400, 0x02000408, 0x0A000408, - 0x02020000, 0x0A020000, 0x02020008, 0x0A020008, - 0x02020400, 0x0A020400, 0x02020408, 0x0A020408, - 0x02000001, 0x0A000001, 0x02000009, 0x0A000009, - 0x02000401, 0x0A000401, 0x02000409, 0x0A000409, - 0x02020001, 0x0A020001, 0x02020009, 0x0A020009, - 0x02020401, 0x0A020401, 0x02020409, 0x0A020409, - }, - { - 0x00000000, 0x00000100, 0x00080000, 0x00080100, - 0x01000000, 0x01000100, 0x01080000, 0x01080100, - 0x00000010, 0x00000110, 0x00080010, 0x00080110, - 0x01000010, 0x01000110, 0x01080010, 0x01080110, - 0x00200000, 0x00200100, 0x00280000, 0x00280100, - 0x01200000, 0x01200100, 0x01280000, 0x01280100, - 0x00200010, 0x00200110, 0x00280010, 0x00280110, - 0x01200010, 0x01200110, 0x01280010, 0x01280110, - 0x00000200, 0x00000300, 0x00080200, 0x00080300, - 0x01000200, 0x01000300, 0x01080200, 0x01080300, - 0x00000210, 0x00000310, 0x00080210, 0x00080310, - 0x01000210, 0x01000310, 0x01080210, 0x01080310, - 0x00200200, 0x00200300, 0x00280200, 0x00280300, - 0x01200200, 0x01200300, 0x01280200, 0x01280300, - 0x00200210, 0x00200310, 0x00280210, 0x00280310, - 0x01200210, 0x01200310, 0x01280210, 0x01280310, - }, - { - 0x00000000, 0x04000000, 0x00040000, 0x04040000, - 0x00000002, 0x04000002, 0x00040002, 0x04040002, - 0x00002000, 0x04002000, 0x00042000, 0x04042000, - 0x00002002, 0x04002002, 0x00042002, 0x04042002, - 0x00000020, 0x04000020, 0x00040020, 0x04040020, - 0x00000022, 0x04000022, 0x00040022, 0x04040022, - 0x00002020, 0x04002020, 0x00042020, 0x04042020, - 0x00002022, 0x04002022, 0x00042022, 0x04042022, - 0x00000800, 0x04000800, 0x00040800, 0x04040800, - 0x00000802, 0x04000802, 0x00040802, 0x04040802, - 0x00002800, 0x04002800, 0x00042800, 0x04042800, - 0x00002802, 0x04002802, 0x00042802, 0x04042802, - 0x00000820, 0x04000820, 0x00040820, 0x04040820, - 0x00000822, 0x04000822, 0x00040822, 0x04040822, - 0x00002820, 0x04002820, 0x00042820, 0x04042820, - 0x00002822, 0x04002822, 0x00042822, 0x04042822 - } -}; - -#if VECT_SIZE == 1 -#define BOX(i,n,S) (S)[(n)][(i)] -#elif VECT_SIZE == 2 -#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1]) -#elif VECT_SIZE == 4 -#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3]) -#elif VECT_SIZE == 8 -#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7]) -#elif VECT_SIZE == 16 -#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7], (S)[(n)][(i).s8], (S)[(n)][(i).s9], (S)[(n)][(i).sa], (S)[(n)][(i).sb], (S)[(n)][(i).sc], (S)[(n)][(i).sd], (S)[(n)][(i).se], (S)[(n)][(i).sf]) -#endif - -DECLSPEC void _des_crypt_encrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64]) -{ - u32x r = data[0]; - u32x l = data[1]; - - #ifdef _unroll - #pragma unroll - #endif - for (u32 i = 0; i < 16; i += 2) - { - u32x u; - u32x t; - - u = Kc[i + 0] ^ hc_rotl32 (r, 30u); - t = Kd[i + 0] ^ hc_rotl32 (r, 26u); - - l ^= BOX (((u >> 0) & 0x3f), 0, s_SPtrans) - | BOX (((u >> 8) & 0x3f), 2, s_SPtrans) - | BOX (((u >> 16) & 0x3f), 4, s_SPtrans) - | BOX (((u >> 24) & 0x3f), 6, s_SPtrans) - | BOX (((t >> 0) & 0x3f), 1, s_SPtrans) - | BOX (((t >> 8) & 0x3f), 3, s_SPtrans) - | BOX (((t >> 16) & 0x3f), 5, s_SPtrans) - | BOX (((t >> 24) & 0x3f), 7, s_SPtrans); - - u = Kc[i + 1] ^ hc_rotl32 (l, 30u); - t = Kd[i + 1] ^ hc_rotl32 (l, 26u); - - r ^= BOX (((u >> 0) & 0x3f), 0, s_SPtrans) - | BOX (((u >> 8) & 0x3f), 2, s_SPtrans) - | BOX (((u >> 16) & 0x3f), 4, s_SPtrans) - | BOX (((u >> 24) & 0x3f), 6, s_SPtrans) - | BOX (((t >> 0) & 0x3f), 1, s_SPtrans) - | BOX (((t >> 8) & 0x3f), 3, s_SPtrans) - | BOX (((t >> 16) & 0x3f), 5, s_SPtrans) - | BOX (((t >> 24) & 0x3f), 7, s_SPtrans); - } - - iv[0] = l; - iv[1] = r; -} - -DECLSPEC void _des_crypt_keysetup (u32x c, u32x d, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_skb)[64]) -{ - u32x tt; - - PERM_OP (d, c, tt, 4, 0x0f0f0f0f); - HPERM_OP (c, tt, 2, 0xcccc0000); - HPERM_OP (d, tt, 2, 0xcccc0000); - PERM_OP (d, c, tt, 1, 0x55555555); - PERM_OP (c, d, tt, 8, 0x00ff00ff); - PERM_OP (d, c, tt, 1, 0x55555555); - - d = ((d & 0x000000ff) << 16) - | ((d & 0x0000ff00) << 0) - | ((d & 0x00ff0000) >> 16) - | ((c & 0xf0000000) >> 4); - - c = c & 0x0fffffff; - - #ifdef _unroll - #pragma unroll - #endif - for (u32 i = 0; i < 16; i++) - { - if ((i < 2) || (i == 8) || (i == 15)) - { - c = ((c >> 1) | (c << 27)); - d = ((d >> 1) | (d << 27)); - } - else - { - c = ((c >> 2) | (c << 26)); - d = ((d >> 2) | (d << 26)); - } - - c = c & 0x0fffffff; - d = d & 0x0fffffff; - - const u32x c00 = (c >> 0) & 0x0000003f; - const u32x c06 = (c >> 6) & 0x00383003; - const u32x c07 = (c >> 7) & 0x0000003c; - const u32x c13 = (c >> 13) & 0x0000060f; - const u32x c20 = (c >> 20) & 0x00000001; - - u32x s = BOX (((c00 >> 0) & 0xff), 0, s_skb) - | BOX (((c06 >> 0) & 0xff) - |((c07 >> 0) & 0xff), 1, s_skb) - | BOX (((c13 >> 0) & 0xff) - |((c06 >> 8) & 0xff), 2, s_skb) - | BOX (((c20 >> 0) & 0xff) - |((c13 >> 8) & 0xff) - |((c06 >> 16) & 0xff), 3, s_skb); - - const u32x d00 = (d >> 0) & 0x00003c3f; - const u32x d07 = (d >> 7) & 0x00003f03; - const u32x d21 = (d >> 21) & 0x0000000f; - const u32x d22 = (d >> 22) & 0x00000030; - - u32x t = BOX (((d00 >> 0) & 0xff), 4, s_skb) - | BOX (((d07 >> 0) & 0xff) - |((d00 >> 8) & 0xff), 5, s_skb) - | BOX (((d07 >> 8) & 0xff), 6, s_skb) - | BOX (((d21 >> 0) & 0xff) - |((d22 >> 0) & 0xff), 7, s_skb); - - Kc[i] = ((t << 16) | (s & 0x0000ffff)); - Kd[i] = ((s >> 16) | (t & 0xffff0000)); - } -} - -DECLSPEC void transform_netntlmv1_key (const u32x w0, const u32x w1, u32x *out) -{ - u32x t[8]; - - t[0] = (w0 >> 0) & 0xff; - t[1] = (w0 >> 8) & 0xff; - t[2] = (w0 >> 16) & 0xff; - t[3] = (w0 >> 24) & 0xff; - t[4] = (w1 >> 0) & 0xff; - t[5] = (w1 >> 8) & 0xff; - t[6] = (w1 >> 16) & 0xff; - t[7] = (w1 >> 24) & 0xff; - - u32x k[8]; - - k[0] = (t[0] >> 0); - k[1] = (t[0] << 7) | (t[1] >> 1); - k[2] = (t[1] << 6) | (t[2] >> 2); - k[3] = (t[2] << 5) | (t[3] >> 3); - k[4] = (t[3] << 4) | (t[4] >> 4); - k[5] = (t[4] << 3) | (t[5] >> 5); - k[6] = (t[5] << 2) | (t[6] >> 6); - k[7] = (t[6] << 1); - - out[0] = ((k[0] & 0xff) << 0) - | ((k[1] & 0xff) << 8) - | ((k[2] & 0xff) << 16) - | ((k[3] & 0xff) << 24); - - out[1] = ((k[4] & 0xff) << 0) - | ((k[5] & 0xff) << 8) - | ((k[6] & 0xff) << 16) - | ((k[7] & 0xff) << 24); -} - -DECLSPEC void m05510m (SHM_TYPE u32 (*s_SPtrans)[64], SHM_TYPE u32 (*s_skb)[64], u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ()) -{ - /** - * modifier - */ - - const u64 gid = get_global_id (0); - const u64 lid = get_local_id (0); - - /** - * salt - */ - - const u32 s0 = salt_bufs[SALT_POS].salt_buf[0]; - const u32 s1 = salt_bufs[SALT_POS].salt_buf[1]; - const u32 s2 = salt_bufs[SALT_POS].salt_buf[2]; - - /** - * loop - */ - - u32 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; - - u32x w0_t[4]; - u32x w1_t[4]; - u32x w2_t[4]; - u32x w3_t[4]; - - w0_t[0] = w0; - w0_t[1] = w[ 1]; - w0_t[2] = w[ 2]; - w0_t[3] = w[ 3]; - w1_t[0] = w[ 4]; - w1_t[1] = w[ 5]; - w1_t[2] = w[ 6]; - w1_t[3] = w[ 7]; - w2_t[0] = w[ 8]; - w2_t[1] = w[ 9]; - w2_t[2] = w[10]; - w2_t[3] = w[11]; - w3_t[0] = w[12]; - w3_t[1] = w[13]; - w3_t[2] = w[14]; - w3_t[3] = w[15]; - - u32x a = w0; - u32x b = w[ 1]; - u32x c = w[ 2]; - u32x d = w[ 3]; - - // MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00); - // MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01); - // MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02); - // MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03); - // MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00); - // MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01); - // MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02); - // MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03); - // MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00); - // MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01); - // MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02); - // MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03); - // MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00); - // MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01); - // MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02); - // MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03); - - // MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10); - // MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11); - // MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12); - // MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13); - // MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10); - // MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11); - // MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12); - // MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13); - // MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10); - // MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11); - // MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12); - // MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13); - // MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10); - // MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11); - // MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12); - // MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13); - - // MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20); - // MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21); - // MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22); - // MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23); - // MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20); - // MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21); - // MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22); - // MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23); - // MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20); - // MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21); - // MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22); - // MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23); - // MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20); - // MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21); - - // if (MATCHES_NONE_VS (((d + MD4M_D) >> 16), s2)) continue; - - // MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22); - // MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23); - - // a += MD4M_A; - // b += MD4M_B; - // c += MD4M_C; - // d += MD4M_D; - - /** - * DES1 - */ - - u32x key[2]; - - transform_netntlmv1_key (a, b, key); - - u32x Kc[16]; - u32x Kd[16]; - - _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); - - u32x data[2]; - - data[0] = s0; - data[1] = s1; - - u32x iv1[2]; - - _des_crypt_encrypt (iv1, data, Kc, Kd, s_SPtrans); - - /** - * DES2 - */ - - transform_netntlmv1_key (((b >> 24) | (c << 8)), ((c >> 24) | (d << 8)), key); - - _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); - - u32x iv2[2]; - - _des_crypt_encrypt (iv2, data, Kc, Kd, s_SPtrans); - - /** - * compare - */ - - COMPARE_M_SIMD (iv1[0], iv1[1], iv2[0], iv2[1]); - } -} - -DECLSPEC void m05510s (SHM_TYPE u32 (*s_SPtrans)[64], SHM_TYPE u32 (*s_skb)[64], u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ()) -{ - /** - * modifier - */ - - const u64 gid = get_global_id (0); - const u64 lid = get_local_id (0); - - /** - * salt - */ - - const u32 s0 = salt_bufs[SALT_POS].salt_buf[0]; - const u32 s1 = salt_bufs[SALT_POS].salt_buf[1]; - const u32 s2 = salt_bufs[SALT_POS].salt_buf[2]; - - /** - * 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] - }; - - /** - * loop - */ - - u32 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; - - u32x w0_t[4]; - u32x w1_t[4]; - u32x w2_t[4]; - u32x w3_t[4]; - - w0_t[0] = w0; - w0_t[1] = w[ 1]; - w0_t[2] = w[ 2]; - w0_t[3] = w[ 3]; - w1_t[0] = w[ 4]; - w1_t[1] = w[ 5]; - w1_t[2] = w[ 6]; - w1_t[3] = w[ 7]; - w2_t[0] = w[ 8]; - w2_t[1] = w[ 9]; - w2_t[2] = w[10]; - w2_t[3] = w[11]; - w3_t[0] = w[12]; - w3_t[1] = w[13]; - w3_t[2] = w[14]; - w3_t[3] = w[15]; - - u32x a = w0; - u32x b = w[ 1]; - u32x c = w[ 2]; - u32x d = w[ 3]; - - // MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00); - // MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01); - // MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02); - // MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03); - // MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00); - // MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01); - // MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02); - // MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03); - // MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00); - // MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01); - // MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02); - // MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03); - // MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00); - // MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01); - // MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02); - // MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03); - - // MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10); - // MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11); - // MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12); - // MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13); - // MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10); - // MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11); - // MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12); - // MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13); - // MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10); - // MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11); - // MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12); - // MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13); - // MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10); - // MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11); - // MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12); - // MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13); - - // MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20); - // MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21); - // MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22); - // MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23); - // MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20); - // MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21); - // MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22); - // MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23); - // MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20); - // MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21); - // MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22); - // MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23); - // MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20); - // MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21); - - // if (MATCHES_NONE_VS (((d + MD4M_D) >> 16), s2)) continue; - - // MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22); - // MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23); - - // a += MD4M_A; - // b += MD4M_B; - // c += MD4M_C; - // d += MD4M_D; - - /** - * DES1 - */ - - u32x key[2]; - - transform_netntlmv1_key (a, b, key); - - u32x Kc[16]; - u32x Kd[16]; - - _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); - - u32x data[2]; - - data[0] = s0; - data[1] = s1; - - u32x iv1[2]; - - _des_crypt_encrypt (iv1, data, Kc, Kd, s_SPtrans); - - /** - * DES2 - */ - - /* - transform_netntlmv1_key (((b >> 24) | (c << 8)), ((c >> 24) | (d << 8)), key); - - _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); - - u32x iv2[2]; - - _des_crypt_encrypt (iv2, data, Kc, Kd, s_SPtrans); - */ - - u32x iv2[2]; - - iv2[0] = search[2]; - iv2[1] = search[3]; - - /** - * compare - */ - - COMPARE_S_SIMD (iv1[0], iv1[1], iv2[0], iv2[1]); - } -} - -KERNEL_FQ void m05510_m04 (KERN_ATTR_VECTOR ()) -{ - /** - * modifier - */ - - const u64 gid = get_global_id (0); - const u64 lid = get_local_id (0); - const u64 lsz = get_local_size (0); - - /** - * sbox, kbox - */ - - #ifdef REAL_SHM - - LOCAL_VK u32 s_SPtrans[8][64]; - LOCAL_VK u32 s_skb[8][64]; - - for (u32 i = lid; i < 64; i += lsz) - { - s_SPtrans[0][i] = c_SPtrans[0][i]; - s_SPtrans[1][i] = c_SPtrans[1][i]; - s_SPtrans[2][i] = c_SPtrans[2][i]; - s_SPtrans[3][i] = c_SPtrans[3][i]; - s_SPtrans[4][i] = c_SPtrans[4][i]; - s_SPtrans[5][i] = c_SPtrans[5][i]; - s_SPtrans[6][i] = c_SPtrans[6][i]; - s_SPtrans[7][i] = c_SPtrans[7][i]; - - s_skb[0][i] = c_skb[0][i]; - s_skb[1][i] = c_skb[1][i]; - s_skb[2][i] = c_skb[2][i]; - s_skb[3][i] = c_skb[3][i]; - s_skb[4][i] = c_skb[4][i]; - s_skb[5][i] = c_skb[5][i]; - s_skb[6][i] = c_skb[6][i]; - s_skb[7][i] = c_skb[7][i]; - } - - SYNC_THREADS (); - - #else - - CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; - CONSTANT_AS u32a (*s_skb)[64] = c_skb; - - #endif - - if (gid >= gid_max) return; - - /** - * base - */ - - u32 w[16]; - - w[ 0] = pws[gid].i[ 0]; - w[ 1] = pws[gid].i[ 1]; - w[ 2] = pws[gid].i[ 2]; - w[ 3] = pws[gid].i[ 3]; - w[ 4] = 0; - w[ 5] = 0; - w[ 6] = 0; - w[ 7] = 0; - w[ 8] = 0; - w[ 9] = 0; - w[10] = 0; - w[11] = 0; - w[12] = 0; - w[13] = 0; - w[14] = pws[gid].i[14]; - w[15] = 0; - - const u32 pw_len = pws[gid].pw_len & 63; - - /** - * main - */ - - m05510m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, pws_pos, gid_max); -} - -KERNEL_FQ void m05510_m08 (KERN_ATTR_VECTOR ()) -{ - /** - * modifier - */ - - const u64 gid = get_global_id (0); - const u64 lid = get_local_id (0); - const u64 lsz = get_local_size (0); - - /** - * sbox, kbox - */ - - #ifdef REAL_SHM - - LOCAL_VK u32 s_SPtrans[8][64]; - LOCAL_VK u32 s_skb[8][64]; - - for (u32 i = lid; i < 64; i += lsz) - { - s_SPtrans[0][i] = c_SPtrans[0][i]; - s_SPtrans[1][i] = c_SPtrans[1][i]; - s_SPtrans[2][i] = c_SPtrans[2][i]; - s_SPtrans[3][i] = c_SPtrans[3][i]; - s_SPtrans[4][i] = c_SPtrans[4][i]; - s_SPtrans[5][i] = c_SPtrans[5][i]; - s_SPtrans[6][i] = c_SPtrans[6][i]; - s_SPtrans[7][i] = c_SPtrans[7][i]; - - s_skb[0][i] = c_skb[0][i]; - s_skb[1][i] = c_skb[1][i]; - s_skb[2][i] = c_skb[2][i]; - s_skb[3][i] = c_skb[3][i]; - s_skb[4][i] = c_skb[4][i]; - s_skb[5][i] = c_skb[5][i]; - s_skb[6][i] = c_skb[6][i]; - s_skb[7][i] = c_skb[7][i]; - } - - SYNC_THREADS (); - - #else - - CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; - CONSTANT_AS u32a (*s_skb)[64] = c_skb; - - #endif - - if (gid >= gid_max) return; - - /** - * base - */ - - u32 w[16]; - - w[ 0] = pws[gid].i[ 0]; - w[ 1] = pws[gid].i[ 1]; - w[ 2] = pws[gid].i[ 2]; - w[ 3] = pws[gid].i[ 3]; - w[ 4] = pws[gid].i[ 4]; - w[ 5] = pws[gid].i[ 5]; - w[ 6] = pws[gid].i[ 6]; - w[ 7] = pws[gid].i[ 7]; - w[ 8] = 0; - w[ 9] = 0; - w[10] = 0; - w[11] = 0; - w[12] = 0; - w[13] = 0; - w[14] = pws[gid].i[14]; - w[15] = 0; - - const u32 pw_len = pws[gid].pw_len & 63; - - /** - * main - */ - - m05510m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, pws_pos, gid_max); -} - -KERNEL_FQ void m05510_m16 (KERN_ATTR_VECTOR ()) -{ - /** - * modifier - */ - - const u64 gid = get_global_id (0); - const u64 lid = get_local_id (0); - const u64 lsz = get_local_size (0); - - /** - * sbox, kbox - */ - - #ifdef REAL_SHM - - LOCAL_VK u32 s_SPtrans[8][64]; - LOCAL_VK u32 s_skb[8][64]; - - for (u32 i = lid; i < 64; i += lsz) - { - s_SPtrans[0][i] = c_SPtrans[0][i]; - s_SPtrans[1][i] = c_SPtrans[1][i]; - s_SPtrans[2][i] = c_SPtrans[2][i]; - s_SPtrans[3][i] = c_SPtrans[3][i]; - s_SPtrans[4][i] = c_SPtrans[4][i]; - s_SPtrans[5][i] = c_SPtrans[5][i]; - s_SPtrans[6][i] = c_SPtrans[6][i]; - s_SPtrans[7][i] = c_SPtrans[7][i]; - - s_skb[0][i] = c_skb[0][i]; - s_skb[1][i] = c_skb[1][i]; - s_skb[2][i] = c_skb[2][i]; - s_skb[3][i] = c_skb[3][i]; - s_skb[4][i] = c_skb[4][i]; - s_skb[5][i] = c_skb[5][i]; - s_skb[6][i] = c_skb[6][i]; - s_skb[7][i] = c_skb[7][i]; - } - - SYNC_THREADS (); - - #else - - CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; - CONSTANT_AS u32a (*s_skb)[64] = c_skb; - - #endif - - if (gid >= gid_max) return; - - /** - * base - */ - - u32 w[16]; - - w[ 0] = pws[gid].i[ 0]; - w[ 1] = pws[gid].i[ 1]; - w[ 2] = pws[gid].i[ 2]; - w[ 3] = pws[gid].i[ 3]; - w[ 4] = pws[gid].i[ 4]; - w[ 5] = pws[gid].i[ 5]; - w[ 6] = pws[gid].i[ 6]; - w[ 7] = pws[gid].i[ 7]; - w[ 8] = pws[gid].i[ 8]; - w[ 9] = pws[gid].i[ 9]; - w[10] = pws[gid].i[10]; - w[11] = pws[gid].i[11]; - w[12] = pws[gid].i[12]; - w[13] = pws[gid].i[13]; - w[14] = pws[gid].i[14]; - w[15] = 0; - - const u32 pw_len = pws[gid].pw_len & 63; - - /** - * main - */ - - m05510m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, pws_pos, gid_max); -} - -KERNEL_FQ void m05510_s04 (KERN_ATTR_VECTOR ()) -{ - /** - * modifier - */ - - const u64 gid = get_global_id (0); - const u64 lid = get_local_id (0); - const u64 lsz = get_local_size (0); - - /** - * sbox, kbox - */ - - #ifdef REAL_SHM - - LOCAL_VK u32 s_SPtrans[8][64]; - LOCAL_VK u32 s_skb[8][64]; - - for (u32 i = lid; i < 64; i += lsz) - { - s_SPtrans[0][i] = c_SPtrans[0][i]; - s_SPtrans[1][i] = c_SPtrans[1][i]; - s_SPtrans[2][i] = c_SPtrans[2][i]; - s_SPtrans[3][i] = c_SPtrans[3][i]; - s_SPtrans[4][i] = c_SPtrans[4][i]; - s_SPtrans[5][i] = c_SPtrans[5][i]; - s_SPtrans[6][i] = c_SPtrans[6][i]; - s_SPtrans[7][i] = c_SPtrans[7][i]; - - s_skb[0][i] = c_skb[0][i]; - s_skb[1][i] = c_skb[1][i]; - s_skb[2][i] = c_skb[2][i]; - s_skb[3][i] = c_skb[3][i]; - s_skb[4][i] = c_skb[4][i]; - s_skb[5][i] = c_skb[5][i]; - s_skb[6][i] = c_skb[6][i]; - s_skb[7][i] = c_skb[7][i]; - } - - SYNC_THREADS (); - - #else - - CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; - CONSTANT_AS u32a (*s_skb)[64] = c_skb; - - #endif - - if (gid >= gid_max) return; - - /** - * base - */ - - u32 w[16]; - - w[ 0] = pws[gid].i[ 0]; - w[ 1] = pws[gid].i[ 1]; - w[ 2] = pws[gid].i[ 2]; - w[ 3] = pws[gid].i[ 3]; - w[ 4] = 0; - w[ 5] = 0; - w[ 6] = 0; - w[ 7] = 0; - w[ 8] = 0; - w[ 9] = 0; - w[10] = 0; - w[11] = 0; - w[12] = 0; - w[13] = 0; - w[14] = pws[gid].i[14]; - w[15] = 0; - - const u32 pw_len = pws[gid].pw_len & 63; - - /** - * main - */ - - m05510s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, pws_pos, gid_max); -} - -KERNEL_FQ void m05510_s08 (KERN_ATTR_VECTOR ()) -{ - /** - * modifier - */ - - const u64 gid = get_global_id (0); - const u64 lid = get_local_id (0); - const u64 lsz = get_local_size (0); - - /** - * sbox, kbox - */ - - #ifdef REAL_SHM - - LOCAL_VK u32 s_SPtrans[8][64]; - LOCAL_VK u32 s_skb[8][64]; - - for (u32 i = lid; i < 64; i += lsz) - { - s_SPtrans[0][i] = c_SPtrans[0][i]; - s_SPtrans[1][i] = c_SPtrans[1][i]; - s_SPtrans[2][i] = c_SPtrans[2][i]; - s_SPtrans[3][i] = c_SPtrans[3][i]; - s_SPtrans[4][i] = c_SPtrans[4][i]; - s_SPtrans[5][i] = c_SPtrans[5][i]; - s_SPtrans[6][i] = c_SPtrans[6][i]; - s_SPtrans[7][i] = c_SPtrans[7][i]; - - s_skb[0][i] = c_skb[0][i]; - s_skb[1][i] = c_skb[1][i]; - s_skb[2][i] = c_skb[2][i]; - s_skb[3][i] = c_skb[3][i]; - s_skb[4][i] = c_skb[4][i]; - s_skb[5][i] = c_skb[5][i]; - s_skb[6][i] = c_skb[6][i]; - s_skb[7][i] = c_skb[7][i]; - } - - SYNC_THREADS (); - - #else - - CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; - CONSTANT_AS u32a (*s_skb)[64] = c_skb; - - #endif - - if (gid >= gid_max) return; - - /** - * base - */ - - u32 w[16]; - - w[ 0] = pws[gid].i[ 0]; - w[ 1] = pws[gid].i[ 1]; - w[ 2] = pws[gid].i[ 2]; - w[ 3] = pws[gid].i[ 3]; - w[ 4] = pws[gid].i[ 4]; - w[ 5] = pws[gid].i[ 5]; - w[ 6] = pws[gid].i[ 6]; - w[ 7] = pws[gid].i[ 7]; - w[ 8] = 0; - w[ 9] = 0; - w[10] = 0; - w[11] = 0; - w[12] = 0; - w[13] = 0; - w[14] = pws[gid].i[14]; - w[15] = 0; - - const u32 pw_len = pws[gid].pw_len & 63; - - /** - * main - */ - - m05510s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, pws_pos, gid_max); -} - -KERNEL_FQ void m05510_s16 (KERN_ATTR_VECTOR ()) -{ - /** - * modifier - */ - - const u64 gid = get_global_id (0); - const u64 lid = get_local_id (0); - const u64 lsz = get_local_size (0); - - /** - * sbox, kbox - */ - - #ifdef REAL_SHM - - LOCAL_VK u32 s_SPtrans[8][64]; - LOCAL_VK u32 s_skb[8][64]; - - for (u32 i = lid; i < 64; i += lsz) - { - s_SPtrans[0][i] = c_SPtrans[0][i]; - s_SPtrans[1][i] = c_SPtrans[1][i]; - s_SPtrans[2][i] = c_SPtrans[2][i]; - s_SPtrans[3][i] = c_SPtrans[3][i]; - s_SPtrans[4][i] = c_SPtrans[4][i]; - s_SPtrans[5][i] = c_SPtrans[5][i]; - s_SPtrans[6][i] = c_SPtrans[6][i]; - s_SPtrans[7][i] = c_SPtrans[7][i]; - - s_skb[0][i] = c_skb[0][i]; - s_skb[1][i] = c_skb[1][i]; - s_skb[2][i] = c_skb[2][i]; - s_skb[3][i] = c_skb[3][i]; - s_skb[4][i] = c_skb[4][i]; - s_skb[5][i] = c_skb[5][i]; - s_skb[6][i] = c_skb[6][i]; - s_skb[7][i] = c_skb[7][i]; - } - - SYNC_THREADS (); - - #else - - CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; - CONSTANT_AS u32a (*s_skb)[64] = c_skb; - - #endif - - if (gid >= gid_max) return; - - /** - * base - */ - - u32 w[16]; - - w[ 0] = pws[gid].i[ 0]; - w[ 1] = pws[gid].i[ 1]; - w[ 2] = pws[gid].i[ 2]; - w[ 3] = pws[gid].i[ 3]; - w[ 4] = pws[gid].i[ 4]; - w[ 5] = pws[gid].i[ 5]; - w[ 6] = pws[gid].i[ 6]; - w[ 7] = pws[gid].i[ 7]; - w[ 8] = pws[gid].i[ 8]; - w[ 9] = pws[gid].i[ 9]; - w[10] = pws[gid].i[10]; - w[11] = pws[gid].i[11]; - w[12] = pws[gid].i[12]; - w[13] = pws[gid].i[13]; - w[14] = pws[gid].i[14]; - w[15] = 0; - - const u32 pw_len = pws[gid].pw_len & 63; - - /** - * main - */ - - m05510s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, SALT_POS, loop_pos, loop_cnt, il_cnt, digests_cnt, DIGESTS_OFFSET, combs_mode, pws_pos, gid_max); -} From e818b56cf340aef468308d090f15c2172cd3335f Mon Sep 17 00:00:00 2001 From: Cablethief Date: Fri, 28 May 2021 14:45:41 +0200 Subject: [PATCH 04/64] Change module number to match future grouping --- ...m05510_a0-optimized.cl => m27000_a0-optimized.cl} | 12 ++++++------ OpenCL/{m05510_a0-pure.cl => m27000_a0-pure.cl} | 4 ++-- OpenCL/{m05510_a3-pure.cl => m27000_a3-pure.cl} | 4 ++-- ...m05610_a0-optimized.cl => m27100_a0-optimized.cl} | 12 ++++++------ OpenCL/{m05610_a0-pure.cl => m27100_a0-pure.cl} | 4 ++-- OpenCL/{m05610_a3-pure.cl => m27100_a3-pure.cl} | 4 ++-- src/modules/{module_05510.c => module_27000.c} | 2 +- src/modules/{module_05610.c => module_27100.c} | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) rename OpenCL/{m05510_a0-optimized.cl => m27000_a0-optimized.cl} (98%) rename OpenCL/{m05510_a0-pure.cl => m27000_a0-pure.cl} (99%) rename OpenCL/{m05510_a3-pure.cl => m27000_a3-pure.cl} (99%) rename OpenCL/{m05610_a0-optimized.cl => m27100_a0-optimized.cl} (97%) rename OpenCL/{m05610_a0-pure.cl => m27100_a0-pure.cl} (96%) rename OpenCL/{m05610_a3-pure.cl => m27100_a3-pure.cl} (97%) rename src/modules/{module_05510.c => module_27000.c} (99%) rename src/modules/{module_05610.c => module_27100.c} (99%) diff --git a/OpenCL/m05510_a0-optimized.cl b/OpenCL/m27000_a0-optimized.cl similarity index 98% rename from OpenCL/m05510_a0-optimized.cl rename to OpenCL/m27000_a0-optimized.cl index c82c816bc..77d86e001 100644 --- a/OpenCL/m05510_a0-optimized.cl +++ b/OpenCL/m27000_a0-optimized.cl @@ -502,7 +502,7 @@ DECLSPEC void transform_netntlmv1_key (const u32x w0, const u32x w1, u32x *out) | ((k[7] & 0xff) << 24); } -KERNEL_FQ void m05510_m04 (KERN_ATTR_RULES ()) +KERNEL_FQ void m27000_m04 (KERN_ATTR_RULES ()) { /** * modifier @@ -624,15 +624,15 @@ KERNEL_FQ void m05510_m04 (KERN_ATTR_RULES ()) } } -KERNEL_FQ void m05510_m08 (KERN_ATTR_RULES ()) +KERNEL_FQ void m27000_m08 (KERN_ATTR_RULES ()) { } -KERNEL_FQ void m05510_m16 (KERN_ATTR_RULES ()) +KERNEL_FQ void m27000_m16 (KERN_ATTR_RULES ()) { } -KERNEL_FQ void m05510_s04 (KERN_ATTR_RULES ()) +KERNEL_FQ void m27000_s04 (KERN_ATTR_RULES ()) { /** * modifier @@ -770,10 +770,10 @@ KERNEL_FQ void m05510_s04 (KERN_ATTR_RULES ()) } } -KERNEL_FQ void m05510_s08 (KERN_ATTR_RULES ()) +KERNEL_FQ void m27000_s08 (KERN_ATTR_RULES ()) { } -KERNEL_FQ void m05510_s16 (KERN_ATTR_RULES ()) +KERNEL_FQ void m27000_s16 (KERN_ATTR_RULES ()) { } diff --git a/OpenCL/m05510_a0-pure.cl b/OpenCL/m27000_a0-pure.cl similarity index 99% rename from OpenCL/m05510_a0-pure.cl rename to OpenCL/m27000_a0-pure.cl index 366988aaa..0cc4580c0 100644 --- a/OpenCL/m05510_a0-pure.cl +++ b/OpenCL/m27000_a0-pure.cl @@ -502,7 +502,7 @@ DECLSPEC void transform_netntlmv1_key (const u32 w0, const u32 w1, u32 *out) | ((k[7] & 0xff) << 24); } -KERNEL_FQ void m05510_mxx (KERN_ATTR_RULES ()) +KERNEL_FQ void m27000_mxx (KERN_ATTR_RULES ()) { /** * modifier @@ -622,7 +622,7 @@ KERNEL_FQ void m05510_mxx (KERN_ATTR_RULES ()) } } -KERNEL_FQ void m05510_sxx (KERN_ATTR_RULES ()) +KERNEL_FQ void m27000_sxx (KERN_ATTR_RULES ()) { /** * modifier diff --git a/OpenCL/m05510_a3-pure.cl b/OpenCL/m27000_a3-pure.cl similarity index 99% rename from OpenCL/m05510_a3-pure.cl rename to OpenCL/m27000_a3-pure.cl index 9cb5d9730..3984f4ab9 100644 --- a/OpenCL/m05510_a3-pure.cl +++ b/OpenCL/m27000_a3-pure.cl @@ -500,7 +500,7 @@ DECLSPEC void transform_netntlmv1_key (const u32x w0, const u32x w1, u32x *out) | ((k[7] & 0xff) << 24); } -KERNEL_FQ void m05510_mxx (KERN_ATTR_VECTOR ()) +KERNEL_FQ void m27000_mxx (KERN_ATTR_VECTOR ()) { /** * modifier @@ -644,7 +644,7 @@ KERNEL_FQ void m05510_mxx (KERN_ATTR_VECTOR ()) } } -KERNEL_FQ void m05510_sxx (KERN_ATTR_VECTOR ()) +KERNEL_FQ void m27000_sxx (KERN_ATTR_VECTOR ()) { /** * modifier diff --git a/OpenCL/m05610_a0-optimized.cl b/OpenCL/m27100_a0-optimized.cl similarity index 97% rename from OpenCL/m05610_a0-optimized.cl rename to OpenCL/m27100_a0-optimized.cl index 8260b9159..e00a93607 100644 --- a/OpenCL/m05610_a0-optimized.cl +++ b/OpenCL/m27100_a0-optimized.cl @@ -114,7 +114,7 @@ DECLSPEC void hmac_md5_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, md5_transform_vector (w0, w1, w2, w3, digest); } -KERNEL_FQ void m05610_m04 (KERN_ATTR_RULES_ESALT (netntlm_t)) +KERNEL_FQ void m27100_m04 (KERN_ATTR_RULES_ESALT (netntlm_t)) { /** * modifier @@ -347,15 +347,15 @@ KERNEL_FQ void m05610_m04 (KERN_ATTR_RULES_ESALT (netntlm_t)) } } -KERNEL_FQ void m05610_m08 (KERN_ATTR_RULES_ESALT (netntlm_t)) +KERNEL_FQ void m27100_m08 (KERN_ATTR_RULES_ESALT (netntlm_t)) { } -KERNEL_FQ void m05610_m16 (KERN_ATTR_RULES_ESALT (netntlm_t)) +KERNEL_FQ void m27100_m16 (KERN_ATTR_RULES_ESALT (netntlm_t)) { } -KERNEL_FQ void m05610_s04 (KERN_ATTR_RULES_ESALT (netntlm_t)) +KERNEL_FQ void m27100_s04 (KERN_ATTR_RULES_ESALT (netntlm_t)) { /** * modifier @@ -601,10 +601,10 @@ KERNEL_FQ void m05610_s04 (KERN_ATTR_RULES_ESALT (netntlm_t)) } } -KERNEL_FQ void m05610_s08 (KERN_ATTR_RULES_ESALT (netntlm_t)) +KERNEL_FQ void m27100_s08 (KERN_ATTR_RULES_ESALT (netntlm_t)) { } -KERNEL_FQ void m05610_s16 (KERN_ATTR_RULES_ESALT (netntlm_t)) +KERNEL_FQ void m27100_s16 (KERN_ATTR_RULES_ESALT (netntlm_t)) { } diff --git a/OpenCL/m05610_a0-pure.cl b/OpenCL/m27100_a0-pure.cl similarity index 96% rename from OpenCL/m05610_a0-pure.cl rename to OpenCL/m27100_a0-pure.cl index 69feb2c3e..99f8b6a6f 100644 --- a/OpenCL/m05610_a0-pure.cl +++ b/OpenCL/m27100_a0-pure.cl @@ -29,7 +29,7 @@ typedef struct netntlm } netntlm_t; -KERNEL_FQ void m05610_mxx (KERN_ATTR_RULES_ESALT (netntlm_t)) +KERNEL_FQ void m27100_mxx (KERN_ATTR_RULES_ESALT (netntlm_t)) { /** * modifier @@ -115,7 +115,7 @@ KERNEL_FQ void m05610_mxx (KERN_ATTR_RULES_ESALT (netntlm_t)) } } -KERNEL_FQ void m05610_sxx (KERN_ATTR_RULES_ESALT (netntlm_t)) +KERNEL_FQ void m27100_sxx (KERN_ATTR_RULES_ESALT (netntlm_t)) { /** * modifier diff --git a/OpenCL/m05610_a3-pure.cl b/OpenCL/m27100_a3-pure.cl similarity index 97% rename from OpenCL/m05610_a3-pure.cl rename to OpenCL/m27100_a3-pure.cl index 5599674d9..e7b75e51b 100644 --- a/OpenCL/m05610_a3-pure.cl +++ b/OpenCL/m27100_a3-pure.cl @@ -27,7 +27,7 @@ typedef struct netntlm } netntlm_t; -KERNEL_FQ void m05610_mxx (KERN_ATTR_VECTOR_ESALT (netntlm_t)) +KERNEL_FQ void m27100_mxx (KERN_ATTR_VECTOR_ESALT (netntlm_t)) { /** * modifier @@ -137,7 +137,7 @@ KERNEL_FQ void m05610_mxx (KERN_ATTR_VECTOR_ESALT (netntlm_t)) } } -KERNEL_FQ void m05610_sxx (KERN_ATTR_VECTOR_ESALT (netntlm_t)) +KERNEL_FQ void m27100_sxx (KERN_ATTR_VECTOR_ESALT (netntlm_t)) { /** * modifier diff --git a/src/modules/module_05510.c b/src/modules/module_27000.c similarity index 99% rename from src/modules/module_05510.c rename to src/modules/module_27000.c index 5692b7daf..69b0732db 100644 --- a/src/modules/module_05510.c +++ b/src/modules/module_27000.c @@ -20,7 +20,7 @@ static const u32 DGST_POS3 = 3; static const u32 DGST_SIZE = DGST_SIZE_4_4; static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; static const char *HASH_NAME = "NetNTLMv1 / NetNTLMv1+ESS (NT)"; -static const u64 KERN_TYPE = 5510; +static const u64 KERN_TYPE = 27000; static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_PT_ADD80 diff --git a/src/modules/module_05610.c b/src/modules/module_27100.c similarity index 99% rename from src/modules/module_05610.c rename to src/modules/module_27100.c index 5d1eeb585..769113315 100644 --- a/src/modules/module_05610.c +++ b/src/modules/module_27100.c @@ -20,7 +20,7 @@ static const u32 DGST_POS3 = 1; static const u32 DGST_SIZE = DGST_SIZE_4_4; static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_PROTOCOL; static const char *HASH_NAME = "NetNTLMv2 (NT)"; -static const u64 KERN_TYPE = 5610; +static const u64 KERN_TYPE = 27100; static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_PT_ADD80 From 5249e2152d5d94be518d62e3c63762173df7bd2c Mon Sep 17 00:00:00 2001 From: Cablethief Date: Mon, 7 Jun 2021 09:58:05 +0200 Subject: [PATCH 05/64] Addition of OPTS_TYPE_PT_ALWAYS_HEXIFY --- src/modules/module_27000.c | 3 ++- src/modules/module_27100.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/module_27000.c b/src/modules/module_27000.c index 69b0732db..6467cfe9c 100644 --- a/src/modules/module_27000.c +++ b/src/modules/module_27000.c @@ -26,7 +26,8 @@ static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_PT_ADD80 | OPTS_TYPE_PT_ADDBITS14 | OPTS_TYPE_PT_UTF16LE - | OPTS_TYPE_ST_HEX; + | OPTS_TYPE_ST_HEX + | OPTS_TYPE_PT_ALWAYS_HEXIFY; static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; static const char *ST_PASS = "\xb4\xb9\xb0\x2e\x6f\x09\xa9\xbd\x76\x0f\x38\x8b\x67\x35\x1e\x2b"; static const char *ST_HASH = "::5V4T:ada06359242920a500000000000000000000000000000000:0556d5297b5daa70eaffde82ef99293a3f3bb59b7c9704ea:9c23f6c094853920"; diff --git a/src/modules/module_27100.c b/src/modules/module_27100.c index 769113315..af7d08b79 100644 --- a/src/modules/module_27100.c +++ b/src/modules/module_27100.c @@ -26,7 +26,8 @@ static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_PT_ADD80 | OPTS_TYPE_PT_ADDBITS14 | OPTS_TYPE_PT_UTF16LE - | OPTS_TYPE_ST_HEX; + | OPTS_TYPE_ST_HEX + | OPTS_TYPE_PT_ALWAYS_HEXIFY; static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; static const char *ST_PASS = "\xb4\xb9\xb0\x2e\x6f\x09\xa9\xbd\x76\x0f\x38\x8b\x67\x35\x1e\x2b"; static const char *ST_HASH = "0UL5G37JOI0SX::6VB1IS0KA74:ebe1afa18b7fbfa6:aab8bf8675658dd2a939458a1077ba08:010100000000000031c8aa092510945398b9f7b7dde1a9fb00000000f7876f2b04b700"; From a38b5b3e255bc4c97a54f665d0c048cf8d9d83a7 Mon Sep 17 00:00:00 2001 From: Cablethief Date: Wed, 14 Jul 2021 14:58:26 +0200 Subject: [PATCH 06/64] 27100 Slow hash, have doubts on how to correctly set iterations --- OpenCL/m27100-pure.cl | 161 +++++++++ OpenCL/m27100_a0-optimized.cl | 610 ---------------------------------- OpenCL/m27100_a0-pure.cl | 214 ------------ OpenCL/m27100_a3-pure.cl | 260 --------------- src/modules/module_27100.c | 20 +- 5 files changed, 179 insertions(+), 1086 deletions(-) create mode 100644 OpenCL/m27100-pure.cl delete mode 100644 OpenCL/m27100_a0-optimized.cl delete mode 100644 OpenCL/m27100_a0-pure.cl delete mode 100644 OpenCL/m27100_a3-pure.cl diff --git a/OpenCL/m27100-pure.cl b/OpenCL/m27100-pure.cl new file mode 100644 index 000000000..7259c2973 --- /dev/null +++ b/OpenCL/m27100-pure.cl @@ -0,0 +1,161 @@ +/** + * 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_md4.cl" +#include "inc_hash_md5.cl" +#endif + +#define COMPARE_S "inc_comp_single.cl" +#define COMPARE_M "inc_comp_multi.cl" + +typedef struct netntlm +{ + u32 user_len; + u32 domain_len; + u32 srvchall_len; + u32 clichall_len; + + u32 userdomain_buf[64]; + u32 chall_buf[256]; + +} netntlm_t; + +typedef struct netntlmv2_tmp +{ + u32 digest_buf[4]; + +} netntlm_tmp_t; + + +KERNEL_FQ void m27100_init (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + /** + * base + */ + + tmps[gid].digest_buf[0] = pws[gid].i[ 0]; + tmps[gid].digest_buf[1] = pws[gid].i[ 1]; + tmps[gid].digest_buf[2] = pws[gid].i[ 2]; + tmps[gid].digest_buf[3] = pws[gid].i[ 3]; +} + + +KERNEL_FQ void m27100_loop (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) +{ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + + u32 w0[4]; + u32 w1[4]; + u32 w2[4]; + u32 w3[4]; + + w0[0] = tmps[gid].digest_buf[0]; + w0[1] = tmps[gid].digest_buf[1]; + w0[2] = tmps[gid].digest_buf[2]; + w0[3] = tmps[gid].digest_buf[3]; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; + + for (u32 i = 0; i < loop_cnt; i++) + { + + md5_hmac_ctx_t ctx0; + + md5_hmac_init_64 (&ctx0, w0, w1, w2, w3); + + md5_hmac_update_global (&ctx0, esalt_bufs[DIGESTS_OFFSET].userdomain_buf, esalt_bufs[DIGESTS_OFFSET].user_len + esalt_bufs[DIGESTS_OFFSET].domain_len); + + md5_hmac_final (&ctx0); + + w0[0] = ctx0.opad.h[0]; + w0[1] = ctx0.opad.h[1]; + w0[2] = ctx0.opad.h[2]; + w0[3] = ctx0.opad.h[3]; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; + + md5_hmac_ctx_t ctx; + + md5_hmac_init_64 (&ctx, w0, w1, w2, w3); + + md5_hmac_update_global (&ctx, esalt_bufs[DIGESTS_OFFSET].chall_buf, esalt_bufs[DIGESTS_OFFSET].srvchall_len + esalt_bufs[DIGESTS_OFFSET].clichall_len); + + md5_hmac_final (&ctx); + + tmps[gid].digest_buf[0] = ctx.opad.h[0]; + tmps[gid].digest_buf[1] = ctx.opad.h[1]; + tmps[gid].digest_buf[2] = ctx.opad.h[2]; + tmps[gid].digest_buf[3] = ctx.opad.h[3]; + } +} + +KERNEL_FQ void m27100_comp (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + const u64 lid = get_local_id (0); + + /** + * digest + */ + + const u32 r0 = tmps[gid].digest_buf[DGST_R0]; + const u32 r1 = tmps[gid].digest_buf[DGST_R1]; + const u32 r2 = tmps[gid].digest_buf[DGST_R2]; + const u32 r3 = tmps[gid].digest_buf[DGST_R3]; + + #define il_pos 0 + + #ifdef KERNEL_STATIC + #include COMPARE_M + #endif +} \ No newline at end of file diff --git a/OpenCL/m27100_a0-optimized.cl b/OpenCL/m27100_a0-optimized.cl deleted file mode 100644 index e00a93607..000000000 --- a/OpenCL/m27100_a0-optimized.cl +++ /dev/null @@ -1,610 +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_rp_optimized.h" -#include "inc_rp_optimized.cl" -#include "inc_simd.cl" -#include "inc_hash_md4.cl" -#include "inc_hash_md5.cl" -#endif - -typedef struct netntlm -{ - u32 user_len; - u32 domain_len; - u32 srvchall_len; - u32 clichall_len; - - u32 userdomain_buf[64]; - u32 chall_buf[256]; - -} netntlm_t; - -DECLSPEC void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad) -{ - w0[0] = w0[0] ^ 0x36363636; - w0[1] = w0[1] ^ 0x36363636; - w0[2] = w0[2] ^ 0x36363636; - w0[3] = w0[3] ^ 0x36363636; - w1[0] = w1[0] ^ 0x36363636; - w1[1] = w1[1] ^ 0x36363636; - w1[2] = w1[2] ^ 0x36363636; - w1[3] = w1[3] ^ 0x36363636; - w2[0] = w2[0] ^ 0x36363636; - w2[1] = w2[1] ^ 0x36363636; - w2[2] = w2[2] ^ 0x36363636; - w2[3] = w2[3] ^ 0x36363636; - w3[0] = w3[0] ^ 0x36363636; - w3[1] = w3[1] ^ 0x36363636; - w3[2] = w3[2] ^ 0x36363636; - w3[3] = w3[3] ^ 0x36363636; - - ipad[0] = MD5M_A; - ipad[1] = MD5M_B; - ipad[2] = MD5M_C; - ipad[3] = MD5M_D; - - md5_transform_vector (w0, w1, w2, w3, ipad); - - w0[0] = w0[0] ^ 0x6a6a6a6a; - w0[1] = w0[1] ^ 0x6a6a6a6a; - w0[2] = w0[2] ^ 0x6a6a6a6a; - w0[3] = w0[3] ^ 0x6a6a6a6a; - w1[0] = w1[0] ^ 0x6a6a6a6a; - w1[1] = w1[1] ^ 0x6a6a6a6a; - w1[2] = w1[2] ^ 0x6a6a6a6a; - w1[3] = w1[3] ^ 0x6a6a6a6a; - w2[0] = w2[0] ^ 0x6a6a6a6a; - w2[1] = w2[1] ^ 0x6a6a6a6a; - w2[2] = w2[2] ^ 0x6a6a6a6a; - w2[3] = w2[3] ^ 0x6a6a6a6a; - w3[0] = w3[0] ^ 0x6a6a6a6a; - w3[1] = w3[1] ^ 0x6a6a6a6a; - w3[2] = w3[2] ^ 0x6a6a6a6a; - w3[3] = w3[3] ^ 0x6a6a6a6a; - - opad[0] = MD5M_A; - opad[1] = MD5M_B; - opad[2] = MD5M_C; - opad[3] = MD5M_D; - - md5_transform_vector (w0, w1, w2, w3, opad); -} - -DECLSPEC void hmac_md5_run (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]; - - md5_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] = 0x80; - 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] = (64 + 16) * 8; - w3[3] = 0; - - digest[0] = opad[0]; - digest[1] = opad[1]; - digest[2] = opad[2]; - digest[3] = opad[3]; - - md5_transform_vector (w0, w1, w2, w3, digest); -} - -KERNEL_FQ void m27100_m04 (KERN_ATTR_RULES_ESALT (netntlm_t)) -{ - /** - * modifier - */ - - const u64 gid = get_global_id (0); - const u64 lid = get_local_id (0); - const u64 lsz = get_local_size (0); - - /** - * salt - */ - - LOCAL_VK u32 s_userdomain_buf[64]; - - for (u32 i = lid; i < 64; i += lsz) - { - s_userdomain_buf[i] = esalt_bufs[DIGESTS_OFFSET].userdomain_buf[i]; - } - - LOCAL_VK u32 s_chall_buf[256]; - - for (u32 i = lid; i < 256; i += lsz) - { - s_chall_buf[i] = esalt_bufs[DIGESTS_OFFSET].chall_buf[i]; - } - - SYNC_THREADS (); - - if (gid >= gid_max) return; - - const u32 userdomain_len = esalt_bufs[DIGESTS_OFFSET].user_len - + esalt_bufs[DIGESTS_OFFSET].domain_len; - - const u32 chall_len = esalt_bufs[DIGESTS_OFFSET].srvchall_len - + esalt_bufs[DIGESTS_OFFSET].clichall_len; - - /** - * base - */ - - // u32 pw_buf0[4]; - // u32 pw_buf1[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]; - // pw_buf1[0] = pws[gid].i[4]; - // pw_buf1[1] = pws[gid].i[5]; - // pw_buf1[2] = pws[gid].i[6]; - // pw_buf1[3] = pws[gid].i[7]; - - // const u32 pw_len = pws[gid].pw_len & 63; - - /** - * loop - */ - - for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE) - { - // u32x w0[4] = { 0 }; - // u32x w1[4] = { 0 }; - // u32x w2[4] = { 0 }; - // u32x w3[4] = { 0 }; - - // const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); - - // append_0x80_2x4_VV (w0, w1, out_len); - - u32x w0_t[4]; - u32x w1_t[4]; - u32x w2_t[4]; - u32x w3_t[4]; - - // make_utf16le (w0, w0_t, w1_t); - // make_utf16le (w1, w2_t, w3_t); - - // w3_t[2] = out_len * 8 * 2; - // w3_t[3] = 0; - - - // digest[0] = pws[gid].i[ 0]; - // digest[1] = pws[gid].i[ 1];; - // digest[2] = pws[gid].i[ 2];; - // digest[3] = pws[gid].i[ 3];; - - - // md4_transform_vector (w0_t, w1_t, w2_t, w3_t, digest); - - w0_t[0] = pws[gid].i[ 0]; - w0_t[1] = pws[gid].i[ 1]; - w0_t[2] = pws[gid].i[ 2]; - w0_t[3] = pws[gid].i[ 3]; - w1_t[0] = 0; - w1_t[1] = 0; - w1_t[2] = 0; - w1_t[3] = 0; - w2_t[0] = 0; - w2_t[1] = 0; - w2_t[2] = 0; - w2_t[3] = 0; - w3_t[0] = 0; - w3_t[1] = 0; - w3_t[2] = 0; - w3_t[3] = 0; - - u32x digest[4]; - - digest[0] = MD5M_A; - digest[1] = MD5M_B; - digest[2] = MD5M_C; - digest[3] = MD5M_D; - - u32x ipad[4]; - u32x opad[4]; - - hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad); - - int left; - int off; - - for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16) - { - w0_t[0] = s_userdomain_buf[off + 0]; - w0_t[1] = s_userdomain_buf[off + 1]; - w0_t[2] = s_userdomain_buf[off + 2]; - w0_t[3] = s_userdomain_buf[off + 3]; - w1_t[0] = s_userdomain_buf[off + 4]; - w1_t[1] = s_userdomain_buf[off + 5]; - w1_t[2] = s_userdomain_buf[off + 6]; - w1_t[3] = s_userdomain_buf[off + 7]; - w2_t[0] = s_userdomain_buf[off + 8]; - w2_t[1] = s_userdomain_buf[off + 9]; - w2_t[2] = s_userdomain_buf[off + 10]; - w2_t[3] = s_userdomain_buf[off + 11]; - w3_t[0] = s_userdomain_buf[off + 12]; - w3_t[1] = s_userdomain_buf[off + 13]; - w3_t[2] = s_userdomain_buf[off + 14]; - w3_t[3] = s_userdomain_buf[off + 15]; - - md5_transform_vector (w0_t, w1_t, w2_t, w3_t, ipad); - } - - w0_t[0] = s_userdomain_buf[off + 0]; - w0_t[1] = s_userdomain_buf[off + 1]; - w0_t[2] = s_userdomain_buf[off + 2]; - w0_t[3] = s_userdomain_buf[off + 3]; - w1_t[0] = s_userdomain_buf[off + 4]; - w1_t[1] = s_userdomain_buf[off + 5]; - w1_t[2] = s_userdomain_buf[off + 6]; - w1_t[3] = s_userdomain_buf[off + 7]; - w2_t[0] = s_userdomain_buf[off + 8]; - w2_t[1] = s_userdomain_buf[off + 9]; - w2_t[2] = s_userdomain_buf[off + 10]; - w2_t[3] = s_userdomain_buf[off + 11]; - w3_t[0] = s_userdomain_buf[off + 12]; - w3_t[1] = s_userdomain_buf[off + 13]; - w3_t[2] = (64 + userdomain_len) * 8; - w3_t[3] = 0; - - hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest); - - w0_t[0] = digest[0]; - w0_t[1] = digest[1]; - w0_t[2] = digest[2]; - w0_t[3] = digest[3]; - w1_t[0] = 0; - w1_t[1] = 0; - w1_t[2] = 0; - w1_t[3] = 0; - w2_t[0] = 0; - w2_t[1] = 0; - w2_t[2] = 0; - w2_t[3] = 0; - w3_t[0] = 0; - w3_t[1] = 0; - w3_t[2] = 0; - w3_t[3] = 0; - - digest[0] = MD5M_A; - digest[1] = MD5M_B; - digest[2] = MD5M_C; - digest[3] = MD5M_D; - - hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad); - - for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16) - { - w0_t[0] = s_chall_buf[off + 0]; - w0_t[1] = s_chall_buf[off + 1]; - w0_t[2] = s_chall_buf[off + 2]; - w0_t[3] = s_chall_buf[off + 3]; - w1_t[0] = s_chall_buf[off + 4]; - w1_t[1] = s_chall_buf[off + 5]; - w1_t[2] = s_chall_buf[off + 6]; - w1_t[3] = s_chall_buf[off + 7]; - w2_t[0] = s_chall_buf[off + 8]; - w2_t[1] = s_chall_buf[off + 9]; - w2_t[2] = s_chall_buf[off + 10]; - w2_t[3] = s_chall_buf[off + 11]; - w3_t[0] = s_chall_buf[off + 12]; - w3_t[1] = s_chall_buf[off + 13]; - w3_t[2] = s_chall_buf[off + 14]; - w3_t[3] = s_chall_buf[off + 15]; - - md5_transform_vector (w0_t, w1_t, w2_t, w3_t, ipad); - } - - w0_t[0] = s_chall_buf[off + 0]; - w0_t[1] = s_chall_buf[off + 1]; - w0_t[2] = s_chall_buf[off + 2]; - w0_t[3] = s_chall_buf[off + 3]; - w1_t[0] = s_chall_buf[off + 4]; - w1_t[1] = s_chall_buf[off + 5]; - w1_t[2] = s_chall_buf[off + 6]; - w1_t[3] = s_chall_buf[off + 7]; - w2_t[0] = s_chall_buf[off + 8]; - w2_t[1] = s_chall_buf[off + 9]; - w2_t[2] = s_chall_buf[off + 10]; - w2_t[3] = s_chall_buf[off + 11]; - w3_t[0] = s_chall_buf[off + 12]; - w3_t[1] = s_chall_buf[off + 13]; - w3_t[2] = (64 + chall_len) * 8; - w3_t[3] = 0; - - hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest); - - COMPARE_M_SIMD (digest[0], digest[3], digest[2], digest[1]); - } -} - -KERNEL_FQ void m27100_m08 (KERN_ATTR_RULES_ESALT (netntlm_t)) -{ -} - -KERNEL_FQ void m27100_m16 (KERN_ATTR_RULES_ESALT (netntlm_t)) -{ -} - -KERNEL_FQ void m27100_s04 (KERN_ATTR_RULES_ESALT (netntlm_t)) -{ - /** - * modifier - */ - - const u64 gid = get_global_id (0); - const u64 lid = get_local_id (0); - const u64 lsz = get_local_size (0); - - /** - * salt - */ - - LOCAL_VK u32 s_userdomain_buf[64]; - - for (u32 i = lid; i < 64; i += lsz) - { - s_userdomain_buf[i] = esalt_bufs[DIGESTS_OFFSET].userdomain_buf[i]; - } - - LOCAL_VK u32 s_chall_buf[256]; - - for (u32 i = lid; i < 256; i += lsz) - { - s_chall_buf[i] = esalt_bufs[DIGESTS_OFFSET].chall_buf[i]; - } - - SYNC_THREADS (); - - if (gid >= gid_max) return; - - const u32 userdomain_len = esalt_bufs[DIGESTS_OFFSET].user_len - + esalt_bufs[DIGESTS_OFFSET].domain_len; - - const u32 chall_len = esalt_bufs[DIGESTS_OFFSET].srvchall_len - + esalt_bufs[DIGESTS_OFFSET].clichall_len; - - /** - * base - */ - - // u32 pw_buf0[4]; - // u32 pw_buf1[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]; - // pw_buf1[0] = pws[gid].i[4]; - // pw_buf1[1] = pws[gid].i[5]; - // pw_buf1[2] = pws[gid].i[6]; - // pw_buf1[3] = pws[gid].i[7]; - - // const u32 pw_len = pws[gid].pw_len & 63; - - /** - * 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] - }; - - /** - * loop - */ - - for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE) - { - // u32x w0[4] = { 0 }; - // u32x w1[4] = { 0 }; - // u32x w2[4] = { 0 }; - // u32x w3[4] = { 0 }; - - // const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1); - - // append_0x80_2x4_VV (w0, w1, out_len); - - u32x w0_t[4]; - u32x w1_t[4]; - u32x w2_t[4]; - u32x w3_t[4]; - - // make_utf16le (w0, w0_t, w1_t); - // make_utf16le (w1, w2_t, w3_t); - - // w3_t[2] = out_len * 8 * 2; - // w3_t[3] = 0; - - // u32x digest[4]; - - // digest[0] = pws[gid].i[ 0]; - // digest[1] = pws[gid].i[ 1]; - // digest[2] = pws[gid].i[ 2]; - // digest[3] = pws[gid].i[ 3]; - - // md4_transform_vector (w0_t, w1_t, w2_t, w3_t, digest); - - w0_t[0] = pws[gid].i[ 0]; - w0_t[1] = pws[gid].i[ 1]; - w0_t[2] = pws[gid].i[ 2]; - w0_t[3] = pws[gid].i[ 3]; - w1_t[0] = 0; - w1_t[1] = 0; - w1_t[2] = 0; - w1_t[3] = 0; - w2_t[0] = 0; - w2_t[1] = 0; - w2_t[2] = 0; - w2_t[3] = 0; - w3_t[0] = 0; - w3_t[1] = 0; - w3_t[2] = 0; - w3_t[3] = 0; - - u32x digest[4]; - - digest[0] = MD5M_A; - digest[1] = MD5M_B; - digest[2] = MD5M_C; - digest[3] = MD5M_D; - - - u32x ipad[4]; - u32x opad[4]; - - hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad); - - int left; - int off; - - for (left = userdomain_len, off = 0; left >= 56; left -= 64, off += 16) - { - w0_t[0] = s_userdomain_buf[off + 0]; - w0_t[1] = s_userdomain_buf[off + 1]; - w0_t[2] = s_userdomain_buf[off + 2]; - w0_t[3] = s_userdomain_buf[off + 3]; - w1_t[0] = s_userdomain_buf[off + 4]; - w1_t[1] = s_userdomain_buf[off + 5]; - w1_t[2] = s_userdomain_buf[off + 6]; - w1_t[3] = s_userdomain_buf[off + 7]; - w2_t[0] = s_userdomain_buf[off + 8]; - w2_t[1] = s_userdomain_buf[off + 9]; - w2_t[2] = s_userdomain_buf[off + 10]; - w2_t[3] = s_userdomain_buf[off + 11]; - w3_t[0] = s_userdomain_buf[off + 12]; - w3_t[1] = s_userdomain_buf[off + 13]; - w3_t[2] = s_userdomain_buf[off + 14]; - w3_t[3] = s_userdomain_buf[off + 15]; - - md5_transform_vector (w0_t, w1_t, w2_t, w3_t, ipad); - } - - w0_t[0] = s_userdomain_buf[off + 0]; - w0_t[1] = s_userdomain_buf[off + 1]; - w0_t[2] = s_userdomain_buf[off + 2]; - w0_t[3] = s_userdomain_buf[off + 3]; - w1_t[0] = s_userdomain_buf[off + 4]; - w1_t[1] = s_userdomain_buf[off + 5]; - w1_t[2] = s_userdomain_buf[off + 6]; - w1_t[3] = s_userdomain_buf[off + 7]; - w2_t[0] = s_userdomain_buf[off + 8]; - w2_t[1] = s_userdomain_buf[off + 9]; - w2_t[2] = s_userdomain_buf[off + 10]; - w2_t[3] = s_userdomain_buf[off + 11]; - w3_t[0] = s_userdomain_buf[off + 12]; - w3_t[1] = s_userdomain_buf[off + 13]; - w3_t[2] = (64 + userdomain_len) * 8; - w3_t[3] = 0; - - hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest); - - w0_t[0] = digest[0]; - w0_t[1] = digest[1]; - w0_t[2] = digest[2]; - w0_t[3] = digest[3]; - w1_t[0] = 0; - w1_t[1] = 0; - w1_t[2] = 0; - w1_t[3] = 0; - w2_t[0] = 0; - w2_t[1] = 0; - w2_t[2] = 0; - w2_t[3] = 0; - w3_t[0] = 0; - w3_t[1] = 0; - w3_t[2] = 0; - w3_t[3] = 0; - - digest[0] = MD5M_A; - digest[1] = MD5M_B; - digest[2] = MD5M_C; - digest[3] = MD5M_D; - - hmac_md5_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad); - - for (left = chall_len, off = 0; left >= 56; left -= 64, off += 16) - { - w0_t[0] = s_chall_buf[off + 0]; - w0_t[1] = s_chall_buf[off + 1]; - w0_t[2] = s_chall_buf[off + 2]; - w0_t[3] = s_chall_buf[off + 3]; - w1_t[0] = s_chall_buf[off + 4]; - w1_t[1] = s_chall_buf[off + 5]; - w1_t[2] = s_chall_buf[off + 6]; - w1_t[3] = s_chall_buf[off + 7]; - w2_t[0] = s_chall_buf[off + 8]; - w2_t[1] = s_chall_buf[off + 9]; - w2_t[2] = s_chall_buf[off + 10]; - w2_t[3] = s_chall_buf[off + 11]; - w3_t[0] = s_chall_buf[off + 12]; - w3_t[1] = s_chall_buf[off + 13]; - w3_t[2] = s_chall_buf[off + 14]; - w3_t[3] = s_chall_buf[off + 15]; - - md5_transform_vector (w0_t, w1_t, w2_t, w3_t, ipad); - } - - w0_t[0] = s_chall_buf[off + 0]; - w0_t[1] = s_chall_buf[off + 1]; - w0_t[2] = s_chall_buf[off + 2]; - w0_t[3] = s_chall_buf[off + 3]; - w1_t[0] = s_chall_buf[off + 4]; - w1_t[1] = s_chall_buf[off + 5]; - w1_t[2] = s_chall_buf[off + 6]; - w1_t[3] = s_chall_buf[off + 7]; - w2_t[0] = s_chall_buf[off + 8]; - w2_t[1] = s_chall_buf[off + 9]; - w2_t[2] = s_chall_buf[off + 10]; - w2_t[3] = s_chall_buf[off + 11]; - w3_t[0] = s_chall_buf[off + 12]; - w3_t[1] = s_chall_buf[off + 13]; - w3_t[2] = (64 + chall_len) * 8; - w3_t[3] = 0; - - hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest); - - COMPARE_S_SIMD (digest[0], digest[3], digest[2], digest[1]); - } -} - -KERNEL_FQ void m27100_s08 (KERN_ATTR_RULES_ESALT (netntlm_t)) -{ -} - -KERNEL_FQ void m27100_s16 (KERN_ATTR_RULES_ESALT (netntlm_t)) -{ -} diff --git a/OpenCL/m27100_a0-pure.cl b/OpenCL/m27100_a0-pure.cl deleted file mode 100644 index 99f8b6a6f..000000000 --- a/OpenCL/m27100_a0-pure.cl +++ /dev/null @@ -1,214 +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_rp.h" -#include "inc_rp.cl" -#include "inc_scalar.cl" -#include "inc_hash_md4.cl" -#include "inc_hash_md5.cl" -#endif - -typedef struct netntlm -{ - u32 user_len; - u32 domain_len; - u32 srvchall_len; - u32 clichall_len; - - u32 userdomain_buf[64]; - u32 chall_buf[256]; - -} netntlm_t; - -KERNEL_FQ void m27100_mxx (KERN_ATTR_RULES_ESALT (netntlm_t)) -{ - /** - * modifier - */ - - const u64 lid = get_local_id (0); - const u64 gid = get_global_id (0); - - if (gid >= gid_max) return; - - /** - * base - */ - - u32 w0[4]; - u32 w1[4]; - u32 w2[4]; - u32 w3[4]; - - w0[0] = pws[gid].i[ 0]; - w0[1] = pws[gid].i[ 1]; - w0[2] = pws[gid].i[ 2]; - w0[3] = pws[gid].i[ 3]; - w1[0] = 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; - - /** - * loop - */ - - for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) - { - - md5_hmac_ctx_t ctx0; - - md5_hmac_init_64 (&ctx0, w0, w1, w2, w3); - - md5_hmac_update_global (&ctx0, esalt_bufs[DIGESTS_OFFSET].userdomain_buf, esalt_bufs[DIGESTS_OFFSET].user_len + esalt_bufs[DIGESTS_OFFSET].domain_len); - - md5_hmac_final (&ctx0); - - w0[0] = ctx0.opad.h[0]; - w0[1] = ctx0.opad.h[1]; - w0[2] = ctx0.opad.h[2]; - w0[3] = ctx0.opad.h[3]; - w1[0] = 0; - w1[1] = 0; - w1[2] = 0; - w1[3] = 0; - w2[0] = 0; - w2[1] = 0; - w2[2] = 0; - w2[3] = 0; - w3[0] = 0; - w3[1] = 0; - w3[2] = 0; - w3[3] = 0; - - md5_hmac_ctx_t ctx; - - md5_hmac_init_64 (&ctx, w0, w1, w2, w3); - - md5_hmac_update_global (&ctx, esalt_bufs[DIGESTS_OFFSET].chall_buf, esalt_bufs[DIGESTS_OFFSET].srvchall_len + esalt_bufs[DIGESTS_OFFSET].clichall_len); - - md5_hmac_final (&ctx); - - const u32 r0 = ctx.opad.h[DGST_R0]; - const u32 r1 = ctx.opad.h[DGST_R1]; - const u32 r2 = ctx.opad.h[DGST_R2]; - const u32 r3 = ctx.opad.h[DGST_R3]; - - COMPARE_M_SCALAR (r0, r1, r2, r3); - } -} - -KERNEL_FQ void m27100_sxx (KERN_ATTR_RULES_ESALT (netntlm_t)) -{ - /** - * 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 w0[4]; - u32 w1[4]; - u32 w2[4]; - u32 w3[4]; - - w0[0] = pws[gid].i[ 0]; - w0[1] = pws[gid].i[ 1]; - w0[2] = pws[gid].i[ 2]; - w0[3] = pws[gid].i[ 3]; - w1[0] = 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; - - /** - * loop - */ - - for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) - { - - md5_hmac_ctx_t ctx0; - - md5_hmac_init_64 (&ctx0, w0, w1, w2, w3); - - md5_hmac_update_global (&ctx0, esalt_bufs[DIGESTS_OFFSET].userdomain_buf, esalt_bufs[DIGESTS_OFFSET].user_len + esalt_bufs[DIGESTS_OFFSET].domain_len); - - md5_hmac_final (&ctx0); - - w0[0] = ctx0.opad.h[0]; - w0[1] = ctx0.opad.h[1]; - w0[2] = ctx0.opad.h[2]; - w0[3] = ctx0.opad.h[3]; - w1[0] = 0; - w1[1] = 0; - w1[2] = 0; - w1[3] = 0; - w2[0] = 0; - w2[1] = 0; - w2[2] = 0; - w2[3] = 0; - w3[0] = 0; - w3[1] = 0; - w3[2] = 0; - w3[3] = 0; - - md5_hmac_ctx_t ctx; - - md5_hmac_init_64 (&ctx, w0, w1, w2, w3); - - md5_hmac_update_global (&ctx, esalt_bufs[DIGESTS_OFFSET].chall_buf, esalt_bufs[DIGESTS_OFFSET].srvchall_len + esalt_bufs[DIGESTS_OFFSET].clichall_len); - - md5_hmac_final (&ctx); - - const u32 r0 = ctx.opad.h[DGST_R0]; - const u32 r1 = ctx.opad.h[DGST_R1]; - const u32 r2 = ctx.opad.h[DGST_R2]; - const u32 r3 = ctx.opad.h[DGST_R3]; - - COMPARE_S_SCALAR (r0, r1, r2, r3); - } -} diff --git a/OpenCL/m27100_a3-pure.cl b/OpenCL/m27100_a3-pure.cl deleted file mode 100644 index e7b75e51b..000000000 --- a/OpenCL/m27100_a3-pure.cl +++ /dev/null @@ -1,260 +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_scalar.cl" -#include "inc_hash_md4.cl" -#include "inc_hash_md5.cl" -#endif - -typedef struct netntlm -{ - u32 user_len; - u32 domain_len; - u32 srvchall_len; - u32 clichall_len; - - u32 userdomain_buf[64]; - u32 chall_buf[256]; - -} netntlm_t; - -KERNEL_FQ void m27100_mxx (KERN_ATTR_VECTOR_ESALT (netntlm_t)) -{ - /** - * 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 = words_buf_r[il_pos / VECT_SIZE]; - - const u32 w0lr = w0l | w0r; - - w[0] = w0lr; - - // md4_ctx_t ctx1; - - // md4_init (&ctx1); - - // md4_update_utf16le (&ctx1, w, pw_len); - - // md4_final (&ctx1); - - u32 w0[4]; - u32 w1[4]; - u32 w2[4]; - u32 w3[4]; - - w0[0] = w[0]; - w0[1] = w[1]; - w0[2] = w[2]; - w0[3] = w[3]; - w1[0] = 0; - w1[1] = 0; - w1[2] = 0; - w1[3] = 0; - w2[0] = 0; - w2[1] = 0; - w2[2] = 0; - w2[3] = 0; - w3[0] = 0; - w3[1] = 0; - w3[2] = 0; - w3[3] = 0; - - md5_hmac_ctx_t ctx0; - - md5_hmac_init_64 (&ctx0, w0, w1, w2, w3); - - md5_hmac_update_global (&ctx0, esalt_bufs[DIGESTS_OFFSET].userdomain_buf, esalt_bufs[DIGESTS_OFFSET].user_len + esalt_bufs[DIGESTS_OFFSET].domain_len); - - md5_hmac_final (&ctx0); - - w0[0] = ctx0.opad.h[0]; - w0[1] = ctx0.opad.h[1]; - w0[2] = ctx0.opad.h[2]; - w0[3] = ctx0.opad.h[3]; - w1[0] = 0; - w1[1] = 0; - w1[2] = 0; - w1[3] = 0; - w2[0] = 0; - w2[1] = 0; - w2[2] = 0; - w2[3] = 0; - w3[0] = 0; - w3[1] = 0; - w3[2] = 0; - w3[3] = 0; - - md5_hmac_ctx_t ctx; - - md5_hmac_init_64 (&ctx, w0, w1, w2, w3); - - md5_hmac_update_global (&ctx, esalt_bufs[DIGESTS_OFFSET].chall_buf, esalt_bufs[DIGESTS_OFFSET].srvchall_len + esalt_bufs[DIGESTS_OFFSET].clichall_len); - - md5_hmac_final (&ctx); - - const u32 r0 = ctx.opad.h[DGST_R0]; - const u32 r1 = ctx.opad.h[DGST_R1]; - const u32 r2 = ctx.opad.h[DGST_R2]; - const u32 r3 = ctx.opad.h[DGST_R3]; - - COMPARE_M_SCALAR (r0, r1, r2, r3); - } -} - -KERNEL_FQ void m27100_sxx (KERN_ATTR_VECTOR_ESALT (netntlm_t)) -{ - /** - * 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 = words_buf_r[il_pos / VECT_SIZE]; - - const u32 w0lr = w0l | w0r; - - w[0] = w0lr; - - // md4_ctx_t ctx1; - - // md4_init (&ctx1); - - // md4_update_utf16le (&ctx1, w, pw_len); - - // md4_final (&ctx1); - - u32 w0[4]; - u32 w1[4]; - u32 w2[4]; - u32 w3[4]; - - w0[0] = w[0]; - w0[1] = w[1]; - w0[2] = w[2]; - w0[3] = w[3]; - w1[0] = 0; - w1[1] = 0; - w1[2] = 0; - w1[3] = 0; - w2[0] = 0; - w2[1] = 0; - w2[2] = 0; - w2[3] = 0; - w3[0] = 0; - w3[1] = 0; - w3[2] = 0; - w3[3] = 0; - - md5_hmac_ctx_t ctx0; - - md5_hmac_init_64 (&ctx0, w0, w1, w2, w3); - - md5_hmac_update_global (&ctx0, esalt_bufs[DIGESTS_OFFSET].userdomain_buf, esalt_bufs[DIGESTS_OFFSET].user_len + esalt_bufs[DIGESTS_OFFSET].domain_len); - - md5_hmac_final (&ctx0); - - w0[0] = ctx0.opad.h[0]; - w0[1] = ctx0.opad.h[1]; - w0[2] = ctx0.opad.h[2]; - w0[3] = ctx0.opad.h[3]; - w1[0] = 0; - w1[1] = 0; - w1[2] = 0; - w1[3] = 0; - w2[0] = 0; - w2[1] = 0; - w2[2] = 0; - w2[3] = 0; - w3[0] = 0; - w3[1] = 0; - w3[2] = 0; - w3[3] = 0; - - md5_hmac_ctx_t ctx; - - md5_hmac_init_64 (&ctx, w0, w1, w2, w3); - - md5_hmac_update_global (&ctx, esalt_bufs[DIGESTS_OFFSET].chall_buf, esalt_bufs[DIGESTS_OFFSET].srvchall_len + esalt_bufs[DIGESTS_OFFSET].clichall_len); - - md5_hmac_final (&ctx); - - const u32 r0 = ctx.opad.h[DGST_R0]; - const u32 r1 = ctx.opad.h[DGST_R1]; - const u32 r2 = ctx.opad.h[DGST_R2]; - const u32 r3 = ctx.opad.h[DGST_R3]; - - COMPARE_S_SCALAR (r0, r1, r2, r3); - } -} diff --git a/src/modules/module_27100.c b/src/modules/module_27100.c index af7d08b79..985a43755 100644 --- a/src/modules/module_27100.c +++ b/src/modules/module_27100.c @@ -12,7 +12,7 @@ #include "emu_inc_cipher_des.h" #include "emu_inc_hash_md5.h" -static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 3; static const u32 DGST_POS2 = 2; @@ -44,6 +44,12 @@ typedef struct netntlm } netntlm_t; +typedef struct netntlmv2_tmp +{ + u32 digest_buf[4]; + +} netntlm_tmp_t; + u32 module_attack_exec (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 ATTACK_EXEC; } u32 module_dgst_pos0 (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 DGST_POS0; } u32 module_dgst_pos1 (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 DGST_POS1; } @@ -59,6 +65,13 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (netntlm_tmp_t); + + return tmp_size; +} + u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { const u64 esalt_size = (const u64) sizeof (netntlm_t); @@ -228,6 +241,9 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE salt->salt_len = 16; + // Why my _loop wasnt being called and what was causing me such confusion :D + salt->salt_iter = 1; + return (PARSER_OK); } @@ -383,7 +399,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_separator = MODULE_DEFAULT; module_ctx->module_st_hash = module_st_hash; module_ctx->module_st_pass = module_st_pass; - module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_tmp_size = module_tmp_size; module_ctx->module_unstable_warning = MODULE_DEFAULT; module_ctx->module_warmup_disable = MODULE_DEFAULT; } From c2ceba4c9d93059fa9fc930a24fff22fa5c1c851 Mon Sep 17 00:00:00 2001 From: Cablethief Date: Thu, 15 Jul 2021 15:56:39 +0200 Subject: [PATCH 07/64] Modded test, however unsure of how to specify only HEX input or not --- tools/test_modules/m27100.pm | 91 ++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 tools/test_modules/m27100.pm diff --git a/tools/test_modules/m27100.pm b/tools/test_modules/m27100.pm new file mode 100644 index 000000000..14e4a9234 --- /dev/null +++ b/tools/test_modules/m27100.pm @@ -0,0 +1,91 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Digest::HMAC qw (hmac hmac_hex); +use Digest::MD5 qw (md5); +use Encode qw (encode); + +sub module_constraints { [[32, 32], [32, 32], [32, 32], [0, 27], [-1, -1]] } + +sub module_generate_hash +{ + my $word = shift; + my $user = shift; + + my $user_len = length $user; + my $domain_len = 27 - $user_len; + + my $domain = shift // random_string ($domain_len); + my $srv_ch = shift // random_hex_string (2 * 8); + my $cli_ch = shift // random_client_challenge (); + + my $b_srv_ch = pack ('H*', $srv_ch); + my $b_cli_ch = pack ('H*', $cli_ch); + + # my $nthash = pack_if_HEX_notation ($word); + my $nthash = pack ("H*", $word); + my $identity = encode ('UTF-16LE', uc ($user) . $domain); + my $digest = hmac_hex ($b_srv_ch . $b_cli_ch, hmac ($identity, $nthash, \&md5, 64), \&md5, 64); + + my $hash = sprintf ("%s::%s:%s:%s:%s", $user, $domain, $srv_ch, $digest, $cli_ch); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $user; + my $domain; + my $srv_ch; + my $cli_ch; + my $word; + + my $hash; + + my $index1 = index ($line, '::'); + my $index2 = index ($line, ':', $index1 + 2); + my $index3 = index ($line, ':', $index2 + 3 + 16 + 32); + + return if $index1 eq -1; + return if $index2 eq -1; + return if $index3 eq -1; + + $hash = substr ($line, 0, $index3); + + $user = substr ($line, 0, $index1); + $domain = substr ($line, $index1 + 2, $index2 - $index1 - 2); + $srv_ch = substr ($line, $index2 + 1, 16); + $cli_ch = substr ($line, $index2 + 3 + 16 + 32, $index3 - $index2 - 3 - 16 - 32); + $word = substr ($line, $index3 + 1); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, $user, $domain, $srv_ch, $cli_ch); + + return ($new_hash, $word); +} + +sub random_client_challenge +{ + my $ch; + + $ch .= '0101000000000000'; + $ch .= random_hex_string (2 * 16); + $ch .= '00000000'; + $ch .= random_hex_string (2 * random_count (20)); + $ch .= '00'; + + return $ch; +} + +1; + From 02a9f3471be12d1e84e94e06bcc58fdaa129d89f Mon Sep 17 00:00:00 2001 From: Cablethief Date: Thu, 15 Jul 2021 16:42:18 +0200 Subject: [PATCH 08/64] 27000 slow hash, same doubts as the first, but now with the shared mem concerns --- OpenCL/m27000-pure.cl | 678 +++++++++++++++++++++++++++++++++++++ src/modules/module_27000.c | 20 +- 2 files changed, 696 insertions(+), 2 deletions(-) create mode 100644 OpenCL/m27000-pure.cl diff --git a/OpenCL/m27000-pure.cl b/OpenCL/m27000-pure.cl new file mode 100644 index 000000000..d948d69b0 --- /dev/null +++ b/OpenCL/m27000-pure.cl @@ -0,0 +1,678 @@ +/** + * 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_md4.cl" +#endif + +#define COMPARE_S "inc_comp_single.cl" +#define COMPARE_M "inc_comp_multi.cl" + +#define PERM_OP(a,b,tt,n,m) \ +{ \ + tt = a >> n; \ + tt = tt ^ b; \ + tt = tt & m; \ + b = b ^ tt; \ + tt = tt << n; \ + a = a ^ tt; \ +} + +#define HPERM_OP(a,tt,n,m) \ +{ \ + tt = a << (16 + n); \ + tt = tt ^ a; \ + tt = tt & m; \ + a = a ^ tt; \ + tt = tt >> (16 + n); \ + a = a ^ tt; \ +} + +CONSTANT_VK u32a c_SPtrans[8][64] = +{ + { + 0x02080800, 0x00080000, 0x02000002, 0x02080802, + 0x02000000, 0x00080802, 0x00080002, 0x02000002, + 0x00080802, 0x02080800, 0x02080000, 0x00000802, + 0x02000802, 0x02000000, 0x00000000, 0x00080002, + 0x00080000, 0x00000002, 0x02000800, 0x00080800, + 0x02080802, 0x02080000, 0x00000802, 0x02000800, + 0x00000002, 0x00000800, 0x00080800, 0x02080002, + 0x00000800, 0x02000802, 0x02080002, 0x00000000, + 0x00000000, 0x02080802, 0x02000800, 0x00080002, + 0x02080800, 0x00080000, 0x00000802, 0x02000800, + 0x02080002, 0x00000800, 0x00080800, 0x02000002, + 0x00080802, 0x00000002, 0x02000002, 0x02080000, + 0x02080802, 0x00080800, 0x02080000, 0x02000802, + 0x02000000, 0x00000802, 0x00080002, 0x00000000, + 0x00080000, 0x02000000, 0x02000802, 0x02080800, + 0x00000002, 0x02080002, 0x00000800, 0x00080802, + }, + { + 0x40108010, 0x00000000, 0x00108000, 0x40100000, + 0x40000010, 0x00008010, 0x40008000, 0x00108000, + 0x00008000, 0x40100010, 0x00000010, 0x40008000, + 0x00100010, 0x40108000, 0x40100000, 0x00000010, + 0x00100000, 0x40008010, 0x40100010, 0x00008000, + 0x00108010, 0x40000000, 0x00000000, 0x00100010, + 0x40008010, 0x00108010, 0x40108000, 0x40000010, + 0x40000000, 0x00100000, 0x00008010, 0x40108010, + 0x00100010, 0x40108000, 0x40008000, 0x00108010, + 0x40108010, 0x00100010, 0x40000010, 0x00000000, + 0x40000000, 0x00008010, 0x00100000, 0x40100010, + 0x00008000, 0x40000000, 0x00108010, 0x40008010, + 0x40108000, 0x00008000, 0x00000000, 0x40000010, + 0x00000010, 0x40108010, 0x00108000, 0x40100000, + 0x40100010, 0x00100000, 0x00008010, 0x40008000, + 0x40008010, 0x00000010, 0x40100000, 0x00108000, + }, + { + 0x04000001, 0x04040100, 0x00000100, 0x04000101, + 0x00040001, 0x04000000, 0x04000101, 0x00040100, + 0x04000100, 0x00040000, 0x04040000, 0x00000001, + 0x04040101, 0x00000101, 0x00000001, 0x04040001, + 0x00000000, 0x00040001, 0x04040100, 0x00000100, + 0x00000101, 0x04040101, 0x00040000, 0x04000001, + 0x04040001, 0x04000100, 0x00040101, 0x04040000, + 0x00040100, 0x00000000, 0x04000000, 0x00040101, + 0x04040100, 0x00000100, 0x00000001, 0x00040000, + 0x00000101, 0x00040001, 0x04040000, 0x04000101, + 0x00000000, 0x04040100, 0x00040100, 0x04040001, + 0x00040001, 0x04000000, 0x04040101, 0x00000001, + 0x00040101, 0x04000001, 0x04000000, 0x04040101, + 0x00040000, 0x04000100, 0x04000101, 0x00040100, + 0x04000100, 0x00000000, 0x04040001, 0x00000101, + 0x04000001, 0x00040101, 0x00000100, 0x04040000, + }, + { + 0x00401008, 0x10001000, 0x00000008, 0x10401008, + 0x00000000, 0x10400000, 0x10001008, 0x00400008, + 0x10401000, 0x10000008, 0x10000000, 0x00001008, + 0x10000008, 0x00401008, 0x00400000, 0x10000000, + 0x10400008, 0x00401000, 0x00001000, 0x00000008, + 0x00401000, 0x10001008, 0x10400000, 0x00001000, + 0x00001008, 0x00000000, 0x00400008, 0x10401000, + 0x10001000, 0x10400008, 0x10401008, 0x00400000, + 0x10400008, 0x00001008, 0x00400000, 0x10000008, + 0x00401000, 0x10001000, 0x00000008, 0x10400000, + 0x10001008, 0x00000000, 0x00001000, 0x00400008, + 0x00000000, 0x10400008, 0x10401000, 0x00001000, + 0x10000000, 0x10401008, 0x00401008, 0x00400000, + 0x10401008, 0x00000008, 0x10001000, 0x00401008, + 0x00400008, 0x00401000, 0x10400000, 0x10001008, + 0x00001008, 0x10000000, 0x10000008, 0x10401000, + }, + { + 0x08000000, 0x00010000, 0x00000400, 0x08010420, + 0x08010020, 0x08000400, 0x00010420, 0x08010000, + 0x00010000, 0x00000020, 0x08000020, 0x00010400, + 0x08000420, 0x08010020, 0x08010400, 0x00000000, + 0x00010400, 0x08000000, 0x00010020, 0x00000420, + 0x08000400, 0x00010420, 0x00000000, 0x08000020, + 0x00000020, 0x08000420, 0x08010420, 0x00010020, + 0x08010000, 0x00000400, 0x00000420, 0x08010400, + 0x08010400, 0x08000420, 0x00010020, 0x08010000, + 0x00010000, 0x00000020, 0x08000020, 0x08000400, + 0x08000000, 0x00010400, 0x08010420, 0x00000000, + 0x00010420, 0x08000000, 0x00000400, 0x00010020, + 0x08000420, 0x00000400, 0x00000000, 0x08010420, + 0x08010020, 0x08010400, 0x00000420, 0x00010000, + 0x00010400, 0x08010020, 0x08000400, 0x00000420, + 0x00000020, 0x00010420, 0x08010000, 0x08000020, + }, + { + 0x80000040, 0x00200040, 0x00000000, 0x80202000, + 0x00200040, 0x00002000, 0x80002040, 0x00200000, + 0x00002040, 0x80202040, 0x00202000, 0x80000000, + 0x80002000, 0x80000040, 0x80200000, 0x00202040, + 0x00200000, 0x80002040, 0x80200040, 0x00000000, + 0x00002000, 0x00000040, 0x80202000, 0x80200040, + 0x80202040, 0x80200000, 0x80000000, 0x00002040, + 0x00000040, 0x00202000, 0x00202040, 0x80002000, + 0x00002040, 0x80000000, 0x80002000, 0x00202040, + 0x80202000, 0x00200040, 0x00000000, 0x80002000, + 0x80000000, 0x00002000, 0x80200040, 0x00200000, + 0x00200040, 0x80202040, 0x00202000, 0x00000040, + 0x80202040, 0x00202000, 0x00200000, 0x80002040, + 0x80000040, 0x80200000, 0x00202040, 0x00000000, + 0x00002000, 0x80000040, 0x80002040, 0x80202000, + 0x80200000, 0x00002040, 0x00000040, 0x80200040, + }, + { + 0x00004000, 0x00000200, 0x01000200, 0x01000004, + 0x01004204, 0x00004004, 0x00004200, 0x00000000, + 0x01000000, 0x01000204, 0x00000204, 0x01004000, + 0x00000004, 0x01004200, 0x01004000, 0x00000204, + 0x01000204, 0x00004000, 0x00004004, 0x01004204, + 0x00000000, 0x01000200, 0x01000004, 0x00004200, + 0x01004004, 0x00004204, 0x01004200, 0x00000004, + 0x00004204, 0x01004004, 0x00000200, 0x01000000, + 0x00004204, 0x01004000, 0x01004004, 0x00000204, + 0x00004000, 0x00000200, 0x01000000, 0x01004004, + 0x01000204, 0x00004204, 0x00004200, 0x00000000, + 0x00000200, 0x01000004, 0x00000004, 0x01000200, + 0x00000000, 0x01000204, 0x01000200, 0x00004200, + 0x00000204, 0x00004000, 0x01004204, 0x01000000, + 0x01004200, 0x00000004, 0x00004004, 0x01004204, + 0x01000004, 0x01004200, 0x01004000, 0x00004004, + }, + { + 0x20800080, 0x20820000, 0x00020080, 0x00000000, + 0x20020000, 0x00800080, 0x20800000, 0x20820080, + 0x00000080, 0x20000000, 0x00820000, 0x00020080, + 0x00820080, 0x20020080, 0x20000080, 0x20800000, + 0x00020000, 0x00820080, 0x00800080, 0x20020000, + 0x20820080, 0x20000080, 0x00000000, 0x00820000, + 0x20000000, 0x00800000, 0x20020080, 0x20800080, + 0x00800000, 0x00020000, 0x20820000, 0x00000080, + 0x00800000, 0x00020000, 0x20000080, 0x20820080, + 0x00020080, 0x20000000, 0x00000000, 0x00820000, + 0x20800080, 0x20020080, 0x20020000, 0x00800080, + 0x20820000, 0x00000080, 0x00800080, 0x20020000, + 0x20820080, 0x00800000, 0x20800000, 0x20000080, + 0x00820000, 0x00020080, 0x20020080, 0x20800000, + 0x00000080, 0x20820000, 0x00820080, 0x00000000, + 0x20000000, 0x20800080, 0x00020000, 0x00820080, + } +}; + +CONSTANT_VK u32a c_skb[8][64] = +{ + { + 0x00000000, 0x00000010, 0x20000000, 0x20000010, + 0x00010000, 0x00010010, 0x20010000, 0x20010010, + 0x00000800, 0x00000810, 0x20000800, 0x20000810, + 0x00010800, 0x00010810, 0x20010800, 0x20010810, + 0x00000020, 0x00000030, 0x20000020, 0x20000030, + 0x00010020, 0x00010030, 0x20010020, 0x20010030, + 0x00000820, 0x00000830, 0x20000820, 0x20000830, + 0x00010820, 0x00010830, 0x20010820, 0x20010830, + 0x00080000, 0x00080010, 0x20080000, 0x20080010, + 0x00090000, 0x00090010, 0x20090000, 0x20090010, + 0x00080800, 0x00080810, 0x20080800, 0x20080810, + 0x00090800, 0x00090810, 0x20090800, 0x20090810, + 0x00080020, 0x00080030, 0x20080020, 0x20080030, + 0x00090020, 0x00090030, 0x20090020, 0x20090030, + 0x00080820, 0x00080830, 0x20080820, 0x20080830, + 0x00090820, 0x00090830, 0x20090820, 0x20090830, + }, + { + 0x00000000, 0x02000000, 0x00002000, 0x02002000, + 0x00200000, 0x02200000, 0x00202000, 0x02202000, + 0x00000004, 0x02000004, 0x00002004, 0x02002004, + 0x00200004, 0x02200004, 0x00202004, 0x02202004, + 0x00000400, 0x02000400, 0x00002400, 0x02002400, + 0x00200400, 0x02200400, 0x00202400, 0x02202400, + 0x00000404, 0x02000404, 0x00002404, 0x02002404, + 0x00200404, 0x02200404, 0x00202404, 0x02202404, + 0x10000000, 0x12000000, 0x10002000, 0x12002000, + 0x10200000, 0x12200000, 0x10202000, 0x12202000, + 0x10000004, 0x12000004, 0x10002004, 0x12002004, + 0x10200004, 0x12200004, 0x10202004, 0x12202004, + 0x10000400, 0x12000400, 0x10002400, 0x12002400, + 0x10200400, 0x12200400, 0x10202400, 0x12202400, + 0x10000404, 0x12000404, 0x10002404, 0x12002404, + 0x10200404, 0x12200404, 0x10202404, 0x12202404, + }, + { + 0x00000000, 0x00000001, 0x00040000, 0x00040001, + 0x01000000, 0x01000001, 0x01040000, 0x01040001, + 0x00000002, 0x00000003, 0x00040002, 0x00040003, + 0x01000002, 0x01000003, 0x01040002, 0x01040003, + 0x00000200, 0x00000201, 0x00040200, 0x00040201, + 0x01000200, 0x01000201, 0x01040200, 0x01040201, + 0x00000202, 0x00000203, 0x00040202, 0x00040203, + 0x01000202, 0x01000203, 0x01040202, 0x01040203, + 0x08000000, 0x08000001, 0x08040000, 0x08040001, + 0x09000000, 0x09000001, 0x09040000, 0x09040001, + 0x08000002, 0x08000003, 0x08040002, 0x08040003, + 0x09000002, 0x09000003, 0x09040002, 0x09040003, + 0x08000200, 0x08000201, 0x08040200, 0x08040201, + 0x09000200, 0x09000201, 0x09040200, 0x09040201, + 0x08000202, 0x08000203, 0x08040202, 0x08040203, + 0x09000202, 0x09000203, 0x09040202, 0x09040203, + }, + { + 0x00000000, 0x00100000, 0x00000100, 0x00100100, + 0x00000008, 0x00100008, 0x00000108, 0x00100108, + 0x00001000, 0x00101000, 0x00001100, 0x00101100, + 0x00001008, 0x00101008, 0x00001108, 0x00101108, + 0x04000000, 0x04100000, 0x04000100, 0x04100100, + 0x04000008, 0x04100008, 0x04000108, 0x04100108, + 0x04001000, 0x04101000, 0x04001100, 0x04101100, + 0x04001008, 0x04101008, 0x04001108, 0x04101108, + 0x00020000, 0x00120000, 0x00020100, 0x00120100, + 0x00020008, 0x00120008, 0x00020108, 0x00120108, + 0x00021000, 0x00121000, 0x00021100, 0x00121100, + 0x00021008, 0x00121008, 0x00021108, 0x00121108, + 0x04020000, 0x04120000, 0x04020100, 0x04120100, + 0x04020008, 0x04120008, 0x04020108, 0x04120108, + 0x04021000, 0x04121000, 0x04021100, 0x04121100, + 0x04021008, 0x04121008, 0x04021108, 0x04121108, + }, + { + 0x00000000, 0x10000000, 0x00010000, 0x10010000, + 0x00000004, 0x10000004, 0x00010004, 0x10010004, + 0x20000000, 0x30000000, 0x20010000, 0x30010000, + 0x20000004, 0x30000004, 0x20010004, 0x30010004, + 0x00100000, 0x10100000, 0x00110000, 0x10110000, + 0x00100004, 0x10100004, 0x00110004, 0x10110004, + 0x20100000, 0x30100000, 0x20110000, 0x30110000, + 0x20100004, 0x30100004, 0x20110004, 0x30110004, + 0x00001000, 0x10001000, 0x00011000, 0x10011000, + 0x00001004, 0x10001004, 0x00011004, 0x10011004, + 0x20001000, 0x30001000, 0x20011000, 0x30011000, + 0x20001004, 0x30001004, 0x20011004, 0x30011004, + 0x00101000, 0x10101000, 0x00111000, 0x10111000, + 0x00101004, 0x10101004, 0x00111004, 0x10111004, + 0x20101000, 0x30101000, 0x20111000, 0x30111000, + 0x20101004, 0x30101004, 0x20111004, 0x30111004, + }, + { + 0x00000000, 0x08000000, 0x00000008, 0x08000008, + 0x00000400, 0x08000400, 0x00000408, 0x08000408, + 0x00020000, 0x08020000, 0x00020008, 0x08020008, + 0x00020400, 0x08020400, 0x00020408, 0x08020408, + 0x00000001, 0x08000001, 0x00000009, 0x08000009, + 0x00000401, 0x08000401, 0x00000409, 0x08000409, + 0x00020001, 0x08020001, 0x00020009, 0x08020009, + 0x00020401, 0x08020401, 0x00020409, 0x08020409, + 0x02000000, 0x0A000000, 0x02000008, 0x0A000008, + 0x02000400, 0x0A000400, 0x02000408, 0x0A000408, + 0x02020000, 0x0A020000, 0x02020008, 0x0A020008, + 0x02020400, 0x0A020400, 0x02020408, 0x0A020408, + 0x02000001, 0x0A000001, 0x02000009, 0x0A000009, + 0x02000401, 0x0A000401, 0x02000409, 0x0A000409, + 0x02020001, 0x0A020001, 0x02020009, 0x0A020009, + 0x02020401, 0x0A020401, 0x02020409, 0x0A020409, + }, + { + 0x00000000, 0x00000100, 0x00080000, 0x00080100, + 0x01000000, 0x01000100, 0x01080000, 0x01080100, + 0x00000010, 0x00000110, 0x00080010, 0x00080110, + 0x01000010, 0x01000110, 0x01080010, 0x01080110, + 0x00200000, 0x00200100, 0x00280000, 0x00280100, + 0x01200000, 0x01200100, 0x01280000, 0x01280100, + 0x00200010, 0x00200110, 0x00280010, 0x00280110, + 0x01200010, 0x01200110, 0x01280010, 0x01280110, + 0x00000200, 0x00000300, 0x00080200, 0x00080300, + 0x01000200, 0x01000300, 0x01080200, 0x01080300, + 0x00000210, 0x00000310, 0x00080210, 0x00080310, + 0x01000210, 0x01000310, 0x01080210, 0x01080310, + 0x00200200, 0x00200300, 0x00280200, 0x00280300, + 0x01200200, 0x01200300, 0x01280200, 0x01280300, + 0x00200210, 0x00200310, 0x00280210, 0x00280310, + 0x01200210, 0x01200310, 0x01280210, 0x01280310, + }, + { + 0x00000000, 0x04000000, 0x00040000, 0x04040000, + 0x00000002, 0x04000002, 0x00040002, 0x04040002, + 0x00002000, 0x04002000, 0x00042000, 0x04042000, + 0x00002002, 0x04002002, 0x00042002, 0x04042002, + 0x00000020, 0x04000020, 0x00040020, 0x04040020, + 0x00000022, 0x04000022, 0x00040022, 0x04040022, + 0x00002020, 0x04002020, 0x00042020, 0x04042020, + 0x00002022, 0x04002022, 0x00042022, 0x04042022, + 0x00000800, 0x04000800, 0x00040800, 0x04040800, + 0x00000802, 0x04000802, 0x00040802, 0x04040802, + 0x00002800, 0x04002800, 0x00042800, 0x04042800, + 0x00002802, 0x04002802, 0x00042802, 0x04042802, + 0x00000820, 0x04000820, 0x00040820, 0x04040820, + 0x00000822, 0x04000822, 0x00040822, 0x04040822, + 0x00002820, 0x04002820, 0x00042820, 0x04042820, + 0x00002822, 0x04002822, 0x00042822, 0x04042822 + } +}; + +#if VECT_SIZE == 1 +#define BOX(i,n,S) (S)[(n)][(i)] +#elif VECT_SIZE == 2 +#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1]) +#elif VECT_SIZE == 4 +#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3]) +#elif VECT_SIZE == 8 +#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7]) +#elif VECT_SIZE == 16 +#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7], (S)[(n)][(i).s8], (S)[(n)][(i).s9], (S)[(n)][(i).sa], (S)[(n)][(i).sb], (S)[(n)][(i).sc], (S)[(n)][(i).sd], (S)[(n)][(i).se], (S)[(n)][(i).sf]) +#endif + +DECLSPEC void _des_crypt_encrypt (u32 *iv, u32 *data, u32 *Kc, u32 *Kd, SHM_TYPE u32 (*s_SPtrans)[64]) +{ + u32 r = data[0]; + u32 l = data[1]; + + #ifdef _unroll + #pragma unroll + #endif + for (u32 i = 0; i < 16; i += 2) + { + u32 u; + u32 t; + + u = Kc[i + 0] ^ hc_rotl32 (r, 30u); + t = Kd[i + 0] ^ hc_rotl32 (r, 26u); + + l ^= BOX (((u >> 0) & 0x3f), 0, s_SPtrans) + | BOX (((u >> 8) & 0x3f), 2, s_SPtrans) + | BOX (((u >> 16) & 0x3f), 4, s_SPtrans) + | BOX (((u >> 24) & 0x3f), 6, s_SPtrans) + | BOX (((t >> 0) & 0x3f), 1, s_SPtrans) + | BOX (((t >> 8) & 0x3f), 3, s_SPtrans) + | BOX (((t >> 16) & 0x3f), 5, s_SPtrans) + | BOX (((t >> 24) & 0x3f), 7, s_SPtrans); + + u = Kc[i + 1] ^ hc_rotl32 (l, 30u); + t = Kd[i + 1] ^ hc_rotl32 (l, 26u); + + r ^= BOX (((u >> 0) & 0x3f), 0, s_SPtrans) + | BOX (((u >> 8) & 0x3f), 2, s_SPtrans) + | BOX (((u >> 16) & 0x3f), 4, s_SPtrans) + | BOX (((u >> 24) & 0x3f), 6, s_SPtrans) + | BOX (((t >> 0) & 0x3f), 1, s_SPtrans) + | BOX (((t >> 8) & 0x3f), 3, s_SPtrans) + | BOX (((t >> 16) & 0x3f), 5, s_SPtrans) + | BOX (((t >> 24) & 0x3f), 7, s_SPtrans); + } + + iv[0] = l; + iv[1] = r; +} + +DECLSPEC void _des_crypt_keysetup (u32 c, u32 d, u32 *Kc, u32 *Kd, SHM_TYPE u32 (*s_skb)[64]) +{ + u32 tt; + + PERM_OP (d, c, tt, 4, 0x0f0f0f0f); + HPERM_OP (c, tt, 2, 0xcccc0000); + HPERM_OP (d, tt, 2, 0xcccc0000); + PERM_OP (d, c, tt, 1, 0x55555555); + PERM_OP (c, d, tt, 8, 0x00ff00ff); + PERM_OP (d, c, tt, 1, 0x55555555); + + d = ((d & 0x000000ff) << 16) + | ((d & 0x0000ff00) << 0) + | ((d & 0x00ff0000) >> 16) + | ((c & 0xf0000000) >> 4); + + c = c & 0x0fffffff; + + #ifdef _unroll + #pragma unroll + #endif + for (u32 i = 0; i < 16; i++) + { + if ((i < 2) || (i == 8) || (i == 15)) + { + c = ((c >> 1) | (c << 27)); + d = ((d >> 1) | (d << 27)); + } + else + { + c = ((c >> 2) | (c << 26)); + d = ((d >> 2) | (d << 26)); + } + + c = c & 0x0fffffff; + d = d & 0x0fffffff; + + const u32 c00 = (c >> 0) & 0x0000003f; + const u32 c06 = (c >> 6) & 0x00383003; + const u32 c07 = (c >> 7) & 0x0000003c; + const u32 c13 = (c >> 13) & 0x0000060f; + const u32 c20 = (c >> 20) & 0x00000001; + + u32 s = BOX (((c00 >> 0) & 0xff), 0, s_skb) + | BOX (((c06 >> 0) & 0xff) + |((c07 >> 0) & 0xff), 1, s_skb) + | BOX (((c13 >> 0) & 0xff) + |((c06 >> 8) & 0xff), 2, s_skb) + | BOX (((c20 >> 0) & 0xff) + |((c13 >> 8) & 0xff) + |((c06 >> 16) & 0xff), 3, s_skb); + + const u32 d00 = (d >> 0) & 0x00003c3f; + const u32 d07 = (d >> 7) & 0x00003f03; + const u32 d21 = (d >> 21) & 0x0000000f; + const u32 d22 = (d >> 22) & 0x00000030; + + u32 t = BOX (((d00 >> 0) & 0xff), 4, s_skb) + | BOX (((d07 >> 0) & 0xff) + |((d00 >> 8) & 0xff), 5, s_skb) + | BOX (((d07 >> 8) & 0xff), 6, s_skb) + | BOX (((d21 >> 0) & 0xff) + |((d22 >> 0) & 0xff), 7, s_skb); + + Kc[i] = ((t << 16) | (s & 0x0000ffff)); + Kd[i] = ((s >> 16) | (t & 0xffff0000)); + } +} + +DECLSPEC void transform_netntlmv1_key (const u32 w0, const u32 w1, u32 *out) +{ + u32 t[8]; + + t[0] = (w0 >> 0) & 0xff; + t[1] = (w0 >> 8) & 0xff; + t[2] = (w0 >> 16) & 0xff; + t[3] = (w0 >> 24) & 0xff; + t[4] = (w1 >> 0) & 0xff; + t[5] = (w1 >> 8) & 0xff; + t[6] = (w1 >> 16) & 0xff; + t[7] = (w1 >> 24) & 0xff; + + u32 k[8]; + + k[0] = (t[0] >> 0); + k[1] = (t[0] << 7) | (t[1] >> 1); + k[2] = (t[1] << 6) | (t[2] >> 2); + k[3] = (t[2] << 5) | (t[3] >> 3); + k[4] = (t[3] << 4) | (t[4] >> 4); + k[5] = (t[4] << 3) | (t[5] >> 5); + k[6] = (t[5] << 2) | (t[6] >> 6); + k[7] = (t[6] << 1); + + out[0] = ((k[0] & 0xff) << 0) + | ((k[1] & 0xff) << 8) + | ((k[2] & 0xff) << 16) + | ((k[3] & 0xff) << 24); + + out[1] = ((k[4] & 0xff) << 0) + | ((k[5] & 0xff) << 8) + | ((k[6] & 0xff) << 16) + | ((k[7] & 0xff) << 24); +} + +typedef struct netntlm +{ + u32 user_len; + u32 domain_len; + u32 srvchall_len; + u32 clichall_len; + + u32 userdomain_buf[64]; + u32 chall_buf[256]; + +} netntlm_t; + +typedef struct netntlm_tmp +{ + u32 digest_buf[4]; + +} netntlm_tmp_t; + +KERNEL_FQ void m27000_init (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); + + if (gid >= gid_max) return; + + /** + * salt + */ + + tmps[gid].digest_buf[0] = pws[gid].i[ 0]; + tmps[gid].digest_buf[1] = pws[gid].i[ 1]; + tmps[gid].digest_buf[2] = pws[gid].i[ 2]; + tmps[gid].digest_buf[3] = pws[gid].i[ 3]; + +} + +KERNEL_FQ void m27000_loop (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) +{ + + /** + * modifier + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + /** + * sbox, kbox + */ + + #ifdef REAL_SHM + + LOCAL_VK u32 s_SPtrans[8][64]; + LOCAL_VK u32 s_skb[8][64]; + + for (u32 i = lid; i < 64; i += lsz) + { + s_SPtrans[0][i] = c_SPtrans[0][i]; + s_SPtrans[1][i] = c_SPtrans[1][i]; + s_SPtrans[2][i] = c_SPtrans[2][i]; + s_SPtrans[3][i] = c_SPtrans[3][i]; + s_SPtrans[4][i] = c_SPtrans[4][i]; + s_SPtrans[5][i] = c_SPtrans[5][i]; + s_SPtrans[6][i] = c_SPtrans[6][i]; + s_SPtrans[7][i] = c_SPtrans[7][i]; + + s_skb[0][i] = c_skb[0][i]; + s_skb[1][i] = c_skb[1][i]; + s_skb[2][i] = c_skb[2][i]; + s_skb[3][i] = c_skb[3][i]; + s_skb[4][i] = c_skb[4][i]; + s_skb[5][i] = c_skb[5][i]; + s_skb[6][i] = c_skb[6][i]; + s_skb[7][i] = c_skb[7][i]; + } + + SYNC_THREADS (); + + #else + + CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; + CONSTANT_AS u32a (*s_skb)[64] = c_skb; + + #endif + + /** + * base + */ + + const u32 s0 = salt_bufs[SALT_POS].salt_buf[0]; + const u32 s1 = salt_bufs[SALT_POS].salt_buf[1]; + const u32 s2 = salt_bufs[SALT_POS].salt_buf[2]; + + const u32 a = tmps[gid].digest_buf[0]; + const u32 b = tmps[gid].digest_buf[1]; + const u32 c = tmps[gid].digest_buf[2]; + const u32 d = tmps[gid].digest_buf[3]; + + /** + * loop + */ + + for (u32 i = 0; i < loop_cnt; i++) + { + + // if ((d >> 16) != s2) continue; + + /** + * DES1 + */ + + u32 key[2]; + + transform_netntlmv1_key (a, b, key); + + u32 Kc[16]; + u32 Kd[16]; + + _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); + + u32 data[2]; + + data[0] = s0; + data[1] = s1; + + u32 out1[2]; + + _des_crypt_encrypt (out1, data, Kc, Kd, s_SPtrans); + + /** + * DES2 + */ + + transform_netntlmv1_key (((b >> 24) | (c << 8)), ((c >> 24) | (d << 8)), key); + + _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); + + u32 out2[2]; + + _des_crypt_encrypt (out2, data, Kc, Kd, s_SPtrans); + + + tmps[gid].digest_buf[0] = out1[0]; + tmps[gid].digest_buf[1] = out1[1]; + tmps[gid].digest_buf[2] = out2[0]; + tmps[gid].digest_buf[3] = out2[1]; + } +} + +KERNEL_FQ void m27000_comp (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + const u64 lid = get_local_id (0); + + /** + * digest + */ + + const u32 r0 = tmps[gid].digest_buf[0]; + const u32 r1 = tmps[gid].digest_buf[1]; + const u32 r2 = tmps[gid].digest_buf[2]; + const u32 r3 = tmps[gid].digest_buf[3]; + + #define il_pos 0 + + #ifdef KERNEL_STATIC + #include COMPARE_M + #endif +} \ No newline at end of file diff --git a/src/modules/module_27000.c b/src/modules/module_27000.c index 6467cfe9c..01c5d045c 100644 --- a/src/modules/module_27000.c +++ b/src/modules/module_27000.c @@ -12,7 +12,7 @@ #include "emu_inc_cipher_des.h" #include "emu_inc_hash_md5.h" -static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; static const u32 DGST_POS0 = 0; static const u32 DGST_POS1 = 1; static const u32 DGST_POS2 = 2; @@ -44,6 +44,12 @@ typedef struct netntlm } netntlm_t; +typedef struct netntlm_tmp +{ + u32 digest_buf[4]; + +} netntlm_tmp_t; + u32 module_attack_exec (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 ATTACK_EXEC; } u32 module_dgst_pos0 (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 DGST_POS0; } u32 module_dgst_pos1 (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 DGST_POS1; } @@ -59,6 +65,13 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u64 tmp_size = (const u64) sizeof (netntlm_tmp_t); + + return tmp_size; +} + static void transform_netntlmv1_key (const u8 *nthash, u8 *key) { key[0] = (nthash[0] >> 0); @@ -321,6 +334,9 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE salt->salt_buf[0] = rotl32 (salt->salt_buf[0], 3); salt->salt_buf[1] = rotl32 (salt->salt_buf[1], 3); + // Why my _loop wasnt being called and what was causing me such confusion :D + salt->salt_iter = 1; + return (PARSER_OK); } @@ -487,7 +503,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_separator = MODULE_DEFAULT; module_ctx->module_st_hash = module_st_hash; module_ctx->module_st_pass = module_st_pass; - module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_tmp_size = module_tmp_size; module_ctx->module_unstable_warning = MODULE_DEFAULT; module_ctx->module_warmup_disable = MODULE_DEFAULT; } From 431f6ec80e4a8707f0a7c3997a89bdab07e1165a Mon Sep 17 00:00:00 2001 From: Cablethief Date: Thu, 15 Jul 2021 16:43:48 +0200 Subject: [PATCH 09/64] remove fast hash 27000 --- OpenCL/m27000_a0-optimized.cl | 779 --------------------------------- OpenCL/m27000_a0-pure.cl | 757 -------------------------------- OpenCL/m27000_a3-pure.cl | 803 ---------------------------------- 3 files changed, 2339 deletions(-) delete mode 100644 OpenCL/m27000_a0-optimized.cl delete mode 100644 OpenCL/m27000_a0-pure.cl delete mode 100644 OpenCL/m27000_a3-pure.cl diff --git a/OpenCL/m27000_a0-optimized.cl b/OpenCL/m27000_a0-optimized.cl deleted file mode 100644 index 77d86e001..000000000 --- a/OpenCL/m27000_a0-optimized.cl +++ /dev/null @@ -1,779 +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_rp_optimized.h" -#include "inc_rp_optimized.cl" -#include "inc_simd.cl" -#include "inc_hash_md4.cl" -#endif - -typedef struct netntlm -{ - u32 user_len; - u32 domain_len; - u32 srvchall_len; - u32 clichall_len; - - u32 userdomain_buf[64]; - u32 chall_buf[256]; - -} netntlm_t; - -#define PERM_OP(a,b,tt,n,m) \ -{ \ - tt = a >> n; \ - tt = tt ^ b; \ - tt = tt & m; \ - b = b ^ tt; \ - tt = tt << n; \ - a = a ^ tt; \ -} - -#define HPERM_OP(a,tt,n,m) \ -{ \ - tt = a << (16 + n); \ - tt = tt ^ a; \ - tt = tt & m; \ - a = a ^ tt; \ - tt = tt >> (16 + n); \ - a = a ^ tt; \ -} - -CONSTANT_VK u32a c_SPtrans[8][64] = -{ - { - 0x02080800, 0x00080000, 0x02000002, 0x02080802, - 0x02000000, 0x00080802, 0x00080002, 0x02000002, - 0x00080802, 0x02080800, 0x02080000, 0x00000802, - 0x02000802, 0x02000000, 0x00000000, 0x00080002, - 0x00080000, 0x00000002, 0x02000800, 0x00080800, - 0x02080802, 0x02080000, 0x00000802, 0x02000800, - 0x00000002, 0x00000800, 0x00080800, 0x02080002, - 0x00000800, 0x02000802, 0x02080002, 0x00000000, - 0x00000000, 0x02080802, 0x02000800, 0x00080002, - 0x02080800, 0x00080000, 0x00000802, 0x02000800, - 0x02080002, 0x00000800, 0x00080800, 0x02000002, - 0x00080802, 0x00000002, 0x02000002, 0x02080000, - 0x02080802, 0x00080800, 0x02080000, 0x02000802, - 0x02000000, 0x00000802, 0x00080002, 0x00000000, - 0x00080000, 0x02000000, 0x02000802, 0x02080800, - 0x00000002, 0x02080002, 0x00000800, 0x00080802, - }, - { - 0x40108010, 0x00000000, 0x00108000, 0x40100000, - 0x40000010, 0x00008010, 0x40008000, 0x00108000, - 0x00008000, 0x40100010, 0x00000010, 0x40008000, - 0x00100010, 0x40108000, 0x40100000, 0x00000010, - 0x00100000, 0x40008010, 0x40100010, 0x00008000, - 0x00108010, 0x40000000, 0x00000000, 0x00100010, - 0x40008010, 0x00108010, 0x40108000, 0x40000010, - 0x40000000, 0x00100000, 0x00008010, 0x40108010, - 0x00100010, 0x40108000, 0x40008000, 0x00108010, - 0x40108010, 0x00100010, 0x40000010, 0x00000000, - 0x40000000, 0x00008010, 0x00100000, 0x40100010, - 0x00008000, 0x40000000, 0x00108010, 0x40008010, - 0x40108000, 0x00008000, 0x00000000, 0x40000010, - 0x00000010, 0x40108010, 0x00108000, 0x40100000, - 0x40100010, 0x00100000, 0x00008010, 0x40008000, - 0x40008010, 0x00000010, 0x40100000, 0x00108000, - }, - { - 0x04000001, 0x04040100, 0x00000100, 0x04000101, - 0x00040001, 0x04000000, 0x04000101, 0x00040100, - 0x04000100, 0x00040000, 0x04040000, 0x00000001, - 0x04040101, 0x00000101, 0x00000001, 0x04040001, - 0x00000000, 0x00040001, 0x04040100, 0x00000100, - 0x00000101, 0x04040101, 0x00040000, 0x04000001, - 0x04040001, 0x04000100, 0x00040101, 0x04040000, - 0x00040100, 0x00000000, 0x04000000, 0x00040101, - 0x04040100, 0x00000100, 0x00000001, 0x00040000, - 0x00000101, 0x00040001, 0x04040000, 0x04000101, - 0x00000000, 0x04040100, 0x00040100, 0x04040001, - 0x00040001, 0x04000000, 0x04040101, 0x00000001, - 0x00040101, 0x04000001, 0x04000000, 0x04040101, - 0x00040000, 0x04000100, 0x04000101, 0x00040100, - 0x04000100, 0x00000000, 0x04040001, 0x00000101, - 0x04000001, 0x00040101, 0x00000100, 0x04040000, - }, - { - 0x00401008, 0x10001000, 0x00000008, 0x10401008, - 0x00000000, 0x10400000, 0x10001008, 0x00400008, - 0x10401000, 0x10000008, 0x10000000, 0x00001008, - 0x10000008, 0x00401008, 0x00400000, 0x10000000, - 0x10400008, 0x00401000, 0x00001000, 0x00000008, - 0x00401000, 0x10001008, 0x10400000, 0x00001000, - 0x00001008, 0x00000000, 0x00400008, 0x10401000, - 0x10001000, 0x10400008, 0x10401008, 0x00400000, - 0x10400008, 0x00001008, 0x00400000, 0x10000008, - 0x00401000, 0x10001000, 0x00000008, 0x10400000, - 0x10001008, 0x00000000, 0x00001000, 0x00400008, - 0x00000000, 0x10400008, 0x10401000, 0x00001000, - 0x10000000, 0x10401008, 0x00401008, 0x00400000, - 0x10401008, 0x00000008, 0x10001000, 0x00401008, - 0x00400008, 0x00401000, 0x10400000, 0x10001008, - 0x00001008, 0x10000000, 0x10000008, 0x10401000, - }, - { - 0x08000000, 0x00010000, 0x00000400, 0x08010420, - 0x08010020, 0x08000400, 0x00010420, 0x08010000, - 0x00010000, 0x00000020, 0x08000020, 0x00010400, - 0x08000420, 0x08010020, 0x08010400, 0x00000000, - 0x00010400, 0x08000000, 0x00010020, 0x00000420, - 0x08000400, 0x00010420, 0x00000000, 0x08000020, - 0x00000020, 0x08000420, 0x08010420, 0x00010020, - 0x08010000, 0x00000400, 0x00000420, 0x08010400, - 0x08010400, 0x08000420, 0x00010020, 0x08010000, - 0x00010000, 0x00000020, 0x08000020, 0x08000400, - 0x08000000, 0x00010400, 0x08010420, 0x00000000, - 0x00010420, 0x08000000, 0x00000400, 0x00010020, - 0x08000420, 0x00000400, 0x00000000, 0x08010420, - 0x08010020, 0x08010400, 0x00000420, 0x00010000, - 0x00010400, 0x08010020, 0x08000400, 0x00000420, - 0x00000020, 0x00010420, 0x08010000, 0x08000020, - }, - { - 0x80000040, 0x00200040, 0x00000000, 0x80202000, - 0x00200040, 0x00002000, 0x80002040, 0x00200000, - 0x00002040, 0x80202040, 0x00202000, 0x80000000, - 0x80002000, 0x80000040, 0x80200000, 0x00202040, - 0x00200000, 0x80002040, 0x80200040, 0x00000000, - 0x00002000, 0x00000040, 0x80202000, 0x80200040, - 0x80202040, 0x80200000, 0x80000000, 0x00002040, - 0x00000040, 0x00202000, 0x00202040, 0x80002000, - 0x00002040, 0x80000000, 0x80002000, 0x00202040, - 0x80202000, 0x00200040, 0x00000000, 0x80002000, - 0x80000000, 0x00002000, 0x80200040, 0x00200000, - 0x00200040, 0x80202040, 0x00202000, 0x00000040, - 0x80202040, 0x00202000, 0x00200000, 0x80002040, - 0x80000040, 0x80200000, 0x00202040, 0x00000000, - 0x00002000, 0x80000040, 0x80002040, 0x80202000, - 0x80200000, 0x00002040, 0x00000040, 0x80200040, - }, - { - 0x00004000, 0x00000200, 0x01000200, 0x01000004, - 0x01004204, 0x00004004, 0x00004200, 0x00000000, - 0x01000000, 0x01000204, 0x00000204, 0x01004000, - 0x00000004, 0x01004200, 0x01004000, 0x00000204, - 0x01000204, 0x00004000, 0x00004004, 0x01004204, - 0x00000000, 0x01000200, 0x01000004, 0x00004200, - 0x01004004, 0x00004204, 0x01004200, 0x00000004, - 0x00004204, 0x01004004, 0x00000200, 0x01000000, - 0x00004204, 0x01004000, 0x01004004, 0x00000204, - 0x00004000, 0x00000200, 0x01000000, 0x01004004, - 0x01000204, 0x00004204, 0x00004200, 0x00000000, - 0x00000200, 0x01000004, 0x00000004, 0x01000200, - 0x00000000, 0x01000204, 0x01000200, 0x00004200, - 0x00000204, 0x00004000, 0x01004204, 0x01000000, - 0x01004200, 0x00000004, 0x00004004, 0x01004204, - 0x01000004, 0x01004200, 0x01004000, 0x00004004, - }, - { - 0x20800080, 0x20820000, 0x00020080, 0x00000000, - 0x20020000, 0x00800080, 0x20800000, 0x20820080, - 0x00000080, 0x20000000, 0x00820000, 0x00020080, - 0x00820080, 0x20020080, 0x20000080, 0x20800000, - 0x00020000, 0x00820080, 0x00800080, 0x20020000, - 0x20820080, 0x20000080, 0x00000000, 0x00820000, - 0x20000000, 0x00800000, 0x20020080, 0x20800080, - 0x00800000, 0x00020000, 0x20820000, 0x00000080, - 0x00800000, 0x00020000, 0x20000080, 0x20820080, - 0x00020080, 0x20000000, 0x00000000, 0x00820000, - 0x20800080, 0x20020080, 0x20020000, 0x00800080, - 0x20820000, 0x00000080, 0x00800080, 0x20020000, - 0x20820080, 0x00800000, 0x20800000, 0x20000080, - 0x00820000, 0x00020080, 0x20020080, 0x20800000, - 0x00000080, 0x20820000, 0x00820080, 0x00000000, - 0x20000000, 0x20800080, 0x00020000, 0x00820080, - } -}; - -CONSTANT_VK u32a c_skb[8][64] = -{ - { - 0x00000000, 0x00000010, 0x20000000, 0x20000010, - 0x00010000, 0x00010010, 0x20010000, 0x20010010, - 0x00000800, 0x00000810, 0x20000800, 0x20000810, - 0x00010800, 0x00010810, 0x20010800, 0x20010810, - 0x00000020, 0x00000030, 0x20000020, 0x20000030, - 0x00010020, 0x00010030, 0x20010020, 0x20010030, - 0x00000820, 0x00000830, 0x20000820, 0x20000830, - 0x00010820, 0x00010830, 0x20010820, 0x20010830, - 0x00080000, 0x00080010, 0x20080000, 0x20080010, - 0x00090000, 0x00090010, 0x20090000, 0x20090010, - 0x00080800, 0x00080810, 0x20080800, 0x20080810, - 0x00090800, 0x00090810, 0x20090800, 0x20090810, - 0x00080020, 0x00080030, 0x20080020, 0x20080030, - 0x00090020, 0x00090030, 0x20090020, 0x20090030, - 0x00080820, 0x00080830, 0x20080820, 0x20080830, - 0x00090820, 0x00090830, 0x20090820, 0x20090830, - }, - { - 0x00000000, 0x02000000, 0x00002000, 0x02002000, - 0x00200000, 0x02200000, 0x00202000, 0x02202000, - 0x00000004, 0x02000004, 0x00002004, 0x02002004, - 0x00200004, 0x02200004, 0x00202004, 0x02202004, - 0x00000400, 0x02000400, 0x00002400, 0x02002400, - 0x00200400, 0x02200400, 0x00202400, 0x02202400, - 0x00000404, 0x02000404, 0x00002404, 0x02002404, - 0x00200404, 0x02200404, 0x00202404, 0x02202404, - 0x10000000, 0x12000000, 0x10002000, 0x12002000, - 0x10200000, 0x12200000, 0x10202000, 0x12202000, - 0x10000004, 0x12000004, 0x10002004, 0x12002004, - 0x10200004, 0x12200004, 0x10202004, 0x12202004, - 0x10000400, 0x12000400, 0x10002400, 0x12002400, - 0x10200400, 0x12200400, 0x10202400, 0x12202400, - 0x10000404, 0x12000404, 0x10002404, 0x12002404, - 0x10200404, 0x12200404, 0x10202404, 0x12202404, - }, - { - 0x00000000, 0x00000001, 0x00040000, 0x00040001, - 0x01000000, 0x01000001, 0x01040000, 0x01040001, - 0x00000002, 0x00000003, 0x00040002, 0x00040003, - 0x01000002, 0x01000003, 0x01040002, 0x01040003, - 0x00000200, 0x00000201, 0x00040200, 0x00040201, - 0x01000200, 0x01000201, 0x01040200, 0x01040201, - 0x00000202, 0x00000203, 0x00040202, 0x00040203, - 0x01000202, 0x01000203, 0x01040202, 0x01040203, - 0x08000000, 0x08000001, 0x08040000, 0x08040001, - 0x09000000, 0x09000001, 0x09040000, 0x09040001, - 0x08000002, 0x08000003, 0x08040002, 0x08040003, - 0x09000002, 0x09000003, 0x09040002, 0x09040003, - 0x08000200, 0x08000201, 0x08040200, 0x08040201, - 0x09000200, 0x09000201, 0x09040200, 0x09040201, - 0x08000202, 0x08000203, 0x08040202, 0x08040203, - 0x09000202, 0x09000203, 0x09040202, 0x09040203, - }, - { - 0x00000000, 0x00100000, 0x00000100, 0x00100100, - 0x00000008, 0x00100008, 0x00000108, 0x00100108, - 0x00001000, 0x00101000, 0x00001100, 0x00101100, - 0x00001008, 0x00101008, 0x00001108, 0x00101108, - 0x04000000, 0x04100000, 0x04000100, 0x04100100, - 0x04000008, 0x04100008, 0x04000108, 0x04100108, - 0x04001000, 0x04101000, 0x04001100, 0x04101100, - 0x04001008, 0x04101008, 0x04001108, 0x04101108, - 0x00020000, 0x00120000, 0x00020100, 0x00120100, - 0x00020008, 0x00120008, 0x00020108, 0x00120108, - 0x00021000, 0x00121000, 0x00021100, 0x00121100, - 0x00021008, 0x00121008, 0x00021108, 0x00121108, - 0x04020000, 0x04120000, 0x04020100, 0x04120100, - 0x04020008, 0x04120008, 0x04020108, 0x04120108, - 0x04021000, 0x04121000, 0x04021100, 0x04121100, - 0x04021008, 0x04121008, 0x04021108, 0x04121108, - }, - { - 0x00000000, 0x10000000, 0x00010000, 0x10010000, - 0x00000004, 0x10000004, 0x00010004, 0x10010004, - 0x20000000, 0x30000000, 0x20010000, 0x30010000, - 0x20000004, 0x30000004, 0x20010004, 0x30010004, - 0x00100000, 0x10100000, 0x00110000, 0x10110000, - 0x00100004, 0x10100004, 0x00110004, 0x10110004, - 0x20100000, 0x30100000, 0x20110000, 0x30110000, - 0x20100004, 0x30100004, 0x20110004, 0x30110004, - 0x00001000, 0x10001000, 0x00011000, 0x10011000, - 0x00001004, 0x10001004, 0x00011004, 0x10011004, - 0x20001000, 0x30001000, 0x20011000, 0x30011000, - 0x20001004, 0x30001004, 0x20011004, 0x30011004, - 0x00101000, 0x10101000, 0x00111000, 0x10111000, - 0x00101004, 0x10101004, 0x00111004, 0x10111004, - 0x20101000, 0x30101000, 0x20111000, 0x30111000, - 0x20101004, 0x30101004, 0x20111004, 0x30111004, - }, - { - 0x00000000, 0x08000000, 0x00000008, 0x08000008, - 0x00000400, 0x08000400, 0x00000408, 0x08000408, - 0x00020000, 0x08020000, 0x00020008, 0x08020008, - 0x00020400, 0x08020400, 0x00020408, 0x08020408, - 0x00000001, 0x08000001, 0x00000009, 0x08000009, - 0x00000401, 0x08000401, 0x00000409, 0x08000409, - 0x00020001, 0x08020001, 0x00020009, 0x08020009, - 0x00020401, 0x08020401, 0x00020409, 0x08020409, - 0x02000000, 0x0A000000, 0x02000008, 0x0A000008, - 0x02000400, 0x0A000400, 0x02000408, 0x0A000408, - 0x02020000, 0x0A020000, 0x02020008, 0x0A020008, - 0x02020400, 0x0A020400, 0x02020408, 0x0A020408, - 0x02000001, 0x0A000001, 0x02000009, 0x0A000009, - 0x02000401, 0x0A000401, 0x02000409, 0x0A000409, - 0x02020001, 0x0A020001, 0x02020009, 0x0A020009, - 0x02020401, 0x0A020401, 0x02020409, 0x0A020409, - }, - { - 0x00000000, 0x00000100, 0x00080000, 0x00080100, - 0x01000000, 0x01000100, 0x01080000, 0x01080100, - 0x00000010, 0x00000110, 0x00080010, 0x00080110, - 0x01000010, 0x01000110, 0x01080010, 0x01080110, - 0x00200000, 0x00200100, 0x00280000, 0x00280100, - 0x01200000, 0x01200100, 0x01280000, 0x01280100, - 0x00200010, 0x00200110, 0x00280010, 0x00280110, - 0x01200010, 0x01200110, 0x01280010, 0x01280110, - 0x00000200, 0x00000300, 0x00080200, 0x00080300, - 0x01000200, 0x01000300, 0x01080200, 0x01080300, - 0x00000210, 0x00000310, 0x00080210, 0x00080310, - 0x01000210, 0x01000310, 0x01080210, 0x01080310, - 0x00200200, 0x00200300, 0x00280200, 0x00280300, - 0x01200200, 0x01200300, 0x01280200, 0x01280300, - 0x00200210, 0x00200310, 0x00280210, 0x00280310, - 0x01200210, 0x01200310, 0x01280210, 0x01280310, - }, - { - 0x00000000, 0x04000000, 0x00040000, 0x04040000, - 0x00000002, 0x04000002, 0x00040002, 0x04040002, - 0x00002000, 0x04002000, 0x00042000, 0x04042000, - 0x00002002, 0x04002002, 0x00042002, 0x04042002, - 0x00000020, 0x04000020, 0x00040020, 0x04040020, - 0x00000022, 0x04000022, 0x00040022, 0x04040022, - 0x00002020, 0x04002020, 0x00042020, 0x04042020, - 0x00002022, 0x04002022, 0x00042022, 0x04042022, - 0x00000800, 0x04000800, 0x00040800, 0x04040800, - 0x00000802, 0x04000802, 0x00040802, 0x04040802, - 0x00002800, 0x04002800, 0x00042800, 0x04042800, - 0x00002802, 0x04002802, 0x00042802, 0x04042802, - 0x00000820, 0x04000820, 0x00040820, 0x04040820, - 0x00000822, 0x04000822, 0x00040822, 0x04040822, - 0x00002820, 0x04002820, 0x00042820, 0x04042820, - 0x00002822, 0x04002822, 0x00042822, 0x04042822 - } -}; - -#if VECT_SIZE == 1 -#define BOX(i,n,S) (S)[(n)][(i)] -#elif VECT_SIZE == 2 -#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1]) -#elif VECT_SIZE == 4 -#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3]) -#elif VECT_SIZE == 8 -#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7]) -#elif VECT_SIZE == 16 -#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7], (S)[(n)][(i).s8], (S)[(n)][(i).s9], (S)[(n)][(i).sa], (S)[(n)][(i).sb], (S)[(n)][(i).sc], (S)[(n)][(i).sd], (S)[(n)][(i).se], (S)[(n)][(i).sf]) -#endif - -DECLSPEC void _des_crypt_encrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64]) -{ - u32x r = data[0]; - u32x l = data[1]; - - #ifdef _unroll - #pragma unroll - #endif - for (u32 i = 0; i < 16; i += 2) - { - u32x u; - u32x t; - - u = Kc[i + 0] ^ hc_rotl32 (r, 30u); - t = Kd[i + 0] ^ hc_rotl32 (r, 26u); - - l ^= BOX (((u >> 0) & 0x3f), 0, s_SPtrans) - | BOX (((u >> 8) & 0x3f), 2, s_SPtrans) - | BOX (((u >> 16) & 0x3f), 4, s_SPtrans) - | BOX (((u >> 24) & 0x3f), 6, s_SPtrans) - | BOX (((t >> 0) & 0x3f), 1, s_SPtrans) - | BOX (((t >> 8) & 0x3f), 3, s_SPtrans) - | BOX (((t >> 16) & 0x3f), 5, s_SPtrans) - | BOX (((t >> 24) & 0x3f), 7, s_SPtrans); - - u = Kc[i + 1] ^ hc_rotl32 (l, 30u); - t = Kd[i + 1] ^ hc_rotl32 (l, 26u); - - r ^= BOX (((u >> 0) & 0x3f), 0, s_SPtrans) - | BOX (((u >> 8) & 0x3f), 2, s_SPtrans) - | BOX (((u >> 16) & 0x3f), 4, s_SPtrans) - | BOX (((u >> 24) & 0x3f), 6, s_SPtrans) - | BOX (((t >> 0) & 0x3f), 1, s_SPtrans) - | BOX (((t >> 8) & 0x3f), 3, s_SPtrans) - | BOX (((t >> 16) & 0x3f), 5, s_SPtrans) - | BOX (((t >> 24) & 0x3f), 7, s_SPtrans); - } - - iv[0] = l; - iv[1] = r; -} - -DECLSPEC void _des_crypt_keysetup (u32x c, u32x d, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_skb)[64]) -{ - u32x tt; - - PERM_OP (d, c, tt, 4, 0x0f0f0f0f); - HPERM_OP (c, tt, 2, 0xcccc0000); - HPERM_OP (d, tt, 2, 0xcccc0000); - PERM_OP (d, c, tt, 1, 0x55555555); - PERM_OP (c, d, tt, 8, 0x00ff00ff); - PERM_OP (d, c, tt, 1, 0x55555555); - - d = ((d & 0x000000ff) << 16) - | ((d & 0x0000ff00) << 0) - | ((d & 0x00ff0000) >> 16) - | ((c & 0xf0000000) >> 4); - - c = c & 0x0fffffff; - - #ifdef _unroll - #pragma unroll - #endif - for (u32 i = 0; i < 16; i++) - { - if ((i < 2) || (i == 8) || (i == 15)) - { - c = ((c >> 1) | (c << 27)); - d = ((d >> 1) | (d << 27)); - } - else - { - c = ((c >> 2) | (c << 26)); - d = ((d >> 2) | (d << 26)); - } - - c = c & 0x0fffffff; - d = d & 0x0fffffff; - - const u32x c00 = (c >> 0) & 0x0000003f; - const u32x c06 = (c >> 6) & 0x00383003; - const u32x c07 = (c >> 7) & 0x0000003c; - const u32x c13 = (c >> 13) & 0x0000060f; - const u32x c20 = (c >> 20) & 0x00000001; - - u32x s = BOX (((c00 >> 0) & 0xff), 0, s_skb) - | BOX (((c06 >> 0) & 0xff) - |((c07 >> 0) & 0xff), 1, s_skb) - | BOX (((c13 >> 0) & 0xff) - |((c06 >> 8) & 0xff), 2, s_skb) - | BOX (((c20 >> 0) & 0xff) - |((c13 >> 8) & 0xff) - |((c06 >> 16) & 0xff), 3, s_skb); - - const u32x d00 = (d >> 0) & 0x00003c3f; - const u32x d07 = (d >> 7) & 0x00003f03; - const u32x d21 = (d >> 21) & 0x0000000f; - const u32x d22 = (d >> 22) & 0x00000030; - - u32x t = BOX (((d00 >> 0) & 0xff), 4, s_skb) - | BOX (((d07 >> 0) & 0xff) - |((d00 >> 8) & 0xff), 5, s_skb) - | BOX (((d07 >> 8) & 0xff), 6, s_skb) - | BOX (((d21 >> 0) & 0xff) - |((d22 >> 0) & 0xff), 7, s_skb); - - Kc[i] = ((t << 16) | (s & 0x0000ffff)); - Kd[i] = ((s >> 16) | (t & 0xffff0000)); - } -} - -DECLSPEC void transform_netntlmv1_key (const u32x w0, const u32x w1, u32x *out) -{ - u32x t[8]; - - t[0] = (w0 >> 0) & 0xff; - t[1] = (w0 >> 8) & 0xff; - t[2] = (w0 >> 16) & 0xff; - t[3] = (w0 >> 24) & 0xff; - t[4] = (w1 >> 0) & 0xff; - t[5] = (w1 >> 8) & 0xff; - t[6] = (w1 >> 16) & 0xff; - t[7] = (w1 >> 24) & 0xff; - - u32x k[8]; - - k[0] = (t[0] >> 0); - k[1] = (t[0] << 7) | (t[1] >> 1); - k[2] = (t[1] << 6) | (t[2] >> 2); - k[3] = (t[2] << 5) | (t[3] >> 3); - k[4] = (t[3] << 4) | (t[4] >> 4); - k[5] = (t[4] << 3) | (t[5] >> 5); - k[6] = (t[5] << 2) | (t[6] >> 6); - k[7] = (t[6] << 1); - - out[0] = ((k[0] & 0xff) << 0) - | ((k[1] & 0xff) << 8) - | ((k[2] & 0xff) << 16) - | ((k[3] & 0xff) << 24); - - out[1] = ((k[4] & 0xff) << 0) - | ((k[5] & 0xff) << 8) - | ((k[6] & 0xff) << 16) - | ((k[7] & 0xff) << 24); -} - -KERNEL_FQ void m27000_m04 (KERN_ATTR_RULES ()) -{ - /** - * modifier - */ - - const u64 gid = get_global_id (0); - const u64 lid = get_local_id (0); - const u64 lsz = get_local_size (0); - - /** - * sbox, kbox - */ - - #ifdef REAL_SHM - - LOCAL_VK u32 s_SPtrans[8][64]; - LOCAL_VK u32 s_skb[8][64]; - - for (u32 i = lid; i < 64; i += lsz) - { - s_SPtrans[0][i] = c_SPtrans[0][i]; - s_SPtrans[1][i] = c_SPtrans[1][i]; - s_SPtrans[2][i] = c_SPtrans[2][i]; - s_SPtrans[3][i] = c_SPtrans[3][i]; - s_SPtrans[4][i] = c_SPtrans[4][i]; - s_SPtrans[5][i] = c_SPtrans[5][i]; - s_SPtrans[6][i] = c_SPtrans[6][i]; - s_SPtrans[7][i] = c_SPtrans[7][i]; - - s_skb[0][i] = c_skb[0][i]; - s_skb[1][i] = c_skb[1][i]; - s_skb[2][i] = c_skb[2][i]; - s_skb[3][i] = c_skb[3][i]; - s_skb[4][i] = c_skb[4][i]; - s_skb[5][i] = c_skb[5][i]; - s_skb[6][i] = c_skb[6][i]; - s_skb[7][i] = c_skb[7][i]; - } - - SYNC_THREADS (); - - #else - - CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; - CONSTANT_AS u32a (*s_skb)[64] = c_skb; - - #endif - - if (gid >= gid_max) return; - - /** - * base - */ - - /** - * salt - */ - - const u32 s0 = salt_bufs[SALT_POS].salt_buf[0]; - const u32 s1 = salt_bufs[SALT_POS].salt_buf[1]; - const u32 s2 = salt_bufs[SALT_POS].salt_buf[2]; - - u32 data[2]; - - data[0] = s0; - data[1] = s1; - - /** - * loop - */ - - for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE) - { - - u32x a = pws[gid].i[ 0]; - u32x b = pws[gid].i[ 1]; - u32x c = pws[gid].i[ 2]; - u32x d = pws[gid].i[ 3]; - - /** - * DES1 - */ - - u32x key[2]; - - transform_netntlmv1_key (a, b, key); - - u32x Kc[16]; - u32x Kd[16]; - - _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); - - u32x data[2]; - - data[0] = s0; - data[1] = s1; - - u32x iv1[2]; - - _des_crypt_encrypt (iv1, data, Kc, Kd, s_SPtrans); - - /** - * DES2 - */ - - transform_netntlmv1_key (((b >> 24) | (c << 8)), ((c >> 24) | (d << 8)), key); - - _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); - - u32x iv2[2]; - - _des_crypt_encrypt (iv2, data, Kc, Kd, s_SPtrans); - - /** - * compare - */ - - COMPARE_M_SIMD (iv1[0], iv1[1], iv2[0], iv2[1]); - } -} - -KERNEL_FQ void m27000_m08 (KERN_ATTR_RULES ()) -{ -} - -KERNEL_FQ void m27000_m16 (KERN_ATTR_RULES ()) -{ -} - -KERNEL_FQ void m27000_s04 (KERN_ATTR_RULES ()) -{ - /** - * modifier - */ - - const u64 gid = get_global_id (0); - const u64 lid = get_local_id (0); - const u64 lsz = get_local_size (0); - - /** - * sbox, kbox - */ - - #ifdef REAL_SHM - - LOCAL_VK u32 s_SPtrans[8][64]; - LOCAL_VK u32 s_skb[8][64]; - - for (u32 i = lid; i < 64; i += lsz) - { - s_SPtrans[0][i] = c_SPtrans[0][i]; - s_SPtrans[1][i] = c_SPtrans[1][i]; - s_SPtrans[2][i] = c_SPtrans[2][i]; - s_SPtrans[3][i] = c_SPtrans[3][i]; - s_SPtrans[4][i] = c_SPtrans[4][i]; - s_SPtrans[5][i] = c_SPtrans[5][i]; - s_SPtrans[6][i] = c_SPtrans[6][i]; - s_SPtrans[7][i] = c_SPtrans[7][i]; - - s_skb[0][i] = c_skb[0][i]; - s_skb[1][i] = c_skb[1][i]; - s_skb[2][i] = c_skb[2][i]; - s_skb[3][i] = c_skb[3][i]; - s_skb[4][i] = c_skb[4][i]; - s_skb[5][i] = c_skb[5][i]; - s_skb[6][i] = c_skb[6][i]; - s_skb[7][i] = c_skb[7][i]; - } - - SYNC_THREADS (); - - #else - - CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; - CONSTANT_AS u32a (*s_skb)[64] = c_skb; - - #endif - - if (gid >= gid_max) return; - - /** - * base - */ - - - - /** - * salt - */ - - const u32 s0 = salt_bufs[SALT_POS].salt_buf[0]; - const u32 s1 = salt_bufs[SALT_POS].salt_buf[1]; - const u32 s2 = salt_bufs[SALT_POS].salt_buf[2]; - - /** - * 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] - }; - - /** - * loop - */ - - for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE) - { - - u32x a = pws[gid].i[ 0]; - u32x b = pws[gid].i[ 1]; - u32x c = pws[gid].i[ 2]; - u32x d = pws[gid].i[ 3]; - - /** - * DES1 - */ - - u32x key[2]; - - transform_netntlmv1_key (a, b, key); - - u32x Kc[16]; - u32x Kd[16]; - - _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); - - u32x data[2]; - - data[0] = s0; - data[1] = s1; - - u32x iv1[2]; - - _des_crypt_encrypt (iv1, data, Kc, Kd, s_SPtrans); - - /** - * DES2 - */ - - /* - transform_netntlmv1_key (((b >> 24) | (c << 8)), ((c >> 24) | (d << 8)), key); - - _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); - - u32x iv2[2]; - - _des_crypt_encrypt (iv2, data, Kc, Kd, s_SPtrans); - */ - - u32x iv2[2]; - - iv2[0] = search[2]; - iv2[1] = search[3]; - - /** - * compare - */ - - COMPARE_S_SIMD (iv1[0], iv1[1], iv2[0], iv2[1]); - } -} - -KERNEL_FQ void m27000_s08 (KERN_ATTR_RULES ()) -{ -} - -KERNEL_FQ void m27000_s16 (KERN_ATTR_RULES ()) -{ -} diff --git a/OpenCL/m27000_a0-pure.cl b/OpenCL/m27000_a0-pure.cl deleted file mode 100644 index 0cc4580c0..000000000 --- a/OpenCL/m27000_a0-pure.cl +++ /dev/null @@ -1,757 +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_rp.h" -#include "inc_rp.cl" -#include "inc_scalar.cl" -#include "inc_hash_md4.cl" -#endif - -typedef struct netntlm -{ - u32 user_len; - u32 domain_len; - u32 srvchall_len; - u32 clichall_len; - - u32 userdomain_buf[64]; - u32 chall_buf[256]; - -} netntlm_t; - -#define PERM_OP(a,b,tt,n,m) \ -{ \ - tt = a >> n; \ - tt = tt ^ b; \ - tt = tt & m; \ - b = b ^ tt; \ - tt = tt << n; \ - a = a ^ tt; \ -} - -#define HPERM_OP(a,tt,n,m) \ -{ \ - tt = a << (16 + n); \ - tt = tt ^ a; \ - tt = tt & m; \ - a = a ^ tt; \ - tt = tt >> (16 + n); \ - a = a ^ tt; \ -} - -CONSTANT_VK u32a c_SPtrans[8][64] = -{ - { - 0x02080800, 0x00080000, 0x02000002, 0x02080802, - 0x02000000, 0x00080802, 0x00080002, 0x02000002, - 0x00080802, 0x02080800, 0x02080000, 0x00000802, - 0x02000802, 0x02000000, 0x00000000, 0x00080002, - 0x00080000, 0x00000002, 0x02000800, 0x00080800, - 0x02080802, 0x02080000, 0x00000802, 0x02000800, - 0x00000002, 0x00000800, 0x00080800, 0x02080002, - 0x00000800, 0x02000802, 0x02080002, 0x00000000, - 0x00000000, 0x02080802, 0x02000800, 0x00080002, - 0x02080800, 0x00080000, 0x00000802, 0x02000800, - 0x02080002, 0x00000800, 0x00080800, 0x02000002, - 0x00080802, 0x00000002, 0x02000002, 0x02080000, - 0x02080802, 0x00080800, 0x02080000, 0x02000802, - 0x02000000, 0x00000802, 0x00080002, 0x00000000, - 0x00080000, 0x02000000, 0x02000802, 0x02080800, - 0x00000002, 0x02080002, 0x00000800, 0x00080802, - }, - { - 0x40108010, 0x00000000, 0x00108000, 0x40100000, - 0x40000010, 0x00008010, 0x40008000, 0x00108000, - 0x00008000, 0x40100010, 0x00000010, 0x40008000, - 0x00100010, 0x40108000, 0x40100000, 0x00000010, - 0x00100000, 0x40008010, 0x40100010, 0x00008000, - 0x00108010, 0x40000000, 0x00000000, 0x00100010, - 0x40008010, 0x00108010, 0x40108000, 0x40000010, - 0x40000000, 0x00100000, 0x00008010, 0x40108010, - 0x00100010, 0x40108000, 0x40008000, 0x00108010, - 0x40108010, 0x00100010, 0x40000010, 0x00000000, - 0x40000000, 0x00008010, 0x00100000, 0x40100010, - 0x00008000, 0x40000000, 0x00108010, 0x40008010, - 0x40108000, 0x00008000, 0x00000000, 0x40000010, - 0x00000010, 0x40108010, 0x00108000, 0x40100000, - 0x40100010, 0x00100000, 0x00008010, 0x40008000, - 0x40008010, 0x00000010, 0x40100000, 0x00108000, - }, - { - 0x04000001, 0x04040100, 0x00000100, 0x04000101, - 0x00040001, 0x04000000, 0x04000101, 0x00040100, - 0x04000100, 0x00040000, 0x04040000, 0x00000001, - 0x04040101, 0x00000101, 0x00000001, 0x04040001, - 0x00000000, 0x00040001, 0x04040100, 0x00000100, - 0x00000101, 0x04040101, 0x00040000, 0x04000001, - 0x04040001, 0x04000100, 0x00040101, 0x04040000, - 0x00040100, 0x00000000, 0x04000000, 0x00040101, - 0x04040100, 0x00000100, 0x00000001, 0x00040000, - 0x00000101, 0x00040001, 0x04040000, 0x04000101, - 0x00000000, 0x04040100, 0x00040100, 0x04040001, - 0x00040001, 0x04000000, 0x04040101, 0x00000001, - 0x00040101, 0x04000001, 0x04000000, 0x04040101, - 0x00040000, 0x04000100, 0x04000101, 0x00040100, - 0x04000100, 0x00000000, 0x04040001, 0x00000101, - 0x04000001, 0x00040101, 0x00000100, 0x04040000, - }, - { - 0x00401008, 0x10001000, 0x00000008, 0x10401008, - 0x00000000, 0x10400000, 0x10001008, 0x00400008, - 0x10401000, 0x10000008, 0x10000000, 0x00001008, - 0x10000008, 0x00401008, 0x00400000, 0x10000000, - 0x10400008, 0x00401000, 0x00001000, 0x00000008, - 0x00401000, 0x10001008, 0x10400000, 0x00001000, - 0x00001008, 0x00000000, 0x00400008, 0x10401000, - 0x10001000, 0x10400008, 0x10401008, 0x00400000, - 0x10400008, 0x00001008, 0x00400000, 0x10000008, - 0x00401000, 0x10001000, 0x00000008, 0x10400000, - 0x10001008, 0x00000000, 0x00001000, 0x00400008, - 0x00000000, 0x10400008, 0x10401000, 0x00001000, - 0x10000000, 0x10401008, 0x00401008, 0x00400000, - 0x10401008, 0x00000008, 0x10001000, 0x00401008, - 0x00400008, 0x00401000, 0x10400000, 0x10001008, - 0x00001008, 0x10000000, 0x10000008, 0x10401000, - }, - { - 0x08000000, 0x00010000, 0x00000400, 0x08010420, - 0x08010020, 0x08000400, 0x00010420, 0x08010000, - 0x00010000, 0x00000020, 0x08000020, 0x00010400, - 0x08000420, 0x08010020, 0x08010400, 0x00000000, - 0x00010400, 0x08000000, 0x00010020, 0x00000420, - 0x08000400, 0x00010420, 0x00000000, 0x08000020, - 0x00000020, 0x08000420, 0x08010420, 0x00010020, - 0x08010000, 0x00000400, 0x00000420, 0x08010400, - 0x08010400, 0x08000420, 0x00010020, 0x08010000, - 0x00010000, 0x00000020, 0x08000020, 0x08000400, - 0x08000000, 0x00010400, 0x08010420, 0x00000000, - 0x00010420, 0x08000000, 0x00000400, 0x00010020, - 0x08000420, 0x00000400, 0x00000000, 0x08010420, - 0x08010020, 0x08010400, 0x00000420, 0x00010000, - 0x00010400, 0x08010020, 0x08000400, 0x00000420, - 0x00000020, 0x00010420, 0x08010000, 0x08000020, - }, - { - 0x80000040, 0x00200040, 0x00000000, 0x80202000, - 0x00200040, 0x00002000, 0x80002040, 0x00200000, - 0x00002040, 0x80202040, 0x00202000, 0x80000000, - 0x80002000, 0x80000040, 0x80200000, 0x00202040, - 0x00200000, 0x80002040, 0x80200040, 0x00000000, - 0x00002000, 0x00000040, 0x80202000, 0x80200040, - 0x80202040, 0x80200000, 0x80000000, 0x00002040, - 0x00000040, 0x00202000, 0x00202040, 0x80002000, - 0x00002040, 0x80000000, 0x80002000, 0x00202040, - 0x80202000, 0x00200040, 0x00000000, 0x80002000, - 0x80000000, 0x00002000, 0x80200040, 0x00200000, - 0x00200040, 0x80202040, 0x00202000, 0x00000040, - 0x80202040, 0x00202000, 0x00200000, 0x80002040, - 0x80000040, 0x80200000, 0x00202040, 0x00000000, - 0x00002000, 0x80000040, 0x80002040, 0x80202000, - 0x80200000, 0x00002040, 0x00000040, 0x80200040, - }, - { - 0x00004000, 0x00000200, 0x01000200, 0x01000004, - 0x01004204, 0x00004004, 0x00004200, 0x00000000, - 0x01000000, 0x01000204, 0x00000204, 0x01004000, - 0x00000004, 0x01004200, 0x01004000, 0x00000204, - 0x01000204, 0x00004000, 0x00004004, 0x01004204, - 0x00000000, 0x01000200, 0x01000004, 0x00004200, - 0x01004004, 0x00004204, 0x01004200, 0x00000004, - 0x00004204, 0x01004004, 0x00000200, 0x01000000, - 0x00004204, 0x01004000, 0x01004004, 0x00000204, - 0x00004000, 0x00000200, 0x01000000, 0x01004004, - 0x01000204, 0x00004204, 0x00004200, 0x00000000, - 0x00000200, 0x01000004, 0x00000004, 0x01000200, - 0x00000000, 0x01000204, 0x01000200, 0x00004200, - 0x00000204, 0x00004000, 0x01004204, 0x01000000, - 0x01004200, 0x00000004, 0x00004004, 0x01004204, - 0x01000004, 0x01004200, 0x01004000, 0x00004004, - }, - { - 0x20800080, 0x20820000, 0x00020080, 0x00000000, - 0x20020000, 0x00800080, 0x20800000, 0x20820080, - 0x00000080, 0x20000000, 0x00820000, 0x00020080, - 0x00820080, 0x20020080, 0x20000080, 0x20800000, - 0x00020000, 0x00820080, 0x00800080, 0x20020000, - 0x20820080, 0x20000080, 0x00000000, 0x00820000, - 0x20000000, 0x00800000, 0x20020080, 0x20800080, - 0x00800000, 0x00020000, 0x20820000, 0x00000080, - 0x00800000, 0x00020000, 0x20000080, 0x20820080, - 0x00020080, 0x20000000, 0x00000000, 0x00820000, - 0x20800080, 0x20020080, 0x20020000, 0x00800080, - 0x20820000, 0x00000080, 0x00800080, 0x20020000, - 0x20820080, 0x00800000, 0x20800000, 0x20000080, - 0x00820000, 0x00020080, 0x20020080, 0x20800000, - 0x00000080, 0x20820000, 0x00820080, 0x00000000, - 0x20000000, 0x20800080, 0x00020000, 0x00820080, - } -}; - -CONSTANT_VK u32a c_skb[8][64] = -{ - { - 0x00000000, 0x00000010, 0x20000000, 0x20000010, - 0x00010000, 0x00010010, 0x20010000, 0x20010010, - 0x00000800, 0x00000810, 0x20000800, 0x20000810, - 0x00010800, 0x00010810, 0x20010800, 0x20010810, - 0x00000020, 0x00000030, 0x20000020, 0x20000030, - 0x00010020, 0x00010030, 0x20010020, 0x20010030, - 0x00000820, 0x00000830, 0x20000820, 0x20000830, - 0x00010820, 0x00010830, 0x20010820, 0x20010830, - 0x00080000, 0x00080010, 0x20080000, 0x20080010, - 0x00090000, 0x00090010, 0x20090000, 0x20090010, - 0x00080800, 0x00080810, 0x20080800, 0x20080810, - 0x00090800, 0x00090810, 0x20090800, 0x20090810, - 0x00080020, 0x00080030, 0x20080020, 0x20080030, - 0x00090020, 0x00090030, 0x20090020, 0x20090030, - 0x00080820, 0x00080830, 0x20080820, 0x20080830, - 0x00090820, 0x00090830, 0x20090820, 0x20090830, - }, - { - 0x00000000, 0x02000000, 0x00002000, 0x02002000, - 0x00200000, 0x02200000, 0x00202000, 0x02202000, - 0x00000004, 0x02000004, 0x00002004, 0x02002004, - 0x00200004, 0x02200004, 0x00202004, 0x02202004, - 0x00000400, 0x02000400, 0x00002400, 0x02002400, - 0x00200400, 0x02200400, 0x00202400, 0x02202400, - 0x00000404, 0x02000404, 0x00002404, 0x02002404, - 0x00200404, 0x02200404, 0x00202404, 0x02202404, - 0x10000000, 0x12000000, 0x10002000, 0x12002000, - 0x10200000, 0x12200000, 0x10202000, 0x12202000, - 0x10000004, 0x12000004, 0x10002004, 0x12002004, - 0x10200004, 0x12200004, 0x10202004, 0x12202004, - 0x10000400, 0x12000400, 0x10002400, 0x12002400, - 0x10200400, 0x12200400, 0x10202400, 0x12202400, - 0x10000404, 0x12000404, 0x10002404, 0x12002404, - 0x10200404, 0x12200404, 0x10202404, 0x12202404, - }, - { - 0x00000000, 0x00000001, 0x00040000, 0x00040001, - 0x01000000, 0x01000001, 0x01040000, 0x01040001, - 0x00000002, 0x00000003, 0x00040002, 0x00040003, - 0x01000002, 0x01000003, 0x01040002, 0x01040003, - 0x00000200, 0x00000201, 0x00040200, 0x00040201, - 0x01000200, 0x01000201, 0x01040200, 0x01040201, - 0x00000202, 0x00000203, 0x00040202, 0x00040203, - 0x01000202, 0x01000203, 0x01040202, 0x01040203, - 0x08000000, 0x08000001, 0x08040000, 0x08040001, - 0x09000000, 0x09000001, 0x09040000, 0x09040001, - 0x08000002, 0x08000003, 0x08040002, 0x08040003, - 0x09000002, 0x09000003, 0x09040002, 0x09040003, - 0x08000200, 0x08000201, 0x08040200, 0x08040201, - 0x09000200, 0x09000201, 0x09040200, 0x09040201, - 0x08000202, 0x08000203, 0x08040202, 0x08040203, - 0x09000202, 0x09000203, 0x09040202, 0x09040203, - }, - { - 0x00000000, 0x00100000, 0x00000100, 0x00100100, - 0x00000008, 0x00100008, 0x00000108, 0x00100108, - 0x00001000, 0x00101000, 0x00001100, 0x00101100, - 0x00001008, 0x00101008, 0x00001108, 0x00101108, - 0x04000000, 0x04100000, 0x04000100, 0x04100100, - 0x04000008, 0x04100008, 0x04000108, 0x04100108, - 0x04001000, 0x04101000, 0x04001100, 0x04101100, - 0x04001008, 0x04101008, 0x04001108, 0x04101108, - 0x00020000, 0x00120000, 0x00020100, 0x00120100, - 0x00020008, 0x00120008, 0x00020108, 0x00120108, - 0x00021000, 0x00121000, 0x00021100, 0x00121100, - 0x00021008, 0x00121008, 0x00021108, 0x00121108, - 0x04020000, 0x04120000, 0x04020100, 0x04120100, - 0x04020008, 0x04120008, 0x04020108, 0x04120108, - 0x04021000, 0x04121000, 0x04021100, 0x04121100, - 0x04021008, 0x04121008, 0x04021108, 0x04121108, - }, - { - 0x00000000, 0x10000000, 0x00010000, 0x10010000, - 0x00000004, 0x10000004, 0x00010004, 0x10010004, - 0x20000000, 0x30000000, 0x20010000, 0x30010000, - 0x20000004, 0x30000004, 0x20010004, 0x30010004, - 0x00100000, 0x10100000, 0x00110000, 0x10110000, - 0x00100004, 0x10100004, 0x00110004, 0x10110004, - 0x20100000, 0x30100000, 0x20110000, 0x30110000, - 0x20100004, 0x30100004, 0x20110004, 0x30110004, - 0x00001000, 0x10001000, 0x00011000, 0x10011000, - 0x00001004, 0x10001004, 0x00011004, 0x10011004, - 0x20001000, 0x30001000, 0x20011000, 0x30011000, - 0x20001004, 0x30001004, 0x20011004, 0x30011004, - 0x00101000, 0x10101000, 0x00111000, 0x10111000, - 0x00101004, 0x10101004, 0x00111004, 0x10111004, - 0x20101000, 0x30101000, 0x20111000, 0x30111000, - 0x20101004, 0x30101004, 0x20111004, 0x30111004, - }, - { - 0x00000000, 0x08000000, 0x00000008, 0x08000008, - 0x00000400, 0x08000400, 0x00000408, 0x08000408, - 0x00020000, 0x08020000, 0x00020008, 0x08020008, - 0x00020400, 0x08020400, 0x00020408, 0x08020408, - 0x00000001, 0x08000001, 0x00000009, 0x08000009, - 0x00000401, 0x08000401, 0x00000409, 0x08000409, - 0x00020001, 0x08020001, 0x00020009, 0x08020009, - 0x00020401, 0x08020401, 0x00020409, 0x08020409, - 0x02000000, 0x0A000000, 0x02000008, 0x0A000008, - 0x02000400, 0x0A000400, 0x02000408, 0x0A000408, - 0x02020000, 0x0A020000, 0x02020008, 0x0A020008, - 0x02020400, 0x0A020400, 0x02020408, 0x0A020408, - 0x02000001, 0x0A000001, 0x02000009, 0x0A000009, - 0x02000401, 0x0A000401, 0x02000409, 0x0A000409, - 0x02020001, 0x0A020001, 0x02020009, 0x0A020009, - 0x02020401, 0x0A020401, 0x02020409, 0x0A020409, - }, - { - 0x00000000, 0x00000100, 0x00080000, 0x00080100, - 0x01000000, 0x01000100, 0x01080000, 0x01080100, - 0x00000010, 0x00000110, 0x00080010, 0x00080110, - 0x01000010, 0x01000110, 0x01080010, 0x01080110, - 0x00200000, 0x00200100, 0x00280000, 0x00280100, - 0x01200000, 0x01200100, 0x01280000, 0x01280100, - 0x00200010, 0x00200110, 0x00280010, 0x00280110, - 0x01200010, 0x01200110, 0x01280010, 0x01280110, - 0x00000200, 0x00000300, 0x00080200, 0x00080300, - 0x01000200, 0x01000300, 0x01080200, 0x01080300, - 0x00000210, 0x00000310, 0x00080210, 0x00080310, - 0x01000210, 0x01000310, 0x01080210, 0x01080310, - 0x00200200, 0x00200300, 0x00280200, 0x00280300, - 0x01200200, 0x01200300, 0x01280200, 0x01280300, - 0x00200210, 0x00200310, 0x00280210, 0x00280310, - 0x01200210, 0x01200310, 0x01280210, 0x01280310, - }, - { - 0x00000000, 0x04000000, 0x00040000, 0x04040000, - 0x00000002, 0x04000002, 0x00040002, 0x04040002, - 0x00002000, 0x04002000, 0x00042000, 0x04042000, - 0x00002002, 0x04002002, 0x00042002, 0x04042002, - 0x00000020, 0x04000020, 0x00040020, 0x04040020, - 0x00000022, 0x04000022, 0x00040022, 0x04040022, - 0x00002020, 0x04002020, 0x00042020, 0x04042020, - 0x00002022, 0x04002022, 0x00042022, 0x04042022, - 0x00000800, 0x04000800, 0x00040800, 0x04040800, - 0x00000802, 0x04000802, 0x00040802, 0x04040802, - 0x00002800, 0x04002800, 0x00042800, 0x04042800, - 0x00002802, 0x04002802, 0x00042802, 0x04042802, - 0x00000820, 0x04000820, 0x00040820, 0x04040820, - 0x00000822, 0x04000822, 0x00040822, 0x04040822, - 0x00002820, 0x04002820, 0x00042820, 0x04042820, - 0x00002822, 0x04002822, 0x00042822, 0x04042822 - } -}; - -#if VECT_SIZE == 1 -#define BOX(i,n,S) (S)[(n)][(i)] -#elif VECT_SIZE == 2 -#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1]) -#elif VECT_SIZE == 4 -#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3]) -#elif VECT_SIZE == 8 -#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7]) -#elif VECT_SIZE == 16 -#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7], (S)[(n)][(i).s8], (S)[(n)][(i).s9], (S)[(n)][(i).sa], (S)[(n)][(i).sb], (S)[(n)][(i).sc], (S)[(n)][(i).sd], (S)[(n)][(i).se], (S)[(n)][(i).sf]) -#endif - -DECLSPEC void _des_crypt_encrypt (u32 *iv, u32 *data, u32 *Kc, u32 *Kd, SHM_TYPE u32 (*s_SPtrans)[64]) -{ - u32 r = data[0]; - u32 l = data[1]; - - #ifdef _unroll - #pragma unroll - #endif - for (u32 i = 0; i < 16; i += 2) - { - u32 u; - u32 t; - - u = Kc[i + 0] ^ hc_rotl32 (r, 30u); - t = Kd[i + 0] ^ hc_rotl32 (r, 26u); - - l ^= BOX (((u >> 0) & 0x3f), 0, s_SPtrans) - | BOX (((u >> 8) & 0x3f), 2, s_SPtrans) - | BOX (((u >> 16) & 0x3f), 4, s_SPtrans) - | BOX (((u >> 24) & 0x3f), 6, s_SPtrans) - | BOX (((t >> 0) & 0x3f), 1, s_SPtrans) - | BOX (((t >> 8) & 0x3f), 3, s_SPtrans) - | BOX (((t >> 16) & 0x3f), 5, s_SPtrans) - | BOX (((t >> 24) & 0x3f), 7, s_SPtrans); - - u = Kc[i + 1] ^ hc_rotl32 (l, 30u); - t = Kd[i + 1] ^ hc_rotl32 (l, 26u); - - r ^= BOX (((u >> 0) & 0x3f), 0, s_SPtrans) - | BOX (((u >> 8) & 0x3f), 2, s_SPtrans) - | BOX (((u >> 16) & 0x3f), 4, s_SPtrans) - | BOX (((u >> 24) & 0x3f), 6, s_SPtrans) - | BOX (((t >> 0) & 0x3f), 1, s_SPtrans) - | BOX (((t >> 8) & 0x3f), 3, s_SPtrans) - | BOX (((t >> 16) & 0x3f), 5, s_SPtrans) - | BOX (((t >> 24) & 0x3f), 7, s_SPtrans); - } - - iv[0] = l; - iv[1] = r; -} - -DECLSPEC void _des_crypt_keysetup (u32 c, u32 d, u32 *Kc, u32 *Kd, SHM_TYPE u32 (*s_skb)[64]) -{ - u32 tt; - - PERM_OP (d, c, tt, 4, 0x0f0f0f0f); - HPERM_OP (c, tt, 2, 0xcccc0000); - HPERM_OP (d, tt, 2, 0xcccc0000); - PERM_OP (d, c, tt, 1, 0x55555555); - PERM_OP (c, d, tt, 8, 0x00ff00ff); - PERM_OP (d, c, tt, 1, 0x55555555); - - d = ((d & 0x000000ff) << 16) - | ((d & 0x0000ff00) << 0) - | ((d & 0x00ff0000) >> 16) - | ((c & 0xf0000000) >> 4); - - c = c & 0x0fffffff; - - #ifdef _unroll - #pragma unroll - #endif - for (u32 i = 0; i < 16; i++) - { - if ((i < 2) || (i == 8) || (i == 15)) - { - c = ((c >> 1) | (c << 27)); - d = ((d >> 1) | (d << 27)); - } - else - { - c = ((c >> 2) | (c << 26)); - d = ((d >> 2) | (d << 26)); - } - - c = c & 0x0fffffff; - d = d & 0x0fffffff; - - const u32 c00 = (c >> 0) & 0x0000003f; - const u32 c06 = (c >> 6) & 0x00383003; - const u32 c07 = (c >> 7) & 0x0000003c; - const u32 c13 = (c >> 13) & 0x0000060f; - const u32 c20 = (c >> 20) & 0x00000001; - - u32 s = BOX (((c00 >> 0) & 0xff), 0, s_skb) - | BOX (((c06 >> 0) & 0xff) - |((c07 >> 0) & 0xff), 1, s_skb) - | BOX (((c13 >> 0) & 0xff) - |((c06 >> 8) & 0xff), 2, s_skb) - | BOX (((c20 >> 0) & 0xff) - |((c13 >> 8) & 0xff) - |((c06 >> 16) & 0xff), 3, s_skb); - - const u32 d00 = (d >> 0) & 0x00003c3f; - const u32 d07 = (d >> 7) & 0x00003f03; - const u32 d21 = (d >> 21) & 0x0000000f; - const u32 d22 = (d >> 22) & 0x00000030; - - u32 t = BOX (((d00 >> 0) & 0xff), 4, s_skb) - | BOX (((d07 >> 0) & 0xff) - |((d00 >> 8) & 0xff), 5, s_skb) - | BOX (((d07 >> 8) & 0xff), 6, s_skb) - | BOX (((d21 >> 0) & 0xff) - |((d22 >> 0) & 0xff), 7, s_skb); - - Kc[i] = ((t << 16) | (s & 0x0000ffff)); - Kd[i] = ((s >> 16) | (t & 0xffff0000)); - } -} - -DECLSPEC void transform_netntlmv1_key (const u32 w0, const u32 w1, u32 *out) -{ - u32 t[8]; - - t[0] = (w0 >> 0) & 0xff; - t[1] = (w0 >> 8) & 0xff; - t[2] = (w0 >> 16) & 0xff; - t[3] = (w0 >> 24) & 0xff; - t[4] = (w1 >> 0) & 0xff; - t[5] = (w1 >> 8) & 0xff; - t[6] = (w1 >> 16) & 0xff; - t[7] = (w1 >> 24) & 0xff; - - u32 k[8]; - - k[0] = (t[0] >> 0); - k[1] = (t[0] << 7) | (t[1] >> 1); - k[2] = (t[1] << 6) | (t[2] >> 2); - k[3] = (t[2] << 5) | (t[3] >> 3); - k[4] = (t[3] << 4) | (t[4] >> 4); - k[5] = (t[4] << 3) | (t[5] >> 5); - k[6] = (t[5] << 2) | (t[6] >> 6); - k[7] = (t[6] << 1); - - out[0] = ((k[0] & 0xff) << 0) - | ((k[1] & 0xff) << 8) - | ((k[2] & 0xff) << 16) - | ((k[3] & 0xff) << 24); - - out[1] = ((k[4] & 0xff) << 0) - | ((k[5] & 0xff) << 8) - | ((k[6] & 0xff) << 16) - | ((k[7] & 0xff) << 24); -} - -KERNEL_FQ void m27000_mxx (KERN_ATTR_RULES ()) -{ - /** - * modifier - */ - - const u64 gid = get_global_id (0); - const u64 lid = get_local_id (0); - const u64 lsz = get_local_size (0); - - /** - * sbox, kbox - */ - - #ifdef REAL_SHM - - LOCAL_VK u32 s_SPtrans[8][64]; - LOCAL_VK u32 s_skb[8][64]; - - for (u32 i = lid; i < 64; i += lsz) - { - s_SPtrans[0][i] = c_SPtrans[0][i]; - s_SPtrans[1][i] = c_SPtrans[1][i]; - s_SPtrans[2][i] = c_SPtrans[2][i]; - s_SPtrans[3][i] = c_SPtrans[3][i]; - s_SPtrans[4][i] = c_SPtrans[4][i]; - s_SPtrans[5][i] = c_SPtrans[5][i]; - s_SPtrans[6][i] = c_SPtrans[6][i]; - s_SPtrans[7][i] = c_SPtrans[7][i]; - - s_skb[0][i] = c_skb[0][i]; - s_skb[1][i] = c_skb[1][i]; - s_skb[2][i] = c_skb[2][i]; - s_skb[3][i] = c_skb[3][i]; - s_skb[4][i] = c_skb[4][i]; - s_skb[5][i] = c_skb[5][i]; - s_skb[6][i] = c_skb[6][i]; - s_skb[7][i] = c_skb[7][i]; - } - - SYNC_THREADS (); - - #else - - CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; - CONSTANT_AS u32a (*s_skb)[64] = c_skb; - - #endif - - if (gid >= gid_max) return; - - /** - * salt - */ - - const u32 s0 = salt_bufs[SALT_POS].salt_buf[0]; - const u32 s1 = salt_bufs[SALT_POS].salt_buf[1]; - const u32 s2 = salt_bufs[SALT_POS].salt_buf[2]; - - /** - * base - */ - - const u32 a = pws[gid].i[ 0]; - const u32 b = pws[gid].i[ 1]; - const u32 c = pws[gid].i[ 2]; - const u32 d = pws[gid].i[ 3]; - - /** - * loop - */ - - for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) - { - - // if ((d >> 16) != s2) continue; - - /** - * DES1 - */ - - u32 key[2]; - - transform_netntlmv1_key (a, b, key); - - u32 Kc[16]; - u32 Kd[16]; - - _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); - - u32 data[2]; - - data[0] = s0; - data[1] = s1; - - u32 out1[2]; - - _des_crypt_encrypt (out1, data, Kc, Kd, s_SPtrans); - - /** - * DES2 - */ - - transform_netntlmv1_key (((b >> 24) | (c << 8)), ((c >> 24) | (d << 8)), key); - - _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); - - u32 out2[2]; - - _des_crypt_encrypt (out2, data, Kc, Kd, s_SPtrans); - - const u32 r0 = out1[0]; - const u32 r1 = out1[1]; - const u32 r2 = out2[0]; - const u32 r3 = out2[1]; - - COMPARE_M_SCALAR (r0, r1, r2, r3); - } -} - -KERNEL_FQ void m27000_sxx (KERN_ATTR_RULES ()) -{ - /** - * modifier - */ - - const u64 gid = get_global_id (0); - const u64 lid = get_local_id (0); - const u64 lsz = get_local_size (0); - - /** - * sbox, kbox - */ - - #ifdef REAL_SHM - - LOCAL_VK u32 s_SPtrans[8][64]; - LOCAL_VK u32 s_skb[8][64]; - - for (u32 i = lid; i < 64; i += lsz) - { - s_SPtrans[0][i] = c_SPtrans[0][i]; - s_SPtrans[1][i] = c_SPtrans[1][i]; - s_SPtrans[2][i] = c_SPtrans[2][i]; - s_SPtrans[3][i] = c_SPtrans[3][i]; - s_SPtrans[4][i] = c_SPtrans[4][i]; - s_SPtrans[5][i] = c_SPtrans[5][i]; - s_SPtrans[6][i] = c_SPtrans[6][i]; - s_SPtrans[7][i] = c_SPtrans[7][i]; - - s_skb[0][i] = c_skb[0][i]; - s_skb[1][i] = c_skb[1][i]; - s_skb[2][i] = c_skb[2][i]; - s_skb[3][i] = c_skb[3][i]; - s_skb[4][i] = c_skb[4][i]; - s_skb[5][i] = c_skb[5][i]; - s_skb[6][i] = c_skb[6][i]; - s_skb[7][i] = c_skb[7][i]; - } - - SYNC_THREADS (); - - #else - - CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; - CONSTANT_AS u32a (*s_skb)[64] = c_skb; - - #endif - - 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] - }; - - /** - * salt - */ - - const u32 s0 = salt_bufs[SALT_POS].salt_buf[0]; - const u32 s1 = salt_bufs[SALT_POS].salt_buf[1]; - const u32 s2 = salt_bufs[SALT_POS].salt_buf[2]; - - /** - * base - */ - - const u32 a = pws[gid].i[ 0]; - const u32 b = pws[gid].i[ 1]; - const u32 c = pws[gid].i[ 2]; - const u32 d = pws[gid].i[ 3]; - - /** - * loop - */ - - for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) - { - - if ((d >> 16) != s2) continue; - - /** - * DES1 - */ - - u32 key[2]; - - transform_netntlmv1_key (a, b, key); - - u32 Kc[16]; - u32 Kd[16]; - - _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); - - u32 data[2]; - - data[0] = s0; - data[1] = s1; - - u32 out1[2]; - - _des_crypt_encrypt (out1, data, Kc, Kd, s_SPtrans); - - /** - * DES2 - */ - - /* - transform_netntlmv1_key (((b >> 24) | (c << 8)), ((c >> 24) | (d << 8)), key); - - _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); - - u32 out2[2]; - - _des_crypt_encrypt (out2, data, Kc, Kd, s_SPtrans); - */ - - const u32 r0 = out1[0]; - const u32 r1 = out1[1]; - const u32 r2 = search[2]; - const u32 r3 = search[3]; - - COMPARE_S_SCALAR (r0, r1, r2, r3); - } -} diff --git a/OpenCL/m27000_a3-pure.cl b/OpenCL/m27000_a3-pure.cl deleted file mode 100644 index 3984f4ab9..000000000 --- a/OpenCL/m27000_a3-pure.cl +++ /dev/null @@ -1,803 +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_md4.cl" -#endif - -typedef struct netntlm -{ - u32 user_len; - u32 domain_len; - u32 srvchall_len; - u32 clichall_len; - - u32 userdomain_buf[64]; - u32 chall_buf[256]; - -} netntlm_t; - -#define PERM_OP(a,b,tt,n,m) \ -{ \ - tt = a >> n; \ - tt = tt ^ b; \ - tt = tt & m; \ - b = b ^ tt; \ - tt = tt << n; \ - a = a ^ tt; \ -} - -#define HPERM_OP(a,tt,n,m) \ -{ \ - tt = a << (16 + n); \ - tt = tt ^ a; \ - tt = tt & m; \ - a = a ^ tt; \ - tt = tt >> (16 + n); \ - a = a ^ tt; \ -} - -CONSTANT_VK u32a c_SPtrans[8][64] = -{ - { - 0x02080800, 0x00080000, 0x02000002, 0x02080802, - 0x02000000, 0x00080802, 0x00080002, 0x02000002, - 0x00080802, 0x02080800, 0x02080000, 0x00000802, - 0x02000802, 0x02000000, 0x00000000, 0x00080002, - 0x00080000, 0x00000002, 0x02000800, 0x00080800, - 0x02080802, 0x02080000, 0x00000802, 0x02000800, - 0x00000002, 0x00000800, 0x00080800, 0x02080002, - 0x00000800, 0x02000802, 0x02080002, 0x00000000, - 0x00000000, 0x02080802, 0x02000800, 0x00080002, - 0x02080800, 0x00080000, 0x00000802, 0x02000800, - 0x02080002, 0x00000800, 0x00080800, 0x02000002, - 0x00080802, 0x00000002, 0x02000002, 0x02080000, - 0x02080802, 0x00080800, 0x02080000, 0x02000802, - 0x02000000, 0x00000802, 0x00080002, 0x00000000, - 0x00080000, 0x02000000, 0x02000802, 0x02080800, - 0x00000002, 0x02080002, 0x00000800, 0x00080802, - }, - { - 0x40108010, 0x00000000, 0x00108000, 0x40100000, - 0x40000010, 0x00008010, 0x40008000, 0x00108000, - 0x00008000, 0x40100010, 0x00000010, 0x40008000, - 0x00100010, 0x40108000, 0x40100000, 0x00000010, - 0x00100000, 0x40008010, 0x40100010, 0x00008000, - 0x00108010, 0x40000000, 0x00000000, 0x00100010, - 0x40008010, 0x00108010, 0x40108000, 0x40000010, - 0x40000000, 0x00100000, 0x00008010, 0x40108010, - 0x00100010, 0x40108000, 0x40008000, 0x00108010, - 0x40108010, 0x00100010, 0x40000010, 0x00000000, - 0x40000000, 0x00008010, 0x00100000, 0x40100010, - 0x00008000, 0x40000000, 0x00108010, 0x40008010, - 0x40108000, 0x00008000, 0x00000000, 0x40000010, - 0x00000010, 0x40108010, 0x00108000, 0x40100000, - 0x40100010, 0x00100000, 0x00008010, 0x40008000, - 0x40008010, 0x00000010, 0x40100000, 0x00108000, - }, - { - 0x04000001, 0x04040100, 0x00000100, 0x04000101, - 0x00040001, 0x04000000, 0x04000101, 0x00040100, - 0x04000100, 0x00040000, 0x04040000, 0x00000001, - 0x04040101, 0x00000101, 0x00000001, 0x04040001, - 0x00000000, 0x00040001, 0x04040100, 0x00000100, - 0x00000101, 0x04040101, 0x00040000, 0x04000001, - 0x04040001, 0x04000100, 0x00040101, 0x04040000, - 0x00040100, 0x00000000, 0x04000000, 0x00040101, - 0x04040100, 0x00000100, 0x00000001, 0x00040000, - 0x00000101, 0x00040001, 0x04040000, 0x04000101, - 0x00000000, 0x04040100, 0x00040100, 0x04040001, - 0x00040001, 0x04000000, 0x04040101, 0x00000001, - 0x00040101, 0x04000001, 0x04000000, 0x04040101, - 0x00040000, 0x04000100, 0x04000101, 0x00040100, - 0x04000100, 0x00000000, 0x04040001, 0x00000101, - 0x04000001, 0x00040101, 0x00000100, 0x04040000, - }, - { - 0x00401008, 0x10001000, 0x00000008, 0x10401008, - 0x00000000, 0x10400000, 0x10001008, 0x00400008, - 0x10401000, 0x10000008, 0x10000000, 0x00001008, - 0x10000008, 0x00401008, 0x00400000, 0x10000000, - 0x10400008, 0x00401000, 0x00001000, 0x00000008, - 0x00401000, 0x10001008, 0x10400000, 0x00001000, - 0x00001008, 0x00000000, 0x00400008, 0x10401000, - 0x10001000, 0x10400008, 0x10401008, 0x00400000, - 0x10400008, 0x00001008, 0x00400000, 0x10000008, - 0x00401000, 0x10001000, 0x00000008, 0x10400000, - 0x10001008, 0x00000000, 0x00001000, 0x00400008, - 0x00000000, 0x10400008, 0x10401000, 0x00001000, - 0x10000000, 0x10401008, 0x00401008, 0x00400000, - 0x10401008, 0x00000008, 0x10001000, 0x00401008, - 0x00400008, 0x00401000, 0x10400000, 0x10001008, - 0x00001008, 0x10000000, 0x10000008, 0x10401000, - }, - { - 0x08000000, 0x00010000, 0x00000400, 0x08010420, - 0x08010020, 0x08000400, 0x00010420, 0x08010000, - 0x00010000, 0x00000020, 0x08000020, 0x00010400, - 0x08000420, 0x08010020, 0x08010400, 0x00000000, - 0x00010400, 0x08000000, 0x00010020, 0x00000420, - 0x08000400, 0x00010420, 0x00000000, 0x08000020, - 0x00000020, 0x08000420, 0x08010420, 0x00010020, - 0x08010000, 0x00000400, 0x00000420, 0x08010400, - 0x08010400, 0x08000420, 0x00010020, 0x08010000, - 0x00010000, 0x00000020, 0x08000020, 0x08000400, - 0x08000000, 0x00010400, 0x08010420, 0x00000000, - 0x00010420, 0x08000000, 0x00000400, 0x00010020, - 0x08000420, 0x00000400, 0x00000000, 0x08010420, - 0x08010020, 0x08010400, 0x00000420, 0x00010000, - 0x00010400, 0x08010020, 0x08000400, 0x00000420, - 0x00000020, 0x00010420, 0x08010000, 0x08000020, - }, - { - 0x80000040, 0x00200040, 0x00000000, 0x80202000, - 0x00200040, 0x00002000, 0x80002040, 0x00200000, - 0x00002040, 0x80202040, 0x00202000, 0x80000000, - 0x80002000, 0x80000040, 0x80200000, 0x00202040, - 0x00200000, 0x80002040, 0x80200040, 0x00000000, - 0x00002000, 0x00000040, 0x80202000, 0x80200040, - 0x80202040, 0x80200000, 0x80000000, 0x00002040, - 0x00000040, 0x00202000, 0x00202040, 0x80002000, - 0x00002040, 0x80000000, 0x80002000, 0x00202040, - 0x80202000, 0x00200040, 0x00000000, 0x80002000, - 0x80000000, 0x00002000, 0x80200040, 0x00200000, - 0x00200040, 0x80202040, 0x00202000, 0x00000040, - 0x80202040, 0x00202000, 0x00200000, 0x80002040, - 0x80000040, 0x80200000, 0x00202040, 0x00000000, - 0x00002000, 0x80000040, 0x80002040, 0x80202000, - 0x80200000, 0x00002040, 0x00000040, 0x80200040, - }, - { - 0x00004000, 0x00000200, 0x01000200, 0x01000004, - 0x01004204, 0x00004004, 0x00004200, 0x00000000, - 0x01000000, 0x01000204, 0x00000204, 0x01004000, - 0x00000004, 0x01004200, 0x01004000, 0x00000204, - 0x01000204, 0x00004000, 0x00004004, 0x01004204, - 0x00000000, 0x01000200, 0x01000004, 0x00004200, - 0x01004004, 0x00004204, 0x01004200, 0x00000004, - 0x00004204, 0x01004004, 0x00000200, 0x01000000, - 0x00004204, 0x01004000, 0x01004004, 0x00000204, - 0x00004000, 0x00000200, 0x01000000, 0x01004004, - 0x01000204, 0x00004204, 0x00004200, 0x00000000, - 0x00000200, 0x01000004, 0x00000004, 0x01000200, - 0x00000000, 0x01000204, 0x01000200, 0x00004200, - 0x00000204, 0x00004000, 0x01004204, 0x01000000, - 0x01004200, 0x00000004, 0x00004004, 0x01004204, - 0x01000004, 0x01004200, 0x01004000, 0x00004004, - }, - { - 0x20800080, 0x20820000, 0x00020080, 0x00000000, - 0x20020000, 0x00800080, 0x20800000, 0x20820080, - 0x00000080, 0x20000000, 0x00820000, 0x00020080, - 0x00820080, 0x20020080, 0x20000080, 0x20800000, - 0x00020000, 0x00820080, 0x00800080, 0x20020000, - 0x20820080, 0x20000080, 0x00000000, 0x00820000, - 0x20000000, 0x00800000, 0x20020080, 0x20800080, - 0x00800000, 0x00020000, 0x20820000, 0x00000080, - 0x00800000, 0x00020000, 0x20000080, 0x20820080, - 0x00020080, 0x20000000, 0x00000000, 0x00820000, - 0x20800080, 0x20020080, 0x20020000, 0x00800080, - 0x20820000, 0x00000080, 0x00800080, 0x20020000, - 0x20820080, 0x00800000, 0x20800000, 0x20000080, - 0x00820000, 0x00020080, 0x20020080, 0x20800000, - 0x00000080, 0x20820000, 0x00820080, 0x00000000, - 0x20000000, 0x20800080, 0x00020000, 0x00820080, - } -}; - -CONSTANT_VK u32a c_skb[8][64] = -{ - { - 0x00000000, 0x00000010, 0x20000000, 0x20000010, - 0x00010000, 0x00010010, 0x20010000, 0x20010010, - 0x00000800, 0x00000810, 0x20000800, 0x20000810, - 0x00010800, 0x00010810, 0x20010800, 0x20010810, - 0x00000020, 0x00000030, 0x20000020, 0x20000030, - 0x00010020, 0x00010030, 0x20010020, 0x20010030, - 0x00000820, 0x00000830, 0x20000820, 0x20000830, - 0x00010820, 0x00010830, 0x20010820, 0x20010830, - 0x00080000, 0x00080010, 0x20080000, 0x20080010, - 0x00090000, 0x00090010, 0x20090000, 0x20090010, - 0x00080800, 0x00080810, 0x20080800, 0x20080810, - 0x00090800, 0x00090810, 0x20090800, 0x20090810, - 0x00080020, 0x00080030, 0x20080020, 0x20080030, - 0x00090020, 0x00090030, 0x20090020, 0x20090030, - 0x00080820, 0x00080830, 0x20080820, 0x20080830, - 0x00090820, 0x00090830, 0x20090820, 0x20090830, - }, - { - 0x00000000, 0x02000000, 0x00002000, 0x02002000, - 0x00200000, 0x02200000, 0x00202000, 0x02202000, - 0x00000004, 0x02000004, 0x00002004, 0x02002004, - 0x00200004, 0x02200004, 0x00202004, 0x02202004, - 0x00000400, 0x02000400, 0x00002400, 0x02002400, - 0x00200400, 0x02200400, 0x00202400, 0x02202400, - 0x00000404, 0x02000404, 0x00002404, 0x02002404, - 0x00200404, 0x02200404, 0x00202404, 0x02202404, - 0x10000000, 0x12000000, 0x10002000, 0x12002000, - 0x10200000, 0x12200000, 0x10202000, 0x12202000, - 0x10000004, 0x12000004, 0x10002004, 0x12002004, - 0x10200004, 0x12200004, 0x10202004, 0x12202004, - 0x10000400, 0x12000400, 0x10002400, 0x12002400, - 0x10200400, 0x12200400, 0x10202400, 0x12202400, - 0x10000404, 0x12000404, 0x10002404, 0x12002404, - 0x10200404, 0x12200404, 0x10202404, 0x12202404, - }, - { - 0x00000000, 0x00000001, 0x00040000, 0x00040001, - 0x01000000, 0x01000001, 0x01040000, 0x01040001, - 0x00000002, 0x00000003, 0x00040002, 0x00040003, - 0x01000002, 0x01000003, 0x01040002, 0x01040003, - 0x00000200, 0x00000201, 0x00040200, 0x00040201, - 0x01000200, 0x01000201, 0x01040200, 0x01040201, - 0x00000202, 0x00000203, 0x00040202, 0x00040203, - 0x01000202, 0x01000203, 0x01040202, 0x01040203, - 0x08000000, 0x08000001, 0x08040000, 0x08040001, - 0x09000000, 0x09000001, 0x09040000, 0x09040001, - 0x08000002, 0x08000003, 0x08040002, 0x08040003, - 0x09000002, 0x09000003, 0x09040002, 0x09040003, - 0x08000200, 0x08000201, 0x08040200, 0x08040201, - 0x09000200, 0x09000201, 0x09040200, 0x09040201, - 0x08000202, 0x08000203, 0x08040202, 0x08040203, - 0x09000202, 0x09000203, 0x09040202, 0x09040203, - }, - { - 0x00000000, 0x00100000, 0x00000100, 0x00100100, - 0x00000008, 0x00100008, 0x00000108, 0x00100108, - 0x00001000, 0x00101000, 0x00001100, 0x00101100, - 0x00001008, 0x00101008, 0x00001108, 0x00101108, - 0x04000000, 0x04100000, 0x04000100, 0x04100100, - 0x04000008, 0x04100008, 0x04000108, 0x04100108, - 0x04001000, 0x04101000, 0x04001100, 0x04101100, - 0x04001008, 0x04101008, 0x04001108, 0x04101108, - 0x00020000, 0x00120000, 0x00020100, 0x00120100, - 0x00020008, 0x00120008, 0x00020108, 0x00120108, - 0x00021000, 0x00121000, 0x00021100, 0x00121100, - 0x00021008, 0x00121008, 0x00021108, 0x00121108, - 0x04020000, 0x04120000, 0x04020100, 0x04120100, - 0x04020008, 0x04120008, 0x04020108, 0x04120108, - 0x04021000, 0x04121000, 0x04021100, 0x04121100, - 0x04021008, 0x04121008, 0x04021108, 0x04121108, - }, - { - 0x00000000, 0x10000000, 0x00010000, 0x10010000, - 0x00000004, 0x10000004, 0x00010004, 0x10010004, - 0x20000000, 0x30000000, 0x20010000, 0x30010000, - 0x20000004, 0x30000004, 0x20010004, 0x30010004, - 0x00100000, 0x10100000, 0x00110000, 0x10110000, - 0x00100004, 0x10100004, 0x00110004, 0x10110004, - 0x20100000, 0x30100000, 0x20110000, 0x30110000, - 0x20100004, 0x30100004, 0x20110004, 0x30110004, - 0x00001000, 0x10001000, 0x00011000, 0x10011000, - 0x00001004, 0x10001004, 0x00011004, 0x10011004, - 0x20001000, 0x30001000, 0x20011000, 0x30011000, - 0x20001004, 0x30001004, 0x20011004, 0x30011004, - 0x00101000, 0x10101000, 0x00111000, 0x10111000, - 0x00101004, 0x10101004, 0x00111004, 0x10111004, - 0x20101000, 0x30101000, 0x20111000, 0x30111000, - 0x20101004, 0x30101004, 0x20111004, 0x30111004, - }, - { - 0x00000000, 0x08000000, 0x00000008, 0x08000008, - 0x00000400, 0x08000400, 0x00000408, 0x08000408, - 0x00020000, 0x08020000, 0x00020008, 0x08020008, - 0x00020400, 0x08020400, 0x00020408, 0x08020408, - 0x00000001, 0x08000001, 0x00000009, 0x08000009, - 0x00000401, 0x08000401, 0x00000409, 0x08000409, - 0x00020001, 0x08020001, 0x00020009, 0x08020009, - 0x00020401, 0x08020401, 0x00020409, 0x08020409, - 0x02000000, 0x0A000000, 0x02000008, 0x0A000008, - 0x02000400, 0x0A000400, 0x02000408, 0x0A000408, - 0x02020000, 0x0A020000, 0x02020008, 0x0A020008, - 0x02020400, 0x0A020400, 0x02020408, 0x0A020408, - 0x02000001, 0x0A000001, 0x02000009, 0x0A000009, - 0x02000401, 0x0A000401, 0x02000409, 0x0A000409, - 0x02020001, 0x0A020001, 0x02020009, 0x0A020009, - 0x02020401, 0x0A020401, 0x02020409, 0x0A020409, - }, - { - 0x00000000, 0x00000100, 0x00080000, 0x00080100, - 0x01000000, 0x01000100, 0x01080000, 0x01080100, - 0x00000010, 0x00000110, 0x00080010, 0x00080110, - 0x01000010, 0x01000110, 0x01080010, 0x01080110, - 0x00200000, 0x00200100, 0x00280000, 0x00280100, - 0x01200000, 0x01200100, 0x01280000, 0x01280100, - 0x00200010, 0x00200110, 0x00280010, 0x00280110, - 0x01200010, 0x01200110, 0x01280010, 0x01280110, - 0x00000200, 0x00000300, 0x00080200, 0x00080300, - 0x01000200, 0x01000300, 0x01080200, 0x01080300, - 0x00000210, 0x00000310, 0x00080210, 0x00080310, - 0x01000210, 0x01000310, 0x01080210, 0x01080310, - 0x00200200, 0x00200300, 0x00280200, 0x00280300, - 0x01200200, 0x01200300, 0x01280200, 0x01280300, - 0x00200210, 0x00200310, 0x00280210, 0x00280310, - 0x01200210, 0x01200310, 0x01280210, 0x01280310, - }, - { - 0x00000000, 0x04000000, 0x00040000, 0x04040000, - 0x00000002, 0x04000002, 0x00040002, 0x04040002, - 0x00002000, 0x04002000, 0x00042000, 0x04042000, - 0x00002002, 0x04002002, 0x00042002, 0x04042002, - 0x00000020, 0x04000020, 0x00040020, 0x04040020, - 0x00000022, 0x04000022, 0x00040022, 0x04040022, - 0x00002020, 0x04002020, 0x00042020, 0x04042020, - 0x00002022, 0x04002022, 0x00042022, 0x04042022, - 0x00000800, 0x04000800, 0x00040800, 0x04040800, - 0x00000802, 0x04000802, 0x00040802, 0x04040802, - 0x00002800, 0x04002800, 0x00042800, 0x04042800, - 0x00002802, 0x04002802, 0x00042802, 0x04042802, - 0x00000820, 0x04000820, 0x00040820, 0x04040820, - 0x00000822, 0x04000822, 0x00040822, 0x04040822, - 0x00002820, 0x04002820, 0x00042820, 0x04042820, - 0x00002822, 0x04002822, 0x00042822, 0x04042822 - } -}; - -#if VECT_SIZE == 1 -#define BOX(i,n,S) (S)[(n)][(i)] -#elif VECT_SIZE == 2 -#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1]) -#elif VECT_SIZE == 4 -#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3]) -#elif VECT_SIZE == 8 -#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7]) -#elif VECT_SIZE == 16 -#define BOX(i,n,S) make_u32x ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7], (S)[(n)][(i).s8], (S)[(n)][(i).s9], (S)[(n)][(i).sa], (S)[(n)][(i).sb], (S)[(n)][(i).sc], (S)[(n)][(i).sd], (S)[(n)][(i).se], (S)[(n)][(i).sf]) -#endif - -DECLSPEC void _des_crypt_encrypt (u32x *iv, u32x *data, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_SPtrans)[64]) -{ - u32x r = data[0]; - u32x l = data[1]; - - #ifdef _unroll - #pragma unroll - #endif - for (u32 i = 0; i < 16; i += 2) - { - u32x u; - u32x t; - - u = Kc[i + 0] ^ hc_rotl32 (r, 30u); - t = Kd[i + 0] ^ hc_rotl32 (r, 26u); - - l ^= BOX (((u >> 0) & 0x3f), 0, s_SPtrans) - | BOX (((u >> 8) & 0x3f), 2, s_SPtrans) - | BOX (((u >> 16) & 0x3f), 4, s_SPtrans) - | BOX (((u >> 24) & 0x3f), 6, s_SPtrans) - | BOX (((t >> 0) & 0x3f), 1, s_SPtrans) - | BOX (((t >> 8) & 0x3f), 3, s_SPtrans) - | BOX (((t >> 16) & 0x3f), 5, s_SPtrans) - | BOX (((t >> 24) & 0x3f), 7, s_SPtrans); - - u = Kc[i + 1] ^ hc_rotl32 (l, 30u); - t = Kd[i + 1] ^ hc_rotl32 (l, 26u); - - r ^= BOX (((u >> 0) & 0x3f), 0, s_SPtrans) - | BOX (((u >> 8) & 0x3f), 2, s_SPtrans) - | BOX (((u >> 16) & 0x3f), 4, s_SPtrans) - | BOX (((u >> 24) & 0x3f), 6, s_SPtrans) - | BOX (((t >> 0) & 0x3f), 1, s_SPtrans) - | BOX (((t >> 8) & 0x3f), 3, s_SPtrans) - | BOX (((t >> 16) & 0x3f), 5, s_SPtrans) - | BOX (((t >> 24) & 0x3f), 7, s_SPtrans); - } - - iv[0] = l; - iv[1] = r; -} - -DECLSPEC void _des_crypt_keysetup (u32x c, u32x d, u32x *Kc, u32x *Kd, SHM_TYPE u32 (*s_skb)[64]) -{ - u32x tt; - - PERM_OP (d, c, tt, 4, 0x0f0f0f0f); - HPERM_OP (c, tt, 2, 0xcccc0000); - HPERM_OP (d, tt, 2, 0xcccc0000); - PERM_OP (d, c, tt, 1, 0x55555555); - PERM_OP (c, d, tt, 8, 0x00ff00ff); - PERM_OP (d, c, tt, 1, 0x55555555); - - d = ((d & 0x000000ff) << 16) - | ((d & 0x0000ff00) << 0) - | ((d & 0x00ff0000) >> 16) - | ((c & 0xf0000000) >> 4); - - c = c & 0x0fffffff; - - #ifdef _unroll - #pragma unroll - #endif - for (u32 i = 0; i < 16; i++) - { - if ((i < 2) || (i == 8) || (i == 15)) - { - c = ((c >> 1) | (c << 27)); - d = ((d >> 1) | (d << 27)); - } - else - { - c = ((c >> 2) | (c << 26)); - d = ((d >> 2) | (d << 26)); - } - - c = c & 0x0fffffff; - d = d & 0x0fffffff; - - const u32x c00 = (c >> 0) & 0x0000003f; - const u32x c06 = (c >> 6) & 0x00383003; - const u32x c07 = (c >> 7) & 0x0000003c; - const u32x c13 = (c >> 13) & 0x0000060f; - const u32x c20 = (c >> 20) & 0x00000001; - - u32x s = BOX (((c00 >> 0) & 0xff), 0, s_skb) - | BOX (((c06 >> 0) & 0xff) - |((c07 >> 0) & 0xff), 1, s_skb) - | BOX (((c13 >> 0) & 0xff) - |((c06 >> 8) & 0xff), 2, s_skb) - | BOX (((c20 >> 0) & 0xff) - |((c13 >> 8) & 0xff) - |((c06 >> 16) & 0xff), 3, s_skb); - - const u32x d00 = (d >> 0) & 0x00003c3f; - const u32x d07 = (d >> 7) & 0x00003f03; - const u32x d21 = (d >> 21) & 0x0000000f; - const u32x d22 = (d >> 22) & 0x00000030; - - u32x t = BOX (((d00 >> 0) & 0xff), 4, s_skb) - | BOX (((d07 >> 0) & 0xff) - |((d00 >> 8) & 0xff), 5, s_skb) - | BOX (((d07 >> 8) & 0xff), 6, s_skb) - | BOX (((d21 >> 0) & 0xff) - |((d22 >> 0) & 0xff), 7, s_skb); - - Kc[i] = ((t << 16) | (s & 0x0000ffff)); - Kd[i] = ((s >> 16) | (t & 0xffff0000)); - } -} - -DECLSPEC void transform_netntlmv1_key (const u32x w0, const u32x w1, u32x *out) -{ - u32x t[8]; - - t[0] = (w0 >> 0) & 0xff; - t[1] = (w0 >> 8) & 0xff; - t[2] = (w0 >> 16) & 0xff; - t[3] = (w0 >> 24) & 0xff; - t[4] = (w1 >> 0) & 0xff; - t[5] = (w1 >> 8) & 0xff; - t[6] = (w1 >> 16) & 0xff; - t[7] = (w1 >> 24) & 0xff; - - u32x k[8]; - - k[0] = (t[0] >> 0); - k[1] = (t[0] << 7) | (t[1] >> 1); - k[2] = (t[1] << 6) | (t[2] >> 2); - k[3] = (t[2] << 5) | (t[3] >> 3); - k[4] = (t[3] << 4) | (t[4] >> 4); - k[5] = (t[4] << 3) | (t[5] >> 5); - k[6] = (t[5] << 2) | (t[6] >> 6); - k[7] = (t[6] << 1); - - out[0] = ((k[0] & 0xff) << 0) - | ((k[1] & 0xff) << 8) - | ((k[2] & 0xff) << 16) - | ((k[3] & 0xff) << 24); - - out[1] = ((k[4] & 0xff) << 0) - | ((k[5] & 0xff) << 8) - | ((k[6] & 0xff) << 16) - | ((k[7] & 0xff) << 24); -} - -KERNEL_FQ void m27000_mxx (KERN_ATTR_VECTOR ()) -{ - /** - * modifier - */ - - const u64 gid = get_global_id (0); - const u64 lid = get_local_id (0); - const u64 lsz = get_local_size (0); - - /** - * sbox, kbox - */ - - #ifdef REAL_SHM - - LOCAL_VK u32 s_SPtrans[8][64]; - LOCAL_VK u32 s_skb[8][64]; - - for (u32 i = lid; i < 64; i += lsz) - { - s_SPtrans[0][i] = c_SPtrans[0][i]; - s_SPtrans[1][i] = c_SPtrans[1][i]; - s_SPtrans[2][i] = c_SPtrans[2][i]; - s_SPtrans[3][i] = c_SPtrans[3][i]; - s_SPtrans[4][i] = c_SPtrans[4][i]; - s_SPtrans[5][i] = c_SPtrans[5][i]; - s_SPtrans[6][i] = c_SPtrans[6][i]; - s_SPtrans[7][i] = c_SPtrans[7][i]; - - s_skb[0][i] = c_skb[0][i]; - s_skb[1][i] = c_skb[1][i]; - s_skb[2][i] = c_skb[2][i]; - s_skb[3][i] = c_skb[3][i]; - s_skb[4][i] = c_skb[4][i]; - s_skb[5][i] = c_skb[5][i]; - s_skb[6][i] = c_skb[6][i]; - s_skb[7][i] = c_skb[7][i]; - } - - SYNC_THREADS (); - - #else - - CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; - CONSTANT_AS u32a (*s_skb)[64] = c_skb; - - #endif - - if (gid >= gid_max) return; - - /** - * salt - */ - - const u32 s0 = salt_bufs[SALT_POS].salt_buf[0]; - const u32 s1 = salt_bufs[SALT_POS].salt_buf[1]; - const u32 s2 = salt_bufs[SALT_POS].salt_buf[2]; - - /** - * 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]; - } - - /** - * 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; - - // md4_ctx_vector_t ctx; - - // md4_init_vector (&ctx); - - // md4_update_vector_utf16le (&ctx, w, pw_len); - - // md4_final_vector (&ctx); - - const u32x a = w[0]; - const u32x b = w[1]; - const u32x c = w[2]; - const u32x d = w[3]; - - if (MATCHES_NONE_VS ((d >> 16), s2)) continue; - - /** - * DES1 - */ - - u32x key[2]; - - transform_netntlmv1_key (a, b, key); - - u32x Kc[16]; - u32x Kd[16]; - - _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); - - u32x data[2]; - - data[0] = s0; - data[1] = s1; - - u32x out1[2]; - - _des_crypt_encrypt (out1, data, Kc, Kd, s_SPtrans); - - /** - * DES2 - */ - - transform_netntlmv1_key (((b >> 24) | (c << 8)), ((c >> 24) | (d << 8)), key); - - _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); - - u32x out2[2]; - - _des_crypt_encrypt (out2, data, Kc, Kd, s_SPtrans); - - const u32x r0 = out1[0]; - const u32x r1 = out1[1]; - const u32x r2 = out2[0]; - const u32x r3 = out2[1]; - - COMPARE_M_SIMD (r0, r1, r2, r3); - } -} - -KERNEL_FQ void m27000_sxx (KERN_ATTR_VECTOR ()) -{ - /** - * modifier - */ - - const u64 gid = get_global_id (0); - const u64 lid = get_local_id (0); - const u64 lsz = get_local_size (0); - - /** - * sbox, kbox - */ - - #ifdef REAL_SHM - - LOCAL_VK u32 s_SPtrans[8][64]; - LOCAL_VK u32 s_skb[8][64]; - - for (u32 i = lid; i < 64; i += lsz) - { - s_SPtrans[0][i] = c_SPtrans[0][i]; - s_SPtrans[1][i] = c_SPtrans[1][i]; - s_SPtrans[2][i] = c_SPtrans[2][i]; - s_SPtrans[3][i] = c_SPtrans[3][i]; - s_SPtrans[4][i] = c_SPtrans[4][i]; - s_SPtrans[5][i] = c_SPtrans[5][i]; - s_SPtrans[6][i] = c_SPtrans[6][i]; - s_SPtrans[7][i] = c_SPtrans[7][i]; - - s_skb[0][i] = c_skb[0][i]; - s_skb[1][i] = c_skb[1][i]; - s_skb[2][i] = c_skb[2][i]; - s_skb[3][i] = c_skb[3][i]; - s_skb[4][i] = c_skb[4][i]; - s_skb[5][i] = c_skb[5][i]; - s_skb[6][i] = c_skb[6][i]; - s_skb[7][i] = c_skb[7][i]; - } - - SYNC_THREADS (); - - #else - - CONSTANT_AS u32a (*s_SPtrans)[64] = c_SPtrans; - CONSTANT_AS u32a (*s_skb)[64] = c_skb; - - #endif - - 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] - }; - - /** - * salt - */ - - const u32 s0 = salt_bufs[SALT_POS].salt_buf[0]; - const u32 s1 = salt_bufs[SALT_POS].salt_buf[1]; - const u32 s2 = salt_bufs[SALT_POS].salt_buf[2]; - - /** - * 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]; - } - - /** - * 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; - - // md4_ctx_vector_t ctx; - - // md4_init_vector (&ctx); - - // md4_update_vector_utf16le (&ctx, w, pw_len); - - // md4_final_vector (&ctx); - - const u32x a = w[0]; - const u32x b = w[1]; - const u32x c = w[2]; - const u32x d = w[3]; - - if (MATCHES_NONE_VS ((d >> 16), s2)) continue; - - /** - * DES1 - */ - - u32x key[2]; - - transform_netntlmv1_key (a, b, key); - - u32x Kc[16]; - u32x Kd[16]; - - _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); - - u32x data[2]; - - data[0] = s0; - data[1] = s1; - - u32x out1[2]; - - _des_crypt_encrypt (out1, data, Kc, Kd, s_SPtrans); - - /** - * DES2 - */ - - - transform_netntlmv1_key (((b >> 24) | (c << 8)), ((c >> 24) | (d << 8)), key); - - _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); - - u32x out2[2]; - - _des_crypt_encrypt (out2, data, Kc, Kd, s_SPtrans); - - - const u32x r0 = out1[0]; - const u32x r1 = out1[1]; - const u32x r2 = out2[0]; - const u32x r3 = out2[1]; - - COMPARE_S_SIMD (r0, r1, r2, r3); - } -} From 32b4a2cfd59709bd8b2a1f66ce01fef484e70b5f Mon Sep 17 00:00:00 2001 From: Cablethief Date: Thu, 15 Jul 2021 16:50:26 +0200 Subject: [PATCH 10/64] Modded test, same issue about requireing a HEX input or HEX[] input --- tools/test_modules/m27000.pm | 178 +++++++++++++++++++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 tools/test_modules/m27000.pm diff --git a/tools/test_modules/m27000.pm b/tools/test_modules/m27000.pm new file mode 100644 index 000000000..42f40985c --- /dev/null +++ b/tools/test_modules/m27000.pm @@ -0,0 +1,178 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; + +use Authen::Passphrase::NTHash; +use Digest::HMAC qw (hmac hmac_hex); +use Digest::MD5 qw (md5); +use Encode qw (encode); +use Crypt::ECB qw (encrypt); + +sub setup_des_key +{ + my @key_56 = split (//, shift); + + my $key = ""; + + $key = $key_56[0]; + + $key .= chr (((ord ($key_56[0]) << 7) | (ord ($key_56[1]) >> 1)) & 255); + $key .= chr (((ord ($key_56[1]) << 6) | (ord ($key_56[2]) >> 2)) & 255); + $key .= chr (((ord ($key_56[2]) << 5) | (ord ($key_56[3]) >> 3)) & 255); + $key .= chr (((ord ($key_56[3]) << 4) | (ord ($key_56[4]) >> 4)) & 255); + $key .= chr (((ord ($key_56[4]) << 3) | (ord ($key_56[5]) >> 5)) & 255); + $key .= chr (((ord ($key_56[5]) << 2) | (ord ($key_56[6]) >> 6)) & 255); + $key .= chr (( ord ($key_56[6]) << 1) & 255); + + return $key; +} + +sub get_random_netntlmv1_salt +{ + my $len_user = shift; + my $len_domain = shift; + + my $char; + my $type; + my $user = ""; + + for (my $i = 0; $i < $len_user; $i++) + { + $type = random_number (1, 3); + + if ($type == 1) + { + $char = random_numeric_string (1); + } + elsif ($type == 2) + { + $char = random_uppercase_string (1); + } + else + { + $char = random_lowercase_string (1); + } + + $user .= $char; + } + + my $domain = ""; + + for (my $i = 0; $i < $len_domain; $i++) + { + $type = random_number (1, 3); + + if ($type == 1) + { + $char = random_numeric_string (1); + } + elsif ($type == 2) + { + $char = random_uppercase_string (1); + } + else + { + $char = random_lowercase_string (1); + } + + $domain .= $char; + } + + my $c_challenge = random_bytes (8); + my $s_challenge = random_bytes (8); + + my $salt_buf = $user . "::" . $domain . ":" . unpack ("H*", $c_challenge) . unpack ("H*", $s_challenge); + + return $salt_buf; +} + +sub module_constraints { [[32, 32], [-1, -1], [0, 27], [-1, -1], [-1, -1]] } # room for improvement in pure kernel mode + +sub module_generate_hash +{ + my $word = shift; + my $unused = shift; + my $salt = shift // get_random_netntlmv1_salt (random_number (0, 15), random_number (0, 15)); + + my $index1 = index ($salt, "::"); + my $user = substr ($salt, 0, $index1); + + my $index2 = index ($salt, ":", $index1 + 2); + my $domain = substr ($salt, $index1 + 2, $index2 - $index1 - 2); + + my $len = length (substr ($salt, $index2 + 1)); + + my $c_challenge_hex; + + if ($len > 32) + { + $c_challenge_hex = substr ($salt, $index2 + 1, 48); + $index2 += 32; + } + else + { + $c_challenge_hex = substr ($salt, $index2 + 1, 16); + $c_challenge_hex .= 00 x 32; + } + + my $c_challenge = pack ("H*", substr ($c_challenge_hex, 0, 16)); + my $s_challenge_hex = substr ($salt, $index2 + 17, 16); + my $s_challenge = pack ("H*", $s_challenge_hex); + + my $challenge = substr (md5 ($s_challenge . $c_challenge), 0, 8); + + my $ntresp; + + # my $nthash = pack_if_HEX_notation ($word); + my $nthash = pack ("H*", $word); + my $nthashpadded = $nthash . "\x00" x 5; + + $ntresp .= Crypt::ECB::encrypt (setup_des_key (substr ($nthashpadded, 0, 7)), "DES", $challenge, "none"); + $ntresp .= Crypt::ECB::encrypt (setup_des_key (substr ($nthashpadded, 7, 7)), "DES", $challenge, "none"); + $ntresp .= Crypt::ECB::encrypt (setup_des_key (substr ($nthashpadded, 14, 7)), "DES", $challenge, "none"); + + my $tmp_hash = sprintf ("%s::%s:%s:%s:%s", $user, $domain, $c_challenge_hex, unpack ("H*", $ntresp), $s_challenge_hex); + + return $tmp_hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my $index1 = index ($line, "::"); + + return if $index1 < 1; + + my $index2 = index ($line, ":", $index1 + 2); + + return if $index2 < 1; + + $index2 = index ($line, ":", $index2 + 1); + + return if $index2 < 1; + + my $salt = substr ($line, 0, $index2 - 32); + + $index2 = index ($line, ":", $index2 + 1); + + return if $index2 < 1; + + $salt .= substr ($line, $index2 + 1, 16); + + my $word = substr ($line, $index2 + 1 + 16 + 1); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed, undef, $salt); + + return ($new_hash, $word); +} + +1; From a6ae33b1cd68d4543efad71c456d59bae4b93b90 Mon Sep 17 00:00:00 2001 From: Michael Kruger Date: Fri, 16 Jul 2021 15:38:42 +0200 Subject: [PATCH 11/64] Changed the test cases to expect the HEX --- tools/test_modules/m27000.pm | 5 ++--- tools/test_modules/m27100.pm | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/test_modules/m27000.pm b/tools/test_modules/m27000.pm index 42f40985c..e77e471ea 100644 --- a/tools/test_modules/m27000.pm +++ b/tools/test_modules/m27000.pm @@ -8,7 +8,6 @@ use strict; use warnings; -use Authen::Passphrase::NTHash; use Digest::HMAC qw (hmac hmac_hex); use Digest::MD5 qw (md5); use Encode qw (encode); @@ -129,8 +128,8 @@ sub module_generate_hash my $ntresp; - # my $nthash = pack_if_HEX_notation ($word); - my $nthash = pack ("H*", $word); + my $nthash = pack_if_HEX_notation ($word); + # my $nthash = pack ("H*", $word); my $nthashpadded = $nthash . "\x00" x 5; $ntresp .= Crypt::ECB::encrypt (setup_des_key (substr ($nthashpadded, 0, 7)), "DES", $challenge, "none"); diff --git a/tools/test_modules/m27100.pm b/tools/test_modules/m27100.pm index 14e4a9234..851cadc49 100644 --- a/tools/test_modules/m27100.pm +++ b/tools/test_modules/m27100.pm @@ -29,8 +29,8 @@ sub module_generate_hash my $b_srv_ch = pack ('H*', $srv_ch); my $b_cli_ch = pack ('H*', $cli_ch); - # my $nthash = pack_if_HEX_notation ($word); - my $nthash = pack ("H*", $word); + my $nthash = pack_if_HEX_notation ($word); + # my $nthash = pack ("H*", $word); my $identity = encode ('UTF-16LE', uc ($user) . $domain); my $digest = hmac_hex ($b_srv_ch . $b_cli_ch, hmac ($identity, $nthash, \&md5, 64), \&md5, 64); From 39e78702e0b17ecba3a90f0281052117f46230ba Mon Sep 17 00:00:00 2001 From: Michael Kruger Date: Fri, 16 Jul 2021 16:01:57 +0200 Subject: [PATCH 12/64] Move gid check below SHM stuff to imitate m06232 --- OpenCL/m27000-pure.cl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenCL/m27000-pure.cl b/OpenCL/m27000-pure.cl index d948d69b0..a5ce12cff 100644 --- a/OpenCL/m27000-pure.cl +++ b/OpenCL/m27000-pure.cl @@ -544,8 +544,6 @@ KERNEL_FQ void m27000_loop (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) const u64 lid = get_local_id (0); const u64 gid = get_global_id (0); - if (gid >= gid_max) return; - /** * sbox, kbox */ @@ -585,6 +583,8 @@ KERNEL_FQ void m27000_loop (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) #endif + if (gid >= gid_max) return; + /** * base */ From 2c2988518d4aa71bd3e83ba7c2c767884e92801c Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Thu, 22 Jul 2021 13:59:19 +0300 Subject: [PATCH 13/64] Remove all calls to clFlush() --- src/backend.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/backend.c b/src/backend.c index 31d6bade1..ae728fbe7 100644 --- a/src/backend.c +++ b/src/backend.c @@ -5377,7 +5377,7 @@ int run_opencl_kernel_atinit (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *dev if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL) == -1) return -1; - if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; + /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; @@ -5405,7 +5405,7 @@ int run_opencl_kernel_utf8toutf16le (hashcat_ctx_t *hashcat_ctx, hc_device_param if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL) == -1) return -1; - if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; + /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; @@ -5446,6 +5446,8 @@ int run_opencl_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *dev if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, buf, CL_FALSE, num16d * 16, num16m, tmp, 0, NULL, NULL) == -1) return -1; } + /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ + if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; return 0; @@ -5484,6 +5486,8 @@ int run_opencl_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *devi if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, buf, CL_FALSE, num16d * 16, num16m, tmp, 0, NULL, NULL) == -1) return -1; } + /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ + if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; return 0; @@ -5857,7 +5861,7 @@ int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, con if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, opencl_kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, &opencl_event) == -1) return -1; - if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; + /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ // spin damper section @@ -6082,7 +6086,7 @@ int run_kernel_mp (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, opencl_kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL) == -1) return -1; - if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; + /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; } @@ -6123,7 +6127,7 @@ int run_kernel_tm (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, cuda_kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL) == -1) return -1; - if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; + /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; } @@ -6174,7 +6178,7 @@ int run_kernel_amp (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, opencl_kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL) == -1) return -1; - if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; + /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; } @@ -6225,7 +6229,7 @@ int run_kernel_decompress (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, opencl_kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL) == -1) return -1; - if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; + /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; } From fafd24237d8bad4f662d0eb63e98ea9d16c49b38 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Thu, 22 Jul 2021 14:24:03 +0300 Subject: [PATCH 14/64] Define HC_ALIGN macro to control data alignment and use common constant zero buffer in run_cuda_kernel_bzero(), run_hip_kernel_bzero() and run_opencl_kernel_bzero(). --- include/common.h | 8 ++++++++ src/backend.c | 27 ++++++--------------------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/include/common.h b/include/common.h index 445ebc405..3da61bc6c 100644 --- a/include/common.h +++ b/include/common.h @@ -63,6 +63,14 @@ #define HC_API_CALL #endif +#if defined (__GNUC__) +#define HC_ALIGN(x) __attribute__((aligned(x))) +#elif defined (_MSC_VER) +#define HC_ALIGN(x) __declspec(align(x)) +#else +#define HC_ALIGN(x) +#endif + #if defined (_WIN) #define WIN32_LEAN_AND_MEAN #endif diff --git a/src/backend.c b/src/backend.c index ae728fbe7..af8cd7c2a 100644 --- a/src/backend.c +++ b/src/backend.c @@ -38,6 +38,9 @@ static const u32 full80 = 0x80808080; static double TARGET_MSEC_PROFILE[4] = { 2, 12, 96, 480 }; +HC_ALIGN(16) +static const u32 bzeros[4] = { 0, 0, 0, 0 }; + static bool is_same_device (const hc_device_param_t *src, const hc_device_param_t *dst) { // First check by PCI address @@ -5214,7 +5217,6 @@ int run_cuda_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device { const u64 num16d = size / 16; const u64 num16m = size % 16; - u32 tmp[4]; if (num16d) { @@ -5232,12 +5234,7 @@ int run_cuda_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device if (num16m) { - tmp[0] = 0; - tmp[1] = 0; - tmp[2] = 0; - tmp[3] = 0; - - if (hc_cuMemcpyHtoDAsync (hashcat_ctx, buf + (num16d * 16), tmp, num16m, device_param->cuda_stream) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, buf + (num16d * 16), bzeros, num16m, device_param->cuda_stream) == -1) return -1; } if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; @@ -5325,7 +5322,6 @@ int run_hip_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_ { const u64 num16d = size / 16; const u64 num16m = size % 16; - u32 tmp[4]; if (num16d) { @@ -5343,12 +5339,7 @@ int run_hip_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_ if (num16m) { - tmp[0] = 0; - tmp[1] = 0; - tmp[2] = 0; - tmp[3] = 0; - - if (hc_hipMemcpyHtoDAsync (hashcat_ctx, buf + (num16d * 16), tmp, num16m, device_param->hip_stream) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, buf + (num16d * 16), bzeros, num16m, device_param->hip_stream) == -1) return -1; } if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; @@ -5457,7 +5448,6 @@ int run_opencl_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *devi { const u64 num16d = size / 16; const u64 num16m = size % 16; - u32 tmp[4]; if (num16d) { @@ -5478,12 +5468,7 @@ int run_opencl_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *devi if (num16m) { - tmp[0] = 0; - tmp[1] = 0; - tmp[2] = 0; - tmp[3] = 0; - - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, buf, CL_FALSE, num16d * 16, num16m, tmp, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, buf, CL_FALSE, num16d * 16, num16m, bzeros, 0, NULL, NULL) == -1) return -1; } /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ From 9f9333f2efeb9c0858cca9e8cebec9a4b64e2bbc Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Thu, 22 Jul 2021 15:18:10 +0300 Subject: [PATCH 15/64] Allow async execution of run_opencl_kernel_bzero(), run_hip_kernel_bzero() and run_opencl_kernel_bzero() --- src/backend.c | 10 +++++----- src/selftest.c | 9 +++++++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/backend.c b/src/backend.c index af8cd7c2a..2b52b4cde 100644 --- a/src/backend.c +++ b/src/backend.c @@ -5068,12 +5068,12 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, { if (device_param->is_cuda == true) { - if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_hooks, pws_cnt * hashconfig->hook_size) == -1) return -1; + if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_hooks, pws_cnt * hashconfig->hook_size) == -1) return -1; } if (device_param->is_hip == true) { - if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_hooks, pws_cnt * hashconfig->hook_size) == -1) return -1; + if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_hooks, pws_cnt * hashconfig->hook_size) == -1) return -1; } if (device_param->is_opencl == true) @@ -5237,7 +5237,7 @@ int run_cuda_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device if (hc_cuMemcpyHtoDAsync (hashcat_ctx, buf + (num16d * 16), bzeros, num16m, device_param->cuda_stream) == -1) return -1; } - if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; + /*if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1;*/ return 0; } @@ -5342,7 +5342,7 @@ int run_hip_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_ if (hc_hipMemcpyHtoDAsync (hashcat_ctx, buf + (num16d * 16), bzeros, num16m, device_param->hip_stream) == -1) return -1; } - if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; + /*if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1;*/ return 0; } @@ -5473,7 +5473,7 @@ int run_opencl_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *devi /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ - if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; + /*if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ return 0; } diff --git a/src/selftest.c b/src/selftest.c index 4f8dc1092..41906ad73 100644 --- a/src/selftest.c +++ b/src/selftest.c @@ -903,13 +903,22 @@ HC_API_CALL void *thread_selftest (void *p) if (device_param->is_cuda == true) { + if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return NULL; + if (hc_cuCtxPopCurrent (hashcat_ctx, &device_param->cuda_context) == -1) return NULL; } if (device_param->is_hip == true) { + if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return NULL; + if (hc_hipCtxPopCurrent (hashcat_ctx, &device_param->hip_context) == -1) return NULL; } + + if (device_param->is_opencl == true) + { + if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return NULL; + } return NULL; } From 4bd736367420b399b04738f5d33e9756842b51d5 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Sun, 25 Jul 2021 22:18:16 +0300 Subject: [PATCH 16/64] Add missing HIP declarations --- include/backend.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/backend.h b/include/backend.h index 957ac229d..baa94b50c 100644 --- a/include/backend.h +++ b/include/backend.h @@ -120,8 +120,11 @@ int hc_hipInit (hashcat_ctx_t *hashcat_ctx, unsigned int Flags int hc_hipLaunchKernel (hashcat_ctx_t *hashcat_ctx, HIPfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, HIPstream hStream, void **kernelParams, void **extra); int hc_hipMemAlloc (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr *dptr, size_t bytesize); int hc_hipMemcpyDtoD (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dstDevice, HIPdeviceptr srcDevice, size_t ByteCount); +int hc_hipMemcpyDtoDAsync (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dstDevice, HIPdeviceptr srcDevice, size_t ByteCount, HIPstream hStream); int hc_hipMemcpyDtoH (hashcat_ctx_t *hashcat_ctx, void *dstHost, HIPdeviceptr srcDevice, size_t ByteCount); +int hc_hipMemcpyDtoHAsync (hashcat_ctx_t *hashcat_ctx, void *dstHost, HIPdeviceptr srcDevice, size_t ByteCount, HIPstream hStream); int hc_hipMemcpyHtoD (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dstDevice, const void *srcHost, size_t ByteCount); +int hc_hipMemcpyHtoDAsync (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dstDevice, const void *srcHost, size_t ByteCount, HIPstream hStream); int hc_hipMemFree (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dptr); int hc_hipModuleGetFunction (hashcat_ctx_t *hashcat_ctx, HIPfunction *hfunc, HIPmodule hmod, const char *name); int hc_hipModuleLoadDataEx (hashcat_ctx_t *hashcat_ctx, HIPmodule *module, const void *image, unsigned int numOptions, HIPjit_option *options, void **optionValues); From 79404b1ff12ca30686cfb0014126d873cd957cad Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Sun, 25 Jul 2021 22:19:50 +0300 Subject: [PATCH 17/64] Allow async execution of selftest() --- src/selftest.c | 131 ++++++++++++++++++++++++++++++------------------- 1 file changed, 81 insertions(+), 50 deletions(-) diff --git a/src/selftest.c b/src/selftest.c index 41906ad73..77ad8f23b 100644 --- a/src/selftest.c +++ b/src/selftest.c @@ -95,17 +95,17 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (device_param->is_cuda == true) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_buf, &pw, 1 * sizeof (pw_t)) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_pws_buf, &pw, 1 * sizeof (pw_t), device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_pws_buf, &pw, 1 * sizeof (pw_t)) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_pws_buf, &pw, 1 * sizeof (pw_t), device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_buf, CL_TRUE, 0, 1 * sizeof (pw_t), &pw, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_buf, CL_FALSE, 0, 1 * sizeof (pw_t), &pw, 0, NULL, NULL) == -1) return -1; } } else @@ -135,17 +135,17 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (device_param->is_cuda == true) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_buf, &pw, 1 * sizeof (pw_t)) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_pws_buf, &pw, 1 * sizeof (pw_t), device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_pws_buf, &pw, 1 * sizeof (pw_t)) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_pws_buf, &pw, 1 * sizeof (pw_t), device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_buf, CL_TRUE, 0, 1 * sizeof (pw_t), &pw, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_buf, CL_FALSE, 0, 1 * sizeof (pw_t), &pw, 0, NULL, NULL) == -1) return -1; } } else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) @@ -202,23 +202,23 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (device_param->is_cuda == true) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_combs_c, &comb, 1 * sizeof (pw_t)) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_combs_c, &comb, 1 * sizeof (pw_t), device_param->cuda_stream) == -1) return -1; - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_buf, &pw, 1 * sizeof (pw_t)) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_pws_buf, &pw, 1 * sizeof (pw_t), device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_combs_c, &comb, 1 * sizeof (pw_t)) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_combs_c, &comb, 1 * sizeof (pw_t), device_param->hip_stream) == -1) return -1; - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_pws_buf, &pw, 1 * sizeof (pw_t)) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_pws_buf, &pw, 1 * sizeof (pw_t), device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_combs_c, CL_TRUE, 0, 1 * sizeof (pw_t), &comb, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_combs_c, CL_FALSE, 0, 1 * sizeof (pw_t), &comb, 0, NULL, NULL) == -1) return -1; - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_buf, CL_TRUE, 0, 1 * sizeof (pw_t), &pw, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_buf, CL_FALSE, 0, 1 * sizeof (pw_t), &pw, 0, NULL, NULL) == -1) return -1; } } else if (user_options_extra->attack_kern == ATTACK_KERN_BF) @@ -246,17 +246,17 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (device_param->is_cuda == true) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_buf, &pw, 1 * sizeof (pw_t)) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_pws_buf, &pw, 1 * sizeof (pw_t), device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_pws_buf, &pw, 1 * sizeof (pw_t)) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_pws_buf, &pw, 1 * sizeof (pw_t), device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_buf, CL_TRUE, 0, 1 * sizeof (pw_t), &pw, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_buf, CL_FALSE, 0, 1 * sizeof (pw_t), &pw, 0, NULL, NULL) == -1) return -1; } } else @@ -302,17 +302,17 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (device_param->is_cuda == true) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_bfs_c, &bf, 1 * sizeof (bf_t)) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_bfs_c, &bf, 1 * sizeof (bf_t), device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_bfs_c, &bf, 1 * sizeof (bf_t)) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_bfs_c, &bf, 1 * sizeof (bf_t), device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_bfs_c, CL_TRUE, 0, 1 * sizeof (bf_t), &bf, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_bfs_c, CL_FALSE, 0, 1 * sizeof (bf_t), &bf, 0, NULL, NULL) == -1) return -1; } pw_t pw; @@ -403,17 +403,17 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (device_param->is_cuda == true) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_buf, &pw, 1 * sizeof (pw_t)) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_pws_buf, &pw, 1 * sizeof (pw_t), device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_pws_buf, &pw, 1 * sizeof (pw_t)) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_pws_buf, &pw, 1 * sizeof (pw_t), device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_buf, CL_TRUE, 0, 1 * sizeof (pw_t), &pw, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_buf, CL_FALSE, 0, 1 * sizeof (pw_t), &pw, 0, NULL, NULL) == -1) return -1; } highest_pw_len = pw.pw_len; @@ -436,17 +436,17 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (device_param->is_cuda == true) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_buf, &pw, 1 * sizeof (pw_t)) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_pws_buf, &pw, 1 * sizeof (pw_t), device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_pws_buf, &pw, 1 * sizeof (pw_t)) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_pws_buf, &pw, 1 * sizeof (pw_t), device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_buf, CL_TRUE, 0, 1 * sizeof (pw_t), &pw, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_buf, CL_FALSE, 0, 1 * sizeof (pw_t), &pw, 0, NULL, NULL) == -1) return -1; } } } @@ -509,12 +509,16 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (device_param->is_cuda == true) { - if (hc_cuMemcpyDtoH (hashcat_ctx, device_param->hooks_buf, device_param->cuda_d_hooks, device_param->size_hooks) == -1) return -1; + if (hc_cuMemcpyDtoHAsync (hashcat_ctx, device_param->hooks_buf, device_param->cuda_d_hooks, device_param->size_hooks, device_param->cuda_stream) == -1) return -1; + + if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyDtoH (hashcat_ctx, device_param->hooks_buf, device_param->hip_d_hooks, device_param->size_hooks) == -1) return -1; + if (hc_hipMemcpyDtoHAsync (hashcat_ctx, device_param->hooks_buf, device_param->hip_d_hooks, device_param->size_hooks, device_param->hip_stream) == -1) return -1; + + if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) @@ -526,17 +530,17 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (device_param->is_cuda == true) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_hooks, device_param->hooks_buf, device_param->size_hooks) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_hooks, device_param->hooks_buf, device_param->size_hooks, device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_hooks, device_param->hooks_buf, device_param->size_hooks) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_hooks, device_param->hooks_buf, device_param->size_hooks, device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_hooks, CL_TRUE, 0, device_param->size_hooks, device_param->hooks_buf, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_hooks, CL_FALSE, 0, device_param->size_hooks, device_param->hooks_buf, 0, NULL, NULL) == -1) return -1; } } @@ -582,12 +586,16 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (device_param->is_cuda == true) { - if (hc_cuMemcpyDtoH (hashcat_ctx, device_param->hooks_buf, device_param->cuda_d_hooks, device_param->size_hooks) == -1) return -1; + if (hc_cuMemcpyDtoHAsync (hashcat_ctx, device_param->hooks_buf, device_param->cuda_d_hooks, device_param->size_hooks, device_param->cuda_stream) == -1) return -1; + + if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyDtoH (hashcat_ctx, device_param->hooks_buf, device_param->hip_d_hooks, device_param->size_hooks) == -1) return -1; + if (hc_hipMemcpyDtoHAsync (hashcat_ctx, device_param->hooks_buf, device_param->hip_d_hooks, device_param->size_hooks, device_param->hip_stream) == -1) return -1; + + if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) @@ -599,17 +607,17 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (device_param->is_cuda == true) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_hooks, device_param->hooks_buf, device_param->size_hooks) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_hooks, device_param->hooks_buf, device_param->size_hooks, device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_hooks, device_param->hooks_buf, device_param->size_hooks) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_hooks, device_param->hooks_buf, device_param->size_hooks, device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_hooks, CL_TRUE, 0, device_param->size_hooks, device_param->hooks_buf, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_hooks, CL_FALSE, 0, device_param->size_hooks, device_param->hooks_buf, 0, NULL, NULL) == -1) return -1; } } } @@ -681,19 +689,25 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param u32 num_cracked = 0; + cl_event opencl_event; + if (device_param->is_cuda == true) { - if (hc_cuMemcpyDtoH (hashcat_ctx, &num_cracked, device_param->cuda_d_result, sizeof (u32)) == -1) return -1; + if (hc_cuMemcpyDtoHAsync (hashcat_ctx, &num_cracked, device_param->cuda_d_result, sizeof (u32), device_param->cuda_stream) == -1) return -1; + + if (hc_cuEventRecord (hashcat_ctx, device_param->cuda_event1, device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyDtoH (hashcat_ctx, &num_cracked, device_param->hip_d_result, sizeof (u32)) == -1) return -1; + if (hc_hipMemcpyDtoHAsync (hashcat_ctx, &num_cracked, device_param->hip_d_result, sizeof (u32), device_param->hip_stream) == -1) return -1; + + if (hc_hipEventRecord (hashcat_ctx, device_param->hip_event1, device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) { - if (hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_result, CL_TRUE, 0, sizeof (u32), &num_cracked, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_result, CL_FALSE, 0, sizeof (u32), &num_cracked, 0, NULL, &opencl_event) == -1) return -1; } // finish : cleanup and restore @@ -712,12 +726,12 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param device_param->kernel_params[17] = &device_param->cuda_d_salt_bufs; device_param->kernel_params[18] = &device_param->cuda_d_esalt_bufs; - if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_pws_buf, device_param->size_pws) == -1) return -1; - if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_tmps, device_param->size_tmps) == -1) return -1; - if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_hooks, device_param->size_hooks) == -1) return -1; - if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_plain_bufs, device_param->size_plains) == -1) return -1; - if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_digests_shown, device_param->size_shown) == -1) return -1; - if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_result, device_param->size_results) == -1) return -1; + if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_pws_buf, device_param->size_pws) == -1) return -1; + if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_tmps, device_param->size_tmps) == -1) return -1; + if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_hooks, device_param->size_hooks) == -1) return -1; + if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_plain_bufs, device_param->size_plains) == -1) return -1; + if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_digests_shown, device_param->size_shown) == -1) return -1; + if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_result, device_param->size_results) == -1) return -1; } if (device_param->is_hip == true) @@ -726,12 +740,12 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param device_param->kernel_params[17] = &device_param->hip_d_salt_bufs; device_param->kernel_params[18] = &device_param->hip_d_esalt_bufs; - if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_pws_buf, device_param->size_pws) == -1) return -1; - if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_tmps, device_param->size_tmps) == -1) return -1; - if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_hooks, device_param->size_hooks) == -1) return -1; - if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_plain_bufs, device_param->size_plains) == -1) return -1; - if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_digests_shown, device_param->size_shown) == -1) return -1; - if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_result, device_param->size_results) == -1) return -1; + if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_pws_buf, device_param->size_pws) == -1) return -1; + if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_tmps, device_param->size_tmps) == -1) return -1; + if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_hooks, device_param->size_hooks) == -1) return -1; + if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_plain_bufs, device_param->size_plains) == -1) return -1; + if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_digests_shown, device_param->size_shown) == -1) return -1; + if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_result, device_param->size_results) == -1) return -1; } if (device_param->is_opencl == true) @@ -820,8 +834,25 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param } } - // check return + // synchronize and .. + if (device_param->is_cuda == true) + { + if (hc_cuEventSynchronize (hashcat_ctx, device_param->cuda_event1) == -1) return -1; + } + if (device_param->is_hip == true) + { + if (hc_hipEventSynchronize (hashcat_ctx, device_param->hip_event1) == -1) return -1; + } + + if (device_param->is_opencl == true) + { + if (hc_clWaitForEvents (hashcat_ctx, 1, &opencl_event) == -1) return -1; + + if (hc_clReleaseEvent (hashcat_ctx, opencl_event) == -1) return -1; + } + + // check return if (num_cracked == 0) { hc_thread_mutex_lock (status_ctx->mux_display); From a86b44a7501569378b148d3999cd07e6fb1fb954 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Mon, 26 Jul 2021 01:51:19 +0300 Subject: [PATCH 18/64] Allow async execution of autotune() and prepare try_run() for async kernel execution --- src/autotune.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/autotune.c b/src/autotune.c index cdeb73553..e8148daf7 100644 --- a/src/autotune.c +++ b/src/autotune.c @@ -37,6 +37,23 @@ static double try_run (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par device_param->spin_damp = 0; + if (device_param->is_cuda == true) + { + if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; + } + + if (device_param->is_hip == true) + { + if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; + } + + if (device_param->is_opencl == true) + { + /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ + + if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; + } + if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) { if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) @@ -60,6 +77,23 @@ static double try_run (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par run_kernel (hashcat_ctx, device_param, KERN_RUN_2, 0, kernel_power_try, true, 0); } + if (device_param->is_cuda == true) + { + if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; + } + + if (device_param->is_hip == true) + { + if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; + } + + if (device_param->is_opencl == true) + { + /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ + + if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; + } + device_param->spin_damp = spin_damp_sav; const double exec_msec_prev = get_avg_exec_time (device_param, 1); @@ -200,14 +234,14 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param { if (device_param->is_cuda == true) { - CU_rc = hc_cuMemcpyDtoD (hashcat_ctx, device_param->cuda_d_rules_c, device_param->cuda_d_rules, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t)); + CU_rc = hc_cuMemcpyDtoDAsync (hashcat_ctx, device_param->cuda_d_rules_c, device_param->cuda_d_rules, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t), device_param->cuda_stream); if (CU_rc == -1) return -1; } if (device_param->is_hip == true) { - HIP_rc = hc_hipMemcpyDtoD (hashcat_ctx, device_param->hip_d_rules_c, device_param->hip_d_rules, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t)); + HIP_rc = hc_hipMemcpyDtoDAsync (hashcat_ctx, device_param->hip_d_rules_c, device_param->hip_d_rules, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t), device_param->hip_stream); if (HIP_rc == -1) return -1; } From de5200cffccabe389ddceca6ac1f23f301bafb6e Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Mon, 26 Jul 2021 15:17:25 +0300 Subject: [PATCH 19/64] Allow async execution of backend --- src/backend.c | 300 ++++++++++++++++++++++---------------------------- 1 file changed, 130 insertions(+), 170 deletions(-) diff --git a/src/backend.c b/src/backend.c index 2b52b4cde..9631e8dd2 100644 --- a/src/backend.c +++ b/src/backend.c @@ -4513,7 +4513,9 @@ int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, c { if (hc_cuCtxPushCurrent (hashcat_ctx, device_param->cuda_context) == -1) return -1; - if (hc_cuMemcpyDtoH (hashcat_ctx, &pw_idx, device_param->cuda_d_pws_idx + (gidd * sizeof (pw_idx_t)), sizeof (pw_idx_t)) == -1) return -1; + if (hc_cuMemcpyDtoHAsync (hashcat_ctx, &pw_idx, device_param->cuda_d_pws_idx + (gidd * sizeof (pw_idx_t)), sizeof (pw_idx_t), device_param->cuda_stream) == -1) return -1; + + if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; if (hc_cuCtxPopCurrent (hashcat_ctx, &device_param->cuda_context) == -1) return -1; } @@ -4522,7 +4524,9 @@ int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, c { if (hc_hipCtxPushCurrent (hashcat_ctx, device_param->hip_context) == -1) return -1; - if (hc_hipMemcpyDtoH (hashcat_ctx, &pw_idx, device_param->hip_d_pws_idx + (gidd * sizeof (pw_idx_t)), sizeof (pw_idx_t)) == -1) return -1; + if (hc_hipMemcpyDtoHAsync (hashcat_ctx, &pw_idx, device_param->hip_d_pws_idx + (gidd * sizeof (pw_idx_t)), sizeof (pw_idx_t), device_param->hip_stream) == -1) return -1; + + if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; if (hc_hipCtxPopCurrent (hashcat_ctx, &device_param->hip_context) == -1) return -1; } @@ -4542,7 +4546,9 @@ int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, c { if (hc_cuCtxPushCurrent (hashcat_ctx, device_param->cuda_context) == -1) return -1; - if (hc_cuMemcpyDtoH (hashcat_ctx,pw->i, device_param->cuda_d_pws_comp_buf + (off * sizeof (u32)), cnt * sizeof (u32)) == -1) return -1; + if (hc_cuMemcpyDtoHAsync (hashcat_ctx,pw->i, device_param->cuda_d_pws_comp_buf + (off * sizeof (u32)), cnt * sizeof (u32), device_param->cuda_stream) == -1) return -1; + + if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; if (hc_cuCtxPopCurrent (hashcat_ctx, &device_param->cuda_context) == -1) return -1; } @@ -4554,7 +4560,9 @@ int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, c { if (hc_hipCtxPushCurrent (hashcat_ctx, device_param->hip_context) == -1) return -1; - if (hc_hipMemcpyDtoH (hashcat_ctx,pw->i, device_param->hip_d_pws_comp_buf + (off * sizeof (u32)), cnt * sizeof (u32)) == -1) return -1; + if (hc_hipMemcpyDtoHAsync (hashcat_ctx,pw->i, device_param->hip_d_pws_comp_buf + (off * sizeof (u32)), cnt * sizeof (u32), device_param->hip_stream) == -1) return -1; + + if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; if (hc_hipCtxPopCurrent (hashcat_ctx, &device_param->hip_context) == -1) return -1; } @@ -4623,12 +4631,12 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, if (device_param->is_cuda == true) { - if (hc_cuMemcpyDtoD (hashcat_ctx, device_param->cuda_d_bfs_c, device_param->cuda_d_tm_c, size_tm) == -1) return -1; + if (hc_cuMemcpyDtoDAsync (hashcat_ctx, device_param->cuda_d_bfs_c, device_param->cuda_d_tm_c, size_tm, device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyDtoD (hashcat_ctx, device_param->hip_d_bfs_c, device_param->hip_d_tm_c, size_tm) == -1) return -1; + if (hc_hipMemcpyDtoDAsync (hashcat_ctx, device_param->hip_d_bfs_c, device_param->hip_d_tm_c, size_tm, device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) @@ -4689,12 +4697,12 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, { if (device_param->is_cuda == true) { - if (hc_cuMemcpyDtoD (hashcat_ctx, device_param->cuda_d_pws_buf, device_param->cuda_d_pws_amp_buf, pws_cnt * sizeof (pw_t)) == -1) return -1; + if (hc_cuMemcpyDtoDAsync (hashcat_ctx, device_param->cuda_d_pws_buf, device_param->cuda_d_pws_amp_buf, pws_cnt * sizeof (pw_t), device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyDtoD (hashcat_ctx, device_param->hip_d_pws_buf, device_param->hip_d_pws_amp_buf, pws_cnt * sizeof (pw_t)) == -1) return -1; + if (hc_hipMemcpyDtoDAsync (hashcat_ctx, device_param->hip_d_pws_buf, device_param->hip_d_pws_amp_buf, pws_cnt * sizeof (pw_t), device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) @@ -4736,17 +4744,17 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, if (device_param->is_cuda == true) { - if (hc_cuMemcpyDtoH (hashcat_ctx, device_param->hooks_buf, device_param->cuda_d_hooks, pws_cnt * hashconfig->hook_size) == -1) return -1; + if (hc_cuMemcpyDtoHAsync (hashcat_ctx, device_param->hooks_buf, device_param->cuda_d_hooks, pws_cnt * hashconfig->hook_size, device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyDtoH (hashcat_ctx, device_param->hooks_buf, device_param->hip_d_hooks, pws_cnt * hashconfig->hook_size) == -1) return -1; + if (hc_hipMemcpyDtoHAsync (hashcat_ctx, device_param->hooks_buf, device_param->hip_d_hooks, pws_cnt * hashconfig->hook_size, device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) { - if (hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_hooks, CL_TRUE, 0, pws_cnt * hashconfig->hook_size, device_param->hooks_buf, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_hooks, CL_FALSE, 0, pws_cnt * hashconfig->hook_size, device_param->hooks_buf, 0, NULL, NULL) == -1) return -1; } const int hook_threads = (int) user_options->hook_threads; @@ -4790,17 +4798,17 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, if (device_param->is_cuda == true) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_hooks, device_param->hooks_buf, pws_cnt * hashconfig->hook_size) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_hooks, device_param->hooks_buf, pws_cnt * hashconfig->hook_size, device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_hooks, device_param->hooks_buf, pws_cnt * hashconfig->hook_size) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_hooks, device_param->hooks_buf, pws_cnt * hashconfig->hook_size, device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_hooks, CL_TRUE, 0, pws_cnt * hashconfig->hook_size, device_param->hooks_buf, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_hooks, CL_FALSE, 0, pws_cnt * hashconfig->hook_size, device_param->hooks_buf, 0, NULL, NULL) == -1) return -1; } } } @@ -4884,17 +4892,17 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, if (device_param->is_cuda == true) { - if (hc_cuMemcpyDtoH (hashcat_ctx, device_param->hooks_buf, device_param->cuda_d_hooks, pws_cnt * hashconfig->hook_size) == -1) return -1; + if (hc_cuMemcpyDtoHAsync (hashcat_ctx, device_param->hooks_buf, device_param->cuda_d_hooks, pws_cnt * hashconfig->hook_size, device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyDtoH (hashcat_ctx, device_param->hooks_buf, device_param->hip_d_hooks, pws_cnt * hashconfig->hook_size) == -1) return -1; + if (hc_hipMemcpyDtoHAsync (hashcat_ctx, device_param->hooks_buf, device_param->hip_d_hooks, pws_cnt * hashconfig->hook_size, device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) { - if (hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_hooks, CL_TRUE, 0, pws_cnt * hashconfig->hook_size, device_param->hooks_buf, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_hooks, CL_FALSE, 0, pws_cnt * hashconfig->hook_size, device_param->hooks_buf, 0, NULL, NULL) == -1) return -1; } const int hook_threads = (int) user_options->hook_threads; @@ -4938,17 +4946,17 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, if (device_param->is_cuda == true) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_hooks, device_param->hooks_buf, pws_cnt * hashconfig->hook_size) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_hooks, device_param->hooks_buf, pws_cnt * hashconfig->hook_size, device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_hooks, device_param->hooks_buf, pws_cnt * hashconfig->hook_size) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_hooks, device_param->hooks_buf, pws_cnt * hashconfig->hook_size, device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_hooks, CL_TRUE, 0, pws_cnt * hashconfig->hook_size, device_param->hooks_buf, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_hooks, CL_FALSE, 0, pws_cnt * hashconfig->hook_size, device_param->hooks_buf, 0, NULL, NULL) == -1) return -1; } } } @@ -5152,8 +5160,6 @@ int run_cuda_kernel_atinit (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *devic if (hc_cuLaunchKernel (hashcat_ctx, function, num_elements, 1, 1, kernel_threads, 1, 1, 0, device_param->cuda_stream, device_param->kernel_params_atinit, NULL) == -1) return -1; - if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; - return 0; } @@ -5172,8 +5178,6 @@ int run_cuda_kernel_utf8toutf16le (hashcat_ctx_t *hashcat_ctx, hc_device_param_t if (hc_cuLaunchKernel (hashcat_ctx, function, num_elements, 1, 1, kernel_threads, 1, 1, 0, device_param->cuda_stream, device_param->kernel_params_utf8toutf16le, NULL) == -1) return -1; - if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; - return 0; } @@ -5237,8 +5241,6 @@ int run_cuda_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device if (hc_cuMemcpyHtoDAsync (hashcat_ctx, buf + (num16d * 16), bzeros, num16m, device_param->cuda_stream) == -1) return -1; } - /*if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1;*/ - return 0; } @@ -5257,8 +5259,6 @@ int run_hip_kernel_atinit (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device if (hc_hipLaunchKernel (hashcat_ctx, function, num_elements, 1, 1, kernel_threads, 1, 1, 0, device_param->hip_stream, device_param->kernel_params_atinit, NULL) == -1) return -1; - if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; - return 0; } @@ -5277,8 +5277,6 @@ int run_hip_kernel_utf8toutf16le (hashcat_ctx_t *hashcat_ctx, hc_device_param_t if (hc_hipLaunchKernel (hashcat_ctx, function, num_elements, 1, 1, kernel_threads, 1, 1, 0, device_param->hip_stream, device_param->kernel_params_utf8toutf16le, NULL) == -1) return -1; - if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; - return 0; } @@ -5342,8 +5340,6 @@ int run_hip_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_ if (hc_hipMemcpyHtoDAsync (hashcat_ctx, buf + (num16d * 16), bzeros, num16m, device_param->hip_stream) == -1) return -1; } - /*if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1;*/ - return 0; } @@ -5370,8 +5366,6 @@ int run_opencl_kernel_atinit (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *dev /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ - if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; - return 0; } @@ -5398,8 +5392,6 @@ int run_opencl_kernel_utf8toutf16le (hashcat_ctx_t *hashcat_ctx, hc_device_param /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ - if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; - return 0; } @@ -5473,8 +5465,6 @@ int run_opencl_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *devi /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ - /*if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ - return 0; } @@ -5648,8 +5638,6 @@ int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, con if (hc_cuEventRecord (hashcat_ctx, device_param->cuda_event2, device_param->cuda_stream) == -1) return -1; - if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; - if (hc_cuEventSynchronize (hashcat_ctx, device_param->cuda_event2) == -1) return -1; float exec_ms; @@ -5747,8 +5735,6 @@ int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, con if (hc_hipEventRecord (hashcat_ctx, device_param->hip_event2, device_param->hip_stream) == -1) return -1; - if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; - if (hc_hipEventSynchronize (hashcat_ctx, device_param->hip_event2) == -1) return -1; float exec_ms; @@ -5948,8 +5934,6 @@ int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, con } if (hc_clReleaseEvent (hashcat_ctx, opencl_event) == -1) return -1; - - if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; } return 0; @@ -5997,8 +5981,6 @@ int run_kernel_mp (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, num_elements = CEILDIV (num_elements, kernel_threads); if (hc_cuLaunchKernel (hashcat_ctx, cuda_function, num_elements, 1, 1, kernel_threads, 1, 1, 0, device_param->cuda_stream, cuda_args, NULL) == -1) return -1; - - if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) @@ -6023,8 +6005,6 @@ int run_kernel_mp (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, num_elements = CEILDIV (num_elements, kernel_threads); if (hc_hipLaunchKernel (hashcat_ctx, hip_function, num_elements, 1, 1, kernel_threads, 1, 1, 0, device_param->hip_stream, hip_args, NULL) == -1) return -1; - - if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) @@ -6072,8 +6052,6 @@ int run_kernel_mp (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, opencl_kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL) == -1) return -1; /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ - - if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; } return 0; @@ -6090,8 +6068,6 @@ int run_kernel_tm (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) CUfunction cuda_function = device_param->cuda_function_tm; if (hc_cuLaunchKernel (hashcat_ctx, cuda_function, num_elements / kernel_threads, 1, 1, kernel_threads, 1, 1, 0, device_param->cuda_stream, device_param->kernel_params_tm, NULL) == -1) return -1; - - if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) @@ -6099,8 +6075,6 @@ int run_kernel_tm (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) HIPfunction hip_function = device_param->hip_function_tm; if (hc_hipLaunchKernel (hashcat_ctx, hip_function, num_elements / kernel_threads, 1, 1, kernel_threads, 1, 1, 0, device_param->hip_stream, device_param->kernel_params_tm, NULL) == -1) return -1; - - if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) @@ -6113,8 +6087,6 @@ int run_kernel_tm (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, cuda_kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL) == -1) return -1; /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ - - if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; } return 0; @@ -6135,8 +6107,6 @@ int run_kernel_amp (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, CUfunction cuda_function = device_param->cuda_function_amp; if (hc_cuLaunchKernel (hashcat_ctx, cuda_function, num_elements, 1, 1, kernel_threads, 1, 1, 0, device_param->cuda_stream, device_param->kernel_params_amp, NULL) == -1) return -1; - - if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) @@ -6146,8 +6116,6 @@ int run_kernel_amp (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, HIPfunction hip_function = device_param->hip_function_amp; if (hc_hipLaunchKernel (hashcat_ctx, hip_function, num_elements, 1, 1, kernel_threads, 1, 1, 0, device_param->hip_stream, device_param->kernel_params_amp, NULL) == -1) return -1; - - if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) @@ -6164,8 +6132,6 @@ int run_kernel_amp (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, opencl_kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL) == -1) return -1; /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ - - if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; } return 0; @@ -6186,8 +6152,6 @@ int run_kernel_decompress (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device CUfunction cuda_function = device_param->cuda_function_decompress; if (hc_cuLaunchKernel (hashcat_ctx, cuda_function, num_elements, 1, 1, kernel_threads, 1, 1, 0, device_param->cuda_stream, device_param->kernel_params_decompress, NULL) == -1) return -1; - - if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) @@ -6197,8 +6161,6 @@ int run_kernel_decompress (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device HIPfunction hip_function = device_param->hip_function_decompress; if (hc_hipLaunchKernel (hashcat_ctx, hip_function, num_elements, 1, 1, kernel_threads, 1, 1, 0, device_param->hip_stream, device_param->kernel_params_decompress, NULL) == -1) return -1; - - if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) @@ -6215,8 +6177,6 @@ int run_kernel_decompress (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, opencl_kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL) == -1) return -1; /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ - - if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; } return 0; @@ -6247,7 +6207,7 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const { if (device_param->is_cuda == true) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_idx, device_param->pws_idx, pws_cnt * sizeof (pw_idx_t)) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_pws_idx, device_param->pws_idx, pws_cnt * sizeof (pw_idx_t), device_param->cuda_stream) == -1) return -1; const pw_idx_t *pw_idx = device_param->pws_idx + pws_cnt; @@ -6255,13 +6215,13 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const if (off) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_comp_buf, device_param->pws_comp, off * sizeof (u32)) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_pws_comp_buf, device_param->pws_comp, off * sizeof (u32), device_param->cuda_stream) == -1) return -1; } } if (device_param->is_hip == true) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_pws_idx, device_param->pws_idx, pws_cnt * sizeof (pw_idx_t)) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_pws_idx, device_param->pws_idx, pws_cnt * sizeof (pw_idx_t), device_param->hip_stream) == -1) return -1; const pw_idx_t *pw_idx = device_param->pws_idx + pws_cnt; @@ -6269,13 +6229,13 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const if (off) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_pws_comp_buf, device_param->pws_comp, off * sizeof (u32)) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_pws_comp_buf, device_param->pws_comp, off * sizeof (u32), device_param->hip_stream) == -1) return -1; } } if (device_param->is_opencl == true) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_idx, CL_TRUE, 0, pws_cnt * sizeof (pw_idx_t), device_param->pws_idx, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_idx, CL_FALSE, 0, pws_cnt * sizeof (pw_idx_t), device_param->pws_idx, 0, NULL, NULL) == -1) return -1; const pw_idx_t *pw_idx = device_param->pws_idx + pws_cnt; @@ -6283,7 +6243,7 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const if (off) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_comp_buf, CL_TRUE, 0, off * sizeof (u32), device_param->pws_comp, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_comp_buf, CL_FALSE, 0, off * sizeof (u32), device_param->pws_comp, 0, NULL, NULL) == -1) return -1; } } @@ -6295,7 +6255,7 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const { if (device_param->is_cuda == true) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_idx, device_param->pws_idx, pws_cnt * sizeof (pw_idx_t)) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_pws_idx, device_param->pws_idx, pws_cnt * sizeof (pw_idx_t), device_param->cuda_stream) == -1) return -1; const pw_idx_t *pw_idx = device_param->pws_idx + pws_cnt; @@ -6303,13 +6263,13 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const if (off) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_comp_buf, device_param->pws_comp, off * sizeof (u32)) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_pws_comp_buf, device_param->pws_comp, off * sizeof (u32), device_param->cuda_stream) == -1) return -1; } } if (device_param->is_hip == true) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_pws_idx, device_param->pws_idx, pws_cnt * sizeof (pw_idx_t)) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_pws_idx, device_param->pws_idx, pws_cnt * sizeof (pw_idx_t), device_param->hip_stream) == -1) return -1; const pw_idx_t *pw_idx = device_param->pws_idx + pws_cnt; @@ -6317,13 +6277,13 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const if (off) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_pws_comp_buf, device_param->pws_comp, off * sizeof (u32)) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_pws_comp_buf, device_param->pws_comp, off * sizeof (u32), device_param->hip_stream) == -1) return -1; } } if (device_param->is_opencl == true) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_idx, CL_TRUE, 0, pws_cnt * sizeof (pw_idx_t), device_param->pws_idx, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_idx, CL_FALSE, 0, pws_cnt * sizeof (pw_idx_t), device_param->pws_idx, 0, NULL, NULL) == -1) return -1; const pw_idx_t *pw_idx = device_param->pws_idx + pws_cnt; @@ -6331,7 +6291,7 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const if (off) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_comp_buf, CL_TRUE, 0, off * sizeof (u32), device_param->pws_comp, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_comp_buf, CL_FALSE, 0, off * sizeof (u32), device_param->pws_comp, 0, NULL, NULL) == -1) return -1; } } @@ -6377,7 +6337,7 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const if (device_param->is_cuda == true) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_idx, device_param->pws_idx, pws_cnt * sizeof (pw_idx_t)) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_pws_idx, device_param->pws_idx, pws_cnt * sizeof (pw_idx_t), device_param->cuda_stream) == -1) return -1; const pw_idx_t *pw_idx = device_param->pws_idx + pws_cnt; @@ -6385,13 +6345,13 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const if (off) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_comp_buf, device_param->pws_comp, off * sizeof (u32)) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_pws_comp_buf, device_param->pws_comp, off * sizeof (u32), device_param->cuda_stream) == -1) return -1; } } if (device_param->is_hip == true) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_pws_idx, device_param->pws_idx, pws_cnt * sizeof (pw_idx_t)) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_pws_idx, device_param->pws_idx, pws_cnt * sizeof (pw_idx_t), device_param->hip_stream) == -1) return -1; const pw_idx_t *pw_idx = device_param->pws_idx + pws_cnt; @@ -6399,13 +6359,13 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const if (off) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_pws_comp_buf, device_param->pws_comp, off * sizeof (u32)) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_pws_comp_buf, device_param->pws_comp, off * sizeof (u32), device_param->hip_stream) == -1) return -1; } } if (device_param->is_opencl == true) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_idx, CL_TRUE, 0, pws_cnt * sizeof (pw_idx_t), device_param->pws_idx, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_idx, CL_FALSE, 0, pws_cnt * sizeof (pw_idx_t), device_param->pws_idx, 0, NULL, NULL) == -1) return -1; const pw_idx_t *pw_idx = device_param->pws_idx + pws_cnt; @@ -6413,7 +6373,7 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const if (off) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_comp_buf, CL_TRUE, 0, off * sizeof (u32), device_param->pws_comp, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_comp_buf, CL_FALSE, 0, off * sizeof (u32), device_param->pws_comp, 0, NULL, NULL) == -1) return -1; } } @@ -6425,7 +6385,7 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const { if (device_param->is_cuda == true) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_idx, device_param->pws_idx, pws_cnt * sizeof (pw_idx_t)) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_pws_idx, device_param->pws_idx, pws_cnt * sizeof (pw_idx_t), device_param->cuda_stream) == -1) return -1; const pw_idx_t *pw_idx = device_param->pws_idx + pws_cnt; @@ -6433,13 +6393,13 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const if (off) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_comp_buf, device_param->pws_comp, off * sizeof (u32)) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_pws_comp_buf, device_param->pws_comp, off * sizeof (u32), device_param->cuda_stream) == -1) return -1; } } if (device_param->is_hip == true) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_pws_idx, device_param->pws_idx, pws_cnt * sizeof (pw_idx_t)) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_pws_idx, device_param->pws_idx, pws_cnt * sizeof (pw_idx_t), device_param->hip_stream) == -1) return -1; const pw_idx_t *pw_idx = device_param->pws_idx + pws_cnt; @@ -6447,13 +6407,13 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const if (off) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_pws_comp_buf, device_param->pws_comp, off * sizeof (u32)) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_pws_comp_buf, device_param->pws_comp, off * sizeof (u32), device_param->hip_stream) == -1) return -1; } } if (device_param->is_opencl == true) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_idx, CL_TRUE, 0, pws_cnt * sizeof (pw_idx_t), device_param->pws_idx, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_idx, CL_FALSE, 0, pws_cnt * sizeof (pw_idx_t), device_param->pws_idx, 0, NULL, NULL) == -1) return -1; const pw_idx_t *pw_idx = device_param->pws_idx + pws_cnt; @@ -6461,7 +6421,7 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const if (off) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_comp_buf, CL_TRUE, 0, off * sizeof (u32), device_param->pws_comp, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_comp_buf, CL_FALSE, 0, off * sizeof (u32), device_param->pws_comp, 0, NULL, NULL) == -1) return -1; } } @@ -6471,7 +6431,7 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const { if (device_param->is_cuda == true) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_idx, device_param->pws_idx, pws_cnt * sizeof (pw_idx_t)) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_pws_idx, device_param->pws_idx, pws_cnt * sizeof (pw_idx_t), device_param->cuda_stream) == -1) return -1; const pw_idx_t *pw_idx = device_param->pws_idx + pws_cnt; @@ -6479,13 +6439,13 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const if (off) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_comp_buf, device_param->pws_comp, off * sizeof (u32)) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_pws_comp_buf, device_param->pws_comp, off * sizeof (u32), device_param->cuda_stream) == -1) return -1; } } if (device_param->is_hip == true) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_pws_idx, device_param->pws_idx, pws_cnt * sizeof (pw_idx_t)) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_pws_idx, device_param->pws_idx, pws_cnt * sizeof (pw_idx_t), device_param->hip_stream) == -1) return -1; const pw_idx_t *pw_idx = device_param->pws_idx + pws_cnt; @@ -6493,13 +6453,13 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const if (off) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_pws_comp_buf, device_param->pws_comp, off * sizeof (u32)) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_pws_comp_buf, device_param->pws_comp, off * sizeof (u32), device_param->hip_stream) == -1) return -1; } } if (device_param->is_opencl == true) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_idx, CL_TRUE, 0, pws_cnt * sizeof (pw_idx_t), device_param->pws_idx, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_idx, CL_FALSE, 0, pws_cnt * sizeof (pw_idx_t), device_param->pws_idx, 0, NULL, NULL) == -1) return -1; const pw_idx_t *pw_idx = device_param->pws_idx + pws_cnt; @@ -6507,7 +6467,7 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const if (off) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_comp_buf, CL_TRUE, 0, off * sizeof (u32), device_param->pws_comp, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_comp_buf, CL_FALSE, 0, off * sizeof (u32), device_param->pws_comp, 0, NULL, NULL) == -1) return -1; } } @@ -6715,12 +6675,12 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co { if (device_param->is_cuda == true) { - if (hc_cuMemcpyDtoD (hashcat_ctx, device_param->cuda_d_rules_c, device_param->cuda_d_rules + (innerloop_pos * sizeof (kernel_rule_t)), innerloop_left * sizeof (kernel_rule_t)) == -1) return -1; + if (hc_cuMemcpyDtoDAsync (hashcat_ctx, device_param->cuda_d_rules_c, device_param->cuda_d_rules + (innerloop_pos * sizeof (kernel_rule_t)), innerloop_left * sizeof (kernel_rule_t), device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyDtoD (hashcat_ctx, device_param->hip_d_rules_c, device_param->hip_d_rules + (innerloop_pos * sizeof (kernel_rule_t)), innerloop_left * sizeof (kernel_rule_t)) == -1) return -1; + if (hc_hipMemcpyDtoDAsync (hashcat_ctx, device_param->hip_d_rules_c, device_param->hip_d_rules + (innerloop_pos * sizeof (kernel_rule_t)), innerloop_left * sizeof (kernel_rule_t), device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) @@ -6840,12 +6800,12 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co if (device_param->is_cuda == true) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_combs_c, device_param->combs_buf, innerloop_left * sizeof (pw_t)) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_combs_c, device_param->combs_buf, innerloop_left * sizeof (pw_t), device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_combs_c, device_param->combs_buf, innerloop_left * sizeof (pw_t)) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_combs_c, device_param->combs_buf, innerloop_left * sizeof (pw_t), device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) @@ -6863,12 +6823,12 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co if (device_param->is_cuda == true) { - if (hc_cuMemcpyDtoD (hashcat_ctx, device_param->cuda_d_combs_c, device_param->cuda_d_combs, innerloop_left * sizeof (pw_t)) == -1) return -1; + if (hc_cuMemcpyDtoDAsync (hashcat_ctx, device_param->cuda_d_combs_c, device_param->cuda_d_combs, innerloop_left * sizeof (pw_t), device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyDtoD (hashcat_ctx, device_param->hip_d_combs_c, device_param->hip_d_combs, innerloop_left * sizeof (pw_t)) == -1) return -1; + if (hc_hipMemcpyDtoDAsync (hashcat_ctx, device_param->hip_d_combs_c, device_param->hip_d_combs, innerloop_left * sizeof (pw_t), device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) @@ -6886,12 +6846,12 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co if (device_param->is_cuda == true) { - if (hc_cuMemcpyDtoD (hashcat_ctx, device_param->cuda_d_combs_c, device_param->cuda_d_combs, innerloop_left * sizeof (pw_t)) == -1) return -1; + if (hc_cuMemcpyDtoDAsync (hashcat_ctx, device_param->cuda_d_combs_c, device_param->cuda_d_combs, innerloop_left * sizeof (pw_t), device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyDtoD (hashcat_ctx, device_param->hip_d_combs_c, device_param->hip_d_combs, innerloop_left * sizeof (pw_t)) == -1) return -1; + if (hc_hipMemcpyDtoDAsync (hashcat_ctx, device_param->hip_d_combs_c, device_param->hip_d_combs, innerloop_left * sizeof (pw_t), device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) @@ -7012,17 +6972,17 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co if (device_param->is_cuda == true) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_combs_c, device_param->combs_buf, innerloop_left * sizeof (pw_t)) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_combs_c, device_param->combs_buf, innerloop_left * sizeof (pw_t), device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_combs_c, device_param->combs_buf, innerloop_left * sizeof (pw_t)) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_combs_c, device_param->combs_buf, innerloop_left * sizeof (pw_t), device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_combs_c, CL_TRUE, 0, innerloop_left * sizeof (pw_t), device_param->combs_buf, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_combs_c, CL_FALSE, 0, innerloop_left * sizeof (pw_t), device_param->combs_buf, 0, NULL, NULL) == -1) return -1; } } else if (user_options->attack_mode == ATTACK_MODE_HYBRID1) @@ -7035,12 +6995,12 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co if (device_param->is_cuda == true) { - if (hc_cuMemcpyDtoD (hashcat_ctx, device_param->cuda_d_combs_c, device_param->cuda_d_combs, innerloop_left * sizeof (pw_t)) == -1) return -1; + if (hc_cuMemcpyDtoDAsync (hashcat_ctx, device_param->cuda_d_combs_c, device_param->cuda_d_combs, innerloop_left * sizeof (pw_t), device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyDtoD (hashcat_ctx, device_param->hip_d_combs_c, device_param->hip_d_combs, innerloop_left * sizeof (pw_t)) == -1) return -1; + if (hc_hipMemcpyDtoDAsync (hashcat_ctx, device_param->hip_d_combs_c, device_param->hip_d_combs, innerloop_left * sizeof (pw_t), device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) @@ -7060,12 +7020,12 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co if (device_param->is_cuda == true) { - if (hc_cuMemcpyDtoD (hashcat_ctx, device_param->cuda_d_bfs_c, device_param->cuda_d_bfs, innerloop_left * sizeof (bf_t)) == -1) return -1; + if (hc_cuMemcpyDtoDAsync (hashcat_ctx, device_param->cuda_d_bfs_c, device_param->cuda_d_bfs, innerloop_left * sizeof (bf_t), device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyDtoD (hashcat_ctx, device_param->hip_d_bfs_c, device_param->hip_d_bfs, innerloop_left * sizeof (bf_t)) == -1) return -1; + if (hc_hipMemcpyDtoDAsync (hashcat_ctx, device_param->hip_d_bfs_c, device_param->hip_d_bfs, innerloop_left * sizeof (bf_t), device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) @@ -12334,16 +12294,16 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) if (hc_cuMemAlloc (hashcat_ctx, &device_param->cuda_d_st_digests_buf, size_st_digests) == -1) return -1; if (hc_cuMemAlloc (hashcat_ctx, &device_param->cuda_d_st_salts_buf, size_st_salts) == -1) return -1; - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_bitmap_s1_a, bitmap_ctx->bitmap_s1_a, bitmap_ctx->bitmap_size) == -1) return -1; - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_bitmap_s1_b, bitmap_ctx->bitmap_s1_b, bitmap_ctx->bitmap_size) == -1) return -1; - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_bitmap_s1_c, bitmap_ctx->bitmap_s1_c, bitmap_ctx->bitmap_size) == -1) return -1; - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_bitmap_s1_d, bitmap_ctx->bitmap_s1_d, bitmap_ctx->bitmap_size) == -1) return -1; - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_bitmap_s2_a, bitmap_ctx->bitmap_s2_a, bitmap_ctx->bitmap_size) == -1) return -1; - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_bitmap_s2_b, bitmap_ctx->bitmap_s2_b, bitmap_ctx->bitmap_size) == -1) return -1; - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_bitmap_s2_c, bitmap_ctx->bitmap_s2_c, bitmap_ctx->bitmap_size) == -1) return -1; - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_bitmap_s2_d, bitmap_ctx->bitmap_s2_d, bitmap_ctx->bitmap_size) == -1) return -1; - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_digests_buf, hashes->digests_buf, size_digests) == -1) return -1; - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_salt_bufs, hashes->salts_buf, size_salts) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_bitmap_s1_a, bitmap_ctx->bitmap_s1_a, bitmap_ctx->bitmap_size, device_param->cuda_stream) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_bitmap_s1_b, bitmap_ctx->bitmap_s1_b, bitmap_ctx->bitmap_size, device_param->cuda_stream) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_bitmap_s1_c, bitmap_ctx->bitmap_s1_c, bitmap_ctx->bitmap_size, device_param->cuda_stream) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_bitmap_s1_d, bitmap_ctx->bitmap_s1_d, bitmap_ctx->bitmap_size, device_param->cuda_stream) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_bitmap_s2_a, bitmap_ctx->bitmap_s2_a, bitmap_ctx->bitmap_size, device_param->cuda_stream) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_bitmap_s2_b, bitmap_ctx->bitmap_s2_b, bitmap_ctx->bitmap_size, device_param->cuda_stream) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_bitmap_s2_c, bitmap_ctx->bitmap_s2_c, bitmap_ctx->bitmap_size, device_param->cuda_stream) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_bitmap_s2_d, bitmap_ctx->bitmap_s2_d, bitmap_ctx->bitmap_size, device_param->cuda_stream) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_digests_buf, hashes->digests_buf, size_digests, device_param->cuda_stream) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_salt_bufs, hashes->salts_buf, size_salts, device_param->cuda_stream) == -1) return -1; /** * special buffers @@ -12370,7 +12330,7 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) if (hc_cuMemAlloc (hashcat_ctx, &device_param->cuda_d_rules_c, size_rules_c) == -1) return -1; } - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_rules, straight_ctx->kernel_rules_buf, size_rules) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_rules, straight_ctx->kernel_rules_buf, size_rules, device_param->cuda_stream) == -1) return -1; } else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) { @@ -12405,19 +12365,19 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) { if (hc_cuMemAlloc (hashcat_ctx, &device_param->cuda_d_esalt_bufs, size_esalts) == -1) return -1; - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_esalt_bufs, hashes->esalts_buf, size_esalts) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_esalt_bufs, hashes->esalts_buf, size_esalts, device_param->cuda_stream) == -1) return -1; } if (hashconfig->st_hash != NULL) { - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_st_digests_buf, hashes->st_digests_buf, size_st_digests) == -1) return -1; - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_st_salts_buf, hashes->st_salts_buf, size_st_salts) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_st_digests_buf, hashes->st_digests_buf, size_st_digests, device_param->cuda_stream) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_st_salts_buf, hashes->st_salts_buf, size_st_salts, device_param->cuda_stream) == -1) return -1; if (size_esalts) { if (hc_cuMemAlloc (hashcat_ctx, &device_param->cuda_d_st_esalts_buf, size_st_esalts) == -1) return -1; - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_st_esalts_buf, hashes->st_esalts_buf, size_st_esalts) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_st_esalts_buf, hashes->st_esalts_buf, size_st_esalts, device_param->cuda_stream) == -1) return -1; } } } @@ -12444,16 +12404,16 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) if (hc_hipMemAlloc (hashcat_ctx, &device_param->hip_d_st_digests_buf, size_st_digests) == -1) return -1; if (hc_hipMemAlloc (hashcat_ctx, &device_param->hip_d_st_salts_buf, size_st_salts) == -1) return -1; - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_bitmap_s1_a, bitmap_ctx->bitmap_s1_a, bitmap_ctx->bitmap_size) == -1) return -1; - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_bitmap_s1_b, bitmap_ctx->bitmap_s1_b, bitmap_ctx->bitmap_size) == -1) return -1; - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_bitmap_s1_c, bitmap_ctx->bitmap_s1_c, bitmap_ctx->bitmap_size) == -1) return -1; - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_bitmap_s1_d, bitmap_ctx->bitmap_s1_d, bitmap_ctx->bitmap_size) == -1) return -1; - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_bitmap_s2_a, bitmap_ctx->bitmap_s2_a, bitmap_ctx->bitmap_size) == -1) return -1; - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_bitmap_s2_b, bitmap_ctx->bitmap_s2_b, bitmap_ctx->bitmap_size) == -1) return -1; - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_bitmap_s2_c, bitmap_ctx->bitmap_s2_c, bitmap_ctx->bitmap_size) == -1) return -1; - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_bitmap_s2_d, bitmap_ctx->bitmap_s2_d, bitmap_ctx->bitmap_size) == -1) return -1; - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_digests_buf, hashes->digests_buf, size_digests) == -1) return -1; - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_salt_bufs, hashes->salts_buf, size_salts) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_bitmap_s1_a, bitmap_ctx->bitmap_s1_a, bitmap_ctx->bitmap_size, device_param->hip_stream) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_bitmap_s1_b, bitmap_ctx->bitmap_s1_b, bitmap_ctx->bitmap_size, device_param->hip_stream) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_bitmap_s1_c, bitmap_ctx->bitmap_s1_c, bitmap_ctx->bitmap_size, device_param->hip_stream) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_bitmap_s1_d, bitmap_ctx->bitmap_s1_d, bitmap_ctx->bitmap_size, device_param->hip_stream) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_bitmap_s2_a, bitmap_ctx->bitmap_s2_a, bitmap_ctx->bitmap_size, device_param->hip_stream) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_bitmap_s2_b, bitmap_ctx->bitmap_s2_b, bitmap_ctx->bitmap_size, device_param->hip_stream) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_bitmap_s2_c, bitmap_ctx->bitmap_s2_c, bitmap_ctx->bitmap_size, device_param->hip_stream) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_bitmap_s2_d, bitmap_ctx->bitmap_s2_d, bitmap_ctx->bitmap_size, device_param->hip_stream) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_digests_buf, hashes->digests_buf, size_digests, device_param->hip_stream) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_salt_bufs, hashes->salts_buf, size_salts, device_param->hip_stream) == -1) return -1; /** * special buffers @@ -12480,7 +12440,7 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) if (hc_hipMemAlloc (hashcat_ctx, &device_param->hip_d_rules_c, size_rules_c) == -1) return -1; } - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_rules, straight_ctx->kernel_rules_buf, size_rules) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_rules, straight_ctx->kernel_rules_buf, size_rules, device_param->hip_stream) == -1) return -1; } else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) { @@ -12515,19 +12475,19 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) { if (hc_hipMemAlloc (hashcat_ctx, &device_param->hip_d_esalt_bufs, size_esalts) == -1) return -1; - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_esalt_bufs, hashes->esalts_buf, size_esalts) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_esalt_bufs, hashes->esalts_buf, size_esalts, device_param->hip_stream) == -1) return -1; } if (hashconfig->st_hash != NULL) { - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_st_digests_buf, hashes->st_digests_buf, size_st_digests) == -1) return -1; - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_st_salts_buf, hashes->st_salts_buf, size_st_salts) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_st_digests_buf, hashes->st_digests_buf, size_st_digests, device_param->hip_stream) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_st_salts_buf, hashes->st_salts_buf, size_st_salts, device_param->hip_stream) == -1) return -1; if (size_esalts) { if (hc_hipMemAlloc (hashcat_ctx, &device_param->hip_d_st_esalts_buf, size_st_esalts) == -1) return -1; - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_st_esalts_buf, hashes->st_esalts_buf, size_st_esalts) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_st_esalts_buf, hashes->st_esalts_buf, size_st_esalts, device_param->hip_stream) == -1) return -1; } } } @@ -12554,16 +12514,16 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) if (hc_clCreateBuffer (hashcat_ctx, device_param->opencl_context, CL_MEM_READ_ONLY, size_st_digests, NULL, &device_param->opencl_d_st_digests_buf) == -1) return -1; if (hc_clCreateBuffer (hashcat_ctx, device_param->opencl_context, CL_MEM_READ_ONLY, size_st_salts, NULL, &device_param->opencl_d_st_salts_buf) == -1) return -1; - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_bitmap_s1_a, CL_TRUE, 0, bitmap_ctx->bitmap_size, bitmap_ctx->bitmap_s1_a, 0, NULL, NULL) == -1) return -1; - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_bitmap_s1_b, CL_TRUE, 0, bitmap_ctx->bitmap_size, bitmap_ctx->bitmap_s1_b, 0, NULL, NULL) == -1) return -1; - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_bitmap_s1_c, CL_TRUE, 0, bitmap_ctx->bitmap_size, bitmap_ctx->bitmap_s1_c, 0, NULL, NULL) == -1) return -1; - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_bitmap_s1_d, CL_TRUE, 0, bitmap_ctx->bitmap_size, bitmap_ctx->bitmap_s1_d, 0, NULL, NULL) == -1) return -1; - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_bitmap_s2_a, CL_TRUE, 0, bitmap_ctx->bitmap_size, bitmap_ctx->bitmap_s2_a, 0, NULL, NULL) == -1) return -1; - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_bitmap_s2_b, CL_TRUE, 0, bitmap_ctx->bitmap_size, bitmap_ctx->bitmap_s2_b, 0, NULL, NULL) == -1) return -1; - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_bitmap_s2_c, CL_TRUE, 0, bitmap_ctx->bitmap_size, bitmap_ctx->bitmap_s2_c, 0, NULL, NULL) == -1) return -1; - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_bitmap_s2_d, CL_TRUE, 0, bitmap_ctx->bitmap_size, bitmap_ctx->bitmap_s2_d, 0, NULL, NULL) == -1) return -1; - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_digests_buf, CL_TRUE, 0, size_digests, hashes->digests_buf, 0, NULL, NULL) == -1) return -1; - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_salt_bufs, CL_TRUE, 0, size_salts, hashes->salts_buf, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_bitmap_s1_a, CL_FALSE, 0, bitmap_ctx->bitmap_size, bitmap_ctx->bitmap_s1_a, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_bitmap_s1_b, CL_FALSE, 0, bitmap_ctx->bitmap_size, bitmap_ctx->bitmap_s1_b, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_bitmap_s1_c, CL_FALSE, 0, bitmap_ctx->bitmap_size, bitmap_ctx->bitmap_s1_c, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_bitmap_s1_d, CL_FALSE, 0, bitmap_ctx->bitmap_size, bitmap_ctx->bitmap_s1_d, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_bitmap_s2_a, CL_FALSE, 0, bitmap_ctx->bitmap_size, bitmap_ctx->bitmap_s2_a, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_bitmap_s2_b, CL_FALSE, 0, bitmap_ctx->bitmap_size, bitmap_ctx->bitmap_s2_b, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_bitmap_s2_c, CL_FALSE, 0, bitmap_ctx->bitmap_size, bitmap_ctx->bitmap_s2_c, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_bitmap_s2_d, CL_FALSE, 0, bitmap_ctx->bitmap_size, bitmap_ctx->bitmap_s2_d, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_digests_buf, CL_FALSE, 0, size_digests, hashes->digests_buf, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_salt_bufs, CL_FALSE, 0, size_salts, hashes->salts_buf, 0, NULL, NULL) == -1) return -1; /** * special buffers @@ -12580,7 +12540,7 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) if (hc_clCreateBuffer (hashcat_ctx, device_param->opencl_context, CL_MEM_READ_ONLY, size_rules, NULL, &device_param->opencl_d_rules) == -1) return -1; if (hc_clCreateBuffer (hashcat_ctx, device_param->opencl_context, CL_MEM_READ_ONLY, size_rules_c, NULL, &device_param->opencl_d_rules_c) == -1) return -1; - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_rules, CL_TRUE, 0, size_rules, straight_ctx->kernel_rules_buf, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_rules, CL_FALSE, 0, size_rules, straight_ctx->kernel_rules_buf, 0, NULL, NULL) == -1) return -1; } else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) { @@ -12603,19 +12563,19 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) { if (hc_clCreateBuffer (hashcat_ctx, device_param->opencl_context, CL_MEM_READ_ONLY, size_esalts, NULL, &device_param->opencl_d_esalt_bufs) == -1) return -1; - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_esalt_bufs, CL_TRUE, 0, size_esalts, hashes->esalts_buf, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_esalt_bufs, CL_FALSE, 0, size_esalts, hashes->esalts_buf, 0, NULL, NULL) == -1) return -1; } if (hashconfig->st_hash != NULL) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_st_digests_buf, CL_TRUE, 0, size_st_digests, hashes->st_digests_buf, 0, NULL, NULL) == -1) return -1; - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_st_salts_buf, CL_TRUE, 0, size_st_salts, hashes->st_salts_buf, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_st_digests_buf, CL_FALSE, 0, size_st_digests, hashes->st_digests_buf, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_st_salts_buf, CL_FALSE, 0, size_st_salts, hashes->st_salts_buf, 0, NULL, NULL) == -1) return -1; if (size_esalts) { if (hc_clCreateBuffer (hashcat_ctx, device_param->opencl_context, CL_MEM_READ_ONLY, size_st_esalts, NULL, &device_param->opencl_d_st_esalts_buf) == -1) return -1; - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_st_esalts_buf, CL_TRUE, 0, size_st_esalts, hashes->st_esalts_buf, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_st_esalts_buf, CL_FALSE, 0, size_st_esalts, hashes->st_esalts_buf, 0, NULL, NULL) == -1) return -1; } } } @@ -15928,8 +15888,8 @@ int backend_session_update_mp (hashcat_ctx_t *hashcat_ctx) //for (u32 i = 3; i < 4; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->opencl_kernel_mp, i, sizeof (cl_ulong), device_param->kernel_params_mp[i]); if (CL_rc == -1) return -1; } //for (u32 i = 4; i < 8; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->opencl_kernel_mp, i, sizeof (cl_uint), device_param->kernel_params_mp[i]); if (CL_rc == -1) return -1; } - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_root_css_buf, mask_ctx->root_css_buf, device_param->size_root_css) == -1) return -1; - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_markov_css_buf, mask_ctx->markov_css_buf, device_param->size_markov_css) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_root_css_buf, mask_ctx->root_css_buf, device_param->size_root_css, device_param->cuda_stream) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_markov_css_buf, mask_ctx->markov_css_buf, device_param->size_markov_css, device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) @@ -15937,8 +15897,8 @@ int backend_session_update_mp (hashcat_ctx_t *hashcat_ctx) //for (u32 i = 3; i < 4; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->opencl_kernel_mp, i, sizeof (cl_ulong), device_param->kernel_params_mp[i]); if (CL_rc == -1) return -1; } //for (u32 i = 4; i < 8; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->opencl_kernel_mp, i, sizeof (cl_uint), device_param->kernel_params_mp[i]); if (CL_rc == -1) return -1; } - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_root_css_buf, mask_ctx->root_css_buf, device_param->size_root_css) == -1) return -1; - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_markov_css_buf, mask_ctx->markov_css_buf, device_param->size_markov_css) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_root_css_buf, mask_ctx->root_css_buf, device_param->size_root_css, device_param->hip_stream) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_markov_css_buf, mask_ctx->markov_css_buf, device_param->size_markov_css, device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) @@ -15946,8 +15906,8 @@ int backend_session_update_mp (hashcat_ctx_t *hashcat_ctx) for (u32 i = 3; i < 4; i++) { if (hc_clSetKernelArg (hashcat_ctx, device_param->opencl_kernel_mp, i, sizeof (cl_ulong), device_param->kernel_params_mp[i]) == -1) return -1; } for (u32 i = 4; i < 8; i++) { if (hc_clSetKernelArg (hashcat_ctx, device_param->opencl_kernel_mp, i, sizeof (cl_uint), device_param->kernel_params_mp[i]) == -1) return -1; } - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_root_css_buf, CL_TRUE, 0, device_param->size_root_css, mask_ctx->root_css_buf, 0, NULL, NULL) == -1) return -1; - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_markov_css_buf, CL_TRUE, 0, device_param->size_markov_css, mask_ctx->markov_css_buf, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_root_css_buf, CL_FALSE, 0, device_param->size_root_css, mask_ctx->root_css_buf, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_markov_css_buf, CL_FALSE, 0, device_param->size_markov_css, mask_ctx->markov_css_buf, 0, NULL, NULL) == -1) return -1; } } @@ -15989,8 +15949,8 @@ int backend_session_update_mp_rl (hashcat_ctx_t *hashcat_ctx, const u32 css_cnt_ //for (u32 i = 4; i < 7; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->opencl_kernel_mp_r, i, sizeof (cl_uint), device_param->kernel_params_mp_r[i]); if (CL_rc == -1) return -1; } //for (u32 i = 8; i < 8; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->opencl_kernel_mp_r, i, sizeof (cl_ulong), device_param->kernel_params_mp_r[i]); if (CL_rc == -1) return -1; } - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_root_css_buf, mask_ctx->root_css_buf, device_param->size_root_css) == -1) return -1; - if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_markov_css_buf, mask_ctx->markov_css_buf, device_param->size_markov_css) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_root_css_buf, mask_ctx->root_css_buf, device_param->size_root_css, device_param->cuda_stream) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_markov_css_buf, mask_ctx->markov_css_buf, device_param->size_markov_css, device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) @@ -16003,8 +15963,8 @@ int backend_session_update_mp_rl (hashcat_ctx_t *hashcat_ctx, const u32 css_cnt_ //for (u32 i = 4; i < 7; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->opencl_kernel_mp_r, i, sizeof (cl_uint), device_param->kernel_params_mp_r[i]); if (CL_rc == -1) return -1; } //for (u32 i = 8; i < 8; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->opencl_kernel_mp_r, i, sizeof (cl_ulong), device_param->kernel_params_mp_r[i]); if (CL_rc == -1) return -1; } - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_root_css_buf, mask_ctx->root_css_buf, device_param->size_root_css) == -1) return -1; - if (hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_markov_css_buf, mask_ctx->markov_css_buf, device_param->size_markov_css) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_root_css_buf, mask_ctx->root_css_buf, device_param->size_root_css, device_param->hip_stream) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_markov_css_buf, mask_ctx->markov_css_buf, device_param->size_markov_css, device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) @@ -16017,8 +15977,8 @@ int backend_session_update_mp_rl (hashcat_ctx_t *hashcat_ctx, const u32 css_cnt_ for (u32 i = 4; i < 7; i++) { if (hc_clSetKernelArg (hashcat_ctx, device_param->opencl_kernel_mp_r, i, sizeof (cl_uint), device_param->kernel_params_mp_r[i]) == -1) return -1; } for (u32 i = 8; i < 8; i++) { if (hc_clSetKernelArg (hashcat_ctx, device_param->opencl_kernel_mp_r, i, sizeof (cl_ulong), device_param->kernel_params_mp_r[i]) == -1) return -1; } - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_root_css_buf, CL_TRUE, 0, device_param->size_root_css, mask_ctx->root_css_buf, 0, NULL, NULL) == -1) return -1; - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_markov_css_buf, CL_TRUE, 0, device_param->size_markov_css, mask_ctx->markov_css_buf, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_root_css_buf, CL_FALSE, 0, device_param->size_root_css, mask_ctx->root_css_buf, 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_markov_css_buf, CL_FALSE, 0, device_param->size_markov_css, mask_ctx->markov_css_buf, 0, NULL, NULL) == -1) return -1; } } From 507d40fff638eb94d813891faf5c1db4de6f74f0 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Mon, 26 Jul 2021 15:35:59 +0300 Subject: [PATCH 20/64] Allow async execution of check_hash() and check_cracked() --- src/hashes.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/hashes.c b/src/hashes.c index 27aa94370..0355a50ad 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -319,17 +319,17 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl if (device_param->is_cuda == true) { - hc_cuMemcpyDtoH (hashcat_ctx, tmps, device_param->cuda_d_tmps + (plain->gidvid * hashconfig->tmp_size), hashconfig->tmp_size); + hc_cuMemcpyDtoHAsync (hashcat_ctx, tmps, device_param->cuda_d_tmps + (plain->gidvid * hashconfig->tmp_size), hashconfig->tmp_size, device_param->cuda_stream); } if (device_param->is_hip == true) { - hc_hipMemcpyDtoH (hashcat_ctx, tmps, device_param->hip_d_tmps + (plain->gidvid * hashconfig->tmp_size), hashconfig->tmp_size); + hc_hipMemcpyDtoHAsync (hashcat_ctx, tmps, device_param->hip_d_tmps + (plain->gidvid * hashconfig->tmp_size), hashconfig->tmp_size, device_param->hip_stream); } if (device_param->is_opencl == true) { - hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_tmps, CL_TRUE, plain->gidvid * hashconfig->tmp_size, hashconfig->tmp_size, tmps, 0, NULL, NULL); + hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_tmps, CL_FALSE, plain->gidvid * hashconfig->tmp_size, hashconfig->tmp_size, tmps, 0, NULL, NULL); } } @@ -491,14 +491,14 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) if (device_param->is_cuda == true) { - CU_rc = hc_cuMemcpyDtoH (hashcat_ctx, &num_cracked, device_param->cuda_d_result, sizeof (u32)); + CU_rc = hc_cuMemcpyDtoHAsync (hashcat_ctx, &num_cracked, device_param->cuda_d_result, sizeof (u32), device_param->cuda_stream); if (CU_rc == -1) return -1; } if (device_param->is_hip == true) { - HIP_rc = hc_hipMemcpyDtoH (hashcat_ctx, &num_cracked, device_param->hip_d_result, sizeof (u32)); + HIP_rc = hc_hipMemcpyDtoHAsync (hashcat_ctx, &num_cracked, device_param->hip_d_result, sizeof (u32), device_param->hip_stream); if (HIP_rc == -1) return -1; } @@ -524,14 +524,14 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) if (device_param->is_cuda == true) { - CU_rc = hc_cuMemcpyDtoH (hashcat_ctx, cracked, device_param->cuda_d_plain_bufs, num_cracked * sizeof (plain_t)); + CU_rc = hc_cuMemcpyDtoHAsync (hashcat_ctx, cracked, device_param->cuda_d_plain_bufs, num_cracked * sizeof (plain_t), device_param->cuda_stream); if (CU_rc == -1) return -1; } if (device_param->is_hip == true) { - HIP_rc = hc_hipMemcpyDtoH (hashcat_ctx, cracked, device_param->hip_d_plain_bufs, num_cracked * sizeof (plain_t)); + HIP_rc = hc_hipMemcpyDtoHAsync (hashcat_ctx, cracked, device_param->hip_d_plain_bufs, num_cracked * sizeof (plain_t), device_param->hip_stream); if (HIP_rc == -1) return -1; } @@ -588,21 +588,21 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) if (device_param->is_cuda == true) { - CU_rc = hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_digests_shown + (salt_buf->digests_offset * sizeof (u32)), &hashes->digests_shown_tmp[salt_buf->digests_offset], salt_buf->digests_cnt * sizeof (u32)); + CU_rc = hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_digests_shown + (salt_buf->digests_offset * sizeof (u32)), &hashes->digests_shown_tmp[salt_buf->digests_offset], salt_buf->digests_cnt * sizeof (u32), device_param->cuda_stream); if (CU_rc == -1) return -1; } if (device_param->is_hip == true) { - HIP_rc = hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_digests_shown + (salt_buf->digests_offset * sizeof (u32)), &hashes->digests_shown_tmp[salt_buf->digests_offset], salt_buf->digests_cnt * sizeof (u32)); + HIP_rc = hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_digests_shown + (salt_buf->digests_offset * sizeof (u32)), &hashes->digests_shown_tmp[salt_buf->digests_offset], salt_buf->digests_cnt * sizeof (u32), device_param->hip_stream); if (HIP_rc == -1) return -1; } if (device_param->is_opencl == true) { - CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_digests_shown, CL_TRUE, salt_buf->digests_offset * sizeof (u32), salt_buf->digests_cnt * sizeof (u32), &hashes->digests_shown_tmp[salt_buf->digests_offset], 0, NULL, NULL); + CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_digests_shown, CL_FALSE, salt_buf->digests_offset * sizeof (u32), salt_buf->digests_cnt * sizeof (u32), &hashes->digests_shown_tmp[salt_buf->digests_offset], 0, NULL, NULL); if (CL_rc == -1) return -1; } @@ -633,21 +633,21 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) if (device_param->is_cuda == true) { - CU_rc = hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_result, &num_cracked, sizeof (u32)); + CU_rc = hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_result, &num_cracked, sizeof (u32), device_param->cuda_stream); if (CU_rc == -1) return -1; } if (device_param->is_hip == true) { - HIP_rc = hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_result, &num_cracked, sizeof (u32)); + HIP_rc = hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_result, &num_cracked, sizeof (u32), device_param->hip_stream); if (HIP_rc == -1) return -1; } if (device_param->is_opencl == true) { - CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_result, CL_TRUE, 0, sizeof (u32), &num_cracked, 0, NULL, NULL); + CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_result, CL_FALSE, 0, sizeof (u32), &num_cracked, 0, NULL, NULL); if (CL_rc == -1) return -1; } From a642f7b23344309fe8dafe6d3d73285ae49af354 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Mon, 26 Jul 2021 15:36:42 +0300 Subject: [PATCH 21/64] Remove synchronous GPU memory copy functions --- include/backend.h | 6 -- include/ext_cuda.h | 6 -- include/ext_hip.h | 6 -- src/backend.c | 168 --------------------------------------------- 4 files changed, 186 deletions(-) diff --git a/include/backend.h b/include/backend.h index baa94b50c..a54ba357e 100644 --- a/include/backend.h +++ b/include/backend.h @@ -68,11 +68,8 @@ int hc_cuFuncSetAttribute (hashcat_ctx_t *hashcat_ctx, CUfunction hfunc, int hc_cuInit (hashcat_ctx_t *hashcat_ctx, unsigned int Flags); int hc_cuLaunchKernel (hashcat_ctx_t *hashcat_ctx, CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void **kernelParams, void **extra); int hc_cuMemAlloc (hashcat_ctx_t *hashcat_ctx, CUdeviceptr *dptr, size_t bytesize); -int hc_cuMemcpyDtoD (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount); int hc_cuMemcpyDtoDAsync (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream); -int hc_cuMemcpyDtoH (hashcat_ctx_t *hashcat_ctx, void *dstHost, CUdeviceptr srcDevice, size_t ByteCount); int hc_cuMemcpyDtoHAsync (hashcat_ctx_t *hashcat_ctx, void *dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream); -int hc_cuMemcpyHtoD (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount); int hc_cuMemcpyHtoDAsync (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount, CUstream hStream); int hc_cuMemFree (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dptr); int hc_cuModuleGetFunction (hashcat_ctx_t *hashcat_ctx, CUfunction *hfunc, CUmodule hmod, const char *name); @@ -119,11 +116,8 @@ int hc_hipFuncGetAttribute (hashcat_ctx_t *hashcat_ctx, int *pi, HIPfuncti int hc_hipInit (hashcat_ctx_t *hashcat_ctx, unsigned int Flags); int hc_hipLaunchKernel (hashcat_ctx_t *hashcat_ctx, HIPfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, HIPstream hStream, void **kernelParams, void **extra); int hc_hipMemAlloc (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr *dptr, size_t bytesize); -int hc_hipMemcpyDtoD (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dstDevice, HIPdeviceptr srcDevice, size_t ByteCount); int hc_hipMemcpyDtoDAsync (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dstDevice, HIPdeviceptr srcDevice, size_t ByteCount, HIPstream hStream); -int hc_hipMemcpyDtoH (hashcat_ctx_t *hashcat_ctx, void *dstHost, HIPdeviceptr srcDevice, size_t ByteCount); int hc_hipMemcpyDtoHAsync (hashcat_ctx_t *hashcat_ctx, void *dstHost, HIPdeviceptr srcDevice, size_t ByteCount, HIPstream hStream); -int hc_hipMemcpyHtoD (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dstDevice, const void *srcHost, size_t ByteCount); int hc_hipMemcpyHtoDAsync (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dstDevice, const void *srcHost, size_t ByteCount, HIPstream hStream); int hc_hipMemFree (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dptr); int hc_hipModuleGetFunction (hashcat_ctx_t *hashcat_ctx, HIPfunction *hfunc, HIPmodule hmod, const char *name); diff --git a/include/ext_cuda.h b/include/ext_cuda.h index 8048c729f..7f40e1410 100644 --- a/include/ext_cuda.h +++ b/include/ext_cuda.h @@ -1028,11 +1028,8 @@ typedef CUresult (CUDA_API_CALL *CUDA_CUINIT) (unsigned int); typedef CUresult (CUDA_API_CALL *CUDA_CULAUNCHKERNEL) (CUfunction, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, CUstream, void **, void **); typedef CUresult (CUDA_API_CALL *CUDA_CUMEMALLOC) (CUdeviceptr *, size_t); typedef CUresult (CUDA_API_CALL *CUDA_CUMEMALLOCHOST) (void **, size_t); -typedef CUresult (CUDA_API_CALL *CUDA_CUMEMCPYDTOD) (CUdeviceptr, CUdeviceptr, size_t); typedef CUresult (CUDA_API_CALL *CUDA_CUMEMCPYDTODASYNC) (CUdeviceptr, CUdeviceptr, size_t, CUstream); -typedef CUresult (CUDA_API_CALL *CUDA_CUMEMCPYDTOH) (void *, CUdeviceptr, size_t); typedef CUresult (CUDA_API_CALL *CUDA_CUMEMCPYDTOHASYNC) (void *, CUdeviceptr, size_t, CUstream); -typedef CUresult (CUDA_API_CALL *CUDA_CUMEMCPYHTOD) (CUdeviceptr, const void *, size_t); typedef CUresult (CUDA_API_CALL *CUDA_CUMEMCPYHTODASYNC) (CUdeviceptr, const void *, size_t, CUstream); typedef CUresult (CUDA_API_CALL *CUDA_CUMEMFREE) (CUdeviceptr); typedef CUresult (CUDA_API_CALL *CUDA_CUMEMFREEHOST) (void *); @@ -1093,11 +1090,8 @@ typedef struct hc_cuda_lib CUDA_CULAUNCHKERNEL cuLaunchKernel; CUDA_CUMEMALLOC cuMemAlloc; CUDA_CUMEMALLOCHOST cuMemAllocHost; - CUDA_CUMEMCPYDTOD cuMemcpyDtoD; CUDA_CUMEMCPYDTODASYNC cuMemcpyDtoDAsync; - CUDA_CUMEMCPYDTOH cuMemcpyDtoH; CUDA_CUMEMCPYDTOHASYNC cuMemcpyDtoHAsync; - CUDA_CUMEMCPYHTOD cuMemcpyHtoD; CUDA_CUMEMCPYHTODASYNC cuMemcpyHtoDAsync; CUDA_CUMEMFREE cuMemFree; CUDA_CUMEMFREEHOST cuMemFreeHost; diff --git a/include/ext_hip.h b/include/ext_hip.h index a99d1e5a9..631dbfb33 100644 --- a/include/ext_hip.h +++ b/include/ext_hip.h @@ -1037,11 +1037,8 @@ typedef HIPresult (HIP_API_CALL *HIP_HIPINIT) (unsigned int); typedef HIPresult (HIP_API_CALL *HIP_HIPLAUNCHKERNEL) (HIPfunction, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, HIPstream, void **, void **); typedef HIPresult (HIP_API_CALL *HIP_HIPMEMALLOC) (HIPdeviceptr *, size_t); typedef HIPresult (HIP_API_CALL *HIP_HIPMEMALLOCHOST) (void **, size_t); -typedef HIPresult (HIP_API_CALL *HIP_HIPMEMCPYDTOD) (HIPdeviceptr, HIPdeviceptr, size_t); typedef HIPresult (HIP_API_CALL *HIP_HIPMEMCPYDTODASYNC) (HIPdeviceptr, HIPdeviceptr, size_t, HIPstream); -typedef HIPresult (HIP_API_CALL *HIP_HIPMEMCPYDTOH) (void *, HIPdeviceptr, size_t); typedef HIPresult (HIP_API_CALL *HIP_HIPMEMCPYDTOHASYNC) (void *, HIPdeviceptr, size_t, HIPstream); -typedef HIPresult (HIP_API_CALL *HIP_HIPMEMCPYHTOD) (HIPdeviceptr, const void *, size_t); typedef HIPresult (HIP_API_CALL *HIP_HIPMEMCPYHTODASYNC) (HIPdeviceptr, const void *, size_t, HIPstream); typedef HIPresult (HIP_API_CALL *HIP_HIPMEMFREE) (HIPdeviceptr); typedef HIPresult (HIP_API_CALL *HIP_HIPMEMFREEHOST) (void *); @@ -1102,11 +1099,8 @@ typedef struct hc_hip_lib HIP_HIPLAUNCHKERNEL hipLaunchKernel; HIP_HIPMEMALLOC hipMemAlloc; HIP_HIPMEMALLOCHOST hipMemAllocHost; - HIP_HIPMEMCPYDTOD hipMemcpyDtoD; HIP_HIPMEMCPYDTODASYNC hipMemcpyDtoDAsync; - HIP_HIPMEMCPYDTOH hipMemcpyDtoH; HIP_HIPMEMCPYDTOHASYNC hipMemcpyDtoHAsync; - HIP_HIPMEMCPYHTOD hipMemcpyHtoD; HIP_HIPMEMCPYHTODASYNC hipMemcpyHtoDAsync; HIP_HIPMEMFREE hipMemFree; HIP_HIPMEMFREEHOST hipMemFreeHost; diff --git a/src/backend.c b/src/backend.c index 9631e8dd2..a6f42b672 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1257,11 +1257,8 @@ int cuda_init (hashcat_ctx_t *hashcat_ctx) HC_LOAD_FUNC_CUDA (cuda, cuLaunchKernel, cuLaunchKernel, CUDA_CULAUNCHKERNEL, CUDA, 1); HC_LOAD_FUNC_CUDA (cuda, cuMemAlloc, cuMemAlloc_v2, CUDA_CUMEMALLOC, CUDA, 1); HC_LOAD_FUNC_CUDA (cuda, cuMemAllocHost, cuMemAllocHost_v2, CUDA_CUMEMALLOCHOST, CUDA, 1); - HC_LOAD_FUNC_CUDA (cuda, cuMemcpyDtoD, cuMemcpyDtoD_v2, CUDA_CUMEMCPYDTOD, CUDA, 1); HC_LOAD_FUNC_CUDA (cuda, cuMemcpyDtoDAsync, cuMemcpyDtoDAsync_v2, CUDA_CUMEMCPYDTODASYNC, CUDA, 1); - HC_LOAD_FUNC_CUDA (cuda, cuMemcpyDtoH, cuMemcpyDtoH_v2, CUDA_CUMEMCPYDTOH, CUDA, 1); HC_LOAD_FUNC_CUDA (cuda, cuMemcpyDtoHAsync, cuMemcpyDtoHAsync_v2, CUDA_CUMEMCPYDTOHASYNC, CUDA, 1); - HC_LOAD_FUNC_CUDA (cuda, cuMemcpyHtoD, cuMemcpyHtoD_v2, CUDA_CUMEMCPYHTOD, CUDA, 1); HC_LOAD_FUNC_CUDA (cuda, cuMemcpyHtoDAsync, cuMemcpyHtoDAsync_v2, CUDA_CUMEMCPYHTODASYNC, CUDA, 1); HC_LOAD_FUNC_CUDA (cuda, cuMemFree, cuMemFree_v2, CUDA_CUMEMFREE, CUDA, 1); HC_LOAD_FUNC_CUDA (cuda, cuMemFreeHost, cuMemFreeHost, CUDA_CUMEMFREEHOST, CUDA, 1); @@ -1687,33 +1684,6 @@ int hc_cuMemFree (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dptr) return 0; } -int hc_cuMemcpyDtoH (hashcat_ctx_t *hashcat_ctx, void *dstHost, CUdeviceptr srcDevice, size_t ByteCount) -{ - backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - - CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; - - const CUresult CU_err = cuda->cuMemcpyDtoH (dstHost, srcDevice, ByteCount); - - if (CU_err != CUDA_SUCCESS) - { - const char *pStr = NULL; - - if (cuda->cuGetErrorString (CU_err, &pStr) == CUDA_SUCCESS) - { - event_log_error (hashcat_ctx, "cuMemcpyDtoH(): %s", pStr); - } - else - { - event_log_error (hashcat_ctx, "cuMemcpyDtoH(): %d", CU_err); - } - - return -1; - } - - return 0; -} - int hc_cuMemcpyDtoHAsync (hashcat_ctx_t *hashcat_ctx, void *dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; @@ -1741,33 +1711,6 @@ int hc_cuMemcpyDtoHAsync (hashcat_ctx_t *hashcat_ctx, void *dstHost, CUdeviceptr return 0; } -int hc_cuMemcpyDtoD (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount) -{ - backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - - CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; - - const CUresult CU_err = cuda->cuMemcpyDtoD (dstDevice, srcDevice, ByteCount); - - if (CU_err != CUDA_SUCCESS) - { - const char *pStr = NULL; - - if (cuda->cuGetErrorString (CU_err, &pStr) == CUDA_SUCCESS) - { - event_log_error (hashcat_ctx, "cuMemcpyDtoD(): %s", pStr); - } - else - { - event_log_error (hashcat_ctx, "cuMemcpyDtoD(): %d", CU_err); - } - - return -1; - } - - return 0; -} - int hc_cuMemcpyDtoDAsync (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; @@ -1795,33 +1738,6 @@ int hc_cuMemcpyDtoDAsync (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dstDevice, CUd return 0; } -int hc_cuMemcpyHtoD (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount) -{ - backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - - CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; - - const CUresult CU_err = cuda->cuMemcpyHtoD (dstDevice, srcHost, ByteCount); - - if (CU_err != CUDA_SUCCESS) - { - const char *pStr = NULL; - - if (cuda->cuGetErrorString (CU_err, &pStr) == CUDA_SUCCESS) - { - event_log_error (hashcat_ctx, "cuMemcpyHtoD(): %s", pStr); - } - else - { - event_log_error (hashcat_ctx, "cuMemcpyHtoD(): %d", CU_err); - } - - return -1; - } - - return 0; -} - int hc_cuMemcpyHtoDAsync (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount, CUstream hStream) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; @@ -2550,11 +2466,8 @@ int hip_init (hashcat_ctx_t *hashcat_ctx) HC_LOAD_FUNC_HIP (hip, hipLaunchKernel, hipModuleLaunchKernel, HIP_HIPLAUNCHKERNEL, HIP, 1); HC_LOAD_FUNC_HIP (hip, hipMemAlloc, hipMalloc, HIP_HIPMEMALLOC, HIP, 1); HC_LOAD_FUNC_HIP (hip, hipMemAllocHost, hipMemAllocHost, HIP_HIPMEMALLOCHOST, HIP, 1); - HC_LOAD_FUNC_HIP (hip, hipMemcpyDtoD, hipMemcpyDtoD, HIP_HIPMEMCPYDTOD, HIP, 1); HC_LOAD_FUNC_HIP (hip, hipMemcpyDtoDAsync, hipMemcpyDtoDAsync, HIP_HIPMEMCPYDTODASYNC, HIP, 1); - HC_LOAD_FUNC_HIP (hip, hipMemcpyDtoH, hipMemcpyDtoH, HIP_HIPMEMCPYDTOH, HIP, 1); HC_LOAD_FUNC_HIP (hip, hipMemcpyDtoHAsync, hipMemcpyDtoHAsync, HIP_HIPMEMCPYDTOHASYNC, HIP, 1); - HC_LOAD_FUNC_HIP (hip, hipMemcpyHtoD, hipMemcpyHtoD, HIP_HIPMEMCPYHTOD, HIP, 1); HC_LOAD_FUNC_HIP (hip, hipMemcpyHtoDAsync, hipMemcpyHtoDAsync, HIP_HIPMEMCPYHTODASYNC, HIP, 1); HC_LOAD_FUNC_HIP (hip, hipMemFree, hipFree, HIP_HIPMEMFREE, HIP, 1); HC_LOAD_FUNC_HIP (hip, hipMemFreeHost, hipFreeHost, HIP_HIPMEMFREEHOST, HIP, 1); @@ -2981,33 +2894,6 @@ int hc_hipMemFree (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dptr) return 0; } -int hc_hipMemcpyDtoH (hashcat_ctx_t *hashcat_ctx, void *dstHost, HIPdeviceptr srcDevice, size_t ByteCount) -{ - backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - - HIP_PTR *hip = (HIP_PTR *) backend_ctx->hip; - - const HIPresult HIP_err = hip->hipMemcpyDtoH (dstHost, srcDevice, ByteCount); - - if (HIP_err != HIP_SUCCESS) - { - const char *pStr = NULL; - - if (hip->hipGetErrorString (HIP_err, &pStr) == HIP_SUCCESS) - { - event_log_error (hashcat_ctx, "hipMemcpyDtoH(): %s", pStr); - } - else - { - event_log_error (hashcat_ctx, "hipMemcpyDtoH(): %d", HIP_err); - } - - return -1; - } - - return 0; -} - int hc_hipMemcpyDtoHAsync (hashcat_ctx_t *hashcat_ctx, void *dstHost, HIPdeviceptr srcDevice, size_t ByteCount, HIPstream hStream) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; @@ -3035,33 +2921,6 @@ int hc_hipMemcpyDtoHAsync (hashcat_ctx_t *hashcat_ctx, void *dstHost, HIPdevicep return 0; } -int hc_hipMemcpyDtoD (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dstDevice, HIPdeviceptr srcDevice, size_t ByteCount) -{ - backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - - HIP_PTR *hip = (HIP_PTR *) backend_ctx->hip; - - const HIPresult HIP_err = hip->hipMemcpyDtoD (dstDevice, srcDevice, ByteCount); - - if (HIP_err != HIP_SUCCESS) - { - const char *pStr = NULL; - - if (hip->hipGetErrorString (HIP_err, &pStr) == HIP_SUCCESS) - { - event_log_error (hashcat_ctx, "hipMemcpyDtoD(): %s", pStr); - } - else - { - event_log_error (hashcat_ctx, "hipMemcpyDtoD(): %d", HIP_err); - } - - return -1; - } - - return 0; -} - int hc_hipMemcpyDtoDAsync (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dstDevice, HIPdeviceptr srcDevice, size_t ByteCount, HIPstream hStream) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; @@ -3089,33 +2948,6 @@ int hc_hipMemcpyDtoDAsync (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dstDevice, H return 0; } -int hc_hipMemcpyHtoD (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dstDevice, const void *srcHost, size_t ByteCount) -{ - backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - - HIP_PTR *hip = (HIP_PTR *) backend_ctx->hip; - - const HIPresult HIP_err = hip->hipMemcpyHtoD (dstDevice, srcHost, ByteCount); - - if (HIP_err != HIP_SUCCESS) - { - const char *pStr = NULL; - - if (hip->hipGetErrorString (HIP_err, &pStr) == HIP_SUCCESS) - { - event_log_error (hashcat_ctx, "hipMemcpyHtoD(): %s", pStr); - } - else - { - event_log_error (hashcat_ctx, "hipMemcpyHtoD(): %d", HIP_err); - } - - return -1; - } - - return 0; -} - int hc_hipMemcpyHtoDAsync (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dstDevice, const void *srcHost, size_t ByteCount, HIPstream hStream) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; From 43a3622a7711e398c7bf561724ef4f9796ca481b Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Mon, 26 Jul 2021 20:57:24 +0300 Subject: [PATCH 22/64] Add necessary synchronization to check_hash() and check_cracked() --- src/hashes.c | 244 ++++++++++++++++++++++++++++----------------------- 1 file changed, 132 insertions(+), 112 deletions(-) diff --git a/src/hashes.c b/src/hashes.c index 0355a50ad..86616afad 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -313,6 +313,8 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl void *tmps = NULL; + cl_event opencl_event; + if (hashconfig->opts_type & OPTS_TYPE_COPY_TMPS) { tmps = hcmalloc (hashconfig->tmp_size); @@ -329,7 +331,7 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl if (device_param->is_opencl == true) { - hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_tmps, CL_FALSE, plain->gidvid * hashconfig->tmp_size, hashconfig->tmp_size, tmps, 0, NULL, NULL); + hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_tmps, CL_FALSE, plain->gidvid * hashconfig->tmp_size, hashconfig->tmp_size, tmps, 0, NULL, &opencl_event); } } @@ -343,9 +345,7 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl // plain - u8 plain_buf[0x1000]; // while the password itself can have only length 256, the module could encode it with something like base64 which inflates the requires buffer size - - memset (plain_buf, 0, sizeof (plain_buf)); + u8 plain_buf[HCBUFSIZ_TINY] = { 0 }; // while the password itself can have only length 256, the module could encode it with something like base64 which inflates the requires buffer size u8 *plain_ptr = plain_buf; @@ -355,9 +355,25 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl if (module_ctx->module_build_plain_postprocess != MODULE_DEFAULT) { - u8 temp_buf[0x1000]; + u8 temp_buf[HCBUFSIZ_TINY] = { 0 }; - memset (temp_buf, 0, sizeof (temp_buf)); + if (hashconfig->opts_type & OPTS_TYPE_COPY_TMPS) + { + if (device_param->is_cuda == true) + { + if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return; + } + + if (device_param->is_hip == true) + { + if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return; + } + + if (device_param->is_opencl == true) + { + if (hc_clWaitForEvents (hashcat_ctx, 1, &opencl_event) == -1) return; + } + } const int temp_len = module_ctx->module_build_plain_postprocess (hashcat_ctx->hashconfig, hashcat_ctx->hashes, tmps, (u32 *) plain_buf, sizeof (plain_buf), plain_len, (u32 *)temp_buf, sizeof (temp_buf)); @@ -407,6 +423,24 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl if (module_ctx->module_hash_encode_potfile != MODULE_DEFAULT) { + if (hashconfig->opts_type & OPTS_TYPE_COPY_TMPS) + { + if (device_param->is_cuda == true) + { + if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return; + } + + if (device_param->is_hip == true) + { + if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return; + } + + if (device_param->is_opencl == true) + { + if (hc_clWaitForEvents (hashcat_ctx, 1, &opencl_event) == -1) return; + } + } + salt_t *salts_buf = hashes->salts_buf; salts_buf += salt_pos; @@ -470,6 +504,11 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl if (hashconfig->opts_type & OPTS_TYPE_COPY_TMPS) { + if (device_param->is_opencl == true) + { + if (hc_clReleaseEvent (hashcat_ctx, opencl_event) == -1) return; + } + hcfree (tmps); } } @@ -485,172 +524,153 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) u32 num_cracked = 0; - int CU_rc; - int HIP_rc; - int CL_rc; - if (device_param->is_cuda == true) { - CU_rc = hc_cuMemcpyDtoHAsync (hashcat_ctx, &num_cracked, device_param->cuda_d_result, sizeof (u32), device_param->cuda_stream); + if (hc_cuMemcpyDtoHAsync (hashcat_ctx, &num_cracked, device_param->cuda_d_result, sizeof (u32), device_param->cuda_stream) == -1) return -1; - if (CU_rc == -1) return -1; + if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - HIP_rc = hc_hipMemcpyDtoHAsync (hashcat_ctx, &num_cracked, device_param->hip_d_result, sizeof (u32), device_param->hip_stream); + if (hc_hipMemcpyDtoHAsync (hashcat_ctx, &num_cracked, device_param->hip_d_result, sizeof (u32), device_param->hip_stream) == -1) return -1; - if (HIP_rc == -1) return -1; + if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) { - CL_rc = hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_result, CL_TRUE, 0, sizeof (u32), &num_cracked, 0, NULL, NULL); - - if (CL_rc == -1) return -1; + if (hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_result, CL_TRUE, 0, sizeof (u32), &num_cracked, 0, NULL, NULL) == -1) return -1; } - if (user_options->speed_only == true) + if (num_cracked == 0 || user_options->speed_only == true) { - // we want the hc_clEnqueueReadBuffer to run in benchmark mode because it has an influence in performance + // we want get num_cracked in benchmark mode because it has an influence in performance // however if the benchmark cracks the artificial hash used for benchmarks we don't want to see that! return 0; } - if (num_cracked) - { - plain_t *cracked = (plain_t *) hccalloc (num_cracked, sizeof (plain_t)); - - if (device_param->is_cuda == true) - { - CU_rc = hc_cuMemcpyDtoHAsync (hashcat_ctx, cracked, device_param->cuda_d_plain_bufs, num_cracked * sizeof (plain_t), device_param->cuda_stream); + plain_t *cracked = (plain_t *) hccalloc (num_cracked, sizeof (plain_t)); - if (CU_rc == -1) return -1; - } + if (device_param->is_cuda == true) + { + if (hc_cuMemcpyDtoHAsync (hashcat_ctx, cracked, device_param->cuda_d_plain_bufs, num_cracked * sizeof (plain_t), device_param->cuda_stream) == -1) return -1; - if (device_param->is_hip == true) - { - HIP_rc = hc_hipMemcpyDtoHAsync (hashcat_ctx, cracked, device_param->hip_d_plain_bufs, num_cracked * sizeof (plain_t), device_param->hip_stream); + if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; + } - if (HIP_rc == -1) return -1; - } + if (device_param->is_hip == true) + { + if (hc_hipMemcpyDtoHAsync (hashcat_ctx, cracked, device_param->hip_d_plain_bufs, num_cracked * sizeof (plain_t), device_param->hip_stream) == -1) return -1; - if (device_param->is_opencl == true) - { - CL_rc = hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_plain_bufs, CL_TRUE, 0, num_cracked * sizeof (plain_t), cracked, 0, NULL, NULL); + if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; + } - if (CL_rc == -1) return -1; - } + if (device_param->is_opencl == true) + { + if (hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_plain_bufs, CL_TRUE, 0, num_cracked * sizeof (plain_t), cracked, 0, NULL, NULL) == -1) return -1; + } - u32 cpt_cracked = 0; + u32 cpt_cracked = 0; - hc_thread_mutex_lock (status_ctx->mux_display); + hc_thread_mutex_lock (status_ctx->mux_display); - for (u32 i = 0; i < num_cracked; i++) - { - const u32 hash_pos = cracked[i].hash_pos; + for (u32 i = 0; i < num_cracked; i++) + { + const u32 hash_pos = cracked[i].hash_pos; - if (hashes->digests_shown[hash_pos] == 1) continue; + if (hashes->digests_shown[hash_pos] == 1) continue; - const u32 salt_pos = cracked[i].salt_pos; - salt_t *salt_buf = &hashes->salts_buf[salt_pos]; + const u32 salt_pos = cracked[i].salt_pos; + salt_t *salt_buf = &hashes->salts_buf[salt_pos]; - if ((hashconfig->opts_type & OPTS_TYPE_PT_NEVERCRACK) == 0) - { - hashes->digests_shown[hash_pos] = 1; + if ((hashconfig->opts_type & OPTS_TYPE_PT_NEVERCRACK) == 0) + { + hashes->digests_shown[hash_pos] = 1; - hashes->digests_done++; + hashes->digests_done++; - cpt_cracked++; + cpt_cracked++; - salt_buf->digests_done++; + salt_buf->digests_done++; - if (salt_buf->digests_done == salt_buf->digests_cnt) - { - hashes->salts_shown[salt_pos] = 1; + if (salt_buf->digests_done == salt_buf->digests_cnt) + { + hashes->salts_shown[salt_pos] = 1; - hashes->salts_done++; - } + hashes->salts_done++; } + } - if (hashes->salts_done == hashes->salts_cnt) mycracked (hashcat_ctx); - - check_hash (hashcat_ctx, device_param, &cracked[i]); - - if (hashconfig->opts_type & OPTS_TYPE_PT_NEVERCRACK) - { - // we need to reset cracked state on the device - // otherwise host thinks again and again the hash was cracked - // and returns invalid password each time - - memset (hashes->digests_shown_tmp, 0, salt_buf->digests_cnt * sizeof (u32)); + if (hashes->salts_done == hashes->salts_cnt) mycracked (hashcat_ctx); - if (device_param->is_cuda == true) - { - CU_rc = hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_digests_shown + (salt_buf->digests_offset * sizeof (u32)), &hashes->digests_shown_tmp[salt_buf->digests_offset], salt_buf->digests_cnt * sizeof (u32), device_param->cuda_stream); + check_hash (hashcat_ctx, device_param, &cracked[i]); - if (CU_rc == -1) return -1; - } + if (hashconfig->opts_type & OPTS_TYPE_PT_NEVERCRACK) + { + // we need to reset cracked state on the device + // otherwise host thinks again and again the hash was cracked + // and returns invalid password each time - if (device_param->is_hip == true) - { - HIP_rc = hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_digests_shown + (salt_buf->digests_offset * sizeof (u32)), &hashes->digests_shown_tmp[salt_buf->digests_offset], salt_buf->digests_cnt * sizeof (u32), device_param->hip_stream); + memset (hashes->digests_shown_tmp, 0, salt_buf->digests_cnt * sizeof (u32)); - if (HIP_rc == -1) return -1; - } + if (device_param->is_cuda == true) + { + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_digests_shown + (salt_buf->digests_offset * sizeof (u32)), &hashes->digests_shown_tmp[salt_buf->digests_offset], salt_buf->digests_cnt * sizeof (u32), device_param->cuda_stream) == -1) return -1; + } - if (device_param->is_opencl == true) - { - CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_digests_shown, CL_FALSE, salt_buf->digests_offset * sizeof (u32), salt_buf->digests_cnt * sizeof (u32), &hashes->digests_shown_tmp[salt_buf->digests_offset], 0, NULL, NULL); + if (device_param->is_hip == true) + { + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_digests_shown + (salt_buf->digests_offset * sizeof (u32)), &hashes->digests_shown_tmp[salt_buf->digests_offset], salt_buf->digests_cnt * sizeof (u32), device_param->hip_stream) == -1) return -1; + } - if (CL_rc == -1) return -1; - } + if (device_param->is_opencl == true) + { + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_digests_shown, CL_FALSE, salt_buf->digests_offset * sizeof (u32), salt_buf->digests_cnt * sizeof (u32), &hashes->digests_shown_tmp[salt_buf->digests_offset], 0, NULL, NULL) == -1) return -1; } } + } - hc_thread_mutex_unlock (status_ctx->mux_display); - - hcfree (cracked); + hc_thread_mutex_unlock (status_ctx->mux_display); - if (cpt_cracked > 0) - { - hc_thread_mutex_lock (status_ctx->mux_display); + hcfree (cracked); - cpt_ctx->cpt_buf[cpt_ctx->cpt_pos].timestamp = time (NULL); - cpt_ctx->cpt_buf[cpt_ctx->cpt_pos].cracked = cpt_cracked; + if (cpt_cracked > 0) + { + hc_thread_mutex_lock (status_ctx->mux_display); - cpt_ctx->cpt_pos++; + cpt_ctx->cpt_buf[cpt_ctx->cpt_pos].timestamp = time (NULL); + cpt_ctx->cpt_buf[cpt_ctx->cpt_pos].cracked = cpt_cracked; - cpt_ctx->cpt_total += cpt_cracked; + cpt_ctx->cpt_pos++; - if (cpt_ctx->cpt_pos == CPT_CACHE) cpt_ctx->cpt_pos = 0; + cpt_ctx->cpt_total += cpt_cracked; - hc_thread_mutex_unlock (status_ctx->mux_display); - } + if (cpt_ctx->cpt_pos == CPT_CACHE) cpt_ctx->cpt_pos = 0; - num_cracked = 0; + hc_thread_mutex_unlock (status_ctx->mux_display); + } - if (device_param->is_cuda == true) - { - CU_rc = hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_result, &num_cracked, sizeof (u32), device_param->cuda_stream); + num_cracked = 0; - if (CU_rc == -1) return -1; - } + if (device_param->is_cuda == true) + { + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_result, &num_cracked, sizeof (u32), device_param->cuda_stream) == -1) return -1; - if (device_param->is_hip == true) - { - HIP_rc = hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_result, &num_cracked, sizeof (u32), device_param->hip_stream); + if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; + } - if (HIP_rc == -1) return -1; - } + if (device_param->is_hip == true) + { + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_result, &num_cracked, sizeof (u32), device_param->hip_stream) == -1) return -1; - if (device_param->is_opencl == true) - { - CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_result, CL_FALSE, 0, sizeof (u32), &num_cracked, 0, NULL, NULL); + if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; + } - if (CL_rc == -1) return -1; - } + if (device_param->is_opencl == true) + { + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_result, CL_TRUE, 0, sizeof (u32), &num_cracked, 0, NULL, NULL) == -1) return -1; } return 0; From 73b8cda1764353ece4699708ed8fa32ec0632563 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Mon, 26 Jul 2021 22:25:50 +0300 Subject: [PATCH 23/64] Avoid unnecessary memcpy in check_hash() --- src/hashes.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/hashes.c b/src/hashes.c index 86616afad..946f3b1f6 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -346,6 +346,7 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl // plain u8 plain_buf[HCBUFSIZ_TINY] = { 0 }; // while the password itself can have only length 256, the module could encode it with something like base64 which inflates the requires buffer size + u8 postprocess_buf[HCBUFSIZ_TINY] = { 0 }; u8 *plain_ptr = plain_buf; @@ -355,8 +356,6 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl if (module_ctx->module_build_plain_postprocess != MODULE_DEFAULT) { - u8 temp_buf[HCBUFSIZ_TINY] = { 0 }; - if (hashconfig->opts_type & OPTS_TYPE_COPY_TMPS) { if (device_param->is_cuda == true) @@ -375,14 +374,9 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl } } - const int temp_len = module_ctx->module_build_plain_postprocess (hashcat_ctx->hashconfig, hashcat_ctx->hashes, tmps, (u32 *) plain_buf, sizeof (plain_buf), plain_len, (u32 *)temp_buf, sizeof (temp_buf)); - - if (temp_len < (int) sizeof (plain_buf)) - { - memcpy (plain_buf, temp_buf, temp_len); + plain_len = module_ctx->module_build_plain_postprocess (hashcat_ctx->hashconfig, hashcat_ctx->hashes, tmps, (u32 *) plain_buf, sizeof (plain_buf), plain_len, (u32 *) postprocess_buf, sizeof (postprocess_buf)); - plain_len = temp_len; - } + plain_ptr = postprocess_buf; } // crackpos From d7de3550b19b808a853ef45021fa24e2a947db49 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Tue, 27 Jul 2021 12:57:26 +0300 Subject: [PATCH 24/64] Add fast event for CUDA and HIP, and use it to synchronize check_hash() --- include/types.h | 2 ++ src/backend.c | 16 ++++++++++++++++ src/hashes.c | 36 ++++++++++++++++++------------------ 3 files changed, 36 insertions(+), 18 deletions(-) diff --git a/include/types.h b/include/types.h index 43e5a55da..93cb42bf4 100644 --- a/include/types.h +++ b/include/types.h @@ -1428,6 +1428,7 @@ typedef struct hc_device_param CUevent cuda_event1; CUevent cuda_event2; + CUevent cuda_event3; CUmodule cuda_module; CUmodule cuda_module_shared; @@ -1509,6 +1510,7 @@ typedef struct hc_device_param HIPevent hip_event1; HIPevent hip_event2; + HIPevent hip_event3; HIPmodule hip_module; HIPmodule hip_module_shared; diff --git a/src/backend.c b/src/backend.c index a6f42b672..73edce1ce 100644 --- a/src/backend.c +++ b/src/backend.c @@ -11360,6 +11360,12 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) device_param->skipped = true; continue; } + + if (hc_cuEventCreate (hashcat_ctx, &device_param->cuda_event3, CU_EVENT_DISABLE_TIMING) == -1) + { + device_param->skipped = true; + continue; + } } /** @@ -11379,6 +11385,12 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) device_param->skipped = true; continue; } + + if (hc_hipEventCreate (hashcat_ctx, &device_param->hip_event3, HIP_EVENT_DISABLE_TIMING) == -1) + { + device_param->skipped = true; + continue; + } } /** @@ -15214,6 +15226,7 @@ void backend_session_destroy (hashcat_ctx_t *hashcat_ctx) if (device_param->cuda_event1) hc_cuEventDestroy (hashcat_ctx, device_param->cuda_event1); if (device_param->cuda_event2) hc_cuEventDestroy (hashcat_ctx, device_param->cuda_event2); + if (device_param->cuda_event3) hc_cuEventDestroy (hashcat_ctx, device_param->cuda_event3); if (device_param->cuda_stream) hc_cuStreamDestroy (hashcat_ctx, device_param->cuda_stream); @@ -15289,6 +15302,7 @@ void backend_session_destroy (hashcat_ctx_t *hashcat_ctx) device_param->cuda_event1 = NULL; device_param->cuda_event2 = NULL; + device_param->cuda_event3 = NULL; device_param->cuda_stream = NULL; @@ -15341,6 +15355,7 @@ void backend_session_destroy (hashcat_ctx_t *hashcat_ctx) if (device_param->hip_event1) hc_hipEventDestroy (hashcat_ctx, device_param->hip_event1); if (device_param->hip_event2) hc_hipEventDestroy (hashcat_ctx, device_param->hip_event2); + if (device_param->hip_event3) hc_hipEventDestroy (hashcat_ctx, device_param->hip_event3); if (device_param->hip_stream) hc_hipStreamDestroy (hashcat_ctx, device_param->hip_stream); @@ -15416,6 +15431,7 @@ void backend_session_destroy (hashcat_ctx_t *hashcat_ctx) device_param->hip_event1 = NULL; device_param->hip_event2 = NULL; + device_param->hip_event3 = NULL; device_param->hip_stream = NULL; diff --git a/src/hashes.c b/src/hashes.c index 946f3b1f6..aa0d5e234 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -322,16 +322,22 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl if (device_param->is_cuda == true) { hc_cuMemcpyDtoHAsync (hashcat_ctx, tmps, device_param->cuda_d_tmps + (plain->gidvid * hashconfig->tmp_size), hashconfig->tmp_size, device_param->cuda_stream); + + hc_cuEventRecord (hashcat_ctx, device_param->cuda_event3, device_param->cuda_stream); } if (device_param->is_hip == true) { hc_hipMemcpyDtoHAsync (hashcat_ctx, tmps, device_param->hip_d_tmps + (plain->gidvid * hashconfig->tmp_size), hashconfig->tmp_size, device_param->hip_stream); + + hc_hipEventRecord (hashcat_ctx, device_param->hip_event3, device_param->hip_stream); } if (device_param->is_opencl == true) { hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_tmps, CL_FALSE, plain->gidvid * hashconfig->tmp_size, hashconfig->tmp_size, tmps, 0, NULL, &opencl_event); + + hc_clFlush (hashcat_ctx, device_param->opencl_command_queue); } } @@ -360,12 +366,12 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl { if (device_param->is_cuda == true) { - if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return; + if (hc_cuEventSynchronize (hashcat_ctx, device_param->cuda_event3) == -1) return; } if (device_param->is_hip == true) { - if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return; + if (hc_hipEventSynchronize (hashcat_ctx, device_param->hip_event3) == -1) return; } if (device_param->is_opencl == true) @@ -421,12 +427,12 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl { if (device_param->is_cuda == true) { - if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return; + if (hc_cuEventSynchronize (hashcat_ctx, device_param->cuda_event3) == -1) return; } if (device_param->is_hip == true) { - if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return; + if (hc_hipEventSynchronize (hashcat_ctx, device_param->hip_event3) == -1) return; } if (device_param->is_opencl == true) @@ -607,21 +613,19 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) // otherwise host thinks again and again the hash was cracked // and returns invalid password each time - memset (hashes->digests_shown_tmp, 0, salt_buf->digests_cnt * sizeof (u32)); - if (device_param->is_cuda == true) { - if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_digests_shown + (salt_buf->digests_offset * sizeof (u32)), &hashes->digests_shown_tmp[salt_buf->digests_offset], salt_buf->digests_cnt * sizeof (u32), device_param->cuda_stream) == -1) return -1; + if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_digests_shown + (salt_buf->digests_offset * sizeof (u32)), hashes->digests_shown_tmp, salt_buf->digests_cnt * sizeof (u32), device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_digests_shown + (salt_buf->digests_offset * sizeof (u32)), &hashes->digests_shown_tmp[salt_buf->digests_offset], salt_buf->digests_cnt * sizeof (u32), device_param->hip_stream) == -1) return -1; + if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_digests_shown + (salt_buf->digests_offset * sizeof (u32)), hashes->digests_shown_tmp, salt_buf->digests_cnt * sizeof (u32), device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_digests_shown, CL_FALSE, salt_buf->digests_offset * sizeof (u32), salt_buf->digests_cnt * sizeof (u32), &hashes->digests_shown_tmp[salt_buf->digests_offset], 0, NULL, NULL) == -1) return -1; + if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_digests_shown, CL_FALSE, salt_buf->digests_offset * sizeof (u32), salt_buf->digests_cnt * sizeof (u32), hashes->digests_shown_tmp, 0, NULL, NULL) == -1) return -1; } } } @@ -646,25 +650,21 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) hc_thread_mutex_unlock (status_ctx->mux_display); } - num_cracked = 0; - if (device_param->is_cuda == true) { - if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_result, &num_cracked, sizeof (u32), device_param->cuda_stream) == -1) return -1; - - if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; + if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_result, sizeof (u32)) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_result, &num_cracked, sizeof (u32), device_param->hip_stream) == -1) return -1; - - if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; + if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_result, sizeof (u32)) == -1) return -1; } if (device_param->is_opencl == true) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_result, CL_TRUE, 0, sizeof (u32), &num_cracked, 0, NULL, NULL) == -1) return -1; + if (run_opencl_kernel_bzero (hashcat_ctx, device_param, device_param->opencl_d_result, sizeof (u32)) == -1) return -1; + + if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; } return 0; From ae44a3022b383276ea12775646ad88c2422b8870 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Tue, 27 Jul 2021 13:00:39 +0300 Subject: [PATCH 25/64] Use fast event to synchronize selftest() --- src/selftest.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/selftest.c b/src/selftest.c index 77ad8f23b..d5fff9433 100644 --- a/src/selftest.c +++ b/src/selftest.c @@ -695,14 +695,14 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param { if (hc_cuMemcpyDtoHAsync (hashcat_ctx, &num_cracked, device_param->cuda_d_result, sizeof (u32), device_param->cuda_stream) == -1) return -1; - if (hc_cuEventRecord (hashcat_ctx, device_param->cuda_event1, device_param->cuda_stream) == -1) return -1; + if (hc_cuEventRecord (hashcat_ctx, device_param->cuda_event3, device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { if (hc_hipMemcpyDtoHAsync (hashcat_ctx, &num_cracked, device_param->hip_d_result, sizeof (u32), device_param->hip_stream) == -1) return -1; - if (hc_hipEventRecord (hashcat_ctx, device_param->hip_event1, device_param->hip_stream) == -1) return -1; + if (hc_hipEventRecord (hashcat_ctx, device_param->hip_event3, device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) @@ -837,12 +837,12 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param // synchronize and .. if (device_param->is_cuda == true) { - if (hc_cuEventSynchronize (hashcat_ctx, device_param->cuda_event1) == -1) return -1; + if (hc_cuEventSynchronize (hashcat_ctx, device_param->cuda_event3) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipEventSynchronize (hashcat_ctx, device_param->hip_event1) == -1) return -1; + if (hc_hipEventSynchronize (hashcat_ctx, device_param->hip_event3) == -1) return -1; } if (device_param->is_opencl == true) From be33ccaa6c750897706abccf9a6067edd8b64b6e Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Tue, 27 Jul 2021 14:36:48 +0300 Subject: [PATCH 26/64] check_hash() needs to return value to indicate possible error --- include/hashes.h | 2 +- src/hashes.c | 70 +++++++++++++++++++++++++++++++++++------------- 2 files changed, 53 insertions(+), 19 deletions(-) diff --git a/include/hashes.h b/include/hashes.h index ca88cab13..1e043aad4 100644 --- a/include/hashes.h +++ b/include/hashes.h @@ -15,7 +15,7 @@ int hash_encode (const hashconfig_t *hashconfig, const hashes_t *hashes, const m int save_hash (hashcat_ctx_t *hashcat_ctx); -void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain); +int check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain); //int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 salt_pos); int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param); diff --git a/src/hashes.c b/src/hashes.c index aa0d5e234..b143ed406 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -300,7 +300,7 @@ int save_hash (hashcat_ctx_t *hashcat_ctx) return 0; } -void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain) +int check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain) { const debugfile_ctx_t *debugfile_ctx = hashcat_ctx->debugfile_ctx; const hashes_t *hashes = hashcat_ctx->hashes; @@ -314,6 +314,7 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl void *tmps = NULL; cl_event opencl_event; + int rc; if (hashconfig->opts_type & OPTS_TYPE_COPY_TMPS) { @@ -321,23 +322,53 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl if (device_param->is_cuda == true) { - hc_cuMemcpyDtoHAsync (hashcat_ctx, tmps, device_param->cuda_d_tmps + (plain->gidvid * hashconfig->tmp_size), hashconfig->tmp_size, device_param->cuda_stream); + rc = hc_cuMemcpyDtoHAsync (hashcat_ctx, tmps, device_param->cuda_d_tmps + (plain->gidvid * hashconfig->tmp_size), hashconfig->tmp_size, device_param->cuda_stream); - hc_cuEventRecord (hashcat_ctx, device_param->cuda_event3, device_param->cuda_stream); + if (rc == 0) + { + rc = hc_cuEventRecord (hashcat_ctx, device_param->cuda_event3, device_param->cuda_stream); + } + + if (rc == -1) + { + free(tmps); + + return -1; + } } if (device_param->is_hip == true) { - hc_hipMemcpyDtoHAsync (hashcat_ctx, tmps, device_param->hip_d_tmps + (plain->gidvid * hashconfig->tmp_size), hashconfig->tmp_size, device_param->hip_stream); + rc = hc_hipMemcpyDtoHAsync (hashcat_ctx, tmps, device_param->hip_d_tmps + (plain->gidvid * hashconfig->tmp_size), hashconfig->tmp_size, device_param->hip_stream); - hc_hipEventRecord (hashcat_ctx, device_param->hip_event3, device_param->hip_stream); + if (rc == 0) + { + rc = hc_hipEventRecord (hashcat_ctx, device_param->hip_event3, device_param->hip_stream); + } + + if (rc == -1) + { + free(tmps); + + return -1; + } } if (device_param->is_opencl == true) { - hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_tmps, CL_FALSE, plain->gidvid * hashconfig->tmp_size, hashconfig->tmp_size, tmps, 0, NULL, &opencl_event); + rc = hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_tmps, CL_FALSE, plain->gidvid * hashconfig->tmp_size, hashconfig->tmp_size, tmps, 0, NULL, &opencl_event); - hc_clFlush (hashcat_ctx, device_param->opencl_command_queue); + if (rc == 0) + { + rc = hc_clFlush (hashcat_ctx, device_param->opencl_command_queue); + } + + if (rc == -1) + { + free(tmps); + + return -1; + } } } @@ -345,7 +376,7 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl u8 *out_buf = hashes->out_buf; - int out_len = hash_encode (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, (char *) out_buf, HCBUFSIZ_LARGE, salt_pos, digest_pos); + int out_len = hash_encode (hashconfig, hashes, module_ctx, (char *) out_buf, HCBUFSIZ_LARGE, salt_pos, digest_pos); out_buf[out_len] = 0; @@ -366,21 +397,21 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl { if (device_param->is_cuda == true) { - if (hc_cuEventSynchronize (hashcat_ctx, device_param->cuda_event3) == -1) return; + if (hc_cuEventSynchronize (hashcat_ctx, device_param->cuda_event3) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipEventSynchronize (hashcat_ctx, device_param->hip_event3) == -1) return; + if (hc_hipEventSynchronize (hashcat_ctx, device_param->hip_event3) == -1) return -1; } if (device_param->is_opencl == true) { - if (hc_clWaitForEvents (hashcat_ctx, 1, &opencl_event) == -1) return; + if (hc_clWaitForEvents (hashcat_ctx, 1, &opencl_event) == -1) return -1; } } - plain_len = module_ctx->module_build_plain_postprocess (hashcat_ctx->hashconfig, hashcat_ctx->hashes, tmps, (u32 *) plain_buf, sizeof (plain_buf), plain_len, (u32 *) postprocess_buf, sizeof (postprocess_buf)); + plain_len = module_ctx->module_build_plain_postprocess (hashconfig, hashes, tmps, (u32 *) plain_buf, sizeof (plain_buf), plain_len, (u32 *) postprocess_buf, sizeof (postprocess_buf)); plain_ptr = postprocess_buf; } @@ -427,17 +458,17 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl { if (device_param->is_cuda == true) { - if (hc_cuEventSynchronize (hashcat_ctx, device_param->cuda_event3) == -1) return; + if (hc_cuEventSynchronize (hashcat_ctx, device_param->cuda_event3) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipEventSynchronize (hashcat_ctx, device_param->hip_event3) == -1) return; + if (hc_hipEventSynchronize (hashcat_ctx, device_param->hip_event3) == -1) return -1; } if (device_param->is_opencl == true) { - if (hc_clWaitForEvents (hashcat_ctx, 1, &opencl_event) == -1) return; + if (hc_clWaitForEvents (hashcat_ctx, 1, &opencl_event) == -1) return -1; } } @@ -504,13 +535,15 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl if (hashconfig->opts_type & OPTS_TYPE_COPY_TMPS) { + hcfree (tmps); + if (device_param->is_opencl == true) { - if (hc_clReleaseEvent (hashcat_ctx, opencl_event) == -1) return; + if (hc_clReleaseEvent (hashcat_ctx, opencl_event) == -1) return -1; } - - hcfree (tmps); } + + return 0; } //int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 salt_pos) @@ -605,6 +638,7 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) if (hashes->salts_done == hashes->salts_cnt) mycracked (hashcat_ctx); + /* TODO: handle check_hash return value */ check_hash (hashcat_ctx, device_param, &cracked[i]); if (hashconfig->opts_type & OPTS_TYPE_PT_NEVERCRACK) From e8be7028cdb048aa9e56ddad0c3d193c7d2df45c Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Tue, 27 Jul 2021 16:28:07 +0300 Subject: [PATCH 27/64] Handle errors inside check_cracked() --- src/hashes.c | 78 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 68 insertions(+), 10 deletions(-) diff --git a/src/hashes.c b/src/hashes.c index b143ed406..5679a5442 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -556,6 +556,7 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) user_options_t *user_options = hashcat_ctx->user_options; u32 num_cracked = 0; + int rc; if (device_param->is_cuda == true) { @@ -588,21 +589,48 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) if (device_param->is_cuda == true) { - if (hc_cuMemcpyDtoHAsync (hashcat_ctx, cracked, device_param->cuda_d_plain_bufs, num_cracked * sizeof (plain_t), device_param->cuda_stream) == -1) return -1; + rc = hc_cuMemcpyDtoHAsync (hashcat_ctx, cracked, device_param->cuda_d_plain_bufs, num_cracked * sizeof (plain_t), device_param->cuda_stream); - if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; + if (rc == 0) + { + rc = hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream); + } + + if (rc == -1) + { + hcfree (cracked); + + return -1; + } } if (device_param->is_hip == true) { - if (hc_hipMemcpyDtoHAsync (hashcat_ctx, cracked, device_param->hip_d_plain_bufs, num_cracked * sizeof (plain_t), device_param->hip_stream) == -1) return -1; + rc = hc_hipMemcpyDtoHAsync (hashcat_ctx, cracked, device_param->hip_d_plain_bufs, num_cracked * sizeof (plain_t), device_param->hip_stream); - if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; + if (rc == 0) + { + rc = hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream); + } + + if (rc == -1) + { + hcfree (cracked); + + return -1; + } } if (device_param->is_opencl == true) { - if (hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_plain_bufs, CL_TRUE, 0, num_cracked * sizeof (plain_t), cracked, 0, NULL, NULL) == -1) return -1; + rc = hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_plain_bufs, CL_TRUE, 0, num_cracked * sizeof (plain_t), cracked, 0, NULL, NULL); + + if (rc == -1) + { + hcfree (cracked); + + return -1; + } } u32 cpt_cracked = 0; @@ -638,8 +666,12 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) if (hashes->salts_done == hashes->salts_cnt) mycracked (hashcat_ctx); - /* TODO: handle check_hash return value */ - check_hash (hashcat_ctx, device_param, &cracked[i]); + rc = check_hash (hashcat_ctx, device_param, &cracked[i]); + + if (rc == -1) + { + break; + } if (hashconfig->opts_type & OPTS_TYPE_PT_NEVERCRACK) { @@ -647,19 +679,40 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) // otherwise host thinks again and again the hash was cracked // and returns invalid password each time + /* TODO: this is bad design -- digests_shown_tmp is only used for zeroing */ if (device_param->is_cuda == true) { - if (hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_digests_shown + (salt_buf->digests_offset * sizeof (u32)), hashes->digests_shown_tmp, salt_buf->digests_cnt * sizeof (u32), device_param->cuda_stream) == -1) return -1; + rc = hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_digests_shown + (salt_buf->digests_offset * sizeof (u32)), hashes->digests_shown_tmp, salt_buf->digests_cnt * sizeof (u32), device_param->cuda_stream); + + if (rc == -1) + { + break; + } } if (device_param->is_hip == true) { - if (hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_digests_shown + (salt_buf->digests_offset * sizeof (u32)), hashes->digests_shown_tmp, salt_buf->digests_cnt * sizeof (u32), device_param->hip_stream) == -1) return -1; + rc = hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_digests_shown + (salt_buf->digests_offset * sizeof (u32)), hashes->digests_shown_tmp, salt_buf->digests_cnt * sizeof (u32), device_param->hip_stream); + + if (rc == -1) + { + break; + } } if (device_param->is_opencl == true) { - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_digests_shown, CL_FALSE, salt_buf->digests_offset * sizeof (u32), salt_buf->digests_cnt * sizeof (u32), hashes->digests_shown_tmp, 0, NULL, NULL) == -1) return -1; + rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_digests_shown, CL_FALSE, salt_buf->digests_offset * sizeof (u32), salt_buf->digests_cnt * sizeof (u32), hashes->digests_shown_tmp, 0, NULL, NULL); + + if (rc == 0) + { + rc = hc_clFlush (hashcat_ctx, device_param->opencl_command_queue); + } + + if (rc == -1) + { + break; + } } } } @@ -668,6 +721,11 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) hcfree (cracked); + if (rc == -1) + { + return -1; + } + if (cpt_cracked > 0) { hc_thread_mutex_lock (status_ctx->mux_display); From cdf27a1cb351a026375d974836340a8e7a7c6a2e Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Tue, 27 Jul 2021 18:56:59 +0300 Subject: [PATCH 28/64] Implement async run_cuda_kernel_memset() and run_cuda_kernel_memset32() --- include/backend.h | 14 ++- include/ext_OpenCL.h | 2 + include/ext_cuda.h | 8 +- include/ext_hip.h | 8 +- src/backend.c | 280 +++++++++++++++++++++++++++++-------------- 5 files changed, 208 insertions(+), 104 deletions(-) diff --git a/include/backend.h b/include/backend.h index a54ba357e..c2c984b24 100644 --- a/include/backend.h +++ b/include/backend.h @@ -72,6 +72,8 @@ int hc_cuMemcpyDtoDAsync (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dstDev int hc_cuMemcpyDtoHAsync (hashcat_ctx_t *hashcat_ctx, void *dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream); int hc_cuMemcpyHtoDAsync (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount, CUstream hStream); int hc_cuMemFree (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dptr); +int hc_cuMemsetD32Async (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dstDevice, unsigned int ui, size_t N, CUstream hStream); +int hc_cuMemsetD8Async (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dstDevice, unsigned char uc, size_t N, CUstream hStream); int hc_cuModuleGetFunction (hashcat_ctx_t *hashcat_ctx, CUfunction *hfunc, CUmodule hmod, const char *name); int hc_cuModuleLoadDataEx (hashcat_ctx_t *hashcat_ctx, CUmodule *module, const void *image, unsigned int numOptions, CUjit_option *options, void **optionValues); int hc_cuModuleUnload (hashcat_ctx_t *hashcat_ctx, CUmodule hmod); @@ -120,6 +122,8 @@ int hc_hipMemcpyDtoDAsync (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dstDe int hc_hipMemcpyDtoHAsync (hashcat_ctx_t *hashcat_ctx, void *dstHost, HIPdeviceptr srcDevice, size_t ByteCount, HIPstream hStream); int hc_hipMemcpyHtoDAsync (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dstDevice, const void *srcHost, size_t ByteCount, HIPstream hStream); int hc_hipMemFree (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dptr); +int hc_hipMemsetD32Async (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dstDevice, unsigned int ui, size_t N, HIPstream hStream); +int hc_hipMemsetD8Async (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dstDevice, unsigned char uc, size_t N, HIPstream hStream); int hc_hipModuleGetFunction (hashcat_ctx_t *hashcat_ctx, HIPfunction *hfunc, HIPmodule hmod, const char *name); int hc_hipModuleLoadDataEx (hashcat_ctx_t *hashcat_ctx, HIPmodule *module, const void *image, unsigned int numOptions, HIPjit_option *options, void **optionValues); int hc_hipModuleUnload (hashcat_ctx_t *hashcat_ctx, HIPmodule hmod); @@ -142,6 +146,7 @@ int hc_clCreateKernel (hashcat_ctx_t *hashcat_ctx, cl_program program int hc_clCreateProgramWithBinary (hashcat_ctx_t *hashcat_ctx, cl_context context, cl_uint num_devices, const cl_device_id *device_list, const size_t *lengths, const unsigned char **binaries, cl_int *binary_status, cl_program *program); int hc_clCreateProgramWithSource (hashcat_ctx_t *hashcat_ctx, cl_context context, cl_uint count, const char **strings, const size_t *lengths, cl_program *program); int hc_clEnqueueCopyBuffer (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer, size_t src_offset, size_t dst_offset, size_t size, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event); +int hc_clEnqueueFillBuffer (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_mem buffer, const void *pattern, size_t pattern_size, size_t offset, size_t size, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event); int hc_clEnqueueMapBuffer (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_map, cl_map_flags map_flags, size_t offset, size_t size, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event, void **buf); int hc_clEnqueueNDRangeKernel (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim, const size_t *global_work_offset, const size_t *global_work_size, const size_t *local_work_size, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event); int hc_clEnqueueReadBuffer (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, size_t offset, size_t size, void *ptr, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event); @@ -177,17 +182,20 @@ void rebuild_pws_compressed_append (hc_device_param_t *device_param, const u64 p int run_cuda_kernel_atinit (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, CUdeviceptr buf, const u64 num); int run_cuda_kernel_utf8toutf16le (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, CUdeviceptr buf, const u64 num); -int run_cuda_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, CUdeviceptr buf, const u32 value, const u64 size); +int run_cuda_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, CUdeviceptr buf, const u64 offset, const u8 value, const u64 size); +int run_cuda_kernel_memset32 (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, CUdeviceptr buf, const u64 offset, const u32 value, const u64 size); int run_cuda_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, CUdeviceptr buf, const u64 size); int run_hip_kernel_atinit (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, HIPdeviceptr buf, const u64 num); int run_hip_kernel_utf8toutf16le (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, HIPdeviceptr buf, const u64 num); -int run_hip_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, HIPdeviceptr buf, const u32 value, const u64 size); +int run_hip_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, HIPdeviceptr buf, const u64 offset, const u8 value, const u64 size); +int run_hip_kernel_memset32 (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, HIPdeviceptr buf, const u64 offset, const u32 value, const u64 size); int run_hip_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, HIPdeviceptr buf, const u64 size); int run_opencl_kernel_atinit (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u64 num); int run_opencl_kernel_utf8toutf16le (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u64 num); -int run_opencl_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u32 value, const u64 size); +int run_opencl_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u64 offset, const u8 value, const u64 size); +int run_opencl_kernel_memset32 (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u64 offset, const u32 value, const u64 size); int run_opencl_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u64 size); int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 kern_run, const u64 pws_pos, const u64 num, const u32 event_update, const u32 iteration); diff --git a/include/ext_OpenCL.h b/include/ext_OpenCL.h index 42e37deed..40f3515ed 100644 --- a/include/ext_OpenCL.h +++ b/include/ext_OpenCL.h @@ -46,6 +46,7 @@ typedef cl_context (CL_API_CALL *OCL_CLCREATECONTEXT) (const cl_ typedef cl_kernel (CL_API_CALL *OCL_CLCREATEKERNEL) (cl_program, const char *, cl_int *); typedef cl_program (CL_API_CALL *OCL_CLCREATEPROGRAMWITHBINARY) (cl_context, cl_uint, const cl_device_id *, const size_t *, const unsigned char **, cl_int *, cl_int *); typedef cl_program (CL_API_CALL *OCL_CLCREATEPROGRAMWITHSOURCE) (cl_context, cl_uint, const char **, const size_t *, cl_int *); +typedef cl_int (CL_API_CALL *OCL_CLENQUEUEFILLBUFFER) (cl_command_queue, cl_mem, const void *, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *); typedef cl_int (CL_API_CALL *OCL_CLENQUEUECOPYBUFFER) (cl_command_queue, cl_mem, cl_mem, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *); typedef void * (CL_API_CALL *OCL_CLENQUEUEMAPBUFFER) (cl_command_queue, cl_mem, cl_bool, cl_map_flags, size_t, size_t, cl_uint, const cl_event *, cl_event *, cl_int *); typedef cl_int (CL_API_CALL *OCL_CLENQUEUENDRANGEKERNEL) (cl_command_queue, cl_kernel, cl_uint, const size_t *, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *); @@ -87,6 +88,7 @@ typedef struct hc_opencl_lib OCL_CLCREATEPROGRAMWITHBINARY clCreateProgramWithBinary; OCL_CLCREATEPROGRAMWITHSOURCE clCreateProgramWithSource; OCL_CLENQUEUECOPYBUFFER clEnqueueCopyBuffer; + OCL_CLENQUEUEFILLBUFFER clEnqueueFillBuffer; OCL_CLENQUEUEMAPBUFFER clEnqueueMapBuffer; OCL_CLENQUEUENDRANGEKERNEL clEnqueueNDRangeKernel; OCL_CLENQUEUEREADBUFFER clEnqueueReadBuffer; diff --git a/include/ext_cuda.h b/include/ext_cuda.h index 7f40e1410..11ed86048 100644 --- a/include/ext_cuda.h +++ b/include/ext_cuda.h @@ -1034,8 +1034,8 @@ typedef CUresult (CUDA_API_CALL *CUDA_CUMEMCPYHTODASYNC) (CUdeviceptr, co typedef CUresult (CUDA_API_CALL *CUDA_CUMEMFREE) (CUdeviceptr); typedef CUresult (CUDA_API_CALL *CUDA_CUMEMFREEHOST) (void *); typedef CUresult (CUDA_API_CALL *CUDA_CUMEMGETINFO) (size_t *, size_t *); -typedef CUresult (CUDA_API_CALL *CUDA_CUMEMSETD32) (CUdeviceptr, unsigned int, size_t); -typedef CUresult (CUDA_API_CALL *CUDA_CUMEMSETD8) (CUdeviceptr, unsigned char, size_t); +typedef CUresult (CUDA_API_CALL *CUDA_CUMEMSETD32ASYNC) (CUdeviceptr, unsigned int, size_t, CUstream); +typedef CUresult (CUDA_API_CALL *CUDA_CUMEMSETD8ASYNC) (CUdeviceptr, unsigned char, size_t, CUstream); typedef CUresult (CUDA_API_CALL *CUDA_CUMODULEGETFUNCTION) (CUfunction *, CUmodule, const char *); typedef CUresult (CUDA_API_CALL *CUDA_CUMODULEGETGLOBAL) (CUdeviceptr *, size_t *, CUmodule, const char *); typedef CUresult (CUDA_API_CALL *CUDA_CUMODULELOAD) (CUmodule *, const char *); @@ -1096,8 +1096,8 @@ typedef struct hc_cuda_lib CUDA_CUMEMFREE cuMemFree; CUDA_CUMEMFREEHOST cuMemFreeHost; CUDA_CUMEMGETINFO cuMemGetInfo; - CUDA_CUMEMSETD32 cuMemsetD32; - CUDA_CUMEMSETD8 cuMemsetD8; + CUDA_CUMEMSETD32ASYNC cuMemsetD32Async; + CUDA_CUMEMSETD8ASYNC cuMemsetD8Async; CUDA_CUMODULEGETFUNCTION cuModuleGetFunction; CUDA_CUMODULEGETGLOBAL cuModuleGetGlobal; CUDA_CUMODULELOAD cuModuleLoad; diff --git a/include/ext_hip.h b/include/ext_hip.h index 631dbfb33..ee344a80b 100644 --- a/include/ext_hip.h +++ b/include/ext_hip.h @@ -1043,8 +1043,8 @@ typedef HIPresult (HIP_API_CALL *HIP_HIPMEMCPYHTODASYNC) (HIPdeviceptr, c typedef HIPresult (HIP_API_CALL *HIP_HIPMEMFREE) (HIPdeviceptr); typedef HIPresult (HIP_API_CALL *HIP_HIPMEMFREEHOST) (void *); typedef HIPresult (HIP_API_CALL *HIP_HIPMEMGETINFO) (size_t *, size_t *); -typedef HIPresult (HIP_API_CALL *HIP_HIPMEMSETD32) (HIPdeviceptr, unsigned int, size_t); -typedef HIPresult (HIP_API_CALL *HIP_HIPMEMSETD8) (HIPdeviceptr, unsigned char, size_t); +typedef HIPresult (HIP_API_CALL *HIP_HIPMEMSETD32ASYNC) (HIPdeviceptr, unsigned int, size_t, HIPstream); +typedef HIPresult (HIP_API_CALL *HIP_HIPMEMSETD8ASYNC) (HIPdeviceptr, unsigned char, size_t, HIPstream); typedef HIPresult (HIP_API_CALL *HIP_HIPMODULEGETFUNCTION) (HIPfunction *, HIPmodule, const char *); typedef HIPresult (HIP_API_CALL *HIP_HIPMODULEGETGLOBAL) (HIPdeviceptr *, size_t *, HIPmodule, const char *); typedef HIPresult (HIP_API_CALL *HIP_HIPMODULELOAD) (HIPmodule *, const char *); @@ -1105,8 +1105,8 @@ typedef struct hc_hip_lib HIP_HIPMEMFREE hipMemFree; HIP_HIPMEMFREEHOST hipMemFreeHost; HIP_HIPMEMGETINFO hipMemGetInfo; - HIP_HIPMEMSETD32 hipMemsetD32; - HIP_HIPMEMSETD8 hipMemsetD8; + HIP_HIPMEMSETD32ASYNC hipMemsetD32Async; + HIP_HIPMEMSETD8ASYNC hipMemsetD8Async; HIP_HIPMODULEGETFUNCTION hipModuleGetFunction; HIP_HIPMODULEGETGLOBAL hipModuleGetGlobal; HIP_HIPMODULELOAD hipModuleLoad; diff --git a/src/backend.c b/src/backend.c index 73edce1ce..69b6345c6 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1263,8 +1263,8 @@ int cuda_init (hashcat_ctx_t *hashcat_ctx) HC_LOAD_FUNC_CUDA (cuda, cuMemFree, cuMemFree_v2, CUDA_CUMEMFREE, CUDA, 1); HC_LOAD_FUNC_CUDA (cuda, cuMemFreeHost, cuMemFreeHost, CUDA_CUMEMFREEHOST, CUDA, 1); HC_LOAD_FUNC_CUDA (cuda, cuMemGetInfo, cuMemGetInfo_v2, CUDA_CUMEMGETINFO, CUDA, 1); - HC_LOAD_FUNC_CUDA (cuda, cuMemsetD32, cuMemsetD32_v2, CUDA_CUMEMSETD32, CUDA, 1); - HC_LOAD_FUNC_CUDA (cuda, cuMemsetD8, cuMemsetD8_v2, CUDA_CUMEMSETD8, CUDA, 1); + HC_LOAD_FUNC_CUDA (cuda, cuMemsetD32Async, cuMemsetD32Async, CUDA_CUMEMSETD32ASYNC, CUDA, 1); + HC_LOAD_FUNC_CUDA (cuda, cuMemsetD8Async, cuMemsetD8Async, CUDA_CUMEMSETD8ASYNC, CUDA, 1); HC_LOAD_FUNC_CUDA (cuda, cuModuleGetFunction, cuModuleGetFunction, CUDA_CUMODULEGETFUNCTION, CUDA, 1); HC_LOAD_FUNC_CUDA (cuda, cuModuleGetGlobal, cuModuleGetGlobal_v2, CUDA_CUMODULEGETGLOBAL, CUDA, 1); HC_LOAD_FUNC_CUDA (cuda, cuModuleLoad, cuModuleLoad, CUDA_CUMODULELOAD, CUDA, 1); @@ -1765,6 +1765,60 @@ int hc_cuMemcpyHtoDAsync (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dstDevice, con return 0; } +int hc_cuMemsetD32Async (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dstDevice, unsigned int ui, size_t N, CUstream hStream) +{ + backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; + + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; + + const CUresult CU_err = cuda->cuMemsetD32Async (dstDevice, ui, N, hStream); + + if (CU_err != CUDA_SUCCESS) + { + const char *pStr = NULL; + + if (cuda->cuGetErrorString (CU_err, &pStr) == CUDA_SUCCESS) + { + event_log_error (hashcat_ctx, "cuMemsetD32Async(): %s", pStr); + } + else + { + event_log_error (hashcat_ctx, "cuMemsetD32Async(): %d", CU_err); + } + + return -1; + } + + return 0; +} + +int hc_cuMemsetD8Async (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dstDevice, unsigned char uc, size_t N, CUstream hStream) +{ + backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; + + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; + + const CUresult CU_err = cuda->cuMemsetD8Async (dstDevice, uc, N, hStream); + + if (CU_err != CUDA_SUCCESS) + { + const char *pStr = NULL; + + if (cuda->cuGetErrorString (CU_err, &pStr) == CUDA_SUCCESS) + { + event_log_error (hashcat_ctx, "cuMemsetD8Async(): %s", pStr); + } + else + { + event_log_error (hashcat_ctx, "cuMemsetD8Async(): %d", CU_err); + } + + return -1; + } + + return 0; +} + int hc_cuModuleGetFunction (hashcat_ctx_t *hashcat_ctx, CUfunction *hfunc, CUmodule hmod, const char *name) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; @@ -2472,8 +2526,8 @@ int hip_init (hashcat_ctx_t *hashcat_ctx) HC_LOAD_FUNC_HIP (hip, hipMemFree, hipFree, HIP_HIPMEMFREE, HIP, 1); HC_LOAD_FUNC_HIP (hip, hipMemFreeHost, hipFreeHost, HIP_HIPMEMFREEHOST, HIP, 1); HC_LOAD_FUNC_HIP (hip, hipMemGetInfo, hipMemGetInfo, HIP_HIPMEMGETINFO, HIP, 1); - //HC_LOAD_FUNC_HIP (hip, hipMemsetD32, hipMemsetD32, HIP_HIPMEMSETD32, HIP, 1); - //HC_LOAD_FUNC_HIP (hip, hipMemsetD8, hipMemsetD8, HIP_HIPMEMSETD8, HIP, 1); + HC_LOAD_FUNC_HIP (hip, hipMemsetD32Async, hipMemsetD32Async, HIP_HIPMEMSETD32ASYNC, HIP, -1); + HC_LOAD_FUNC_HIP (hip, hipMemsetD8Async, hipMemsetD8Async, HIP_HIPMEMSETD8ASYNC, HIP, -1); HC_LOAD_FUNC_HIP (hip, hipModuleGetFunction, hipModuleGetFunction, HIP_HIPMODULEGETFUNCTION, HIP, 1); HC_LOAD_FUNC_HIP (hip, hipModuleGetGlobal, hipModuleGetGlobal, HIP_HIPMODULEGETGLOBAL, HIP, 1); HC_LOAD_FUNC_HIP (hip, hipModuleLoad, hipModuleLoad, HIP_HIPMODULELOAD, HIP, 1); @@ -2975,6 +3029,60 @@ int hc_hipMemcpyHtoDAsync (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dstDevice, c return 0; } +int hc_hipMemsetD32Async (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dstDevice, unsigned int ui, size_t N, HIPstream hStream) +{ + backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; + + HIP_PTR *hip = (HIP_PTR *) backend_ctx->hip; + + const HIPresult HIP_err = hip->hipMemsetD32Async (dstDevice, ui, N, hStream); + + if (HIP_err != HIP_SUCCESS) + { + const char *pStr = NULL; + + if (hip->hipGetErrorString (HIP_err, &pStr) == HIP_SUCCESS) + { + event_log_error (hashcat_ctx, "hipMemsetD32Async(): %s", pStr); + } + else + { + event_log_error (hashcat_ctx, "hipMemsetD32Async(): %d", HIP_err); + } + + return -1; + } + + return 0; +} + +int hc_hipMemsetD8Async (hashcat_ctx_t *hashcat_ctx, HIPdeviceptr dstDevice, unsigned char uc, size_t N, HIPstream hStream) +{ + backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; + + HIP_PTR *hip = (HIP_PTR *) backend_ctx->hip; + + const HIPresult HIP_err = hip->hipMemsetD8Async (dstDevice, uc, N, hStream); + + if (HIP_err != HIP_SUCCESS) + { + const char *pStr = NULL; + + if (hip->hipGetErrorString (HIP_err, &pStr) == HIP_SUCCESS) + { + event_log_error (hashcat_ctx, "hipMemsetD8Async(): %s", pStr); + } + else + { + event_log_error (hashcat_ctx, "hipMemsetD8Async(): %d", HIP_err); + } + + return -1; + } + + return 0; +} + int hc_hipModuleGetFunction (hashcat_ctx_t *hashcat_ctx, HIPfunction *hfunc, HIPmodule hmod, const char *name) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; @@ -3636,6 +3744,7 @@ int ocl_init (hashcat_ctx_t *hashcat_ctx) HC_LOAD_FUNC (ocl, clCreateProgramWithBinary, OCL_CLCREATEPROGRAMWITHBINARY, OpenCL, 1); HC_LOAD_FUNC (ocl, clCreateProgramWithSource, OCL_CLCREATEPROGRAMWITHSOURCE, OpenCL, 1); HC_LOAD_FUNC (ocl, clEnqueueCopyBuffer, OCL_CLENQUEUECOPYBUFFER, OpenCL, 1); + HC_LOAD_FUNC (ocl, clEnqueueFillBuffer, OCL_CLENQUEUEFILLBUFFER, OpenCL, -1); HC_LOAD_FUNC (ocl, clEnqueueMapBuffer, OCL_CLENQUEUEMAPBUFFER, OpenCL, 1); HC_LOAD_FUNC (ocl, clEnqueueNDRangeKernel, OCL_CLENQUEUENDRANGEKERNEL, OpenCL, 1); HC_LOAD_FUNC (ocl, clEnqueueReadBuffer, OCL_CLENQUEUEREADBUFFER, OpenCL, 1); @@ -3811,6 +3920,23 @@ int hc_clEnqueueCopyBuffer (hashcat_ctx_t *hashcat_ctx, cl_command_queue command return 0; } +int hc_clEnqueueFillBuffer (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_mem buffer, const void *pattern, size_t pattern_size, size_t offset, size_t size, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event) +{ + const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; + const OCL_PTR *ocl = backend_ctx->ocl; + + cl_int CL_err = ocl->clEnqueueFillBuffer (command_queue, buffer, pattern, pattern_size, offset, size, num_events_in_wait_list, event_wait_list, event); + + if (CL_err != CL_SUCCESS) + { + event_log_error (hashcat_ctx, "clEnqueueFillBuffer(): %s", val2cstr_cl (CL_err)); + + return -1; + } + + return 0; +} + int hc_clEnqueueReadBuffer (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, size_t offset, size_t size, void *ptr, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; @@ -5013,40 +5139,14 @@ int run_cuda_kernel_utf8toutf16le (hashcat_ctx_t *hashcat_ctx, hc_device_param_t return 0; } -int run_cuda_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, CUdeviceptr buf, const u32 value, const u64 size) +int run_cuda_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, CUdeviceptr buf, const u64 offset, const u8 value, const u64 size) { - const u64 num16d = size / 16; - const u64 num16m = size % 16; - u32 tmp[4]; - - if (num16d) - { - device_param->kernel_params_memset[0] = (void *) &buf; - device_param->kernel_params_memset_buf32[1] = value; - device_param->kernel_params_memset_buf64[2] = num16d; - - const u64 kernel_threads = device_param->kernel_wgs_memset; - - u64 num_elements = CEILDIV (num16d, kernel_threads); - - CUfunction function = device_param->cuda_function_memset; - - if (hc_cuLaunchKernel (hashcat_ctx, function, num_elements, 1, 1, kernel_threads, 1, 1, 0, device_param->cuda_stream, device_param->kernel_params_memset, NULL) == -1) return -1; - } - - if (num16m) - { - tmp[0] = value; - tmp[1] = value; - tmp[2] = value; - tmp[3] = value; - - if (hc_cuMemcpyHtoDAsync (hashcat_ctx, buf + (num16d * 16), tmp, num16m, device_param->cuda_stream) == -1) return -1; - } - - if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; + return hc_cuMemsetD8Async (hashcat_ctx, buf + offset, value, size, device_param->cuda_stream); +} - return 0; +int run_cuda_kernel_memset32 (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, CUdeviceptr buf, const u64 offset, const u32 value, const u64 size) +{ + return hc_cuMemsetD32Async (hashcat_ctx, buf + offset * sizeof (u32), value, size, device_param->cuda_stream); } int run_cuda_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, CUdeviceptr buf, const u64 size) @@ -5112,40 +5212,14 @@ int run_hip_kernel_utf8toutf16le (hashcat_ctx_t *hashcat_ctx, hc_device_param_t return 0; } -int run_hip_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, HIPdeviceptr buf, const u32 value, const u64 size) +int run_hip_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, HIPdeviceptr buf, const u64 offset, const u8 value, const u64 size) { - const u64 num16d = size / 16; - const u64 num16m = size % 16; - u32 tmp[4]; - - if (num16d) - { - device_param->kernel_params_memset[0] = (void *) &buf; - device_param->kernel_params_memset_buf32[1] = value; - device_param->kernel_params_memset_buf64[2] = num16d; - - const u64 kernel_threads = device_param->kernel_wgs_memset; - - u64 num_elements = CEILDIV (num16d, kernel_threads); - - HIPfunction function = device_param->hip_function_memset; - - if (hc_hipLaunchKernel (hashcat_ctx, function, num_elements, 1, 1, kernel_threads, 1, 1, 0, device_param->hip_stream, device_param->kernel_params_memset, NULL) == -1) return -1; - } - - if (num16m) - { - tmp[0] = value; - tmp[1] = value; - tmp[2] = value; - tmp[3] = value; - - if (hc_hipMemcpyHtoDAsync (hashcat_ctx, buf + (num16d * 16), tmp, num16m, device_param->hip_stream) == -1) return -1; - } - - if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; + return hc_hipMemsetD8Async (hashcat_ctx, buf + offset, value, size, device_param->hip_stream); +} - return 0; +int run_hip_kernel_memset32 (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, HIPdeviceptr buf, const u64 offset, const u32 value, const u64 size) +{ + return hc_hipMemsetD32Async (hashcat_ctx, buf + offset * sizeof (u32), value, size, device_param->hip_stream); } int run_hip_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, HIPdeviceptr buf, const u64 size) @@ -5227,45 +5301,65 @@ int run_opencl_kernel_utf8toutf16le (hashcat_ctx_t *hashcat_ctx, hc_device_param return 0; } -int run_opencl_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u32 value, const u64 size) +int run_opencl_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u64 offset, const u8 value, const u64 size) { - const u64 num16d = size / 16; - const u64 num16m = size % 16; - u32 tmp[4]; + const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; + const OCL_PTR *ocl = backend_ctx->ocl; - if (num16d) + int rc; + + /* workaround if missing clEnqueueFillBuffer() */ + if (ocl->clEnqueueFillBuffer == NULL) { - const u64 kernel_threads = device_param->kernel_wgs_memset; + const u64 len = offset + size; - u64 num_elements = round_up_multiple_64 (num16d, kernel_threads); + char *tmp = hcmalloc (len * sizeof (u8)); - cl_kernel kernel = device_param->opencl_kernel_memset; + memset(tmp, value, len); - if (hc_clSetKernelArg (hashcat_ctx, kernel, 0, sizeof(cl_mem), (void *) &buf) == -1) return -1; - if (hc_clSetKernelArg (hashcat_ctx, kernel, 1, sizeof(cl_uint), (void *) &value) == -1) return -1; - if (hc_clSetKernelArg (hashcat_ctx, kernel, 2, sizeof(cl_ulong), (void *) &num16d) == -1) return -1; + /* blocking */ + rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, buf, CL_TRUE, offset, size, tmp, 0, NULL, NULL); - const size_t global_work_size[3] = { num_elements, 1, 1 }; - const size_t local_work_size[3] = { kernel_threads, 1, 1 }; - - if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL) == -1) return -1; + free(tmp); + } + else + { + rc = hc_clEnqueueFillBuffer (hashcat_ctx, device_param->opencl_command_queue, buf, &value, sizeof (u8), offset, size, 0, NULL, NULL); } - if (num16m) + return rc; +} + +int run_opencl_kernel_memset32 (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u64 offset, const u32 value, const u64 size) +{ + const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; + const OCL_PTR *ocl = backend_ctx->ocl; + + int rc; + + /* workaround if missing clEnqueueFillBuffer() */ + if (ocl->clEnqueueFillBuffer == NULL) { - tmp[0] = value; - tmp[1] = value; - tmp[2] = value; - tmp[3] = value; + const u64 len = offset + size; - if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, buf, CL_FALSE, num16d * 16, num16m, tmp, 0, NULL, NULL) == -1) return -1; - } + u32 *tmp = (u32 *) hcmalloc ((offset + size) * sizeof (u32)); - /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ + for (u64 i = 0; i < len; i++) + { + tmp[i] = value; + } - if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; + /* blocking */ + rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, buf, CL_TRUE, offset * sizeof (u32), size * sizeof (u32), tmp, 0, NULL, NULL); - return 0; + free(tmp); + } + else + { + rc = hc_clEnqueueFillBuffer (hashcat_ctx, device_param->opencl_command_queue, buf, &value, sizeof (u32), offset, size, 0, NULL, NULL); + } + + return rc; } int run_opencl_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u64 size) From 5dbe4958b88fc3b37543eae2b7391fb35b590647 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Tue, 27 Jul 2021 19:01:13 +0300 Subject: [PATCH 29/64] Remove digests_shown_tmp buffer, used in check_cracked() to zero out hashes --- include/types.h | 1 - src/hashes.c | 11 ++++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/include/types.h b/include/types.h index 93cb42bf4..e0de045a5 100644 --- a/include/types.h +++ b/include/types.h @@ -927,7 +927,6 @@ typedef struct hashes void *digests_buf; u32 *digests_shown; - u32 *digests_shown_tmp; u32 salts_cnt; u32 salts_done; diff --git a/src/hashes.c b/src/hashes.c index 5679a5442..e1f8402c2 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -679,10 +679,9 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) // otherwise host thinks again and again the hash was cracked // and returns invalid password each time - /* TODO: this is bad design -- digests_shown_tmp is only used for zeroing */ if (device_param->is_cuda == true) { - rc = hc_cuMemcpyHtoDAsync (hashcat_ctx, device_param->cuda_d_digests_shown + (salt_buf->digests_offset * sizeof (u32)), hashes->digests_shown_tmp, salt_buf->digests_cnt * sizeof (u32), device_param->cuda_stream); + rc = run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_digests_shown + (salt_buf->digests_offset * sizeof (u32)), salt_buf->digests_cnt * sizeof (u32)); if (rc == -1) { @@ -692,7 +691,7 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) if (device_param->is_hip == true) { - rc = hc_hipMemcpyHtoDAsync (hashcat_ctx, device_param->hip_d_digests_shown + (salt_buf->digests_offset * sizeof (u32)), hashes->digests_shown_tmp, salt_buf->digests_cnt * sizeof (u32), device_param->hip_stream); + rc = run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_digests_shown + (salt_buf->digests_offset * sizeof (u32)), salt_buf->digests_cnt * sizeof (u32)); if (rc == -1) { @@ -702,7 +701,8 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) if (device_param->is_opencl == true) { - rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_digests_shown, CL_FALSE, salt_buf->digests_offset * sizeof (u32), salt_buf->digests_cnt * sizeof (u32), hashes->digests_shown_tmp, 0, NULL, NULL); + /* NOTE: run_opencl_kernel_bzero() does not handle buffer offset */ + rc = run_opencl_kernel_memset32 (hashcat_ctx, device_param, device_param->opencl_d_digests_shown, salt_buf->digests_offset, 0, salt_buf->digests_cnt); if (rc == 0) { @@ -1675,7 +1675,6 @@ int hashes_init_stage2 (hashcat_ctx_t *hashcat_ctx) u32 digests_done = 0; u32 *digests_shown = (u32 *) hccalloc (digests_cnt, sizeof (u32)); - u32 *digests_shown_tmp = (u32 *) hccalloc (digests_cnt, sizeof (u32)); u32 salts_cnt = 0; u32 salts_done = 0; @@ -1812,7 +1811,6 @@ int hashes_init_stage2 (hashcat_ctx_t *hashcat_ctx) hashes->digests_done = digests_done; hashes->digests_buf = digests_buf_new; hashes->digests_shown = digests_shown; - hashes->digests_shown_tmp = digests_shown_tmp; hashes->salts_cnt = salts_cnt; hashes->salts_done = salts_done; @@ -2299,7 +2297,6 @@ void hashes_destroy (hashcat_ctx_t *hashcat_ctx) hcfree (hashes->digests_buf); hcfree (hashes->digests_shown); - hcfree (hashes->digests_shown_tmp); hcfree (hashes->salts_buf); hcfree (hashes->salts_shown); From 8b590f651b058e56e68678d1f3b0cda1f0ad8405 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Wed, 28 Jul 2021 19:26:30 +0300 Subject: [PATCH 30/64] Remove unused gpu_memset and its references --- OpenCL/shared.cl | 27 ---------------------- include/types.h | 11 --------- src/backend.c | 59 ------------------------------------------------ 3 files changed, 97 deletions(-) diff --git a/OpenCL/shared.cl b/OpenCL/shared.cl index fe4ff4087..267ce5c85 100644 --- a/OpenCL/shared.cl +++ b/OpenCL/shared.cl @@ -106,33 +106,6 @@ KERNEL_FQ void gpu_decompress (GLOBAL_AS pw_idx_t *pws_idx, GLOBAL_AS u32 *pws_c pws_buf[gid] = pw; } -KERNEL_FQ void gpu_memset (GLOBAL_AS uint4 *buf, const u32 value, const u64 gid_max) -{ - const u64 gid = get_global_id (0); - - if (gid >= gid_max) return; - - uint4 r; - - #if defined IS_NATIVE - r = value; - #elif defined IS_OPENCL - r = (uint4) (value); - #elif defined IS_CUDA - r.x = value; - r.y = value; - r.z = value; - r.w = value; - #elif defined IS_HIP - r.x = value; - r.y = value; - r.z = value; - r.w = value; - #endif - - buf[gid] = r; -} - KERNEL_FQ void gpu_bzero(GLOBAL_AS uint4* buf, const u64 gid_max) { const u64 gid = get_global_id(0); diff --git a/include/types.h b/include/types.h index e0de045a5..88a4e98dc 100644 --- a/include/types.h +++ b/include/types.h @@ -1139,7 +1139,6 @@ typedef struct hc_device_param u32 kernel_wgs_mp_r; u32 kernel_wgs_amp; u32 kernel_wgs_tm; - u32 kernel_wgs_memset; u32 kernel_wgs_bzero; u32 kernel_wgs_atinit; u32 kernel_wgs_utf8toutf16le; @@ -1165,7 +1164,6 @@ typedef struct hc_device_param u32 kernel_preferred_wgs_multiple_mp_r; u32 kernel_preferred_wgs_multiple_amp; u32 kernel_preferred_wgs_multiple_tm; - u32 kernel_preferred_wgs_multiple_memset; u32 kernel_preferred_wgs_multiple_bzero; u32 kernel_preferred_wgs_multiple_atinit; u32 kernel_preferred_wgs_multiple_utf8toutf16le; @@ -1191,7 +1189,6 @@ typedef struct hc_device_param u64 kernel_local_mem_size_mp_r; u64 kernel_local_mem_size_amp; u64 kernel_local_mem_size_tm; - u64 kernel_local_mem_size_memset; u64 kernel_local_mem_size_bzero; u64 kernel_local_mem_size_atinit; u64 kernel_local_mem_size_utf8toutf16le; @@ -1217,7 +1214,6 @@ typedef struct hc_device_param u64 kernel_dynamic_local_mem_size_mp_r; u64 kernel_dynamic_local_mem_size_amp; u64 kernel_dynamic_local_mem_size_tm; - u64 kernel_dynamic_local_mem_size_memset; u64 kernel_dynamic_local_mem_size_bzero; u64 kernel_dynamic_local_mem_size_atinit; u64 kernel_dynamic_local_mem_size_utf8toutf16le; @@ -1379,7 +1375,6 @@ typedef struct hc_device_param void *kernel_params_mp_l[PARAMCNT]; void *kernel_params_amp[PARAMCNT]; void *kernel_params_tm[PARAMCNT]; - void *kernel_params_memset[PARAMCNT]; void *kernel_params_bzero[PARAMCNT]; void *kernel_params_atinit[PARAMCNT]; void *kernel_params_utf8toutf16le[PARAMCNT]; @@ -1400,9 +1395,6 @@ typedef struct hc_device_param u32 kernel_params_amp_buf32[PARAMCNT]; u64 kernel_params_amp_buf64[PARAMCNT]; - u32 kernel_params_memset_buf32[PARAMCNT]; - u64 kernel_params_memset_buf64[PARAMCNT]; - u32 kernel_params_bzero_buf32[PARAMCNT]; u64 kernel_params_bzero_buf64[PARAMCNT]; @@ -1450,7 +1442,6 @@ typedef struct hc_device_param CUfunction cuda_function_mp_r; CUfunction cuda_function_amp; CUfunction cuda_function_tm; - CUfunction cuda_function_memset; CUfunction cuda_function_bzero; CUfunction cuda_function_atinit; CUfunction cuda_function_utf8toutf16le; @@ -1532,7 +1523,6 @@ typedef struct hc_device_param HIPfunction hip_function_mp_r; HIPfunction hip_function_amp; HIPfunction hip_function_tm; - HIPfunction hip_function_memset; HIPfunction hip_function_bzero; HIPfunction hip_function_atinit; HIPfunction hip_function_utf8toutf16le; @@ -1618,7 +1608,6 @@ typedef struct hc_device_param cl_kernel opencl_kernel_mp_r; cl_kernel opencl_kernel_amp; cl_kernel opencl_kernel_tm; - cl_kernel opencl_kernel_memset; cl_kernel opencl_kernel_bzero; cl_kernel opencl_kernel_atinit; cl_kernel opencl_kernel_utf8toutf16le; diff --git a/src/backend.c b/src/backend.c index 69b6345c6..e9fc8c64c 100644 --- a/src/backend.c +++ b/src/backend.c @@ -5471,18 +5471,6 @@ int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, con dynamic_shared_mem = 0; } - //if (device_param->is_cuda == true) - //{ - //if ((device_param->kernel_dynamic_local_mem_size_memset % device_param->device_local_mem_size) == 0) - //{ - // this is the case Compute Capability 7.5 - // there is also Compute Capability 7.0 which offers a larger dynamic local size access - // however, if it's an exact multiple the driver can optimize this for us more efficient - - //dynamic_shared_mem = 0; - //} - //} - kernel_threads = MIN (kernel_threads, device_param->kernel_threads); device_param->kernel_params_buf64[35] = pws_pos; @@ -11750,18 +11738,6 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) if (device_param->is_cuda == true) { - // GPU memset - - if (hc_cuModuleGetFunction (hashcat_ctx, &device_param->cuda_function_memset, device_param->cuda_module_shared, "gpu_memset") == -1) return -1; - - if (get_cuda_kernel_wgs (hashcat_ctx, device_param->cuda_function_memset, &device_param->kernel_wgs_memset) == -1) return -1; - - if (get_cuda_kernel_local_mem_size (hashcat_ctx, device_param->cuda_function_memset, &device_param->kernel_local_mem_size_memset) == -1) return -1; - - device_param->kernel_dynamic_local_mem_size_memset = device_param->device_local_mem_size - device_param->kernel_local_mem_size_memset; - - device_param->kernel_preferred_wgs_multiple_memset = device_param->cuda_warp_size; - // GPU bzero if (hc_cuModuleGetFunction (hashcat_ctx, &device_param->cuda_function_bzero, device_param->cuda_module_shared, "gpu_bzero") == -1) return -1; @@ -11816,18 +11792,6 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) if (device_param->is_hip == true) { - // GPU memset - - if (hc_hipModuleGetFunction (hashcat_ctx, &device_param->hip_function_memset, device_param->hip_module_shared, "gpu_memset") == -1) return -1; - - if (get_hip_kernel_wgs (hashcat_ctx, device_param->hip_function_memset, &device_param->kernel_wgs_memset) == -1) return -1; - - if (get_hip_kernel_local_mem_size (hashcat_ctx, device_param->hip_function_memset, &device_param->kernel_local_mem_size_memset) == -1) return -1; - - device_param->kernel_dynamic_local_mem_size_memset = device_param->device_local_mem_size - device_param->kernel_local_mem_size_memset; - - device_param->kernel_preferred_wgs_multiple_memset = device_param->hip_warp_size; - // GPU bzero if (hc_hipModuleGetFunction (hashcat_ctx, &device_param->hip_function_bzero, device_param->hip_module_shared, "gpu_bzero") == -1) return -1; @@ -11882,18 +11846,6 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) if (device_param->is_opencl == true) { - // GPU memset - - if (hc_clCreateKernel (hashcat_ctx, device_param->opencl_program_shared, "gpu_memset", &device_param->opencl_kernel_memset) == -1) return -1; - - if (get_opencl_kernel_wgs (hashcat_ctx, device_param, device_param->opencl_kernel_memset, &device_param->kernel_wgs_memset) == -1) return -1; - - if (get_opencl_kernel_local_mem_size (hashcat_ctx, device_param, device_param->opencl_kernel_memset, &device_param->kernel_local_mem_size_memset) == -1) return -1; - - if (get_opencl_kernel_dynamic_local_mem_size (hashcat_ctx, device_param, device_param->opencl_kernel_memset, &device_param->kernel_dynamic_local_mem_size_memset) == -1) return -1; - - if (get_opencl_kernel_preferred_wgs_multiple (hashcat_ctx, device_param, device_param->opencl_kernel_memset, &device_param->kernel_preferred_wgs_multiple_memset) == -1) return -1; - // GPU bzero if (hc_clCreateKernel (hashcat_ctx, device_param->opencl_program_shared, "gpu_bzero", &device_param->opencl_kernel_bzero) == -1) return -1; @@ -12840,13 +12792,6 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) } } - device_param->kernel_params_memset_buf32[1] = 0; // value - device_param->kernel_params_memset_buf64[2] = 0; // gid_max - - device_param->kernel_params_memset[0] = NULL; - device_param->kernel_params_memset[1] = &device_param->kernel_params_memset_buf32[1]; - device_param->kernel_params_memset[2] = &device_param->kernel_params_memset_buf64[2]; - device_param->kernel_params_bzero_buf64[1] = 0; // gid_max device_param->kernel_params_bzero[0] = NULL; @@ -15384,7 +15329,6 @@ void backend_session_destroy (hashcat_ctx_t *hashcat_ctx) device_param->cuda_function_mp_r = NULL; device_param->cuda_function_tm = NULL; device_param->cuda_function_amp = NULL; - device_param->cuda_function_memset = NULL; device_param->cuda_function_bzero = NULL; device_param->cuda_function_atinit = NULL; device_param->cuda_function_utf8toutf16le = NULL; @@ -15513,7 +15457,6 @@ void backend_session_destroy (hashcat_ctx_t *hashcat_ctx) device_param->hip_function_mp_r = NULL; device_param->hip_function_tm = NULL; device_param->hip_function_amp = NULL; - device_param->hip_function_memset = NULL; device_param->hip_function_bzero = NULL; device_param->hip_function_atinit = NULL; device_param->hip_function_utf8toutf16le = NULL; @@ -15592,7 +15535,6 @@ void backend_session_destroy (hashcat_ctx_t *hashcat_ctx) if (device_param->opencl_kernel_mp_r) hc_clReleaseKernel (hashcat_ctx, device_param->opencl_kernel_mp_r); if (device_param->opencl_kernel_tm) hc_clReleaseKernel (hashcat_ctx, device_param->opencl_kernel_tm); if (device_param->opencl_kernel_amp) hc_clReleaseKernel (hashcat_ctx, device_param->opencl_kernel_amp); - if (device_param->opencl_kernel_memset) hc_clReleaseKernel (hashcat_ctx, device_param->opencl_kernel_memset); if (device_param->opencl_kernel_bzero) hc_clReleaseKernel (hashcat_ctx, device_param->opencl_kernel_bzero); if (device_param->opencl_kernel_atinit) hc_clReleaseKernel (hashcat_ctx, device_param->opencl_kernel_atinit); if (device_param->opencl_kernel_utf8toutf16le) hc_clReleaseKernel (hashcat_ctx, device_param->opencl_kernel_utf8toutf16le); @@ -15663,7 +15605,6 @@ void backend_session_destroy (hashcat_ctx_t *hashcat_ctx) device_param->opencl_kernel_mp_r = NULL; device_param->opencl_kernel_tm = NULL; device_param->opencl_kernel_amp = NULL; - device_param->opencl_kernel_memset = NULL; device_param->opencl_kernel_bzero = NULL; device_param->opencl_kernel_atinit = NULL; device_param->opencl_kernel_utf8toutf16le = NULL; From d7cc8d7cd2247615bdba6fad9e34e7b29d53a4fe Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Wed, 28 Jul 2021 19:49:02 +0300 Subject: [PATCH 31/64] Revert due to module_03200.c, module_25600.c and module_25800.c using device_param->kernel_dynamic_local_mem_size_memset --- OpenCL/shared.cl | 27 ++++++++++++++++++++++ include/types.h | 11 +++++++++ src/backend.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+) diff --git a/OpenCL/shared.cl b/OpenCL/shared.cl index 267ce5c85..fe4ff4087 100644 --- a/OpenCL/shared.cl +++ b/OpenCL/shared.cl @@ -106,6 +106,33 @@ KERNEL_FQ void gpu_decompress (GLOBAL_AS pw_idx_t *pws_idx, GLOBAL_AS u32 *pws_c pws_buf[gid] = pw; } +KERNEL_FQ void gpu_memset (GLOBAL_AS uint4 *buf, const u32 value, const u64 gid_max) +{ + const u64 gid = get_global_id (0); + + if (gid >= gid_max) return; + + uint4 r; + + #if defined IS_NATIVE + r = value; + #elif defined IS_OPENCL + r = (uint4) (value); + #elif defined IS_CUDA + r.x = value; + r.y = value; + r.z = value; + r.w = value; + #elif defined IS_HIP + r.x = value; + r.y = value; + r.z = value; + r.w = value; + #endif + + buf[gid] = r; +} + KERNEL_FQ void gpu_bzero(GLOBAL_AS uint4* buf, const u64 gid_max) { const u64 gid = get_global_id(0); diff --git a/include/types.h b/include/types.h index 88a4e98dc..e0de045a5 100644 --- a/include/types.h +++ b/include/types.h @@ -1139,6 +1139,7 @@ typedef struct hc_device_param u32 kernel_wgs_mp_r; u32 kernel_wgs_amp; u32 kernel_wgs_tm; + u32 kernel_wgs_memset; u32 kernel_wgs_bzero; u32 kernel_wgs_atinit; u32 kernel_wgs_utf8toutf16le; @@ -1164,6 +1165,7 @@ typedef struct hc_device_param u32 kernel_preferred_wgs_multiple_mp_r; u32 kernel_preferred_wgs_multiple_amp; u32 kernel_preferred_wgs_multiple_tm; + u32 kernel_preferred_wgs_multiple_memset; u32 kernel_preferred_wgs_multiple_bzero; u32 kernel_preferred_wgs_multiple_atinit; u32 kernel_preferred_wgs_multiple_utf8toutf16le; @@ -1189,6 +1191,7 @@ typedef struct hc_device_param u64 kernel_local_mem_size_mp_r; u64 kernel_local_mem_size_amp; u64 kernel_local_mem_size_tm; + u64 kernel_local_mem_size_memset; u64 kernel_local_mem_size_bzero; u64 kernel_local_mem_size_atinit; u64 kernel_local_mem_size_utf8toutf16le; @@ -1214,6 +1217,7 @@ typedef struct hc_device_param u64 kernel_dynamic_local_mem_size_mp_r; u64 kernel_dynamic_local_mem_size_amp; u64 kernel_dynamic_local_mem_size_tm; + u64 kernel_dynamic_local_mem_size_memset; u64 kernel_dynamic_local_mem_size_bzero; u64 kernel_dynamic_local_mem_size_atinit; u64 kernel_dynamic_local_mem_size_utf8toutf16le; @@ -1375,6 +1379,7 @@ typedef struct hc_device_param void *kernel_params_mp_l[PARAMCNT]; void *kernel_params_amp[PARAMCNT]; void *kernel_params_tm[PARAMCNT]; + void *kernel_params_memset[PARAMCNT]; void *kernel_params_bzero[PARAMCNT]; void *kernel_params_atinit[PARAMCNT]; void *kernel_params_utf8toutf16le[PARAMCNT]; @@ -1395,6 +1400,9 @@ typedef struct hc_device_param u32 kernel_params_amp_buf32[PARAMCNT]; u64 kernel_params_amp_buf64[PARAMCNT]; + u32 kernel_params_memset_buf32[PARAMCNT]; + u64 kernel_params_memset_buf64[PARAMCNT]; + u32 kernel_params_bzero_buf32[PARAMCNT]; u64 kernel_params_bzero_buf64[PARAMCNT]; @@ -1442,6 +1450,7 @@ typedef struct hc_device_param CUfunction cuda_function_mp_r; CUfunction cuda_function_amp; CUfunction cuda_function_tm; + CUfunction cuda_function_memset; CUfunction cuda_function_bzero; CUfunction cuda_function_atinit; CUfunction cuda_function_utf8toutf16le; @@ -1523,6 +1532,7 @@ typedef struct hc_device_param HIPfunction hip_function_mp_r; HIPfunction hip_function_amp; HIPfunction hip_function_tm; + HIPfunction hip_function_memset; HIPfunction hip_function_bzero; HIPfunction hip_function_atinit; HIPfunction hip_function_utf8toutf16le; @@ -1608,6 +1618,7 @@ typedef struct hc_device_param cl_kernel opencl_kernel_mp_r; cl_kernel opencl_kernel_amp; cl_kernel opencl_kernel_tm; + cl_kernel opencl_kernel_memset; cl_kernel opencl_kernel_bzero; cl_kernel opencl_kernel_atinit; cl_kernel opencl_kernel_utf8toutf16le; diff --git a/src/backend.c b/src/backend.c index e9fc8c64c..69b6345c6 100644 --- a/src/backend.c +++ b/src/backend.c @@ -5471,6 +5471,18 @@ int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, con dynamic_shared_mem = 0; } + //if (device_param->is_cuda == true) + //{ + //if ((device_param->kernel_dynamic_local_mem_size_memset % device_param->device_local_mem_size) == 0) + //{ + // this is the case Compute Capability 7.5 + // there is also Compute Capability 7.0 which offers a larger dynamic local size access + // however, if it's an exact multiple the driver can optimize this for us more efficient + + //dynamic_shared_mem = 0; + //} + //} + kernel_threads = MIN (kernel_threads, device_param->kernel_threads); device_param->kernel_params_buf64[35] = pws_pos; @@ -11738,6 +11750,18 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) if (device_param->is_cuda == true) { + // GPU memset + + if (hc_cuModuleGetFunction (hashcat_ctx, &device_param->cuda_function_memset, device_param->cuda_module_shared, "gpu_memset") == -1) return -1; + + if (get_cuda_kernel_wgs (hashcat_ctx, device_param->cuda_function_memset, &device_param->kernel_wgs_memset) == -1) return -1; + + if (get_cuda_kernel_local_mem_size (hashcat_ctx, device_param->cuda_function_memset, &device_param->kernel_local_mem_size_memset) == -1) return -1; + + device_param->kernel_dynamic_local_mem_size_memset = device_param->device_local_mem_size - device_param->kernel_local_mem_size_memset; + + device_param->kernel_preferred_wgs_multiple_memset = device_param->cuda_warp_size; + // GPU bzero if (hc_cuModuleGetFunction (hashcat_ctx, &device_param->cuda_function_bzero, device_param->cuda_module_shared, "gpu_bzero") == -1) return -1; @@ -11792,6 +11816,18 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) if (device_param->is_hip == true) { + // GPU memset + + if (hc_hipModuleGetFunction (hashcat_ctx, &device_param->hip_function_memset, device_param->hip_module_shared, "gpu_memset") == -1) return -1; + + if (get_hip_kernel_wgs (hashcat_ctx, device_param->hip_function_memset, &device_param->kernel_wgs_memset) == -1) return -1; + + if (get_hip_kernel_local_mem_size (hashcat_ctx, device_param->hip_function_memset, &device_param->kernel_local_mem_size_memset) == -1) return -1; + + device_param->kernel_dynamic_local_mem_size_memset = device_param->device_local_mem_size - device_param->kernel_local_mem_size_memset; + + device_param->kernel_preferred_wgs_multiple_memset = device_param->hip_warp_size; + // GPU bzero if (hc_hipModuleGetFunction (hashcat_ctx, &device_param->hip_function_bzero, device_param->hip_module_shared, "gpu_bzero") == -1) return -1; @@ -11846,6 +11882,18 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) if (device_param->is_opencl == true) { + // GPU memset + + if (hc_clCreateKernel (hashcat_ctx, device_param->opencl_program_shared, "gpu_memset", &device_param->opencl_kernel_memset) == -1) return -1; + + if (get_opencl_kernel_wgs (hashcat_ctx, device_param, device_param->opencl_kernel_memset, &device_param->kernel_wgs_memset) == -1) return -1; + + if (get_opencl_kernel_local_mem_size (hashcat_ctx, device_param, device_param->opencl_kernel_memset, &device_param->kernel_local_mem_size_memset) == -1) return -1; + + if (get_opencl_kernel_dynamic_local_mem_size (hashcat_ctx, device_param, device_param->opencl_kernel_memset, &device_param->kernel_dynamic_local_mem_size_memset) == -1) return -1; + + if (get_opencl_kernel_preferred_wgs_multiple (hashcat_ctx, device_param, device_param->opencl_kernel_memset, &device_param->kernel_preferred_wgs_multiple_memset) == -1) return -1; + // GPU bzero if (hc_clCreateKernel (hashcat_ctx, device_param->opencl_program_shared, "gpu_bzero", &device_param->opencl_kernel_bzero) == -1) return -1; @@ -12792,6 +12840,13 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) } } + device_param->kernel_params_memset_buf32[1] = 0; // value + device_param->kernel_params_memset_buf64[2] = 0; // gid_max + + device_param->kernel_params_memset[0] = NULL; + device_param->kernel_params_memset[1] = &device_param->kernel_params_memset_buf32[1]; + device_param->kernel_params_memset[2] = &device_param->kernel_params_memset_buf64[2]; + device_param->kernel_params_bzero_buf64[1] = 0; // gid_max device_param->kernel_params_bzero[0] = NULL; @@ -15329,6 +15384,7 @@ void backend_session_destroy (hashcat_ctx_t *hashcat_ctx) device_param->cuda_function_mp_r = NULL; device_param->cuda_function_tm = NULL; device_param->cuda_function_amp = NULL; + device_param->cuda_function_memset = NULL; device_param->cuda_function_bzero = NULL; device_param->cuda_function_atinit = NULL; device_param->cuda_function_utf8toutf16le = NULL; @@ -15457,6 +15513,7 @@ void backend_session_destroy (hashcat_ctx_t *hashcat_ctx) device_param->hip_function_mp_r = NULL; device_param->hip_function_tm = NULL; device_param->hip_function_amp = NULL; + device_param->hip_function_memset = NULL; device_param->hip_function_bzero = NULL; device_param->hip_function_atinit = NULL; device_param->hip_function_utf8toutf16le = NULL; @@ -15535,6 +15592,7 @@ void backend_session_destroy (hashcat_ctx_t *hashcat_ctx) if (device_param->opencl_kernel_mp_r) hc_clReleaseKernel (hashcat_ctx, device_param->opencl_kernel_mp_r); if (device_param->opencl_kernel_tm) hc_clReleaseKernel (hashcat_ctx, device_param->opencl_kernel_tm); if (device_param->opencl_kernel_amp) hc_clReleaseKernel (hashcat_ctx, device_param->opencl_kernel_amp); + if (device_param->opencl_kernel_memset) hc_clReleaseKernel (hashcat_ctx, device_param->opencl_kernel_memset); if (device_param->opencl_kernel_bzero) hc_clReleaseKernel (hashcat_ctx, device_param->opencl_kernel_bzero); if (device_param->opencl_kernel_atinit) hc_clReleaseKernel (hashcat_ctx, device_param->opencl_kernel_atinit); if (device_param->opencl_kernel_utf8toutf16le) hc_clReleaseKernel (hashcat_ctx, device_param->opencl_kernel_utf8toutf16le); @@ -15605,6 +15663,7 @@ void backend_session_destroy (hashcat_ctx_t *hashcat_ctx) device_param->opencl_kernel_mp_r = NULL; device_param->opencl_kernel_tm = NULL; device_param->opencl_kernel_amp = NULL; + device_param->opencl_kernel_memset = NULL; device_param->opencl_kernel_bzero = NULL; device_param->opencl_kernel_atinit = NULL; device_param->opencl_kernel_utf8toutf16le = NULL; From e889cf98a9456415cd168d10661687e5a7bb1df4 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Wed, 28 Jul 2021 23:50:58 +0300 Subject: [PATCH 32/64] Few cleanups in autotune --- src/autotune.c | 113 ++++++++++--------------------------------------- 1 file changed, 22 insertions(+), 91 deletions(-) diff --git a/src/autotune.c b/src/autotune.c index e8148daf7..0db68efda 100644 --- a/src/autotune.c +++ b/src/autotune.c @@ -37,23 +37,6 @@ static double try_run (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par device_param->spin_damp = 0; - if (device_param->is_cuda == true) - { - if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; - } - - if (device_param->is_hip == true) - { - if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; - } - - if (device_param->is_opencl == true) - { - /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ - - if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; - } - if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) { if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) @@ -89,8 +72,6 @@ static double try_run (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par if (device_param->is_opencl == true) { - /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ - if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; } @@ -198,29 +179,19 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param const u32 kernel_power_max = device_param->hardware_power * kernel_accel_max; - int CU_rc; - int HIP_rc; - int CL_rc; - if (device_param->is_cuda == true) { - CU_rc = run_cuda_kernel_atinit (hashcat_ctx, device_param, device_param->cuda_d_pws_buf, kernel_power_max); - - if (CU_rc == -1) return -1; + if (run_cuda_kernel_atinit (hashcat_ctx, device_param, device_param->cuda_d_pws_buf, kernel_power_max) == -1) return -1; } if (device_param->is_hip == true) { - HIP_rc = run_hip_kernel_atinit (hashcat_ctx, device_param, device_param->hip_d_pws_buf, kernel_power_max); - - if (HIP_rc == -1) return -1; + if (run_hip_kernel_atinit (hashcat_ctx, device_param, device_param->hip_d_pws_buf, kernel_power_max) == -1) return -1; } if (device_param->is_opencl == true) { - CL_rc = run_opencl_kernel_atinit (hashcat_ctx, device_param, device_param->opencl_d_pws_buf, kernel_power_max); - - if (CL_rc == -1) return -1; + if (run_opencl_kernel_atinit (hashcat_ctx, device_param, device_param->opencl_d_pws_buf, kernel_power_max) == -1) return -1; } if (user_options->slow_candidates == true) @@ -234,23 +205,19 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param { if (device_param->is_cuda == true) { - CU_rc = hc_cuMemcpyDtoDAsync (hashcat_ctx, device_param->cuda_d_rules_c, device_param->cuda_d_rules, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t), device_param->cuda_stream); - - if (CU_rc == -1) return -1; + if (hc_cuMemcpyDtoDAsync (hashcat_ctx, device_param->cuda_d_rules_c, device_param->cuda_d_rules, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t), device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { - HIP_rc = hc_hipMemcpyDtoDAsync (hashcat_ctx, device_param->hip_d_rules_c, device_param->hip_d_rules, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t), device_param->hip_stream); - - if (HIP_rc == -1) return -1; + if (hc_hipMemcpyDtoDAsync (hashcat_ctx, device_param->hip_d_rules_c, device_param->hip_d_rules, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t), device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) { - CL_rc = hc_clEnqueueCopyBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_rules, device_param->opencl_d_rules_c, 0, 0, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t), 0, NULL, NULL); + if (hc_clEnqueueCopyBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_rules, device_param->opencl_d_rules_c, 0, 0, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t), 0, NULL, NULL) == -1) return -1; - if (CL_rc == -1) return -1; + if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; } } } @@ -420,77 +387,41 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (device_param->is_cuda == true) { - int CU_rc; - - CU_rc = run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_pws_buf, device_param->size_pws); - - if (CU_rc == -1) return -1; - - CU_rc = run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_plain_bufs, device_param->size_plains); + if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_pws_buf, device_param->size_pws) == -1) return -1; - if (CU_rc == -1) return -1; + if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_plain_bufs, device_param->size_plains) == -1) return -1; - CU_rc = run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_digests_shown, device_param->size_shown); + if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_digests_shown, device_param->size_shown) == -1) return -1; - if (CU_rc == -1) return -1; + if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_result, device_param->size_results) == -1) return -1; - CU_rc = run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_result, device_param->size_results); - - if (CU_rc == -1) return -1; - - CU_rc = run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_tmps, device_param->size_tmps); - - if (CU_rc == -1) return -1; + if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_tmps, device_param->size_tmps) == -1) return -1; } if (device_param->is_hip == true) { - int HIP_rc; - - HIP_rc = run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_pws_buf, device_param->size_pws); - - if (HIP_rc == -1) return -1; + if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_pws_buf, device_param->size_pws) == -1) return -1; - HIP_rc = run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_plain_bufs, device_param->size_plains); + if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_plain_bufs, device_param->size_plains) == -1) return -1; - if (HIP_rc == -1) return -1; + if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_digests_shown, device_param->size_shown) == -1) return -1; - HIP_rc = run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_digests_shown, device_param->size_shown); + if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_result, device_param->size_results) == -1) return -1; - if (HIP_rc == -1) return -1; - - HIP_rc = run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_result, device_param->size_results); - - if (HIP_rc == -1) return -1; - - HIP_rc = run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_tmps, device_param->size_tmps); - - if (HIP_rc == -1) return -1; + if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_tmps, device_param->size_tmps) == -1) return -1; } if (device_param->is_opencl == true) { - int CL_rc; - - CL_rc = run_opencl_kernel_bzero (hashcat_ctx, device_param, device_param->opencl_d_pws_buf, device_param->size_pws); - - if (CL_rc == -1) return -1; - - CL_rc = run_opencl_kernel_bzero (hashcat_ctx, device_param, device_param->opencl_d_plain_bufs, device_param->size_plains); - - if (CL_rc == -1) return -1; - - CL_rc = run_opencl_kernel_bzero (hashcat_ctx, device_param, device_param->opencl_d_digests_shown, device_param->size_shown); - - if (CL_rc == -1) return -1; + if (run_opencl_kernel_bzero (hashcat_ctx, device_param, device_param->opencl_d_pws_buf, device_param->size_pws) == -1) return -1; - CL_rc = run_opencl_kernel_bzero (hashcat_ctx, device_param, device_param->opencl_d_result, device_param->size_results); + if (run_opencl_kernel_bzero (hashcat_ctx, device_param, device_param->opencl_d_plain_bufs, device_param->size_plains) == -1) return -1; - if (CL_rc == -1) return -1; + if (run_opencl_kernel_bzero (hashcat_ctx, device_param, device_param->opencl_d_digests_shown, device_param->size_shown) == -1) return -1; - CL_rc = run_opencl_kernel_bzero (hashcat_ctx, device_param, device_param->opencl_d_tmps, device_param->size_tmps); + if (run_opencl_kernel_bzero (hashcat_ctx, device_param, device_param->opencl_d_result, device_param->size_results) == -1) return -1; - if (CL_rc == -1) return -1; + if (run_opencl_kernel_bzero (hashcat_ctx, device_param, device_param->opencl_d_tmps, device_param->size_tmps) == -1) return -1; } // reset timer From 9ed231c99c9728c1b5036636261ea642f39b9d02 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Thu, 29 Jul 2021 00:07:10 +0300 Subject: [PATCH 33/64] Add comment to blocking OpenCL calls --- src/backend.c | 2 ++ src/hashes.c | 2 ++ src/selftest.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/backend.c b/src/backend.c index 69b6345c6..59458e5e8 100644 --- a/src/backend.c +++ b/src/backend.c @@ -4491,6 +4491,7 @@ int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, c if (device_param->is_opencl == true) { + /* blocking */ if (hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_idx, CL_TRUE, gidd * sizeof (pw_idx_t), sizeof (pw_idx_t), &pw_idx, 0, NULL, NULL) == -1) return -1; } @@ -4530,6 +4531,7 @@ int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, c { if (cnt > 0) { + /* blocking */ if (hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_comp_buf, CL_TRUE, off * sizeof (u32), cnt * sizeof (u32), pw->i, 0, NULL, NULL) == -1) return -1; } } diff --git a/src/hashes.c b/src/hashes.c index e1f8402c2..9145c9834 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -574,6 +574,7 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) if (device_param->is_opencl == true) { + /* blocking */ if (hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_result, CL_TRUE, 0, sizeof (u32), &num_cracked, 0, NULL, NULL) == -1) return -1; } @@ -623,6 +624,7 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) if (device_param->is_opencl == true) { + /* blocking */ rc = hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_plain_bufs, CL_TRUE, 0, num_cracked * sizeof (plain_t), cracked, 0, NULL, NULL); if (rc == -1) diff --git a/src/selftest.c b/src/selftest.c index d5fff9433..af3a94550 100644 --- a/src/selftest.c +++ b/src/selftest.c @@ -523,6 +523,7 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (device_param->is_opencl == true) { + /* blocking */ if (hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_hooks, CL_TRUE, 0, device_param->size_hooks, device_param->hooks_buf, 0, NULL, NULL) == -1) return -1; } @@ -600,6 +601,7 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (device_param->is_opencl == true) { + /* blocking */ if (hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_hooks, CL_TRUE, 0, device_param->size_hooks, device_param->hooks_buf, 0, NULL, NULL) == -1) return -1; } From c48e6a25a811f46adfced436eca81edc7115d22f Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Thu, 29 Jul 2021 14:28:01 +0300 Subject: [PATCH 34/64] Enqueue several commands before clFlush() --- src/autotune.c | 4 ++-- src/backend.c | 29 ++++++++++------------------- src/hashes.c | 5 ----- 3 files changed, 12 insertions(+), 26 deletions(-) diff --git a/src/autotune.c b/src/autotune.c index 0db68efda..6d9f6da9a 100644 --- a/src/autotune.c +++ b/src/autotune.c @@ -216,8 +216,6 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (device_param->is_opencl == true) { if (hc_clEnqueueCopyBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_rules, device_param->opencl_d_rules_c, 0, 0, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t), 0, NULL, NULL) == -1) return -1; - - if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; } } } @@ -422,6 +420,8 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (run_opencl_kernel_bzero (hashcat_ctx, device_param, device_param->opencl_d_result, device_param->size_results) == -1) return -1; if (run_opencl_kernel_bzero (hashcat_ctx, device_param, device_param->opencl_d_tmps, device_param->size_tmps) == -1) return -1; + + if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; } // reset timer diff --git a/src/backend.c b/src/backend.c index 59458e5e8..4d08dc875 100644 --- a/src/backend.c +++ b/src/backend.c @@ -4602,6 +4602,8 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, if (device_param->is_opencl == true) { if (hc_clEnqueueCopyBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_tm_c, device_param->opencl_d_bfs_c, 0, 0, size_tm, 0, NULL, NULL) == -1) return -1; + + if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; } } } @@ -5270,11 +5272,7 @@ int run_opencl_kernel_atinit (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *dev if (hc_clSetKernelArg (hashcat_ctx, kernel, 1, sizeof (cl_ulong), device_param->kernel_params_atinit[1]) == -1) return -1; - if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL) == -1) return -1; - - /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ - - return 0; + return hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL); } int run_opencl_kernel_utf8toutf16le (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u64 num) @@ -5296,11 +5294,7 @@ int run_opencl_kernel_utf8toutf16le (hashcat_ctx_t *hashcat_ctx, hc_device_param if (hc_clSetKernelArg (hashcat_ctx, kernel, 1, sizeof (cl_ulong), device_param->kernel_params_utf8toutf16le[1]) == -1) return -1; - if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL) == -1) return -1; - - /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ - - return 0; + return hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL); } int run_opencl_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u64 offset, const u8 value, const u64 size) @@ -5391,8 +5385,6 @@ int run_opencl_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *devi if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, buf, CL_FALSE, num16d * 16, num16m, bzeros, 0, NULL, NULL) == -1) return -1; } - /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ - return 0; } @@ -5760,7 +5752,7 @@ int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, con if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, opencl_kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, &opencl_event) == -1) return -1; - /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ + if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; // spin damper section @@ -5978,8 +5970,6 @@ int run_kernel_mp (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const size_t local_work_size[3] = { kernel_threads, 1, 1 }; if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, opencl_kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL) == -1) return -1; - - /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ } return 0; @@ -6013,8 +6003,6 @@ int run_kernel_tm (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) const size_t local_work_size[3] = { kernel_threads, 1, 1 }; if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, cuda_kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL) == -1) return -1; - - /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ } return 0; @@ -6103,8 +6091,6 @@ int run_kernel_decompress (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device if (hc_clSetKernelArg (hashcat_ctx, opencl_kernel, 3, sizeof (cl_ulong), device_param->kernel_params_decompress[3]) == -1) return -1; if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, opencl_kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL) == -1) return -1; - - /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ } return 0; @@ -6421,6 +6407,11 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const } } + if (device_param->is_opencl == true) + { + if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; + } + return 0; } diff --git a/src/hashes.c b/src/hashes.c index 9145c9834..241b653cb 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -706,11 +706,6 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) /* NOTE: run_opencl_kernel_bzero() does not handle buffer offset */ rc = run_opencl_kernel_memset32 (hashcat_ctx, device_param, device_param->opencl_d_digests_shown, salt_buf->digests_offset, 0, salt_buf->digests_cnt); - if (rc == 0) - { - rc = hc_clFlush (hashcat_ctx, device_param->opencl_command_queue); - } - if (rc == -1) { break; From 7a8065d090027418d452876109f386ee3aaf64c1 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Thu, 29 Jul 2021 14:39:11 +0300 Subject: [PATCH 35/64] Do not call clWaitForEvents() after spin damper when we know that event status is CL_COMPLETE --- src/backend.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/backend.c b/src/backend.c index 4d08dc875..4e4581d99 100644 --- a/src/backend.c +++ b/src/backend.c @@ -5752,8 +5752,6 @@ int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, con if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, opencl_kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, &opencl_event) == -1) return -1; - if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; - // spin damper section const u32 iterationm = iteration % EXPECTED_ITERATIONS; @@ -5764,6 +5762,8 @@ int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, con size_t param_value_size_ret; + if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; + if (hc_clGetEventInfo (hashcat_ctx, opencl_event, CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof (opencl_event_status), &opencl_event_status, ¶m_value_size_ret) == -1) return -1; double spin_total = device_param->spin_damp; @@ -5800,11 +5800,18 @@ int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, con spin_total += device_param->spin_damp; - if (spin_total > 1) break; + if (spin_total > 1) + { + if (hc_clWaitForEvents (hashcat_ctx, 1, &opencl_event) == -1) return -1; + + break; + } } } - - if (hc_clWaitForEvents (hashcat_ctx, 1, &opencl_event) == -1) return -1; + else + { + if (hc_clWaitForEvents (hashcat_ctx, 1, &opencl_event) == -1) return -1; + } cl_ulong time_start; cl_ulong time_end; From 8d51fca192040a6e5b30ec8b8049d3f27ff3525c Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Thu, 29 Jul 2021 14:40:45 +0300 Subject: [PATCH 36/64] No need to synchronize after run_kernel() --- src/autotune.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/autotune.c b/src/autotune.c index 6d9f6da9a..8941c71b9 100644 --- a/src/autotune.c +++ b/src/autotune.c @@ -60,21 +60,6 @@ static double try_run (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par run_kernel (hashcat_ctx, device_param, KERN_RUN_2, 0, kernel_power_try, true, 0); } - if (device_param->is_cuda == true) - { - if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; - } - - if (device_param->is_hip == true) - { - if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; - } - - if (device_param->is_opencl == true) - { - if (hc_clFinish (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; - } - device_param->spin_damp = spin_damp_sav; const double exec_msec_prev = get_avg_exec_time (device_param, 1); From 81c2ec3caf7780eb26bf061bd89cde353342ee85 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Thu, 29 Jul 2021 14:48:36 +0300 Subject: [PATCH 37/64] Small cleanup in gidd_to_pw_t() --- src/backend.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/backend.c b/src/backend.c index 4e4581d99..1dbe2ec16 100644 --- a/src/backend.c +++ b/src/backend.c @@ -4499,9 +4499,9 @@ int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, c const u32 cnt = pw_idx.cnt; const u32 len = pw_idx.len; - if (device_param->is_cuda == true) + if (cnt > 0) { - if (cnt > 0) + if (device_param->is_cuda == true) { if (hc_cuCtxPushCurrent (hashcat_ctx, device_param->cuda_context) == -1) return -1; @@ -4511,11 +4511,8 @@ int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, c if (hc_cuCtxPopCurrent (hashcat_ctx, &device_param->cuda_context) == -1) return -1; } - } - if (device_param->is_hip == true) - { - if (cnt > 0) + if (device_param->is_hip == true) { if (hc_hipCtxPushCurrent (hashcat_ctx, device_param->hip_context) == -1) return -1; @@ -4525,11 +4522,8 @@ int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, c if (hc_hipCtxPopCurrent (hashcat_ctx, &device_param->hip_context) == -1) return -1; } - } - if (device_param->is_opencl == true) - { - if (cnt > 0) + if (device_param->is_opencl == true) { /* blocking */ if (hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_comp_buf, CL_TRUE, off * sizeof (u32), cnt * sizeof (u32), pw->i, 0, NULL, NULL) == -1) return -1; From 1064cce08cc85001f30af73fc6e644977422dc8f Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Thu, 29 Jul 2021 15:22:25 +0300 Subject: [PATCH 38/64] Synchronize before hooks --- src/backend.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/backend.c b/src/backend.c index 1dbe2ec16..595fd3508 100644 --- a/src/backend.c +++ b/src/backend.c @@ -4701,16 +4701,21 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, if (device_param->is_cuda == true) { if (hc_cuMemcpyDtoHAsync (hashcat_ctx, device_param->hooks_buf, device_param->cuda_d_hooks, pws_cnt * hashconfig->hook_size, device_param->cuda_stream) == -1) return -1; + + if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { if (hc_hipMemcpyDtoHAsync (hashcat_ctx, device_param->hooks_buf, device_param->hip_d_hooks, pws_cnt * hashconfig->hook_size, device_param->hip_stream) == -1) return -1; + + if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) { - if (hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_hooks, CL_FALSE, 0, pws_cnt * hashconfig->hook_size, device_param->hooks_buf, 0, NULL, NULL) == -1) return -1; + /* blocking */ + if (hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_hooks, CL_TRUE, 0, pws_cnt * hashconfig->hook_size, device_param->hooks_buf, 0, NULL, NULL) == -1) return -1; } const int hook_threads = (int) user_options->hook_threads; @@ -4849,16 +4854,21 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, if (device_param->is_cuda == true) { if (hc_cuMemcpyDtoHAsync (hashcat_ctx, device_param->hooks_buf, device_param->cuda_d_hooks, pws_cnt * hashconfig->hook_size, device_param->cuda_stream) == -1) return -1; + + if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; } if (device_param->is_hip == true) { if (hc_hipMemcpyDtoHAsync (hashcat_ctx, device_param->hooks_buf, device_param->hip_d_hooks, pws_cnt * hashconfig->hook_size, device_param->hip_stream) == -1) return -1; + + if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; } if (device_param->is_opencl == true) { - if (hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_hooks, CL_FALSE, 0, pws_cnt * hashconfig->hook_size, device_param->hooks_buf, 0, NULL, NULL) == -1) return -1; + /* blocking */ + if (hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_hooks, CL_TRUE, 0, pws_cnt * hashconfig->hook_size, device_param->hooks_buf, 0, NULL, NULL) == -1) return -1; } const int hook_threads = (int) user_options->hook_threads; @@ -6047,8 +6057,6 @@ int run_kernel_amp (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const size_t local_work_size[3] = { kernel_threads, 1, 1 }; if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, opencl_kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL) == -1) return -1; - - /*if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1;*/ } return 0; @@ -12510,6 +12518,8 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_st_esalts_buf, CL_FALSE, 0, size_st_esalts, hashes->st_esalts_buf, 0, NULL, NULL) == -1) return -1; } } + + if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; } /** From d721deb17a5df30ed57cc0c78a4dc5b7ebab4db5 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Thu, 29 Jul 2021 15:23:24 +0300 Subject: [PATCH 39/64] Move variables higher to avoid async execution stack problems --- src/selftest.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/selftest.c b/src/selftest.c index af3a94550..e9367e152 100644 --- a/src/selftest.c +++ b/src/selftest.c @@ -72,6 +72,10 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param tmp.pw_len = (u32) tmp_len; } + pw_t pw; + pw_t comb; + bf_t bf; + u32 highest_pw_len = 0; if (user_options->slow_candidates == true) @@ -81,8 +85,6 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param device_param->kernel_params_buf32[30] = 1; } - pw_t pw; - memset (&pw, 0, sizeof (pw)); char *pw_ptr = (char *) &pw.i; @@ -116,8 +118,6 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param { device_param->kernel_params_buf32[30] = 1; - pw_t pw; - memset (&pw, 0, sizeof (pw)); char *pw_ptr = (char *) &pw.i; @@ -153,8 +153,6 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param device_param->kernel_params_buf32[30] = 1; device_param->kernel_params_buf32[33] = COMBINATOR_MODE_BASE_LEFT; - pw_t pw; - memset (&pw, 0, sizeof (pw)); char *pw_ptr = (char *) &pw.i; @@ -170,8 +168,6 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param uppercase ((u8 *) pw_ptr, pw.pw_len); } - pw_t comb; - memset (&comb, 0, sizeof (comb)); char *comb_ptr = (char *) &comb.i; @@ -227,8 +223,6 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (hashconfig->opts_type & OPTS_TYPE_TM_KERNEL) { - pw_t pw; - memset (&pw, 0, sizeof (pw)); char *pw_ptr = (char *) &pw.i; @@ -261,8 +255,6 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param } else { - bf_t bf; - memset (&bf, 0, sizeof (bf)); char *bf_ptr = (char *) &bf.i; @@ -315,8 +307,6 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_bfs_c, CL_FALSE, 0, 1 * sizeof (bf_t), &bf, 0, NULL, NULL) == -1) return -1; } - pw_t pw; - memset (&pw, 0, sizeof (pw)); char *pw_ptr = (char *) &pw.i; @@ -422,8 +412,6 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param } else { - pw_t pw; - memset (&pw, 0, sizeof (pw)); char *pw_ptr = (char *) &pw.i; @@ -710,6 +698,8 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (device_param->is_opencl == true) { if (hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_result, CL_FALSE, 0, sizeof (u32), &num_cracked, 0, NULL, &opencl_event) == -1) return -1; + + if (hc_clFlush (hashcat_ctx, device_param->opencl_command_queue) == -1) return -1; } // finish : cleanup and restore From e154f9e781cfc15b3eba10ba1136da2135358a92 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Fri, 30 Jul 2021 12:24:21 +0300 Subject: [PATCH 40/64] Few cleanups --- src/backend.c | 24 +++++------------------- src/hashes.c | 4 ++-- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/src/backend.c b/src/backend.c index b399ec492..435d06097 100644 --- a/src/backend.c +++ b/src/backend.c @@ -4480,7 +4480,8 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const int hook_threads = (int) user_options->hook_threads; - hook_thread_param_t *hook_threads_param = (hook_thread_param_t *) hccalloc (hook_threads, sizeof (hook_thread_param_t)); + hook_thread_param_t *hook_threads_param = (hook_thread_param_t *) hcmalloc (hook_threads * sizeof (hook_thread_param_t)); + hc_thread_t *c_threads = (hc_thread_t *) hcmalloc (hook_threads * sizeof (hc_thread_t)); for (int i = 0; i < hook_threads; i++) { @@ -4500,13 +4501,6 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, hook_thread_param->salt_pos = salt_pos; hook_thread_param->pws_cnt = pws_cnt; - } - - hc_thread_t *c_threads = (hc_thread_t *) hccalloc (hook_threads, sizeof (hc_thread_t)); - - for (int i = 0; i < hook_threads; i++) - { - hook_thread_param_t *hook_thread_param = hook_threads_param + i; hc_thread_create (c_threads[i], hook12_thread, hook_thread_param); } @@ -4514,7 +4508,6 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, hc_thread_wait (hook_threads, c_threads); hcfree (c_threads); - hcfree (hook_threads_param); if (device_param->is_cuda == true) @@ -4633,7 +4626,8 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const int hook_threads = (int) user_options->hook_threads; - hook_thread_param_t *hook_threads_param = (hook_thread_param_t *) hccalloc (hook_threads, sizeof (hook_thread_param_t)); + hook_thread_param_t *hook_threads_param = (hook_thread_param_t *) hcmalloc (hook_threads * sizeof (hook_thread_param_t)); + hc_thread_t *c_threads = (hc_thread_t *) hcmalloc (hook_threads * sizeof (hc_thread_t)); for (int i = 0; i < hook_threads; i++) { @@ -4653,13 +4647,6 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, hook_thread_param->salt_pos = salt_pos; hook_thread_param->pws_cnt = pws_cnt; - } - - hc_thread_t *c_threads = (hc_thread_t *) hccalloc (hook_threads, sizeof (hc_thread_t)); - - for (int i = 0; i < hook_threads; i++) - { - hook_thread_param_t *hook_thread_param = hook_threads_param + i; hc_thread_create (c_threads[i], hook23_thread, hook_thread_param); } @@ -4667,7 +4654,6 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, hc_thread_wait (hook_threads, c_threads); hcfree (c_threads); - hcfree (hook_threads_param); if (device_param->is_cuda == true) @@ -5102,7 +5088,7 @@ int run_opencl_kernel_memset32 (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *d { const u64 len = offset + size; - u32 *tmp = (u32 *) hcmalloc ((offset + size) * sizeof (u32)); + u32 *tmp = (u32 *) hcmalloc (len * sizeof (u32)); for (u64 i = 0; i < len; i++) { diff --git a/src/hashes.c b/src/hashes.c index 2fbf9d0cf..ef654e672 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -580,13 +580,13 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) if (num_cracked == 0 || user_options->speed_only == true) { - // we want get num_cracked in benchmark mode because it has an influence in performance + // we want to get the num_cracked in benchmark mode because it has an influence in performance // however if the benchmark cracks the artificial hash used for benchmarks we don't want to see that! return 0; } - plain_t *cracked = (plain_t *) hccalloc (num_cracked, sizeof (plain_t)); + plain_t *cracked = (plain_t *) hcmalloc (num_cracked * sizeof (plain_t)); if (device_param->is_cuda == true) { From 51adbbbe53b100a94f7235af53c3a6ad3f01d17b Mon Sep 17 00:00:00 2001 From: philsmd Date: Fri, 30 Jul 2021 15:23:33 +0200 Subject: [PATCH 41/64] fix buffer sizes for -m 13600 = WinZip --- OpenCL/m13600-pure.cl | 2 +- src/modules/module_13600.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/OpenCL/m13600-pure.cl b/OpenCL/m13600-pure.cl index 0202cf0bf..34356b3a9 100644 --- a/OpenCL/m13600-pure.cl +++ b/OpenCL/m13600-pure.cl @@ -37,7 +37,7 @@ typedef struct zip2 u32 verify_bytes; u32 compress_length; u32 data_len; - u32 data_buf[0x4000000]; + u32 data_buf[0x200000]; u32 auth_len; u32 auth_buf[4]; diff --git a/src/modules/module_13600.c b/src/modules/module_13600.c index ec1c4e6ef..66f852695 100644 --- a/src/modules/module_13600.c +++ b/src/modules/module_13600.c @@ -9,6 +9,7 @@ #include "bitops.h" #include "convert.h" #include "shared.h" +#include "memory.h" static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL; static const u32 DGST_POS0 = 0; @@ -61,7 +62,7 @@ typedef struct zip2 u32 verify_bytes; u32 compress_length; u32 data_len; - u32 data_buf[0x4000000]; + u32 data_buf[0x200000]; u32 auth_len; u32 auth_buf[4]; @@ -166,7 +167,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE | TOKEN_ATTR_VERIFY_HEX; token.len_min[7] = 0; - token.len_max[7] = 0x4000000 * 4 * 2; + token.len_max[7] = 0x200000 * 4 * 2; token.sep[7] = '*'; token.attr[7] = TOKEN_ATTR_VERIFY_LENGTH | TOKEN_ATTR_VERIFY_HEX; @@ -365,7 +366,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE const u32 data_len = zip2->data_len; - char data_tmp[16384 + 1] = { 0 }; + char *data_tmp = (char *) hccalloc (1, (data_len * 2) + 1); for (u32 i = 0, j = 0; i < data_len; i += 1, j += 2) { @@ -397,6 +398,8 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE auth_tmp, SIGNATURE_ZIP2_STOP); + hcfree (data_tmp); + return line_len; } From 92dfa7e13717c4cf42fcab35d7ad392ff9c25393 Mon Sep 17 00:00:00 2001 From: philsmd Date: Fri, 30 Jul 2021 15:29:47 +0200 Subject: [PATCH 42/64] Increase buffer sizes for -m 11600 = 7-Zip --- docs/changes.txt | 1 + src/modules/module_11600.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index e864683d6..7212ab1a7 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -41,6 +41,7 @@ - Kernel Cache: Add kernel threads into hash computation which is later used in the kernel cache filename - Memory Management: Refactored the code responsible for limiting kernel accel in order to avoid out of -host- memory situations - SCRYPT Kernels: Add more optimized values for some new NV/AMD GPUs +- 7-Zip Hook: Increase supported data length from 320kb to 8mb ## ## Algorithms diff --git a/src/modules/module_11600.c b/src/modules/module_11600.c index 25fe732a3..709cedfa9 100644 --- a/src/modules/module_11600.c +++ b/src/modules/module_11600.c @@ -80,7 +80,7 @@ typedef struct seven_zip_hook_salt u8 data_type; - u32 data_buf[81882]; + u32 data_buf[0x200000]; u32 data_len; u32 unpack_size; @@ -130,8 +130,8 @@ bool module_hook_extra_param_init (MAYBE_UNUSED const hashconfig_t *hashconfig, { seven_zip_hook_extra_t *seven_zip_hook_extra = (seven_zip_hook_extra_t *) hook_extra_param; - #define AESSIZE 320 * 1024 - #define UNPSIZE 9766 * 1024 // or actually maximum is 9999999 + #define AESSIZE 8 * 1024 * 1024 + #define UNPSIZE 9999999 seven_zip_hook_extra->aes = hccalloc (backend_ctx->backend_devices_cnt, sizeof (void *)); @@ -500,7 +500,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE token.sep[10] = '$'; token.len_min[10] = 2; - token.len_max[10] = 655056; + token.len_max[10] = 0x200000 * 4 * 2; token.attr[10] = TOKEN_ATTR_VERIFY_LENGTH; const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); @@ -592,7 +592,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE if ((data_len * 2) != data_buf_len) return (PARSER_SALT_VALUE); - if (data_len > 327528) return (PARSER_SALT_VALUE); + if (data_len > 0x200000 * 4) return (PARSER_SALT_VALUE); if (unpack_size > data_len) return (PARSER_SALT_VALUE); From ca896f89bc920e090c64feaf6ca49634746f1754 Mon Sep 17 00:00:00 2001 From: Gabriele Gristina Date: Sat, 31 Jul 2021 14:34:36 +0200 Subject: [PATCH 43/64] Fixed multiple buffer overflow in DPAPI masterkey file v1 module --- docs/changes.txt | 1 + src/modules/module_15300.c | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 1ab36e2df..cbd2d3b42 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -14,6 +14,7 @@ - Fixed autotune unitialized tmps variable for slow hashes by calling _init kernel before calling _loop kernel - Fixed datatype in function sha384_hmac_init_vector_128() that could come into effect if vector datatype was manually set - Fixed false negative in all VeraCrypt hash-modes if both conditions are met: 1. use CPU for cracking and 2. PIM range was used +- Fixed multiple buffer overflow in DPAPI masterkey file v1 module ## ## Improvements diff --git a/src/modules/module_15300.c b/src/modules/module_15300.c index 7f85d4471..1327438be 100644 --- a/src/modules/module_15300.c +++ b/src/modules/module_15300.c @@ -224,9 +224,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE dpapimk->context = hc_strtoul ((const char *) context_pos, NULL, 10); - // division by 4 should be fine because contents_len is either 208 or 288 - - for (u32 i = 0; i < dpapimk->contents_len / 4; i++) + for (u32 i = 0; i < dpapimk->contents_len / 8; i++) { dpapimk->contents[i] = hex_to_u32 ((const u8 *) &contents_pos[i * 8]); @@ -317,7 +315,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE SID_tmp = (u8 *) hcmalloc ((SID_len + 1) * sizeof(u8)); - for (u32 i = 0; i < (SID_len / 4) + 1; i++) + for (u32 i = 0; i < (SID_len / 4); i++) { u8 hex[8] = { 0 }; From a847a4c84b68c5d72c662198487a3ea96b0e1e1f Mon Sep 17 00:00:00 2001 From: Gabriele Gristina Date: Sat, 31 Jul 2021 14:38:14 +0200 Subject: [PATCH 44/64] Fixed multiple buffer overflow in DPAPI masterkey file v2 module --- docs/changes.txt | 1 + src/modules/module_15900.c | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 1ab36e2df..fc2638a55 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -14,6 +14,7 @@ - Fixed autotune unitialized tmps variable for slow hashes by calling _init kernel before calling _loop kernel - Fixed datatype in function sha384_hmac_init_vector_128() that could come into effect if vector datatype was manually set - Fixed false negative in all VeraCrypt hash-modes if both conditions are met: 1. use CPU for cracking and 2. PIM range was used +- Fixed multiple buffer overflow in DPAPI masterkey file v2 module ## ## Improvements diff --git a/src/modules/module_15900.c b/src/modules/module_15900.c index b07809107..155255a51 100644 --- a/src/modules/module_15900.c +++ b/src/modules/module_15900.c @@ -212,9 +212,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE dpapimk->context = hc_strtoul ((const char *) context_pos, NULL, 10); - // division by 4 should be fine because contents_len is either 208 or 288 - - for (u32 i = 0; i < dpapimk->contents_len / 4; i++) + for (u32 i = 0; i < dpapimk->contents_len / 8; i++) { dpapimk->contents[i] = hex_to_u32 ((const u8 *) &contents_pos[i * 8]); @@ -303,7 +301,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE SID_tmp = (u8 *) hcmalloc ((SID_len + 1) * sizeof (u8)); - for (u32 i = 0; i < (SID_len / 4) + 1; i++) + for (u32 i = 0; i < (SID_len / 4); i++) { u8 hex[8] = { 0 }; From 4869e2a9d11e9d82768cdccb7357850891833acf Mon Sep 17 00:00:00 2001 From: Gabriele Gristina Date: Sat, 31 Jul 2021 15:52:44 +0200 Subject: [PATCH 45/64] Fixed buffer overflow in Stuffit5 module --- docs/changes.txt | 1 + src/modules/module_24700.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 1ab36e2df..78cb1f98c 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -14,6 +14,7 @@ - Fixed autotune unitialized tmps variable for slow hashes by calling _init kernel before calling _loop kernel - Fixed datatype in function sha384_hmac_init_vector_128() that could come into effect if vector datatype was manually set - Fixed false negative in all VeraCrypt hash-modes if both conditions are met: 1. use CPU for cracking and 2. PIM range was used +- Fixed buffer overflow in Stuffit5 module ## ## Improvements diff --git a/src/modules/module_24700.c b/src/modules/module_24700.c index 04163dc37..e50df1c2f 100644 --- a/src/modules/module_24700.c +++ b/src/modules/module_24700.c @@ -52,9 +52,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE token.token_cnt = 1; - token.len_min[0] = 10; - token.len_max[0] = 10; - token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH + token.len[0] = 10; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH | TOKEN_ATTR_VERIFY_HEX; const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); @@ -62,9 +61,14 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); const u8 *hash_pos = token.buf[0]; + const u32 hash_len = token.len[0]; - digest[0] = hex_to_u32 (hash_pos + 0); - digest[1] = hex_to_u32 (hash_pos + 8); + u8 digest_tmp[16] = { 0 }; + + memcpy (digest_tmp, hash_pos, hash_len); + + digest[0] = hex_to_u32 (digest_tmp + 0); + digest[1] = hex_to_u32 (digest_tmp + 8); if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) { From 89234a5c7c8ac48f84c9f2ce00e8851742140b80 Mon Sep 17 00:00:00 2001 From: Gabriele Gristina Date: Sat, 31 Jul 2021 16:18:29 +0200 Subject: [PATCH 46/64] Fixed buffer overflow in Stargazer Stellar Wallet XLM module --- docs/changes.txt | 1 + src/modules/module_25500.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 1ab36e2df..9d2478275 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -14,6 +14,7 @@ - Fixed autotune unitialized tmps variable for slow hashes by calling _init kernel before calling _loop kernel - Fixed datatype in function sha384_hmac_init_vector_128() that could come into effect if vector datatype was manually set - Fixed false negative in all VeraCrypt hash-modes if both conditions are met: 1. use CPU for cracking and 2. PIM range was used +- Fixed buffer overflow in Stargazer Stellar Wallet XLM module ## ## Improvements diff --git a/src/modules/module_25500.c b/src/modules/module_25500.c index e6853e951..f858e3062 100644 --- a/src/modules/module_25500.c +++ b/src/modules/module_25500.c @@ -247,9 +247,9 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE // salt - #define SALT_LEN_BASE64 ((16 * 8) / 6) + 3 - #define IV_LEN_BASE64 ((12 * 8) / 6) + 3 - #define CT_LEN_BASE64 ((72 * 8) / 6) + 3 + #define SALT_LEN_BASE64 ((16 * 8) / 6) + 3 + 1 // 25 vs 24 + #define IV_LEN_BASE64 ((12 * 8) / 6) + 1 // 17 vs 16 + #define CT_LEN_BASE64 ((72 * 8) / 6) + 1 // 97 vs 96 u8 salt_buf[SALT_LEN_BASE64] = { 0 }; From d4997d12559524699b9cccae6142a08d08e9c5fb Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Sat, 31 Jul 2021 16:49:39 +0200 Subject: [PATCH 47/64] Added support for auto-tuning --kernel-threads (-T) on startup --- src/autotune.c | 242 +++++++++++++++++++++++-------------- src/backend.c | 136 +++++++++++---------- src/modules/module_01500.c | 9 +- src/modules/module_03000.c | 9 +- src/modules/module_12500.c | 11 +- src/modules/module_14000.c | 9 +- src/modules/module_14600.c | 13 +- src/modules/module_23700.c | 11 +- src/modules/module_23800.c | 11 +- src/selftest.c | 6 + tools/benchmark_deep.pl | 1 - 11 files changed, 236 insertions(+), 222 deletions(-) diff --git a/src/autotune.c b/src/autotune.c index cdeb73553..d6c406513 100644 --- a/src/autotune.c +++ b/src/autotune.c @@ -10,7 +10,7 @@ #include "status.h" #include "autotune.h" -static double try_run (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 kernel_accel, const u32 kernel_loops) +static double try_run (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 kernel_accel, const u32 kernel_loops, const u32 kernel_threads) { hashconfig_t *hashconfig = hashcat_ctx->hashconfig; user_options_t *user_options = hashcat_ctx->user_options; @@ -19,7 +19,9 @@ static double try_run (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par device_param->kernel_params_buf32[29] = kernel_loops; // not a bug, both need to be set device_param->kernel_params_buf32[30] = kernel_loops; // because there's two variables for inner iters for slow and fast hashes - u32 kernel_power_try = device_param->hardware_power * kernel_accel; + const u32 hardware_power = ((hashconfig->opts_type & OPTS_TYPE_MP_MULTI_DISABLE) ? 1 : device_param->device_processors) * kernel_threads; + + u32 kernel_power_try = hardware_power * kernel_accel; if (user_options->attack_mode == ATTACK_MODE_ASSOCIATION) { @@ -33,6 +35,10 @@ static double try_run (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par } } + const u32 kernel_threads_sav = device_param->kernel_threads; + + device_param->kernel_threads = kernel_threads; + const double spin_damp_sav = device_param->spin_damp; device_param->spin_damp = 0; @@ -50,71 +56,51 @@ static double try_run (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par } else { - run_kernel (hashcat_ctx, device_param, KERN_RUN_1, 0, kernel_power_try, true, 0); - - if (hashconfig->opts_type & OPTS_TYPE_LOOP_PREPARE) - { - run_kernel (hashcat_ctx, device_param, KERN_RUN_2P, 0, kernel_power_try, true, 0); - } - run_kernel (hashcat_ctx, device_param, KERN_RUN_2, 0, kernel_power_try, true, 0); } device_param->spin_damp = spin_damp_sav; + device_param->kernel_threads = kernel_threads_sav; + const double exec_msec_prev = get_avg_exec_time (device_param, 1); return exec_msec_prev; } -/* -static double try_run_preferred (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 kernel_accel, const u32 kernel_loops) +static double try_run_times (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 kernel_accel, const u32 kernel_loops, const u32 kernel_threads, const int times) { - hashconfig_t *hashconfig = hashcat_ctx->hashconfig; - - device_param->kernel_params_buf32[28] = 0; - device_param->kernel_params_buf32[29] = kernel_loops; // not a bug, both need to be set - device_param->kernel_params_buf32[30] = kernel_loops; // because there's two variables for inner iters for slow and fast hashes + double exec_msec_best = try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops, kernel_threads); - const u32 kernel_power_try = device_param->hardware_power * kernel_accel; - - const u32 kernel_threads_sav = device_param->kernel_threads; - - const double spin_damp_sav = device_param->spin_damp; - - device_param->spin_damp = 0; - - if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) + for (int i = 1; i < times; i++) { - if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) - { - device_param->kernel_threads = device_param->kernel_preferred_wgs_multiple1; + double exec_msec = try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops, kernel_threads); - run_kernel (hashcat_ctx, device_param, KERN_RUN_1, 0, kernel_power_try, true, 0); - } - else - { - device_param->kernel_threads = device_param->kernel_preferred_wgs_multiple4; + if (exec_msec > exec_msec_best) continue; - run_kernel (hashcat_ctx, device_param, KERN_RUN_4, 0, kernel_power_try, true, 0); - } + exec_msec_best = exec_msec; } - else - { - device_param->kernel_threads = device_param->kernel_preferred_wgs_multiple2; - run_kernel (hashcat_ctx, device_param, KERN_RUN_2, 0, kernel_power_try, true, 0); - } + return exec_msec_best; +} - device_param->kernel_threads = kernel_threads_sav; +static u32 previous_power_of_two (const u32 x) +{ + // https://stackoverflow.com/questions/2679815/previous-power-of-2 + // really cool! - device_param->spin_damp = spin_damp_sav; + if (x == 0) return 0; - const double exec_msec_prev = get_avg_exec_time (device_param, 1); + u32 r = x; - return exec_msec_prev; + r |= (r >> 1); + r |= (r >> 2); + r |= (r >> 4); + r |= (r >> 8); + r |= (r >> 16); + + return r - (r >> 1); } -*/ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) { @@ -131,9 +117,57 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param const u32 kernel_loops_min = device_param->kernel_loops_min; const u32 kernel_loops_max = device_param->kernel_loops_max; + const u32 kernel_threads_min = device_param->kernel_threads_min; + const u32 kernel_threads_max = device_param->kernel_threads_max; + u32 kernel_accel = kernel_accel_min; u32 kernel_loops = kernel_loops_min; + // for the threads we take as initial value what we receive from the runtime + // but is only to start with something, we will fine tune this value as soon as we have our workload specified + // this thread limiting is also performed insinde run_kernel() so we need to redo it here, too + + u32 kernel_wgs = 0; + u32 kernel_wgs_multiple = 0; + + if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) + { + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + kernel_wgs = device_param->kernel_wgs1; + + kernel_wgs_multiple = device_param->kernel_preferred_wgs_multiple1; + } + else + { + kernel_wgs = device_param->kernel_wgs4; + + kernel_wgs_multiple = device_param->kernel_preferred_wgs_multiple4; + } + } + else + { + kernel_wgs = device_param->kernel_wgs2; + + kernel_wgs_multiple = device_param->kernel_preferred_wgs_multiple2; + } + + u32 kernel_threads = kernel_threads_max; + + if ((kernel_wgs >= kernel_threads_min) && (kernel_wgs <= kernel_threads_max)) + { + kernel_threads = kernel_wgs; + } + + // having a value power of 2 makes it easier to divide + + const u32 kernel_threads_p2 = previous_power_of_two (kernel_threads); + + if ((kernel_threads_p2 >= kernel_threads_min) && (kernel_threads_p2 <= kernel_threads_max)) + { + kernel_threads = kernel_threads_p2; + } + // in this case the user specified a fixed -n and -u on the commandline // no way to tune anything // but we need to run a few caching rounds @@ -149,10 +183,10 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (hashconfig->warmup_disable == false) { - try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops); - try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops); - try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops); - try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops); + try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops, kernel_threads); + try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops, kernel_threads); + try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops, kernel_threads); + try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops, kernel_threads); } #endif @@ -222,13 +256,37 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param } } + // we also need to initialize some values using kernels + + if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) + { + // nothing to do + } + else + { + const u32 kernel_threads_sav = device_param->kernel_threads; + + device_param->kernel_threads = device_param->kernel_wgs1; + + run_kernel (hashcat_ctx, device_param, KERN_RUN_1, 0, kernel_power_max, false, 0); + + if (hashconfig->opts_type & OPTS_TYPE_LOOP_PREPARE) + { + device_param->kernel_threads = device_param->kernel_wgs2p; + + run_kernel (hashcat_ctx, device_param, KERN_RUN_2P, 0, kernel_power_max, false, 0); + } + + device_param->kernel_threads = kernel_threads_sav; + } + // Do a pre-autotune test run to find out if kernel runtime is above some TDR limit u32 kernel_loops_max_reduced = kernel_loops_max; if (true) { - double exec_msec = try_run (hashcat_ctx, device_param, kernel_accel_min, kernel_loops_min); + double exec_msec = try_run (hashcat_ctx, device_param, kernel_accel_min, kernel_loops_min, kernel_threads); if (exec_msec > 2000) { @@ -237,7 +295,7 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param return -1; } - exec_msec = try_run (hashcat_ctx, device_param, kernel_accel_min, kernel_loops_min); + exec_msec = try_run (hashcat_ctx, device_param, kernel_accel_min, kernel_loops_min, kernel_threads); const u32 mm = kernel_loops_max / kernel_loops_min; @@ -257,16 +315,16 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param { if (kernel_loops > kernel_loops_max_reduced) continue; - double exec_msec = try_run (hashcat_ctx, device_param, kernel_accel_min, kernel_loops); + double exec_msec = try_run_times (hashcat_ctx, device_param, kernel_accel_min, kernel_loops, kernel_threads, 1); if (exec_msec < target_msec) break; } } - // now the same for kernel-accel but with the new kernel-loops from previous loop set - #define STEPS_CNT 16 + // now the same for kernel-accel but with the new kernel-loops from previous loop set + if (kernel_accel_min < kernel_accel_max) { for (int i = 0; i < STEPS_CNT; i++) @@ -276,7 +334,7 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param if (kernel_accel_try < kernel_accel_min) continue; if (kernel_accel_try > kernel_accel_max) break; - double exec_msec = try_run (hashcat_ctx, device_param, kernel_accel_try, kernel_loops); + double exec_msec = try_run_times (hashcat_ctx, device_param, kernel_accel_try, kernel_loops, kernel_threads, 1); if (exec_msec > target_msec) break; @@ -292,7 +350,7 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param const u32 kernel_accel_orig = kernel_accel; const u32 kernel_loops_orig = kernel_loops; - double exec_msec_prev = try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops); + double exec_msec_prev = try_run_times (hashcat_ctx, device_param, kernel_accel, kernel_loops, kernel_threads, 1); for (int i = 1; i < STEPS_CNT; i++) { @@ -307,7 +365,7 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param // do a real test - const double exec_msec = try_run (hashcat_ctx, device_param, kernel_accel_try, kernel_loops_try); + const double exec_msec = try_run_times (hashcat_ctx, device_param, kernel_accel_try, kernel_loops_try, kernel_threads, 1); if (exec_msec_prev < exec_msec) break; @@ -324,7 +382,7 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param } } - double exec_msec_pre_final = try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops); + double exec_msec_pre_final = try_run_times (hashcat_ctx, device_param, kernel_accel, kernel_loops, kernel_threads, 1); const u32 exec_left = (const u32) (target_msec / exec_msec_pre_final); @@ -339,46 +397,43 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param kernel_accel *= exec_accel_min; } - // start finding best thread count is easier. - // it's either the preferred or the maximum thread count + // v6.2.4 new section: find thread count + // This is not as effective as it could be because of inaccurate kernel return timers + // But is better than fixed values + // Timers in this section are critical, so we rerun meassurements 3 times - /* - const u32 kernel_threads_min = device_param->kernel_threads_min; - const u32 kernel_threads_max = device_param->kernel_threads_max; - - if (kernel_threads_min < kernel_threads_max) + if (kernel_threads_max > kernel_threads_min) { - const double exec_msec_max = try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops); + const u32 kernel_accel_orig = kernel_accel; + const u32 kernel_threads_orig = kernel_threads; - u32 preferred_threads = 0; + double exec_msec_prev = try_run_times (hashcat_ctx, device_param, kernel_accel, kernel_loops, kernel_threads, 3); - if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) - { - if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) - { - preferred_threads = device_param->kernel_preferred_wgs_multiple1; - } - else - { - preferred_threads = device_param->kernel_preferred_wgs_multiple4; - } - } - else + for (int i = 1; i < STEPS_CNT; i++) { - preferred_threads = device_param->kernel_preferred_wgs_multiple2; - } + const u32 kernel_accel_try = kernel_accel_orig * (1U << i); + const u32 kernel_threads_try = kernel_threads_orig / (1U << i); - if ((preferred_threads >= kernel_threads_min) && (preferred_threads <= kernel_threads_max)) - { - const double exec_msec_preferred = try_run_preferred (hashcat_ctx, device_param, kernel_accel, kernel_loops); + // since we do not modify total amount of workitems, we can (and need) to do increase kernel_accel_max - if (exec_msec_preferred < exec_msec_max) - { - device_param->kernel_threads = preferred_threads; - } + const u32 kernel_accel_max_try = kernel_accel_max * (1U << i); + + if (kernel_accel_try > kernel_accel_max_try) break; + + if (kernel_threads_try < kernel_threads_min) break; + + if (kernel_threads_try % kernel_wgs_multiple) break; // this would just be waste of time + + double exec_msec = try_run_times (hashcat_ctx, device_param, kernel_accel_try, kernel_loops, kernel_threads_try, 3); + + if (exec_msec > exec_msec_prev) continue; + + exec_msec_prev = exec_msec; + + kernel_accel = kernel_accel_try; + kernel_threads = kernel_threads_try; } } - */ } // reset them fake words @@ -478,8 +533,13 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param // store - device_param->kernel_accel = kernel_accel; - device_param->kernel_loops = kernel_loops; + device_param->kernel_accel = kernel_accel; + device_param->kernel_loops = kernel_loops; + device_param->kernel_threads = kernel_threads; + + const u32 hardware_power = ((hashconfig->opts_type & OPTS_TYPE_MP_MULTI_DISABLE) ? 1 : device_param->device_processors) * device_param->kernel_threads; + + device_param->hardware_power = hardware_power; const u32 kernel_power = device_param->hardware_power * device_param->kernel_accel; diff --git a/src/backend.c b/src/backend.c index 05cdeeac4..e95793c4f 100644 --- a/src/backend.c +++ b/src/backend.c @@ -5420,6 +5420,8 @@ int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, con if (hc_cuEventSynchronize (hashcat_ctx, device_param->cuda_event2) == -1) return -1; + if (hc_cuEventSynchronize (hashcat_ctx, device_param->cuda_event1) == -1) return -1; + float exec_ms; if (hc_cuEventElapsedTime (hashcat_ctx, &exec_ms, device_param->cuda_event1, device_param->cuda_event2) == -1) return -1; @@ -9095,6 +9097,13 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) } } + if (device_param->opencl_device_type & CL_DEVICE_TYPE_CPU) + { + // they like this + + device_param->kernel_preferred_wgs_multiple = 1; + } + if (device_param->opencl_device_type & CL_DEVICE_TYPE_GPU) { if ((device_param->opencl_platform_vendor_id == VENDOR_ID_APPLE) && (device_param->opencl_device_vendor_id == VENDOR_ID_AMD)) @@ -10113,61 +10122,6 @@ static int get_opencl_kernel_dynamic_local_mem_size (hashcat_ctx_t *hashcat_ctx, return 0; } -static u32 get_kernel_threads (const hc_device_param_t *device_param) -{ - // this is an upper limit, a good start, since our strategy is to reduce thread counts only. - - u32 kernel_threads_min = device_param->kernel_threads_min; - u32 kernel_threads_max = device_param->kernel_threads_max; - - // the changes we do here are just optimizations, since the module always has priority. - - const u32 device_maxworkgroup_size = (const u32) device_param->device_maxworkgroup_size; - - kernel_threads_max = MIN (kernel_threads_max, device_maxworkgroup_size); - - if (device_param->opencl_device_type & CL_DEVICE_TYPE_CPU) - { - // for all CPU we just do 1 ... - - kernel_threads_max = MIN (kernel_threads_max, 1); - } - else if (device_param->opencl_device_type & CL_DEVICE_TYPE_GPU) - { - // for GPU we need to distinguish by vendor - - if (device_param->opencl_device_vendor_id == VENDOR_ID_INTEL_SDK) - { - kernel_threads_max = MIN (kernel_threads_max, 8); - } - else if (device_param->opencl_device_vendor_id == VENDOR_ID_AMD) - { - if (device_param->kernel_preferred_wgs_multiple == 64) - { - // only older AMD GPUs with WaveFront size 64 benefit from this - - kernel_threads_max = MIN (kernel_threads_max, device_param->kernel_preferred_wgs_multiple); - } - } - else if (device_param->opencl_device_vendor_id == VENDOR_ID_AMD_USE_HIP) - { - if (device_param->kernel_preferred_wgs_multiple == 64) - { - // only older AMD GPUs with WaveFront size 64 benefit from this - - kernel_threads_max = MIN (kernel_threads_max, device_param->kernel_preferred_wgs_multiple); - } - } - } - - // this is intenionally! at this point, kernel_threads_min can be higher than kernel_threads_max. - // in this case we actually want kernel_threads_min selected. - - const u32 kernel_threads = MAX (kernel_threads_min, kernel_threads_max); - - return kernel_threads; -} - static bool load_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const char *kernel_name, char *source_file, char *cached_file, const char *build_options_buf, const bool cache_disable, cl_program *opencl_program, CUmodule *cuda_module, hipModule_t *hip_module) { const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; @@ -10206,8 +10160,6 @@ static bool load_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_p if (cached == false) { #if defined (DEBUG) - const user_options_t *user_options = hashcat_ctx->user_options; - if (user_options->quiet == false) event_log_warning (hashcat_ctx, "* Device #%u: Kernel %s not found in cache. Please be patient...", device_param->device_id + 1, filename_from_filepath (cached_file)); #endif @@ -10460,7 +10412,7 @@ static bool load_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_p //hiprtc_options[1] = "--device-as-default-execution-space"; //hiprtc_options[2] = "--gpu-architecture"; - hc_asprintf (&hiprtc_options[0], "--gpu-max-threads-per-block=%d", (user_options->kernel_threads_chgd == true) ? user_options->kernel_threads : ((device_param->kernel_preferred_wgs_multiple == 64) ? 64 : KERNEL_THREADS_MAX)); + hc_asprintf (&hiprtc_options[0], "--gpu-max-threads-per-block=%d", (user_options->kernel_threads_chgd == true) ? user_options->kernel_threads : device_param->kernel_threads_max); hiprtc_options[1] = "-nocudainc"; hiprtc_options[2] = "-nocudalib"; @@ -11106,6 +11058,19 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) } } + // this seems to work always + + if (device_param->opencl_device_type & CL_DEVICE_TYPE_CPU) + { + u32 native_threads = 1; + + if ((native_threads >= device_param->kernel_threads_min) && (native_threads <= device_param->kernel_threads_max)) + { + device_param->kernel_threads_min = native_threads; + device_param->kernel_threads_max = native_threads; + } + } + /** * create context for each device */ @@ -11423,7 +11388,7 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) device_param->device_name, device_param->opencl_device_version, device_param->opencl_driver_version, - (user_options->kernel_threads_chgd == true) ? user_options->kernel_threads : ((device_param->kernel_preferred_wgs_multiple == 64) ? 64 : KERNEL_THREADS_MAX)); + (user_options->kernel_threads_chgd == true) ? user_options->kernel_threads : device_param->kernel_threads_max); md5_ctx_t md5_ctx; @@ -11758,7 +11723,7 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) device_param->vector_width, hashconfig->kern_type, extra_value, - (user_options->kernel_threads_chgd == true) ? user_options->kernel_threads : ((device_param->kernel_preferred_wgs_multiple == 64) ? 64 : KERNEL_THREADS_MAX), + (user_options->kernel_threads_chgd == true) ? user_options->kernel_threads : device_param->kernel_threads_max, build_options_module_buf); md5_ctx_t md5_ctx; @@ -14483,7 +14448,7 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) * now everything that depends on threads and accel, basically dynamic workload */ - u32 kernel_threads = get_kernel_threads (device_param); + // u32 kernel_threads = get_kernel_threads (device_param); if (user_options->attack_mode == ATTACK_MODE_ASSOCIATION) { @@ -14491,12 +14456,14 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) // in autotune. in this attack mode kernel_power is limited by salts_cnt so we // do not have a lot of options left. - kernel_threads = MIN (kernel_threads, 64); + device_param->kernel_threads_min = MIN (device_param->kernel_threads_min, 64); + device_param->kernel_threads_max = MIN (device_param->kernel_threads_max, 64); } - device_param->kernel_threads = kernel_threads; + // device_param->kernel_threads = kernel_threads; + device_param->kernel_threads = 0; - device_param->hardware_power = ((hashconfig->opts_type & OPTS_TYPE_MP_MULTI_DISABLE) ? 1 : device_processors) * kernel_threads; + device_param->hardware_power = ((hashconfig->opts_type & OPTS_TYPE_MP_MULTI_DISABLE) ? 1 : device_processors) * device_param->kernel_threads_max; u32 kernel_accel_min = device_param->kernel_accel_min; u32 kernel_accel_max = device_param->kernel_accel_max; @@ -14622,6 +14589,47 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) if ((size_tmps + EXTRA_SPACE) > device_param->device_maxmem_alloc) memory_limit_hit = 1; if ((size_hooks + EXTRA_SPACE) > device_param->device_maxmem_alloc) memory_limit_hit = 1; + // work around, for some reason apple opencl can't have buffers larger 2^31 + // typically runs into trap 6 + // maybe 32/64 bit problem affecting size_t? + + if (device_param->opencl_platform_vendor_id == VENDOR_ID_APPLE) + { + const size_t undocumented_single_allocation_apple = 0x7fffffff; + + if (bitmap_ctx->bitmap_size > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (bitmap_ctx->bitmap_size > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (bitmap_ctx->bitmap_size > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (bitmap_ctx->bitmap_size > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (bitmap_ctx->bitmap_size > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (bitmap_ctx->bitmap_size > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (bitmap_ctx->bitmap_size > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (bitmap_ctx->bitmap_size > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_bfs > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_combs > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_digests > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_esalts > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_hooks > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_markov_css > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_plains > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_pws > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_pws_amp > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_pws_comp > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_pws_idx > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_results > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_root_css > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_rules > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_rules_c > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_salts > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_extra_buffer > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_shown > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_tm > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_tmps > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_st_digests > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_st_salts > undocumented_single_allocation_apple) memory_limit_hit = 1; + if (size_st_esalts > undocumented_single_allocation_apple) memory_limit_hit = 1; + } + const u64 size_total = bitmap_ctx->bitmap_size + bitmap_ctx->bitmap_size diff --git a/src/modules/module_01500.c b/src/modules/module_01500.c index dc7b7b47e..ca0e90232 100644 --- a/src/modules/module_01500.c +++ b/src/modules/module_01500.c @@ -95,13 +95,6 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig, return src_len; } -u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) -{ - const u32 kernel_threads_max = 64; // performance only optimization - - return kernel_threads_max; -} - u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { u32 kernel_loops_max = KERNEL_LOOPS_MAX; @@ -345,7 +338,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_kernel_accel_min = MODULE_DEFAULT; module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = module_kernel_loops_min; - module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; module_ctx->module_kern_type = module_kern_type; module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; diff --git a/src/modules/module_03000.c b/src/modules/module_03000.c index c9b616ab5..cc091a5e5 100644 --- a/src/modules/module_03000.c +++ b/src/modules/module_03000.c @@ -96,13 +96,6 @@ char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAY return jit_build_options; } -u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) -{ - const u32 kernel_threads_max = 64; // performance only optimization - - return kernel_threads_max; -} - u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { u32 kernel_loops_max = KERNEL_LOOPS_MAX; @@ -269,7 +262,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_kernel_accel_min = MODULE_DEFAULT; module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = module_kernel_loops_min; - module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; module_ctx->module_kern_type = module_kern_type; module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; diff --git a/src/modules/module_12500.c b/src/modules/module_12500.c index fda848e0a..a095b8f78 100644 --- a/src/modules/module_12500.c +++ b/src/modules/module_12500.c @@ -88,15 +88,6 @@ u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_ return kernel_loops_max; } -u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) -{ - // -T 128 works slightly faster but it's free for the user to change - - const u32 kernel_threads_max = (user_options->kernel_threads_chgd == true) ? user_options->kernel_threads : 128; - - return kernel_threads_max; -} - u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); @@ -256,7 +247,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_kernel_accel_min = MODULE_DEFAULT; module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = module_kernel_loops_min; - module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; module_ctx->module_kern_type = module_kern_type; module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; diff --git a/src/modules/module_14000.c b/src/modules/module_14000.c index 013888bcc..abe8d259e 100644 --- a/src/modules/module_14000.c +++ b/src/modules/module_14000.c @@ -91,13 +91,6 @@ char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAY return jit_build_options; } -u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) -{ - const u32 kernel_threads_max = 64; // performance only optimization - - return kernel_threads_max; -} - u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { u32 kernel_loops_max = KERNEL_LOOPS_MAX; @@ -300,7 +293,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_kernel_accel_min = MODULE_DEFAULT; module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = module_kernel_loops_min; - module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; module_ctx->module_kern_type = module_kern_type; module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; diff --git a/src/modules/module_14600.c b/src/modules/module_14600.c index 0ff26ac67..755fef2ff 100644 --- a/src/modules/module_14600.c +++ b/src/modules/module_14600.c @@ -179,17 +179,6 @@ typedef struct luks_tmp } luks_tmp_t; -u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) -{ - // the module requires a lot of registers for key schedulers on _comp kernel. - // it's possible, if using too many threads, there's not enough registers available, typically ending with misleading error message: - // cuLaunchKernel(): out of memory - - const u32 kernel_threads_max = 64; - - return kernel_threads_max; -} - void *module_benchmark_esalt (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { luks_t *luks = (luks_t *) hcmalloc (sizeof (luks_t)); @@ -655,7 +644,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_kernel_accel_min = MODULE_DEFAULT; module_ctx->module_kernel_loops_max = MODULE_DEFAULT; module_ctx->module_kernel_loops_min = MODULE_DEFAULT; - module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; module_ctx->module_kern_type = module_kern_type; module_ctx->module_kern_type_dynamic = module_kern_type_dynamic; diff --git a/src/modules/module_23700.c b/src/modules/module_23700.c index d3803b0eb..26a24c16f 100644 --- a/src/modules/module_23700.c +++ b/src/modules/module_23700.c @@ -105,15 +105,6 @@ u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_ return kernel_loops_max; } -u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) -{ - // -T 128 works slightly faster but it's free for the user to change - - const u32 kernel_threads_max = (user_options->kernel_threads_chgd == true) ? user_options->kernel_threads : 128; - - return kernel_threads_max; -} - u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); @@ -377,7 +368,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_kernel_accel_min = MODULE_DEFAULT; module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = module_kernel_loops_min; - module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; module_ctx->module_kern_type = module_kern_type; module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; diff --git a/src/modules/module_23800.c b/src/modules/module_23800.c index f910b361f..1ca597082 100644 --- a/src/modules/module_23800.c +++ b/src/modules/module_23800.c @@ -388,15 +388,6 @@ u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_ return kernel_loops_max; } -u32 module_kernel_threads_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) -{ - // -T 128 works slightly faster but it's free for the user to change - - const u32 kernel_threads_max = (user_options->kernel_threads_chgd == true) ? user_options->kernel_threads : 128; - - return kernel_threads_max; -} - u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); @@ -654,7 +645,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_kernel_accel_min = MODULE_DEFAULT; module_ctx->module_kernel_loops_max = module_kernel_loops_max; module_ctx->module_kernel_loops_min = module_kernel_loops_min; - module_ctx->module_kernel_threads_max = module_kernel_threads_max; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; module_ctx->module_kernel_threads_min = MODULE_DEFAULT; module_ctx->module_kern_type = module_kern_type; module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; diff --git a/src/selftest.c b/src/selftest.c index 4f8dc1092..2e0b5b000 100644 --- a/src/selftest.c +++ b/src/selftest.c @@ -453,6 +453,10 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param // main : run the kernel + const u32 kernel_threads_sav = device_param->kernel_threads; + + device_param->kernel_threads = device_param->kernel_threads_min; + const double spin_damp_sav = device_param->spin_damp; device_param->spin_damp = 0; @@ -677,6 +681,8 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param device_param->spin_damp = spin_damp_sav; + device_param->kernel_threads = kernel_threads_sav; + // check : check if cracked u32 num_cracked = 0; diff --git a/tools/benchmark_deep.pl b/tools/benchmark_deep.pl index ba2db8856..a481a87e9 100755 --- a/tools/benchmark_deep.pl +++ b/tools/benchmark_deep.pl @@ -409,7 +409,6 @@ for my $hash_type (@hash_types) "--wordlist-autohex-disable", "--potfile-disable", "--logfile-disable", - "--hwmon-disable", "--status", "--status-timer", 1, "--runtime", $runtime, From f4e52ca5330c9db3cd40f64460e3002300bf18ec Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Sun, 1 Aug 2021 00:04:10 +0200 Subject: [PATCH 48/64] Add new rule function '3' to switch the case of the first letter after occurrence N of char X --- OpenCL/inc_rp.cl | 30 +++++++++++++++ OpenCL/inc_rp.h | 2 + OpenCL/inc_rp_optimized.cl | 77 ++++++++++++++++++++++++++++++++++++++ OpenCL/inc_rp_optimized.h | 2 + docs/rules.txt | 1 + include/types.h | 1 + src/rp.c | 21 +++++++++-- src/rp_cpu.c | 42 +++++++++++++++++++++ 8 files changed, 172 insertions(+), 4 deletions(-) diff --git a/OpenCL/inc_rp.cl b/OpenCL/inc_rp.cl index 8cecc661d..8ad61b27f 100644 --- a/OpenCL/inc_rp.cl +++ b/OpenCL/inc_rp.cl @@ -269,6 +269,35 @@ DECLSPEC int mangle_toggle_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p return (len); } +DECLSPEC int mangle_toggle_at_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len) +{ + if (len >= RP_PASSWORD_SIZE) return (len); + + u8 occurence = 0; + + u32 rem = 0; + + for (int i = 0, idx = 0; i < len; i += 4, idx += 1) + { + const u32 t = buf[idx]; + + buf[idx] = t | generate_cmask (t); + + u32 out = rem; + + rem = 0; + + if (((t >> 0) & 0xff) == p1) { if (occurence == p0) out = 0x0000ff00; occurence++; } + if (((t >> 8) & 0xff) == p1) { if (occurence == p0) out = 0x00ff0000; occurence++; } + if (((t >> 16) & 0xff) == p1) { if (occurence == p0) out = 0xff000000; occurence++; } + if (((t >> 24) & 0xff) == p1) { if (occurence == p0) rem = 0x000000ff; occurence++; } + + buf[idx] = t ^ (generate_cmask (t) & out); + } + + return (len); +} + DECLSPEC int mangle_reverse (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len) { for (int l = 0; l < len / 2; l++) @@ -725,6 +754,7 @@ DECLSPEC int apply_rule (const u32 name, MAYBE_UNUSED const u8 p0, MAYBE_UNUSED case RULE_OP_MANGLE_UREST_LFIRST: out_len = mangle_urest_lfirst (p0, p1, buf, out_len); break; case RULE_OP_MANGLE_TREST: out_len = mangle_trest (p0, p1, buf, out_len); break; case RULE_OP_MANGLE_TOGGLE_AT: out_len = mangle_toggle_at (p0, p1, buf, out_len); break; + case RULE_OP_MANGLE_TOGGLE_AT_SEP: out_len = mangle_toggle_at_sep (p0, p1, buf, out_len); break; case RULE_OP_MANGLE_REVERSE: out_len = mangle_reverse (p0, p1, buf, out_len); break; case RULE_OP_MANGLE_DUPEWORD: out_len = mangle_dupeword (p0, p1, buf, out_len); break; case RULE_OP_MANGLE_DUPEWORD_TIMES: out_len = mangle_dupeword_times (p0, p1, (u8 *) buf, out_len); break; diff --git a/OpenCL/inc_rp.h b/OpenCL/inc_rp.h index c13d06e1f..3b91ff9da 100644 --- a/OpenCL/inc_rp.h +++ b/OpenCL/inc_rp.h @@ -21,6 +21,7 @@ #define RULE_OP_MANGLE_UREST_LFIRST 'C' #define RULE_OP_MANGLE_TREST 't' #define RULE_OP_MANGLE_TOGGLE_AT 'T' +#define RULE_OP_MANGLE_TOGGLE_AT_SEP '3' #define RULE_OP_MANGLE_REVERSE 'r' #define RULE_OP_MANGLE_DUPEWORD 'd' #define RULE_OP_MANGLE_DUPEWORD_TIMES 'p' @@ -83,6 +84,7 @@ DECLSPEC int mangle_urest (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u DECLSPEC int mangle_urest_lfirst (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len); DECLSPEC int mangle_trest (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len); DECLSPEC int mangle_toggle_at (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len); +DECLSPEC int mangle_toggle_at_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len); DECLSPEC int mangle_reverse (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len); DECLSPEC int mangle_dupeword (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len); DECLSPEC int mangle_dupeword_times (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len); diff --git a/OpenCL/inc_rp_optimized.cl b/OpenCL/inc_rp_optimized.cl index 026198f09..38239c0ec 100644 --- a/OpenCL/inc_rp_optimized.cl +++ b/OpenCL/inc_rp_optimized.cl @@ -1163,6 +1163,82 @@ DECLSPEC u32 rule_op_mangle_toggle_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED c return (in_len); } +DECLSPEC u32 rule_op_mangle_toggle_at_sep (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) +{ + if (in_len == 0) return in_len; + + u32 r0 = search_on_register (buf0[0], p1); + u32 r1 = search_on_register (buf0[1], p1); + u32 r2 = search_on_register (buf0[2], p1); + u32 r3 = search_on_register (buf0[3], p1); + u32 r4 = search_on_register (buf1[0], p1); + u32 r5 = search_on_register (buf1[1], p1); + u32 r6 = search_on_register (buf1[2], p1); + u32 r7 = search_on_register (buf1[3], p1); + + const u32 rn = (r0 << 0) + | (r1 << 4) + | (r2 << 8) + | (r3 << 12) + | (r4 << 16) + | (r5 << 20) + | (r6 << 24) + | (r7 << 28); + + if (rn == 0) return in_len; + + u32 occurence = 0; + + u32 ro = 0; + + #ifdef _unroll + #pragma unroll + #endif + for (int i = 0; i < 32; i++) + { + if ((rn >> i) & 1) + { + if (occurence == p0) + { + ro = 1 << i; + + break; + } + + occurence++; + } + } + + r0 = (ro >> 0) & 15; + r1 = (ro >> 4) & 15; + r2 = (ro >> 8) & 15; + r3 = (ro >> 12) & 15; + r4 = (ro >> 16) & 15; + r5 = (ro >> 20) & 15; + r6 = (ro >> 24) & 15; + r7 = (ro >> 28) & 15; + + r0 <<= 1; + r1 <<= 1; r1 |= r0 >> 4; + r2 <<= 1; r2 |= r1 >> 4; + r3 <<= 1; r3 |= r2 >> 4; + r4 <<= 1; r4 |= r3 >> 4; + r5 <<= 1; r5 |= r4 >> 4; + r6 <<= 1; r6 |= r5 >> 4; + r7 <<= 1; r7 |= r6 >> 4; + + buf0[0] = toggle_on_register (buf0[0], r0); + buf0[1] = toggle_on_register (buf0[1], r1); + buf0[2] = toggle_on_register (buf0[2], r2); + buf0[3] = toggle_on_register (buf0[3], r3); + buf1[0] = toggle_on_register (buf1[0], r4); + buf1[1] = toggle_on_register (buf1[1], r5); + buf1[2] = toggle_on_register (buf1[2], r6); + buf1[3] = toggle_on_register (buf1[3], r7); + + return in_len; +} + DECLSPEC u32 rule_op_mangle_reverse (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len) { reverse_block_optimized (buf0, buf1, buf0, buf1, in_len); @@ -2285,6 +2361,7 @@ DECLSPEC u32 apply_rule_optimized (const u32 name, const u32 p0, const u32 p1, u case RULE_OP_MANGLE_UREST_LFIRST: out_len = rule_op_mangle_urest_lfirst (p0, p1, buf0, buf1, out_len); break; case RULE_OP_MANGLE_TREST: out_len = rule_op_mangle_trest (p0, p1, buf0, buf1, out_len); break; case RULE_OP_MANGLE_TOGGLE_AT: out_len = rule_op_mangle_toggle_at (p0, p1, buf0, buf1, out_len); break; + case RULE_OP_MANGLE_TOGGLE_AT_SEP: out_len = rule_op_mangle_toggle_at_sep (p0, p1, buf0, buf1, out_len); break; case RULE_OP_MANGLE_REVERSE: out_len = rule_op_mangle_reverse (p0, p1, buf0, buf1, out_len); break; case RULE_OP_MANGLE_DUPEWORD: out_len = rule_op_mangle_dupeword (p0, p1, buf0, buf1, out_len); break; case RULE_OP_MANGLE_DUPEWORD_TIMES: out_len = rule_op_mangle_dupeword_times (p0, p1, buf0, buf1, out_len); break; diff --git a/OpenCL/inc_rp_optimized.h b/OpenCL/inc_rp_optimized.h index b6a133086..d391d1cfe 100644 --- a/OpenCL/inc_rp_optimized.h +++ b/OpenCL/inc_rp_optimized.h @@ -21,6 +21,7 @@ #define RULE_OP_MANGLE_UREST_LFIRST 'C' #define RULE_OP_MANGLE_TREST 't' #define RULE_OP_MANGLE_TOGGLE_AT 'T' +#define RULE_OP_MANGLE_TOGGLE_AT_SEP '3' #define RULE_OP_MANGLE_REVERSE 'r' #define RULE_OP_MANGLE_DUPEWORD 'd' #define RULE_OP_MANGLE_DUPEWORD_TIMES 'p' @@ -85,6 +86,7 @@ DECLSPEC u32 rule_op_mangle_lrest_ufirst (MAYBE_UNUSED const u32 p0, MAYBE_UNUSE DECLSPEC u32 rule_op_mangle_urest_lfirst (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len); DECLSPEC u32 rule_op_mangle_trest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len); DECLSPEC u32 rule_op_mangle_toggle_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len); +DECLSPEC u32 rule_op_mangle_toggle_at_sep (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len); DECLSPEC u32 rule_op_mangle_reverse (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len); DECLSPEC u32 rule_op_mangle_dupeword (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len); DECLSPEC u32 rule_op_mangle_dupeword_times (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len); diff --git a/docs/rules.txt b/docs/rules.txt index b2621bba4..59233d1ad 100644 --- a/docs/rules.txt +++ b/docs/rules.txt @@ -5,6 +5,7 @@ #define RULE_OP_MANGLE_UREST_LFIRST 'C' // upper case all chars, lower case 1st #define RULE_OP_MANGLE_TREST 't' // switch the case of each char #define RULE_OP_MANGLE_TOGGLE_AT 'T' // switch the case of each char on pos N +#define RULE_OP_MANGLE_TOGGLE_AT_SEP '3' // switch the case of the first letter after occurrence N of char X #define RULE_OP_MANGLE_REVERSE 'r' // reverse word #define RULE_OP_MANGLE_DUPEWORD 'd' // append word to itself #define RULE_OP_MANGLE_DUPEWORD_TIMES 'p' // append word to itself N times diff --git a/include/types.h b/include/types.h index cb4f10f44..98766dfe5 100644 --- a/include/types.h +++ b/include/types.h @@ -295,6 +295,7 @@ typedef enum rule_functions RULE_OP_MANGLE_UREST_LFIRST = 'C', RULE_OP_MANGLE_TREST = 't', RULE_OP_MANGLE_TOGGLE_AT = 'T', + RULE_OP_MANGLE_TOGGLE_AT_SEP = '3', RULE_OP_MANGLE_REVERSE = 'r', RULE_OP_MANGLE_DUPEWORD = 'd', RULE_OP_MANGLE_DUPEWORD_TIMES = 'p', diff --git a/src/rp.c b/src/rp.c index 019b6333c..811546d37 100644 --- a/src/rp.c +++ b/src/rp.c @@ -71,7 +71,8 @@ static const char grp_op_chr_chr[] = static const char grp_op_pos_chr[] = { RULE_OP_MANGLE_INSERT, - RULE_OP_MANGLE_OVERSTRIKE + RULE_OP_MANGLE_OVERSTRIKE, + RULE_OP_MANGLE_TOGGLE_AT_SEP }; static const char grp_op_pos_pos0[] = @@ -444,12 +445,18 @@ int cpu_rule_to_kernel_rule (char *rule_buf, u32 rule_len, kernel_rule_t *rule) break; case RULE_OP_MANGLE_TITLE: - SET_NAME (rule, rule_buf[rule_pos]); + SET_NAME (rule, rule_buf[rule_pos]); break; case RULE_OP_MANGLE_TITLE_SEP: - SET_NAME (rule, rule_buf[rule_pos]); - SET_P0 (rule, rule_buf[rule_pos]); + SET_NAME (rule, rule_buf[rule_pos]); + SET_P0 (rule, rule_buf[rule_pos]); + break; + + case RULE_OP_MANGLE_TOGGLE_AT_SEP: + SET_NAME (rule, rule_buf[rule_pos]); + SET_P0_CONV (rule, rule_buf[rule_pos]); + SET_P1 (rule, rule_buf[rule_pos]); break; default: @@ -675,6 +682,12 @@ int kernel_rule_to_cpu_rule (char *rule_buf, kernel_rule_t *rule) GET_P0 (rule); break; + case RULE_OP_MANGLE_TOGGLE_AT_SEP: + rule_buf[rule_pos] = rule_cmd; + GET_P0_CONV (rule); + GET_P1 (rule); + break; + case 0: if (rule_pos == 0) return -1; return rule_pos - 1; diff --git a/src/rp_cpu.c b/src/rp_cpu.c index b9dc23e69..0fd6265af 100644 --- a/src/rp_cpu.c +++ b/src/rp_cpu.c @@ -45,6 +45,41 @@ static void MANGLE_SWITCH (char *arr, const int l, const int r) arr[l] = c; } +static int mangle_toggle_at_sep (char arr[RP_PASSWORD_SIZE], int arr_len, char c, int upos) +{ + int toggle_next = 0; + + int occurrence = 0; + + int pos; + + for (pos = 0; pos < arr_len; pos++) + { + if (arr[pos] == c) + { + if (occurrence == upos) + { + toggle_next = 1; + } + else + { + occurrence++; + } + + continue; + } + + if (toggle_next == 1) + { + MANGLE_TOGGLE_AT (arr, pos); + + break; + } + } + + return (arr_len); +} + static int mangle_lrest (char arr[RP_PASSWORD_SIZE], int arr_len) { int pos; @@ -561,6 +596,13 @@ int _old_apply_rule (const char *rule, int rule_len, char in[RP_PASSWORD_SIZE], if (upos < out_len) MANGLE_TOGGLE_AT (out, upos); break; + case RULE_OP_MANGLE_TOGGLE_AT_SEP: + NEXT_RULEPOS (rule_pos); + NEXT_RPTOI (rule_new, rule_pos, upos); + NEXT_RULEPOS (rule_pos); + out_len = mangle_toggle_at_sep (out, out_len, rule_new[rule_pos], upos); + break; + case RULE_OP_MANGLE_REVERSE: out_len = mangle_reverse (out, out_len); break; From 6bcbc218d6aec3644c6d893a402639ade48cbfff Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Sun, 1 Aug 2021 10:21:21 +0200 Subject: [PATCH 49/64] Fixed out-of-boundary read in input_tokenizer() if the signatures in the hash line is longer than the constant signature in the plugin --- docs/changes.txt | 1 + src/shared.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 1ab36e2df..901cc3933 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -14,6 +14,7 @@ - Fixed autotune unitialized tmps variable for slow hashes by calling _init kernel before calling _loop kernel - Fixed datatype in function sha384_hmac_init_vector_128() that could come into effect if vector datatype was manually set - Fixed false negative in all VeraCrypt hash-modes if both conditions are met: 1. use CPU for cracking and 2. PIM range was used +- Fixed out-of-boundary read in input_tokenizer() if the signature in the hash is longer than the length of the plugins' signature constant ## ## Improvements diff --git a/src/shared.c b/src/shared.c index 7efdd4d53..9bff0c646 100644 --- a/src/shared.c +++ b/src/shared.c @@ -1181,7 +1181,7 @@ int input_tokenizer (const u8 *input_buf, const int input_len, token_t *token) for (int signature_idx = 0; signature_idx < token->signatures_cnt; signature_idx++) { - if (memcmp (token->buf[token_idx], token->signatures_buf[signature_idx], token->len[token_idx]) == 0) matched = true; + if (strncmp ((char *) token->buf[token_idx], token->signatures_buf[signature_idx], token->len[token_idx]) == 0) matched = true; } if (matched == false) return (PARSER_SIGNATURE_UNMATCHED); From e352a79a05fd60dec8f63b6454c96c0e49f87a55 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Sun, 1 Aug 2021 14:15:03 +0300 Subject: [PATCH 50/64] Extend context in gidd_to_pw_t() --- src/backend.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/backend.c b/src/backend.c index 435d06097..0d7741593 100644 --- a/src/backend.c +++ b/src/backend.c @@ -4234,8 +4234,6 @@ int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, c if (hc_cuMemcpyDtoHAsync (hashcat_ctx, &pw_idx, device_param->cuda_d_pws_idx + (gidd * sizeof (pw_idx_t)), sizeof (pw_idx_t), device_param->cuda_stream) == -1) return -1; if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; - - if (hc_cuCtxPopCurrent (hashcat_ctx, &device_param->cuda_context) == -1) return -1; } if (device_param->is_hip == true) @@ -4245,8 +4243,6 @@ int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, c if (hc_hipMemcpyDtoHAsync (hashcat_ctx, &pw_idx, device_param->hip_d_pws_idx + (gidd * sizeof (pw_idx_t)), sizeof (pw_idx_t), device_param->hip_stream) == -1) return -1; if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; - - if (hc_hipCtxPopCurrent (hashcat_ctx, &device_param->hip_context) == -1) return -1; } if (device_param->is_opencl == true) @@ -4263,24 +4259,16 @@ int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, c { if (device_param->is_cuda == true) { - if (hc_cuCtxPushCurrent (hashcat_ctx, device_param->cuda_context) == -1) return -1; - - if (hc_cuMemcpyDtoHAsync (hashcat_ctx,pw->i, device_param->cuda_d_pws_comp_buf + (off * sizeof (u32)), cnt * sizeof (u32), device_param->cuda_stream) == -1) return -1; + if (hc_cuMemcpyDtoHAsync (hashcat_ctx, pw->i, device_param->cuda_d_pws_comp_buf + (off * sizeof (u32)), cnt * sizeof (u32), device_param->cuda_stream) == -1) return -1; if (hc_cuStreamSynchronize (hashcat_ctx, device_param->cuda_stream) == -1) return -1; - - if (hc_cuCtxPopCurrent (hashcat_ctx, &device_param->cuda_context) == -1) return -1; } if (device_param->is_hip == true) { - if (hc_hipCtxPushCurrent (hashcat_ctx, device_param->hip_context) == -1) return -1; - - if (hc_hipMemcpyDtoHAsync (hashcat_ctx,pw->i, device_param->hip_d_pws_comp_buf + (off * sizeof (u32)), cnt * sizeof (u32), device_param->hip_stream) == -1) return -1; + if (hc_hipMemcpyDtoHAsync (hashcat_ctx, pw->i, device_param->hip_d_pws_comp_buf + (off * sizeof (u32)), cnt * sizeof (u32), device_param->hip_stream) == -1) return -1; if (hc_hipStreamSynchronize (hashcat_ctx, device_param->hip_stream) == -1) return -1; - - if (hc_hipCtxPopCurrent (hashcat_ctx, &device_param->hip_context) == -1) return -1; } if (device_param->is_opencl == true) @@ -4297,6 +4285,16 @@ int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, c pw->pw_len = len; + if (device_param->is_cuda == true) + { + if (hc_cuCtxPopCurrent (hashcat_ctx, &device_param->cuda_context) == -1) return -1; + } + + if (device_param->is_hip == true) + { + if (hc_hipCtxPopCurrent (hashcat_ctx, &device_param->hip_context) == -1) return -1; + } + return 0; } From 1ee222d43f3d923f2539f7f2931c1ae7761aee0a Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Sun, 1 Aug 2021 14:21:18 +0300 Subject: [PATCH 51/64] Replace free() with hcfree() --- src/backend.c | 6 +++--- src/hashes.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/backend.c b/src/backend.c index 0d7741593..d870602e0 100644 --- a/src/backend.c +++ b/src/backend.c @@ -5059,12 +5059,12 @@ int run_opencl_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *dev char *tmp = hcmalloc (len * sizeof (u8)); - memset(tmp, value, len); + memset (tmp, value, len); /* blocking */ rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, buf, CL_TRUE, offset, size, tmp, 0, NULL, NULL); - free(tmp); + hcfree (tmp); } else { @@ -5096,7 +5096,7 @@ int run_opencl_kernel_memset32 (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *d /* blocking */ rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, buf, CL_TRUE, offset * sizeof (u32), size * sizeof (u32), tmp, 0, NULL, NULL); - free(tmp); + hcfree (tmp); } else { diff --git a/src/hashes.c b/src/hashes.c index ef654e672..28f5396b7 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -331,7 +331,7 @@ int check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pla if (rc == -1) { - free(tmps); + hcfree (tmps); return -1; } @@ -348,7 +348,7 @@ int check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pla if (rc == -1) { - free(tmps); + hcfree (tmps); return -1; } @@ -365,7 +365,7 @@ int check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pla if (rc == -1) { - free(tmps); + hcfree (tmps); return -1; } From dbe2bad0989e94592d6ea6b8f01256aeefd642c2 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Sun, 1 Aug 2021 14:26:33 +0300 Subject: [PATCH 52/64] Maintain code style --- src/backend.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/backend.c b/src/backend.c index d870602e0..bc1064c34 100644 --- a/src/backend.c +++ b/src/backend.c @@ -5020,7 +5020,9 @@ int run_opencl_kernel_atinit (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *dev if (hc_clSetKernelArg (hashcat_ctx, kernel, 1, sizeof (cl_ulong), device_param->kernel_params_atinit[1]) == -1) return -1; - return hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL); + if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL) == -1) return -1; + + return 0; } int run_opencl_kernel_utf8toutf16le (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u64 num) @@ -5042,7 +5044,9 @@ int run_opencl_kernel_utf8toutf16le (hashcat_ctx_t *hashcat_ctx, hc_device_param if (hc_clSetKernelArg (hashcat_ctx, kernel, 1, sizeof (cl_ulong), device_param->kernel_params_utf8toutf16le[1]) == -1) return -1; - return hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL); + if (hc_clEnqueueNDRangeKernel (hashcat_ctx, device_param->opencl_command_queue, kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL) == -1) return -1; + + return 0; } int run_opencl_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u64 offset, const u8 value, const u64 size) From fdbfae9a287e694539e50a9eb4e7ce3ebcc43819 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Sun, 1 Aug 2021 14:47:08 +0300 Subject: [PATCH 53/64] Modify OpenCL clEnqueueFillBuffer() workaround --- src/backend.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/backend.c b/src/backend.c index bc1064c34..2b43c008b 100644 --- a/src/backend.c +++ b/src/backend.c @@ -5059,11 +5059,9 @@ int run_opencl_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *dev /* workaround if missing clEnqueueFillBuffer() */ if (ocl->clEnqueueFillBuffer == NULL) { - const u64 len = offset + size; + char *tmp = hcmalloc (size * sizeof (u8)); - char *tmp = hcmalloc (len * sizeof (u8)); - - memset (tmp, value, len); + memset (tmp, value, size); /* blocking */ rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, buf, CL_TRUE, offset, size, tmp, 0, NULL, NULL); @@ -5088,11 +5086,9 @@ int run_opencl_kernel_memset32 (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *d /* workaround if missing clEnqueueFillBuffer() */ if (ocl->clEnqueueFillBuffer == NULL) { - const u64 len = offset + size; - - u32 *tmp = (u32 *) hcmalloc (len * sizeof (u32)); + u32 *tmp = (u32 *) hcmalloc (size * sizeof (u32)); - for (u64 i = 0; i < len; i++) + for (u64 i = 0; i < size; i++) { tmp[i] = value; } From 62a06f735f7b7c10e7a50eea36e81bed06e4586f Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Sun, 1 Aug 2021 15:19:15 +0300 Subject: [PATCH 54/64] kernel_memset32(): assume offset and size are bytes, not elements --- src/backend.c | 30 +++++++++++++++++++++++++----- src/hashes.c | 2 +- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/backend.c b/src/backend.c index 2b43c008b..4801acf38 100644 --- a/src/backend.c +++ b/src/backend.c @@ -4898,7 +4898,13 @@ int run_cuda_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *devic int run_cuda_kernel_memset32 (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, CUdeviceptr buf, const u64 offset, const u32 value, const u64 size) { - return hc_cuMemsetD32Async (hashcat_ctx, buf + offset * sizeof (u32), value, size, device_param->cuda_stream); + /* check that the size is multiple of element size */ + if (size % 4 != 0) + { + return CUDA_ERROR_INVALID_VALUE; + } + + return hc_cuMemsetD32Async (hashcat_ctx, buf + offset, value, size / 4, device_param->cuda_stream); } int run_cuda_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, CUdeviceptr buf, const u64 size) @@ -4971,7 +4977,13 @@ int run_hip_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device int run_hip_kernel_memset32 (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, hipDeviceptr_t buf, const u64 offset, const u32 value, const u64 size) { - return hc_hipMemsetD32Async (hashcat_ctx, buf + offset * sizeof (u32), value, size, device_param->hip_stream); + /* check that the size is multiple of element size */ + if (size % 4 != 0) + { + return hipErrorInvalidValue; + } + + return hc_hipMemsetD32Async (hashcat_ctx, buf + offset, value, size / 4, device_param->hip_stream); } int run_hip_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, hipDeviceptr_t buf, const u64 size) @@ -5086,15 +5098,23 @@ int run_opencl_kernel_memset32 (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *d /* workaround if missing clEnqueueFillBuffer() */ if (ocl->clEnqueueFillBuffer == NULL) { - u32 *tmp = (u32 *) hcmalloc (size * sizeof (u32)); + const u64 N = size / 4; - for (u64 i = 0; i < size; i++) + /* check that the size is multiple of element size */ + if (size % 4 != 0) + { + return CL_INVALID_VALUE; + } + + u32 *tmp = (u32 *) hcmalloc (size); + + for (u64 i = 0; i < N; i++) { tmp[i] = value; } /* blocking */ - rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, buf, CL_TRUE, offset * sizeof (u32), size * sizeof (u32), tmp, 0, NULL, NULL); + rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, buf, CL_TRUE, offset, size, tmp, 0, NULL, NULL); hcfree (tmp); } diff --git a/src/hashes.c b/src/hashes.c index 28f5396b7..80fa6cede 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -704,7 +704,7 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) if (device_param->is_opencl == true) { /* NOTE: run_opencl_kernel_bzero() does not handle buffer offset */ - rc = run_opencl_kernel_memset32 (hashcat_ctx, device_param, device_param->opencl_d_digests_shown, salt_buf->digests_offset, 0, salt_buf->digests_cnt); + rc = run_opencl_kernel_memset32 (hashcat_ctx, device_param, device_param->opencl_d_digests_shown, salt_buf->digests_offset * sizeof (u32), 0, salt_buf->digests_cnt * sizeof (u32)); if (rc == -1) { From 20a7b9f9921fa297659c3d4f874ae270b49e299f Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Sun, 1 Aug 2021 16:25:37 +0200 Subject: [PATCH 55/64] Tuning-Database: Add new module function module_extra_tuningdb_block() to extend hashcat.hctune content from a plugin See src/modules/module_08900.c as an example --- hashcat.hctune | 180 +----------------- include/interface.h | 2 +- include/modules.h | 1 + include/tuningdb.h | 4 + include/types.h | 3 + src/Makefile | 9 +- src/backend.c | 42 +++++ src/interface.c | 1 + src/modules/module_00000.c | 1 + src/modules/module_00010.c | 1 + src/modules/module_00011.c | 1 + src/modules/module_00012.c | 1 + src/modules/module_00020.c | 1 + src/modules/module_00021.c | 1 + src/modules/module_00022.c | 1 + src/modules/module_00023.c | 1 + src/modules/module_00024.c | 1 + src/modules/module_00030.c | 1 + src/modules/module_00040.c | 1 + src/modules/module_00050.c | 1 + src/modules/module_00060.c | 1 + src/modules/module_00070.c | 1 + src/modules/module_00100.c | 1 + src/modules/module_00101.c | 1 + src/modules/module_00110.c | 1 + src/modules/module_00111.c | 1 + src/modules/module_00112.c | 1 + src/modules/module_00120.c | 1 + src/modules/module_00121.c | 1 + src/modules/module_00122.c | 1 + src/modules/module_00124.c | 1 + src/modules/module_00125.c | 1 + src/modules/module_00130.c | 1 + src/modules/module_00131.c | 1 + src/modules/module_00132.c | 1 + src/modules/module_00133.c | 1 + src/modules/module_00140.c | 1 + src/modules/module_00141.c | 1 + src/modules/module_00150.c | 1 + src/modules/module_00160.c | 1 + src/modules/module_00170.c | 1 + src/modules/module_00200.c | 1 + src/modules/module_00300.c | 1 + src/modules/module_00400.c | 1 + src/modules/module_00500.c | 1 + src/modules/module_00501.c | 1 + src/modules/module_00600.c | 1 + src/modules/module_00900.c | 1 + src/modules/module_01000.c | 1 + src/modules/module_01100.c | 1 + src/modules/module_01300.c | 1 + src/modules/module_01400.c | 1 + src/modules/module_01410.c | 1 + src/modules/module_01411.c | 1 + src/modules/module_01420.c | 1 + src/modules/module_01421.c | 1 + src/modules/module_01430.c | 1 + src/modules/module_01440.c | 1 + src/modules/module_01441.c | 1 + src/modules/module_01450.c | 1 + src/modules/module_01460.c | 1 + src/modules/module_01470.c | 1 + src/modules/module_01500.c | 1 + src/modules/module_01600.c | 1 + src/modules/module_01700.c | 1 + src/modules/module_01710.c | 1 + src/modules/module_01711.c | 1 + src/modules/module_01720.c | 1 + src/modules/module_01722.c | 1 + src/modules/module_01730.c | 1 + src/modules/module_01731.c | 1 + src/modules/module_01740.c | 1 + src/modules/module_01750.c | 1 + src/modules/module_01760.c | 1 + src/modules/module_01770.c | 1 + src/modules/module_01800.c | 1 + src/modules/module_02000.c | 1 + src/modules/module_02100.c | 1 + src/modules/module_02400.c | 1 + src/modules/module_02410.c | 1 + src/modules/module_02500.c | 1 + src/modules/module_02501.c | 1 + src/modules/module_02600.c | 1 + src/modules/module_02611.c | 1 + src/modules/module_02612.c | 1 + src/modules/module_02711.c | 1 + src/modules/module_02811.c | 1 + src/modules/module_03000.c | 1 + src/modules/module_03100.c | 1 + src/modules/module_03200.c | 1 + src/modules/module_03500.c | 1 + src/modules/module_03710.c | 1 + src/modules/module_03711.c | 1 + src/modules/module_03800.c | 1 + src/modules/module_03910.c | 1 + src/modules/module_04010.c | 1 + src/modules/module_04110.c | 1 + src/modules/module_04300.c | 1 + src/modules/module_04400.c | 1 + src/modules/module_04500.c | 1 + src/modules/module_04510.c | 1 + src/modules/module_04520.c | 1 + src/modules/module_04521.c | 1 + src/modules/module_04522.c | 1 + src/modules/module_04700.c | 1 + src/modules/module_04710.c | 1 + src/modules/module_04711.c | 1 + src/modules/module_04800.c | 1 + src/modules/module_04900.c | 1 + src/modules/module_05000.c | 1 + src/modules/module_05100.c | 1 + src/modules/module_05200.c | 1 + src/modules/module_05300.c | 1 + src/modules/module_05400.c | 1 + src/modules/module_05500.c | 1 + src/modules/module_05600.c | 1 + src/modules/module_05700.c | 1 + src/modules/module_05800.c | 1 + src/modules/module_06000.c | 1 + src/modules/module_06100.c | 1 + src/modules/module_06211.c | 1 + src/modules/module_06212.c | 1 + src/modules/module_06213.c | 1 + src/modules/module_06221.c | 1 + src/modules/module_06222.c | 1 + src/modules/module_06223.c | 1 + src/modules/module_06231.c | 1 + src/modules/module_06232.c | 1 + src/modules/module_06233.c | 1 + src/modules/module_06241.c | 1 + src/modules/module_06242.c | 1 + src/modules/module_06243.c | 1 + src/modules/module_06300.c | 1 + src/modules/module_06400.c | 1 + src/modules/module_06500.c | 1 + src/modules/module_06600.c | 1 + src/modules/module_06700.c | 1 + src/modules/module_06800.c | 1 + src/modules/module_06900.c | 1 + src/modules/module_07000.c | 1 + src/modules/module_07100.c | 1 + src/modules/module_07200.c | 1 + src/modules/module_07300.c | 1 + src/modules/module_07400.c | 1 + src/modules/module_07401.c | 1 + src/modules/module_07500.c | 1 + src/modules/module_07700.c | 1 + src/modules/module_07701.c | 1 + src/modules/module_07800.c | 1 + src/modules/module_07801.c | 1 + src/modules/module_07900.c | 1 + src/modules/module_08000.c | 1 + src/modules/module_08100.c | 1 + src/modules/module_08200.c | 1 + src/modules/module_08300.c | 1 + src/modules/module_08400.c | 1 + src/modules/module_08500.c | 1 + src/modules/module_08600.c | 1 + src/modules/module_08700.c | 1 + src/modules/module_08800.c | 1 + src/modules/module_08900.c | 42 +++++ src/modules/module_09000.c | 1 + src/modules/module_09100.c | 1 + src/modules/module_09200.c | 1 + src/modules/module_09300.c | 42 +++++ src/modules/module_09400.c | 1 + src/modules/module_09500.c | 1 + src/modules/module_09600.c | 1 + src/modules/module_09700.c | 1 + src/modules/module_09710.c | 1 + src/modules/module_09720.c | 1 + src/modules/module_09800.c | 1 + src/modules/module_09810.c | 1 + src/modules/module_09820.c | 1 + src/modules/module_09900.c | 1 + src/modules/module_10000.c | 1 + src/modules/module_10100.c | 1 + src/modules/module_10200.c | 1 + src/modules/module_10300.c | 1 + src/modules/module_10400.c | 1 + src/modules/module_10410.c | 1 + src/modules/module_10420.c | 1 + src/modules/module_10500.c | 1 + src/modules/module_10600.c | 1 + src/modules/module_10700.c | 1 + src/modules/module_10800.c | 1 + src/modules/module_10810.c | 1 + src/modules/module_10820.c | 1 + src/modules/module_10830.c | 1 + src/modules/module_10840.c | 1 + src/modules/module_10870.c | 1 + src/modules/module_10900.c | 1 + src/modules/module_10901.c | 1 + src/modules/module_11000.c | 1 + src/modules/module_11100.c | 1 + src/modules/module_11200.c | 1 + src/modules/module_11300.c | 1 + src/modules/module_11400.c | 1 + src/modules/module_11500.c | 1 + src/modules/module_11600.c | 1 + src/modules/module_11700.c | 1 + src/modules/module_11750.c | 1 + src/modules/module_11760.c | 1 + src/modules/module_11800.c | 1 + src/modules/module_11850.c | 1 + src/modules/module_11860.c | 1 + src/modules/module_11900.c | 1 + src/modules/module_12000.c | 1 + src/modules/module_12001.c | 1 + src/modules/module_12100.c | 1 + src/modules/module_12200.c | 1 + src/modules/module_12300.c | 1 + src/modules/module_12400.c | 1 + src/modules/module_12500.c | 1 + src/modules/module_12600.c | 1 + src/modules/module_12700.c | 1 + src/modules/module_12800.c | 1 + src/modules/module_12900.c | 1 + src/modules/module_13000.c | 1 + src/modules/module_13100.c | 1 + src/modules/module_13200.c | 1 + src/modules/module_13300.c | 1 + src/modules/module_13400.c | 1 + src/modules/module_13500.c | 1 + src/modules/module_13600.c | 1 + src/modules/module_13711.c | 1 + src/modules/module_13712.c | 1 + src/modules/module_13713.c | 1 + src/modules/module_13721.c | 1 + src/modules/module_13722.c | 1 + src/modules/module_13723.c | 1 + src/modules/module_13731.c | 1 + src/modules/module_13732.c | 1 + src/modules/module_13733.c | 1 + src/modules/module_13741.c | 1 + src/modules/module_13742.c | 1 + src/modules/module_13743.c | 1 + src/modules/module_13751.c | 1 + src/modules/module_13752.c | 1 + src/modules/module_13753.c | 1 + src/modules/module_13761.c | 1 + src/modules/module_13762.c | 1 + src/modules/module_13763.c | 1 + src/modules/module_13771.c | 1 + src/modules/module_13772.c | 1 + src/modules/module_13773.c | 1 + src/modules/module_13781.c | 1 + src/modules/module_13782.c | 1 + src/modules/module_13783.c | 1 + src/modules/module_13800.c | 1 + src/modules/module_13900.c | 1 + src/modules/module_14000.c | 1 + src/modules/module_14100.c | 1 + src/modules/module_14400.c | 1 + src/modules/module_14500.c | 1 + src/modules/module_14600.c | 1 + src/modules/module_14700.c | 1 + src/modules/module_14800.c | 1 + src/modules/module_14900.c | 1 + src/modules/module_15000.c | 1 + src/modules/module_15100.c | 1 + src/modules/module_15200.c | 1 + src/modules/module_15300.c | 1 + src/modules/module_15400.c | 1 + src/modules/module_15500.c | 1 + src/modules/module_15600.c | 1 + src/modules/module_15700.c | 42 +++++ src/modules/module_15900.c | 1 + src/modules/module_16000.c | 1 + src/modules/module_16100.c | 1 + src/modules/module_16200.c | 1 + src/modules/module_16300.c | 1 + src/modules/module_16400.c | 1 + src/modules/module_16500.c | 1 + src/modules/module_16600.c | 1 + src/modules/module_16700.c | 1 + src/modules/module_16800.c | 1 + src/modules/module_16801.c | 1 + src/modules/module_16900.c | 1 + src/modules/module_17200.c | 1 + src/modules/module_17210.c | 1 + src/modules/module_17220.c | 1 + src/modules/module_17225.c | 1 + src/modules/module_17230.c | 1 + src/modules/module_17300.c | 1 + src/modules/module_17400.c | 1 + src/modules/module_17500.c | 1 + src/modules/module_17600.c | 1 + src/modules/module_17700.c | 1 + src/modules/module_17800.c | 1 + src/modules/module_17900.c | 1 + src/modules/module_18000.c | 1 + src/modules/module_18100.c | 1 + src/modules/module_18200.c | 1 + src/modules/module_18300.c | 1 + src/modules/module_18400.c | 1 + src/modules/module_18500.c | 1 + src/modules/module_18600.c | 1 + src/modules/module_18700.c | 1 + src/modules/module_18800.c | 1 + src/modules/module_18900.c | 1 + src/modules/module_19000.c | 1 + src/modules/module_19100.c | 1 + src/modules/module_19200.c | 1 + src/modules/module_19300.c | 1 + src/modules/module_19500.c | 1 + src/modules/module_19600.c | 1 + src/modules/module_19700.c | 1 + src/modules/module_19800.c | 1 + src/modules/module_19900.c | 1 + src/modules/module_20011.c | 1 + src/modules/module_20012.c | 1 + src/modules/module_20013.c | 1 + src/modules/module_20200.c | 1 + src/modules/module_20300.c | 1 + src/modules/module_20400.c | 1 + src/modules/module_20500.c | 1 + src/modules/module_20510.c | 1 + src/modules/module_20600.c | 1 + src/modules/module_20710.c | 1 + src/modules/module_20711.c | 1 + src/modules/module_20720.c | 1 + src/modules/module_20800.c | 1 + src/modules/module_20900.c | 1 + src/modules/module_21000.c | 1 + src/modules/module_21100.c | 1 + src/modules/module_21200.c | 1 + src/modules/module_21300.c | 1 + src/modules/module_21400.c | 1 + src/modules/module_21500.c | 1 + src/modules/module_21501.c | 1 + src/modules/module_21600.c | 1 + src/modules/module_21700.c | 1 + src/modules/module_21800.c | 1 + src/modules/module_22000.c | 1 + src/modules/module_22001.c | 1 + src/modules/module_22100.c | 1 + src/modules/module_22200.c | 1 + src/modules/module_22300.c | 1 + src/modules/module_22301.c | 1 + src/modules/module_22400.c | 1 + src/modules/module_22500.c | 1 + src/modules/module_22600.c | 1 + src/modules/module_22700.c | 42 +++++ src/modules/module_22911.c | 1 + src/modules/module_22921.c | 1 + src/modules/module_22931.c | 1 + src/modules/module_22941.c | 1 + src/modules/module_22951.c | 1 + src/modules/module_23001.c | 1 + src/modules/module_23002.c | 1 + src/modules/module_23003.c | 1 + src/modules/module_23100.c | 1 + src/modules/module_23200.c | 1 + src/modules/module_23300.c | 1 + src/modules/module_23400.c | 1 + src/modules/module_23500.c | 1 + src/modules/module_23600.c | 1 + src/modules/module_23700.c | 1 + src/modules/module_23800.c | 1 + src/modules/module_23900.c | 1 + src/modules/module_24100.c | 1 + src/modules/module_24200.c | 1 + src/modules/module_24300.c | 1 + src/modules/module_24410.c | 1 + src/modules/module_24420.c | 1 + src/modules/module_24500.c | 1 + src/modules/module_24600.c | 1 + src/modules/module_24700.c | 1 + src/modules/module_24800.c | 1 + src/modules/module_24900.c | 1 + src/modules/module_25000.c | 1 + src/modules/module_25100.c | 1 + src/modules/module_25200.c | 1 + src/modules/module_25300.c | 1 + src/modules/module_25400.c | 1 + src/modules/module_25500.c | 1 + src/modules/module_25600.c | 1 + src/modules/module_25700.c | 1 + src/modules/module_25800.c | 1 + src/modules/module_25900.c | 1 + src/modules/module_26000.c | 1 + src/modules/module_26100.c | 1 + src/modules/module_26200.c | 1 + src/modules/module_26300.c | 1 + src/modules/module_26401.c | 1 + src/modules/module_26402.c | 1 + src/modules/module_26403.c | 1 + src/modules/module_26500.c | 1 + src/modules/module_26600.c | 1 + src/modules/module_26700.c | 1 + src/modules/module_26800.c | 1 + src/modules/module_99999.c | 1 + src/tuningdb.c | 376 ++++++++++++++++++++----------------- 394 files changed, 814 insertions(+), 353 deletions(-) diff --git a/hashcat.hctune b/hashcat.hctune index 2b99ee149..5b991c35b 100644 --- a/hashcat.hctune +++ b/hashcat.hctune @@ -386,189 +386,13 @@ GeForce_GTX_TITAN 3 9900 2 A DEVICE_TYPE_CPU * 3200 1 N A ## -## SCRYPT +## SCRYPT: Tunings for SCRYPT based hash-modes can be found inside the plugin source +## See function module_extra_tuningdb_block() ## -DEVICE_TYPE_CPU * 8900 1 N A -DEVICE_TYPE_CPU * 9300 1 N A -DEVICE_TYPE_CPU * 15700 1 N A -DEVICE_TYPE_CPU * 22700 1 N A - -DEVICE_TYPE_GPU * 8900 1 N A -DEVICE_TYPE_GPU * 9300 1 N A -DEVICE_TYPE_GPU * 15700 1 1 A -DEVICE_TYPE_GPU * 22700 1 N A - ## ## CryptoAPI ## DEVICE_TYPE_CPU * 14500 1 A A DEVICE_TYPE_GPU * 14500 1 A A - -## Here's an example of how to manually tune SCRYPT algorithm kernels for your hardware. -## Manually tuning the GPU will yield increased performance. There is typically no noticeable change to CPU performance. -## -## First, you need to know the parameters of your SCRYPT hash: N, r and p. -## -## The reference SCRYPT parameter values are N=14, r=8 and p=1, but these will likely not match the parameters used by real-world applications. -## For reference, the N value represents an exponent (2^N, which we calculate by bit shifting 1 left by N bits). -## Hashcat expects this N value in decimal format: 1 << 14 = 16384 -## -## Now that you have the 3 configuration items in decimal format, multiply them by 128 (underlaying crypto primitive block size). -## For example: 128 * 16384 * 8 * 1 = 16777216 = 16MB -## This is the amount of memory required for the GPU to compute the hash of one password candidate. -## -## Hashcat computes multiple password candidates in parallel - this is what allows for full utilization of the device. -## The number of password candidates that Hashcat can run in parallel is VRAM limited and depends on: -## -## 1. Compute devices' native compute units -## 2. Compute devices' native thread count -## 3. Artificial multiplier (--kernel-accel aka -n) -## -## In order to find these values: -## -## 1. On startup Hashcat will show: * Device #1: GeForce GTX 980, 3963/4043 MB, 16MCU. The 16 MCU is the number of compute units on that device. -## 2. Native thread counts are fixed values: CPU=1, GPU-Intel=8, GPU-AMD=64 (wavefronts), GPU-NVIDIA=32 (warps) -## -## Now multiply them together. For my GTX980: 16 * 32 * 16777216 = 8589934592 = 8GB -## -## If we want to actually make use of all computing resources, this GPU would require 8GB of GPU RAM. -## However, it doesn't have that: -## -## Device #1: GeForce GTX 980, 3963/4043 MB, 16MCU. We only have 4043 MB (4GB minus some overhead from the OS). -## -## How do we deal with this? This is where SCRYPT TMTO(time-memory trde off) kicks in. The SCRYPT algorithm is designed in such a way that we -## can pre-compute that 16MB buffer from a self-choosen offset. Details on how this actually works are not important for this process. -## -## What's relevant to us is that we can halve the buffer size, but we pay with twice the computation time. -## We can repeat this as often as we want. That's why it's a trade-off. -## -## This mechanic can be manually set using --scrypt-tmto on the commandline, but this is not the best way. -## -## Back to our problem. We need 8GB of memory but have only ~4GB. -## It's not a full 4GB. The OS needs some of it and Hashcat needs some of it to store password candidates and other things. -## If you run a headless server it should be safe to subtract a fixed value of 200MB from whatever you have in your GPU. -## -## So lets divide our required memory(8GB) by 2 until it fits in our VRAM - 200MB. -## -## (8GB >> 0) = 8GB < 3.8GB = No, Does not fit -## (8GB >> 1) = 4GB < 3.8GB = No, Does not fit -## (8GB >> 2) = 2GB < 3.8GB = Yes! -## -## This process is automated in Hashcat, but it is important to understand what's happening here. -## Because of the light overhead from the OS and Hashcat, we pay a very high price. -## Even though it is just 200MB, it forces us to increase the TMTO by another step. -## In terms of speed, the speed is now only 1/4 of what we could archieve on that same GPU if it had only 8.2GB ram. -## But now we end up in a situation that we waste 1.8GB RAM which costs us ((1.8GB/16MB)>>1) candidates/second. -## -## This is where manual tuning can come into play. -## If we know that the resources we need are close to what we have (in this case 3.8GB <-> 4.0GB) -## We could decide to throw away some of our compute units so that we will no longer need 4.0GB but only 3.8GB. -## Therefore, we do not need to increase the TMTO by another step to fit in VRAM. -## -## If we cut down our 16 MCU to only 15 MCU or 14 MCU using --kernel-accel(-n), we end up with: -## -## 16 * 32 * 16777216 = 8589934592 / 2 = 4294967296 = 4.00GB < 3.80GB = Nope, next -## 15 * 32 * 16777216 = 8053063680 / 2 = 4026531840 = 3.84GB < 3.80GB = Nope, next -## 14 * 32 * 16777216 = 7516192768 / 2 = 3758096384 = 3.58GB < 3.80GB = Yes! -## -## So we can throw away 2/16 compute units, but save half of the computation trade-off on the rest of the compute device. -## On my GTX980, this improves the performance from 163 H/s to 201 H/s. -## You don't need to control --scrypt-tmto manually because now that the multiplier (-n) is smaller than the native value -## Hashcat will automatically realize it can decrease the TMTO by one. -## -## At this point, you found the optimal base value for your compute device. In this case: 14. -## -## Depending on our hardware, especially hardware with very slow memory access like a GPU -## there's a good chance that it's cheaper (faster) to compute an extra step on the GPU register. -## So if we increase the TMTO again by one, this gives an extra speed boost. -## -## On my GTX980, this improves the performance from 201 H/s to 255 H/s. -## Again, there's no need to control this with --scrypt-tmto. Hashcat will realize it has to increase the TMTO again. -## -## All together, you can control all of this by using the -n parameter in the command line. -## This is not ideal in a production environment because you must use the --force flag. -## The best way to set this is by using this Hashcat.hctune file to store it. This avoids the need to bypass any warnings. -## -## Find the ideal -n value, then store it here along with the proper compute device name. -## Formatting guidelines are availabe at the top of this document. -## -## ------------------------------------------------- -## -## You can also ignore all theoretical derivations and semi-automate the process in the real scenario (I prefer this approach): -## -## 1. For example, to find the value for 8900, first create a valid hash for 8900 as follows: -## -## $ ./hashcat --example-hashes -m 8900 | grep Example.Hash | grep -v Format | cut -b 25- > tmp.hash.8900 -## -## 2. Now let it iterate through all -n values to a certain point. In this case, I'm using 200, but in general it's a value that is at least twice that of the multiprocessor. If you don't mind you can just leave it as it is, it just runs a little longer. -## -## $ export i=1; while [ $i -ne 201 ]; do echo $i; ./hashcat --quiet tmp.hash.8900 --keep-guessing --self-test-disable --markov-disable --restore-disable --outfile-autohex-disable --wordlist-autohex-disable --potfile-disable --logfile-disable --hwmon-disable --status --status-timer 1 --runtime 28 --machine-readable --optimized-kernel-enable --workload-profile 3 --hash-type 8900 --attack-mode 3 ?b?b?b?b?b?b?b --backend-devices 1 --force -n $i; i=$(($i+1)); done | tee x -## -## 3. Determine the highest measured H/s speed. But don't just use the highest value. Instead, use the number that seems most stable, usually at the beginning. -## -## $ grep "$(printf 'STATUS\t3')" x | cut -f4 -d$'\t' | sort -n | tail -## -## 4. To match the speed you have chosen to the correct value in the "x" file, simply search for it in it. Then go up a little on the block where you found him. The value -n is the single value that begins before the block start. If you have multiple blocks at the same speed, choose the lowest value for -n -## - -## 4GB -GeForce_GTX_980 * 8900 1 29 A -GeForce_GTX_980 * 9300 1 128 A -GeForce_GTX_980 * 15700 1 24 A -GeForce_GTX_980 * 22700 1 29 A - -## 8GB -GeForce_GTX_1080 * 8900 1 15 A -GeForce_GTX_1080 * 9300 1 256 A -GeForce_GTX_1080 * 15700 1 28 A -GeForce_GTX_1080 * 22700 1 15 A - -## 11GB -GeForce_RTX_2080_Ti * 8900 1 68 A -GeForce_RTX_2080_Ti * 9300 1 528 A -GeForce_RTX_2080_Ti * 15700 1 68 A -GeForce_RTX_2080_Ti * 22700 1 68 A - -## 8GB -GeForce_RTX_3060_Ti * 8900 1 51 A -GeForce_RTX_3060_Ti * 9300 1 256 A -GeForce_RTX_3060_Ti * 15700 1 11 A -GeForce_RTX_3060_Ti * 22700 1 51 A - -## 8GB -GeForce_RTX_3070 * 8900 1 46 A -GeForce_RTX_3070 * 9300 1 368 A -GeForce_RTX_3070 * 15700 1 22 A -GeForce_RTX_3070 * 22700 1 46 A - -## 24GB -GeForce_RTX_3090 * 8900 1 82 A -GeForce_RTX_3090 * 9300 1 984 A -GeForce_RTX_3090 * 15700 1 82 A -GeForce_RTX_3090 * 22700 1 82 A - -## 4GB -ALIAS_AMD_RX480 * 8900 1 15 A -ALIAS_AMD_RX480 * 9300 1 232 A -ALIAS_AMD_RX480 * 15700 1 58 A -ALIAS_AMD_RX480 * 22700 1 15 A - -## 8GB -ALIAS_AMD_Vega64 * 8900 1 31 A -ALIAS_AMD_Vega64 * 9300 1 440 A -ALIAS_AMD_Vega64 * 15700 1 53 A -ALIAS_AMD_Vega64 * 22700 1 31 A - -## 32GB -ALIAS_AMD_MI100 * 8900 1 79 A -ALIAS_AMD_MI100 * 9300 1 1000 A -ALIAS_AMD_MI100 * 15700 1 120 A -ALIAS_AMD_MI100 * 22700 1 79 A - -## 16GB -ALIAS_AMD_RX6900XT * 8900 1 59 A -ALIAS_AMD_RX6900XT * 9300 1 720 A -ALIAS_AMD_RX6900XT * 15700 1 56 A -ALIAS_AMD_RX6900XT * 22700 1 59 A diff --git a/include/interface.h b/include/interface.h index 2035b6063..4e3485ced 100644 --- a/include/interface.h +++ b/include/interface.h @@ -13,7 +13,7 @@ #include #include -static const int MODULE_INTERFACE_VERSION_MINIMUM = 520; +static const int MODULE_INTERFACE_VERSION_MINIMUM = 630; static const int MODULE_HASH_MODES_MAXIMUM = 100000; diff --git a/include/modules.h b/include/modules.h index 7f24c3c48..17ad584a6 100644 --- a/include/modules.h +++ b/include/modules.h @@ -18,6 +18,7 @@ u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *ha u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); +const char *module_extra_tuningdb_block (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); u32 module_forced_outfile_format (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); diff --git a/include/tuningdb.h b/include/tuningdb.h index 60fb60e68..1f306a3f4 100644 --- a/include/tuningdb.h +++ b/include/tuningdb.h @@ -11,9 +11,13 @@ #define TUNING_DB_FILE "hashcat.hctune" +int sort_by_tuning_db_alias (const void *v1, const void *v2); +int sort_by_tuning_db_entry (const void *v1, const void *v2); + int tuning_db_init (hashcat_ctx_t *hashcat_ctx); void tuning_db_destroy (hashcat_ctx_t *hashcat_ctx); +bool tuning_db_process_line (hashcat_ctx_t *hashcat_ctx, const char *line_buf, const int line_num); tuning_db_entry_t *tuning_db_search (hashcat_ctx_t *hashcat_ctx, const char *device_name, const cl_device_type device_type, int attack_mode, const int hash_mode); #endif // _TUNINGDB_H diff --git a/include/types.h b/include/types.h index 98766dfe5..f415698c7 100644 --- a/include/types.h +++ b/include/types.h @@ -2043,9 +2043,11 @@ typedef struct tuning_db tuning_db_alias_t *alias_buf; int alias_cnt; + int alias_alloc; tuning_db_entry_t *entry_buf; int entry_cnt; + int entry_alloc; } tuning_db_t; @@ -2649,6 +2651,7 @@ typedef struct module_ctx u32 (*module_dgst_pos3) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); u32 (*module_dgst_size) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); u64 (*module_esalt_size) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); + const char *(*module_extra_tuningdb_block) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); u32 (*module_forced_outfile_format) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); u32 (*module_hash_category) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); const char *(*module_hash_name) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *); diff --git a/src/Makefile b/src/Makefile index e1ff6a534..066c898af 100644 --- a/src/Makefile +++ b/src/Makefile @@ -53,7 +53,7 @@ endif ## Do not modify ## -MODULE_INTERFACE_VERSION := 620 +MODULE_INTERFACE_VERSION := 630 ## ## Native compiler paths @@ -203,12 +203,11 @@ endif ## because UNRAR ifeq ($(ENABLE_UNRAR),1) ifeq ($(USE_SYSTEM_UNRAR),0) -ifneq ($(UNAME),Darwin) -CFLAGS_UNRAR += -Wno-misleading-indentation +ifneq ($(CC),clang) CFLAGS_UNRAR += -Wno-class-memaccess -else -CFLAGS_UNRAR += -Wno-missing-braces +CFLAGS_UNRAR += -Wno-misleading-indentation endif +CFLAGS_UNRAR += -Wno-missing-braces CFLAGS_UNRAR += -Wno-unused-variable CFLAGS_UNRAR += -Wno-unused-parameter CFLAGS_UNRAR += -Wno-unused-function diff --git a/src/backend.c b/src/backend.c index e95793c4f..9ff1c8bb9 100644 --- a/src/backend.c +++ b/src/backend.c @@ -10775,6 +10775,48 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) } } + /** + * tuning db + */ + + if (module_ctx->module_extra_tuningdb_block != MODULE_DEFAULT) + { + const char *extra_tuningdb_block = module_ctx->module_extra_tuningdb_block (hashconfig, user_options, user_options_extra); + + char *lines_buf = hcstrdup (extra_tuningdb_block); + + char *saveptr = NULL; + + char *next = strtok_r (lines_buf, "\n", &saveptr); + + int line_num = 0; + + do + { + line_num++; + + const size_t line_len = strlen (next); + + if (line_len == 0) continue; + + if (next[0] == '#') continue; + + tuning_db_process_line (hashcat_ctx, next, line_num); + + } while ((next = strtok_r ((char *) NULL, "\n", &saveptr)) != NULL); + + hcfree (lines_buf); + + // todo: print loaded 'cnt' message + + // sort the database + + tuning_db_t *tuning_db = hashcat_ctx->tuning_db; + + qsort (tuning_db->alias_buf, tuning_db->alias_cnt, sizeof (tuning_db_alias_t), sort_by_tuning_db_alias); + qsort (tuning_db->entry_buf, tuning_db->entry_cnt, sizeof (tuning_db_entry_t), sort_by_tuning_db_entry); + } + // vector_width int vector_width = 0; diff --git a/src/interface.c b/src/interface.c index 6952cdb8c..68cf97bff 100644 --- a/src/interface.c +++ b/src/interface.c @@ -150,6 +150,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) CHECK_DEFINED (module_ctx->module_esalt_size); CHECK_DEFINED (module_ctx->module_extra_buffer_size); CHECK_DEFINED (module_ctx->module_extra_tmp_size); + CHECK_DEFINED (module_ctx->module_extra_tuningdb_block); CHECK_DEFINED (module_ctx->module_forced_outfile_format); CHECK_DEFINED (module_ctx->module_hash_binary_count); CHECK_DEFINED (module_ctx->module_hash_binary_parse); diff --git a/src/modules/module_00000.c b/src/modules/module_00000.c index 136aba0a4..7fb04e0ac 100644 --- a/src/modules/module_00000.c +++ b/src/modules/module_00000.c @@ -138,6 +138,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00010.c b/src/modules/module_00010.c index f5c31ad00..8824a94aa 100644 --- a/src/modules/module_00010.c +++ b/src/modules/module_00010.c @@ -161,6 +161,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00011.c b/src/modules/module_00011.c index fcff6b47c..c66944c09 100644 --- a/src/modules/module_00011.c +++ b/src/modules/module_00011.c @@ -164,6 +164,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00012.c b/src/modules/module_00012.c index 9c6e90829..3aa9a3869 100644 --- a/src/modules/module_00012.c +++ b/src/modules/module_00012.c @@ -156,6 +156,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00020.c b/src/modules/module_00020.c index e3ee404dd..2cd45822a 100644 --- a/src/modules/module_00020.c +++ b/src/modules/module_00020.c @@ -160,6 +160,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00021.c b/src/modules/module_00021.c index ce4686961..4370fc7c9 100644 --- a/src/modules/module_00021.c +++ b/src/modules/module_00021.c @@ -155,6 +155,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00022.c b/src/modules/module_00022.c index 42a50dbd0..25a82d9af 100644 --- a/src/modules/module_00022.c +++ b/src/modules/module_00022.c @@ -268,6 +268,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00023.c b/src/modules/module_00023.c index 71b06a618..922a5a8a4 100644 --- a/src/modules/module_00023.c +++ b/src/modules/module_00023.c @@ -170,6 +170,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00024.c b/src/modules/module_00024.c index 5248b46de..a7fc23c61 100644 --- a/src/modules/module_00024.c +++ b/src/modules/module_00024.c @@ -154,6 +154,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00030.c b/src/modules/module_00030.c index 28d42da03..5ca3107ef 100644 --- a/src/modules/module_00030.c +++ b/src/modules/module_00030.c @@ -162,6 +162,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00040.c b/src/modules/module_00040.c index 9ee815472..57c21f170 100644 --- a/src/modules/module_00040.c +++ b/src/modules/module_00040.c @@ -161,6 +161,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00050.c b/src/modules/module_00050.c index 8eaa36679..19b9ca456 100644 --- a/src/modules/module_00050.c +++ b/src/modules/module_00050.c @@ -140,6 +140,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00060.c b/src/modules/module_00060.c index 5bcaecfbf..171bd9951 100644 --- a/src/modules/module_00060.c +++ b/src/modules/module_00060.c @@ -140,6 +140,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00070.c b/src/modules/module_00070.c index c7df389de..fd43385a5 100644 --- a/src/modules/module_00070.c +++ b/src/modules/module_00070.c @@ -136,6 +136,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00100.c b/src/modules/module_00100.c index b23531e46..986004151 100644 --- a/src/modules/module_00100.c +++ b/src/modules/module_00100.c @@ -154,6 +154,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00101.c b/src/modules/module_00101.c index e58114f4b..25826c735 100644 --- a/src/modules/module_00101.c +++ b/src/modules/module_00101.c @@ -158,6 +158,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00110.c b/src/modules/module_00110.c index 8299e5900..b0f834620 100644 --- a/src/modules/module_00110.c +++ b/src/modules/module_00110.c @@ -180,6 +180,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00111.c b/src/modules/module_00111.c index 07335b5b8..312da55fe 100644 --- a/src/modules/module_00111.c +++ b/src/modules/module_00111.c @@ -184,6 +184,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00112.c b/src/modules/module_00112.c index d059d621d..96d4c7483 100644 --- a/src/modules/module_00112.c +++ b/src/modules/module_00112.c @@ -181,6 +181,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00120.c b/src/modules/module_00120.c index 6e347a2a9..25180acc6 100644 --- a/src/modules/module_00120.c +++ b/src/modules/module_00120.c @@ -180,6 +180,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00121.c b/src/modules/module_00121.c index dab88f693..469da8149 100644 --- a/src/modules/module_00121.c +++ b/src/modules/module_00121.c @@ -181,6 +181,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00122.c b/src/modules/module_00122.c index d5e46c318..0d0c87e16 100644 --- a/src/modules/module_00122.c +++ b/src/modules/module_00122.c @@ -160,6 +160,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00124.c b/src/modules/module_00124.c index 17cd6ef8f..a9604df79 100644 --- a/src/modules/module_00124.c +++ b/src/modules/module_00124.c @@ -179,6 +179,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00125.c b/src/modules/module_00125.c index 29545c2a5..3a22f2262 100644 --- a/src/modules/module_00125.c +++ b/src/modules/module_00125.c @@ -162,6 +162,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00130.c b/src/modules/module_00130.c index 3ba62c5db..03a4569dd 100644 --- a/src/modules/module_00130.c +++ b/src/modules/module_00130.c @@ -181,6 +181,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00131.c b/src/modules/module_00131.c index 1a37a5876..6addd2a9b 100644 --- a/src/modules/module_00131.c +++ b/src/modules/module_00131.c @@ -176,6 +176,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00132.c b/src/modules/module_00132.c index d8aed073d..1956dd9ec 100644 --- a/src/modules/module_00132.c +++ b/src/modules/module_00132.c @@ -170,6 +170,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00133.c b/src/modules/module_00133.c index 1177017b0..ef80f1c56 100644 --- a/src/modules/module_00133.c +++ b/src/modules/module_00133.c @@ -153,6 +153,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00140.c b/src/modules/module_00140.c index f0ed02252..38bd9a906 100644 --- a/src/modules/module_00140.c +++ b/src/modules/module_00140.c @@ -181,6 +181,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00141.c b/src/modules/module_00141.c index e4d369381..55642cfbe 100644 --- a/src/modules/module_00141.c +++ b/src/modules/module_00141.c @@ -188,6 +188,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00150.c b/src/modules/module_00150.c index 3673e511e..6bdb22f29 100644 --- a/src/modules/module_00150.c +++ b/src/modules/module_00150.c @@ -158,6 +158,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00160.c b/src/modules/module_00160.c index 81f4c9f41..2480912cc 100644 --- a/src/modules/module_00160.c +++ b/src/modules/module_00160.c @@ -158,6 +158,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00170.c b/src/modules/module_00170.c index 0533ade86..8165fac23 100644 --- a/src/modules/module_00170.c +++ b/src/modules/module_00170.c @@ -155,6 +155,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00200.c b/src/modules/module_00200.c index 1cf90dda4..480876048 100644 --- a/src/modules/module_00200.c +++ b/src/modules/module_00200.c @@ -122,6 +122,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00300.c b/src/modules/module_00300.c index eabe88871..f34d4b821 100644 --- a/src/modules/module_00300.c +++ b/src/modules/module_00300.c @@ -153,6 +153,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00400.c b/src/modules/module_00400.c index def472e8c..9b150f542 100644 --- a/src/modules/module_00400.c +++ b/src/modules/module_00400.c @@ -249,6 +249,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00500.c b/src/modules/module_00500.c index da1492e45..635d0729c 100644 --- a/src/modules/module_00500.c +++ b/src/modules/module_00500.c @@ -262,6 +262,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00501.c b/src/modules/module_00501.c index 5cb8776f2..9bc6418f5 100644 --- a/src/modules/module_00501.c +++ b/src/modules/module_00501.c @@ -341,6 +341,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00600.c b/src/modules/module_00600.c index a6c4f2a8d..dddd43874 100644 --- a/src/modules/module_00600.c +++ b/src/modules/module_00600.c @@ -127,6 +127,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_00900.c b/src/modules/module_00900.c index 0e5215275..36ad3e38a 100644 --- a/src/modules/module_00900.c +++ b/src/modules/module_00900.c @@ -138,6 +138,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01000.c b/src/modules/module_01000.c index 1d84c5edc..eb4186711 100644 --- a/src/modules/module_01000.c +++ b/src/modules/module_01000.c @@ -141,6 +141,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01100.c b/src/modules/module_01100.c index 8b7383399..18725266b 100644 --- a/src/modules/module_01100.c +++ b/src/modules/module_01100.c @@ -165,6 +165,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01300.c b/src/modules/module_01300.c index 82dbc90ef..3f33b6ce4 100644 --- a/src/modules/module_01300.c +++ b/src/modules/module_01300.c @@ -168,6 +168,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01400.c b/src/modules/module_01400.c index b7a33ff43..6e87c61a4 100644 --- a/src/modules/module_01400.c +++ b/src/modules/module_01400.c @@ -175,6 +175,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01410.c b/src/modules/module_01410.c index f6fda5840..716f996bb 100644 --- a/src/modules/module_01410.c +++ b/src/modules/module_01410.c @@ -201,6 +201,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01411.c b/src/modules/module_01411.c index 684366b6b..738f83e08 100644 --- a/src/modules/module_01411.c +++ b/src/modules/module_01411.c @@ -197,6 +197,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01420.c b/src/modules/module_01420.c index 3df3a8316..b32d4837b 100644 --- a/src/modules/module_01420.c +++ b/src/modules/module_01420.c @@ -201,6 +201,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01421.c b/src/modules/module_01421.c index 811363a50..78acbae9d 100644 --- a/src/modules/module_01421.c +++ b/src/modules/module_01421.c @@ -177,6 +177,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01430.c b/src/modules/module_01430.c index 48bd7e713..0de394b6b 100644 --- a/src/modules/module_01430.c +++ b/src/modules/module_01430.c @@ -202,6 +202,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01440.c b/src/modules/module_01440.c index f45bd58b6..60f84e3f7 100644 --- a/src/modules/module_01440.c +++ b/src/modules/module_01440.c @@ -202,6 +202,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01441.c b/src/modules/module_01441.c index 67f290425..695de3806 100644 --- a/src/modules/module_01441.c +++ b/src/modules/module_01441.c @@ -203,6 +203,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01450.c b/src/modules/module_01450.c index 5a5bf97d8..f4ec025b0 100644 --- a/src/modules/module_01450.c +++ b/src/modules/module_01450.c @@ -172,6 +172,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01460.c b/src/modules/module_01460.c index f2952aa36..4f5849db6 100644 --- a/src/modules/module_01460.c +++ b/src/modules/module_01460.c @@ -204,6 +204,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01470.c b/src/modules/module_01470.c index ec2e26ae6..8bafbc6f7 100644 --- a/src/modules/module_01470.c +++ b/src/modules/module_01470.c @@ -176,6 +176,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01500.c b/src/modules/module_01500.c index ca0e90232..6f20a517f 100644 --- a/src/modules/module_01500.c +++ b/src/modules/module_01500.c @@ -308,6 +308,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01600.c b/src/modules/module_01600.c index f3d4d3e13..147fbfac2 100644 --- a/src/modules/module_01600.c +++ b/src/modules/module_01600.c @@ -262,6 +262,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01700.c b/src/modules/module_01700.c index 04f2762c1..2956e7ee2 100644 --- a/src/modules/module_01700.c +++ b/src/modules/module_01700.c @@ -202,6 +202,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01710.c b/src/modules/module_01710.c index a36c9492a..48347c0c6 100644 --- a/src/modules/module_01710.c +++ b/src/modules/module_01710.c @@ -202,6 +202,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01711.c b/src/modules/module_01711.c index b037abe83..0308b2fc0 100644 --- a/src/modules/module_01711.c +++ b/src/modules/module_01711.c @@ -198,6 +198,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01720.c b/src/modules/module_01720.c index 3fdc77653..bf135b591 100644 --- a/src/modules/module_01720.c +++ b/src/modules/module_01720.c @@ -227,6 +227,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01722.c b/src/modules/module_01722.c index 3264c5f46..6105c9718 100644 --- a/src/modules/module_01722.c +++ b/src/modules/module_01722.c @@ -204,6 +204,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01730.c b/src/modules/module_01730.c index f0b579fcc..c3c514b65 100644 --- a/src/modules/module_01730.c +++ b/src/modules/module_01730.c @@ -203,6 +203,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01731.c b/src/modules/module_01731.c index c26465d77..1f0a7ea37 100644 --- a/src/modules/module_01731.c +++ b/src/modules/module_01731.c @@ -189,6 +189,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01740.c b/src/modules/module_01740.c index 9df594f94..4ac3b59f6 100644 --- a/src/modules/module_01740.c +++ b/src/modules/module_01740.c @@ -203,6 +203,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01750.c b/src/modules/module_01750.c index eb5ce8558..ee0e1b56d 100644 --- a/src/modules/module_01750.c +++ b/src/modules/module_01750.c @@ -173,6 +173,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01760.c b/src/modules/module_01760.c index 6811199af..f36b3c0a2 100644 --- a/src/modules/module_01760.c +++ b/src/modules/module_01760.c @@ -174,6 +174,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01770.c b/src/modules/module_01770.c index 50e802556..19b71100a 100644 --- a/src/modules/module_01770.c +++ b/src/modules/module_01770.c @@ -191,6 +191,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_01800.c b/src/modules/module_01800.c index 98471dd89..e6e3a7f00 100644 --- a/src/modules/module_01800.c +++ b/src/modules/module_01800.c @@ -567,6 +567,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_02000.c b/src/modules/module_02000.c index 19fb60394..b473c3841 100644 --- a/src/modules/module_02000.c +++ b/src/modules/module_02000.c @@ -79,6 +79,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_02100.c b/src/modules/module_02100.c index 371d4a14e..0ede5e5c2 100644 --- a/src/modules/module_02100.c +++ b/src/modules/module_02100.c @@ -175,6 +175,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_02400.c b/src/modules/module_02400.c index 5d1d18d02..3dc730ece 100644 --- a/src/modules/module_02400.c +++ b/src/modules/module_02400.c @@ -169,6 +169,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_02410.c b/src/modules/module_02410.c index 502b48474..d49b1fe74 100644 --- a/src/modules/module_02410.c +++ b/src/modules/module_02410.c @@ -185,6 +185,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_02500.c b/src/modules/module_02500.c index aede25a2f..c7a54ba77 100644 --- a/src/modules/module_02500.c +++ b/src/modules/module_02500.c @@ -910,6 +910,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = module_hash_binary_count; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_02501.c b/src/modules/module_02501.c index e29a64065..92aa6cd7d 100644 --- a/src/modules/module_02501.c +++ b/src/modules/module_02501.c @@ -907,6 +907,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = module_hash_binary_count; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_02600.c b/src/modules/module_02600.c index 9cc503202..291141952 100644 --- a/src/modules/module_02600.c +++ b/src/modules/module_02600.c @@ -147,6 +147,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_02611.c b/src/modules/module_02611.c index 20980c526..ee6972c0e 100644 --- a/src/modules/module_02611.c +++ b/src/modules/module_02611.c @@ -161,6 +161,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_02612.c b/src/modules/module_02612.c index 6629f9123..b6208b98c 100644 --- a/src/modules/module_02612.c +++ b/src/modules/module_02612.c @@ -163,6 +163,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_02711.c b/src/modules/module_02711.c index 50f58dea4..c89436ef2 100644 --- a/src/modules/module_02711.c +++ b/src/modules/module_02711.c @@ -145,6 +145,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_02811.c b/src/modules/module_02811.c index 71eaaef7b..d851572dc 100644 --- a/src/modules/module_02811.c +++ b/src/modules/module_02811.c @@ -175,6 +175,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_03000.c b/src/modules/module_03000.c index cc091a5e5..98b519a21 100644 --- a/src/modules/module_03000.c +++ b/src/modules/module_03000.c @@ -232,6 +232,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_03100.c b/src/modules/module_03100.c index 53a7dd9e3..b5ed25071 100644 --- a/src/modules/module_03100.c +++ b/src/modules/module_03100.c @@ -143,6 +143,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_03200.c b/src/modules/module_03200.c index ebc60c5ba..e977ab497 100644 --- a/src/modules/module_03200.c +++ b/src/modules/module_03200.c @@ -304,6 +304,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_03500.c b/src/modules/module_03500.c index 10182be02..67f43dfcd 100644 --- a/src/modules/module_03500.c +++ b/src/modules/module_03500.c @@ -147,6 +147,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_03710.c b/src/modules/module_03710.c index 3d30567cb..58990dbde 100644 --- a/src/modules/module_03710.c +++ b/src/modules/module_03710.c @@ -172,6 +172,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_03711.c b/src/modules/module_03711.c index ee5e1d3f6..9377bb42b 100644 --- a/src/modules/module_03711.c +++ b/src/modules/module_03711.c @@ -175,6 +175,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_03800.c b/src/modules/module_03800.c index 5656c411f..97178dc7c 100644 --- a/src/modules/module_03800.c +++ b/src/modules/module_03800.c @@ -161,6 +161,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_03910.c b/src/modules/module_03910.c index c4b81d6e6..795763f39 100644 --- a/src/modules/module_03910.c +++ b/src/modules/module_03910.c @@ -177,6 +177,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_04010.c b/src/modules/module_04010.c index 79d38481f..794b33256 100644 --- a/src/modules/module_04010.c +++ b/src/modules/module_04010.c @@ -175,6 +175,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_04110.c b/src/modules/module_04110.c index 653f27164..c2ec46e51 100644 --- a/src/modules/module_04110.c +++ b/src/modules/module_04110.c @@ -173,6 +173,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_04300.c b/src/modules/module_04300.c index 0e348b89f..ad0f03816 100644 --- a/src/modules/module_04300.c +++ b/src/modules/module_04300.c @@ -147,6 +147,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_04400.c b/src/modules/module_04400.c index 478e4e2cf..c21e59a62 100644 --- a/src/modules/module_04400.c +++ b/src/modules/module_04400.c @@ -137,6 +137,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_04500.c b/src/modules/module_04500.c index c4943a7d4..f2c08bd84 100644 --- a/src/modules/module_04500.c +++ b/src/modules/module_04500.c @@ -152,6 +152,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_04510.c b/src/modules/module_04510.c index f6047bc90..f4087eb34 100644 --- a/src/modules/module_04510.c +++ b/src/modules/module_04510.c @@ -179,6 +179,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_04520.c b/src/modules/module_04520.c index 0ecafefa4..7569b3055 100644 --- a/src/modules/module_04520.c +++ b/src/modules/module_04520.c @@ -160,6 +160,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_04521.c b/src/modules/module_04521.c index d326795d6..8f27a959b 100644 --- a/src/modules/module_04521.c +++ b/src/modules/module_04521.c @@ -152,6 +152,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_04522.c b/src/modules/module_04522.c index 8fcc1b4f0..8142e5244 100644 --- a/src/modules/module_04522.c +++ b/src/modules/module_04522.c @@ -152,6 +152,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_04700.c b/src/modules/module_04700.c index 959ccd1a8..8c6c9a20b 100644 --- a/src/modules/module_04700.c +++ b/src/modules/module_04700.c @@ -154,6 +154,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_04710.c b/src/modules/module_04710.c index 4c7361f3c..559c29bb3 100644 --- a/src/modules/module_04710.c +++ b/src/modules/module_04710.c @@ -179,6 +179,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_04711.c b/src/modules/module_04711.c index f4961f306..34b04e7b0 100644 --- a/src/modules/module_04711.c +++ b/src/modules/module_04711.c @@ -193,6 +193,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_04800.c b/src/modules/module_04800.c index baecc963c..4b5caf9e5 100644 --- a/src/modules/module_04800.c +++ b/src/modules/module_04800.c @@ -160,6 +160,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_04900.c b/src/modules/module_04900.c index 151537fa8..4da530630 100644 --- a/src/modules/module_04900.c +++ b/src/modules/module_04900.c @@ -175,6 +175,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_05000.c b/src/modules/module_05000.c index 67ef974ce..27dbc1ed2 100644 --- a/src/modules/module_05000.c +++ b/src/modules/module_05000.c @@ -175,6 +175,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_05100.c b/src/modules/module_05100.c index d1b07b76c..1301f3e39 100644 --- a/src/modules/module_05100.c +++ b/src/modules/module_05100.c @@ -115,6 +115,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_05200.c b/src/modules/module_05200.c index 6fb3f08d8..a0577137f 100644 --- a/src/modules/module_05200.c +++ b/src/modules/module_05200.c @@ -201,6 +201,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_05300.c b/src/modules/module_05300.c index a1cd04076..6cf5e34b6 100644 --- a/src/modules/module_05300.c +++ b/src/modules/module_05300.c @@ -256,6 +256,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_05400.c b/src/modules/module_05400.c index d9472c480..15f0954cf 100644 --- a/src/modules/module_05400.c +++ b/src/modules/module_05400.c @@ -263,6 +263,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_05500.c b/src/modules/module_05500.c index 447a64d83..2f4fb2ba7 100644 --- a/src/modules/module_05500.c +++ b/src/modules/module_05500.c @@ -422,6 +422,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_05600.c b/src/modules/module_05600.c index 3c96edf1e..d4627f3a9 100644 --- a/src/modules/module_05600.c +++ b/src/modules/module_05600.c @@ -317,6 +317,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_05700.c b/src/modules/module_05700.c index 9d3b86a93..bb8d19d93 100644 --- a/src/modules/module_05700.c +++ b/src/modules/module_05700.c @@ -163,6 +163,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_05800.c b/src/modules/module_05800.c index 4c8f6d881..34287cbc5 100644 --- a/src/modules/module_05800.c +++ b/src/modules/module_05800.c @@ -176,6 +176,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_06000.c b/src/modules/module_06000.c index 0d348f0e3..91bfcc9aa 100644 --- a/src/modules/module_06000.c +++ b/src/modules/module_06000.c @@ -118,6 +118,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_06100.c b/src/modules/module_06100.c index 88d80f3ad..f9e4f3b59 100644 --- a/src/modules/module_06100.c +++ b/src/modules/module_06100.c @@ -198,6 +198,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_06211.c b/src/modules/module_06211.c index 5cb417d26..1d7e53843 100644 --- a/src/modules/module_06211.c +++ b/src/modules/module_06211.c @@ -260,6 +260,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_06212.c b/src/modules/module_06212.c index ceb18f192..d545813f7 100644 --- a/src/modules/module_06212.c +++ b/src/modules/module_06212.c @@ -260,6 +260,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_06213.c b/src/modules/module_06213.c index 20323fc62..fa89e6ada 100644 --- a/src/modules/module_06213.c +++ b/src/modules/module_06213.c @@ -258,6 +258,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_06221.c b/src/modules/module_06221.c index 38cb70ed8..a5a923a4e 100644 --- a/src/modules/module_06221.c +++ b/src/modules/module_06221.c @@ -262,6 +262,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_06222.c b/src/modules/module_06222.c index 4873b8fab..2099f7a16 100644 --- a/src/modules/module_06222.c +++ b/src/modules/module_06222.c @@ -262,6 +262,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_06223.c b/src/modules/module_06223.c index 8d4261420..3175b41c8 100644 --- a/src/modules/module_06223.c +++ b/src/modules/module_06223.c @@ -262,6 +262,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_06231.c b/src/modules/module_06231.c index c9699c033..0c162a890 100644 --- a/src/modules/module_06231.c +++ b/src/modules/module_06231.c @@ -272,6 +272,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_06232.c b/src/modules/module_06232.c index 496b9c575..33d981c95 100644 --- a/src/modules/module_06232.c +++ b/src/modules/module_06232.c @@ -272,6 +272,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_06233.c b/src/modules/module_06233.c index e6ba28e2d..fb642ad38 100644 --- a/src/modules/module_06233.c +++ b/src/modules/module_06233.c @@ -268,6 +268,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_06241.c b/src/modules/module_06241.c index 47da47ffb..e7ee661f6 100644 --- a/src/modules/module_06241.c +++ b/src/modules/module_06241.c @@ -273,6 +273,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_06242.c b/src/modules/module_06242.c index 014b5d161..bf8f1743f 100644 --- a/src/modules/module_06242.c +++ b/src/modules/module_06242.c @@ -273,6 +273,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_06243.c b/src/modules/module_06243.c index a84abdd7c..fff7cdbb1 100644 --- a/src/modules/module_06243.c +++ b/src/modules/module_06243.c @@ -273,6 +273,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_06300.c b/src/modules/module_06300.c index 0b5dbdc5c..4d9b27c8f 100644 --- a/src/modules/module_06300.c +++ b/src/modules/module_06300.c @@ -253,6 +253,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_06400.c b/src/modules/module_06400.c index 2b032f4f5..3a4b157f0 100644 --- a/src/modules/module_06400.c +++ b/src/modules/module_06400.c @@ -378,6 +378,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_06500.c b/src/modules/module_06500.c index b95a4bd0b..747fc3061 100644 --- a/src/modules/module_06500.c +++ b/src/modules/module_06500.c @@ -551,6 +551,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_06600.c b/src/modules/module_06600.c index be83e5567..3a9941f04 100644 --- a/src/modules/module_06600.c +++ b/src/modules/module_06600.c @@ -229,6 +229,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_06700.c b/src/modules/module_06700.c index f63248ca7..180b1e14e 100644 --- a/src/modules/module_06700.c +++ b/src/modules/module_06700.c @@ -304,6 +304,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_06800.c b/src/modules/module_06800.c index 0f25fa29d..0dc21e921 100644 --- a/src/modules/module_06800.c +++ b/src/modules/module_06800.c @@ -204,6 +204,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_06900.c b/src/modules/module_06900.c index cf9ea46c0..7c6ddeeba 100644 --- a/src/modules/module_06900.c +++ b/src/modules/module_06900.c @@ -129,6 +129,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_07000.c b/src/modules/module_07000.c index aa19f0677..4c473f906 100644 --- a/src/modules/module_07000.c +++ b/src/modules/module_07000.c @@ -201,6 +201,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_07100.c b/src/modules/module_07100.c index 5f81ba616..e6bb644a6 100644 --- a/src/modules/module_07100.c +++ b/src/modules/module_07100.c @@ -252,6 +252,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_07200.c b/src/modules/module_07200.c index 5ed129893..896d97077 100644 --- a/src/modules/module_07200.c +++ b/src/modules/module_07200.c @@ -223,6 +223,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_07300.c b/src/modules/module_07300.c index f4844669f..d46f9c504 100644 --- a/src/modules/module_07300.c +++ b/src/modules/module_07300.c @@ -179,6 +179,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_07400.c b/src/modules/module_07400.c index 3be47f898..4ea51a0e7 100644 --- a/src/modules/module_07400.c +++ b/src/modules/module_07400.c @@ -377,6 +377,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_07401.c b/src/modules/module_07401.c index ba71bf179..7390870f7 100644 --- a/src/modules/module_07401.c +++ b/src/modules/module_07401.c @@ -422,6 +422,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_07500.c b/src/modules/module_07500.c index 7cb6e04e4..8f7dde4f2 100644 --- a/src/modules/module_07500.c +++ b/src/modules/module_07500.c @@ -255,6 +255,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_07700.c b/src/modules/module_07700.c index 59d6337f9..68acb39e4 100644 --- a/src/modules/module_07700.c +++ b/src/modules/module_07700.c @@ -161,6 +161,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_07701.c b/src/modules/module_07701.c index 5dbffa59c..eef48f64a 100644 --- a/src/modules/module_07701.c +++ b/src/modules/module_07701.c @@ -154,6 +154,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_07800.c b/src/modules/module_07800.c index 878847c7a..bf17dc29f 100644 --- a/src/modules/module_07800.c +++ b/src/modules/module_07800.c @@ -177,6 +177,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_07801.c b/src/modules/module_07801.c index e1d936421..83d3ccde9 100644 --- a/src/modules/module_07801.c +++ b/src/modules/module_07801.c @@ -177,6 +177,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_07900.c b/src/modules/module_07900.c index a51efecd9..2d08e8daa 100644 --- a/src/modules/module_07900.c +++ b/src/modules/module_07900.c @@ -461,6 +461,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_08000.c b/src/modules/module_08000.c index 65aa287f8..5259cd74a 100644 --- a/src/modules/module_08000.c +++ b/src/modules/module_08000.c @@ -182,6 +182,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_08100.c b/src/modules/module_08100.c index 1318fdfae..92d333b5c 100644 --- a/src/modules/module_08100.c +++ b/src/modules/module_08100.c @@ -172,6 +172,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_08200.c b/src/modules/module_08200.c index 617b80972..657a2608a 100644 --- a/src/modules/module_08200.c +++ b/src/modules/module_08200.c @@ -270,6 +270,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_08300.c b/src/modules/module_08300.c index 26439a0f6..f67c6b2c9 100644 --- a/src/modules/module_08300.c +++ b/src/modules/module_08300.c @@ -220,6 +220,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_08400.c b/src/modules/module_08400.c index 11ef09579..c2fab507e 100644 --- a/src/modules/module_08400.c +++ b/src/modules/module_08400.c @@ -151,6 +151,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_08500.c b/src/modules/module_08500.c index 00243f12b..a03393c26 100644 --- a/src/modules/module_08500.c +++ b/src/modules/module_08500.c @@ -217,6 +217,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_08600.c b/src/modules/module_08600.c index 7b46885e8..af9cf94d3 100644 --- a/src/modules/module_08600.c +++ b/src/modules/module_08600.c @@ -114,6 +114,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_08700.c b/src/modules/module_08700.c index be902d527..c36e25bbd 100644 --- a/src/modules/module_08700.c +++ b/src/modules/module_08700.c @@ -168,6 +168,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_08800.c b/src/modules/module_08800.c index 3c2b8667e..0494349a2 100644 --- a/src/modules/module_08800.c +++ b/src/modules/module_08800.c @@ -226,6 +226,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_08900.c b/src/modules/module_08900.c index de2a936d6..1ab64b73b 100644 --- a/src/modules/module_08900.c +++ b/src/modules/module_08900.c @@ -387,6 +387,47 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE return line_len; } +/* + +Find the right -n value for your GPU: +===================================== + +1. For example, to find the value for 8900, first create a valid hash for 8900 as follows: + +$ ./hashcat --example-hashes -m 8900 | grep Example.Hash | grep -v Format | cut -b 25- > tmp.hash.8900 + +2. Now let it iterate through all -n values to a certain point. In this case, I'm using 200, but in general it's a value that is at least twice that of the multiprocessor. If you don't mind you can just leave it as it is, it just runs a little longer. + +$ export i=1; while [ $i -ne 201 ]; do echo $i; ./hashcat --quiet tmp.hash.8900 --keep-guessing --self-test-disable --markov-disable --restore-disable --outfile-autohex-disable --wordlist-autohex-disable --potfile-disable --logfile-disable --hwmon-disable --status --status-timer 1 --runtime 28 --machine-readable --optimized-kernel-enable --workload-profile 3 --hash-type 8900 --attack-mode 3 ?b?b?b?b?b?b?b --backend-devices 1 --force -n $i; i=$(($i+1)); done | tee x + +3. Determine the highest measured H/s speed. But don't just use the highest value. Instead, use the number that seems most stable, usually at the beginning. + +$ grep "$(printf 'STATUS\t3')" x | cut -f4 -d$'\t' | sort -n | tail + +4. To match the speed you have chosen to the correct value in the 'x' file, simply search for it in it. Then go up a little on the block where you found him. The value -n is the single value that begins before the block start. If you have multiple blocks at the same speed, choose the lowest value for -n + +*/ + +const char *module_extra_tuningdb_block (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const char *extra_tuningdb_block = + "DEVICE_TYPE_CPU * 8900 1 N A\n" + "DEVICE_TYPE_GPU * 8900 1 N A\n" + "GeForce_GTX_980 * 8900 1 29 A\n" + "GeForce_GTX_1080 * 8900 1 15 A\n" + "GeForce_RTX_2080_Ti * 8900 1 68 A\n" + "GeForce_RTX_3060_Ti * 8900 1 51 A\n" + "GeForce_RTX_3070 * 8900 1 46 A\n" + "GeForce_RTX_3090 * 8900 1 82 A\n" + "ALIAS_AMD_RX480 * 8900 1 15 A\n" + "ALIAS_AMD_Vega64 * 8900 1 31 A\n" + "ALIAS_AMD_MI100 * 8900 1 79 A\n" + "ALIAS_AMD_RX6900XT * 8900 1 59 A\n" + ; + + return extra_tuningdb_block; +} + void module_init (module_ctx_t *module_ctx) { module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; @@ -408,6 +449,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = module_extra_buffer_size; module_ctx->module_extra_tmp_size = module_extra_tmp_size; + module_ctx->module_extra_tuningdb_block = module_extra_tuningdb_block; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_09000.c b/src/modules/module_09000.c index 28963a1fc..c5e5abbc5 100644 --- a/src/modules/module_09000.c +++ b/src/modules/module_09000.c @@ -235,6 +235,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_09100.c b/src/modules/module_09100.c index 092ec71fe..2863a2fc7 100644 --- a/src/modules/module_09100.c +++ b/src/modules/module_09100.c @@ -207,6 +207,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_09200.c b/src/modules/module_09200.c index e1fd7ece2..65cbc6629 100644 --- a/src/modules/module_09200.c +++ b/src/modules/module_09200.c @@ -221,6 +221,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_09300.c b/src/modules/module_09300.c index 05dcbc585..1b5914817 100644 --- a/src/modules/module_09300.c +++ b/src/modules/module_09300.c @@ -344,6 +344,47 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE return line_len; } +/* + +Find the right -n value for your GPU: +===================================== + +1. For example, to find the value for 9300, first create a valid hash for 9300 as follows: + +$ ./hashcat --example-hashes -m 9300 | grep Example.Hash | grep -v Format | cut -b 25- > tmp.hash.9300 + +2. Now let it iterate through all -n values to a certain point. In this case, I'm using 1032, but in general it's a value that is at least twice that of the multiprocessor. If you don't mind you can just leave it as it is, it just runs a little longer. + +$ export i=8; while [ $i -ne 1032 ]; do echo $i; ./hashcat --quiet tmp.hash.9300 --keep-guessing --self-test-disable --markov-disable --restore-disable --outfile-autohex-disable --wordlist-autohex-disable --potfile-disable --logfile-disable --hwmon-disable --status --status-timer 1 --runtime 28 --machine-readable --optimized-kernel-enable --workload-profile 3 --hash-type 9300 --attack-mode 3 ?b?b?b?b?b?b?b --backend-devices 1 --force -n $i; i=$(($i+8)); done | tee x + +3. Determine the highest measured H/s speed. But don't just use the highest value. Instead, use the number that seems most stable, usually at the beginning. + +$ grep "$(printf 'STATUS\t3')" x | cut -f4 -d$'\t' | sort -n | tail + +4. To match the speed you have chosen to the correct value in the 'x' file, simply search for it in it. Then go up a little on the block where you found him. The value -n is the single value that begins before the block start. If you have multiple blocks at the same speed, choose the lowest value for -n + +*/ + +const char *module_extra_tuningdb_block (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const char *extra_tuningdb_block = + "DEVICE_TYPE_CPU * 9300 1 N A\n" + "DEVICE_TYPE_GPU * 9300 1 N A\n" + "GeForce_GTX_980 * 9300 1 128 A\n" + "GeForce_GTX_1080 * 9300 1 256 A\n" + "GeForce_RTX_2080_Ti * 9300 1 528 A\n" + "GeForce_RTX_3060_Ti * 9300 1 256 A\n" + "GeForce_RTX_3070 * 9300 1 368 A\n" + "GeForce_RTX_3090 * 9300 1 984 A\n" + "ALIAS_AMD_RX480 * 9300 1 232 A\n" + "ALIAS_AMD_Vega64 * 9300 1 440 A\n" + "ALIAS_AMD_MI100 * 9300 1 1000 A\n" + "ALIAS_AMD_RX6900XT * 9300 1 720 A\n" + ; + + return extra_tuningdb_block; +} + void module_init (module_ctx_t *module_ctx) { module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; @@ -365,6 +406,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = module_extra_buffer_size; module_ctx->module_extra_tmp_size = module_extra_tmp_size; + module_ctx->module_extra_tuningdb_block = module_extra_tuningdb_block; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_09400.c b/src/modules/module_09400.c index 4870920a6..0666d99a8 100644 --- a/src/modules/module_09400.c +++ b/src/modules/module_09400.c @@ -271,6 +271,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_09500.c b/src/modules/module_09500.c index 49a8e7546..fb47bba52 100644 --- a/src/modules/module_09500.c +++ b/src/modules/module_09500.c @@ -292,6 +292,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_09600.c b/src/modules/module_09600.c index 8a51522ff..fb7b619c8 100644 --- a/src/modules/module_09600.c +++ b/src/modules/module_09600.c @@ -325,6 +325,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_09700.c b/src/modules/module_09700.c index 626f65f8f..fa70c9805 100644 --- a/src/modules/module_09700.c +++ b/src/modules/module_09700.c @@ -244,6 +244,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_09710.c b/src/modules/module_09710.c index aa63f6905..45b10dd4f 100644 --- a/src/modules/module_09710.c +++ b/src/modules/module_09710.c @@ -263,6 +263,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = module_forced_outfile_format; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_09720.c b/src/modules/module_09720.c index e4be9f8b0..436a9cedf 100644 --- a/src/modules/module_09720.c +++ b/src/modules/module_09720.c @@ -276,6 +276,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_09800.c b/src/modules/module_09800.c index 357ecb80b..354bbabd0 100644 --- a/src/modules/module_09800.c +++ b/src/modules/module_09800.c @@ -303,6 +303,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_09810.c b/src/modules/module_09810.c index 9d3edd8d2..7ebbb9863 100644 --- a/src/modules/module_09810.c +++ b/src/modules/module_09810.c @@ -321,6 +321,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = module_forced_outfile_format; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_09820.c b/src/modules/module_09820.c index 9997992e4..ae5ac0146 100644 --- a/src/modules/module_09820.c +++ b/src/modules/module_09820.c @@ -343,6 +343,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_09900.c b/src/modules/module_09900.c index 1cf0bf948..686181863 100644 --- a/src/modules/module_09900.c +++ b/src/modules/module_09900.c @@ -127,6 +127,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_10000.c b/src/modules/module_10000.c index c2e4db394..f5ba85095 100644 --- a/src/modules/module_10000.c +++ b/src/modules/module_10000.c @@ -231,6 +231,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_10100.c b/src/modules/module_10100.c index c5cafc8c9..1acb405e5 100644 --- a/src/modules/module_10100.c +++ b/src/modules/module_10100.c @@ -147,6 +147,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_10200.c b/src/modules/module_10200.c index cd74cc1f1..a13486fba 100644 --- a/src/modules/module_10200.c +++ b/src/modules/module_10200.c @@ -190,6 +190,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_10300.c b/src/modules/module_10300.c index 723a3ed01..66b28ed0d 100644 --- a/src/modules/module_10300.c +++ b/src/modules/module_10300.c @@ -192,6 +192,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_10400.c b/src/modules/module_10400.c index 30c95e68a..143f9ab07 100644 --- a/src/modules/module_10400.c +++ b/src/modules/module_10400.c @@ -337,6 +337,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_10410.c b/src/modules/module_10410.c index 25be1feb4..78f0e15bb 100644 --- a/src/modules/module_10410.c +++ b/src/modules/module_10410.c @@ -357,6 +357,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = module_forced_outfile_format; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_10420.c b/src/modules/module_10420.c index eecf97f2c..cafc8aada 100644 --- a/src/modules/module_10420.c +++ b/src/modules/module_10420.c @@ -372,6 +372,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_10500.c b/src/modules/module_10500.c index d261e4458..d553c024d 100644 --- a/src/modules/module_10500.c +++ b/src/modules/module_10500.c @@ -463,6 +463,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_10600.c b/src/modules/module_10600.c index 77d0ff1d7..678619d3d 100644 --- a/src/modules/module_10600.c +++ b/src/modules/module_10600.c @@ -302,6 +302,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_10700.c b/src/modules/module_10700.c index 5c801b3c9..e06cb6e0a 100644 --- a/src/modules/module_10700.c +++ b/src/modules/module_10700.c @@ -328,6 +328,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_10800.c b/src/modules/module_10800.c index 1765bddac..f3017225f 100644 --- a/src/modules/module_10800.c +++ b/src/modules/module_10800.c @@ -213,6 +213,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_10810.c b/src/modules/module_10810.c index 10d1443f4..b6486d408 100644 --- a/src/modules/module_10810.c +++ b/src/modules/module_10810.c @@ -239,6 +239,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_10820.c b/src/modules/module_10820.c index 82987fe39..0003b1a0b 100644 --- a/src/modules/module_10820.c +++ b/src/modules/module_10820.c @@ -239,6 +239,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_10830.c b/src/modules/module_10830.c index f431762f8..86a9dd9de 100644 --- a/src/modules/module_10830.c +++ b/src/modules/module_10830.c @@ -240,6 +240,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_10840.c b/src/modules/module_10840.c index f60d3ea13..3dbe725e8 100644 --- a/src/modules/module_10840.c +++ b/src/modules/module_10840.c @@ -240,6 +240,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_10870.c b/src/modules/module_10870.c index 047c67242..585a40678 100644 --- a/src/modules/module_10870.c +++ b/src/modules/module_10870.c @@ -214,6 +214,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_10900.c b/src/modules/module_10900.c index efde01301..f17d98063 100644 --- a/src/modules/module_10900.c +++ b/src/modules/module_10900.c @@ -236,6 +236,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_10901.c b/src/modules/module_10901.c index 47049576a..edfce0ec0 100644 --- a/src/modules/module_10901.c +++ b/src/modules/module_10901.c @@ -211,6 +211,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_11000.c b/src/modules/module_11000.c index 7b9398299..3b6e8937f 100644 --- a/src/modules/module_11000.c +++ b/src/modules/module_11000.c @@ -150,6 +150,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_11100.c b/src/modules/module_11100.c index 7d76f5eff..951065c55 100644 --- a/src/modules/module_11100.c +++ b/src/modules/module_11100.c @@ -185,6 +185,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_11200.c b/src/modules/module_11200.c index bcfd8a2ba..cde3f895a 100644 --- a/src/modules/module_11200.c +++ b/src/modules/module_11200.c @@ -149,6 +149,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_11300.c b/src/modules/module_11300.c index 6711006c9..c860d5ac0 100644 --- a/src/modules/module_11300.c +++ b/src/modules/module_11300.c @@ -295,6 +295,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_11400.c b/src/modules/module_11400.c index f5ff1eb64..85875068c 100644 --- a/src/modules/module_11400.c +++ b/src/modules/module_11400.c @@ -442,6 +442,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_11500.c b/src/modules/module_11500.c index 7b012979d..bdf436af0 100644 --- a/src/modules/module_11500.c +++ b/src/modules/module_11500.c @@ -123,6 +123,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_11600.c b/src/modules/module_11600.c index 25fe732a3..af2125e1e 100644 --- a/src/modules/module_11600.c +++ b/src/modules/module_11600.c @@ -800,6 +800,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_11700.c b/src/modules/module_11700.c index ebf903a55..9c32af242 100644 --- a/src/modules/module_11700.c +++ b/src/modules/module_11700.c @@ -148,6 +148,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_11750.c b/src/modules/module_11750.c index f2302db35..57e90dbd8 100644 --- a/src/modules/module_11750.c +++ b/src/modules/module_11750.c @@ -175,6 +175,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_11760.c b/src/modules/module_11760.c index 5c574e469..c6053ae97 100644 --- a/src/modules/module_11760.c +++ b/src/modules/module_11760.c @@ -175,6 +175,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_11800.c b/src/modules/module_11800.c index 3c83bc0c0..4355e8c3c 100644 --- a/src/modules/module_11800.c +++ b/src/modules/module_11800.c @@ -172,6 +172,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_11850.c b/src/modules/module_11850.c index 6bf1853b4..68d77101c 100644 --- a/src/modules/module_11850.c +++ b/src/modules/module_11850.c @@ -199,6 +199,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_11860.c b/src/modules/module_11860.c index 67a5ff618..2fbaeac50 100644 --- a/src/modules/module_11860.c +++ b/src/modules/module_11860.c @@ -199,6 +199,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_11900.c b/src/modules/module_11900.c index d75ffd168..96eb9703f 100644 --- a/src/modules/module_11900.c +++ b/src/modules/module_11900.c @@ -200,6 +200,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_12000.c b/src/modules/module_12000.c index c878760d3..ef1541e2b 100644 --- a/src/modules/module_12000.c +++ b/src/modules/module_12000.c @@ -205,6 +205,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_12001.c b/src/modules/module_12001.c index 07c622b23..3d09a9c24 100644 --- a/src/modules/module_12001.c +++ b/src/modules/module_12001.c @@ -178,6 +178,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_12100.c b/src/modules/module_12100.c index 9407b2c23..c62f65276 100644 --- a/src/modules/module_12100.c +++ b/src/modules/module_12100.c @@ -210,6 +210,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_12200.c b/src/modules/module_12200.c index 3f6b57821..c2ae42f74 100644 --- a/src/modules/module_12200.c +++ b/src/modules/module_12200.c @@ -231,6 +231,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_12300.c b/src/modules/module_12300.c index a7b7e7fde..9025ae9ed 100644 --- a/src/modules/module_12300.c +++ b/src/modules/module_12300.c @@ -187,6 +187,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_12400.c b/src/modules/module_12400.c index 425a2252b..9048a6cfd 100644 --- a/src/modules/module_12400.c +++ b/src/modules/module_12400.c @@ -229,6 +229,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_12500.c b/src/modules/module_12500.c index a095b8f78..61284a3b1 100644 --- a/src/modules/module_12500.c +++ b/src/modules/module_12500.c @@ -217,6 +217,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_12600.c b/src/modules/module_12600.c index bf689dfdb..80f3da004 100644 --- a/src/modules/module_12600.c +++ b/src/modules/module_12600.c @@ -231,6 +231,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_12700.c b/src/modules/module_12700.c index a29502fdf..f421fdeba 100644 --- a/src/modules/module_12700.c +++ b/src/modules/module_12700.c @@ -171,6 +171,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_12800.c b/src/modules/module_12800.c index cd2099cdc..cf5cebf30 100644 --- a/src/modules/module_12800.c +++ b/src/modules/module_12800.c @@ -235,6 +235,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_12900.c b/src/modules/module_12900.c index 4c5a9892b..9442d0698 100644 --- a/src/modules/module_12900.c +++ b/src/modules/module_12900.c @@ -240,6 +240,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_13000.c b/src/modules/module_13000.c index ab389431d..abbfd59f3 100644 --- a/src/modules/module_13000.c +++ b/src/modules/module_13000.c @@ -274,6 +274,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_13100.c b/src/modules/module_13100.c index 2b4e0e846..c507b346d 100644 --- a/src/modules/module_13100.c +++ b/src/modules/module_13100.c @@ -276,6 +276,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_13200.c b/src/modules/module_13200.c index e86917e99..e1f682b7a 100644 --- a/src/modules/module_13200.c +++ b/src/modules/module_13200.c @@ -200,6 +200,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_13300.c b/src/modules/module_13300.c index 98782b227..cb8be76df 100644 --- a/src/modules/module_13300.c +++ b/src/modules/module_13300.c @@ -124,6 +124,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_13400.c b/src/modules/module_13400.c index 6fce19d15..dcec3eeff 100644 --- a/src/modules/module_13400.c +++ b/src/modules/module_13400.c @@ -664,6 +664,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_13500.c b/src/modules/module_13500.c index 0ca00a2e8..f15cb9b11 100644 --- a/src/modules/module_13500.c +++ b/src/modules/module_13500.c @@ -218,6 +218,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_13600.c b/src/modules/module_13600.c index ec1c4e6ef..dc57c5a82 100644 --- a/src/modules/module_13600.c +++ b/src/modules/module_13600.c @@ -421,6 +421,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_13711.c b/src/modules/module_13711.c index 919bc7a91..9bbc79284 100644 --- a/src/modules/module_13711.c +++ b/src/modules/module_13711.c @@ -308,6 +308,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13712.c b/src/modules/module_13712.c index 4dfa1324e..41ee05ccb 100644 --- a/src/modules/module_13712.c +++ b/src/modules/module_13712.c @@ -308,6 +308,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13713.c b/src/modules/module_13713.c index f5e1c28d0..9665cb660 100644 --- a/src/modules/module_13713.c +++ b/src/modules/module_13713.c @@ -308,6 +308,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13721.c b/src/modules/module_13721.c index ae3debbfb..eccda2a1e 100644 --- a/src/modules/module_13721.c +++ b/src/modules/module_13721.c @@ -318,6 +318,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13722.c b/src/modules/module_13722.c index 3706fb6b7..d88bce860 100644 --- a/src/modules/module_13722.c +++ b/src/modules/module_13722.c @@ -318,6 +318,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13723.c b/src/modules/module_13723.c index 6b5a29fa6..22ee30047 100644 --- a/src/modules/module_13723.c +++ b/src/modules/module_13723.c @@ -318,6 +318,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13731.c b/src/modules/module_13731.c index 6aee7e87c..c7175b67c 100644 --- a/src/modules/module_13731.c +++ b/src/modules/module_13731.c @@ -297,6 +297,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13732.c b/src/modules/module_13732.c index e36529eb1..10252498e 100644 --- a/src/modules/module_13732.c +++ b/src/modules/module_13732.c @@ -297,6 +297,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13733.c b/src/modules/module_13733.c index e878f3cf0..d573616d4 100644 --- a/src/modules/module_13733.c +++ b/src/modules/module_13733.c @@ -297,6 +297,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13741.c b/src/modules/module_13741.c index 58b29bb96..f2b4cff19 100644 --- a/src/modules/module_13741.c +++ b/src/modules/module_13741.c @@ -310,6 +310,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13742.c b/src/modules/module_13742.c index a8cb4df57..df1086d16 100644 --- a/src/modules/module_13742.c +++ b/src/modules/module_13742.c @@ -310,6 +310,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13743.c b/src/modules/module_13743.c index c6276c2d4..d68bfd003 100644 --- a/src/modules/module_13743.c +++ b/src/modules/module_13743.c @@ -310,6 +310,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13751.c b/src/modules/module_13751.c index f7123f79d..5f17e7587 100644 --- a/src/modules/module_13751.c +++ b/src/modules/module_13751.c @@ -327,6 +327,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13752.c b/src/modules/module_13752.c index 425d7ac15..713cc595b 100644 --- a/src/modules/module_13752.c +++ b/src/modules/module_13752.c @@ -327,6 +327,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13753.c b/src/modules/module_13753.c index 2ea19c7d6..1a32423de 100644 --- a/src/modules/module_13753.c +++ b/src/modules/module_13753.c @@ -327,6 +327,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13761.c b/src/modules/module_13761.c index 3fd5f4d0e..efee04031 100644 --- a/src/modules/module_13761.c +++ b/src/modules/module_13761.c @@ -329,6 +329,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13762.c b/src/modules/module_13762.c index 697c2fe75..0f90c50cf 100644 --- a/src/modules/module_13762.c +++ b/src/modules/module_13762.c @@ -329,6 +329,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13763.c b/src/modules/module_13763.c index 5b091c238..1268c114c 100644 --- a/src/modules/module_13763.c +++ b/src/modules/module_13763.c @@ -329,6 +329,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13771.c b/src/modules/module_13771.c index c248b7d94..0b6e6dff6 100644 --- a/src/modules/module_13771.c +++ b/src/modules/module_13771.c @@ -321,6 +321,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13772.c b/src/modules/module_13772.c index c24b09157..a3a48abc9 100644 --- a/src/modules/module_13772.c +++ b/src/modules/module_13772.c @@ -321,6 +321,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13773.c b/src/modules/module_13773.c index 0a84ca9b0..6516b469d 100644 --- a/src/modules/module_13773.c +++ b/src/modules/module_13773.c @@ -321,6 +321,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13781.c b/src/modules/module_13781.c index d4c0aceb5..5e5a99723 100644 --- a/src/modules/module_13781.c +++ b/src/modules/module_13781.c @@ -323,6 +323,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13782.c b/src/modules/module_13782.c index 268575a80..434f27d3a 100644 --- a/src/modules/module_13782.c +++ b/src/modules/module_13782.c @@ -323,6 +323,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13783.c b/src/modules/module_13783.c index 3607a8128..59fdebfad 100644 --- a/src/modules/module_13783.c +++ b/src/modules/module_13783.c @@ -323,6 +323,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_13800.c b/src/modules/module_13800.c index 07f0bdcdd..1a5eeadc8 100644 --- a/src/modules/module_13800.c +++ b/src/modules/module_13800.c @@ -201,6 +201,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_13900.c b/src/modules/module_13900.c index fd7a06131..676115c41 100644 --- a/src/modules/module_13900.c +++ b/src/modules/module_13900.c @@ -151,6 +151,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_14000.c b/src/modules/module_14000.c index abe8d259e..5eb25072b 100644 --- a/src/modules/module_14000.c +++ b/src/modules/module_14000.c @@ -263,6 +263,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_14100.c b/src/modules/module_14100.c index cd8d907da..8bbcadaaa 100644 --- a/src/modules/module_14100.c +++ b/src/modules/module_14100.c @@ -214,6 +214,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_14400.c b/src/modules/module_14400.c index 925fe8a37..5164419d3 100644 --- a/src/modules/module_14400.c +++ b/src/modules/module_14400.c @@ -169,6 +169,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_14500.c b/src/modules/module_14500.c index ba4edab17..5dc91091e 100644 --- a/src/modules/module_14500.c +++ b/src/modules/module_14500.c @@ -358,6 +358,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_14600.c b/src/modules/module_14600.c index 755fef2ff..4e8b4adf7 100644 --- a/src/modules/module_14600.c +++ b/src/modules/module_14600.c @@ -614,6 +614,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = module_hash_binary_count; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_14700.c b/src/modules/module_14700.c index b4292ab9a..0025afa82 100644 --- a/src/modules/module_14700.c +++ b/src/modules/module_14700.c @@ -366,6 +366,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_14800.c b/src/modules/module_14800.c index 510f66544..692e413dd 100644 --- a/src/modules/module_14800.c +++ b/src/modules/module_14800.c @@ -393,6 +393,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_14900.c b/src/modules/module_14900.c index 84a5678ee..d4b55bb7e 100644 --- a/src/modules/module_14900.c +++ b/src/modules/module_14900.c @@ -135,6 +135,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_15000.c b/src/modules/module_15000.c index 9fae0e769..3c962a217 100644 --- a/src/modules/module_15000.c +++ b/src/modules/module_15000.c @@ -244,6 +244,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_15100.c b/src/modules/module_15100.c index aa2cde6f8..50f41e103 100644 --- a/src/modules/module_15100.c +++ b/src/modules/module_15100.c @@ -330,6 +330,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_15200.c b/src/modules/module_15200.c index 0985e7923..5a73b19c3 100644 --- a/src/modules/module_15200.c +++ b/src/modules/module_15200.c @@ -177,6 +177,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_15300.c b/src/modules/module_15300.c index 7f85d4471..6accf04f2 100644 --- a/src/modules/module_15300.c +++ b/src/modules/module_15300.c @@ -404,6 +404,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_15400.c b/src/modules/module_15400.c index 64edfce9f..494824f12 100644 --- a/src/modules/module_15400.c +++ b/src/modules/module_15400.c @@ -228,6 +228,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_15500.c b/src/modules/module_15500.c index 3964d618b..e0a4fade7 100644 --- a/src/modules/module_15500.c +++ b/src/modules/module_15500.c @@ -294,6 +294,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_15600.c b/src/modules/module_15600.c index c7acdb8d3..78d1613a8 100644 --- a/src/modules/module_15600.c +++ b/src/modules/module_15600.c @@ -283,6 +283,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_15700.c b/src/modules/module_15700.c index cb2d939ab..a0f819df7 100644 --- a/src/modules/module_15700.c +++ b/src/modules/module_15700.c @@ -453,6 +453,47 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE return line_len; } +/* + +Find the right -n value for your GPU: +===================================== + +1. For example, to find the value for 15700, first create a valid hash for 15700 as follows: + +$ ./hashcat --example-hashes -m 15700 | grep Example.Hash | grep -v Format | cut -b 25- > tmp.hash.15700 + +2. Now let it iterate through all -n values to a certain point. In this case, I'm using 200, but in general it's a value that is at least twice that of the multiprocessor. If you don't mind you can just leave it as it is, it just runs a little longer. + +$ export i=1; while [ $i -ne 201 ]; do echo $i; ./hashcat --quiet tmp.hash.15700 --keep-guessing --self-test-disable --markov-disable --restore-disable --outfile-autohex-disable --wordlist-autohex-disable --potfile-disable --logfile-disable --hwmon-disable --status --status-timer 1 --runtime 28 --machine-readable --optimized-kernel-enable --workload-profile 3 --hash-type 15700 --attack-mode 3 ?b?b?b?b?b?b?b --backend-devices 1 --force -n $i; i=$(($i+1)); done | tee x + +3. Determine the highest measured H/s speed. But don't just use the highest value. Instead, use the number that seems most stable, usually at the beginning. + +$ grep "$(printf 'STATUS\t3')" x | cut -f4 -d$'\t' | sort -n | tail + +4. To match the speed you have chosen to the correct value in the 'x' file, simply search for it in it. Then go up a little on the block where you found him. The value -n is the single value that begins before the block start. If you have multiple blocks at the same speed, choose the lowest value for -n + +*/ + +const char *module_extra_tuningdb_block (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const char *extra_tuningdb_block = + "DEVICE_TYPE_CPU * 15700 1 N A\n" + "DEVICE_TYPE_GPU * 15700 1 1 A\n" + "GeForce_GTX_980 * 15700 1 24 A\n" + "GeForce_GTX_1080 * 15700 1 28 A\n" + "GeForce_RTX_2080_Ti * 15700 1 68 A\n" + "GeForce_RTX_3060_Ti * 15700 1 11 A\n" + "GeForce_RTX_3070 * 15700 1 22 A\n" + "GeForce_RTX_3090 * 15700 1 82 A\n" + "ALIAS_AMD_RX480 * 15700 1 58 A\n" + "ALIAS_AMD_Vega64 * 15700 1 53 A\n" + "ALIAS_AMD_MI100 * 15700 1 120 A\n" + "ALIAS_AMD_RX6900XT * 15700 1 56 A\n" + ; + + return extra_tuningdb_block; +} + void module_init (module_ctx_t *module_ctx) { module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; @@ -474,6 +515,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = module_extra_buffer_size; module_ctx->module_extra_tmp_size = module_extra_tmp_size; + module_ctx->module_extra_tuningdb_block = module_extra_tuningdb_block; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_15900.c b/src/modules/module_15900.c index b07809107..dec7f761f 100644 --- a/src/modules/module_15900.c +++ b/src/modules/module_15900.c @@ -390,6 +390,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_16000.c b/src/modules/module_16000.c index 03ca3aad9..20640c1b4 100644 --- a/src/modules/module_16000.c +++ b/src/modules/module_16000.c @@ -148,6 +148,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_16100.c b/src/modules/module_16100.c index a1b1f801c..f3a1a6b37 100644 --- a/src/modules/module_16100.c +++ b/src/modules/module_16100.c @@ -205,6 +205,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_16200.c b/src/modules/module_16200.c index 19cbbac8d..0e91d4fa8 100644 --- a/src/modules/module_16200.c +++ b/src/modules/module_16200.c @@ -270,6 +270,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_16300.c b/src/modules/module_16300.c index 33997b1ed..6a9fb4b44 100644 --- a/src/modules/module_16300.c +++ b/src/modules/module_16300.c @@ -283,6 +283,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_16400.c b/src/modules/module_16400.c index d76eba9f8..1ab04d85f 100644 --- a/src/modules/module_16400.c +++ b/src/modules/module_16400.c @@ -130,6 +130,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_16500.c b/src/modules/module_16500.c index bad1e2172..99c6b6e6e 100644 --- a/src/modules/module_16500.c +++ b/src/modules/module_16500.c @@ -350,6 +350,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_16600.c b/src/modules/module_16600.c index 9c92c690e..00d83ce86 100644 --- a/src/modules/module_16600.c +++ b/src/modules/module_16600.c @@ -202,6 +202,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_16700.c b/src/modules/module_16700.c index 5d5ddd234..2e112d6c9 100644 --- a/src/modules/module_16700.c +++ b/src/modules/module_16700.c @@ -241,6 +241,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_16800.c b/src/modules/module_16800.c index 625d2fbf0..ce770ec47 100644 --- a/src/modules/module_16800.c +++ b/src/modules/module_16800.c @@ -518,6 +518,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_16801.c b/src/modules/module_16801.c index 6d237ebf5..9ad6d0f05 100644 --- a/src/modules/module_16801.c +++ b/src/modules/module_16801.c @@ -594,6 +594,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_16900.c b/src/modules/module_16900.c index 93915b592..deb2c17b9 100644 --- a/src/modules/module_16900.c +++ b/src/modules/module_16900.c @@ -306,6 +306,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_17200.c b/src/modules/module_17200.c index 4577fb5f5..8876019cc 100644 --- a/src/modules/module_17200.c +++ b/src/modules/module_17200.c @@ -391,6 +391,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_17210.c b/src/modules/module_17210.c index 326159fed..4c105a6b7 100644 --- a/src/modules/module_17210.c +++ b/src/modules/module_17210.c @@ -384,6 +384,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_17220.c b/src/modules/module_17220.c index 5ad6f6050..6a2c1c921 100644 --- a/src/modules/module_17220.c +++ b/src/modules/module_17220.c @@ -394,6 +394,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_17225.c b/src/modules/module_17225.c index 65128552c..5587928a2 100644 --- a/src/modules/module_17225.c +++ b/src/modules/module_17225.c @@ -395,6 +395,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_17230.c b/src/modules/module_17230.c index c6e720465..d9ceb4eb2 100644 --- a/src/modules/module_17230.c +++ b/src/modules/module_17230.c @@ -389,6 +389,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_17300.c b/src/modules/module_17300.c index fbd89af0f..8544e7dc3 100644 --- a/src/modules/module_17300.c +++ b/src/modules/module_17300.c @@ -125,6 +125,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_17400.c b/src/modules/module_17400.c index 63f5b8598..b8712ebff 100644 --- a/src/modules/module_17400.c +++ b/src/modules/module_17400.c @@ -116,6 +116,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_17500.c b/src/modules/module_17500.c index 6e6c1fa98..3bb07dd52 100644 --- a/src/modules/module_17500.c +++ b/src/modules/module_17500.c @@ -122,6 +122,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_17600.c b/src/modules/module_17600.c index 1974550e7..14ea764b3 100644 --- a/src/modules/module_17600.c +++ b/src/modules/module_17600.c @@ -128,6 +128,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_17700.c b/src/modules/module_17700.c index dd750e526..85a6a7a5d 100644 --- a/src/modules/module_17700.c +++ b/src/modules/module_17700.c @@ -125,6 +125,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_17800.c b/src/modules/module_17800.c index 7c516f071..fa78772df 100644 --- a/src/modules/module_17800.c +++ b/src/modules/module_17800.c @@ -116,6 +116,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_17900.c b/src/modules/module_17900.c index c527ee657..4b097c265 100644 --- a/src/modules/module_17900.c +++ b/src/modules/module_17900.c @@ -122,6 +122,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_18000.c b/src/modules/module_18000.c index 9f1803dc4..1d0f293ef 100644 --- a/src/modules/module_18000.c +++ b/src/modules/module_18000.c @@ -128,6 +128,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_18100.c b/src/modules/module_18100.c index 41c620bdc..58dc7774d 100644 --- a/src/modules/module_18100.c +++ b/src/modules/module_18100.c @@ -158,6 +158,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_18200.c b/src/modules/module_18200.c index f4d32695e..a63ad3242 100644 --- a/src/modules/module_18200.c +++ b/src/modules/module_18200.c @@ -238,6 +238,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_18300.c b/src/modules/module_18300.c index b58ef35f5..d57333137 100644 --- a/src/modules/module_18300.c +++ b/src/modules/module_18300.c @@ -280,6 +280,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_18400.c b/src/modules/module_18400.c index 35670017f..b65cf5613 100644 --- a/src/modules/module_18400.c +++ b/src/modules/module_18400.c @@ -298,6 +298,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_18500.c b/src/modules/module_18500.c index 7a3ab51be..f6308bb58 100644 --- a/src/modules/module_18500.c +++ b/src/modules/module_18500.c @@ -154,6 +154,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_18600.c b/src/modules/module_18600.c index 8f2d05f4c..724759b31 100644 --- a/src/modules/module_18600.c +++ b/src/modules/module_18600.c @@ -386,6 +386,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_18700.c b/src/modules/module_18700.c index c23cc2efc..e306a8694 100644 --- a/src/modules/module_18700.c +++ b/src/modules/module_18700.c @@ -103,6 +103,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_18800.c b/src/modules/module_18800.c index 6847edde2..9b41696d5 100644 --- a/src/modules/module_18800.c +++ b/src/modules/module_18800.c @@ -242,6 +242,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_18900.c b/src/modules/module_18900.c index 55e05f605..0815aa591 100644 --- a/src/modules/module_18900.c +++ b/src/modules/module_18900.c @@ -326,6 +326,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_19000.c b/src/modules/module_19000.c index a3735c2ed..8aaa64c4b 100644 --- a/src/modules/module_19000.c +++ b/src/modules/module_19000.c @@ -196,6 +196,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_19100.c b/src/modules/module_19100.c index 7c663c4bb..29e12726e 100644 --- a/src/modules/module_19100.c +++ b/src/modules/module_19100.c @@ -204,6 +204,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_19200.c b/src/modules/module_19200.c index 3dd7b46f6..997b85b2e 100644 --- a/src/modules/module_19200.c +++ b/src/modules/module_19200.c @@ -221,6 +221,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_19300.c b/src/modules/module_19300.c index 1b0665ac5..a2df62573 100644 --- a/src/modules/module_19300.c +++ b/src/modules/module_19300.c @@ -212,6 +212,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_19500.c b/src/modules/module_19500.c index c0f2ced88..89dac2f18 100644 --- a/src/modules/module_19500.c +++ b/src/modules/module_19500.c @@ -227,6 +227,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_19600.c b/src/modules/module_19600.c index 343b09637..8c30cc4b2 100644 --- a/src/modules/module_19600.c +++ b/src/modules/module_19600.c @@ -313,6 +313,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_19700.c b/src/modules/module_19700.c index 7d353e598..fa7a88396 100644 --- a/src/modules/module_19700.c +++ b/src/modules/module_19700.c @@ -313,6 +313,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_19800.c b/src/modules/module_19800.c index 0ac45ee57..63f647b0f 100644 --- a/src/modules/module_19800.c +++ b/src/modules/module_19800.c @@ -259,6 +259,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_19900.c b/src/modules/module_19900.c index 644968c04..7986b3d59 100644 --- a/src/modules/module_19900.c +++ b/src/modules/module_19900.c @@ -259,6 +259,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_20011.c b/src/modules/module_20011.c index 7bd94888a..676ac2625 100644 --- a/src/modules/module_20011.c +++ b/src/modules/module_20011.c @@ -214,6 +214,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_20012.c b/src/modules/module_20012.c index 58f88b2c6..a82d0d86e 100644 --- a/src/modules/module_20012.c +++ b/src/modules/module_20012.c @@ -214,6 +214,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_20013.c b/src/modules/module_20013.c index 0ecd72c8a..ba37844e6 100644 --- a/src/modules/module_20013.c +++ b/src/modules/module_20013.c @@ -214,6 +214,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_20200.c b/src/modules/module_20200.c index 9f18dc7d9..04391c4cd 100644 --- a/src/modules/module_20200.c +++ b/src/modules/module_20200.c @@ -241,6 +241,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_20300.c b/src/modules/module_20300.c index 0624b8dce..558c21807 100644 --- a/src/modules/module_20300.c +++ b/src/modules/module_20300.c @@ -240,6 +240,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_20400.c b/src/modules/module_20400.c index 5df332861..ae590dfc0 100644 --- a/src/modules/module_20400.c +++ b/src/modules/module_20400.c @@ -233,6 +233,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_20500.c b/src/modules/module_20500.c index f568d2dc3..b68bd0942 100644 --- a/src/modules/module_20500.c +++ b/src/modules/module_20500.c @@ -170,6 +170,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_20510.c b/src/modules/module_20510.c index d3a34a961..8393be7ab 100644 --- a/src/modules/module_20510.c +++ b/src/modules/module_20510.c @@ -209,6 +209,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_20600.c b/src/modules/module_20600.c index e270fde50..067132211 100644 --- a/src/modules/module_20600.c +++ b/src/modules/module_20600.c @@ -201,6 +201,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_20710.c b/src/modules/module_20710.c index 08f407ef4..8934a8421 100644 --- a/src/modules/module_20710.c +++ b/src/modules/module_20710.c @@ -198,6 +198,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_20711.c b/src/modules/module_20711.c index 2fb69ce2c..10a1c6752 100644 --- a/src/modules/module_20711.c +++ b/src/modules/module_20711.c @@ -233,6 +233,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_20720.c b/src/modules/module_20720.c index 72992bc1f..300d3fe14 100644 --- a/src/modules/module_20720.c +++ b/src/modules/module_20720.c @@ -198,6 +198,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_20800.c b/src/modules/module_20800.c index 65f4acb82..a0bed9d21 100644 --- a/src/modules/module_20800.c +++ b/src/modules/module_20800.c @@ -175,6 +175,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_20900.c b/src/modules/module_20900.c index 6e269034a..87c16b87b 100644 --- a/src/modules/module_20900.c +++ b/src/modules/module_20900.c @@ -137,6 +137,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_21000.c b/src/modules/module_21000.c index 7df98beb4..eefe6a3be 100644 --- a/src/modules/module_21000.c +++ b/src/modules/module_21000.c @@ -216,6 +216,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_21100.c b/src/modules/module_21100.c index c1fc210ec..fa21ecfab 100644 --- a/src/modules/module_21100.c +++ b/src/modules/module_21100.c @@ -180,6 +180,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_21200.c b/src/modules/module_21200.c index 3a99a2cbd..be284a2a8 100644 --- a/src/modules/module_21200.c +++ b/src/modules/module_21200.c @@ -194,6 +194,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_21300.c b/src/modules/module_21300.c index e35e0160a..c2375b191 100644 --- a/src/modules/module_21300.c +++ b/src/modules/module_21300.c @@ -162,6 +162,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_21400.c b/src/modules/module_21400.c index d941c58de..de990db62 100644 --- a/src/modules/module_21400.c +++ b/src/modules/module_21400.c @@ -175,6 +175,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_21500.c b/src/modules/module_21500.c index f6c68655b..3a4ebe850 100644 --- a/src/modules/module_21500.c +++ b/src/modules/module_21500.c @@ -243,6 +243,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_21501.c b/src/modules/module_21501.c index 33285c18b..ca2d3868e 100644 --- a/src/modules/module_21501.c +++ b/src/modules/module_21501.c @@ -251,6 +251,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_21600.c b/src/modules/module_21600.c index 8112d0813..a965b3c72 100644 --- a/src/modules/module_21600.c +++ b/src/modules/module_21600.c @@ -174,6 +174,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_21700.c b/src/modules/module_21700.c index 8152d57e2..f66ef6c62 100644 --- a/src/modules/module_21700.c +++ b/src/modules/module_21700.c @@ -267,6 +267,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_21800.c b/src/modules/module_21800.c index c256d5d5c..449277f2b 100644 --- a/src/modules/module_21800.c +++ b/src/modules/module_21800.c @@ -294,6 +294,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_22000.c b/src/modules/module_22000.c index 2b5f60cfb..41ed137dc 100644 --- a/src/modules/module_22000.c +++ b/src/modules/module_22000.c @@ -1292,6 +1292,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = module_hash_binary_count; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_22001.c b/src/modules/module_22001.c index dd45f3bd2..7f4e3d458 100644 --- a/src/modules/module_22001.c +++ b/src/modules/module_22001.c @@ -1293,6 +1293,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = module_hash_binary_count; module_ctx->module_hash_binary_parse = module_hash_binary_parse; diff --git a/src/modules/module_22100.c b/src/modules/module_22100.c index 09ad806ae..fb1e34f2c 100644 --- a/src/modules/module_22100.c +++ b/src/modules/module_22100.c @@ -444,6 +444,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_22200.c b/src/modules/module_22200.c index 5ea525fbe..cf559881a 100644 --- a/src/modules/module_22200.c +++ b/src/modules/module_22200.c @@ -247,6 +247,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_22300.c b/src/modules/module_22300.c index a5fde60de..bc1c5606c 100644 --- a/src/modules/module_22300.c +++ b/src/modules/module_22300.c @@ -198,6 +198,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_22301.c b/src/modules/module_22301.c index 9f96f4d0b..e2b115793 100644 --- a/src/modules/module_22301.c +++ b/src/modules/module_22301.c @@ -200,6 +200,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_22400.c b/src/modules/module_22400.c index a3ab81101..5d1823af0 100644 --- a/src/modules/module_22400.c +++ b/src/modules/module_22400.c @@ -321,6 +321,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_22500.c b/src/modules/module_22500.c index e30543f30..4050b261d 100644 --- a/src/modules/module_22500.c +++ b/src/modules/module_22500.c @@ -188,6 +188,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_22600.c b/src/modules/module_22600.c index 798bf88ab..d0203cf63 100644 --- a/src/modules/module_22600.c +++ b/src/modules/module_22600.c @@ -243,6 +243,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_22700.c b/src/modules/module_22700.c index 599144173..fb47b71d9 100644 --- a/src/modules/module_22700.c +++ b/src/modules/module_22700.c @@ -392,6 +392,47 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE return line_len; } +/* + +Find the right -n value for your GPU: +===================================== + +1. For example, to find the value for 22700, first create a valid hash for 22700 as follows: + +$ ./hashcat --example-hashes -m 22700 | grep Example.Hash | grep -v Format | cut -b 25- > tmp.hash.22700 + +2. Now let it iterate through all -n values to a certain point. In this case, I'm using 200, but in general it's a value that is at least twice that of the multiprocessor. If you don't mind you can just leave it as it is, it just runs a little longer. + +$ export i=1; while [ $i -ne 201 ]; do echo $i; ./hashcat --quiet tmp.hash.22700 --keep-guessing --self-test-disable --markov-disable --restore-disable --outfile-autohex-disable --wordlist-autohex-disable --potfile-disable --logfile-disable --hwmon-disable --status --status-timer 1 --runtime 28 --machine-readable --optimized-kernel-enable --workload-profile 3 --hash-type 22700 --attack-mode 3 ?b?b?b?b?b?b?b --backend-devices 1 --force -n $i; i=$(($i+1)); done | tee x + +3. Determine the highest measured H/s speed. But don't just use the highest value. Instead, use the number that seems most stable, usually at the beginning. + +$ grep "$(printf 'STATUS\t3')" x | cut -f4 -d$'\t' | sort -n | tail + +4. To match the speed you have chosen to the correct value in the 'x' file, simply search for it in it. Then go up a little on the block where you found him. The value -n is the single value that begins before the block start. If you have multiple blocks at the same speed, choose the lowest value for -n + +*/ + +const char *module_extra_tuningdb_block (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const char *extra_tuningdb_block = + "DEVICE_TYPE_CPU * 22700 1 N A\n" + "DEVICE_TYPE_GPU * 22700 1 N A\n" + "GeForce_GTX_980 * 22700 1 29 A\n" + "GeForce_GTX_1080 * 22700 1 15 A\n" + "GeForce_RTX_2080_Ti * 22700 1 68 A\n" + "GeForce_RTX_3060_Ti * 22700 1 51 A\n" + "GeForce_RTX_3070 * 22700 1 46 A\n" + "GeForce_RTX_3090 * 22700 1 82 A\n" + "ALIAS_AMD_RX480 * 22700 1 15 A\n" + "ALIAS_AMD_Vega64 * 22700 1 31 A\n" + "ALIAS_AMD_MI100 * 22700 1 79 A\n" + "ALIAS_AMD_RX6900XT * 22700 1 59 A\n" + ; + + return extra_tuningdb_block; +} + void module_init (module_ctx_t *module_ctx) { module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; @@ -413,6 +454,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = module_extra_buffer_size; module_ctx->module_extra_tmp_size = module_extra_tmp_size; + module_ctx->module_extra_tuningdb_block = module_extra_tuningdb_block; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_22911.c b/src/modules/module_22911.c index 26e11c5bd..82010e63d 100644 --- a/src/modules/module_22911.c +++ b/src/modules/module_22911.c @@ -210,6 +210,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_22921.c b/src/modules/module_22921.c index b6dc3c425..16a6b4e12 100644 --- a/src/modules/module_22921.c +++ b/src/modules/module_22921.c @@ -210,6 +210,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_22931.c b/src/modules/module_22931.c index bb6d1a641..03a02db6f 100644 --- a/src/modules/module_22931.c +++ b/src/modules/module_22931.c @@ -214,6 +214,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_22941.c b/src/modules/module_22941.c index 71743996c..33cf0dfa3 100644 --- a/src/modules/module_22941.c +++ b/src/modules/module_22941.c @@ -214,6 +214,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_22951.c b/src/modules/module_22951.c index 64e6a1fce..5fe52ad0d 100644 --- a/src/modules/module_22951.c +++ b/src/modules/module_22951.c @@ -214,6 +214,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_23001.c b/src/modules/module_23001.c index 40f6d76bd..39c5591c4 100644 --- a/src/modules/module_23001.c +++ b/src/modules/module_23001.c @@ -262,6 +262,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_23002.c b/src/modules/module_23002.c index b151974e0..4b5e8a1de 100644 --- a/src/modules/module_23002.c +++ b/src/modules/module_23002.c @@ -262,6 +262,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_23003.c b/src/modules/module_23003.c index 5a033c1fa..6bba6c558 100644 --- a/src/modules/module_23003.c +++ b/src/modules/module_23003.c @@ -262,6 +262,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_23100.c b/src/modules/module_23100.c index e5d9db05e..1ebf74b86 100644 --- a/src/modules/module_23100.c +++ b/src/modules/module_23100.c @@ -221,6 +221,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_23200.c b/src/modules/module_23200.c index 72f8325a5..81b4ebda9 100644 --- a/src/modules/module_23200.c +++ b/src/modules/module_23200.c @@ -206,6 +206,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_23300.c b/src/modules/module_23300.c index b5be729eb..4b53432ce 100644 --- a/src/modules/module_23300.c +++ b/src/modules/module_23300.c @@ -274,6 +274,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_23400.c b/src/modules/module_23400.c index 5921ca9db..a96711c99 100644 --- a/src/modules/module_23400.c +++ b/src/modules/module_23400.c @@ -260,6 +260,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_23500.c b/src/modules/module_23500.c index e0607a8d4..4e75a8896 100644 --- a/src/modules/module_23500.c +++ b/src/modules/module_23500.c @@ -299,6 +299,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_23600.c b/src/modules/module_23600.c index a0dde6ca8..95f5650fa 100644 --- a/src/modules/module_23600.c +++ b/src/modules/module_23600.c @@ -299,6 +299,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_23700.c b/src/modules/module_23700.c index 26a24c16f..8122a00f5 100644 --- a/src/modules/module_23700.c +++ b/src/modules/module_23700.c @@ -338,6 +338,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_23800.c b/src/modules/module_23800.c index 1ca597082..793269dc9 100644 --- a/src/modules/module_23800.c +++ b/src/modules/module_23800.c @@ -615,6 +615,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_23900.c b/src/modules/module_23900.c index 35ef8df35..5f3ffd91a 100644 --- a/src/modules/module_23900.c +++ b/src/modules/module_23900.c @@ -230,6 +230,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_24100.c b/src/modules/module_24100.c index cd9b4d9c9..da8faa353 100644 --- a/src/modules/module_24100.c +++ b/src/modules/module_24100.c @@ -294,6 +294,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_24200.c b/src/modules/module_24200.c index bd93b36e0..ae9555459 100644 --- a/src/modules/module_24200.c +++ b/src/modules/module_24200.c @@ -334,6 +334,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_24300.c b/src/modules/module_24300.c index 14770ff33..fbc1a4761 100644 --- a/src/modules/module_24300.c +++ b/src/modules/module_24300.c @@ -158,6 +158,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_24410.c b/src/modules/module_24410.c index 1a6b4274c..b8e1471c5 100644 --- a/src/modules/module_24410.c +++ b/src/modules/module_24410.c @@ -307,6 +307,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_24420.c b/src/modules/module_24420.c index c45de065e..901a8e5e5 100644 --- a/src/modules/module_24420.c +++ b/src/modules/module_24420.c @@ -307,6 +307,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_24500.c b/src/modules/module_24500.c index 2df2eebc1..3b8155a29 100644 --- a/src/modules/module_24500.c +++ b/src/modules/module_24500.c @@ -265,6 +265,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_24600.c b/src/modules/module_24600.c index 7a2ef5dc6..40b54927a 100644 --- a/src/modules/module_24600.c +++ b/src/modules/module_24600.c @@ -299,6 +299,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_24700.c b/src/modules/module_24700.c index e50df1c2f..a0ac82ecc 100644 --- a/src/modules/module_24700.c +++ b/src/modules/module_24700.c @@ -130,6 +130,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_24800.c b/src/modules/module_24800.c index c978cb358..3bde578d6 100644 --- a/src/modules/module_24800.c +++ b/src/modules/module_24800.c @@ -130,6 +130,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_24900.c b/src/modules/module_24900.c index b68b1e639..1ea5504a1 100644 --- a/src/modules/module_24900.c +++ b/src/modules/module_24900.c @@ -158,6 +158,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_25000.c b/src/modules/module_25000.c index deac74055..865f1212f 100644 --- a/src/modules/module_25000.c +++ b/src/modules/module_25000.c @@ -286,6 +286,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_25100.c b/src/modules/module_25100.c index 4fdbdf828..a8b299e46 100644 --- a/src/modules/module_25100.c +++ b/src/modules/module_25100.c @@ -267,6 +267,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_25200.c b/src/modules/module_25200.c index 66573cb5a..c2173ef4a 100644 --- a/src/modules/module_25200.c +++ b/src/modules/module_25200.c @@ -278,6 +278,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_25300.c b/src/modules/module_25300.c index e21d55881..6aaa4658c 100644 --- a/src/modules/module_25300.c +++ b/src/modules/module_25300.c @@ -260,6 +260,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_25400.c b/src/modules/module_25400.c index 6325bf737..d96dd00fb 100644 --- a/src/modules/module_25400.c +++ b/src/modules/module_25400.c @@ -466,6 +466,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_25500.c b/src/modules/module_25500.c index f858e3062..c208cc891 100644 --- a/src/modules/module_25500.c +++ b/src/modules/module_25500.c @@ -314,6 +314,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_25600.c b/src/modules/module_25600.c index 561c04d77..00b0a4568 100644 --- a/src/modules/module_25600.c +++ b/src/modules/module_25600.c @@ -296,6 +296,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_25700.c b/src/modules/module_25700.c index a142ea26c..a50f5cd7e 100644 --- a/src/modules/module_25700.c +++ b/src/modules/module_25700.c @@ -134,6 +134,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_25800.c b/src/modules/module_25800.c index 154e9bc5c..70faf02b5 100644 --- a/src/modules/module_25800.c +++ b/src/modules/module_25800.c @@ -296,6 +296,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_25900.c b/src/modules/module_25900.c index c44a1642b..94a2d4d93 100644 --- a/src/modules/module_25900.c +++ b/src/modules/module_25900.c @@ -282,6 +282,7 @@ void module_init(module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_26000.c b/src/modules/module_26000.c index 585a92fdb..81a493637 100644 --- a/src/modules/module_26000.c +++ b/src/modules/module_26000.c @@ -207,6 +207,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_26100.c b/src/modules/module_26100.c index 2a6478828..896ae5780 100644 --- a/src/modules/module_26100.c +++ b/src/modules/module_26100.c @@ -263,6 +263,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_26200.c b/src/modules/module_26200.c index 8b082f2d5..4ae7f8d5a 100644 --- a/src/modules/module_26200.c +++ b/src/modules/module_26200.c @@ -141,6 +141,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_26300.c b/src/modules/module_26300.c index a07167582..0dbac9345 100644 --- a/src/modules/module_26300.c +++ b/src/modules/module_26300.c @@ -207,6 +207,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_26401.c b/src/modules/module_26401.c index d8341b6b6..9f9244ff3 100644 --- a/src/modules/module_26401.c +++ b/src/modules/module_26401.c @@ -148,6 +148,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_26402.c b/src/modules/module_26402.c index ecf1f03a1..8f7a2806f 100644 --- a/src/modules/module_26402.c +++ b/src/modules/module_26402.c @@ -148,6 +148,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_26403.c b/src/modules/module_26403.c index c7c5fd11e..ccc3793c2 100644 --- a/src/modules/module_26403.c +++ b/src/modules/module_26403.c @@ -148,6 +148,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_26500.c b/src/modules/module_26500.c index b473bd0fb..9574c92a4 100644 --- a/src/modules/module_26500.c +++ b/src/modules/module_26500.c @@ -259,6 +259,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_26600.c b/src/modules/module_26600.c index c9e04958c..ffa3d8a79 100644 --- a/src/modules/module_26600.c +++ b/src/modules/module_26600.c @@ -334,6 +334,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_26700.c b/src/modules/module_26700.c index c64f269cf..b78d43c8c 100644 --- a/src/modules/module_26700.c +++ b/src/modules/module_26700.c @@ -280,6 +280,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_26800.c b/src/modules/module_26800.c index 1eb4aac43..9f35d308f 100644 --- a/src/modules/module_26800.c +++ b/src/modules/module_26800.c @@ -288,6 +288,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_99999.c b/src/modules/module_99999.c index 0611c7ef6..ee0ce0dcb 100644 --- a/src/modules/module_99999.c +++ b/src/modules/module_99999.c @@ -139,6 +139,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = MODULE_DEFAULT; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/tuningdb.c b/src/tuningdb.c index f487c128c..d16e7517a 100644 --- a/src/tuningdb.c +++ b/src/tuningdb.c @@ -11,7 +11,7 @@ #include "shared.h" #include "tuningdb.h" -static int sort_by_tuning_db_alias (const void *v1, const void *v2) +int sort_by_tuning_db_alias (const void *v1, const void *v2) { const tuning_db_alias_t *t1 = (const tuning_db_alias_t *) v1; const tuning_db_alias_t *t2 = (const tuning_db_alias_t *) v2; @@ -23,7 +23,7 @@ static int sort_by_tuning_db_alias (const void *v1, const void *v2) return 0; } -static int sort_by_tuning_db_entry (const void *v1, const void *v2) +int sort_by_tuning_db_entry (const void *v1, const void *v2) { const tuning_db_entry_t *t1 = (const tuning_db_entry_t *) v1; const tuning_db_entry_t *t2 = (const tuning_db_entry_t *) v2; @@ -47,10 +47,9 @@ static int sort_by_tuning_db_entry (const void *v1, const void *v2) int tuning_db_init (hashcat_ctx_t *hashcat_ctx) { - folder_config_t *folder_config = hashcat_ctx->folder_config; - tuning_db_t *tuning_db = hashcat_ctx->tuning_db; - user_options_t *user_options = hashcat_ctx->user_options; - user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra; + folder_config_t *folder_config = hashcat_ctx->folder_config; + tuning_db_t *tuning_db = hashcat_ctx->tuning_db; + user_options_t *user_options = hashcat_ctx->user_options; tuning_db->enabled = false; @@ -80,18 +79,6 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx) hcfree (tuning_db_file); - const size_t num_lines = count_lines (&fp); - - // a bit over-allocated - - tuning_db->alias_buf = (tuning_db_alias_t *) hccalloc (num_lines + 1, sizeof (tuning_db_alias_t)); - tuning_db->alias_cnt = 0; - - tuning_db->entry_buf = (tuning_db_entry_t *) hccalloc (num_lines + 1, sizeof (tuning_db_entry_t)); - tuning_db->entry_cnt = 0; - - hc_rewind (&fp); - int line_num = 0; char *buf = (char *) hcmalloc (HCBUFSIZ_LARGE); @@ -110,211 +97,253 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx) if (line_buf[0] == '#') continue; - // start processing + tuning_db_process_line (hashcat_ctx, line_buf, line_num); + } - char *token_ptr[7] = { NULL }; + hcfree (buf); - int token_cnt = 0; + hc_fclose (&fp); - char *saveptr = NULL; + // todo: print loaded 'cnt' message - char *next = strtok_r (line_buf, "\t ", &saveptr); + // sort the database - token_ptr[token_cnt] = next; + qsort (tuning_db->alias_buf, tuning_db->alias_cnt, sizeof (tuning_db_alias_t), sort_by_tuning_db_alias); + qsort (tuning_db->entry_buf, tuning_db->entry_cnt, sizeof (tuning_db_entry_t), sort_by_tuning_db_entry); - token_cnt++; + return 0; +} - while ((next = strtok_r ((char *) NULL, "\t ", &saveptr)) != NULL) - { - token_ptr[token_cnt] = next; +void tuning_db_destroy (hashcat_ctx_t *hashcat_ctx) +{ + tuning_db_t *tuning_db = hashcat_ctx->tuning_db; - token_cnt++; - } + if (tuning_db->enabled == false) return; - if (token_cnt == 2) - { - char *device_name = token_ptr[0]; - char *alias_name = token_ptr[1]; + int i; - tuning_db_alias_t *alias = &tuning_db->alias_buf[tuning_db->alias_cnt]; + for (i = 0; i < tuning_db->alias_cnt; i++) + { + tuning_db_alias_t *alias = &tuning_db->alias_buf[i]; - alias->device_name = hcstrdup (device_name); - alias->alias_name = hcstrdup (alias_name); + hcfree (alias->device_name); + hcfree (alias->alias_name); + } - tuning_db->alias_cnt++; - } - else if (token_cnt == 6) - { - if ((token_ptr[1][0] != '0') && - (token_ptr[1][0] != '1') && - (token_ptr[1][0] != '3') && - (token_ptr[1][0] != '9') && - (token_ptr[1][0] != '*')) - { - event_log_warning (hashcat_ctx, "Tuning-db: Invalid attack_mode '%c' in Line '%d'", token_ptr[1][0], line_num); + for (i = 0; i < tuning_db->entry_cnt; i++) + { + tuning_db_entry_t *entry = &tuning_db->entry_buf[i]; - continue; - } + hcfree ((void *)entry->device_name); + } - if ((token_ptr[3][0] != '1') && - (token_ptr[3][0] != '2') && - (token_ptr[3][0] != '4') && - (token_ptr[3][0] != '8') && - (token_ptr[3][0] != 'N')) - { - event_log_warning (hashcat_ctx, "Tuning-db: Invalid vector_width '%c' in Line '%d'", token_ptr[3][0], line_num); + hcfree (tuning_db->alias_buf); + hcfree (tuning_db->entry_buf); - continue; - } + memset (tuning_db, 0, sizeof (tuning_db_t)); +} - char *device_name = token_ptr[0]; +bool tuning_db_process_line (hashcat_ctx_t *hashcat_ctx, const char *line_buf, const int line_num) +{ + tuning_db_t *tuning_db = hashcat_ctx->tuning_db; + user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra; - int attack_mode = -1; - int hash_mode = -1; - int vector_width = -1; - int kernel_accel = -1; - int kernel_loops = -1; + #define ADD_DB_ENTRIES 1 - if (token_ptr[1][0] != '*') attack_mode = (int) strtol (token_ptr[1], NULL, 10); - if (token_ptr[2][0] != '*') hash_mode = (int) strtol (token_ptr[2], NULL, 10); - if (token_ptr[3][0] != 'N') vector_width = (int) strtol (token_ptr[3], NULL, 10); + if (tuning_db->alias_cnt == tuning_db->alias_alloc) + { + tuning_db->alias_buf = (tuning_db_alias_t *) hcrealloc (tuning_db->alias_buf, tuning_db->alias_alloc * sizeof (tuning_db_alias_t), ADD_DB_ENTRIES * sizeof (tuning_db_alias_t)); + tuning_db->alias_alloc += ADD_DB_ENTRIES; + } - if (token_ptr[4][0] == 'A') - { - kernel_accel = 0; - } - else if (token_ptr[4][0] == 'M') - { - kernel_accel = 1024; - } - else if (token_ptr[4][0] == 'N') - { - kernel_accel = -1; - } - else - { - kernel_accel = (int) strtol (token_ptr[4], NULL, 10); + if (tuning_db->entry_cnt == tuning_db->entry_alloc) + { + tuning_db->entry_buf = (tuning_db_entry_t *) hcrealloc (tuning_db->entry_buf, tuning_db->entry_alloc * sizeof (tuning_db_entry_t), ADD_DB_ENTRIES * sizeof (tuning_db_entry_t)); + tuning_db->entry_alloc += ADD_DB_ENTRIES; + } - if ((kernel_accel < 1) || (kernel_accel > 1024)) - { - event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_accel '%d' in Line '%d'", kernel_accel, line_num); + char *buf = hcstrdup (line_buf); - continue; - } - } + char *token_ptr[7] = { NULL }; - if (token_ptr[5][0] == 'A') - { - kernel_loops = 0; - } - else if (token_ptr[5][0] == 'M') - { - if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) - { - kernel_loops = KERNEL_RULES; - } - else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) - { - kernel_loops = KERNEL_COMBS; - } - else if (user_options_extra->attack_kern == ATTACK_KERN_BF) - { - kernel_loops = KERNEL_BFS; - } - } - else - { - kernel_loops = (int) strtol (token_ptr[5], NULL, 10); + int token_cnt = 0; - if (kernel_loops < 1) - { - event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_loops '%d' in Line '%d'", kernel_loops, line_num); + char *saveptr = NULL; - continue; - } + char *next = strtok_r (buf, "\t ", &saveptr); - if ((user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) && (kernel_loops > KERNEL_RULES)) - { - event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_loops '%d' in Line '%d'", kernel_loops, line_num); + token_ptr[token_cnt] = next; - continue; - } + token_cnt++; - if ((user_options_extra->attack_kern == ATTACK_KERN_COMBI) && (kernel_loops > KERNEL_COMBS)) - { - event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_loops '%d' in Line '%d'", kernel_loops, line_num); + while ((next = strtok_r ((char *) NULL, "\t ", &saveptr)) != NULL) + { + token_ptr[token_cnt] = next; - continue; - } + token_cnt++; + } - if ((user_options_extra->attack_kern == ATTACK_KERN_BF) && (kernel_loops > KERNEL_BFS)) - { - event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_loops '%d' in Line '%d'", kernel_loops, line_num); + if (token_cnt == 2) + { + char *device_name = token_ptr[0]; + char *alias_name = token_ptr[1]; - continue; - } - } + tuning_db_alias_t *alias = &tuning_db->alias_buf[tuning_db->alias_cnt]; + + alias->device_name = hcstrdup (device_name); + alias->alias_name = hcstrdup (alias_name); + + tuning_db->alias_cnt++; + } + else if (token_cnt == 6) + { + if ((token_ptr[1][0] != '0') && + (token_ptr[1][0] != '1') && + (token_ptr[1][0] != '3') && + (token_ptr[1][0] != '9') && + (token_ptr[1][0] != '*')) + { + event_log_warning (hashcat_ctx, "Tuning-db: Invalid attack_mode '%c' in Line '%d'", token_ptr[1][0], line_num); - tuning_db_entry_t *entry = &tuning_db->entry_buf[tuning_db->entry_cnt]; + hcfree (buf); - entry->device_name = hcstrdup (device_name); - entry->attack_mode = attack_mode; - entry->hash_mode = hash_mode; - entry->vector_width = vector_width; - entry->kernel_accel = kernel_accel; - entry->kernel_loops = kernel_loops; + return false; + } + + if ((token_ptr[3][0] != '1') && + (token_ptr[3][0] != '2') && + (token_ptr[3][0] != '4') && + (token_ptr[3][0] != '8') && + (token_ptr[3][0] != 'N')) + { + event_log_warning (hashcat_ctx, "Tuning-db: Invalid vector_width '%c' in Line '%d'", token_ptr[3][0], line_num); + + hcfree (buf); + + return false; + } + + char *device_name = token_ptr[0]; + + int attack_mode = -1; + int hash_mode = -1; + int vector_width = -1; + int kernel_accel = -1; + int kernel_loops = -1; - tuning_db->entry_cnt++; + if (token_ptr[1][0] != '*') attack_mode = (int) strtol (token_ptr[1], NULL, 10); + if (token_ptr[2][0] != '*') hash_mode = (int) strtol (token_ptr[2], NULL, 10); + if (token_ptr[3][0] != 'N') vector_width = (int) strtol (token_ptr[3], NULL, 10); + + if (token_ptr[4][0] == 'A') + { + kernel_accel = 0; + } + else if (token_ptr[4][0] == 'M') + { + kernel_accel = 1024; + } + else if (token_ptr[4][0] == 'N') + { + kernel_accel = -1; } else { - event_log_warning (hashcat_ctx, "Tuning-db: Invalid number of token in Line '%d'", line_num); + kernel_accel = (int) strtol (token_ptr[4], NULL, 10); + + if ((kernel_accel < 1) || (kernel_accel > 1024)) + { + event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_accel '%d' in Line '%d'", kernel_accel, line_num); + + hcfree (buf); - continue; + return false; + } } - } - hcfree (buf); + if (token_ptr[5][0] == 'A') + { + kernel_loops = 0; + } + else if (token_ptr[5][0] == 'M') + { + if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) + { + kernel_loops = KERNEL_RULES; + } + else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) + { + kernel_loops = KERNEL_COMBS; + } + else if (user_options_extra->attack_kern == ATTACK_KERN_BF) + { + kernel_loops = KERNEL_BFS; + } + } + else + { + kernel_loops = (int) strtol (token_ptr[5], NULL, 10); - hc_fclose (&fp); + if (kernel_loops < 1) + { + event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_loops '%d' in Line '%d'", kernel_loops, line_num); - // todo: print loaded 'cnt' message + hcfree (buf); - // sort the database + return false; + } - qsort (tuning_db->alias_buf, tuning_db->alias_cnt, sizeof (tuning_db_alias_t), sort_by_tuning_db_alias); - qsort (tuning_db->entry_buf, tuning_db->entry_cnt, sizeof (tuning_db_entry_t), sort_by_tuning_db_entry); + if ((user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) && (kernel_loops > KERNEL_RULES)) + { + event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_loops '%d' in Line '%d'", kernel_loops, line_num); - return 0; -} + hcfree (buf); -void tuning_db_destroy (hashcat_ctx_t *hashcat_ctx) -{ - tuning_db_t *tuning_db = hashcat_ctx->tuning_db; + return false; + } - if (tuning_db->enabled == false) return; + if ((user_options_extra->attack_kern == ATTACK_KERN_COMBI) && (kernel_loops > KERNEL_COMBS)) + { + event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_loops '%d' in Line '%d'", kernel_loops, line_num); - int i; + hcfree (buf); - for (i = 0; i < tuning_db->alias_cnt; i++) - { - tuning_db_alias_t *alias = &tuning_db->alias_buf[i]; + return false; + } - hcfree (alias->device_name); - hcfree (alias->alias_name); - } + if ((user_options_extra->attack_kern == ATTACK_KERN_BF) && (kernel_loops > KERNEL_BFS)) + { + event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_loops '%d' in Line '%d'", kernel_loops, line_num); - for (i = 0; i < tuning_db->entry_cnt; i++) + hcfree (buf); + + return false; + } + } + + tuning_db_entry_t *entry = &tuning_db->entry_buf[tuning_db->entry_cnt]; + + entry->device_name = hcstrdup (device_name); + entry->attack_mode = attack_mode; + entry->hash_mode = hash_mode; + entry->vector_width = vector_width; + entry->kernel_accel = kernel_accel; + entry->kernel_loops = kernel_loops; + + tuning_db->entry_cnt++; + } + else { - tuning_db_entry_t *entry = &tuning_db->entry_buf[i]; + event_log_warning (hashcat_ctx, "Tuning-db: Invalid number of token in Line '%d'", line_num); - hcfree ((void *)entry->device_name); + hcfree (buf); + + return false; } - hcfree (tuning_db->alias_buf); - hcfree (tuning_db->entry_buf); + hcfree (buf); - memset (tuning_db, 0, sizeof (tuning_db_t)); + return true; } tuning_db_entry_t *tuning_db_search_real (hashcat_ctx_t *hashcat_ctx, const char *device_name, const cl_device_type device_type, int attack_mode, const int hash_mode) @@ -435,13 +464,22 @@ tuning_db_entry_t *tuning_db_search (hashcat_ctx_t *hashcat_ctx, const char *dev const char *NV_prefix = (const char *) "NVIDIA "; - if (strlen(device_name) >= strlen(NV_prefix) && memcmp (device_name, NV_prefix, strlen (NV_prefix)) == 0) + if (strncmp (device_name, NV_prefix, strlen (NV_prefix)) == 0) { entry = tuning_db_search_real (hashcat_ctx, device_name + strlen (NV_prefix), device_type, attack_mode, hash_mode); if (entry) return entry; } + const char *AMD_prefix = (const char *) "AMD "; + + if (strncmp (device_name, AMD_prefix, strlen (AMD_prefix)) == 0) + { + entry = tuning_db_search_real (hashcat_ctx, device_name + strlen (AMD_prefix), device_type, attack_mode, hash_mode); + + if (entry) return entry; + } + entry = tuning_db_search_real (hashcat_ctx, device_name, device_type, attack_mode, hash_mode); return entry; From 3ba02f11ea331b9cb3d74774046c673e084727aa Mon Sep 17 00:00:00 2001 From: Michael Kruger Date: Mon, 2 Aug 2021 11:40:14 +0200 Subject: [PATCH 56/64] Expect Hex input, removed OPTS_TYPE_PT_ALWAYS_HEXIFY, added benchmark mask. --- OpenCL/m27000-pure.cl | 137 ++++++++++++++++++++--------------- OpenCL/m27100-pure.cl | 142 +++++++++++++++++++++++-------------- src/modules/module_27000.c | 20 +++--- src/modules/module_27100.c | 20 +++--- 4 files changed, 190 insertions(+), 129 deletions(-) diff --git a/OpenCL/m27000-pure.cl b/OpenCL/m27000-pure.cl index a5ce12cff..a35d2e039 100644 --- a/OpenCL/m27000-pure.cl +++ b/OpenCL/m27000-pure.cl @@ -493,6 +493,23 @@ DECLSPEC void transform_netntlmv1_key (const u32 w0, const u32 w1, u32 *out) | ((k[7] & 0xff) << 24); } +#ifdef KERNEL_STATIC +DECLSPEC u8 hex_convert (const u8 c) +{ + return (c & 15) + (c >> 6) * 9; +} + +DECLSPEC u8 hex_to_u8 (const u8 *hex) +{ + u8 v = 0; + + v |= ((u8) hex_convert (hex[1]) << 0); + v |= ((u8) hex_convert (hex[0]) << 4); + + return (v); +} +#endif + typedef struct netntlm { u32 user_len; @@ -527,23 +544,52 @@ KERNEL_FQ void m27000_init (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) * salt */ - tmps[gid].digest_buf[0] = pws[gid].i[ 0]; - tmps[gid].digest_buf[1] = pws[gid].i[ 1]; - tmps[gid].digest_buf[2] = pws[gid].i[ 2]; - tmps[gid].digest_buf[3] = pws[gid].i[ 3]; + u32 in[16]; + + in[ 0] = pws[gid].i[ 0]; + in[ 1] = pws[gid].i[ 1]; + in[ 2] = pws[gid].i[ 2]; + in[ 3] = pws[gid].i[ 3]; + in[ 4] = pws[gid].i[ 4]; + in[ 5] = pws[gid].i[ 5]; + in[ 6] = pws[gid].i[ 6]; + in[ 7] = pws[gid].i[ 7]; + + u8 *in_ptr = (u8 *) in; + + u32 out[4]; + + u8 *out_ptr = (u8 *) out; + + for (int i = 0, j = 0; i < 16; i += 1, j += 2) + { + out_ptr[i] = hex_to_u8 (in_ptr + j); + } + + tmps[gid].digest_buf[0] = out[ 0]; + tmps[gid].digest_buf[1] = out[ 1]; + tmps[gid].digest_buf[2] = out[ 2]; + tmps[gid].digest_buf[3] = out[ 3]; } KERNEL_FQ void m27000_loop (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) { - /** +} + +KERNEL_FQ void m27000_comp (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) +{ + /** * modifier */ - const u64 lid = get_local_id (0); const u64 gid = get_global_id (0); + if (gid >= gid_max) return; + + const u64 lid = get_local_id (0); + /** * sbox, kbox */ @@ -598,77 +644,52 @@ KERNEL_FQ void m27000_loop (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) const u32 c = tmps[gid].digest_buf[2]; const u32 d = tmps[gid].digest_buf[3]; - /** - * loop - */ - - for (u32 i = 0; i < loop_cnt; i++) - { - - // if ((d >> 16) != s2) continue; - - /** - * DES1 - */ - - u32 key[2]; - - transform_netntlmv1_key (a, b, key); - - u32 Kc[16]; - u32 Kd[16]; - - _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); + // I believe this matches the last 2 bytes and throws away. + // Taken from 5500. + if ((d >> 16) != s2) return; - u32 data[2]; + /** + * DES1 + */ - data[0] = s0; - data[1] = s1; + u32 key[2]; - u32 out1[2]; + transform_netntlmv1_key (a, b, key); - _des_crypt_encrypt (out1, data, Kc, Kd, s_SPtrans); + u32 Kc[16]; + u32 Kd[16]; - /** - * DES2 - */ + _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); - transform_netntlmv1_key (((b >> 24) | (c << 8)), ((c >> 24) | (d << 8)), key); + u32 data[2]; - _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); + data[0] = s0; + data[1] = s1; - u32 out2[2]; + u32 out1[2]; - _des_crypt_encrypt (out2, data, Kc, Kd, s_SPtrans); + _des_crypt_encrypt (out1, data, Kc, Kd, s_SPtrans); + /** + * DES2 + */ - tmps[gid].digest_buf[0] = out1[0]; - tmps[gid].digest_buf[1] = out1[1]; - tmps[gid].digest_buf[2] = out2[0]; - tmps[gid].digest_buf[3] = out2[1]; - } -} + transform_netntlmv1_key (((b >> 24) | (c << 8)), ((c >> 24) | (d << 8)), key); -KERNEL_FQ void m27000_comp (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) -{ - /** - * modifier - */ - - const u64 gid = get_global_id (0); + _des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb); - if (gid >= gid_max) return; + u32 out2[2]; - const u64 lid = get_local_id (0); + _des_crypt_encrypt (out2, data, Kc, Kd, s_SPtrans); /** * digest */ - const u32 r0 = tmps[gid].digest_buf[0]; - const u32 r1 = tmps[gid].digest_buf[1]; - const u32 r2 = tmps[gid].digest_buf[2]; - const u32 r3 = tmps[gid].digest_buf[3]; + const u32 r0 = out1[0]; + const u32 r1 = out1[1]; + const u32 r2 = out2[0]; + const u32 r3 = out2[1]; #define il_pos 0 diff --git a/OpenCL/m27100-pure.cl b/OpenCL/m27100-pure.cl index 7259c2973..d34355187 100644 --- a/OpenCL/m27100-pure.cl +++ b/OpenCL/m27100-pure.cl @@ -20,6 +20,23 @@ #define COMPARE_S "inc_comp_single.cl" #define COMPARE_M "inc_comp_multi.cl" +#ifdef KERNEL_STATIC +DECLSPEC u8 hex_convert (const u8 c) +{ + return (c & 15) + (c >> 6) * 9; +} + +DECLSPEC u8 hex_to_u8 (const u8 *hex) +{ + u8 v = 0; + + v |= ((u8) hex_convert (hex[1]) << 0); + v |= ((u8) hex_convert (hex[0]) << 4); + + return (v); +} +#endif + typedef struct netntlm { u32 user_len; @@ -54,19 +71,54 @@ KERNEL_FQ void m27100_init (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) * base */ - tmps[gid].digest_buf[0] = pws[gid].i[ 0]; - tmps[gid].digest_buf[1] = pws[gid].i[ 1]; - tmps[gid].digest_buf[2] = pws[gid].i[ 2]; - tmps[gid].digest_buf[3] = pws[gid].i[ 3]; + u32 in[16]; + + in[ 0] = pws[gid].i[ 0]; + in[ 1] = pws[gid].i[ 1]; + in[ 2] = pws[gid].i[ 2]; + in[ 3] = pws[gid].i[ 3]; + in[ 4] = pws[gid].i[ 4]; + in[ 5] = pws[gid].i[ 5]; + in[ 6] = pws[gid].i[ 6]; + in[ 7] = pws[gid].i[ 7]; + + u8 *in_ptr = (u8 *) in; + + u32 out[4]; + + u8 *out_ptr = (u8 *) out; + + for (int i = 0, j = 0; i < 16; i += 1, j += 2) + { + out_ptr[i] = hex_to_u8 (in_ptr + j); + } + + tmps[gid].digest_buf[0] = out[ 0]; + tmps[gid].digest_buf[1] = out[ 1]; + tmps[gid].digest_buf[2] = out[ 2]; + tmps[gid].digest_buf[3] = out[ 3]; + } KERNEL_FQ void m27100_loop (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) { - const u64 lid = get_local_id (0); + +} + +KERNEL_FQ void m27100_comp (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) +{ + /** + * modifier + */ + const u64 gid = get_global_id (0); + if (gid >= gid_max) return; + + const u64 lid = get_local_id (0); + u32 w0[4]; u32 w1[4]; u32 w2[4]; @@ -88,70 +140,54 @@ KERNEL_FQ void m27100_loop (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) w3[1] = 0; w3[2] = 0; w3[3] = 0; - - for (u32 i = 0; i < loop_cnt; i++) - { - md5_hmac_ctx_t ctx0; + md5_hmac_ctx_t ctx0; - md5_hmac_init_64 (&ctx0, w0, w1, w2, w3); + md5_hmac_init_64 (&ctx0, w0, w1, w2, w3); - md5_hmac_update_global (&ctx0, esalt_bufs[DIGESTS_OFFSET].userdomain_buf, esalt_bufs[DIGESTS_OFFSET].user_len + esalt_bufs[DIGESTS_OFFSET].domain_len); + md5_hmac_update_global (&ctx0, esalt_bufs[DIGESTS_OFFSET].userdomain_buf, esalt_bufs[DIGESTS_OFFSET].user_len + esalt_bufs[DIGESTS_OFFSET].domain_len); - md5_hmac_final (&ctx0); + md5_hmac_final (&ctx0); - w0[0] = ctx0.opad.h[0]; - w0[1] = ctx0.opad.h[1]; - w0[2] = ctx0.opad.h[2]; - w0[3] = ctx0.opad.h[3]; - w1[0] = 0; - w1[1] = 0; - w1[2] = 0; - w1[3] = 0; - w2[0] = 0; - w2[1] = 0; - w2[2] = 0; - w2[3] = 0; - w3[0] = 0; - w3[1] = 0; - w3[2] = 0; - w3[3] = 0; - - md5_hmac_ctx_t ctx; - - md5_hmac_init_64 (&ctx, w0, w1, w2, w3); - - md5_hmac_update_global (&ctx, esalt_bufs[DIGESTS_OFFSET].chall_buf, esalt_bufs[DIGESTS_OFFSET].srvchall_len + esalt_bufs[DIGESTS_OFFSET].clichall_len); + w0[0] = ctx0.opad.h[0]; + w0[1] = ctx0.opad.h[1]; + w0[2] = ctx0.opad.h[2]; + w0[3] = ctx0.opad.h[3]; + w1[0] = 0; + w1[1] = 0; + w1[2] = 0; + w1[3] = 0; + w2[0] = 0; + w2[1] = 0; + w2[2] = 0; + w2[3] = 0; + w3[0] = 0; + w3[1] = 0; + w3[2] = 0; + w3[3] = 0; - md5_hmac_final (&ctx); + md5_hmac_ctx_t ctx; - tmps[gid].digest_buf[0] = ctx.opad.h[0]; - tmps[gid].digest_buf[1] = ctx.opad.h[1]; - tmps[gid].digest_buf[2] = ctx.opad.h[2]; - tmps[gid].digest_buf[3] = ctx.opad.h[3]; - } -} + md5_hmac_init_64 (&ctx, w0, w1, w2, w3); -KERNEL_FQ void m27100_comp (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) -{ - /** - * modifier - */ + md5_hmac_update_global (&ctx, esalt_bufs[DIGESTS_OFFSET].chall_buf, esalt_bufs[DIGESTS_OFFSET].srvchall_len + esalt_bufs[DIGESTS_OFFSET].clichall_len); - const u64 gid = get_global_id (0); + md5_hmac_final (&ctx); - if (gid >= gid_max) return; + tmps[gid].digest_buf[0] = ctx.opad.h[0]; + tmps[gid].digest_buf[1] = ctx.opad.h[1]; + tmps[gid].digest_buf[2] = ctx.opad.h[2]; + tmps[gid].digest_buf[3] = ctx.opad.h[3]; - const u64 lid = get_local_id (0); /** * digest */ - const u32 r0 = tmps[gid].digest_buf[DGST_R0]; - const u32 r1 = tmps[gid].digest_buf[DGST_R1]; - const u32 r2 = tmps[gid].digest_buf[DGST_R2]; - const u32 r3 = tmps[gid].digest_buf[DGST_R3]; + const u32 r0 = ctx.opad.h[DGST_R0]; + const u32 r1 = ctx.opad.h[DGST_R1]; + const u32 r2 = ctx.opad.h[DGST_R2]; + const u32 r3 = ctx.opad.h[DGST_R3]; #define il_pos 0 diff --git a/src/modules/module_27000.c b/src/modules/module_27000.c index 01c5d045c..3dc44335d 100644 --- a/src/modules/module_27000.c +++ b/src/modules/module_27000.c @@ -26,10 +26,9 @@ static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_PT_ADD80 | OPTS_TYPE_PT_ADDBITS14 | OPTS_TYPE_PT_UTF16LE - | OPTS_TYPE_ST_HEX - | OPTS_TYPE_PT_ALWAYS_HEXIFY; + | OPTS_TYPE_ST_HEX; static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; -static const char *ST_PASS = "\xb4\xb9\xb0\x2e\x6f\x09\xa9\xbd\x76\x0f\x38\x8b\x67\x35\x1e\x2b"; +static const char *ST_PASS = "b4b9b02e6f09a9bd760f388b67351e2b"; static const char *ST_HASH = "::5V4T:ada06359242920a500000000000000000000000000000000:0556d5297b5daa70eaffde82ef99293a3f3bb59b7c9704ea:9c23f6c094853920"; typedef struct netntlm @@ -334,9 +333,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE salt->salt_buf[0] = rotl32 (salt->salt_buf[0], 3); salt->salt_buf[1] = rotl32 (salt->salt_buf[1], 3); - // Why my _loop wasnt being called and what was causing me such confusion :D - salt->salt_iter = 1; - return (PARSER_OK); } @@ -420,18 +416,24 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u32 pw_max = 16; // Length of a NT hash + const u32 pw_max = 32; // Length of a NT hash return pw_max; } u32 module_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u32 pw_min = 16; // Length of a NT hash + const u32 pw_min = 32; // Length of a NT hash return pw_min; } +const char *module_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const char *mask = "?a?a?a?a?a?a?a?axxxxxxxxxxxxxxxx"; + return mask; +} + void module_init (module_ctx_t *module_ctx) { module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; @@ -440,7 +442,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_attack_exec = module_attack_exec; module_ctx->module_benchmark_esalt = MODULE_DEFAULT; module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; - module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = module_benchmark_mask; module_ctx->module_benchmark_salt = MODULE_DEFAULT; module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; diff --git a/src/modules/module_27100.c b/src/modules/module_27100.c index 985a43755..715f936ea 100644 --- a/src/modules/module_27100.c +++ b/src/modules/module_27100.c @@ -26,10 +26,9 @@ static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_PT_ADD80 | OPTS_TYPE_PT_ADDBITS14 | OPTS_TYPE_PT_UTF16LE - | OPTS_TYPE_ST_HEX - | OPTS_TYPE_PT_ALWAYS_HEXIFY; + | OPTS_TYPE_ST_HEX; static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; -static const char *ST_PASS = "\xb4\xb9\xb0\x2e\x6f\x09\xa9\xbd\x76\x0f\x38\x8b\x67\x35\x1e\x2b"; +static const char *ST_PASS = "b4b9b02e6f09a9bd760f388b67351e2b"; static const char *ST_HASH = "0UL5G37JOI0SX::6VB1IS0KA74:ebe1afa18b7fbfa6:aab8bf8675658dd2a939458a1077ba08:010100000000000031c8aa092510945398b9f7b7dde1a9fb00000000f7876f2b04b700"; typedef struct netntlm @@ -241,9 +240,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE salt->salt_len = 16; - // Why my _loop wasnt being called and what was causing me such confusion :D - salt->salt_iter = 1; - return (PARSER_OK); } @@ -316,18 +312,24 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u32 pw_max = 16; // Length of a NT hash + const u32 pw_max = 32; // Length of a NT hash return pw_max; } u32 module_pw_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { - const u32 pw_min = 16; // Length of a NT hash + const u32 pw_min = 32; // Length of a NT hash return pw_min; } +const char *module_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const char *mask = "?a?a?a?a?a?a?a?axxxxxxxxxxxxxxxx"; + return mask; +} + void module_init (module_ctx_t *module_ctx) { module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; @@ -336,7 +338,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_attack_exec = module_attack_exec; module_ctx->module_benchmark_esalt = MODULE_DEFAULT; module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; - module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = module_benchmark_mask; module_ctx->module_benchmark_salt = MODULE_DEFAULT; module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; From b2d1f42905604e5fa093141dff31e2938e18c3ba Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Mon, 2 Aug 2021 12:00:17 +0200 Subject: [PATCH 57/64] Fix self-test functionality if FIXED_LOCAL_SIZE_COMP is used Fix -m 25700 datatype in -a 3 mode and maximum password length in pure kernel mode Fix -m 12500, 23700 and 23800 if password is exactly length 128 --- OpenCL/m12500-pure.cl | 4 ++-- OpenCL/m23700-pure.cl | 4 ++-- OpenCL/m23800-pure.cl | 4 ++-- OpenCL/m25700_a3-optimized.cl | 2 +- src/backend.c | 12 +++++++++++- tools/test_modules/m25700.pm | 2 +- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/OpenCL/m12500-pure.cl b/OpenCL/m12500-pure.cl index 6112ec296..020ac1619 100644 --- a/OpenCL/m12500-pure.cl +++ b/OpenCL/m12500-pure.cl @@ -804,7 +804,7 @@ KERNEL_FQ void m12500_loop (KERN_ATTR_TMPS (rar3_tmp_t)) * base */ - const u32 pw_len = pws[gid].pw_len & 255; + const u32 pw_len = pws[gid].pw_len; const u32 salt_len = 8; @@ -970,7 +970,7 @@ KERNEL_FQ void m12500_comp (KERN_ATTR_TMPS (rar3_tmp_t)) * base */ - const u32 pw_len = pws[gid].pw_len & 255; + const u32 pw_len = pws[gid].pw_len; const u32 salt_len = 8; diff --git a/OpenCL/m23700-pure.cl b/OpenCL/m23700-pure.cl index 63e84cbf7..c33c5f123 100644 --- a/OpenCL/m23700-pure.cl +++ b/OpenCL/m23700-pure.cl @@ -912,7 +912,7 @@ KERNEL_FQ void m23700_loop (KERN_ATTR_TMPS_ESALT (rar3_tmp_t, rar3_t)) * base */ - const u32 pw_len = pws[gid].pw_len & 255; + const u32 pw_len = pws[gid].pw_len; const u32 salt_len = 8; @@ -1086,7 +1086,7 @@ KERNEL_FQ void m23700_comp (KERN_ATTR_TMPS_ESALT (rar3_tmp_t, rar3_t)) * base */ - const u32 pw_len = pws[gid].pw_len & 255; + const u32 pw_len = pws[gid].pw_len; const u32 salt_len = 8; diff --git a/OpenCL/m23800-pure.cl b/OpenCL/m23800-pure.cl index 530c3268d..fb38fab7d 100644 --- a/OpenCL/m23800-pure.cl +++ b/OpenCL/m23800-pure.cl @@ -823,7 +823,7 @@ KERNEL_FQ void m23800_loop (KERN_ATTR_TMPS_HOOKS_ESALT (rar3_tmp_t, rar3_hook_t, * base */ - const u32 pw_len = pws[gid].pw_len & 255; + const u32 pw_len = pws[gid].pw_len; const u32 salt_len = 8; @@ -990,7 +990,7 @@ KERNEL_FQ void m23800_hook23 (KERN_ATTR_TMPS_HOOKS_ESALT (rar3_tmp_t, rar3_hook_ * base */ - const u32 pw_len = pws[gid].pw_len & 255; + const u32 pw_len = pws[gid].pw_len; const u32 salt_len = 8; diff --git a/OpenCL/m25700_a3-optimized.cl b/OpenCL/m25700_a3-optimized.cl index 783cf4fef..f879233f3 100644 --- a/OpenCL/m25700_a3-optimized.cl +++ b/OpenCL/m25700_a3-optimized.cl @@ -14,7 +14,7 @@ #include "inc_hash_md5.cl" #endif -DECLSPEC u32x MurmurHash_w0 (const u32 seed, const u32x w0, const u32 *w, const int pw_len) +DECLSPEC u32x MurmurHash_w0 (const u32 seed, const u32x w0, const u32x *w, const int pw_len) { u32x hash = seed; diff --git a/src/backend.c b/src/backend.c index d2a68e5b0..ebe4d1eb0 100644 --- a/src/backend.c +++ b/src/backend.c @@ -11111,7 +11111,7 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) { device_param->skipped = true; continue; - } + } } /** @@ -11629,6 +11629,16 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) device_param->kernel_threads_min = fixed_local_size; device_param->kernel_threads_max = fixed_local_size; } + else + { + // kernels specific minimum needs to be set so that self-test wont fail + + if (sscanf (jit_build_options, "-D FIXED_LOCAL_SIZE_COMP=%u", &fixed_local_size) == 1) + { + device_param->kernel_threads_min = fixed_local_size; + // device_param->kernel_threads_max = fixed_local_size; + } + } } } diff --git a/tools/test_modules/m25700.pm b/tools/test_modules/m25700.pm index d5c2e2424..56f6c042f 100644 --- a/tools/test_modules/m25700.pm +++ b/tools/test_modules/m25700.pm @@ -8,7 +8,7 @@ use strict; use warnings; -sub module_constraints { [[0, 256], [8, 8], [0, 55], [8, 8], [-1, -1]] } +sub module_constraints { [[-1, -1], [-1, -1], [0, 55], [8, 8], [-1, -1]] } sub MurmurHash { From 30fe29b8a80a465a5649711985f9762d6dc5f4b6 Mon Sep 17 00:00:00 2001 From: Michael Kruger Date: Mon, 2 Aug 2021 12:06:38 +0200 Subject: [PATCH 58/64] Allways pack in the tests. --- tools/test_modules/m27000.pm | 5 ++--- tools/test_modules/m27100.pm | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/tools/test_modules/m27000.pm b/tools/test_modules/m27000.pm index e77e471ea..bf279bfb9 100644 --- a/tools/test_modules/m27000.pm +++ b/tools/test_modules/m27000.pm @@ -128,8 +128,7 @@ sub module_generate_hash my $ntresp; - my $nthash = pack_if_HEX_notation ($word); - # my $nthash = pack ("H*", $word); + my $nthash = pack ("H*", $word); my $nthashpadded = $nthash . "\x00" x 5; $ntresp .= Crypt::ECB::encrypt (setup_des_key (substr ($nthashpadded, 0, 7)), "DES", $challenge, "none"); @@ -167,7 +166,7 @@ sub module_verify_hash my $word = substr ($line, $index2 + 1 + 16 + 1); - my $word_packed = pack_if_HEX_notation ($word); + my $word_packed = pack ("H*", $word); my $new_hash = module_generate_hash ($word_packed, undef, $salt); diff --git a/tools/test_modules/m27100.pm b/tools/test_modules/m27100.pm index 851cadc49..fef575c3b 100644 --- a/tools/test_modules/m27100.pm +++ b/tools/test_modules/m27100.pm @@ -29,8 +29,7 @@ sub module_generate_hash my $b_srv_ch = pack ('H*', $srv_ch); my $b_cli_ch = pack ('H*', $cli_ch); - my $nthash = pack_if_HEX_notation ($word); - # my $nthash = pack ("H*", $word); + my $nthash = pack ("H*", $word); my $identity = encode ('UTF-16LE', uc ($user) . $domain); my $digest = hmac_hex ($b_srv_ch . $b_cli_ch, hmac ($identity, $nthash, \&md5, 64), \&md5, 64); @@ -67,7 +66,7 @@ sub module_verify_hash $cli_ch = substr ($line, $index2 + 3 + 16 + 32, $index3 - $index2 - 3 - 16 - 32); $word = substr ($line, $index3 + 1); - my $word_packed = pack_if_HEX_notation ($word); + my $word_packed = pack ("H*", $word); my $new_hash = module_generate_hash ($word_packed, $user, $domain, $srv_ch, $cli_ch); From 2814f7f910cdae5833c06c806ca94f47285e5aa3 Mon Sep 17 00:00:00 2001 From: Michael Kruger Date: Mon, 2 Aug 2021 14:09:19 +0200 Subject: [PATCH 59/64] Made all module_constraints [32,32]. --- tools/test_modules/m27000.pm | 6 +++--- tools/test_modules/m27100.pm | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/test_modules/m27000.pm b/tools/test_modules/m27000.pm index bf279bfb9..709a747bc 100644 --- a/tools/test_modules/m27000.pm +++ b/tools/test_modules/m27000.pm @@ -91,7 +91,7 @@ sub get_random_netntlmv1_salt return $salt_buf; } -sub module_constraints { [[32, 32], [-1, -1], [0, 27], [-1, -1], [-1, -1]] } # room for improvement in pure kernel mode +sub module_constraints { [[32, 32], [-1, -1], [32, 32], [-1, -1], [-1, -1]] } # room for improvement in pure kernel mode sub module_generate_hash { @@ -166,9 +166,9 @@ sub module_verify_hash my $word = substr ($line, $index2 + 1 + 16 + 1); - my $word_packed = pack ("H*", $word); + # my $word_packed = pack ("H*", $word); - my $new_hash = module_generate_hash ($word_packed, undef, $salt); + my $new_hash = module_generate_hash ($word, undef, $salt); return ($new_hash, $word); } diff --git a/tools/test_modules/m27100.pm b/tools/test_modules/m27100.pm index fef575c3b..e464aac23 100644 --- a/tools/test_modules/m27100.pm +++ b/tools/test_modules/m27100.pm @@ -12,7 +12,7 @@ use Digest::HMAC qw (hmac hmac_hex); use Digest::MD5 qw (md5); use Encode qw (encode); -sub module_constraints { [[32, 32], [32, 32], [32, 32], [0, 27], [-1, -1]] } +sub module_constraints { [[32, 32], [32, 32], [32, 32], [32, 32], [-1, -1]] } sub module_generate_hash { From 0810126145a42ac9b253828e7274233ffaea8007 Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Mon, 2 Aug 2021 14:12:36 +0200 Subject: [PATCH 60/64] Fix Blake2b in generic mode --- OpenCL/inc_common.cl | 2 ++ OpenCL/inc_hash_blake2b.cl | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenCL/inc_common.cl b/OpenCL/inc_common.cl index 82b50b7c8..00d68110c 100644 --- a/OpenCL/inc_common.cl +++ b/OpenCL/inc_common.cl @@ -2300,6 +2300,8 @@ DECLSPEC int hc_enc_next_global (hc_enc_t *hc_enc, GLOBAL_AS const u32 *src_buf, if ((dst_pos + 2) == dst_sz) { + // this section seems to break intel opencl runtime but is unknown why + dst_ptr[dst_pos++] = (a >> 0) & 0xff; dst_ptr[dst_pos++] = (a >> 8) & 0xff; diff --git a/OpenCL/inc_hash_blake2b.cl b/OpenCL/inc_hash_blake2b.cl index 33467c933..3aea61922 100644 --- a/OpenCL/inc_hash_blake2b.cl +++ b/OpenCL/inc_hash_blake2b.cl @@ -113,7 +113,7 @@ DECLSPEC u64 blake2b_rot24_S (const u64 a) #else - return hc_rotr64_S (a, 16); + return hc_rotr64_S (a, 24); #endif } From 3bb25edb585438147a1c5240cbeac63d8bdc9be5 Mon Sep 17 00:00:00 2001 From: Michael Kruger Date: Mon, 2 Aug 2021 14:24:26 +0200 Subject: [PATCH 61/64] I was wrong, the 4th module_constraints is put back --- tools/test_modules/m27100.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test_modules/m27100.pm b/tools/test_modules/m27100.pm index e464aac23..fef575c3b 100644 --- a/tools/test_modules/m27100.pm +++ b/tools/test_modules/m27100.pm @@ -12,7 +12,7 @@ use Digest::HMAC qw (hmac hmac_hex); use Digest::MD5 qw (md5); use Encode qw (encode); -sub module_constraints { [[32, 32], [32, 32], [32, 32], [32, 32], [-1, -1]] } +sub module_constraints { [[32, 32], [32, 32], [32, 32], [0, 27], [-1, -1]] } sub module_generate_hash { From 5c9be6c855726c5213a50905e52d4c809dd305d0 Mon Sep 17 00:00:00 2001 From: Michael Kruger Date: Mon, 2 Aug 2021 14:43:22 +0200 Subject: [PATCH 62/64] Add extra_tuningdb_block, test mod_constrants [-1,-1] --- src/modules/module_27000.c | 1 + src/modules/module_27100.c | 1 + tools/test_modules/m27000.pm | 2 +- tools/test_modules/m27100.pm | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/module_27000.c b/src/modules/module_27000.c index 3dc44335d..7bb8287bc 100644 --- a/src/modules/module_27000.c +++ b/src/modules/module_27000.c @@ -455,6 +455,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/src/modules/module_27100.c b/src/modules/module_27100.c index 715f936ea..84b1fa6ca 100644 --- a/src/modules/module_27100.c +++ b/src/modules/module_27100.c @@ -351,6 +351,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_esalt_size = module_esalt_size; module_ctx->module_extra_buffer_size = MODULE_DEFAULT; module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; module_ctx->module_forced_outfile_format = MODULE_DEFAULT; module_ctx->module_hash_binary_count = MODULE_DEFAULT; module_ctx->module_hash_binary_parse = MODULE_DEFAULT; diff --git a/tools/test_modules/m27000.pm b/tools/test_modules/m27000.pm index 709a747bc..2ae2ea163 100644 --- a/tools/test_modules/m27000.pm +++ b/tools/test_modules/m27000.pm @@ -91,7 +91,7 @@ sub get_random_netntlmv1_salt return $salt_buf; } -sub module_constraints { [[32, 32], [-1, -1], [32, 32], [-1, -1], [-1, -1]] } # room for improvement in pure kernel mode +sub module_constraints { [[32, 32], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] } # room for improvement in pure kernel mode sub module_generate_hash { diff --git a/tools/test_modules/m27100.pm b/tools/test_modules/m27100.pm index fef575c3b..fb52146c5 100644 --- a/tools/test_modules/m27100.pm +++ b/tools/test_modules/m27100.pm @@ -12,7 +12,7 @@ use Digest::HMAC qw (hmac hmac_hex); use Digest::MD5 qw (md5); use Encode qw (encode); -sub module_constraints { [[32, 32], [32, 32], [32, 32], [0, 27], [-1, -1]] } +sub module_constraints { [[32, 32], [-1, -1], [-1, -1], [-1, -1], [-1, -1]] } sub module_generate_hash { From b9992cc1196a094cb936d81828ef1d91ca0c6390 Mon Sep 17 00:00:00 2001 From: Michael Kruger Date: Mon, 2 Aug 2021 15:15:05 +0200 Subject: [PATCH 63/64] naughty race condition return --- OpenCL/m27000-pure.cl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/OpenCL/m27000-pure.cl b/OpenCL/m27000-pure.cl index a35d2e039..6f5e8955a 100644 --- a/OpenCL/m27000-pure.cl +++ b/OpenCL/m27000-pure.cl @@ -585,10 +585,8 @@ KERNEL_FQ void m27000_comp (KERN_ATTR_TMPS_ESALT (netntlm_tmp_t, netntlm_t)) */ const u64 gid = get_global_id (0); - - if (gid >= gid_max) return; - const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); /** * sbox, kbox From 3d4e2aec43731ff4a89d7576c2b01c2512b899f6 Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Tue, 3 Aug 2021 08:34:37 +0200 Subject: [PATCH 64/64] Work around segmentation fault in Intel JiT 2021.12.6.0.19_160000 compiling hc_enc_next()/hc_enc_next_global() --- OpenCL/inc_common.cl | 12 ++++++++++++ OpenCL/inc_vendor.h | 1 - 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/OpenCL/inc_common.cl b/OpenCL/inc_common.cl index 00d68110c..a65fd21c7 100644 --- a/OpenCL/inc_common.cl +++ b/OpenCL/inc_common.cl @@ -2066,6 +2066,12 @@ DECLSPEC int hc_enc_next (hc_enc_t *hc_enc, const u32 *src_buf, const int src_le int src_pos = hc_enc->pos; + #if VENDOR_ID == 8 + // Work around segmentation fault in Intel JiT + // Tested with 2021.12.6.0.19_160000 + volatile + #endif + int dst_pos = hc_enc->clen; dst_buf[0] = hc_enc->cbuf; @@ -2197,6 +2203,12 @@ DECLSPEC int hc_enc_next_global (hc_enc_t *hc_enc, GLOBAL_AS const u32 *src_buf, int src_pos = hc_enc->pos; + #if VENDOR_ID == 8 + // Work around segmentation fault in Intel JiT + // Tested with 2021.12.6.0.19_160000 + volatile + #endif + int dst_pos = hc_enc->clen; dst_buf[0] = hc_enc->cbuf; diff --git a/OpenCL/inc_vendor.h b/OpenCL/inc_vendor.h index bbd7e23d8..43f5d8fb8 100644 --- a/OpenCL/inc_vendor.h +++ b/OpenCL/inc_vendor.h @@ -16,7 +16,6 @@ #define IS_OPENCL #endif - #if defined IS_NATIVE #define CONSTANT_VK #define CONSTANT_AS