View | Details | Raw Unified | Return to bug 211998 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (-1 / +1 lines)
Lines 2-8 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	hashcat
4
PORTNAME=	hashcat
5
PORTVERSION=	3.00
5
PORTVERSION=	3.10
6
DISTVERSIONPREFIX=	v
6
DISTVERSIONPREFIX=	v
7
CATEGORIES=	security
7
CATEGORIES=	security
8
8
(-)distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1468849069
1
TIMESTAMP = 1471617716
2
SHA256 (hashcat-hashcat-v3.00_GH0.tar.gz) = 0283791b91db9dd7ee7431d8975c63419c73232945b76eedcefbe12becfa19c4
2
SHA256 (hashcat-hashcat-v3.10_GH0.tar.gz) = 8de4f4ae8baa10dbe9139d670cc26dcd49e0e7e343bcbcadbe912cc52fb8255f
3
SIZE (hashcat-hashcat-v3.00_GH0.tar.gz) = 4068649
3
SIZE (hashcat-hashcat-v3.10_GH0.tar.gz) = 4077706
(-)files/patch-include_common.h (-14 lines)
Lines 1-14 Link Here
1
--- include/common.h.orig	2016-06-28 09:47:32 UTC
2
+++ include/common.h
3
@@ -51,6 +51,11 @@
4
 #include <mach/mach.h>
5
 #endif
6
 
7
+#ifdef __FreeBSD__
8
+#include <termios.h>
9
+#include <sys/ioctl.h>
10
+#endif
11
+
12
 typedef void *OCL_LIB;
13
 
14
 #ifdef HAVE_HWMON
(-)files/patch-include_ext__OpenCL.h (-13 lines)
Lines 1-13 Link Here
1
--- include/ext_OpenCL.h.orig	2016-06-28 09:47:32 UTC
2
+++ include/ext_OpenCL.h
3
@@ -27,6 +27,10 @@
4
 // #include <CL/cl_ext.h> // used for CL_DEVICE_TOPOLOGY_AMD but broken for dual GPU
5
 #endif
6
 
7
+#ifdef __FreeBSD__
8
+#include <CL/cl.h>
9
+#endif
10
+
11
 #include <shared.h>
12
 
13
 typedef cl_mem (CL_API_CALL *OCL_CLCREATEBUFFER)                 (cl_context, cl_mem_flags, size_t, void *, cl_int *);
