Revert "Zero pws_buf before reuse"
[hashcat.git] / OpenCL / m08500_a1.cl
index fa71396..f3f653d 100644 (file)
@@ -7,8 +7,6 @@
 
 #define _DES_
 
-#define NEW_SIMD_CODE
-
 #include "include/constants.h"
 #include "include/kernel_vendor.h"
 
@@ -20,7 +18,9 @@
 #include "include/kernel_functions.c"
 #include "OpenCL/types_ocl.c"
 #include "OpenCL/common.c"
-#include "OpenCL/simd.c"
+
+#define COMPARE_S "OpenCL/check_single_comp4.c"
+#define COMPARE_M "OpenCL/check_multi_comp4.c"
 
 #define PERM_OP(a,b,tt,n,m) \
 {                           \
@@ -583,7 +583,7 @@ __kernel void m08500_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
 
   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
   {
-    switch_buffer_by_offset_le_S (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
+    switch_buffer_by_offset_le (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
   }
 
   /**
@@ -599,49 +599,69 @@ __kernel void m08500_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
    * main
    */
 
-  for (u32 il_pos = 0; il_pos < combs_cnt; il_pos += VECT_SIZE)
+  for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
   {
-    const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
+    const u32 pw_r_len = combs_buf[il_pos].pw_len;
 
-    u32x pw_len = pw_l_len + pw_r_len;
+    u32 pw_len = pw_l_len + pw_r_len;
 
     pw_len = (pw_len >= 8) ? 8 : pw_len;
 
-    u32x wordr0[4] = { 0 };
-    u32x wordr1[4] = { 0 };
-    u32x wordr2[4] = { 0 };
-    u32x wordr3[4] = { 0 };
+    u32 wordr0[4];
+
+    wordr0[0] = combs_buf[il_pos].i[0];
+    wordr0[1] = combs_buf[il_pos].i[1];
+    wordr0[2] = 0;
+    wordr0[3] = 0;
+
+    u32 wordr1[4];
+
+    wordr1[0] = 0;
+    wordr1[1] = 0;
+    wordr1[2] = 0;
+    wordr1[3] = 0;
+
+    u32 wordr2[4];
+
+    wordr2[0] = 0;
+    wordr2[1] = 0;
+    wordr2[2] = 0;
+    wordr2[3] = 0;
 
-    wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
-    wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
+    u32 wordr3[4];
+
+    wordr3[0] = 0;
+    wordr3[1] = 0;
+    wordr3[2] = 0;
+    wordr3[3] = 0;
 
     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
     {
       switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
     }
 
-    u32x w0[4];
+    u32 w0[4];
 
     w0[0] = wordl0[0] | wordr0[0];
     w0[1] = wordl0[1] | wordr0[1];
     w0[2] = 0;
     w0[3] = 0;
 
-    u32x w1[4];
+    u32 w1[4];
 
     w1[0] = 0;
     w1[1] = 0;
     w1[2] = 0;
     w1[3] = 0;
 
-    u32x w2[4];
+    u32 w2[4];
 
     w2[0] = 0;
     w2[1] = 0;
     w2[2] = 0;
     w2[3] = 0;
 
-    u32x w3[4];
+    u32 w3[4];
 
     w3[0] = 0;
     w3[1] = 0;
@@ -669,10 +689,12 @@ __kernel void m08500_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
 
     _des_crypt_encrypt (iv, data, Kc, Kd, s_SPtrans);
 
-    u32x c = 0;
-    u32x d = 0;
+    const u32 r0 = iv[0];
+    const u32 r1 = iv[1];
+    const u32 r2 = 0;
+    const u32 r3 = 0;
 
-    COMPARE_M_SIMD (iv[0], iv[1], c, d);
+    #include COMPARE_M
   }
 }
 
@@ -762,7 +784,7 @@ __kernel void m08500_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
 
   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
   {
-    switch_buffer_by_offset_le_S (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
+    switch_buffer_by_offset_le (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
   }
 
   /**
@@ -790,49 +812,69 @@ __kernel void m08500_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
    * main
    */
 
-  for (u32 il_pos = 0; il_pos < combs_cnt; il_pos += VECT_SIZE)
+  for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
   {
-    const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
+    const u32 pw_r_len = combs_buf[il_pos].pw_len;
 
-    u32x pw_len = pw_l_len + pw_r_len;
+    u32 pw_len = pw_l_len + pw_r_len;
 
     pw_len = (pw_len >= 8) ? 8 : pw_len;
 
-    u32x wordr0[4] = { 0 };
-    u32x wordr1[4] = { 0 };
-    u32x wordr2[4] = { 0 };
-    u32x wordr3[4] = { 0 };
+    u32 wordr0[4];
+
+    wordr0[0] = combs_buf[il_pos].i[0];
+    wordr0[1] = combs_buf[il_pos].i[1];
+    wordr0[2] = 0;
+    wordr0[3] = 0;
+
+    u32 wordr1[4];
+
+    wordr1[0] = 0;
+    wordr1[1] = 0;
+    wordr1[2] = 0;
+    wordr1[3] = 0;
+
+    u32 wordr2[4];
+
+    wordr2[0] = 0;
+    wordr2[1] = 0;
+    wordr2[2] = 0;
+    wordr2[3] = 0;
+
+    u32 wordr3[4];
 
-    wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
-    wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
+    wordr3[0] = 0;
+    wordr3[1] = 0;
+    wordr3[2] = 0;
+    wordr3[3] = 0;
 
     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
     {
       switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
     }
 
-    u32x w0[4];
+    u32 w0[4];
 
     w0[0] = wordl0[0] | wordr0[0];
     w0[1] = wordl0[1] | wordr0[1];
     w0[2] = 0;
     w0[3] = 0;
 
-    u32x w1[4];
+    u32 w1[4];
 
     w1[0] = 0;
     w1[1] = 0;
     w1[2] = 0;
     w1[3] = 0;
 
-    u32x w2[4];
+    u32 w2[4];
 
     w2[0] = 0;
     w2[1] = 0;
     w2[2] = 0;
     w2[3] = 0;
 
-    u32x w3[4];
+    u32 w3[4];
 
     w3[0] = 0;
     w3[1] = 0;
@@ -860,10 +902,12 @@ __kernel void m08500_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
 
     _des_crypt_encrypt (iv, data, Kc, Kd, s_SPtrans);
 
-    u32x c = 0;
-    u32x d = 0;
+    const u32 r0 = iv[0];
+    const u32 r1 = iv[1];
+    const u32 r2 = 0;
+    const u32 r3 = 0;
 
-    COMPARE_S_SIMD (iv[0], iv[1], c, d);
+    #include COMPARE_S
   }
 }