small fix for unknown opencl platforms
authorjsteube <jens.steube@gmail.com>
Mon, 4 Jan 2016 15:13:10 +0000 (16:13 +0100)
committerjsteube <jens.steube@gmail.com>
Mon, 4 Jan 2016 15:13:10 +0000 (16:13 +0100)
OpenCL/types_ocl.c
include/kernel_functions.c
src/oclHashcat.c

index 8f442b2..2fa42ae 100644 (file)
@@ -346,14 +346,14 @@ static inline u32 rotl32 (const u32 a, const u32 n)
   return rotate (a, n);
 }
 
-static inline u64 rotr64 (const u64 a, const u64 n)
+static inline u64 rotr64 (const u64 a, const u32 n)
 {
-  return rotate (a, 64 - n);
+  return rotate (a, (u64) 64 - n);
 }
 
-static inline u64 rotl64 (const u64 a, const u64 n)
+static inline u64 rotl64 (const u64 a, const u32 n)
 {
-  return rotate (a, n);
+  return rotr64 (a, (u64) 64 - n);
 }
 
 #endif
@@ -368,7 +368,8 @@ static inline u32 rotr32 (const u32 a, const u32 n)
 
 static inline u32 rotl32 (const u32 a, const u32 n)
 {
-  return rotate (a, n);
+//  return rotate (a, n);
+  return (a << n) | (a >> (32 - n));
 }
 
 static inline u64 rotr64 (const u64 a, const u32 n)
@@ -378,7 +379,7 @@ static inline u64 rotr64 (const u64 a, const u32 n)
 
 static inline u64 rotl64 (const u64 a, const u32 n)
 {
-  return rotr64 (a, 64 - n);
+  return rotr64 (a, (u64) 64 - n);
 }
 
 #endif
index 23d4a6d..b5cad0f 100644 (file)
@@ -37,8 +37,8 @@
 #define MD4_F(x,y,z)    (((x) & (y)) | ((~(x)) & (z)))
 #define MD4_G(x,y,z)    (((x) & (y)) | ((x) & (z)) | ((y) & (z)))
 #define MD4_H(x,y,z)    ((x) ^ (y) ^ (z))
-#define MD4_H1(x,y,z)   ((tmp2 = (x) ^ (y)) ^ (z))
-#define MD4_H2(x,y,z)   ((x) ^ tmp2)
+#define MD5_H1(x,y,z)   (MD4_H((x), (y), (z)))
+#define MD5_H2(x,y,z)   (MD4_H((x), (y), (z)))
 #define MD4_Fo(x,y,z)   (MD4_F((x), (y), (z)))
 #define MD4_Go(x,y,z)   (MD4_G((x), (y), (z)))
 #endif
@@ -97,8 +97,8 @@
 #define MD5_F(x,y,z)    ((z) ^ ((x) & ((y) ^ (z))))
 #define MD5_G(x,y,z)    ((y) ^ ((z) & ((x) ^ (y))))
 #define MD5_H(x,y,z)    ((x) ^ (y) ^ (z))
-#define MD5_H1(x,y,z)   ((tmp2 = (x) ^ (y)) ^ (z))
-#define MD5_H2(x,y,z)   ((x) ^ tmp2)
+#define MD5_H1(x,y,z)   (MD5_H((x), (y), (z)))
+#define MD5_H2(x,y,z)   (MD5_H((x), (y), (z)))
 #define MD5_I(x,y,z)    ((y) ^ ((x) | ~(z)))
 #define MD5_Fo(x,y,z)   (MD5_F((x), (y), (z)))
 #define MD5_Go(x,y,z)   (MD5_G((x), (y), (z)))
index f068042..3be4b89 100644 (file)
@@ -2536,6 +2536,13 @@ static void run_kernel_bzero (hc_device_param_t *device_param, cl_mem buf, const
 
     myfree (tmp);
   }
+
+  if (data.vendor_id == VENDOR_ID_UNKNOWN)
+  {
+    const cl_uchar zero = 0;
+
+    hc_clEnqueueFillBuffer (device_param->command_queue, buf, &zero, sizeof (cl_uchar), 0, size, 0, NULL, NULL);
+  }
 }
 
 static int run_rule_engine (const int rule_len, const char *rule_buf)