From f4569739287cd21ddecf4d7643551417f19d93cd Mon Sep 17 00:00:00 2001
From: pelle
Date: Thu, 27 Oct 2022 12:09:37 +0200
Subject: [PATCH] Added error message describing workaround when detecting more
than 64 backend devices.
---
docs/changes.txt | 1 +
src/backend.c | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/docs/changes.txt b/docs/changes.txt
index 611a5e82b..37fc0c555 100644
--- a/docs/changes.txt
+++ b/docs/changes.txt
@@ -16,6 +16,7 @@
- Modules: Added support for non-zero IVs for -m 6800 (Lastpass). Also added `tools/lastpass2hashcat.py`
- Status Code: Add specific return code for self-test fail (-11)
+- Described workaround in error message when detecting more than 64 backend devices
* changes v6.2.5 -> v6.2.6
diff --git a/src/backend.c b/src/backend.c
index f5b75c571..46a0bcdf1 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -7330,6 +7330,13 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
{
const u64 backend_devices_cnt_mask = ~(((u64) -1 >> backend_ctx->backend_devices_cnt) << backend_ctx->backend_devices_cnt);
+ if (backend_ctx->backend_devices_cnt >= 64)
+ {
+ event_log_error (hashcat_ctx, "Illegal use of the --backend-devices parameter because too many backend devices were found (%u).", backend_ctx->backend_devices_cnt);
+ event_log_error (hashcat_ctx, "If possible, disable one of your backends to reduce the number of backend devices. For example \"--backend-ignore-cuda\" or \"--backend-ignore-opencl\" .");
+
+ return -1;
+ }
if (backend_ctx->backend_devices_filter > backend_devices_cnt_mask)
{
event_log_error (hashcat_ctx, "An invalid device was specified using the --backend-devices parameter.");