mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-03 12:21:07 +00:00
Replace all #ifdef with #if defined (...) for convention
This commit is contained in:
parent
eb00cd959f
commit
9eb47153d4
@ -9,21 +9,21 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#endif // _POSIX
|
#endif // _POSIX
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined (__APPLE__)
|
||||||
#include <mach-o/dyld.h>
|
#include <mach-o/dyld.h>
|
||||||
#include <mach/mach.h>
|
#include <mach/mach.h>
|
||||||
#endif // __APPLE__
|
#endif // __APPLE__
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif // _WIN
|
#endif // _WIN
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined (__APPLE__)
|
||||||
typedef struct cpu_set
|
typedef struct cpu_set
|
||||||
{
|
{
|
||||||
uint32_t count;
|
uint32_t count;
|
||||||
|
@ -8,6 +8,18 @@
|
|||||||
#ifndef _COMMON_H
|
#ifndef _COMMON_H
|
||||||
#define _COMMON_H
|
#define _COMMON_H
|
||||||
|
|
||||||
|
#if defined (__linux__)
|
||||||
|
#define _POSIX
|
||||||
|
#elif defined (__APPLE__)
|
||||||
|
#define _POSIX
|
||||||
|
#elif defined (__FreeBSD__)
|
||||||
|
#define _POSIX
|
||||||
|
#elif defined (_WIN32) || defined (_WIN64)
|
||||||
|
#define _WIN
|
||||||
|
#else
|
||||||
|
#error Your Operating System is not supported or detected
|
||||||
|
#endif
|
||||||
|
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#define _FILE_OFFSET_BITS 64
|
#define _FILE_OFFSET_BITS 64
|
||||||
|
|
||||||
@ -32,11 +44,11 @@
|
|||||||
|
|
||||||
#define CEIL(a) ((a - (int) (a)) > 0 ? a + 1 : a)
|
#define CEIL(a) ((a - (int) (a)) > 0 ? a + 1 : a)
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined (__APPLE__)
|
||||||
#define __stdcall
|
#define __stdcall
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ typedef struct
|
|||||||
* hardware watchdog
|
* hardware watchdog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMON)
|
||||||
void *hm_adl;
|
void *hm_adl;
|
||||||
void *hm_nvml;
|
void *hm_nvml;
|
||||||
void *hm_nvapi;
|
void *hm_nvapi;
|
||||||
@ -192,7 +192,7 @@ typedef struct
|
|||||||
uint dgst_pos2;
|
uint dgst_pos2;
|
||||||
uint dgst_pos3;
|
uint dgst_pos3;
|
||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMON)
|
||||||
uint gpu_temp_disable;
|
uint gpu_temp_disable;
|
||||||
uint gpu_temp_abort;
|
uint gpu_temp_abort;
|
||||||
uint gpu_temp_retain;
|
uint gpu_temp_retain;
|
||||||
|
@ -8,18 +8,18 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#ifdef __APPLE__
|
#if defined (__APPLE__)
|
||||||
#include <mach-o/dyld.h>
|
#include <mach-o/dyld.h>
|
||||||
#endif // __APPLE__
|
#endif // __APPLE__
|
||||||
#endif // _POSIX
|
#endif // _POSIX
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif // _WIN
|
#endif // _WIN
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
#define hc_dlopen LoadLibrary
|
#define hc_dlopen LoadLibrary
|
||||||
#define hc_dlclose FreeLibrary
|
#define hc_dlclose FreeLibrary
|
||||||
#define hc_dlsym GetProcAddress
|
#define hc_dlsym GetProcAddress
|
||||||
|
@ -304,7 +304,7 @@ typedef int (ADL_API_CALL *ADL_OVERDRIVE6_TARGETTEMPERATUREDATA_GET) (int, int *
|
|||||||
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_TARGETTEMPERATURERANGEINFO_GET) (int, ADLOD6ParameterRange *);
|
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_TARGETTEMPERATURERANGEINFO_GET) (int, ADLOD6ParameterRange *);
|
||||||
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_FANSPEED_RESET) (int);
|
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_FANSPEED_RESET) (int);
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
typedef void *ADL_LIB;
|
typedef void *ADL_LIB;
|
||||||
#else
|
#else
|
||||||
typedef HINSTANCE ADL_LIB;
|
typedef HINSTANCE ADL_LIB;
|
||||||
|
@ -11,19 +11,19 @@
|
|||||||
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
|
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
|
||||||
#define CL_USE_DEPRECATED_OPENCL_2_0_APIS
|
#define CL_USE_DEPRECATED_OPENCL_2_0_APIS
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined (__APPLE__)
|
||||||
#include <OpenCL/cl.h>
|
#include <OpenCL/cl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
#include <CL/cl.h>
|
#include <CL/cl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __linux__
|
#if defined (__linux__)
|
||||||
#include <CL/cl.h>
|
#include <CL/cl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#if defined (__FreeBSD__)
|
||||||
#include <CL/cl.h>
|
#include <CL/cl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ typedef cl_int (CL_API_CALL *OCL_CLRELEASEPROGRAM) (cl_progra
|
|||||||
typedef cl_int (CL_API_CALL *OCL_CLSETKERNELARG) (cl_kernel, cl_uint, size_t, const void *);
|
typedef cl_int (CL_API_CALL *OCL_CLSETKERNELARG) (cl_kernel, cl_uint, size_t, const void *);
|
||||||
typedef cl_int (CL_API_CALL *OCL_CLWAITFOREVENTS) (cl_uint, const cl_event *);
|
typedef cl_int (CL_API_CALL *OCL_CLWAITFOREVENTS) (cl_uint, const cl_event *);
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
typedef void *OCL_LIB;
|
typedef void *OCL_LIB;
|
||||||
#else
|
#else
|
||||||
typedef HINSTANCE OCL_LIB;
|
typedef HINSTANCE OCL_LIB;
|
||||||
|
@ -233,7 +233,7 @@ typedef int (*NVAPI_API_CALL NVAPI_GPU_GETPERFPOLICIESSTATUS) (NvPhysicalGpuHand
|
|||||||
typedef int (*NVAPI_API_CALL NVAPI_GPU_SETCOOLERLEVELS) (NvPhysicalGpuHandle, NvU32, NV_GPU_COOLER_LEVELS *);
|
typedef int (*NVAPI_API_CALL NVAPI_GPU_SETCOOLERLEVELS) (NvPhysicalGpuHandle, NvU32, NV_GPU_COOLER_LEVELS *);
|
||||||
typedef int (*NVAPI_API_CALL NVAPI_GPU_RESTORECOOLERSETTINGS) (NvPhysicalGpuHandle, NvU32);
|
typedef int (*NVAPI_API_CALL NVAPI_GPU_RESTORECOOLERSETTINGS) (NvPhysicalGpuHandle, NvU32);
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
typedef void *NVAPI_LIB;
|
typedef void *NVAPI_LIB;
|
||||||
#else
|
#else
|
||||||
typedef HINSTANCE NVAPI_LIB;
|
typedef HINSTANCE NVAPI_LIB;
|
||||||
|
@ -189,7 +189,7 @@ typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_GET_POWERMANAGEMENTLIMITCONSTRA
|
|||||||
typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_SET_POWERMANAGEMENTLIMIT) (nvmlDevice_t, unsigned int);
|
typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_SET_POWERMANAGEMENTLIMIT) (nvmlDevice_t, unsigned int);
|
||||||
typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_GET_POWERMANAGEMENTLIMIT) (nvmlDevice_t, unsigned int *);
|
typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_GET_POWERMANAGEMENTLIMIT) (nvmlDevice_t, unsigned int *);
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
typedef void *NVML_LIB;
|
typedef void *NVML_LIB;
|
||||||
#else
|
#else
|
||||||
typedef HINSTANCE NVML_LIB;
|
typedef HINSTANCE NVML_LIB;
|
||||||
|
@ -49,7 +49,7 @@ typedef int HM_ADAPTER_XNVCTRL;
|
|||||||
typedef int (*XNVCTRL_API_CALL XNVCTRLQUERYTARGETATTRIBUTE) (void *, int, int, unsigned int, unsigned int, int *);
|
typedef int (*XNVCTRL_API_CALL XNVCTRLQUERYTARGETATTRIBUTE) (void *, int, int, unsigned int, unsigned int, int *);
|
||||||
typedef void (*XNVCTRL_API_CALL XNVCTRLSETTARGETATTRIBUTE) (void *, int, int, unsigned int, unsigned int, int);
|
typedef void (*XNVCTRL_API_CALL XNVCTRLSETTARGETATTRIBUTE) (void *, int, int, unsigned int, unsigned int, int);
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
typedef void *XNVCTRL_LIB;
|
typedef void *XNVCTRL_LIB;
|
||||||
#else
|
#else
|
||||||
typedef HINSTANCE XNVCTRL_LIB;
|
typedef HINSTANCE XNVCTRL_LIB;
|
||||||
|
@ -10,14 +10,14 @@
|
|||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifdef __APPLE__
|
#if defined (__APPLE__)
|
||||||
#include <mach-o/dyld.h>
|
#include <mach-o/dyld.h>
|
||||||
#endif // __APPLE__
|
#endif // __APPLE__
|
||||||
#endif // _POSIX
|
#endif // _POSIX
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#ifdef F_SETLKW
|
#if defined (F_SETLKW)
|
||||||
|
|
||||||
void lock_file (FILE *fp);
|
void lock_file (FILE *fp);
|
||||||
void unlock_file (FILE *fp);
|
void unlock_file (FILE *fp);
|
||||||
|
@ -10,12 +10,12 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#endif // _POSIX
|
#endif // _POSIX
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <psapi.h>
|
#include <psapi.h>
|
||||||
#endif // _WIN
|
#endif // _WIN
|
||||||
|
@ -20,13 +20,13 @@
|
|||||||
* OS specific includes
|
* OS specific includes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#endif // _POSIX
|
#endif // _POSIX
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif // _WIN
|
#endif // _WIN
|
||||||
|
|
||||||
@ -37,9 +37,9 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
#define hc_sleep(x) Sleep ((x) * 1000);
|
#define hc_sleep(x) Sleep ((x) * 1000);
|
||||||
#elif _POSIX
|
#elif defined (_POSIX)
|
||||||
#define hc_sleep(x) sleep ((x));
|
#define hc_sleep(x) sleep ((x));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ void naive_escape (char *s, size_t s_max, const u8 key_char, const u8 escape_cha
|
|||||||
|
|
||||||
void check_checkpoint (void);
|
void check_checkpoint (void);
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
|
|
||||||
BOOL WINAPI sigHandler_default (DWORD sig);
|
BOOL WINAPI sigHandler_default (DWORD sig);
|
||||||
BOOL WINAPI sigHandler_benchmark (DWORD sig);
|
BOOL WINAPI sigHandler_benchmark (DWORD sig);
|
||||||
|
@ -13,14 +13,14 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#ifdef __APPLE__
|
#if defined (__APPLE__)
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#endif // __APPLE__
|
#endif // __APPLE__
|
||||||
#endif // _POSIX
|
#endif // _POSIX
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif // _WIN
|
#endif // _WIN
|
||||||
|
|
||||||
|
@ -6,23 +6,23 @@
|
|||||||
#ifndef _THREAD_H
|
#ifndef _THREAD_H
|
||||||
#define _THREAD_H
|
#define _THREAD_H
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
#endif // _POSIX
|
#endif // _POSIX
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif // _WIN
|
#endif // _WIN
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
typedef HANDLE hc_thread_t;
|
typedef HANDLE hc_thread_t;
|
||||||
typedef CRITICAL_SECTION hc_thread_mutex_t;
|
typedef CRITICAL_SECTION hc_thread_mutex_t;
|
||||||
#elif _POSIX
|
#elif defined (_POSIX)
|
||||||
typedef pthread_t hc_thread_t;
|
typedef pthread_t hc_thread_t;
|
||||||
typedef pthread_mutex_t hc_thread_mutex_t;
|
typedef pthread_mutex_t hc_thread_mutex_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
|
|
||||||
#define hc_thread_create(t,f,a) t = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE) &f, a, 0, NULL)
|
#define hc_thread_create(t,f,a) t = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE) &f, a, 0, NULL)
|
||||||
#define hc_thread_wait(n,a) for (uint i = 0; i < n; i++) WaitForSingleObject ((a)[i], INFINITE)
|
#define hc_thread_wait(n,a) for (uint i = 0; i < n; i++) WaitForSingleObject ((a)[i], INFINITE)
|
||||||
@ -33,7 +33,7 @@ typedef pthread_mutex_t hc_thread_mutex_t;
|
|||||||
#define hc_thread_mutex_init(m) InitializeCriticalSection (&m)
|
#define hc_thread_mutex_init(m) InitializeCriticalSection (&m)
|
||||||
#define hc_thread_mutex_delete(m) DeleteCriticalSection (&m)
|
#define hc_thread_mutex_delete(m) DeleteCriticalSection (&m)
|
||||||
|
|
||||||
#elif _POSIX
|
#elif defined (_POSIX)
|
||||||
|
|
||||||
#define hc_thread_create(t,f,a) pthread_create (&t, NULL, f, a)
|
#define hc_thread_create(t,f,a) pthread_create (&t, NULL, f, a)
|
||||||
#define hc_thread_wait(n,a) for (uint i = 0; i < n; i++) pthread_join ((a)[i], NULL)
|
#define hc_thread_wait(n,a) for (uint i = 0; i < n; i++) pthread_join ((a)[i], NULL)
|
||||||
|
@ -6,23 +6,23 @@
|
|||||||
#ifndef _TIMER_H
|
#ifndef _TIMER_H
|
||||||
#define _TIMER_H
|
#define _TIMER_H
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
typedef LARGE_INTEGER hc_timer_t;
|
typedef LARGE_INTEGER hc_timer_t;
|
||||||
#elif _POSIX
|
#elif defined (_POSIX)
|
||||||
typedef struct timeval hc_timer_t;
|
typedef struct timeval hc_timer_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
|
|
||||||
#define hc_timer_get(a,r) { hc_timer_t hr_freq; QueryPerformanceFrequency (&hr_freq); hc_timer_t hr_tmp; hc_timer_set (&hr_tmp); (r) = (double) ((double) (hr_tmp.QuadPart - (a).QuadPart) / (double) (hr_freq.QuadPart / 1000)); }
|
#define hc_timer_get(a,r) { hc_timer_t hr_freq; QueryPerformanceFrequency (&hr_freq); hc_timer_t hr_tmp; hc_timer_set (&hr_tmp); (r) = (double) ((double) (hr_tmp.QuadPart - (a).QuadPart) / (double) (hr_freq.QuadPart / 1000)); }
|
||||||
#define hc_timer_set(a) { QueryPerformanceCounter ((a)); }
|
#define hc_timer_set(a) { QueryPerformanceCounter ((a)); }
|
||||||
|
|
||||||
#elif _POSIX
|
#elif defined (_POSIX)
|
||||||
|
|
||||||
#define hc_timer_get(a,r) { hc_timer_t hr_tmp; hc_timer_set (&hr_tmp); (r) = (double) (((hr_tmp.tv_sec - (a).tv_sec) * 1000) + ((double) (hr_tmp.tv_usec - (a).tv_usec) / 1000)); }
|
#define hc_timer_get(a,r) { hc_timer_t hr_tmp; hc_timer_set (&hr_tmp); (r) = (double) (((hr_tmp.tv_sec - (a).tv_sec) * 1000) + ((double) (hr_tmp.tv_usec - (a).tv_usec) / 1000)); }
|
||||||
#define hc_timer_set(a) { gettimeofday ((a), NULL); }
|
#define hc_timer_set(a) { gettimeofday ((a), NULL); }
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
#define EOL "\r\n"
|
#define EOL "\r\n"
|
||||||
#else
|
#else
|
||||||
#define EOL "\n"
|
#define EOL "\n"
|
||||||
@ -210,11 +210,11 @@ typedef struct
|
|||||||
{
|
{
|
||||||
u64 cnt;
|
u64 cnt;
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
struct stat stat;
|
struct stat stat;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
struct __stat64 stat;
|
struct __stat64 stat;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#ifdef _BASETSD_H
|
#if defined (_BASETSD_H)
|
||||||
#else
|
#else
|
||||||
typedef UINT8 uint8_t;
|
typedef UINT8 uint8_t;
|
||||||
typedef UINT16 uint16_t;
|
typedef UINT16 uint16_t;
|
||||||
|
10
src/Makefile
10
src/Makefile
@ -113,14 +113,14 @@ BINARY_NATIVE := $(PROG_NAME)
|
|||||||
|
|
||||||
ifeq ($(UNAME),Darwin)
|
ifeq ($(UNAME),Darwin)
|
||||||
export MACOSX_DEPLOYMENT_TARGET=10.9
|
export MACOSX_DEPLOYMENT_TARGET=10.9
|
||||||
CFLAGS_NATIVE := -D_POSIX
|
CFLAGS_NATIVE :=
|
||||||
CFLAGS_NATIVE += $(CFLAGS)
|
CFLAGS_NATIVE += $(CFLAGS)
|
||||||
LFLAGS_NATIVE := -lpthread
|
LFLAGS_NATIVE := -lpthread
|
||||||
LFLAGS_NATIVE += $(LDFLAGS)
|
LFLAGS_NATIVE += $(LDFLAGS)
|
||||||
endif # darwin
|
endif # darwin
|
||||||
|
|
||||||
ifeq ($(UNAME),Linux)
|
ifeq ($(UNAME),Linux)
|
||||||
CFLAGS_NATIVE := -D_POSIX
|
CFLAGS_NATIVE :=
|
||||||
ifndef DEBUG
|
ifndef DEBUG
|
||||||
CFLAGS_NATIVE += -s
|
CFLAGS_NATIVE += -s
|
||||||
endif
|
endif
|
||||||
@ -131,7 +131,7 @@ LFLAGS_NATIVE += $(LDFLAGS)
|
|||||||
endif # linux
|
endif # linux
|
||||||
|
|
||||||
ifeq ($(UNAME),FreeBSD)
|
ifeq ($(UNAME),FreeBSD)
|
||||||
CFLAGS_NATIVE := -D_POSIX
|
CFLAGS_NATIVE :=
|
||||||
CFLAGS_NATIVE += $(CFLAGS)
|
CFLAGS_NATIVE += $(CFLAGS)
|
||||||
LFLAGS_NATIVE := -lpthread
|
LFLAGS_NATIVE := -lpthread
|
||||||
LFLAGS_NATIVE += $(LDFLAGS)
|
LFLAGS_NATIVE += $(LDFLAGS)
|
||||||
@ -141,7 +141,7 @@ endif # freebsd
|
|||||||
## Cross compilation target
|
## Cross compilation target
|
||||||
##
|
##
|
||||||
|
|
||||||
CFLAGS_CROSS_LINUX := -D_POSIX
|
CFLAGS_CROSS_LINUX :=
|
||||||
ifndef DEBUG
|
ifndef DEBUG
|
||||||
CFLAGS_CROSS_LINUX += -s
|
CFLAGS_CROSS_LINUX += -s
|
||||||
endif
|
endif
|
||||||
@ -149,7 +149,7 @@ CFLAGS_CROSS_LINUX += $(CFLAGS)
|
|||||||
CFLAGS_CROSS_LINUX += -DHAVE_HWMON
|
CFLAGS_CROSS_LINUX += -DHAVE_HWMON
|
||||||
|
|
||||||
#CFLAGS_CROSS_WIN := -D_WIN -DWIN -D__MSVCRT__ -D__USE_MINGW_ANSI_STDIO=1
|
#CFLAGS_CROSS_WIN := -D_WIN -DWIN -D__MSVCRT__ -D__USE_MINGW_ANSI_STDIO=1
|
||||||
CFLAGS_CROSS_WIN := -D_WIN
|
CFLAGS_CROSS_WIN :=
|
||||||
ifndef DEBUG
|
ifndef DEBUG
|
||||||
CFLAGS_CROSS_WIN += -s
|
CFLAGS_CROSS_WIN += -s
|
||||||
endif
|
endif
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* License.....: MIT
|
* License.....: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined (__APPLE__)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -13,7 +13,7 @@
|
|||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#include "affinity.h"
|
#include "affinity.h"
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined (__APPLE__)
|
||||||
static void CPU_ZERO (cpu_set_t *cs)
|
static void CPU_ZERO (cpu_set_t *cs)
|
||||||
{
|
{
|
||||||
cs->count = 0;
|
cs->count = 0;
|
||||||
@ -77,9 +77,9 @@ void set_cpu_affinity (char *cpu_affinity)
|
|||||||
|
|
||||||
if (cpu_id == 0)
|
if (cpu_id == 0)
|
||||||
{
|
{
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
aff_mask = 0;
|
aff_mask = 0;
|
||||||
#elif _POSIX
|
#elif defined (_POSIX)
|
||||||
CPU_ZERO (&cpuset);
|
CPU_ZERO (&cpuset);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -93,9 +93,9 @@ void set_cpu_affinity (char *cpu_affinity)
|
|||||||
exit (-1);
|
exit (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
aff_mask |= 1u << (cpu_id - 1);
|
aff_mask |= 1u << (cpu_id - 1);
|
||||||
#elif _POSIX
|
#elif defined (_POSIX)
|
||||||
CPU_SET ((cpu_id - 1), &cpuset);
|
CPU_SET ((cpu_id - 1), &cpuset);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ int ocl_init (OCL_PTR *ocl)
|
|||||||
log_info ("");
|
log_info ("");
|
||||||
log_info ("ATTENTION! Can't find OpenCL ICD loader library");
|
log_info ("ATTENTION! Can't find OpenCL ICD loader library");
|
||||||
log_info ("");
|
log_info ("");
|
||||||
#ifdef __linux__
|
#if defined (__linux__)
|
||||||
log_info ("You're probably missing the \"ocl-icd-libopencl1\" package (Debian/Ubuntu)");
|
log_info ("You're probably missing the \"ocl-icd-libopencl1\" package (Debian/Ubuntu)");
|
||||||
log_info (" sudo apt-get install ocl-icd-libopencl1");
|
log_info (" sudo apt-get install ocl-icd-libopencl1");
|
||||||
log_info ("");
|
log_info ("");
|
||||||
|
@ -17,7 +17,7 @@ int nvapi_init (NVAPI_PTR *nvapi)
|
|||||||
|
|
||||||
memset (nvapi, 0, sizeof (NVAPI_PTR));
|
memset (nvapi, 0, sizeof (NVAPI_PTR));
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
#if defined (WIN64)
|
#if defined (WIN64)
|
||||||
nvapi->lib = hc_dlopen ("nvapi64.dll");
|
nvapi->lib = hc_dlopen ("nvapi64.dll");
|
||||||
#elif defined (WIN32)
|
#elif defined (WIN32)
|
||||||
@ -194,7 +194,7 @@ int hm_NvAPI_GPU_RestoreCoolerSettings (NVAPI_PTR *nvapi, NvPhysicalGpuHandle hP
|
|||||||
return NvAPI_rc;
|
return NvAPI_rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __MINGW64__
|
#if defined (__MINGW64__)
|
||||||
|
|
||||||
void __security_check_cookie (uintptr_t _StackCookie)
|
void __security_check_cookie (uintptr_t _StackCookie)
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@ int nvml_init (NVML_PTR *nvml)
|
|||||||
|
|
||||||
memset (nvml, 0, sizeof (NVML_PTR));
|
memset (nvml, 0, sizeof (NVML_PTR));
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
nvml->lib = hc_dlopen ("nvml.dll");
|
nvml->lib = hc_dlopen ("nvml.dll");
|
||||||
|
|
||||||
if (!nvml->lib)
|
if (!nvml->lib)
|
||||||
@ -61,7 +61,7 @@ int nvml_init (NVML_PTR *nvml)
|
|||||||
myfree (Buffer);
|
myfree (Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif _POSIX
|
#elif defined (_POSIX)
|
||||||
nvml->lib = hc_dlopen ("libnvidia-ml.so", RTLD_NOW);
|
nvml->lib = hc_dlopen ("libnvidia-ml.so", RTLD_NOW);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ void xnvctrl_close (XNVCTRL_PTR *xnvctrl)
|
|||||||
{
|
{
|
||||||
if (xnvctrl)
|
if (xnvctrl)
|
||||||
{
|
{
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
|
|
||||||
if (xnvctrl->lib_x11)
|
if (xnvctrl->lib_x11)
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* License.....: MIT
|
* License.....: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined (__APPLE__)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -13,7 +13,7 @@
|
|||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "folder.h"
|
#include "folder.h"
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined (__APPLE__)
|
||||||
#include "types_int.h"
|
#include "types_int.h"
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#endif
|
#endif
|
||||||
@ -152,7 +152,7 @@ char **scan_directory (const char *path)
|
|||||||
|
|
||||||
if ((d = opendir (tmp_path)) != NULL)
|
if ((d = opendir (tmp_path)) != NULL)
|
||||||
{
|
{
|
||||||
#ifdef __APPLE__
|
#if defined (__APPLE__)
|
||||||
|
|
||||||
struct dirent e;
|
struct dirent e;
|
||||||
|
|
||||||
|
156
src/hashcat.c
156
src/hashcat.c
@ -6,7 +6,7 @@
|
|||||||
* License.....: MIT
|
* License.....: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined (__APPLE__)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -20,7 +20,7 @@
|
|||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#endif // _POSIX
|
#endif // _POSIX
|
||||||
@ -270,7 +270,7 @@ static const char ST_0009[] = "Running (stop at checkpoint)";
|
|||||||
static const char ST_0010[] = "Autotuning";
|
static const char ST_0010[] = "Autotuning";
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
#define mkdir(name,mode) mkdir (name)
|
#define mkdir(name,mode) mkdir (name)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -666,7 +666,7 @@ void status_display_machine_readable ()
|
|||||||
* temperature
|
* temperature
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMON)
|
||||||
if (data.gpu_temp_disable == 0)
|
if (data.gpu_temp_disable == 0)
|
||||||
{
|
{
|
||||||
fprintf (out, "TEMP\t");
|
fprintf (out, "TEMP\t");
|
||||||
@ -1059,7 +1059,7 @@ void status_display ()
|
|||||||
ms_paused += ms_paused_tmp;
|
ms_paused += ms_paused_tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
|
|
||||||
__time64_t sec_run = (__time64_t) ms_running / 1000;
|
__time64_t sec_run = (__time64_t) ms_running / 1000;
|
||||||
|
|
||||||
@ -1077,7 +1077,7 @@ void status_display ()
|
|||||||
|
|
||||||
struct tm *tmp = NULL;
|
struct tm *tmp = NULL;
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
|
|
||||||
tmp = _gmtime64 (&sec_run);
|
tmp = _gmtime64 (&sec_run);
|
||||||
|
|
||||||
@ -1172,7 +1172,7 @@ void status_display ()
|
|||||||
{
|
{
|
||||||
if (data.devices_status != STATUS_CRACKED)
|
if (data.devices_status != STATUS_CRACKED)
|
||||||
{
|
{
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
__time64_t sec_etc = 0;
|
__time64_t sec_etc = 0;
|
||||||
#else
|
#else
|
||||||
time_t sec_etc = 0;
|
time_t sec_etc = 0;
|
||||||
@ -1205,7 +1205,7 @@ void status_display ()
|
|||||||
|
|
||||||
struct tm *tmp = NULL;
|
struct tm *tmp = NULL;
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
tmp = _gmtime64 (&sec_etc);
|
tmp = _gmtime64 (&sec_etc);
|
||||||
#else
|
#else
|
||||||
tmp = gmtime (&sec_etc);
|
tmp = gmtime (&sec_etc);
|
||||||
@ -1236,7 +1236,7 @@ void status_display ()
|
|||||||
|
|
||||||
time (&runtime_cur);
|
time (&runtime_cur);
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
|
|
||||||
__time64_t runtime_left = data.proc_start + data.runtime + data.prepare_time + (ms_paused / 1000) - runtime_cur;
|
__time64_t runtime_left = data.proc_start + data.runtime + data.prepare_time + (ms_paused / 1000) - runtime_cur;
|
||||||
|
|
||||||
@ -1433,7 +1433,7 @@ void status_display ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMON)
|
||||||
|
|
||||||
if (data.devices_status == STATUS_EXHAUSTED) return;
|
if (data.devices_status == STATUS_EXHAUSTED) return;
|
||||||
if (data.devices_status == STATUS_CRACKED) return;
|
if (data.devices_status == STATUS_CRACKED) return;
|
||||||
@ -3590,7 +3590,7 @@ static int autotune (hc_device_param_t *device_param)
|
|||||||
|
|
||||||
device_param->kernel_power = kernel_power;
|
device_param->kernel_power = kernel_power;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if defined (DEBUG)
|
||||||
|
|
||||||
if (data.quiet == 0)
|
if (data.quiet == 0)
|
||||||
{
|
{
|
||||||
@ -3619,14 +3619,14 @@ static int run_cracker (hc_device_param_t *device_param, const uint pws_cnt)
|
|||||||
|
|
||||||
uint speed_pos = device_param->speed_pos;
|
uint speed_pos = device_param->speed_pos;
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
if (device_param->timer_speed.tv_sec == 0)
|
if (device_param->timer_speed.tv_sec == 0)
|
||||||
{
|
{
|
||||||
hc_timer_set (&device_param->timer_speed);
|
hc_timer_set (&device_param->timer_speed);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
if (device_param->timer_speed.QuadPart == 0)
|
if (device_param->timer_speed.QuadPart == 0)
|
||||||
{
|
{
|
||||||
hc_timer_set (&device_param->timer_speed);
|
hc_timer_set (&device_param->timer_speed);
|
||||||
@ -4157,11 +4157,11 @@ static void get_next_word (wl_data_t *wl_data, FILE *fd, char **out_buf, uint *o
|
|||||||
get_next_word (wl_data, fd, out_buf, out_len);
|
get_next_word (wl_data, fd, out_buf, out_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
static u64 count_words (wl_data_t *wl_data, FILE *fd, char *dictfile, dictstat_t *dictstat_base, size_t *dictstat_nmemb)
|
static u64 count_words (wl_data_t *wl_data, FILE *fd, char *dictfile, dictstat_t *dictstat_base, size_t *dictstat_nmemb)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
static u64 count_words (wl_data_t *wl_data, FILE *fd, char *dictfile, dictstat_t *dictstat_base, uint *dictstat_nmemb)
|
static u64 count_words (wl_data_t *wl_data, FILE *fd, char *dictfile, dictstat_t *dictstat_base, uint *dictstat_nmemb)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -4171,11 +4171,11 @@ static u64 count_words (wl_data_t *wl_data, FILE *fd, char *dictfile, dictstat_t
|
|||||||
|
|
||||||
d.cnt = 0;
|
d.cnt = 0;
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
fstat (fileno (fd), &d.stat);
|
fstat (fileno (fd), &d.stat);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
_fstat64 (fileno (fd), &d.stat);
|
_fstat64 (fileno (fd), &d.stat);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -4186,7 +4186,7 @@ static u64 count_words (wl_data_t *wl_data, FILE *fd, char *dictfile, dictstat_t
|
|||||||
d.stat.st_rdev = 0;
|
d.stat.st_rdev = 0;
|
||||||
d.stat.st_atime = 0;
|
d.stat.st_atime = 0;
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
d.stat.st_blksize = 0;
|
d.stat.st_blksize = 0;
|
||||||
d.stat.st_blocks = 0;
|
d.stat.st_blocks = 0;
|
||||||
#endif
|
#endif
|
||||||
@ -4315,7 +4315,7 @@ static void *thread_monitor (void *p)
|
|||||||
uint remove_left = data.remove_timer;
|
uint remove_left = data.remove_timer;
|
||||||
uint status_left = data.status_timer;
|
uint status_left = data.status_timer;
|
||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMON)
|
||||||
uint hwmon_check = 0;
|
uint hwmon_check = 0;
|
||||||
|
|
||||||
int slowdown_warnings = 0;
|
int slowdown_warnings = 0;
|
||||||
@ -4359,7 +4359,7 @@ static void *thread_monitor (void *p)
|
|||||||
status_check = 1;
|
status_check = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMON)
|
||||||
if (data.gpu_temp_disable == 0)
|
if (data.gpu_temp_disable == 0)
|
||||||
{
|
{
|
||||||
time (&last_temp_check_time);
|
time (&last_temp_check_time);
|
||||||
@ -4370,7 +4370,7 @@ static void *thread_monitor (void *p)
|
|||||||
|
|
||||||
if ((runtime_check == 0) && (remove_check == 0) && (status_check == 0) && (restore_check == 0))
|
if ((runtime_check == 0) && (remove_check == 0) && (status_check == 0) && (restore_check == 0))
|
||||||
{
|
{
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMON)
|
||||||
if (hwmon_check == 0)
|
if (hwmon_check == 0)
|
||||||
#endif
|
#endif
|
||||||
return (p);
|
return (p);
|
||||||
@ -4382,7 +4382,7 @@ static void *thread_monitor (void *p)
|
|||||||
|
|
||||||
if (data.devices_status != STATUS_RUNNING) continue;
|
if (data.devices_status != STATUS_RUNNING) continue;
|
||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMON)
|
||||||
|
|
||||||
if (hwmon_check == 1)
|
if (hwmon_check == 1)
|
||||||
{
|
{
|
||||||
@ -4524,11 +4524,11 @@ static void *thread_monitor (void *p)
|
|||||||
}
|
}
|
||||||
else if (device_param->device_vendor_id == VENDOR_ID_NV)
|
else if (device_param->device_vendor_id == VENDOR_ID_NV)
|
||||||
{
|
{
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
hm_set_fanspeed_with_device_id_nvapi (device_id, fan_speed_new, 1);
|
hm_set_fanspeed_with_device_id_nvapi (device_id, fan_speed_new, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __linux__
|
#if defined (__linux__)
|
||||||
hm_set_fanspeed_with_device_id_xnvctrl (device_id, fan_speed_new);
|
hm_set_fanspeed_with_device_id_xnvctrl (device_id, fan_speed_new);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -4629,7 +4629,7 @@ static void *thread_monitor (void *p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMON)
|
||||||
myfree (fan_speed_chgd);
|
myfree (fan_speed_chgd);
|
||||||
|
|
||||||
myfree (temp_diff_old);
|
myfree (temp_diff_old);
|
||||||
@ -4752,13 +4752,13 @@ static void *thread_outfile_remove (void *p)
|
|||||||
{
|
{
|
||||||
//hc_thread_mutex_lock (mux_display);
|
//hc_thread_mutex_lock (mux_display);
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
struct stat outfile_stat;
|
struct stat outfile_stat;
|
||||||
|
|
||||||
fstat (fileno (fp), &outfile_stat);
|
fstat (fileno (fp), &outfile_stat);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
struct stat64 outfile_stat;
|
struct stat64 outfile_stat;
|
||||||
|
|
||||||
_fstat64 (fileno (fp), &outfile_stat);
|
_fstat64 (fileno (fp), &outfile_stat);
|
||||||
@ -5916,7 +5916,7 @@ static void *HC_API_CALL ADL_Main_Memory_Alloc (const int iSize)
|
|||||||
* main
|
* main
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
static void SetConsoleWindowSize (const int x)
|
static void SetConsoleWindowSize (const int x)
|
||||||
{
|
{
|
||||||
HANDLE h = GetStdHandle (STD_OUTPUT_HANDLE);
|
HANDLE h = GetStdHandle (STD_OUTPUT_HANDLE);
|
||||||
@ -5944,7 +5944,7 @@ static void SetConsoleWindowSize (const int x)
|
|||||||
|
|
||||||
int main (int argc, char **argv)
|
int main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
SetConsoleWindowSize (132);
|
SetConsoleWindowSize (132);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -6095,7 +6095,7 @@ int main (int argc, char **argv)
|
|||||||
uint kernel_loops = KERNEL_LOOPS;
|
uint kernel_loops = KERNEL_LOOPS;
|
||||||
uint nvidia_spin_damp = NVIDIA_SPIN_DAMP;
|
uint nvidia_spin_damp = NVIDIA_SPIN_DAMP;
|
||||||
uint gpu_temp_disable = GPU_TEMP_DISABLE;
|
uint gpu_temp_disable = GPU_TEMP_DISABLE;
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMON)
|
||||||
uint gpu_temp_abort = GPU_TEMP_ABORT;
|
uint gpu_temp_abort = GPU_TEMP_ABORT;
|
||||||
uint gpu_temp_retain = GPU_TEMP_RETAIN;
|
uint gpu_temp_retain = GPU_TEMP_RETAIN;
|
||||||
uint powertune_enable = POWERTUNE_ENABLE;
|
uint powertune_enable = POWERTUNE_ENABLE;
|
||||||
@ -6254,7 +6254,7 @@ int main (int argc, char **argv)
|
|||||||
{"kernel-loops", required_argument, 0, IDX_KERNEL_LOOPS},
|
{"kernel-loops", required_argument, 0, IDX_KERNEL_LOOPS},
|
||||||
{"nvidia-spin-damp", required_argument, 0, IDX_NVIDIA_SPIN_DAMP},
|
{"nvidia-spin-damp", required_argument, 0, IDX_NVIDIA_SPIN_DAMP},
|
||||||
{"gpu-temp-disable", no_argument, 0, IDX_GPU_TEMP_DISABLE},
|
{"gpu-temp-disable", no_argument, 0, IDX_GPU_TEMP_DISABLE},
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMON)
|
||||||
{"gpu-temp-abort", required_argument, 0, IDX_GPU_TEMP_ABORT},
|
{"gpu-temp-abort", required_argument, 0, IDX_GPU_TEMP_ABORT},
|
||||||
{"gpu-temp-retain", required_argument, 0, IDX_GPU_TEMP_RETAIN},
|
{"gpu-temp-retain", required_argument, 0, IDX_GPU_TEMP_RETAIN},
|
||||||
{"powertune-enable", no_argument, 0, IDX_POWERTUNE_ENABLE},
|
{"powertune-enable", no_argument, 0, IDX_POWERTUNE_ENABLE},
|
||||||
@ -6414,7 +6414,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
char cpath[1024] = { 0 };
|
char cpath[1024] = { 0 };
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
|
|
||||||
snprintf (cpath, sizeof (cpath) - 1, "%s\\OpenCL\\", shared_dir);
|
snprintf (cpath, sizeof (cpath) - 1, "%s\\OpenCL\\", shared_dir);
|
||||||
|
|
||||||
@ -6452,7 +6452,7 @@ int main (int argc, char **argv)
|
|||||||
putenv (tmp);
|
putenv (tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
|
|
||||||
naive_replace (cpath_real, '\\', '/');
|
naive_replace (cpath_real, '\\', '/');
|
||||||
|
|
||||||
@ -6536,9 +6536,9 @@ int main (int argc, char **argv)
|
|||||||
myargc = rd->argc;
|
myargc = rd->argc;
|
||||||
myargv = rd->argv;
|
myargv = rd->argv;
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
rd->pid = getpid ();
|
rd->pid = getpid ();
|
||||||
#elif _WIN
|
#elif defined (_WIN)
|
||||||
rd->pid = GetCurrentProcessId ();
|
rd->pid = GetCurrentProcessId ();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -6639,7 +6639,7 @@ int main (int argc, char **argv)
|
|||||||
case IDX_NVIDIA_SPIN_DAMP: nvidia_spin_damp = atoi (optarg);
|
case IDX_NVIDIA_SPIN_DAMP: nvidia_spin_damp = atoi (optarg);
|
||||||
nvidia_spin_damp_chgd = 1; break;
|
nvidia_spin_damp_chgd = 1; break;
|
||||||
case IDX_GPU_TEMP_DISABLE: gpu_temp_disable = 1; break;
|
case IDX_GPU_TEMP_DISABLE: gpu_temp_disable = 1; break;
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMON)
|
||||||
case IDX_GPU_TEMP_ABORT: gpu_temp_abort = atoi (optarg); break;
|
case IDX_GPU_TEMP_ABORT: gpu_temp_abort = atoi (optarg); break;
|
||||||
case IDX_GPU_TEMP_RETAIN: gpu_temp_retain = atoi (optarg); break;
|
case IDX_GPU_TEMP_RETAIN: gpu_temp_retain = atoi (optarg); break;
|
||||||
case IDX_POWERTUNE_ENABLE: powertune_enable = 1; break;
|
case IDX_POWERTUNE_ENABLE: powertune_enable = 1; break;
|
||||||
@ -7401,7 +7401,7 @@ int main (int argc, char **argv)
|
|||||||
data.custom_charset_2 = custom_charset_2;
|
data.custom_charset_2 = custom_charset_2;
|
||||||
data.custom_charset_3 = custom_charset_3;
|
data.custom_charset_3 = custom_charset_3;
|
||||||
data.custom_charset_4 = custom_charset_4;
|
data.custom_charset_4 = custom_charset_4;
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMONO)
|
||||||
data.powertune_enable = powertune_enable;
|
data.powertune_enable = powertune_enable;
|
||||||
#endif
|
#endif
|
||||||
data.logfile_disable = logfile_disable;
|
data.logfile_disable = logfile_disable;
|
||||||
@ -7484,7 +7484,7 @@ int main (int argc, char **argv)
|
|||||||
logfile_top_uint (kernel_loops);
|
logfile_top_uint (kernel_loops);
|
||||||
logfile_top_uint (nvidia_spin_damp);
|
logfile_top_uint (nvidia_spin_damp);
|
||||||
logfile_top_uint (gpu_temp_disable);
|
logfile_top_uint (gpu_temp_disable);
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMON)
|
||||||
logfile_top_uint (gpu_temp_abort);
|
logfile_top_uint (gpu_temp_abort);
|
||||||
logfile_top_uint (gpu_temp_retain);
|
logfile_top_uint (gpu_temp_retain);
|
||||||
#endif
|
#endif
|
||||||
@ -7606,7 +7606,7 @@ int main (int argc, char **argv)
|
|||||||
gpu_temp_disable = 1;
|
gpu_temp_disable = 1;
|
||||||
outfile_check_timer = 0;
|
outfile_check_timer = 0;
|
||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMON)
|
||||||
if (powertune_enable == 1)
|
if (powertune_enable == 1)
|
||||||
{
|
{
|
||||||
gpu_temp_disable = 0;
|
gpu_temp_disable = 0;
|
||||||
@ -11719,11 +11719,11 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
dictstat_t *dictstat_base = (dictstat_t *) mycalloc (MAX_DICTSTAT, sizeof (dictstat_t));
|
dictstat_t *dictstat_base = (dictstat_t *) mycalloc (MAX_DICTSTAT, sizeof (dictstat_t));
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
size_t dictstat_nmemb = 0;
|
size_t dictstat_nmemb = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
uint dictstat_nmemb = 0;
|
uint dictstat_nmemb = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -11739,13 +11739,13 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
if (dictstat_fp)
|
if (dictstat_fp)
|
||||||
{
|
{
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
struct stat tmpstat;
|
struct stat tmpstat;
|
||||||
|
|
||||||
fstat (fileno (dictstat_fp), &tmpstat);
|
fstat (fileno (dictstat_fp), &tmpstat);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
struct stat64 tmpstat;
|
struct stat64 tmpstat;
|
||||||
|
|
||||||
_fstat64 (fileno (dictstat_fp), &tmpstat);
|
_fstat64 (fileno (dictstat_fp), &tmpstat);
|
||||||
@ -13118,12 +13118,12 @@ int main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
if (data.hashfile != NULL)
|
if (data.hashfile != NULL)
|
||||||
{
|
{
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
struct stat tmpstat_outfile;
|
struct stat tmpstat_outfile;
|
||||||
struct stat tmpstat_hashfile;
|
struct stat tmpstat_hashfile;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
struct stat64 tmpstat_outfile;
|
struct stat64 tmpstat_outfile;
|
||||||
struct stat64 tmpstat_hashfile;
|
struct stat64 tmpstat_hashfile;
|
||||||
#endif
|
#endif
|
||||||
@ -13132,11 +13132,11 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
if (tmp_outfile_fp)
|
if (tmp_outfile_fp)
|
||||||
{
|
{
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
fstat (fileno (tmp_outfile_fp), &tmpstat_outfile);
|
fstat (fileno (tmp_outfile_fp), &tmpstat_outfile);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
_fstat64 (fileno (tmp_outfile_fp), &tmpstat_outfile);
|
_fstat64 (fileno (tmp_outfile_fp), &tmpstat_outfile);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -13147,11 +13147,11 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
if (tmp_hashfile_fp)
|
if (tmp_hashfile_fp)
|
||||||
{
|
{
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
fstat (fileno (tmp_hashfile_fp), &tmpstat_hashfile);
|
fstat (fileno (tmp_hashfile_fp), &tmpstat_hashfile);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
_fstat64 (fileno (tmp_hashfile_fp), &tmpstat_hashfile);
|
_fstat64 (fileno (tmp_hashfile_fp), &tmpstat_hashfile);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -13174,7 +13174,7 @@ int main (int argc, char **argv)
|
|||||||
tmpstat_hashfile.st_rdev = 0;
|
tmpstat_hashfile.st_rdev = 0;
|
||||||
tmpstat_hashfile.st_atime = 0;
|
tmpstat_hashfile.st_atime = 0;
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
tmpstat_outfile.st_blksize = 0;
|
tmpstat_outfile.st_blksize = 0;
|
||||||
tmpstat_outfile.st_blocks = 0;
|
tmpstat_outfile.st_blocks = 0;
|
||||||
|
|
||||||
@ -13182,7 +13182,7 @@ int main (int argc, char **argv)
|
|||||||
tmpstat_hashfile.st_blocks = 0;
|
tmpstat_hashfile.st_blocks = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
if (memcmp (&tmpstat_outfile, &tmpstat_hashfile, sizeof (struct stat)) == 0)
|
if (memcmp (&tmpstat_outfile, &tmpstat_hashfile, sizeof (struct stat)) == 0)
|
||||||
{
|
{
|
||||||
log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
|
log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
|
||||||
@ -13191,7 +13191,7 @@ int main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
if (memcmp (&tmpstat_outfile, &tmpstat_hashfile, sizeof (struct stat64)) == 0)
|
if (memcmp (&tmpstat_outfile, &tmpstat_hashfile, sizeof (struct stat64)) == 0)
|
||||||
{
|
{
|
||||||
log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
|
log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
|
||||||
@ -14761,7 +14761,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
char *device_name_chksum = (char *) mymalloc (INFOSZ);
|
char *device_name_chksum = (char *) mymalloc (INFOSZ);
|
||||||
|
|
||||||
#ifdef __x86_64__
|
#if defined (__x86_64__)
|
||||||
snprintf (device_name_chksum, INFOSZ - 1, "%u-%u-%u-%s-%s-%s-%u", 64, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, COMPTIME);
|
snprintf (device_name_chksum, INFOSZ - 1, "%u-%u-%u-%s-%s-%s-%u", 64, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, COMPTIME);
|
||||||
#else
|
#else
|
||||||
snprintf (device_name_chksum, INFOSZ - 1, "%u-%u-%u-%s-%s-%s-%u", 32, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, COMPTIME);
|
snprintf (device_name_chksum, INFOSZ - 1, "%u-%u-%u-%s-%s-%s-%u", 32, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, COMPTIME);
|
||||||
@ -14788,11 +14788,11 @@ int main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
need_nvml = 1;
|
need_nvml = 1;
|
||||||
|
|
||||||
#ifdef __linux__
|
#if defined (__linux__)
|
||||||
need_xnvctrl = 1;
|
need_xnvctrl = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
need_nvapi = 1;
|
need_nvapi = 1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -14938,7 +14938,7 @@ int main (int argc, char **argv)
|
|||||||
log_info ("ATTENTION! Unsupported or incorrectly installed Catalyst driver detected!");
|
log_info ("ATTENTION! Unsupported or incorrectly installed Catalyst driver detected!");
|
||||||
log_info ("You are STRONGLY encouraged to use the official supported catalyst driver");
|
log_info ("You are STRONGLY encouraged to use the official supported catalyst driver");
|
||||||
log_info ("See hashcat's homepage for official supported catalyst drivers");
|
log_info ("See hashcat's homepage for official supported catalyst drivers");
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
log_info ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
|
log_info ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
|
||||||
#endif
|
#endif
|
||||||
log_info ("You can use --force to override this but do not post error reports if you do so");
|
log_info ("You can use --force to override this but do not post error reports if you do so");
|
||||||
@ -15080,7 +15080,7 @@ int main (int argc, char **argv)
|
|||||||
* HM devices: init
|
* HM devices: init
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMON)
|
||||||
hm_attrs_t hm_adapters_adl[DEVICES_MAX];
|
hm_attrs_t hm_adapters_adl[DEVICES_MAX];
|
||||||
hm_attrs_t hm_adapters_nvapi[DEVICES_MAX];
|
hm_attrs_t hm_adapters_nvapi[DEVICES_MAX];
|
||||||
hm_attrs_t hm_adapters_nvml[DEVICES_MAX];
|
hm_attrs_t hm_adapters_nvml[DEVICES_MAX];
|
||||||
@ -15313,7 +15313,7 @@ int main (int argc, char **argv)
|
|||||||
* Watchdog and Temperature balance
|
* Watchdog and Temperature balance
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMON)
|
||||||
if (gpu_temp_disable == 0 && data.hm_adl == NULL && data.hm_nvml == NULL && data.hm_xnvctrl == NULL)
|
if (gpu_temp_disable == 0 && data.hm_adl == NULL && data.hm_nvml == NULL && data.hm_xnvctrl == NULL)
|
||||||
{
|
{
|
||||||
log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
|
log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
|
||||||
@ -15341,7 +15341,7 @@ int main (int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMON)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HM devices: copy
|
* HM devices: copy
|
||||||
@ -15578,7 +15578,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
#endif // HAVE_HWMON
|
#endif // HAVE_HWMON
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if defined (DEBUG)
|
||||||
if (benchmark == 1) log_info ("Hashmode: %d", data.hash_mode);
|
if (benchmark == 1) log_info ("Hashmode: %d", data.hash_mode);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -16107,7 +16107,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
char build_opts[1024] = { 0 };
|
char build_opts[1024] = { 0 };
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
snprintf (build_opts, sizeof (build_opts) - 1, "-I \"%s\"", cpath_real);
|
snprintf (build_opts, sizeof (build_opts) - 1, "-I \"%s\"", cpath_real);
|
||||||
#else
|
#else
|
||||||
snprintf (build_opts, sizeof (build_opts) - 1, "-I %s", cpath_real);
|
snprintf (build_opts, sizeof (build_opts) - 1, "-I %s", cpath_real);
|
||||||
@ -16167,7 +16167,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
char build_opts_new[1024] = { 0 };
|
char build_opts_new[1024] = { 0 };
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if defined (DEBUG)
|
||||||
snprintf (build_opts_new, sizeof (build_opts_new) - 1, "%s -D VENDOR_ID=%u -D CUDA_ARCH=%d -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D _unroll -cl-std=CL1.1", build_opts, device_param->device_vendor_id, (device_param->sm_major * 100) + device_param->sm_minor, device_param->vector_width, (u32) device_param->device_type, data.dgst_pos0, data.dgst_pos1, data.dgst_pos2, data.dgst_pos3, data.dgst_size / 4, kern_type);
|
snprintf (build_opts_new, sizeof (build_opts_new) - 1, "%s -D VENDOR_ID=%u -D CUDA_ARCH=%d -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D _unroll -cl-std=CL1.1", build_opts, device_param->device_vendor_id, (device_param->sm_major * 100) + device_param->sm_minor, device_param->vector_width, (u32) device_param->device_type, data.dgst_pos0, data.dgst_pos1, data.dgst_pos2, data.dgst_pos3, data.dgst_size / 4, kern_type);
|
||||||
#else
|
#else
|
||||||
snprintf (build_opts_new, sizeof (build_opts_new) - 1, "%s -D VENDOR_ID=%u -D CUDA_ARCH=%d -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D _unroll -cl-std=CL1.1 -w", build_opts, device_param->device_vendor_id, (device_param->sm_major * 100) + device_param->sm_minor, device_param->vector_width, (u32) device_param->device_type, data.dgst_pos0, data.dgst_pos1, data.dgst_pos2, data.dgst_pos3, data.dgst_size / 4, kern_type);
|
snprintf (build_opts_new, sizeof (build_opts_new) - 1, "%s -D VENDOR_ID=%u -D CUDA_ARCH=%d -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_TYPE=%u -D _unroll -cl-std=CL1.1 -w", build_opts, device_param->device_vendor_id, (device_param->sm_major * 100) + device_param->sm_minor, device_param->vector_width, (u32) device_param->device_type, data.dgst_pos0, data.dgst_pos1, data.dgst_pos2, data.dgst_pos3, data.dgst_size / 4, kern_type);
|
||||||
@ -16175,7 +16175,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
strncpy (build_opts, build_opts_new, sizeof (build_opts));
|
strncpy (build_opts, build_opts_new, sizeof (build_opts));
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if defined (DEBUG)
|
||||||
log_info ("- Device #%u: build_opts '%s'\n", device_id + 1, build_opts);
|
log_info ("- Device #%u: build_opts '%s'\n", device_id + 1, build_opts);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -16267,7 +16267,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
hc_clGetProgramBuildInfo (data.ocl, device_param->program, device_param->device, CL_PROGRAM_BUILD_LOG, 0, NULL, &build_log_size);
|
hc_clGetProgramBuildInfo (data.ocl, device_param->program, device_param->device, CL_PROGRAM_BUILD_LOG, 0, NULL, &build_log_size);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if defined (DEBUG)
|
||||||
if ((build_log_size != 0) || (CL_err != CL_SUCCESS))
|
if ((build_log_size != 0) || (CL_err != CL_SUCCESS))
|
||||||
#else
|
#else
|
||||||
if (CL_err != CL_SUCCESS)
|
if (CL_err != CL_SUCCESS)
|
||||||
@ -16326,7 +16326,7 @@ int main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#if defined (DEBUG)
|
||||||
log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id + 1, cached_file, cst.st_size);
|
log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id + 1, cached_file, cst.st_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -16353,7 +16353,7 @@ int main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#if defined (DEBUG)
|
||||||
log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id + 1, source_file, sst.st_size);
|
log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id + 1, source_file, sst.st_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -16407,7 +16407,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
hc_clGetProgramBuildInfo (data.ocl, device_param->program, device_param->device, CL_PROGRAM_BUILD_LOG, 0, NULL, &build_log_size);
|
hc_clGetProgramBuildInfo (data.ocl, device_param->program, device_param->device, CL_PROGRAM_BUILD_LOG, 0, NULL, &build_log_size);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if defined (DEBUG)
|
||||||
if ((build_log_size != 0) || (CL_err != CL_SUCCESS))
|
if ((build_log_size != 0) || (CL_err != CL_SUCCESS))
|
||||||
#else
|
#else
|
||||||
if (CL_err != CL_SUCCESS)
|
if (CL_err != CL_SUCCESS)
|
||||||
@ -16530,7 +16530,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
hc_clGetProgramBuildInfo (data.ocl, device_param->program_mp, device_param->device, CL_PROGRAM_BUILD_LOG, 0, NULL, &build_log_size);
|
hc_clGetProgramBuildInfo (data.ocl, device_param->program_mp, device_param->device, CL_PROGRAM_BUILD_LOG, 0, NULL, &build_log_size);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if defined (DEBUG)
|
||||||
if ((build_log_size != 0) || (CL_err != CL_SUCCESS))
|
if ((build_log_size != 0) || (CL_err != CL_SUCCESS))
|
||||||
#else
|
#else
|
||||||
if (CL_err != CL_SUCCESS)
|
if (CL_err != CL_SUCCESS)
|
||||||
@ -16589,7 +16589,7 @@ int main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#if defined (DEBUG)
|
||||||
log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id + 1, cached_file, cst.st_size);
|
log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id + 1, cached_file, cst.st_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -16711,7 +16711,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
hc_clGetProgramBuildInfo (data.ocl, device_param->program_amp, device_param->device, CL_PROGRAM_BUILD_LOG, 0, NULL, &build_log_size);
|
hc_clGetProgramBuildInfo (data.ocl, device_param->program_amp, device_param->device, CL_PROGRAM_BUILD_LOG, 0, NULL, &build_log_size);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if defined (DEBUG)
|
||||||
if ((build_log_size != 0) || (CL_err != CL_SUCCESS))
|
if ((build_log_size != 0) || (CL_err != CL_SUCCESS))
|
||||||
#else
|
#else
|
||||||
if (CL_err != CL_SUCCESS)
|
if (CL_err != CL_SUCCESS)
|
||||||
@ -16770,7 +16770,7 @@ int main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#if defined (DEBUG)
|
||||||
if (quiet == 0) log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id + 1, cached_file, cst.st_size);
|
if (quiet == 0) log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id + 1, cached_file, cst.st_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -17560,11 +17560,11 @@ int main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else if (device_param->device_vendor_id == VENDOR_ID_NV)
|
else if (device_param->device_vendor_id == VENDOR_ID_NV)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#if defined (__linux__)
|
||||||
rc = set_fan_control (data.hm_xnvctrl, data.hm_device[device_id].xnvctrl, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_TRUE);
|
rc = set_fan_control (data.hm_xnvctrl, data.hm_device[device_id].xnvctrl, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_TRUE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
rc = hm_set_fanspeed_with_device_id_nvapi (device_id, fanspeed, 1);
|
rc = hm_set_fanspeed_with_device_id_nvapi (device_id, fanspeed, 1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -17626,7 +17626,7 @@ int main (int argc, char **argv)
|
|||||||
* open filehandles
|
* open filehandles
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
if (_setmode (_fileno (stdin), _O_BINARY) == -1)
|
if (_setmode (_fileno (stdin), _O_BINARY) == -1)
|
||||||
{
|
{
|
||||||
log_error ("ERROR: %s: %s", "stdin", strerror (errno));
|
log_error ("ERROR: %s: %s", "stdin", strerror (errno));
|
||||||
@ -19809,7 +19809,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
// reset default fan speed
|
// reset default fan speed
|
||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMON)
|
||||||
if (gpu_temp_disable == 0)
|
if (gpu_temp_disable == 0)
|
||||||
{
|
{
|
||||||
if (gpu_temp_retain != 0)
|
if (gpu_temp_retain != 0)
|
||||||
@ -19832,11 +19832,11 @@ int main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else if (device_param->device_vendor_id == VENDOR_ID_NV)
|
else if (device_param->device_vendor_id == VENDOR_ID_NV)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#if defined (__linux__)
|
||||||
rc = set_fan_control (data.hm_xnvctrl, data.hm_device[device_id].xnvctrl, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_FALSE);
|
rc = set_fan_control (data.hm_xnvctrl, data.hm_device[device_id].xnvctrl, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_FALSE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
rc = hm_set_fanspeed_with_device_id_nvapi (device_id, 100, 0);
|
rc = hm_set_fanspeed_with_device_id_nvapi (device_id, 100, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -20001,7 +20001,7 @@ int main (int argc, char **argv)
|
|||||||
local_free (bitmap_s2_c);
|
local_free (bitmap_s2_c);
|
||||||
local_free (bitmap_s2_d);
|
local_free (bitmap_s2_d);
|
||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMON)
|
||||||
local_free (od_clock_mem_status);
|
local_free (od_clock_mem_status);
|
||||||
local_free (od_power_control_status);
|
local_free (od_power_control_status);
|
||||||
local_free (nvml_power_limit);
|
local_free (nvml_power_limit);
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "opencl.h"
|
#include "opencl.h"
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
|
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMON)
|
||||||
|
|
||||||
extern hc_global_data_t data;
|
extern hc_global_data_t data;
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ u32 *hm_get_list_valid_adl_adapters (int iNumberAdapters, int *num_adl_adapters,
|
|||||||
|
|
||||||
if (strlen (info.strUDID) < 1) continue;
|
if (strlen (info.strUDID) < 1) continue;
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
if (info.iVendorID != 1002) continue;
|
if (info.iVendorID != 1002) continue;
|
||||||
#else
|
#else
|
||||||
if (info.iVendorID != 0x1002) continue;
|
if (info.iVendorID != 0x1002) continue;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* License.....: MIT
|
* License.....: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined (__APPLE__)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#include "locking.h"
|
#include "locking.h"
|
||||||
|
|
||||||
#ifdef F_SETLKW
|
#if defined (F_SETLKW)
|
||||||
|
|
||||||
void lock_file (FILE *fp)
|
void lock_file (FILE *fp)
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* License.....: MIT
|
* License.....: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined (__APPLE__)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* License.....: MIT
|
* License.....: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined (__APPLE__)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* License.....: MIT
|
* License.....: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined (__APPLE__)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
extern hc_global_data_t data;
|
extern hc_global_data_t data;
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
static void fsync (int fd)
|
static void fsync (int fd)
|
||||||
{
|
{
|
||||||
HANDLE h = (HANDLE) _get_osfhandle (fd);
|
HANDLE h = (HANDLE) _get_osfhandle (fd);
|
||||||
@ -86,7 +86,7 @@ restore_data_t *init_restore (int argc, char **argv)
|
|||||||
|
|
||||||
int pidbin_len = -1;
|
int pidbin_len = -1;
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
snprintf (pidbin, HCBUFSIZ - 1, "/proc/%d/cmdline", rd->pid);
|
snprintf (pidbin, HCBUFSIZ - 1, "/proc/%d/cmdline", rd->pid);
|
||||||
|
|
||||||
FILE *fd = fopen (pidbin, "rb");
|
FILE *fd = fopen (pidbin, "rb");
|
||||||
@ -115,7 +115,7 @@ restore_data_t *init_restore (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif _WIN
|
#elif defined (_WIN)
|
||||||
HANDLE hProcess = OpenProcess (PROCESS_ALL_ACCESS, FALSE, rd->pid);
|
HANDLE hProcess = OpenProcess (PROCESS_ALL_ACCESS, FALSE, rd->pid);
|
||||||
|
|
||||||
char *pidbin2 = (char *) mymalloc (HCBUFSIZ);
|
char *pidbin2 = (char *) mymalloc (HCBUFSIZ);
|
||||||
@ -158,9 +158,9 @@ restore_data_t *init_restore (int argc, char **argv)
|
|||||||
|
|
||||||
rd->version = RESTORE_VERSION_CUR;
|
rd->version = RESTORE_VERSION_CUR;
|
||||||
|
|
||||||
#ifdef _POSIX
|
#if defined (_POSIX)
|
||||||
rd->pid = getpid ();
|
rd->pid = getpid ();
|
||||||
#elif _WIN
|
#elif defined (_WIN)
|
||||||
rd->pid = GetCurrentProcessId ();
|
rd->pid = GetCurrentProcessId ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* License.....: MIT
|
* License.....: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined (__APPLE__)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
10
src/shared.c
10
src/shared.c
@ -6,7 +6,7 @@
|
|||||||
* License.....: MIT
|
* License.....: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined (__APPLE__)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ int sort_by_dictstat (const void *s1, const void *s2)
|
|||||||
dictstat_t *d1 = (dictstat_t *) s1;
|
dictstat_t *d1 = (dictstat_t *) s1;
|
||||||
dictstat_t *d2 = (dictstat_t *) s2;
|
dictstat_t *d2 = (dictstat_t *) s2;
|
||||||
|
|
||||||
#ifdef __linux__
|
#if defined (__linux__)
|
||||||
d2->stat.st_atim = d1->stat.st_atim;
|
d2->stat.st_atim = d1->stat.st_atim;
|
||||||
#else
|
#else
|
||||||
d2->stat.st_atime = d1->stat.st_atime;
|
d2->stat.st_atime = d1->stat.st_atime;
|
||||||
@ -1119,7 +1119,7 @@ void check_checkpoint ()
|
|||||||
* parallel running threads
|
* parallel running threads
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
|
|
||||||
BOOL WINAPI sigHandler_default (DWORD sig)
|
BOOL WINAPI sigHandler_default (DWORD sig)
|
||||||
{
|
{
|
||||||
@ -1239,7 +1239,7 @@ void *thread_keypress (void *p)
|
|||||||
if (ch == 0) continue;
|
if (ch == 0) continue;
|
||||||
|
|
||||||
//https://github.com/hashcat/hashcat/issues/302
|
//https://github.com/hashcat/hashcat/issues/302
|
||||||
//#ifdef _POSIX
|
//#if defined (_POSIX)
|
||||||
//if (ch != '\n')
|
//if (ch != '\n')
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
@ -1326,7 +1326,7 @@ void *thread_keypress (void *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//https://github.com/hashcat/hashcat/issues/302
|
//https://github.com/hashcat/hashcat/issues/302
|
||||||
//#ifdef _POSIX
|
//#if defined (_POSIX)
|
||||||
//if (ch != '\n')
|
//if (ch != '\n')
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "terminal.h"
|
#include "terminal.h"
|
||||||
|
|
||||||
#ifdef __linux__
|
#if defined (__linux__)
|
||||||
static struct termios savemodes;
|
static struct termios savemodes;
|
||||||
static int havemodes = 0;
|
static int havemodes = 0;
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ int tty_fix()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN
|
#if defined (_WIN)
|
||||||
static DWORD saveMode = 0;
|
static DWORD saveMode = 0;
|
||||||
|
|
||||||
int tty_break()
|
int tty_break()
|
||||||
|
@ -82,7 +82,7 @@ static const char *USAGE_BIG[] =
|
|||||||
" -u, --kernel-loops | Num | Manual workload tuning, set innerloop step size to X | -u 256",
|
" -u, --kernel-loops | Num | Manual workload tuning, set innerloop step size to X | -u 256",
|
||||||
" --nvidia-spin-damp | Num | Workaround NVidias CPU burning loop bug, in percent | --nvidia-spin-damp=50",
|
" --nvidia-spin-damp | Num | Workaround NVidias CPU burning loop bug, in percent | --nvidia-spin-damp=50",
|
||||||
" --gpu-temp-disable | | Disable temperature and fanspeed reads and triggers |",
|
" --gpu-temp-disable | | Disable temperature and fanspeed reads and triggers |",
|
||||||
#ifdef HAVE_HWMON
|
#if defined (HAVE_HWMON)
|
||||||
" --gpu-temp-abort | Num | Abort if GPU temperature reaches X degrees celsius | --gpu-temp-abort=100",
|
" --gpu-temp-abort | Num | Abort if GPU temperature reaches X degrees celsius | --gpu-temp-abort=100",
|
||||||
" --gpu-temp-retain | Num | Try to retain GPU temperature at X degrees celsius | --gpu-temp-retain=95",
|
" --gpu-temp-retain | Num | Try to retain GPU temperature at X degrees celsius | --gpu-temp-retain=95",
|
||||||
" --powertune-enable | | Enable power tuning, restores settings when finished |",
|
" --powertune-enable | | Enable power tuning, restores settings when finished |",
|
||||||
|
Loading…
Reference in New Issue
Block a user