summaryrefslogtreecommitdiff
path: root/security/hashcat/files/patch-src_shared.c
diff options
context:
space:
mode:
authorMatthew Seaman <matthew@FreeBSD.org>2016-07-11 21:21:35 +0000
committerMatthew Seaman <matthew@FreeBSD.org>2016-07-11 21:21:35 +0000
commitcfcc60d58cbf54c7e32cf38a2028ee1e2c3ae378 (patch)
tree61d88ac62d5eae63f7c087b9183d67ca6036355e /security/hashcat/files/patch-src_shared.c
parentSet NO_ARCH=yes. (diff)
Upgrade to 3.00
This is a major rewrite that combines the codebases of the former hashcat (running on the main CPU) and oclHashcat (running on the GPU). Because of the extent of the changes, the previous version will still remain available, renamed to 'hashcat-legacy' (following upstream) ChangeLog: https://github.com/hashcat/hashcat/releases/tag/v3.00 PR: 210873 Submitted by: lifanov@mail.lifanov.com (maintainer)
Notes
Notes: svn path=/head/; revision=418409
Diffstat (limited to 'security/hashcat/files/patch-src_shared.c')
-rw-r--r--security/hashcat/files/patch-src_shared.c67
1 files changed, 67 insertions, 0 deletions
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);