security/hashcat: Fix build on aarch64

Same fix as archivers/7-zip

Approved by:	portmgr (build fix blanket)
This commit is contained in:
Mikael Urankar 2022-03-25 09:24:07 +01:00
parent 3d5c66e149
commit 9638af3be2
2 changed files with 37 additions and 2 deletions

View File

@ -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

View File

@ -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