From 57bef8abc998030d285d3d56ab239aaa2ebc2b41 Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Sun, 6 Sep 2020 13:29:32 +0200 Subject: [PATCH] Display possible NVIDIA CUDA/RTC library loading error message only in case a NVIDIA device was found using OpenCL --- include/types.h | 3 +++ src/backend.c | 30 +++++++++++++++++++++++++----- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/include/types.h b/include/types.h index 8c2e982fc..a727bd558 100644 --- a/include/types.h +++ b/include/types.h @@ -1557,6 +1557,9 @@ typedef struct backend_ctx // cuda + int rc_cuda_init; + int rc_nvrtc_init; + int nvrtc_driver_version; int cuda_driver_version; diff --git a/src/backend.c b/src/backend.c index 9171a5497..5c6b442f4 100644 --- a/src/backend.c +++ b/src/backend.c @@ -4935,8 +4935,7 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx) if (rc_cuda_init == -1) { - event_log_warning (hashcat_ctx, "Failed to initialize NVIDIA CUDA library."); - event_log_warning (hashcat_ctx, NULL); + backend_ctx->rc_cuda_init = rc_cuda_init; cuda_close (hashcat_ctx); } @@ -4953,8 +4952,7 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx) if (rc_nvrtc_init == -1) { - event_log_warning (hashcat_ctx, "Failed to initialize NVIDIA RTC library."); - event_log_warning (hashcat_ctx, NULL); + backend_ctx->rc_nvrtc_init = rc_nvrtc_init; nvrtc_close (hashcat_ctx); } @@ -6269,7 +6267,29 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) { if (user_options->backend_ignore_cuda == false) { - event_log_warning (hashcat_ctx, "* Device #%u: CUDA SDK Toolkit installation NOT detected.", device_id + 1); + if (backend_ctx->rc_cuda_init == -1) + { + event_log_warning (hashcat_ctx, "Failed to initialize NVIDIA CUDA library."); + event_log_warning (hashcat_ctx, NULL); + } + else + { + event_log_warning (hashcat_ctx, "Successfully initialized NVIDIA CUDA library."); + event_log_warning (hashcat_ctx, NULL); + } + + if (backend_ctx->rc_nvrtc_init == -1) + { + event_log_warning (hashcat_ctx, "Failed to initialize NVIDIA RTC library."); + event_log_warning (hashcat_ctx, NULL); + } + else + { + event_log_warning (hashcat_ctx, "Successfully initialized NVIDIA RTC library."); + event_log_warning (hashcat_ctx, NULL); + } + + event_log_warning (hashcat_ctx, "* Device #%u: CUDA SDK Toolkit installation NOT detected or incorrectly installed.", device_id + 1); event_log_warning (hashcat_ctx, " CUDA SDK Toolkit installation required for proper device support and utilization"); event_log_warning (hashcat_ctx, " Falling back to OpenCL Runtime");