From 9b842e30ab1a01cc43ced7636fd658cad5859e4c Mon Sep 17 00:00:00 2001
From: jsteube <jens.steube@gmail.com>
Date: Thu, 7 Feb 2019 17:05:02 +0100
Subject: [PATCH] Get rid of OPTI_TYPE_PRECOMPUTE_PERMUT

---
 include/types.h            | 37 ++++++++++++++++++-------------------
 src/modules/module_01500.c |  3 +--
 src/modules/module_03000.c |  3 +--
 src/modules/module_05500.c |  3 +--
 src/modules/module_14000.c |  3 +--
 src/modules/module_14100.c |  3 +--
 src/shared.c               |  1 -
 7 files changed, 23 insertions(+), 30 deletions(-)

diff --git a/include/types.h b/include/types.h
index 3b15de933..13a8ce8bb 100644
--- a/include/types.h
+++ b/include/types.h
@@ -345,24 +345,23 @@ typedef enum opti_type
   OPTI_TYPE_ZERO_BYTE           = (1 <<  1),
   OPTI_TYPE_PRECOMPUTE_INIT     = (1 <<  2),
   OPTI_TYPE_PRECOMPUTE_MERKLE   = (1 <<  3),
-  OPTI_TYPE_PRECOMPUTE_PERMUT   = (1 <<  4),
-  OPTI_TYPE_MEET_IN_MIDDLE      = (1 <<  5),
-  OPTI_TYPE_EARLY_SKIP          = (1 <<  6),
-  OPTI_TYPE_NOT_SALTED          = (1 <<  7),
-  OPTI_TYPE_NOT_ITERATED        = (1 <<  8),
-  OPTI_TYPE_PREPENDED_SALT      = (1 <<  9),
-  OPTI_TYPE_APPENDED_SALT       = (1 << 10),
-  OPTI_TYPE_SINGLE_HASH         = (1 << 11),
-  OPTI_TYPE_SINGLE_SALT         = (1 << 12),
-  OPTI_TYPE_BRUTE_FORCE         = (1 << 13),
-  OPTI_TYPE_RAW_HASH            = (1 << 14),
-  OPTI_TYPE_SLOW_HASH_SIMD_INIT = (1 << 15),
-  OPTI_TYPE_SLOW_HASH_SIMD_LOOP = (1 << 16),
-  OPTI_TYPE_SLOW_HASH_SIMD_COMP = (1 << 17),
-  OPTI_TYPE_USES_BITS_8         = (1 << 18),
-  OPTI_TYPE_USES_BITS_16        = (1 << 19),
-  OPTI_TYPE_USES_BITS_32        = (1 << 20),
-  OPTI_TYPE_USES_BITS_64        = (1 << 21)
+  OPTI_TYPE_MEET_IN_MIDDLE      = (1 <<  4),
+  OPTI_TYPE_EARLY_SKIP          = (1 <<  5),
+  OPTI_TYPE_NOT_SALTED          = (1 <<  6),
+  OPTI_TYPE_NOT_ITERATED        = (1 <<  7),
+  OPTI_TYPE_PREPENDED_SALT      = (1 <<  8),
+  OPTI_TYPE_APPENDED_SALT       = (1 <<  9),
+  OPTI_TYPE_SINGLE_HASH         = (1 << 10),
+  OPTI_TYPE_SINGLE_SALT         = (1 << 11),
+  OPTI_TYPE_BRUTE_FORCE         = (1 << 12),
+  OPTI_TYPE_RAW_HASH            = (1 << 13),
+  OPTI_TYPE_SLOW_HASH_SIMD_INIT = (1 << 14),
+  OPTI_TYPE_SLOW_HASH_SIMD_LOOP = (1 << 15),
+  OPTI_TYPE_SLOW_HASH_SIMD_COMP = (1 << 16),
+  OPTI_TYPE_USES_BITS_8         = (1 << 17),
+  OPTI_TYPE_USES_BITS_16        = (1 << 18),
+  OPTI_TYPE_USES_BITS_32        = (1 << 19),
+  OPTI_TYPE_USES_BITS_64        = (1 << 20)
 
 } opti_type_t;
 
@@ -2340,7 +2339,7 @@ typedef struct module_ctx
   void        (*module_hook12)                  (hc_device_param_t *, const void *, const u32, const u64);
   void        (*module_hook23)                  (hc_device_param_t *, const void *, const u32, const u64);
 
-  int         (*module_build_plain_postprocess) (const u32 *, const size_t, const int, u32 *, const size_t);
+  int         (*module_build_plain_postprocess) (const hashconfig_t *, const hashes_t *, const u32 *, const size_t, const int, u32 *, const size_t);
 
 } module_ctx_t;
 
diff --git a/src/modules/module_01500.c b/src/modules/module_01500.c
index cfda1764e..acfabb527 100644
--- a/src/modules/module_01500.c
+++ b/src/modules/module_01500.c
@@ -21,8 +21,7 @@ static const u32   HASH_CATEGORY  = HASH_CATEGORY_OS;
 static const char *HASH_NAME      = "descrypt, DES (Unix), Traditional DES";
 static const u32   HASH_TYPE      = HASH_TYPE_GENERIC;
 static const u64   KERN_TYPE      = 1500;
-static const u32   OPTI_TYPE      = OPTI_TYPE_ZERO_BYTE
-                                  | OPTI_TYPE_PRECOMPUTE_PERMUT;
+static const u32   OPTI_TYPE      = OPTI_TYPE_ZERO_BYTE;
 static const u64   OPTS_TYPE      = OPTS_TYPE_STATE_BUFFER_LE
                                   | OPTS_TYPE_PT_GENERATE_LE
                                   | OPTS_TYPE_PT_BITSLICE;
