From 48917b58436ac4eb608c45a8e6b0794ffba82a97 Mon Sep 17 00:00:00 2001 From: jsteube Date: Wed, 28 Sep 2016 11:11:14 +0200 Subject: [PATCH] Move tmp size and hook size to hashconfig_init() --- include/interface.h | 18 ++++----- include/opencl.h | 2 +- include/types.h | 7 +++- src/interface.c | 92 ++++++++++++++++++++++++++++++++++++++++++ src/opencl.c | 97 +++------------------------------------------ 5 files changed, 112 insertions(+), 104 deletions(-) diff --git a/include/interface.h b/include/interface.h index 27bf7d3c3..8450f2e34 100644 --- a/include/interface.h +++ b/include/interface.h @@ -1537,14 +1537,14 @@ void to_hccap_t (hccap_t *hccap, const uint salt_pos, const uint digest_pos, con void ascii_digest (char *out_buf, const uint salt_pos, const uint digest_pos, const hashconfig_t *hashconfig, const hashes_t *hashes); -int hashconfig_init (hashconfig_t *hashconfig, const user_options_t *user_options); -void hashconfig_destroy (hashconfig_t *hashconfig); -u32 hashconfig_enforce_kernel_threads (const hashconfig_t *hashconfig, const hc_device_param_t *device_param); -u32 hashconfig_enforce_kernel_loops (const hashconfig_t *hashconfig, const user_options_t *user_options); -uint hashconfig_general_pw_min (hashconfig_t *hashconfig); -uint hashconfig_general_pw_max (hashconfig_t *hashconfig); -void hashconfig_general_defaults (hashconfig_t *hashconfig, hashes_t *hashes, const user_options_t *user_options); -void hashconfig_benchmark_defaults (const hashconfig_t *hashconfig, salt_t *salt, void *esalt); -char *hashconfig_benchmark_mask (const hashconfig_t *hashconfig); +int hashconfig_init (hashconfig_t *hashconfig, const user_options_t *user_options); +void hashconfig_destroy (hashconfig_t *hashconfig); +u32 hashconfig_enforce_kernel_threads (const hashconfig_t *hashconfig, const hc_device_param_t *device_param); +u32 hashconfig_enforce_kernel_loops (const hashconfig_t *hashconfig, const user_options_t *user_options); +uint hashconfig_general_pw_min (hashconfig_t *hashconfig); +uint hashconfig_general_pw_max (hashconfig_t *hashconfig); +void hashconfig_general_defaults (hashconfig_t *hashconfig, hashes_t *hashes, const user_options_t *user_options); +void hashconfig_benchmark_defaults (const hashconfig_t *hashconfig, salt_t *salt, void *esalt); +char *hashconfig_benchmark_mask (const hashconfig_t *hashconfig); #endif // _INTERFACE_H diff --git a/include/opencl.h b/include/opencl.h index 5ac167524..1729b6d96 100644 --- a/include/opencl.h +++ b/include/opencl.h @@ -42,7 +42,7 @@ void opencl_ctx_destroy (opencl_ctx_t *opencl_ctx); int opencl_ctx_devices_init (opencl_ctx_t *opencl_ctx, const user_options_t *user_options); void opencl_ctx_devices_destroy (opencl_ctx_t *opencl_ctx); -int opencl_session_begin (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const straight_ctx_t *straight_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const folder_config_t *folder_config, const bitmap_ctx_t *bitmap_ctx, const tuning_db_t *tuning_db); +int opencl_session_begin (opencl_ctx_t *opencl_ctx, hashconfig_t *hashconfig, const hashes_t *hashes, const straight_ctx_t *straight_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const folder_config_t *folder_config, const bitmap_ctx_t *bitmap_ctx, const tuning_db_t *tuning_db); void opencl_session_destroy (opencl_ctx_t *opencl_ctx); void opencl_session_reset (opencl_ctx_t *opencl_ctx); int opencl_session_update_combinator (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const combinator_ctx_t *combinator_ctx); diff --git a/include/types.h b/include/types.h index 12499cfc2..2605455cb 100644 --- a/include/types.h +++ b/include/types.h @@ -424,14 +424,17 @@ struct _hashconfig u32 opts_type; u32 kern_type; u32 dgst_size; - u32 esalt_size; u32 opti_type; - u32 is_salted; u32 dgst_pos0; u32 dgst_pos1; u32 dgst_pos2; u32 dgst_pos3; + u32 is_salted; + u32 esalt_size; + u32 tmp_size; + u32 hook_size; + int (*parse_func) (char *, u32, hash_t *, const struct _hashconfig *); }; diff --git a/src/interface.c b/src/interface.c index 3c71e1de0..151d5bd10 100644 --- a/src/interface.c +++ b/src/interface.c @@ -16168,6 +16168,8 @@ int hashconfig_init (hashconfig_t *hashconfig, const user_options_t *user_option hashconfig->kern_type = 0; hashconfig->dgst_size = 0; hashconfig->esalt_size = 0; + hashconfig->tmp_size = 0; + hashconfig->hook_size = 0; hashconfig->opti_type = 0; hashconfig->is_salted = 0; hashconfig->dgst_pos0 = 0; @@ -19911,6 +19913,96 @@ int hashconfig_init (hashconfig_t *hashconfig, const user_options_t *user_option case 13800: hashconfig->esalt_size = sizeof (win8phone_t); break; } + switch (hashconfig->hash_mode) + { + case 400: hashconfig->tmp_size = sizeof (phpass_tmp_t); break; + case 500: hashconfig->tmp_size = sizeof (md5crypt_tmp_t); break; + case 501: hashconfig->tmp_size = sizeof (md5crypt_tmp_t); break; + case 1600: hashconfig->tmp_size = sizeof (md5crypt_tmp_t); break; + case 1800: hashconfig->tmp_size = sizeof (sha512crypt_tmp_t); break; + case 2100: hashconfig->tmp_size = sizeof (dcc2_tmp_t); break; + case 2500: hashconfig->tmp_size = sizeof (wpa_tmp_t); break; + case 3200: hashconfig->tmp_size = sizeof (bcrypt_tmp_t); break; + case 5200: hashconfig->tmp_size = sizeof (pwsafe3_tmp_t); break; + case 5800: hashconfig->tmp_size = sizeof (androidpin_tmp_t); break; + case 6211: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 6212: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 6213: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 6221: hashconfig->tmp_size = sizeof (tc64_tmp_t); break; + case 6222: hashconfig->tmp_size = sizeof (tc64_tmp_t); break; + case 6223: hashconfig->tmp_size = sizeof (tc64_tmp_t); break; + case 6231: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 6232: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 6233: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 6241: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 6242: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 6243: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 6300: hashconfig->tmp_size = sizeof (md5crypt_tmp_t); break; + case 6400: hashconfig->tmp_size = sizeof (sha256aix_tmp_t); break; + case 6500: hashconfig->tmp_size = sizeof (sha512aix_tmp_t); break; + case 6600: hashconfig->tmp_size = sizeof (agilekey_tmp_t); break; + case 6700: hashconfig->tmp_size = sizeof (sha1aix_tmp_t); break; + case 6800: hashconfig->tmp_size = sizeof (lastpass_tmp_t); break; + case 7100: hashconfig->tmp_size = sizeof (pbkdf2_sha512_tmp_t); break; + case 7200: hashconfig->tmp_size = sizeof (pbkdf2_sha512_tmp_t); break; + case 7400: hashconfig->tmp_size = sizeof (sha256crypt_tmp_t); break; + case 7900: hashconfig->tmp_size = sizeof (drupal7_tmp_t); break; + case 8200: hashconfig->tmp_size = sizeof (pbkdf2_sha512_tmp_t); break; + case 8800: hashconfig->tmp_size = sizeof (androidfde_tmp_t); break; + case 9000: hashconfig->tmp_size = sizeof (pwsafe2_tmp_t); break; + case 9100: hashconfig->tmp_size = sizeof (lotus8_tmp_t); break; + case 9200: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break; + case 9400: hashconfig->tmp_size = sizeof (office2007_tmp_t); break; + case 9500: hashconfig->tmp_size = sizeof (office2010_tmp_t); break; + case 9600: hashconfig->tmp_size = sizeof (office2013_tmp_t); break; + case 10000: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break; + case 10200: hashconfig->tmp_size = sizeof (cram_md5_t); break; + case 10300: hashconfig->tmp_size = sizeof (saph_sha1_tmp_t); break; + case 10500: hashconfig->tmp_size = sizeof (pdf14_tmp_t); break; + case 10700: hashconfig->tmp_size = sizeof (pdf17l8_tmp_t); break; + case 10900: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break; + case 11300: hashconfig->tmp_size = sizeof (bitcoin_wallet_tmp_t); break; + case 11600: hashconfig->tmp_size = sizeof (seven_zip_tmp_t); break; + case 11900: hashconfig->tmp_size = sizeof (pbkdf2_md5_tmp_t); break; + case 12000: hashconfig->tmp_size = sizeof (pbkdf2_sha1_tmp_t); break; + case 12100: hashconfig->tmp_size = sizeof (pbkdf2_sha512_tmp_t); break; + case 12200: hashconfig->tmp_size = sizeof (ecryptfs_tmp_t); break; + case 12300: hashconfig->tmp_size = sizeof (oraclet_tmp_t); break; + case 12400: hashconfig->tmp_size = sizeof (bsdicrypt_tmp_t); break; + case 12500: hashconfig->tmp_size = sizeof (rar3_tmp_t); break; + case 12700: hashconfig->tmp_size = sizeof (mywallet_tmp_t); break; + case 12800: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break; + case 12900: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break; + case 13000: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break; + case 13200: hashconfig->tmp_size = sizeof (axcrypt_tmp_t); break; + case 13400: hashconfig->tmp_size = sizeof (keepass_tmp_t); break; + case 13600: hashconfig->tmp_size = sizeof (pbkdf2_sha1_tmp_t); break; + case 13711: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 13712: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 13713: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 13721: hashconfig->tmp_size = sizeof (tc64_tmp_t); break; + case 13722: hashconfig->tmp_size = sizeof (tc64_tmp_t); break; + case 13723: hashconfig->tmp_size = sizeof (tc64_tmp_t); break; + case 13731: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 13732: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 13733: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 13741: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 13742: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 13743: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 13751: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 13752: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 13753: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 13761: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 13762: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + case 13763: hashconfig->tmp_size = sizeof (tc_tmp_t); break; + default : hashconfig->tmp_size = 4; break; + }; + + switch (hashconfig->hash_mode) + { + default : hashconfig->hook_size = 4; break; + }; + return 0; } diff --git a/src/opencl.c b/src/opencl.c index 6ba905720..866d23b72 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -2457,7 +2457,7 @@ void opencl_ctx_devices_destroy (opencl_ctx_t *opencl_ctx) opencl_ctx->need_xnvctrl = 0; } -int opencl_session_begin (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const straight_ctx_t *straight_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const folder_config_t *folder_config, const bitmap_ctx_t *bitmap_ctx, const tuning_db_t *tuning_db) +int opencl_session_begin (opencl_ctx_t *opencl_ctx, hashconfig_t *hashconfig, const hashes_t *hashes, const straight_ctx_t *straight_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const folder_config_t *folder_config, const bitmap_ctx_t *bitmap_ctx, const tuning_db_t *tuning_db) { /** * Some algorithm, like descrypt, can benefit from JIT compilation @@ -2708,6 +2708,8 @@ int opencl_session_begin (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconf scrypt_tmp_size = (128 * scrypt_r * scrypt_p); + hashconfig->tmp_size = scrypt_tmp_size; break; + uint tmto_start = 0; uint tmto_stop = 10; @@ -2822,100 +2824,11 @@ int opencl_session_begin (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconf // size_tmps - switch (hashconfig->hash_mode) - { - case 400: size_tmps = kernel_power_max * sizeof (phpass_tmp_t); break; - case 500: size_tmps = kernel_power_max * sizeof (md5crypt_tmp_t); break; - case 501: size_tmps = kernel_power_max * sizeof (md5crypt_tmp_t); break; - case 1600: size_tmps = kernel_power_max * sizeof (md5crypt_tmp_t); break; - case 1800: size_tmps = kernel_power_max * sizeof (sha512crypt_tmp_t); break; - case 2100: size_tmps = kernel_power_max * sizeof (dcc2_tmp_t); break; - case 2500: size_tmps = kernel_power_max * sizeof (wpa_tmp_t); break; - case 3200: size_tmps = kernel_power_max * sizeof (bcrypt_tmp_t); break; - case 5200: size_tmps = kernel_power_max * sizeof (pwsafe3_tmp_t); break; - case 5800: size_tmps = kernel_power_max * sizeof (androidpin_tmp_t); break; - case 6211: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 6212: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 6213: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 6221: size_tmps = kernel_power_max * sizeof (tc64_tmp_t); break; - case 6222: size_tmps = kernel_power_max * sizeof (tc64_tmp_t); break; - case 6223: size_tmps = kernel_power_max * sizeof (tc64_tmp_t); break; - case 6231: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 6232: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 6233: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 6241: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 6242: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 6243: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 6300: size_tmps = kernel_power_max * sizeof (md5crypt_tmp_t); break; - case 6400: size_tmps = kernel_power_max * sizeof (sha256aix_tmp_t); break; - case 6500: size_tmps = kernel_power_max * sizeof (sha512aix_tmp_t); break; - case 6600: size_tmps = kernel_power_max * sizeof (agilekey_tmp_t); break; - case 6700: size_tmps = kernel_power_max * sizeof (sha1aix_tmp_t); break; - case 6800: size_tmps = kernel_power_max * sizeof (lastpass_tmp_t); break; - case 7100: size_tmps = kernel_power_max * sizeof (pbkdf2_sha512_tmp_t); break; - case 7200: size_tmps = kernel_power_max * sizeof (pbkdf2_sha512_tmp_t); break; - case 7400: size_tmps = kernel_power_max * sizeof (sha256crypt_tmp_t); break; - case 7900: size_tmps = kernel_power_max * sizeof (drupal7_tmp_t); break; - case 8200: size_tmps = kernel_power_max * sizeof (pbkdf2_sha512_tmp_t); break; - case 8800: size_tmps = kernel_power_max * sizeof (androidfde_tmp_t); break; - case 8900: size_tmps = kernel_power_max * scrypt_tmp_size; break; - case 9000: size_tmps = kernel_power_max * sizeof (pwsafe2_tmp_t); break; - case 9100: size_tmps = kernel_power_max * sizeof (lotus8_tmp_t); break; - case 9200: size_tmps = kernel_power_max * sizeof (pbkdf2_sha256_tmp_t); break; - case 9300: size_tmps = kernel_power_max * scrypt_tmp_size; break; - case 9400: size_tmps = kernel_power_max * sizeof (office2007_tmp_t); break; - case 9500: size_tmps = kernel_power_max * sizeof (office2010_tmp_t); break; - case 9600: size_tmps = kernel_power_max * sizeof (office2013_tmp_t); break; - case 10000: size_tmps = kernel_power_max * sizeof (pbkdf2_sha256_tmp_t); break; - case 10200: size_tmps = kernel_power_max * sizeof (cram_md5_t); break; - case 10300: size_tmps = kernel_power_max * sizeof (saph_sha1_tmp_t); break; - case 10500: size_tmps = kernel_power_max * sizeof (pdf14_tmp_t); break; - case 10700: size_tmps = kernel_power_max * sizeof (pdf17l8_tmp_t); break; - case 10900: size_tmps = kernel_power_max * sizeof (pbkdf2_sha256_tmp_t); break; - case 11300: size_tmps = kernel_power_max * sizeof (bitcoin_wallet_tmp_t); break; - case 11600: size_tmps = kernel_power_max * sizeof (seven_zip_tmp_t); break; - case 11900: size_tmps = kernel_power_max * sizeof (pbkdf2_md5_tmp_t); break; - case 12000: size_tmps = kernel_power_max * sizeof (pbkdf2_sha1_tmp_t); break; - case 12100: size_tmps = kernel_power_max * sizeof (pbkdf2_sha512_tmp_t); break; - case 12200: size_tmps = kernel_power_max * sizeof (ecryptfs_tmp_t); break; - case 12300: size_tmps = kernel_power_max * sizeof (oraclet_tmp_t); break; - case 12400: size_tmps = kernel_power_max * sizeof (bsdicrypt_tmp_t); break; - case 12500: size_tmps = kernel_power_max * sizeof (rar3_tmp_t); break; - case 12700: size_tmps = kernel_power_max * sizeof (mywallet_tmp_t); break; - case 12800: size_tmps = kernel_power_max * sizeof (pbkdf2_sha256_tmp_t); break; - case 12900: size_tmps = kernel_power_max * sizeof (pbkdf2_sha256_tmp_t); break; - case 13000: size_tmps = kernel_power_max * sizeof (pbkdf2_sha256_tmp_t); break; - case 13200: size_tmps = kernel_power_max * sizeof (axcrypt_tmp_t); break; - case 13400: size_tmps = kernel_power_max * sizeof (keepass_tmp_t); break; - case 13600: size_tmps = kernel_power_max * sizeof (pbkdf2_sha1_tmp_t); break; - case 13711: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 13712: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 13713: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 13721: size_tmps = kernel_power_max * sizeof (tc64_tmp_t); break; - case 13722: size_tmps = kernel_power_max * sizeof (tc64_tmp_t); break; - case 13723: size_tmps = kernel_power_max * sizeof (tc64_tmp_t); break; - case 13731: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 13732: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 13733: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 13741: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 13742: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 13743: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 13751: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 13752: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 13753: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 13761: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 13762: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - case 13763: size_tmps = kernel_power_max * sizeof (tc_tmp_t); break; - }; + size_tmps = kernel_power_max * hashconfig->tmp_size; // size_hooks - if ((hashconfig->opts_type & OPTS_TYPE_HOOK12) || (hashconfig->opts_type & OPTS_TYPE_HOOK23)) - { - switch (hashconfig->hash_mode) - { - } - } + size_hooks = kernel_power_max * hashconfig->hook_size; // now check if all device-memory sizes which depend on the kernel_accel_max amplifier are within its boundaries // if not, decrease amplifier and try again