Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-crypt/hashcat/files/, app-crypt/hashcat/
Date: Wed, 08 Sep 2021 04:15:24
Message-Id: 1631074490.f7c45d03f600f5e28966a20acc267e10e1f2996e.sam@gentoo
1 commit: f7c45d03f600f5e28966a20acc267e10e1f2996e
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 8 04:14:50 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 8 04:14:50 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f7c45d03
7
8 app-crypt/hashcat: add POCL include fix
9
10 Signed-off-by: Sam James <sam <AT> gentoo.org>
11
12 .../files/hashcat-6.2.4-pocl-quoting-include.patch | 34 +++++++
13 app-crypt/hashcat/hashcat-6.2.4-r1.ebuild | 113 +++++++++++++++++++++
14 2 files changed, 147 insertions(+)
15
16 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
17 new file mode 100644
18 index 00000000000..c2c834f712e
19 --- /dev/null
20 +++ b/app-crypt/hashcat/files/hashcat-6.2.4-pocl-quoting-include.patch
21 @@ -0,0 +1,34 @@
22 +Fixes POCL include error.
23 +
24 +https://github.com/hashcat/hashcat/commit/8c14fd85eaf98f4cda3acf8f917edae696a3bb71
25 +https://github.com/hashcat/hashcat/issues/2950
26 +
27 +From: Jens Steube <jens.steube@×××××.com>
28 +Date: Sun, 5 Sep 2021 10:55:59 +0200
29 +Subject: [PATCH] POCL: Added a workaround for an issue in POCL that uses a
30 + quote character as part of the path itself given to a path for the -I option
31 +
32 +--- a/src/backend.c
33 ++++ b/src/backend.c
34 +@@ -11365,7 +11365,19 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
35 + }
36 + else
37 + {
38 +- 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);
39 ++ if (device_param->opencl_platform_vendor_id == VENDOR_ID_POCL)
40 ++ {
41 ++ // POCL doesn't like quotes in the include path, see:
42 ++ // https://github.com/hashcat/hashcat/issues/2950
43 ++ // Maybe related:
44 ++ // https://github.com/pocl/pocl/issues/962
45 ++
46 ++ 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);
47 ++ }
48 ++ else
49 ++ {
50 ++ 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);
51 ++ }
52 + }
53 +
54 + /* currently disabled, hangs NEO drivers since 20.09.
55 +
56
57 diff --git a/app-crypt/hashcat/hashcat-6.2.4-r1.ebuild b/app-crypt/hashcat/hashcat-6.2.4-r1.ebuild
58 new file mode 100644
59 index 00000000000..8d00e75fa19
60 --- /dev/null
61 +++ b/app-crypt/hashcat/hashcat-6.2.4-r1.ebuild
62 @@ -0,0 +1,113 @@
63 +# Copyright 1999-2021 Gentoo Authors
64 +# Distributed under the terms of the GNU General Public License v2
65 +
66 +EAPI=7
67 +
68 +inherit pax-utils toolchain-funcs
69 +
70 +DESCRIPTION="World's fastest and most advanced password recovery utility"
71 +HOMEPAGE="https://github.com/hashcat/hashcat"
72 +LICENSE="MIT"
73 +SLOT="0"
74 +if [ "${PV}" = "9999" ]; then
75 + inherit git-r3
76 + EGIT_REPO_URI="https://github.com/hashcat/hashcat.git"
77 +else
78 + KEYWORDS="~amd64"
79 + SRC_URI="https://github.com/hashcat/hashcat/archive/v${PV}.tar.gz -> ${P}.tar.gz"
80 +fi
81 +
82 +IUSE="brain video_cards_nvidia"
83 +DEPEND="
84 + app-arch/lzma
85 + app-arch/unrar
86 + sys-libs/zlib[minizip]
87 + brain? ( dev-libs/xxhash )
88 + video_cards_nvidia? ( >x11-drivers/nvidia-drivers-440.64
89 + || ( dev-util/nvidia-cuda-toolkit
90 + virtual/opencl )
91 + )
92 + !video_cards_nvidia? ( virtual/opencl )"
93 +RDEPEND="${DEPEND}"
94 +
95 +PATCHES=(
96 + "${FILESDIR}"/${PN}-6.2.4-brainless.patch
97 + "${FILESDIR}"/${PN}-6.2.4-pocl-quoting-include.patch
98 +)
99 +
100 +src_prepare() {
101 + # remove bundled stuff
102 + rm -r deps/OpenCL-Headers || die "Failed to remove bundled OpenCL Headers"
103 + rm -r deps/xxHash || die "Failed to remove bundled xxHash"
104 + # TODO: Gentoo's app-arch/lzma doesn't install the needed files
105 + #rm -r deps/LZMA-SDK || die "Failed to remove bundled LZMA-SDK"
106 + #rm -r deps || die "Failed to remove bundled deps"
107 +
108 + # do not strip
109 + sed -i "/LFLAGS += -s/d" src/Makefile
110 + # do not add random CFLAGS
111 + sed -i "s/-O2//" src/Makefile || die
112 + #sed -i "#LZMA_SDK_INCLUDE#d" src/Makefile || die
113 + # respect CC, CXX, AR
114 + sed -i \
115 + -e 's/:= gcc/:= $(CC)/' \
116 + -e 's/:= g++/:= $(CXX)/' \
117 + -e 's/:= ar/:= $(AR)/' \
118 + src/Makefile || die
119 +
120 + export PREFIX="${EPREFIX}"/usr
121 + export LIBRARY_FOLDER="/usr/$(get_libdir)"
122 + export DOCUMENT_FOLDER="/usr/share/doc/${PF}"
123 +
124 + default
125 +}
126 +
127 +src_compile() {
128 + tc-export CC CXX AR
129 +
130 + # Use bundled unrar for now, bug #792720
131 + emake \
132 + SHARED=1 \
133 + PRODUCTION=1 \
134 + ENABLE_BRAIN=$(usex brain 1 0) \
135 + USE_SYSTEM_LZMA=0 \
136 + USE_SYSTEM_OPENCL=1 \
137 + USE_SYSTEM_UNRAR=0 \
138 + USE_SYSTEM_ZLIB=1 \
139 + USE_SYSTEM_XXHASH=1 \
140 + VERSION_PURE="${PV}"
141 +
142 + pax-mark -mr hashcat
143 +}
144 +
145 +src_test() {
146 + if use video_cards_nvidia; then
147 + addwrite /dev/nvidia0
148 + addwrite /dev/nvidiactl
149 + addwrite /dev/nvidia-uvm
150 + if [ ! -w /dev/nvidia0 ]; then
151 + einfo "To run these tests, portage likely must be in the video group."
152 + einfo "Please run \"gpasswd -a portage video\" if the tests will fail"
153 + fi
154 + #elif use vidia_cards_fglrx; then
155 + # addwrite /dev/ati
156 + fi
157 + #this always exits with 255 despite success
158 + #./hashcat -b -m 2500 || die "Test failed"
159 + LD_PRELOAD=./libhashcat.so.${PV} ./hashcat -a 3 -m 1500 nQCk49SiErOgk || die "Test failed"
160 +}
161 +
162 +src_install() {
163 + emake \
164 + DESTDIR="${ED}" \
165 + SHARED=1 \
166 + PRODUCTION=1 \
167 + ENABLE_BRAIN=$(usex brain 1 0) \
168 + USE_SYSTEM_LZMA=0 \
169 + USE_SYSTEM_OPENCL=1 \
170 + USE_SYSTEM_UNRAR=1 \
171 + USE_SYSTEM_ZLIB=1 \
172 + USE_SYSTEM_XXHASH=1 \
173 + VERSION_PURE="${PV}" \
174 + install
175 +}