diff --git a/src/modules/module_03000.c b/src/modules/module_03000.c
index 0aca093f0..540215c21 100644
--- a/src/modules/module_03000.c
+++ b/src/modules/module_03000.c
@@ -21,8 +21,7 @@ static const u32   HASH_CATEGORY  = HASH_CATEGORY_OS;
 static const char *HASH_NAME      = "LM";
 static const u32   HASH_TYPE      = HASH_TYPE_GENERIC;
 static const u64   KERN_TYPE      = 3000;
-static const u32   OPTI_TYPE      = OPTI_TYPE_ZERO_BYTE
-                                  | OPTI_TYPE_PRECOMPUTE_PERMUT;
+static const u32   OPTI_TYPE      = OPTI_TYPE_ZERO_BYTE;
 static const u64   OPTS_TYPE      = OPTS_TYPE_STATE_BUFFER_LE
                                   | OPTS_TYPE_PT_GENERATE_LE
                                   | OPTS_TYPE_PT_UPPER
diff --git a/src/modules/module_05500.c b/src/modules/module_05500.c
index 4a03af80f..3df8bb32d 100644
--- a/src/modules/module_05500.c
+++ b/src/modules/module_05500.c
@@ -23,8 +23,7 @@ static const u32   HASH_CATEGORY  = HASH_CATEGORY_NETWORK_PROTOCOL;
 static const char *HASH_NAME      = "NetNTLMv1 / NetNTLMv1+ESS";
 static const u32   HASH_TYPE      = HASH_TYPE_GENERIC;
 static const u64   KERN_TYPE      = 5500;
-static const u32   OPTI_TYPE      = OPTI_TYPE_ZERO_BYTE
-                                  | OPTI_TYPE_PRECOMPUTE_PERMUT;
+static const u32   OPTI_TYPE      = OPTI_TYPE_ZERO_BYTE;
 static const u64   OPTS_TYPE      = OPTS_TYPE_STATE_BUFFER_LE
                                   | OPTS_TYPE_PT_GENERATE_LE
                                   | OPTS_TYPE_PT_ADD80
diff --git a/src/modules/module_14000.c b/src/modules/module_14000.c
index 01c01696d..d6a137231 100644
--- a/src/modules/module_14000.c
+++ b/src/modules/module_14000.c
@@ -21,8 +21,7 @@ static const u32   HASH_CATEGORY  = HASH_CATEGORY_RAW_CIPHER_KPA;
 static const char *HASH_NAME      = "DES (PT = $salt, key = $pass)";
 static const u32   HASH_TYPE      = HASH_TYPE_GENERIC;
 static const u64   KERN_TYPE      = 14000;
-static const u32   OPTI_TYPE      = OPTI_TYPE_ZERO_BYTE
-                                  | OPTI_TYPE_PRECOMPUTE_PERMUT;
+static const u32   OPTI_TYPE      = OPTI_TYPE_ZERO_BYTE;
 static const u64   OPTS_TYPE      = OPTS_TYPE_STATE_BUFFER_LE
                                   | OPTS_TYPE_PT_GENERATE_LE
                                   | OPTS_TYPE_PT_BITSLICE
diff --git a/src/modules/module_14100.c b/src/modules/module_14100.c
index def18c019..369f31b5f 100644
--- a/src/modules/module_14100.c
+++ b/src/modules/module_14100.c
@@ -21,8 +21,7 @@ static const u32   HASH_CATEGORY  = HASH_CATEGORY_RAW_CIPHER_KPA;
 static const char *HASH_NAME      = "3DES (PT = $salt, key = $pass)";
 static const u32   HASH_TYPE      = HASH_TYPE_GENERIC;
 static const u64   KERN_TYPE      = 14100;
-static const u32   OPTI_TYPE      = OPTI_TYPE_ZERO_BYTE
-                                  | OPTI_TYPE_PRECOMPUTE_PERMUT;
+static const u32   OPTI_TYPE      = OPTI_TYPE_ZERO_BYTE;
 static const u64   OPTS_TYPE      = OPTS_TYPE_STATE_BUFFER_LE
                                   | OPTS_TYPE_PT_GENERATE_LE
                                   | OPTS_TYPE_ST_GENERATE_LE
diff --git a/src/shared.c b/src/shared.c
index 87b42d28f..09ad14a41 100644
--- a/src/shared.c
+++ b/src/shared.c
@@ -922,7 +922,6 @@ const char *stroptitype (const u32 opti_type)
     case OPTI_TYPE_ZERO_BYTE:           return OPTI_STR_ZERO_BYTE;
     case OPTI_TYPE_PRECOMPUTE_INIT:     return OPTI_STR_PRECOMPUTE_INIT;
     case OPTI_TYPE_PRECOMPUTE_MERKLE:   return OPTI_STR_PRECOMPUTE_MERKLE;
-    case OPTI_TYPE_PRECOMPUTE_PERMUT:   return OPTI_STR_PRECOMPUTE_PERMUT;
     case OPTI_TYPE_MEET_IN_MIDDLE:      return OPTI_STR_MEET_IN_MIDDLE;
     case OPTI_TYPE_EARLY_SKIP:          return OPTI_STR_EARLY_SKIP;
     case OPTI_TYPE_NOT_SALTED:          return OPTI_STR_NOT_SALTED;