diff --git a/OpenCL/inc_types.cl b/OpenCL/inc_types.cl index 33fce0fed..b2910d403 100644 --- a/OpenCL/inc_types.cl +++ b/OpenCL/inc_types.cl @@ -783,7 +783,6 @@ typedef struct chacha20 { u32 iv[2]; u32 plain[2]; - u32 plain_length; u32 position[2]; } chacha20_t; diff --git a/OpenCL/m15400_a0.cl b/OpenCL/m15400_a0.cl index dd57c38d5..4a675e3ba 100644 --- a/OpenCL/m15400_a0.cl +++ b/OpenCL/m15400_a0.cl @@ -139,8 +139,6 @@ __kernel void m15400_m04 (__global pw_t *pws, __global const kernel_rule_t *rule position[0] = esalt_bufs->position[0]; position[1] = esalt_bufs->position[1]; - u32 plain_length = esalt_bufs->plain_length; - iv[0] = esalt_bufs->iv[0]; iv[1] = esalt_bufs->iv[1]; @@ -214,8 +212,6 @@ __kernel void m15400_s04 (__global pw_t *pws, __global const kernel_rule_t *rule position[0] = esalt_bufs->position[0]; position[1] = esalt_bufs->position[1]; - u32 plain_length = esalt_bufs->plain_length; - iv[0] = esalt_bufs->iv[0]; iv[1] = esalt_bufs->iv[1]; diff --git a/OpenCL/m15400_a1.cl b/OpenCL/m15400_a1.cl index 52fdb5a23..f3398c79d 100644 --- a/OpenCL/m15400_a1.cl +++ b/OpenCL/m15400_a1.cl @@ -139,8 +139,6 @@ __kernel void m15400_m04 (__global pw_t *pws, __global const kernel_rule_t *rule position[0] = esalt_bufs->position[0]; position[1] = esalt_bufs->position[1]; - u32 plain_length = esalt_bufs->plain_length; - iv[0] = esalt_bufs->iv[0]; iv[1] = esalt_bufs->iv[1]; @@ -274,8 +272,6 @@ __kernel void m15400_s04 (__global pw_t *pws, __global const kernel_rule_t *rule position[0] = esalt_bufs->position[0]; position[1] = esalt_bufs->position[1]; - u32 plain_length = esalt_bufs->plain_length; - iv[0] = esalt_bufs->iv[0]; iv[1] = esalt_bufs->iv[1]; diff --git a/OpenCL/m15400_a3.cl b/OpenCL/m15400_a3.cl index 9b6fdca86..4980e96ee 100644 --- a/OpenCL/m15400_a3.cl +++ b/OpenCL/m15400_a3.cl @@ -123,8 +123,6 @@ __kernel void m15400_m04 (__global pw_t *pws, __global const kernel_rule_t *rule position[0] = esalt_bufs->position[0]; position[1] = esalt_bufs->position[1]; - u32 plain_length = esalt_bufs->plain_length; - iv[0] = esalt_bufs->iv[0]; iv[1] = esalt_bufs->iv[1]; @@ -203,8 +201,6 @@ __kernel void m15400_s04 (__global pw_t *pws, __global const kernel_rule_t *rule position[0] = esalt_bufs->position[0]; position[1] = esalt_bufs->position[1]; - u32 plain_length = esalt_bufs->plain_length; - iv[0] = esalt_bufs->iv[0]; iv[1] = esalt_bufs->iv[1]; diff --git a/include/types.h b/include/types.h index 6acac0298..1bba55b60 100644 --- a/include/types.h +++ b/include/types.h @@ -696,7 +696,6 @@ typedef struct { u32 iv[2]; u32 plain[2]; - u32 plain_length; u32 position[2]; } chacha20_t; diff --git a/src/interface.c b/src/interface.c index f34c6ecae..33307cdff 100644 --- a/src/interface.c +++ b/src/interface.c @@ -5320,6 +5320,8 @@ int chacha20_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U chacha20_t *chacha20 = (chacha20_t *) hash_buf->esalt; + salt_t *salt = (salt_t *) hash_buf->salt; + u8 *position_marker = (u8 *) strchr ((const char *) input_buf, '*') + 1; if (position_marker == NULL) return (PARSER_SEPARATOR_UNMATCHED); @@ -5332,8 +5334,6 @@ int chacha20_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U u8 *cipher_marker = (u8 *) strchr ((const char *) plain_marker, '*') + 1; if (cipher_marker == NULL) return (PARSER_SEPARATOR_UNMATCHED); - chacha20->plain_length = 16; - chacha20->iv[0] = hex_to_u32 ((const u8 *) iv_marker + 8); chacha20->iv[1] = hex_to_u32 ((const u8 *) iv_marker + 0); @@ -5343,6 +5343,19 @@ int chacha20_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U chacha20->position[0] = byte_swap_32(hex_to_u32 ((const u8 *) position_marker + 8)); chacha20->position[1] = byte_swap_32(hex_to_u32 ((const u8 *) position_marker + 0)); + /* some fake salt for the sorting mechanisms */ + + salt->salt_buf[0] = chacha20->iv[0]; + salt->salt_buf[1] = chacha20->iv[1]; + salt->salt_buf[2] = chacha20->plain[0]; + salt->salt_buf[3] = chacha20->plain[1]; + salt->salt_buf[4] = chacha20->position[0]; + salt->salt_buf[5] = chacha20->position[1]; + salt->salt_buf[6] = 0; + salt->salt_buf[7] = 0; + salt->salt_len = 24; + + /* Store cipher for search mechanism */ digest[0] = hex_to_u32 ((const u8 *) cipher_marker + 8); digest[1] = hex_to_u32 ((const u8 *) cipher_marker + 0);