Some final fixes for d_return_buf refactorization; Initial kernels vor veracrypts...
[hashcat.git] / OpenCL / m06231.cl
index f01eed0..90f248c 100644 (file)
@@ -1091,7 +1091,7 @@ __constant u32 Cl[8][256] =
 
 #define BOX(S,n,i) (S)[(n)][(i)]
 
-static void whirlpool_transform_last (u32 dgst[16], __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256])
+void whirlpool_transform_last (u32 dgst[16], __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256])
 {
   const u32 rch[R + 1] =
   {
@@ -1175,7 +1175,9 @@ static void whirlpool_transform_last (u32 dgst[16], __local u32 (*s_Ch)[256], __
 
     u32 i;
 
+    #ifdef _unroll
     #pragma unroll
+    #endif
     for (i = 0; i < 8; i++)
     {
       const u32 Lp0 = Kh[(i + 8) & 7] >> 24;
@@ -1223,7 +1225,9 @@ static void whirlpool_transform_last (u32 dgst[16], __local u32 (*s_Ch)[256], __
     Kh[7] = Lh[7];
     Kl[7] = Ll[7];
 
+    #ifdef _unroll
     #pragma unroll
+    #endif
     for (i = 0; i < 8; i++)
     {
       const u32 Lp0 = stateh[(i + 8) & 7] >> 24;
@@ -1290,7 +1294,7 @@ static void whirlpool_transform_last (u32 dgst[16], __local u32 (*s_Ch)[256], __
   dgst[15] ^= statel[7] ^ LAST_W15;
 }
 
-static void whirlpool_transform (const u32 w[16], u32 dgst[16], __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256])
+void whirlpool_transform (const u32 w[16], u32 dgst[16], __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256])
 {
   const u32 rch[R + 1] =
   {
@@ -1371,7 +1375,9 @@ static void whirlpool_transform (const u32 w[16], u32 dgst[16], __local u32 (*s_
 
     u32 i;
 
+    #ifdef _unroll
     #pragma unroll
+    #endif
     for (i = 0; i < 8; i++)
     {
       const u32 Lp0 = Kh[(i + 8) & 7] >> 24;
@@ -1419,7 +1425,9 @@ static void whirlpool_transform (const u32 w[16], u32 dgst[16], __local u32 (*s_
     Kh[7] = Lh[7];
     Kl[7] = Ll[7];
 
+    #ifdef _unroll
     #pragma unroll
+    #endif
     for (i = 0; i < 8; i++)
     {
       const u32 Lp0 = stateh[(i + 8) & 7] >> 24;
@@ -1486,7 +1494,7 @@ static void whirlpool_transform (const u32 w[16], u32 dgst[16], __local u32 (*s_
   dgst[15] ^= statel[7] ^ w[15];
 }
 
-static void hmac_run2a (const u32 w1[16], const u32 w2[16], const u32 ipad[16], const u32 opad[16], u32 dgst[16], __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256])
+void hmac_run2a (const u32 w1[16], const u32 w2[16], const u32 ipad[16], const u32 opad[16], u32 dgst[16], __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256])
 {
   dgst[ 0] = ipad[ 0];
   dgst[ 1] = ipad[ 1];
@@ -1549,7 +1557,7 @@ static void hmac_run2a (const u32 w1[16], const u32 w2[16], const u32 ipad[16],
   whirlpool_transform_last (dgst, s_Ch, s_Cl);
 }
 
-static void hmac_run2b (const u32 w1[16], const u32 ipad[16], const u32 opad[16], u32 dgst[16], __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256])
+void hmac_run2b (const u32 w1[16], const u32 ipad[16], const u32 opad[16], u32 dgst[16], __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256])
 {
   dgst[ 0] = ipad[ 0];
   dgst[ 1] = ipad[ 1];
@@ -1613,7 +1621,7 @@ static void hmac_run2b (const u32 w1[16], const u32 ipad[16], const u32 opad[16]
   whirlpool_transform_last (dgst, s_Ch, s_Cl);
 }
 
-static void hmac_init (u32 w[16], u32 ipad[16], u32 opad[16], __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256])
+void hmac_init (u32 w[16], u32 ipad[16], u32 opad[16], __local u32 (*s_Ch)[256], __local u32 (*s_Cl)[256])
 {
   w[ 0] ^= 0x36363636;
   w[ 1] ^= 0x36363636;
@@ -1688,7 +1696,7 @@ static void hmac_init (u32 w[16], u32 ipad[16], u32 opad[16], __local u32 (*s_Ch
   whirlpool_transform (w, opad, s_Ch, s_Cl);
 }
 
-static u32 u8add (const u32 a, const u32 b)
+u32 u8add (const u32 a, const u32 b)
 {
   const u32 a1 = (a >>  0) & 0xff;
   const u32 a2 = (a >>  8) & 0xff;
@@ -2193,6 +2201,8 @@ __kernel void m06231_comp (__global pw_t *pws, __global kernel_rule_t *rules_buf
   data[2] = esalt_bufs[0].data_buf[2];
   data[3] = esalt_bufs[0].data_buf[3];
 
+  const u32 signature = esalt_bufs[0].signature;
+
   u32 tmp[4];
 
   {
@@ -2203,11 +2213,9 @@ __kernel void m06231_comp (__global pw_t *pws, __global kernel_rule_t *rules_buf
 
     aes256_decrypt_xts (ukey1, ukey2, tmp, tmp);
 
-    if (((tmp[0] == 0x45555254) && (tmp[3] == 0)) || ((tmp[0] == 0x45555254) && ((tmp[1] >> 16) <= 5)))
+    if (((tmp[0] == signature) && (tmp[3] == 0)) || ((tmp[0] == signature) && ((tmp[1] >> 16) <= 5)))
     {
-      mark_hash (plains_buf, hashes_shown, 0, gid, 0);
-
-      d_return_buf[lid] = 1;
+      mark_hash (plains_buf, d_return_buf, salt_pos, 0, 0, gid, 0);
     }
   }
 
@@ -2219,11 +2227,9 @@ __kernel void m06231_comp (__global pw_t *pws, __global kernel_rule_t *rules_buf
 
     serpent256_decrypt_xts (ukey1, ukey2, tmp, tmp);
 
-    if (((tmp[0] == 0x45555254) && (tmp[3] == 0)) || ((tmp[0] == 0x45555254) && ((tmp[1] >> 16) <= 5)))
+    if (((tmp[0] == signature) && (tmp[3] == 0)) || ((tmp[0] == signature) && ((tmp[1] >> 16) <= 5)))
     {
-      mark_hash (plains_buf, hashes_shown, 0, gid, 0);
-
-      d_return_buf[lid] = 1;
+      mark_hash (plains_buf, d_return_buf, salt_pos, 0, 0, gid, 0);
     }
   }
 
@@ -2235,11 +2241,9 @@ __kernel void m06231_comp (__global pw_t *pws, __global kernel_rule_t *rules_buf
 
     twofish256_decrypt_xts (ukey1, ukey2, tmp, tmp);
 
-    if (((tmp[0] == 0x45555254) && (tmp[3] == 0)) || ((tmp[0] == 0x45555254) && ((tmp[1] >> 16) <= 5)))
+    if (((tmp[0] == signature) && (tmp[3] == 0)) || ((tmp[0] == signature) && ((tmp[1] >> 16) <= 5)))
     {
-      mark_hash (plains_buf, hashes_shown, 0, gid, 0);
-
-      d_return_buf[lid] = 1;
+      mark_hash (plains_buf, d_return_buf, salt_pos, 0, 0, gid, 0);
     }
   }
 }