(-)files/patch-src_Makefile (-52 lines)
Lines 1-52 Link Here
1
--- src/Makefile.orig	2016-06-28 09:47:32 UTC
2
+++ src/Makefile
3
@@ -17,7 +17,7 @@ UNAME                    := $(shell unam
4
 # we need to strip the windows version number to be able to build hashcat on cygwin hosts
5
 UNAME                    := $(patsubst CYGWIN_NT-%,CYGWIN_NT-,$(UNAME))
6
 
7
-ifeq (,$(filter $(UNAME),Linux Darwin CYGWIN_NT-))
8
+ifeq (,$(filter $(UNAME),Linux Darwin CYGWIN_NT- FreeBSD))
9
 $(error "! Your Operating System ($(UNAME)) is not supported by $(PROG_NAME) Makefile")
10
 endif
11
 
12
@@ -58,7 +58,6 @@ OPENCL_HEADERS_KHRONOS   := deps/OpenCL-
13
 ## Native compiler paths
14
 ##
15
 
16
-CC                       := gcc
17
 FIND                     := find
18
 INSTALL                  := install
19
 RM                       := rm
20
@@ -87,7 +86,7 @@ VERSION_TAG              := $(shell test
21
 ## Compiler flags
22
 ##
23
 
24
-CFLAGS                   := -pipe -W -Wall -std=c99 -Iinclude/ -IOpenCL/ -I$(OPENCL_HEADERS_KHRONOS)/
25
+CFLAGS                   += -Iinclude/ -IOpenCL/ -I$(OPENCL_HEADERS_KHRONOS)/
26
 
27
 ifndef DEBUG
28
 CFLAGS                   += -O2
29
@@ -97,6 +96,9 @@ ifeq ($(DEBUG),2)
30
 CFLAGS                   += -fsanitize=address -fno-omit-frame-pointer
31
 endif
32
 endif
33
+ifeq ($(UNAME),FreeBSD)
34
+SED                      := gsed
35
+endif
36
 
37
 ##
38
 ## Native compilation target
39
@@ -122,6 +124,13 @@ LFLAGS_NATIVE            := -lpthread -l
40
 CFLAGS_NATIVE            += -DHAVE_HWMON
41
 endif # linux
42
 
43
+ifeq ($(UNAME),FreeBSD)
44
+CFLAGS_NATIVE            := -D_POSIX
45
+CFLAGS_NATIVE            += $(CFLAGS)
46
+LFLAGS_NATIVE            := -lpthread
47
+LFLAGS_NATIVE            += $(LDFLAGS)
48
+endif # freebsd
49
+
50
 ##
51
 ## Cross compilation target
52
 ##
(-)files/patch-src_hashcat.c (-20 lines)
Lines 1-20 Link Here
1
--- src/hashcat.c.orig	2016-06-28 09:47:32 UTC
2
+++ src/hashcat.c
3
@@ -6,7 +6,7 @@
4
  * License.....: MIT
5
  */
6
 
7
-#ifdef DARWIN
8
+#if defined(DARWIN) || defined(__FreeBSD__)
9
 #include <stdio.h>
10
 #endif
11
 
12
@@ -6134,7 +6134,7 @@ int main (int argc, char **argv)
13
 
14
   char *exec_path = get_exec_path ();
15
 
16
-  #ifdef LINUX
17
+  #if defined(LINUX) || defined(__FreeBSD__)
18
 
19
   char *resolved_install_folder = realpath (INSTALL_FOLDER, NULL);
20
   char *resolved_exec_path      = realpath (exec_path, NULL);
(-)files/patch-src_shared.c (-67 lines)
Lines 1-67 Link Here
1
--- src/shared.c.orig	2016-06-28 09:47:32 UTC
2
+++ src/shared.c
3
@@ -10,6 +10,11 @@
4
 #include <stdio.h>
5
 #endif
6
 
7
+#ifdef __FreeBSD__
8
+#include <stdio.h>
9
+#include <pthread_np.h>
10
+#endif
11
+
12
 #include <shared.h>
13
 #include <limits.h>
14
 
15
@@ -2382,7 +2387,7 @@ int tty_fix()
16
 }
17
 #endif
18
 
19
-#ifdef DARWIN
20
+#if defined(DARWIN) || defined(__FreeBSD__)
21
 static struct termios savemodes;
22
 static int havemodes = 0;
23
 
24
@@ -4371,6 +4376,23 @@ char *get_exec_path ()
25
 
26
   const int len = strlen (exec_path);
27
 
28
+  #elif __FreeBSD__
29
+
30
+  #include <sys/sysctl.h>
31
+
32
+  int mib[4];
33
+  mib[0] = CTL_KERN;
34
+  mib[1] = KERN_PROC;
35
+  mib[2] = KERN_PROC_PATHNAME;
36
+  mib[3] = -1;
37
+
38
+  char tmp[32] = { 0 };
39
+
40
+  size_t size = exec_path_len;
41
+  sysctl(mib, 4, exec_path, &size, NULL, 0);
42
+
43
+  const int len = readlink (tmp, exec_path, exec_path_len - 1);
44
+
45
   #else
46
   #error Your Operating System is not supported or detected
47
   #endif
48
@@ -4523,6 +4545,9 @@ void set_cpu_affinity (char *cpu_affinit
49
 {
50
   #ifdef _WIN
51
   DWORD_PTR aff_mask = 0;
52
+  #elif __FreeBSD__
53
+  cpuset_t cpuset;
54
+  CPU_ZERO (&cpuset);
55
   #elif _POSIX
56
   cpu_set_t cpuset;
57
   CPU_ZERO (&cpuset);
58
@@ -4570,6 +4595,9 @@ void set_cpu_affinity (char *cpu_affinit
59
   #ifdef _WIN
60
   SetProcessAffinityMask (GetCurrentProcess (), aff_mask);
61
   SetThreadAffinityMask (GetCurrentThread (), aff_mask);
62
+  #elif __FreeBSD__
63
+  pthread_t thread = pthread_self ();
64
+  pthread_setaffinity_np (thread, sizeof (cpuset_t), &cpuset);
65
   #elif _POSIX
66
   pthread_t thread = pthread_self ();
67
   pthread_setaffinity_np (thread, sizeof (cpu_set_t), &cpuset);
(-)pkg-plist (+3 lines)
Lines 377-382 Link Here
377
%%DATADIR%%/OpenCL/m13800_a0.cl
377
%%DATADIR%%/OpenCL/m13800_a0.cl
378
%%DATADIR%%/OpenCL/m13800_a1.cl
378
%%DATADIR%%/OpenCL/m13800_a1.cl
379
%%DATADIR%%/OpenCL/m13800_a3.cl
379
%%DATADIR%%/OpenCL/m13800_a3.cl
380
%%DATADIR%%/OpenCL/m13900_a0.cl
381
%%DATADIR%%/OpenCL/m13900_a1.cl
382
%%DATADIR%%/OpenCL/m13900_a3.cl
380
%%DATADIR%%/OpenCL/markov_be.cl
383
%%DATADIR%%/OpenCL/markov_be.cl
381
%%DATADIR%%/OpenCL/markov_le.cl
384
%%DATADIR%%/OpenCL/markov_le.cl
382
%%DATADIR%%/charsets/combined/Bulgarian.hcchr
385
%%DATADIR%%/charsets/combined/Bulgarian.hcchr

Return to bug 211998