1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 18:08:20 +00:00

Workaround setting password length bug in ROCM and POCL for -m 10100

This commit is contained in:
jsteube 2019-04-15 11:14:02 +02:00
parent 4cdff67011
commit 8e89617015
4 changed files with 61 additions and 70 deletions

View File

@ -15,20 +15,20 @@
#include "inc_simd.cl" #include "inc_simd.cl"
#endif #endif
#define SIPROUND(v0,v1,v2,v3) \ #define SIPROUND(v0,v1,v2,v3) \
(v0) += (v1); \ (v0) += (v1); \
(v1) = hc_rotl64 ((v1), 13); \ (v1) = hc_rotl64 ((v1), 13); \
(v1) ^= (v0); \ (v1) ^= (v0); \
(v0) = hc_rotl64 ((v0), 32); \ (v0) = hc_rotl64 ((v0), 32); \
(v2) += (v3); \ (v2) += (v3); \
(v3) = hc_rotl64 ((v3), 16); \ (v3) = hc_rotl64 ((v3), 16); \
(v3) ^= (v2); \ (v3) ^= (v2); \
(v0) += (v3); \ (v0) += (v3); \
(v3) = hc_rotl64 ((v3), 21); \ (v3) = hc_rotl64 ((v3), 21); \
(v3) ^= (v0); \ (v3) ^= (v0); \
(v2) += (v1); \ (v2) += (v1); \
(v1) = hc_rotl64 ((v1), 17); \ (v1) = hc_rotl64 ((v1), 17); \
(v1) ^= (v2); \ (v1) ^= (v2); \
(v2) = hc_rotl64 ((v2), 32) (v2) = hc_rotl64 ((v2), 32)
KERNEL_FQ void m10100_m04 (KERN_ATTR_RULES ()) KERNEL_FQ void m10100_m04 (KERN_ATTR_RULES ())

View File

@ -13,20 +13,20 @@
#include "inc_simd.cl" #include "inc_simd.cl"
#endif #endif
#define SIPROUND(v0,v1,v2,v3) \ #define SIPROUND(v0,v1,v2,v3) \
(v0) += (v1); \ (v0) += (v1); \
(v1) = hc_rotl64 ((v1), 13); \ (v1) = hc_rotl64 ((v1), 13); \
(v1) ^= (v0); \ (v1) ^= (v0); \
(v0) = hc_rotl64 ((v0), 32); \ (v0) = hc_rotl64 ((v0), 32); \
(v2) += (v3); \ (v2) += (v3); \
(v3) = hc_rotl64 ((v3), 16); \ (v3) = hc_rotl64 ((v3), 16); \
(v3) ^= (v2); \ (v3) ^= (v2); \
(v0) += (v3); \ (v0) += (v3); \
(v3) = hc_rotl64 ((v3), 21); \ (v3) = hc_rotl64 ((v3), 21); \
(v3) ^= (v0); \ (v3) ^= (v0); \
(v2) += (v1); \ (v2) += (v1); \
(v1) = hc_rotl64 ((v1), 17); \ (v1) = hc_rotl64 ((v1), 17); \
(v1) ^= (v2); \ (v1) ^= (v2); \
(v2) = hc_rotl64 ((v2), 32) (v2) = hc_rotl64 ((v2), 32)
KERNEL_FQ void m10100_m04 (KERN_ATTR_BASIC ()) KERNEL_FQ void m10100_m04 (KERN_ATTR_BASIC ())

View File

