From 7458e4f487d600958d72ec82585881241658e6ac Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Thu, 14 Nov 2019 11:31:00 +0100 Subject: [PATCH] Add per-device available memory test of static data (hashlist, ruleset) before test of dynamic data (-n based) --- src/backend.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/backend.c b/src/backend.c index 363dbf150..177597943 100644 --- a/src/backend.c +++ b/src/backend.c @@ -7759,6 +7759,38 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) * global buffers */ + const u64 size_total_fixed + = bitmap_ctx->bitmap_size + + bitmap_ctx->bitmap_size + + bitmap_ctx->bitmap_size + + bitmap_ctx->bitmap_size + + bitmap_ctx->bitmap_size + + bitmap_ctx->bitmap_size + + bitmap_ctx->bitmap_size + + bitmap_ctx->bitmap_size + + size_plains + + size_digests + + size_shown + + size_salts + + size_results + + size_extra_buffer + + size_st_digests + + size_st_salts + + size_st_esalts + + size_esalts + + size_markov_css + + size_root_css + + size_rules + + size_rules_c + + size_tm; + + if (size_total_fixed > device_param->device_available_mem) + { + event_log_error (hashcat_ctx, "* Device #%u: Not enough allocatable device memory for this hashlist and/or ruleset.", device_id + 1); + + return -1; + } + if (device_param->is_cuda == true) { if (hc_cuMemAlloc (hashcat_ctx, &device_param->cuda_d_bitmap_s1_a, bitmap_ctx->bitmap_size) == -1) return -1;