From 609c0e26160f0f7672721e632e1f6f21d1b8fea2 Mon Sep 17 00:00:00 2001 From: Rick Farina Date: Wed, 17 Jun 2020 13:02:12 -0400 Subject: app-crypt/hashcat: pull upstream fix https://github.com/hashcat/hashcat/issues/2455 Package-Manager: Portage-2.3.101, Repoman-2.3.22 Signed-off-by: Rick Farina --- .../files/hashcat-6.0.0-missing-not-fatal.patch | 53 ++++++++++++++++ app-crypt/hashcat/hashcat-6.0.0-r1.ebuild | 74 ++++++++++++++++++++++ app-crypt/hashcat/hashcat-6.0.0.ebuild | 69 -------------------- app-crypt/hashcat/hashcat-9999.ebuild | 12 ++-- 4 files changed, 135 insertions(+), 73 deletions(-) create mode 100644 app-crypt/hashcat/files/hashcat-6.0.0-missing-not-fatal.patch create mode 100644 app-crypt/hashcat/hashcat-6.0.0-r1.ebuild delete mode 100644 app-crypt/hashcat/hashcat-6.0.0.ebuild (limited to 'app-crypt') diff --git a/app-crypt/hashcat/files/hashcat-6.0.0-missing-not-fatal.patch b/app-crypt/hashcat/files/hashcat-6.0.0-missing-not-fatal.patch new file mode 100644 index 000000000000..52120e0e05c4 --- /dev/null +++ b/app-crypt/hashcat/files/hashcat-6.0.0-missing-not-fatal.patch @@ -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; diff --git a/app-crypt/hashcat/hashcat-6.0.0-r1.ebuild b/app-crypt/hashcat/hashcat-6.0.0-r1.ebuild new file mode 100644 index 000000000000..eab3098c5c18 --- /dev/null +++ b/app-crypt/hashcat/hashcat-6.0.0-r1.ebuild @@ -0,0 +1,74 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit eutils pax-utils multilib + +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 + 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}/${P}-missing-not-fatal.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" + #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 + export PREFIX=/usr + export LIBRARY_FOLDER="/usr/$(get_libdir)" + export DOCUMENT_FOLDER="/usr/share/doc/${P}" + default +} + +src_compile() { + emake SHARED=1 PRODUCTION=1 ENABLE_BRAIN=$(usex brain 1 0) USE_SYSTEM_LZMA=0 USE_SYSTEM_OPENCL=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_XXHASH=1 VERSION_PURE="${PV}" install +} diff --git a/app-crypt/hashcat/hashcat-6.0.0.ebuild b/app-crypt/hashcat/hashcat-6.0.0.ebuild deleted file mode 100644 index 4c3c141fcb4d..000000000000 --- a/app-crypt/hashcat/hashcat-6.0.0.ebuild +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright 1999-2020 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -inherit eutils pax-utils multilib - -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 - #this doesn't work for me, so it doesn't get keywords - #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 - app-arch/lzma - brain? ( dev-libs/xxhash ) - video_cards_nvidia? ( >x11-drivers/nvidia-drivers-367.0 )" -RDEPEND="${DEPEND}" - -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" - #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 - export PREFIX=/usr - export LIBRARY_FOLDER="/usr/$(get_libdir)" - export DOCUMENT_FOLDER="/usr/share/doc/${P}" - eapply_user -} - -src_compile() { - emake SHARED=1 PRODUCTION=1 ENABLE_BRAIN=$(usex brain 1 0) USE_SYSTEM_LZMA=0 USE_SYSTEM_OPENCL=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_XXHASH=1 VERSION_PURE="${PV}" install -} diff --git a/app-crypt/hashcat/hashcat-9999.ebuild b/app-crypt/hashcat/hashcat-9999.ebuild index bc8b3fb95c51..32005fae3ae5 100644 --- a/app-crypt/hashcat/hashcat-9999.ebuild +++ b/app-crypt/hashcat/hashcat-9999.ebuild @@ -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 @@ -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() { @@ -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() { -- cgit v1.2.3-65-gdbad