From 8b50b6048487c729c826a9bf102e9781156b89b7 Mon Sep 17 00:00:00 2001 From: jsteube Date: Mon, 4 Jan 2016 19:23:21 +0100 Subject: [PATCH] More fixes for general OpenCL platforms --- OpenCL/m01500_a3.cl | 7 ++++++- OpenCL/m03000_a3.cl | 10 +++++++++- src/oclHashcat.c | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/OpenCL/m01500_a3.cl b/OpenCL/m01500_a3.cl index 8a0bf6baa..24bcc6df1 100644 --- a/OpenCL/m01500_a3.cl +++ b/OpenCL/m01500_a3.cl @@ -893,7 +893,7 @@ static void s8 (const u32 a1, const u32 a2, const u32 a3, const u32 a4, const u3 #endif #endif -#ifdef IS_AMD +#if defined IS_AMD || IS_UNKNOWN /* * Bitslice DES S-boxes making use of a vector conditional select operation @@ -1467,6 +1467,11 @@ s8(u32 a1, u32 a2, u32 a3, u32 a4, u32 a5, u32 a6, #define sXXX_DECL volatile #endif +#ifdef IS_UNKNOWN +#define KXX_DECL +#define sXXX_DECL +#endif + #ifdef DESCRYPT_SALT static void DESCrypt (const u32 SALT, const u32 K00, const u32 K01, const u32 K02, const u32 K03, const u32 K04, const u32 K05, const u32 K06, const u32 K07, const u32 K08, const u32 K09, const u32 K10, const u32 K11, const u32 K12, const u32 K13, const u32 K14, const u32 K15, const u32 K16, const u32 K17, const u32 K18, const u32 K19, const u32 K20, const u32 K21, const u32 K22, const u32 K23, const u32 K24, const u32 K25, const u32 K26, const u32 K27, const u32 K28, const u32 K29, const u32 K30, const u32 K31, const u32 K32, const u32 K33, const u32 K34, const u32 K35, const u32 K36, const u32 K37, const u32 K38, const u32 K39, const u32 K40, const u32 K41, const u32 K42, const u32 K43, const u32 K44, const u32 K45, const u32 K46, const u32 K47, const u32 K48, const u32 K49, const u32 K50, const u32 K51, const u32 K52, const u32 K53, const u32 K54, const u32 K55, u32 *D00, u32 *D01, u32 *D02, u32 *D03, u32 *D04, u32 *D05, u32 *D06, u32 *D07, u32 *D08, u32 *D09, u32 *D10, u32 *D11, u32 *D12, u32 *D13, u32 *D14, u32 *D15, u32 *D16, u32 *D17, u32 *D18, u32 *D19, u32 *D20, u32 *D21, u32 *D22, u32 *D23, u32 *D24, u32 *D25, u32 *D26, u32 *D27, u32 *D28, u32 *D29, u32 *D30, u32 *D31, u32 *D32, u32 *D33, u32 *D34, u32 *D35, u32 *D36, u32 *D37, u32 *D38, u32 *D39, u32 *D40, u32 *D41, u32 *D42, u32 *D43, u32 *D44, u32 *D45, u32 *D46, u32 *D47, u32 *D48, u32 *D49, u32 *D50, u32 *D51, u32 *D52, u32 *D53, u32 *D54, u32 *D55, u32 *D56, u32 *D57, u32 *D58, u32 *D59, u32 *D60, u32 *D61, u32 *D62, u32 *D63) diff --git a/OpenCL/m03000_a3.cl b/OpenCL/m03000_a3.cl index c9f84822b..9d0bee054 100644 --- a/OpenCL/m03000_a3.cl +++ b/OpenCL/m03000_a3.cl @@ -29,6 +29,10 @@ #define KXX_DECL volatile #endif +#ifdef IS_UNKNOWN +#define KXX_DECL +#endif + #ifdef IS_NV #if CUDA_ARCH >= 500 @@ -898,7 +902,7 @@ static void s8 (const u32 a1, const u32 a2, const u32 a3, const u32 a4, const u3 #endif #endif -#ifdef IS_AMD +#if defined IS_AMD || IS_UNKNOWN /* * Bitslice DES S-boxes making use of a vector conditional select operation @@ -1484,6 +1488,10 @@ static void DES (const u32 K00, const u32 K01, const u32 K02, const u32 K03, con #pragma unroll #endif + #ifdef IS_UNKNOWN + #pragma unroll 1 + #endif + for (u32 i = 0; i < 2; i++) { if (i) KEYSET10 else KEYSET00 diff --git a/src/oclHashcat.c b/src/oclHashcat.c index 3be4b896f..bf401615e 100644 --- a/src/oclHashcat.c +++ b/src/oclHashcat.c @@ -2537,6 +2537,29 @@ static void run_kernel_bzero (hc_device_param_t *device_param, cl_mem buf, const myfree (tmp); } + if (data.vendor_id == VENDOR_ID_POCL) + { + // NOTE: clEnqueueFillBuffer () segfaults with Ubuntu 15.04 pocl + // We need to workaround... + + #define FILLSZ 0x100000 + + char *tmp = (char *) mymalloc (FILLSZ); + + memset (tmp, 0, FILLSZ); + + for (uint i = 0; i < size; i += FILLSZ) + { + const int left = size - i; + + const int fillsz = MIN (FILLSZ, left); + + hc_clEnqueueWriteBuffer (device_param->command_queue, buf, CL_TRUE, i, fillsz, tmp, 0, NULL, NULL); + } + + myfree (tmp); + } + if (data.vendor_id == VENDOR_ID_UNKNOWN) { const cl_uchar zero = 0; @@ -12777,6 +12800,20 @@ int main (int argc, char **argv) device_param->sm_major = sm_major; } + if (vendor_id == VENDOR_ID_POCL) + { + cl_uint gpu_processor_cores = 1; + + device_param->gpu_processor_cores = gpu_processor_cores; + } + + if (vendor_id == VENDOR_ID_UNKNOWN) + { + cl_uint gpu_processor_cores = 1; + + device_param->gpu_processor_cores = gpu_processor_cores; + } + /** * common driver check */