diff options
Diffstat (limited to 'security/hashcat/files')
-rw-r--r-- | security/hashcat/files/patch-include_common.h | 14 | ||||
-rw-r--r-- | security/hashcat/files/patch-include_ext__OpenCL.h | 13 | ||||
-rw-r--r-- | security/hashcat/files/patch-src_Makefile | 52 | ||||
-rw-r--r-- | security/hashcat/files/patch-src_hashcat-cli.c | 95 | ||||
-rw-r--r-- | security/hashcat/files/patch-src_hashcat.c | 20 | ||||
-rw-r--r-- | security/hashcat/files/patch-src_shared.c | 67 |
6 files changed, 166 insertions, 95 deletions
diff --git a/security/hashcat/files/patch-include_common.h b/security/hashcat/files/patch-include_common.h new file mode 100644 index 000000000000..bf13aed556fe --- /dev/null +++ b/security/hashcat/files/patch-include_common.h @@ -0,0 +1,14 @@ +--- include/common.h.orig 2016-06-28 09:47:32 UTC ++++ include/common.h +@@ -51,6 +51,11 @@ + #include <mach/mach.h> + #endif + ++#ifdef __FreeBSD__ ++#include <termios.h> ++#include <sys/ioctl.h> ++#endif ++ + typedef void *OCL_LIB; + + #ifdef HAVE_HWMON diff --git a/security/hashcat/files/patch-include_ext__OpenCL.h b/security/hashcat/files/patch-include_ext__OpenCL.h new file mode 100644 index 000000000000..bdeb44a14e34 --- /dev/null +++ b/security/hashcat/files/patch-include_ext__OpenCL.h @@ -0,0 +1,13 @@ +--- include/ext_OpenCL.h.orig 2016-06-28 09:47:32 UTC ++++ include/ext_OpenCL.h +@@ -27,6 +27,10 @@ + // #include <CL/cl_ext.h> // used for CL_DEVICE_TOPOLOGY_AMD but broken for dual GPU + #endif + ++#ifdef __FreeBSD__ ++#include <CL/cl.h> ++#endif ++ + #include <shared.h> + + typedef cl_mem (CL_API_CALL *OCL_CLCREATEBUFFER) (cl_context, cl_mem_flags, size_t, void *, cl_int *); diff --git a/security/hashcat/files/patch-src_Makefile b/security/hashcat/files/patch-src_Makefile new file mode 100644 index 000000000000..7d1c2e3d5a40 --- /dev/null +++ b/security/hashcat/files/patch-src_Makefile @@ -0,0 +1,52 @@ +--- src/Makefile.orig 2016-06-28 09:47:32 UTC ++++ src/Makefile +@@ -17,7 +17,7 @@ UNAME := $(shell unam + # we need to strip the windows version number to be able to build hashcat on cygwin hosts + UNAME := $(patsubst CYGWIN_NT-%,CYGWIN_NT-,$(UNAME)) + +-ifeq (,$(filter $(UNAME),Linux Darwin CYGWIN_NT-)) ++ifeq (,$(filter $(UNAME),Linux Darwin CYGWIN_NT- FreeBSD)) + $(error "! Your Operating System ($(UNAME)) is not supported by $(PROG_NAME) Makefile") + endif + +@@ -58,7 +58,6 @@ OPENCL_HEADERS_KHRONOS := deps/OpenCL- + ## Native compiler paths + ## + +-CC := gcc + FIND := find + INSTALL := install + RM := rm +@@ -87,7 +86,7 @@ VERSION_TAG := $(shell test + ## Compiler flags + ## + +-CFLAGS := -pipe -W -Wall -std=c99 -Iinclude/ -IOpenCL/ -I$(OPENCL_HEADERS_KHRONOS)/ ++CFLAGS += -Iinclude/ -IOpenCL/ -I$(OPENCL_HEADERS_KHRONOS)/ + + ifndef DEBUG + CFLAGS += -O2 +@@ -97,6 +96,9 @@ ifeq ($(DEBUG),2) + CFLAGS += -fsanitize=address -fno-omit-frame-pointer + endif + endif ++ifeq ($(UNAME),FreeBSD) ++SED := gsed ++endif + + ## + ## Native compilation target +@@ -122,6 +124,13 @@ LFLAGS_NATIVE := -lpthread -l + CFLAGS_NATIVE += -DHAVE_HWMON + endif # linux + ++ifeq ($(UNAME),FreeBSD) ++CFLAGS_NATIVE := -D_POSIX ++CFLAGS_NATIVE += $(CFLAGS) ++LFLAGS_NATIVE := -lpthread ++LFLAGS_NATIVE += $(LDFLAGS) ++endif # freebsd ++ + ## + ## Cross compilation target + ## diff --git a/security/hashcat/files/patch-src_hashcat-cli.c b/security/hashcat/files/patch-src_hashcat-cli.c deleted file mode 100644 index b792639b61f0..000000000000 --- a/security/hashcat/files/patch-src_hashcat-cli.c +++ /dev/null @@ -1,95 +0,0 @@ ---- src/hashcat-cli.c.orig 2015-12-04 15:35:08 UTC -+++ src/hashcat-cli.c -@@ -17,14 +17,14 @@ - - // for interactive status prompt - #ifdef POSIX --#ifndef OSX -+#if defined(OSX) || defined(__FreeBSD__) - --#include <termio.h> -+#include <termios.h> -+#include <sys/ioctl.h> - - #else - --#include <termios.h> --#include <sys/ioctl.h> -+#include <termio.h> - - #endif - #endif -@@ -2836,16 +2836,16 @@ void save_hash () - - #ifdef POSIX - --#ifndef OSX -+#if defined(OSX) || defined(__FreeBSD__) - --static struct termio savemodes; -+static struct termios savemodes; - static int havemodes = 0; - - int tty_break () - { -- struct termio modmodes; -+ struct termios modmodes; - -- if (ioctl (fileno (stdin), TCGETA, &savemodes) < 0) return -1; -+ if (ioctl (fileno (stdin), TIOCGETA, &savemodes) < 0) return -1; - - havemodes = 1; - -@@ -2854,7 +2854,7 @@ int tty_break () - modmodes.c_cc[VMIN] = 1; - modmodes.c_cc[VTIME] = 0; - -- return ioctl (fileno (stdin), TCSETAW, &modmodes); -+ return ioctl (fileno (stdin), TIOCSETAW, &modmodes); - } - - int tty_getchar () -@@ -2882,19 +2882,19 @@ int tty_fix () - { - if (!havemodes) return 0; - -- return ioctl (fileno (stdin), TCSETAW, &savemodes); -+ return ioctl (fileno (stdin), TIOCSETAW, &savemodes); - } - - #else - --static struct termios savemodes; -+static struct termio savemodes; - static int havemodes = 0; - - int tty_break () - { -- struct termios modmodes; -+ struct termio modmodes; - -- if (ioctl (fileno (stdin), TIOCGETA, &savemodes) < 0) return -1; -+ if (ioctl (fileno (stdin), TCGETA, &savemodes) < 0) return -1; - - havemodes = 1; - -@@ -2903,7 +2903,7 @@ int tty_break () - modmodes.c_cc[VMIN] = 1; - modmodes.c_cc[VTIME] = 0; - -- return ioctl (fileno (stdin), TIOCSETAW, &modmodes); -+ return ioctl (fileno (stdin), TCSETAW, &modmodes); - } - - int tty_getchar () -@@ -2931,8 +2931,9 @@ int tty_fix () - { - if (!havemodes) return 0; - -- return ioctl (fileno (stdin), TIOCSETAW, &savemodes); -+ return ioctl (fileno (stdin), TCSETAW, &savemodes); - } -+ - #endif - #endif - diff --git a/security/hashcat/files/patch-src_hashcat.c b/security/hashcat/files/patch-src_hashcat.c new file mode 100644 index 000000000000..c1bb3ccc5111 --- /dev/null +++ b/security/hashcat/files/patch-src_hashcat.c @@ -0,0 +1,20 @@ +--- src/hashcat.c.orig 2016-06-28 09:47:32 UTC ++++ src/hashcat.c +@@ -6,7 +6,7 @@ + * License.....: MIT + */ + +-#ifdef DARWIN ++#if defined(DARWIN) || defined(__FreeBSD__) + #include <stdio.h> + #endif + +@@ -6134,7 +6134,7 @@ int main (int argc, char **argv) + + char *exec_path = get_exec_path (); + +- #ifdef LINUX ++ #if defined(LINUX) || defined(__FreeBSD__) + + char *resolved_install_folder = realpath (INSTALL_FOLDER, NULL); + char *resolved_exec_path = realpath (exec_path, NULL); diff --git a/security/hashcat/files/patch-src_shared.c b/security/hashcat/files/patch-src_shared.c new file mode 100644 index 000000000000..348ef3498f24 --- /dev/null +++ b/security/hashcat/files/patch-src_shared.c @@ -0,0 +1,67 @@ +--- src/shared.c.orig 2016-06-28 09:47:32 UTC ++++ src/shared.c +@@ -10,6 +10,11 @@ + #include <stdio.h> + #endif + ++#ifdef __FreeBSD__ ++#include <stdio.h> ++#include <pthread_np.h> ++#endif ++ + #include <shared.h> + #include <limits.h> + +@@ -2382,7 +2387,7 @@ int tty_fix() + } + #endif + +-#ifdef DARWIN ++#if defined(DARWIN) || defined(__FreeBSD__) + static struct termios savemodes; + static int havemodes = 0; + +@@ -4371,6 +4376,23 @@ char *get_exec_path () + + const int len = strlen (exec_path); + ++ #elif __FreeBSD__ ++ ++ #include <sys/sysctl.h> ++ ++ int mib[4]; ++ mib[0] = CTL_KERN; ++ mib[1] = KERN_PROC; ++ mib[2] = KERN_PROC_PATHNAME; ++ mib[3] = -1; ++ ++ char tmp[32] = { 0 }; ++ ++ size_t size = exec_path_len; ++ sysctl(mib, 4, exec_path, &size, NULL, 0); ++ ++ const int len = readlink (tmp, exec_path, exec_path_len - 1); ++ + #else + #error Your Operating System is not supported or detected + #endif +@@ -4523,6 +4545,9 @@ void set_cpu_affinity (char *cpu_affinit + { + #ifdef _WIN + DWORD_PTR aff_mask = 0; ++ #elif __FreeBSD__ ++ cpuset_t cpuset; ++ CPU_ZERO (&cpuset); + #elif _POSIX + cpu_set_t cpuset; + CPU_ZERO (&cpuset); +@@ -4570,6 +4595,9 @@ void set_cpu_affinity (char *cpu_affinit + #ifdef _WIN + SetProcessAffinityMask (GetCurrentProcess (), aff_mask); + SetThreadAffinityMask (GetCurrentThread (), aff_mask); ++ #elif __FreeBSD__ ++ pthread_t thread = pthread_self (); ++ pthread_setaffinity_np (thread, sizeof (cpuset_t), &cpuset); + #elif _POSIX + pthread_t thread = pthread_self (); + pthread_setaffinity_np (thread, sizeof (cpu_set_t), &cpuset); |