aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Urankar <mikael@FreeBSD.org>2022-03-25 08:24:07 +0000
committerMikael Urankar <mikael@FreeBSD.org>2022-03-25 08:24:07 +0000
commit9638af3be2e4c5c876f507a0e018a9be8d30b1e2 (patch)
treeccbd8b3819fec0175f09b5af541da96d420e29dc
parent3d5c66e1490fd0031d09d3afe5cca031df78af28 (diff)
downloadports-9638af3be2e4c5c876f507a0e018a9be8d30b1e2.tar.gz
ports-9638af3be2e4c5c876f507a0e018a9be8d30b1e2.zip
security/hashcat: Fix build on aarch64
Same fix as archivers/7-zip Approved by: portmgr (build fix blanket)
-rw-r--r--security/hashcat/Makefile5
-rw-r--r--security/hashcat/files/patch-deps_LZMA-SDK_C_CpuArch.c34
2 files changed, 37 insertions, 2 deletions
diff --git a/security/hashcat/Makefile b/security/hashcat/Makefile
index 7fc1e358d8e2..d545635c385d 100644
--- a/security/hashcat/Makefile
+++ b/security/hashcat/Makefile
@@ -11,9 +11,8 @@ COMMENT= Advanced CPU-based password recovery utility
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/docs/license.txt
-NOT_FOR_ARCHS= aarch64 powerpc powerpc64 powerpcspe sparc64
+NOT_FOR_ARCHS= powerpc powerpc64 powerpcspe sparc64
NOT_FOR_ARCHS_REASON= fails to compile: compiling for big-endian architecture not supported
-NOT_FOR_ARCHS_REASON_aarch64= fails to compile
BUILD_DEPENDS= minizip:archivers/minizip
@@ -40,6 +39,8 @@ BRAIN_DESC= Build Hashcat Brain
BRAIN_MAKE_ARGS_OFF= ENABLE_BRAIN=0
BRAIN_CFLAGS= -DWITH_BRAIN -Ideps/git/xxHash
+CFLAGS_aarch64+= -march=armv8-a+crc+crypto
+
pre-install:
${STRIP_CMD} ${WRKSRC}/libhashcat.so.${PORTVERSION}
${STRIP_CMD} ${WRKSRC}/modules/*.so
diff --git a/security/hashcat/files/patch-deps_LZMA-SDK_C_CpuArch.c b/security/hashcat/files/patch-deps_LZMA-SDK_C_CpuArch.c
new file mode 100644
index 000000000000..a788aaec3e8b
--- /dev/null
+++ b/security/hashcat/files/patch-deps_LZMA-SDK_C_CpuArch.c
@@ -0,0 +1,34 @@
+--- deps/LZMA-SDK/C/CpuArch.c.orig 2022-03-25 08:13:08 UTC
++++ deps/LZMA-SDK/C/CpuArch.c
+@@ -384,6 +384,23 @@ BoolInt CPU_IsSupported_AES (void) { return APPLE_CRYP
+
+ #include <sys/auxv.h>
+
++#if defined(__FreeBSD__)
++static UInt64 get_hwcap() {
++ unsigned long hwcap;
++ if(elf_aux_info(AT_HWCAP, &hwcap, sizeof(unsigned long)) != 0) {
++ return(0);
++ }
++ return hwcap;
++}
++
++BoolInt CPU_IsSupported_CRC32(void) { return get_hwcap() & HWCAP_CRC32; }
++BoolInt CPU_IsSupported_NEON(void) { return 1; }
++BoolInt CPU_IsSupported_SHA1(void){ return get_hwcap() & HWCAP_SHA1; }
++BoolInt CPU_IsSupported_SHA2(void) { return get_hwcap() & HWCAP_SHA2; }
++BoolInt CPU_IsSupported_AES(void) { return get_hwcap() & HWCAP_AES; }
++
++#else // __FreeBSD__
++
+ #define USE_HWCAP
+
+ #ifdef USE_HWCAP
+@@ -410,6 +427,7 @@ MY_HWCAP_CHECK_FUNC (SHA1)
+ MY_HWCAP_CHECK_FUNC (SHA2)
+ MY_HWCAP_CHECK_FUNC (AES)
+
++#endif // FreeBSD
+ #endif // __APPLE__
+ #endif // _WIN32
+