@ -12,20 +12,20 @@
#include "inc_simd.cl" #include "inc_simd.cl"
#endif #endif
#define SIPROUND(v0,v1,v2,v3) \ #define SIPROUND(v0,v1,v2,v3) \
(v0) += (v1); \ (v0) += (v1); \
(v1) = hc_rotl64 ((v1), 13); \ (v1) = hc_rotl64 ((v1), 13); \
(v1) ^= (v0); \ (v1) ^= (v0); \
(v0) = hc_rotl64 ((v0), 32); \ (v0) = hc_rotl64 ((v0), 32); \
(v2) += (v3); \ (v2) += (v3); \
(v3) = hc_rotl64 ((v3), 16); \ (v3) = hc_rotl64 ((v3), 16); \
(v3) ^= (v2); \ (v3) ^= (v2); \
(v0) += (v3); \ (v0) += (v3); \
(v3) = hc_rotl64 ((v3), 21); \ (v3) = hc_rotl64 ((v3), 21); \
(v3) ^= (v0); \ (v3) ^= (v0); \
(v2) += (v1); \ (v2) += (v1); \
(v1) = hc_rotl64 ((v1), 17); \ (v1) = hc_rotl64 ((v1), 17); \
(v1) ^= (v2); \ (v1) ^= (v2); \
(v2) = hc_rotl64 ((v2), 32) (v2) = hc_rotl64 ((v2), 32)
DECLSPEC void m10100m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ()) DECLSPEC void m10100m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
@ -51,9 +51,13 @@ DECLSPEC void m10100m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
v2p ^= hl32_to_64_S (salt_bufs[salt_pos].salt_buf[1], salt_bufs[salt_pos].salt_buf[0]); v2p ^= hl32_to_64_S (salt_bufs[salt_pos].salt_buf[1], salt_bufs[salt_pos].salt_buf[0]);
v3p ^= hl32_to_64_S (salt_bufs[salt_pos].salt_buf[3], salt_bufs[salt_pos].salt_buf[2]); v3p ^= hl32_to_64_S (salt_bufs[salt_pos].salt_buf[3], salt_bufs[salt_pos].salt_buf[2]);
u64 *w_ptr = (u64 *) w; switch (pw_len / 8)
{
w_ptr[pw_len / 8] |= (u64) pw_len << 56; case 0: w[1] |= pw_len << 24; break;
case 1: w[3] |= pw_len << 24; break;
case 2: w[5] |= pw_len << 24; break;
case 3: w[7] |= pw_len << 24; break;
}
/** /**
* loop * loop
@ -141,9 +145,13 @@ DECLSPEC void m10100s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
v2p ^= hl32_to_64_S (salt_bufs[salt_pos].salt_buf[1], salt_bufs[salt_pos].salt_buf[0]); v2p ^= hl32_to_64_S (salt_bufs[salt_pos].salt_buf[1], salt_bufs[salt_pos].salt_buf[0]);
v3p ^= hl32_to_64_S (salt_bufs[salt_pos].salt_buf[3], salt_bufs[salt_pos].salt_buf[2]); v3p ^= hl32_to_64_S (salt_bufs[salt_pos].salt_buf[3], salt_bufs[salt_pos].salt_buf[2]);
u64 *w_ptr = (u64 *) w; switch (pw_len / 8)
{
w_ptr[pw_len / 8] |= (u64) pw_len << 56; case 0: w[1] |= pw_len << 24; break;
case 1: w[3] |= pw_len << 24; break;
case 2: w[5] |= pw_len << 24; break;
case 3: w[7] |= pw_len << 24; break;
}
/** /**
* digest * digest
@ -246,7 +254,7 @@ KERNEL_FQ void m10100_m04 (KERN_ATTR_VECTOR ())
w[11] = 0; w[11] = 0;
w[12] = 0; w[12] = 0;
w[13] = 0; w[13] = 0;
w[14] = pws[gid].i[14]; w[14] = 0;
w[15] = 0; w[15] = 0;
const u32 pw_len = pws[gid].pw_len & 63; const u32 pw_len = pws[gid].pw_len & 63;
@ -284,7 +292,7 @@ KERNEL_FQ void m10100_m08 (KERN_ATTR_VECTOR ())
w[11] = 0; w[11] = 0;
w[12] = 0; w[12] = 0;
w[13] = 0; w[13] = 0;
w[14] = pws[gid].i[14]; w[14] = 0;
w[15] = 0; w[15] = 0;
const u32 pw_len = pws[gid].pw_len & 63; const u32 pw_len = pws[gid].pw_len & 63;
@ -360,7 +368,7 @@ KERNEL_FQ void m10100_s04 (KERN_ATTR_VECTOR ())
w[11] = 0; w[11] = 0;
w[12] = 0; w[12] = 0;
w[13] = 0; w[13] = 0;
w[14] = pws[gid].i[14]; w[14] = 0;
w[15] = 0; w[15] = 0;
const u32 pw_len = pws[gid].pw_len & 63; const u32 pw_len = pws[gid].pw_len & 63;
@ -398,7 +406,7 @@ KERNEL_FQ void m10100_s08 (KERN_ATTR_VECTOR ())
w[11] = 0; w[11] = 0;
w[12] = 0; w[12] = 0;
w[13] = 0; w[13] = 0;
w[14] = pws[gid].i[14]; w[14] = 0;
w[15] = 0; w[15] = 0;
const u32 pw_len = pws[gid].pw_len & 63; const u32 pw_len = pws[gid].pw_len & 63;

View File

@ -42,23 +42,6 @@ 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_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; } 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; }
bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hc_device_param_t *device_param)
{
// OpenCL 1.2 pocl HSTR: pthread-x86_64-pc-linux-gnu-skylake: self-test failed
if (device_param->platform_vendor_id == VENDOR_ID_POCL)
{
return true;
}
// rocm 1.2.0-20190: self-test failed
if ((device_param->device_vendor_id == VENDOR_ID_AMD) && (device_param->has_vperm == true))
{
return true;
}
return false;
}
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) 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; u32 *digest = (u32 *) digest_buf;
@ -210,6 +193,6 @@ void module_init (module_ctx_t *module_ctx)
module_ctx->module_st_hash = module_st_hash; module_ctx->module_st_hash = module_st_hash;
module_ctx->module_st_pass = module_st_pass; module_ctx->module_st_pass = module_st_pass;
module_ctx->module_tmp_size = MODULE_DEFAULT; module_ctx->module_tmp_size = MODULE_DEFAULT;
module_ctx->module_unstable_warning = module_unstable_warning; module_ctx->module_unstable_warning = MODULE_DEFAULT;
module_ctx->module_warmup_disable = MODULE_DEFAULT; module_ctx->module_warmup_disable = MODULE_DEFAULT;
} }