From 3188f1a64d8e7bbeab771360cbf01a9f326d1afd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dosko=C4=8Dil?= <30779172+Dook97@users.noreply.github.com> Date: Wed, 19 Feb 2025 12:56:59 +0100 Subject: [PATCH 1/2] mod 8300 (NSEC3): support salt length up to what the standard allows --- src/modules/module_08300.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/module_08300.c b/src/modules/module_08300.c index 74bb19823..e51d30313 100644 --- a/src/modules/module_08300.c +++ b/src/modules/module_08300.c @@ -64,7 +64,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE token.sep[2] = ':'; token.len_min[2] = 0; - token.len_max[2] = 32; + token.len_max[2] = 510; // max salt length is 255B, human readable repr is hex so 2 chars per byte token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; token.sep[3] = ':'; From 7adc25eb82b8741a0820e70754d318dda85a5dba Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Sun, 13 Jul 2025 14:28:21 +0200 Subject: [PATCH 2/2] Updated maximum domain and salt length support for pure kernel to 256 --- src/modules/module_08300.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/modules/module_08300.c b/src/modules/module_08300.c index e51d30313..1247b59d5 100644 --- a/src/modules/module_08300.c +++ b/src/modules/module_08300.c @@ -19,7 +19,8 @@ static const u32 DGST_SIZE = DGST_SIZE_4_5; static const u32 HASH_CATEGORY = HASH_CATEGORY_NETWORK_SERVER; static const char *HASH_NAME = "DNSSEC (NSEC3)"; static const u64 KERN_TYPE = 8300; -static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_REGISTER_LIMIT; static const u64 OPTS_TYPE = OPTS_TYPE_STOCK_MODULE | OPTS_TYPE_PT_GENERATE_BE | OPTS_TYPE_ST_HEX @@ -43,6 +44,18 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + u32 pw_max = 63; + + if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) + { + pw_max = 32; + } + + return pw_max; +} + int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) { u32 *digest = (u32 *) digest_buf; @@ -59,12 +72,12 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE token.sep[1] = ':'; token.len_min[1] = 0; - token.len_max[1] = 32; + token.len_max[1] = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) ? 32 : 256; token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH; token.sep[2] = ':'; token.len_min[2] = 0; - token.len_max[2] = 510; // max salt length is 255B, human readable repr is hex so 2 chars per byte + token.len_max[2] = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) ? 32 : 256; token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH; token.sep[3] = ':'; @@ -173,7 +186,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE const u32 salt_pc_len = salt->salt_len_pc; - char domain_buf_c[33] = { 0 }; + char domain_buf_c[256 + 1] = { 0 }; memcpy (domain_buf_c, (const char *) salt->salt_buf_pc, salt_pc_len); @@ -212,6 +225,8 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_benchmark_mask = MODULE_DEFAULT; module_ctx->module_benchmark_charset = MODULE_DEFAULT; module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_bridge_name = MODULE_DEFAULT; + module_ctx->module_bridge_type = MODULE_DEFAULT; module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; module_ctx->module_deprecated_notice = MODULE_DEFAULT; @@ -268,7 +283,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_potfile_disable = MODULE_DEFAULT; module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; module_ctx->module_pwdump_column = MODULE_DEFAULT; - module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; module_ctx->module_pw_min = MODULE_DEFAULT; module_ctx->module_salt_max = MODULE_DEFAULT; module_ctx->module_salt_min = MODULE_DEFAULT;