From 9638af3be2e4c5c876f507a0e018a9be8d30b1e2 Mon Sep 17 00:00:00 2001 From: Mikael Urankar Date: Fri, 25 Mar 2022 09:24:07 +0100 Subject: [PATCH] security/hashcat: Fix build on aarch64 Same fix as archivers/7-zip Approved by: portmgr (build fix blanket) --- security/hashcat/Makefile | 5 +-- .../files/patch-deps_LZMA-SDK_C_CpuArch.c | 34 +++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 security/hashcat/files/patch-deps_LZMA-SDK_C_CpuArch.c 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 + ++#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 +