static inline u64 rotr64_S (const u64 a, const u32 n)
{
- #if (DEVICE_TYPE == DEVICE_TYPE_GPU)
-
- #ifdef cl_amd_media_ops
-
const u32 a0 = h32_from_64_S (a);
const u32 a1 = l32_from_64_S (a);
const u64 r = hl32_to_64_S (t0, t1);
- #else
-
- const u64 r = rotate (a, (u64) 64 - n);
-
- #endif
-
- #else
-
- const u64 r = rotate (a, (u64) 64 - n);
-
- #endif
-
return r;
}
static inline u64x rotr64 (const u64x a, const u32 n)
{
- #if (DEVICE_TYPE == DEVICE_TYPE_GPU)
-
- #ifdef cl_amd_media_ops
-
const u32x a0 = h32_from_64 (a);
const u32x a1 = l32_from_64 (a);
const u64x r = hl32_to_64 (t0, t1);
- #else
-
- const u64x r = rotate (a, (u64) 64 - n);
-
- #endif
-
- #else
-
- const u64x r = rotate (a, (u64) 64 - n);
-
- #endif
-
return r;
}
static inline u32 __bfe (const u32 a, const u32 b, const u32 c)
{
- #ifdef cl_amd_media_ops2
-
return amd_bfe (a, b, c);
-
- #else
-
- #define BIT(x) (1 << (x))
- #define BIT_MASK(x) (BIT (x) - 1)
- #define BFE(x,y,z) (((x) >> (y)) & BIT_MASK (z))
-
- return BFE (a, b, c);
-
- #endif
}
static inline u32 amd_bytealign_S (const u32 a, const u32 b, const u32 c)
{
- #ifdef cl_amd_media_ops
-
return amd_bytealign (a, b, c);
-
- #else
-
- const u64 tmp = ((((u64) a) << 32) | ((u64) b)) >> ((c & 3) * 8);
-
- return (u32) (tmp);
-
- #endif
}
#endif
* shared stuff
*/
-#define ETC_MAX (60 * 60 * 24 * 365 * 10)
+#define ETC_MAX (60 * 60 * 24 * 365 * 10)
-#define DEVICES_MAX 128
+#define DEVICES_MAX 128
-#define CL_PLATFORMS_MAX 16
+#define CL_PLATFORMS_MAX 16
-#define CL_VENDOR_NV "NVIDIA Corporation"
-#define CL_VENDOR_AMD "Advanced Micro Devices, Inc."
-#define CL_VENDOR_APPLE "Apple"
-#define CL_VENDOR_POCL "The pocl project"
+#define CL_VENDOR_AMD "Advanced Micro Devices, Inc."
+#define CL_VENDOR_APPLE "Apple"
+#define CL_VENDOR_INTEL_BEIGNET "Intel"
+#define CL_VENDOR_INTEL_SDK "Intel(R) OpenCL"
+#define CL_VENDOR_MESA "Mesa"
+#define CL_VENDOR_NV "NVIDIA Corporation"
+#define CL_VENDOR_POCL "The pocl project"
-#define VENDOR_ID_AMD 4098
-#define VENDOR_ID_NV 4318
-#define VENDOR_ID_APPLE_INTEL 4294967295
-#define VENDOR_ID_APPLE_IRIS 16925952
-#define VENDOR_ID_GENERIC 9999
+#define VENDOR_ID_AMD (1 << 0)
+#define VENDOR_ID_APPLE (1 << 1)
+#define VENDOR_ID_INTEL_BEIGNET (1 << 2)
+#define VENDOR_ID_INTEL_SDK (1 << 3)
+#define VENDOR_ID INTEL (1 << 4)
+#define VENDOR_ID_MESA (1 << 5)
+#define VENDOR_ID_NV (1 << 6)
+#define VENDOR_ID_POCL (1 << 7)
+#define VENDOR_ID_GENERIC (1 << 31)
-#define BLOCK_SIZE 64
+#define BLOCK_SIZE 64
-#define CHARSIZ 0x100
-#define INFOSZ CHARSIZ
+#define CHARSIZ 0x100
+#define INFOSZ CHARSIZ
-#define SP_HCSTAT "hashcat.hcstat"
-#define SP_PW_MIN 2
-#define SP_PW_MAX 64
-#define SP_ROOT_CNT (SP_PW_MAX * CHARSIZ)
-#define SP_MARKOV_CNT (SP_PW_MAX * CHARSIZ * CHARSIZ)
+#define SP_HCSTAT "hashcat.hcstat"
+#define SP_PW_MIN 2
+#define SP_PW_MAX 64
+#define SP_ROOT_CNT (SP_PW_MAX * CHARSIZ)
+#define SP_MARKOV_CNT (SP_PW_MAX * CHARSIZ * CHARSIZ)
-#define TUNING_DB_FILE "hashcat_tuning.hctab"
+#define TUNING_DB_FILE "hashcat_tuning.hctab"
-#define INDUCT_DIR "induct"
-#define OUTFILES_DIR "outfiles"
+#define INDUCT_DIR "induct"
+#define OUTFILES_DIR "outfiles"
-#define LOOPBACK_FILE "hashcat.loopback"
+#define LOOPBACK_FILE "hashcat.loopback"
-#define DICTSTAT_FILENAME "hashcat.dictstat"
-#define POTFILE_FILENAME "hashcat.pot"
+#define DICTSTAT_FILENAME "hashcat.dictstat"
+#define POTFILE_FILENAME "hashcat.pot"
/**
* types
*/
#ifdef _WIN
-typedef LARGE_INTEGER hc_timer_t;
-typedef HANDLE hc_thread_t;
-typedef CRITICAL_SECTION hc_thread_mutex_t;
+typedef LARGE_INTEGER hc_timer_t;
+typedef HANDLE hc_thread_t;
+typedef CRITICAL_SECTION hc_thread_mutex_t;
#elif _POSIX
-typedef struct timeval hc_timer_t;
-typedef pthread_t hc_thread_t;
-typedef pthread_mutex_t hc_thread_mutex_t;
+typedef struct timeval hc_timer_t;
+typedef pthread_t hc_thread_t;
+typedef pthread_mutex_t hc_thread_mutex_t;
#endif
#include <types.h>
#define DISPLAY_LEN_MAX_11100 10 + 32 + 1 + 8 + 1 + 32
#define DISPLAY_LEN_MIN_11200 9 + 40 + 1 + 40
#define DISPLAY_LEN_MAX_11200 9 + 40 + 1 + 40
-#define DISPLAY_LEN_MIN_11300 1 + 7 + 1 + 2 + 1 + 96 + 1 + 2 + 1 + 16 + 1 + 1 + 1 + 2 + 1 + 96 + 1 + 2 + 1 + 66
-#define DISPLAY_LEN_MAX_11300 1 + 7 + 1 + 2 + 1 + 96 + 1 + 2 + 1 + 16 + 1 + 6 + 1 + 2 + 1 + 96 + 1 + 2 + 1 + 66
+#define DISPLAY_LEN_MIN_11300 1 + 7 + 1 + 2 + 1 + 96 + 1 + 2 + 1 + 16 + 1 + 1 + 1 + 2 + 1 + 96 + 1 + 1 + 1 + 2
+#define DISPLAY_LEN_MAX_11300 1 + 7 + 1 + 2 + 1 + 96 + 1 + 2 + 1 + 16 + 1 + 6 + 1 + 2 + 1 + 96 + 1 + 3 + 1 + 512
#define DISPLAY_LEN_MIN_11400 6 + 0 + 1 + 0 + 1 + 0 + 1 + 0 + 1 + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 1 + 0 + 1 + 3 + 1 + 32
#define DISPLAY_LEN_MAX_11400 6 + 512 + 1 + 512 + 1 + 116 + 1 + 116 + 1 + 246 + 1 + 245 + 1 + 246 + 1 + 245 + 1 + 50 + 1 + 50 + 1 + 50 + 1 + 50 + 1 + 3 + 1 + 32
#define DISPLAY_LEN_MIN_11500 8 + 1 + 8
hc_clGetDeviceIDs (data.ocl, platform, CL_DEVICE_TYPE_ALL, DEVICES_MAX, platform_devices, &platform_devices_cnt);
+ char platform_vendor[INFOSZ] = { 0 };
+
+ hc_clGetPlatformInfo (data.ocl, platform, CL_PLATFORM_VENDOR, sizeof (platform_vendor), platform_vendor, NULL);
+
+ // find our own platform vendor because pocl and mesa are pushing original vendor_id through opencl
+ // this causes trouble with vendor id based macros
+ // we'll assign generic to those without special optimization available
+
+ cl_uint vendor_id = 0;
+
+ if (strcmp (platform_vendor, CL_VENDOR_AMD) == 0)
+ {
+ vendor_id = VENDOR_ID_AMD;
+ }
+ else if (strcmp (platform_vendor, CL_VENDOR_APPLE) == 0)
+ {
+ vendor_id = VENDOR_ID_GENERIC;
+ }
+ else if (strcmp (platform_vendor, CL_VENDOR_INTEL_BEIGNET) == 0)
+ {
+ vendor_id = VENDOR_ID_GENERIC;
+ }
+ else if (strcmp (platform_vendor, CL_VENDOR_INTEL_SDK) == 0)
+ {
+ vendor_id = VENDOR_ID_GENERIC;
+ }
+ else if (strcmp (platform_vendor, CL_VENDOR_MESA) == 0)
+ {
+ vendor_id = VENDOR_ID_GENERIC;
+ }
+ else if (strcmp (platform_vendor, CL_VENDOR_NV) == 0)
+ {
+ vendor_id = VENDOR_ID_NV;
+ }
+ else if (strcmp (platform_vendor, CL_VENDOR_POCL) == 0)
+ {
+ vendor_id = VENDOR_ID_GENERIC;
+ }
+ else
+ {
+ vendor_id = VENDOR_ID_GENERIC;
+ }
+
for (uint platform_devices_id = 0; platform_devices_id < platform_devices_cnt; platform_devices_id++)
{
size_t param_value_size = 0;
hc_device_param_t *device_param = &data.devices_param[device_id];
+ device_param->vendor_id = vendor_id;
+
device_param->device = platform_devices[platform_devices_id];
device_param->device_id = device_id;
device_param->device_type = device_type;
- // vendor_id
-
- cl_uint vendor_id = 0;
-
- hc_clGetDeviceInfo (data.ocl, device_param->device, CL_DEVICE_VENDOR_ID, sizeof (vendor_id), &vendor_id, NULL);
-
- device_param->vendor_id = vendor_id;
-
// device_name
hc_clGetDeviceInfo (data.ocl, device_param->device, CL_DEVICE_NAME, 0, NULL, ¶m_value_size);
myfree (device_opencl_version);
- if (strstr (device_version, "pocl"))
- {
- // pocl returns the real vendor_id in CL_DEVICE_VENDOR_ID which causes many problems because of hms and missing amd_bfe () etc
- // we need to overwrite vendor_id to avoid this. maybe open pocl issue?
-
- cl_uint vendor_id = VENDOR_ID_GENERIC;
-
- device_param->vendor_id = vendor_id;
- }
-
// vector_width
cl_uint vector_width;
{
if (vendor_id == VENDOR_ID_AMD)
{
- if (strstr (device_version, "MESA"))
- {
- // MESA stuff
- }
- else
- {
- cl_uint device_processor_cores = 0;
+ cl_uint device_processor_cores = 0;
- #define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043
+ #define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043
- hc_clGetDeviceInfo (data.ocl, device_param->device, CL_DEVICE_WAVEFRONT_WIDTH_AMD, sizeof (device_processor_cores), &device_processor_cores, NULL);
+ hc_clGetDeviceInfo (data.ocl, device_param->device, CL_DEVICE_WAVEFRONT_WIDTH_AMD, sizeof (device_processor_cores), &device_processor_cores, NULL);
- device_param->device_processor_cores = device_processor_cores;
- }
+ device_param->device_processor_cores = device_processor_cores;
}
else if (vendor_id == VENDOR_ID_NV)
{
if (device_param->skipped == 0)
{
- if (strstr (device_version, "pocl"))
+ if (device_type & CL_DEVICE_TYPE_GPU)
{
- if (force == 0)
+ if (vendor_id == VENDOR_ID_AMD)
{
- log_info ("");
- log_info ("ATTENTION! All pocl drivers are known to be broken due to broken LLVM <= 3.7");
- log_info ("You are STRONGLY encouraged not to use it");
- log_info ("You can use --force to override this but do not post error reports if you do so");
- log_info ("");
+ int catalyst_check = (force == 1) ? 0 : 1;
- return (-1);
- }
- }
+ int catalyst_warn = 0;
- if (device_type & CL_DEVICE_TYPE_GPU)
- {
- if (vendor_id == VENDOR_ID_NV)
+ int catalyst_broken = 0;
+
+ if (catalyst_check == 1)
+ {
+ catalyst_warn = 1;
+
+ // v14.9 and higher
+ if (atoi (device_param->driver_version) >= 1573)
+ {
+ catalyst_warn = 0;
+ }
+
+ catalyst_check = 0;
+ }
+
+ if (catalyst_broken == 1)
+ {
+ log_info ("");
+ log_info ("ATTENTION! The installed catalyst driver in your system is known to be broken!");
+ log_info ("It will pass over cracked hashes and does not report them as cracked");
+ log_info ("You are STRONGLY encouraged not to use it");
+ log_info ("You can use --force to override this but do not post error reports if you do so");
+ log_info ("");
+
+ return (-1);
+ }
+
+ if (catalyst_warn == 1)
+ {
+ log_info ("");
+ log_info ("ATTENTION! Unsupported or incorrect installed catalyst driver detected!");
+ log_info ("You are STRONGLY encouraged to use the official supported catalyst driver for good reasons");
+ log_info ("See oclHashcat's homepage for official supported catalyst drivers");
+ #ifdef _WIN
+ log_info ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
+ #endif
+ log_info ("You can use --force to override this but do not post error reports if you do so");
+ log_info ("");
+
+ return (-1);
+ }
+ }
+ else if (vendor_id == VENDOR_ID_NV)
{
if (device_param->kernel_exec_timeout != 0)
{
if (data.quiet == 0) log_info (" See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch");
}
}
- else if (vendor_id == VENDOR_ID_AMD)
+ else if (vendor_id == VENDOR_ID_POCL)
{
- if (strstr (device_version, "MESA"))
+ if (force == 0)
{
- // MESA stuff
- }
- else
- {
- int catalyst_check = (force == 1) ? 0 : 1;
-
- int catalyst_warn = 0;
-
- int catalyst_broken = 0;
-
- if (catalyst_check == 1)
- {
- catalyst_warn = 1;
-
- // v14.9 and higher
- if (atoi (device_param->driver_version) >= 1573)
- {
- catalyst_warn = 0;
- }
-
- catalyst_check = 0;
- }
-
- if (catalyst_broken == 1)
- {
- log_info ("");
- log_info ("ATTENTION! The installed catalyst driver in your system is known to be broken!");
- log_info ("It will pass over cracked hashes and does not report them as cracked");
- log_info ("You are STRONGLY encouraged not to use it");
- log_info ("You can use --force to override this but do not post error reports if you do so");
- log_info ("");
-
- return (-1);
- }
+ log_info ("");
+ log_info ("ATTENTION! All pocl drivers are known to be broken due to broken LLVM <= 3.7");
+ log_info ("You are STRONGLY encouraged not to use it");
+ log_info ("You can use --force to override this but do not post error reports if you do so");
+ log_info ("");
- if (catalyst_warn == 1)
- {
- log_info ("");
- log_info ("ATTENTION! Unsupported or incorrect installed catalyst driver detected!");
- log_info ("You are STRONGLY encouraged to use the official supported catalyst driver for good reasons");
- log_info ("See oclHashcat's homepage for official supported catalyst drivers");
- #ifdef _WIN
- log_info ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
- #endif
- log_info ("You can use --force to override this but do not post error reports if you do so");
- log_info ("");
-
- return (-1);
- }
+ return (-1);
}
}
}