summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2021-09-08 05:14:50 +0100
committerSam James <sam@gentoo.org>2021-09-08 05:14:50 +0100
commitf7c45d03f600f5e28966a20acc267e10e1f2996e (patch)
treece1ebe64b8677dc55d743e5a442c1b82ef242108
parentnet-mail/mu: Bump to 1.6.6 (diff)
downloadgentoo-f7c45d03.tar.gz
gentoo-f7c45d03.tar.bz2
gentoo-f7c45d03.zip
app-crypt/hashcat: add POCL include fix
Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--app-crypt/hashcat/files/hashcat-6.2.4-pocl-quoting-include.patch34
-rw-r--r--app-crypt/hashcat/hashcat-6.2.4-r1.ebuild113
2 files changed, 147 insertions, 0 deletions
diff --git a/app-crypt/hashcat/files/hashcat-6.2.4-pocl-quoting-include.patch b/app-crypt/hashcat/files/hashcat-6.2.4-pocl-quoting-include.patch
new file mode 100644
index 000000000000..c2c834f712e6
--- /dev/null
+++ b/app-crypt/hashcat/files/hashcat-6.2.4-pocl-quoting-include.patch
@@ -0,0 +1,34 @@
+Fixes POCL include error.
+
+https://github.com/hashcat/hashcat/commit/8c14fd85eaf98f4cda3acf8f917edae696a3bb71
+https://github.com/hashcat/hashcat/issues/2950
+
+From: Jens Steube <jens.steube@gmail.com>
+Date: Sun, 5 Sep 2021 10:55:59 +0200
+Subject: [PATCH] POCL: Added a workaround for an issue in POCL that uses a
+ quote character as part of the path itself given to a path for the -I option
+
+--- a/src/backend.c
++++ b/src/backend.c
+@@ -11365,7 +11365,19 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
+ }
+ else
+ {
+- build_options_len += snprintf (build_options_buf + build_options_len, build_options_sz - build_options_len, "-D KERNEL_STATIC -I OpenCL -I \"%s\" ", folder_config->cpath_real);
++ if (device_param->opencl_platform_vendor_id == VENDOR_ID_POCL)
++ {
++ // POCL doesn't like quotes in the include path, see:
++ // https://github.com/hashcat/hashcat/issues/2950
++ // Maybe related:
++ // https://github.com/pocl/pocl/issues/962
++
++ build_options_len += snprintf (build_options_buf + build_options_len, build_options_sz - build_options_len, "-D KERNEL_STATIC -I OpenCL -I %s ", folder_config->cpath_real);
++ }
++ else
++ {
++ build_options_len += snprintf (build_options_buf + build_options_len, build_options_sz - build_options_len, "-D KERNEL_STATIC -I OpenCL -I \"%s\" ", folder_config->cpath_real);
++ }
+ }
+
+ /* currently disabled, hangs NEO drivers since 20.09.
+
diff --git a/app-crypt/hashcat/hashcat-6.2.4-r1.ebuild b/app-crypt/hashcat/hashcat-6.2.4-r1.ebuild
new file mode 100644
index 000000000000..8d00e75fa192
--- /dev/null
+++ b/app-crypt/hashcat/hashcat-6.2.4-r1.ebuild
@@ -0,0 +1,113 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit pax-utils toolchain-funcs
+
+DESCRIPTION="World's fastest and most advanced password recovery utility"
+HOMEPAGE="https://github.com/hashcat/hashcat"
+LICENSE="MIT"
+SLOT="0"
+if [ "${PV}" = "9999" ]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/hashcat/hashcat.git"
+else
+ KEYWORDS="~amd64"
+ SRC_URI="https://github.com/hashcat/hashcat/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+fi
+
+IUSE="brain video_cards_nvidia"
+DEPEND="
+ app-arch/lzma
+ app-arch/unrar
+ sys-libs/zlib[minizip]
+ brain? ( dev-libs/xxhash )
+ video_cards_nvidia? ( >x11-drivers/nvidia-drivers-440.64
+ || ( dev-util/nvidia-cuda-toolkit
+ virtual/opencl )
+ )
+ !video_cards_nvidia? ( virtual/opencl )"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-6.2.4-brainless.patch
+ "${FILESDIR}"/${PN}-6.2.4-pocl-quoting-include.patch
+)
+
+src_prepare() {
+ # remove bundled stuff
+ rm -r deps/OpenCL-Headers || die "Failed to remove bundled OpenCL Headers"
+ rm -r deps/xxHash || die "Failed to remove bundled xxHash"
+ # TODO: Gentoo's app-arch/lzma doesn't install the needed files
+ #rm -r deps/LZMA-SDK || die "Failed to remove bundled LZMA-SDK"
+ #rm -r deps || die "Failed to remove bundled deps"
+
+ # do not strip
+ sed -i "/LFLAGS += -s/d" src/Makefile
+ # do not add random CFLAGS
+ sed -i "s/-O2//" src/Makefile || die
+ #sed -i "#LZMA_SDK_INCLUDE#d" src/Makefile || die
+ # respect CC, CXX, AR
+ sed -i \
+ -e 's/:= gcc/:= $(CC)/' \
+ -e 's/:= g++/:= $(CXX)/' \
+ -e 's/:= ar/:= $(AR)/' \
+ src/Makefile || die
+
+ export PREFIX="${EPREFIX}"/usr
+ export LIBRARY_FOLDER="/usr/$(get_libdir)"
+ export DOCUMENT_FOLDER="/usr/share/doc/${PF}"
+
+ default
+}
+
+src_compile() {
+ tc-export CC CXX AR
+
+ # Use bundled unrar for now, bug #792720
+ emake \
+ SHARED=1 \
+ PRODUCTION=1 \
+ ENABLE_BRAIN=$(usex brain 1 0) \
+ USE_SYSTEM_LZMA=0 \
+ USE_SYSTEM_OPENCL=1 \
+ USE_SYSTEM_UNRAR=0 \
+ USE_SYSTEM_ZLIB=1 \
+ USE_SYSTEM_XXHASH=1 \
+ VERSION_PURE="${PV}"
+
+ pax-mark -mr hashcat
+}
+
+src_test() {
+ if use video_cards_nvidia; then
+ addwrite /dev/nvidia0
+ addwrite /dev/nvidiactl
+ addwrite /dev/nvidia-uvm
+ if [ ! -w /dev/nvidia0 ]; then
+ einfo "To run these tests, portage likely must be in the video group."
+ einfo "Please run \"gpasswd -a portage video\" if the tests will fail"
+ fi
+ #elif use vidia_cards_fglrx; then
+ # addwrite /dev/ati
+ fi
+ #this always exits with 255 despite success
+ #./hashcat -b -m 2500 || die "Test failed"
+ LD_PRELOAD=./libhashcat.so.${PV} ./hashcat -a 3 -m 1500 nQCk49SiErOgk || die "Test failed"
+}
+
+src_install() {
+ emake \
+ DESTDIR="${ED}" \
+ SHARED=1 \
+ PRODUCTION=1 \
+ ENABLE_BRAIN=$(usex brain 1 0) \
+ USE_SYSTEM_LZMA=0 \
+ USE_SYSTEM_OPENCL=1 \
+ USE_SYSTEM_UNRAR=1 \
+ USE_SYSTEM_ZLIB=1 \
+ USE_SYSTEM_XXHASH=1 \
+ VERSION_PURE="${PV}" \
+ install
+}