Skip to content

Commit

Permalink
app-crypt/hashcat: pull upstream fix
Browse files Browse the repository at this point in the history
hashcat/hashcat#2455

Package-Manager: Portage-2.3.101, Repoman-2.3.22
Signed-off-by: Rick Farina <[email protected]>
  • Loading branch information
ZeroChaos- committed Jun 17, 2020
1 parent ce069b8 commit 609c0e2
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 9 deletions.
53 changes: 53 additions & 0 deletions app-crypt/hashcat/files/hashcat-6.0.0-missing-not-fatal.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
diff --git a/docs/changes.txt b/docs/changes.txt
index 1527da46..420c2102 100644
--- a/docs/changes.txt
+++ b/docs/changes.txt
@@ -1,3 +1,11 @@
+* changes v6.0.0 -> v6.0.x
+
+##
+## Improvements
+##
+
+- OpenCL Runtime: Reinterpret return code CL_DEVICE_NOT_FOUND from clGetDeviceIDs() as non-fatal
+
* changes v5.1.0 -> v6.0.0

##
diff --git a/src/backend.c b/src/backend.c
index 80fdbb38..7f79879f 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -5185,7 +5185,31 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx)
{
event_log_error (hashcat_ctx, "clGetDeviceIDs(): %s", val2cstr_cl (CL_rc));

- return -1;
+ // Special handling for CL_DEVICE_NOT_FOUND, see: https://github.com/hashcat/hashcat/issues/2455
+
+ #define IGNORE_DEVICE_NOT_FOUND 1
+
+ if (IGNORE_DEVICE_NOT_FOUND)
+ {
+ backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
+
+ OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl;
+
+ const cl_int CL_err = ocl->clGetDeviceIDs (opencl_platform, CL_DEVICE_TYPE_ALL, DEVICES_MAX, opencl_platform_devices, &opencl_platform_devices_cnt);
+
+ if (CL_err == CL_DEVICE_NOT_FOUND)
+ {
+ // we ignore this error
+ }
+ else
+ {
+ return -1;
+ }
+ }
+ else
+ {
+ return -1;
+ }
}

opencl_platforms_devices[opencl_platforms_idx] = opencl_platform_devices;
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,23 @@ if [ "${PV}" = "9999" ]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/hashcat/hashcat.git"
else
#this doesn't work for me, so it doesn't get keywords
#KEYWORDS="~amd64"
KEYWORDS="~amd64"
SRC_URI="https://github.com/hashcat/hashcat/archive/v${PV}.tar.gz -> ${P}.tar.gz"
fi

IUSE="brain video_cards_nvidia"
DEPEND="virtual/opencl
DEPEND="
app-arch/lzma
brain? ( dev-libs/xxhash )
video_cards_nvidia? ( >x11-drivers/nvidia-drivers-367.0 )"
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}/${P}-missing-not-fatal.patch" )

src_prepare() {
#remove bundled stuff
rm -r deps/OpenCL-Headers || die "Failed to remove bundled OpenCL Headers"
Expand All @@ -39,7 +44,7 @@ src_prepare() {
export PREFIX=/usr
export LIBRARY_FOLDER="/usr/$(get_libdir)"
export DOCUMENT_FOLDER="/usr/share/doc/${P}"
eapply_user
default
}

src_compile() {
Expand Down
12 changes: 8 additions & 4 deletions app-crypt/hashcat/hashcat-9999.ebuild
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=6
EAPI=7

inherit eutils pax-utils multilib

Expand All @@ -18,10 +18,14 @@ else
fi

IUSE="brain video_cards_nvidia"
DEPEND="virtual/opencl
DEPEND="
app-arch/lzma
brain? ( dev-libs/xxhash )
video_cards_nvidia? ( >x11-drivers/nvidia-drivers-367.0 )"
video_cards_nvidia? ( >x11-drivers/nvidia-drivers-440.64
|| ( dev-util/nvidia-cuda-toolkit
virtual/opencl )
)
!video_cards_nvidia? ( virtual/opencl )"
RDEPEND="${DEPEND}"

src_prepare() {
Expand All @@ -38,7 +42,7 @@ src_prepare() {
export PREFIX=/usr
export LIBRARY_FOLDER="/usr/$(get_libdir)"
export DOCUMENT_FOLDER="/usr/share/doc/${P}"
eapply_user
default
}

src_compile() {
Expand Down

0 comments on commit 609c0e2

Please sign in to comment.