mirror of
https://github.com/hashcat/hashcat.git
synced 2025-02-02 10:51:16 +00:00
Fixed error in separator check
This commit is contained in:
parent
ab2610d9df
commit
990a72affe
@ -5479,6 +5479,8 @@ int blake2b_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN
|
|||||||
|
|
||||||
int chacha20_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig)
|
int chacha20_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig)
|
||||||
{
|
{
|
||||||
|
#define INVALID_SEPARATOR_POINTER (void *)1
|
||||||
|
|
||||||
if ((input_len < DISPLAY_LEN_MIN_15400) || (input_len > DISPLAY_LEN_MAX_15400)) return (PARSER_GLOBAL_LENGTH);
|
if ((input_len < DISPLAY_LEN_MIN_15400) || (input_len > DISPLAY_LEN_MAX_15400)) return (PARSER_GLOBAL_LENGTH);
|
||||||
|
|
||||||
if (memcmp (SIGNATURE_CHACHA20, input_buf, 10)) return (PARSER_SIGNATURE_UNMATCHED);
|
if (memcmp (SIGNATURE_CHACHA20, input_buf, 10)) return (PARSER_SIGNATURE_UNMATCHED);
|
||||||
@ -5490,25 +5492,25 @@ int chacha20_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U
|
|||||||
salt_t *salt = (salt_t *) hash_buf->salt;
|
salt_t *salt = (salt_t *) hash_buf->salt;
|
||||||
|
|
||||||
u8 *position_marker = (u8 *) strchr ((const char *) input_buf, '*') + 1;
|
u8 *position_marker = (u8 *) strchr ((const char *) input_buf, '*') + 1;
|
||||||
if (position_marker == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
if (position_marker == INVALID_SEPARATOR_POINTER) return (PARSER_SEPARATOR_UNMATCHED);
|
||||||
if (is_valid_hex_string (position_marker, 16) == false) return (PARSER_SALT_ENCODING);
|
if (is_valid_hex_string (position_marker, 16) == false) return (PARSER_SALT_ENCODING);
|
||||||
|
|
||||||
u8 *offset_marker = (u8 *) strchr ((const char *) position_marker, '*') + 1;
|
u8 *offset_marker = (u8 *) strchr ((const char *) position_marker, '*') + 1;
|
||||||
if (offset_marker == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
if (offset_marker == INVALID_SEPARATOR_POINTER) return (PARSER_SEPARATOR_UNMATCHED);
|
||||||
|
|
||||||
int offset = atoi ((char*) offset_marker);
|
int offset = atoi ((char*) offset_marker);
|
||||||
if (offset > 63) return (PARSER_SALT_VALUE);
|
if (offset > 63) return (PARSER_SALT_VALUE);
|
||||||
|
|
||||||
u8 *iv_marker = (u8 *) strchr ((const char *) offset_marker, '*') + 1;
|
u8 *iv_marker = (u8 *) strchr ((const char *) offset_marker, '*') + 1;
|
||||||
if (iv_marker == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
if (iv_marker == INVALID_SEPARATOR_POINTER) return (PARSER_SEPARATOR_UNMATCHED);
|
||||||
if (is_valid_hex_string (iv_marker, 16) == false) return (PARSER_SALT_ENCODING);
|
if (is_valid_hex_string (iv_marker, 16) == false) return (PARSER_SALT_ENCODING);
|
||||||
|
|
||||||
u8 *plain_marker = (u8 *) strchr ((const char *) iv_marker, '*') + 1;
|
u8 *plain_marker = (u8 *) strchr ((const char *) iv_marker, '*') + 1;
|
||||||
if (plain_marker == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
if (plain_marker == INVALID_SEPARATOR_POINTER) return (PARSER_SEPARATOR_UNMATCHED);
|
||||||
if (is_valid_hex_string (plain_marker, 16) == false) return (PARSER_SALT_ENCODING);
|
if (is_valid_hex_string (plain_marker, 16) == false) return (PARSER_SALT_ENCODING);
|
||||||
|
|
||||||
u8 *cipher_marker = (u8 *) strchr ((const char *) plain_marker, '*') + 1;
|
u8 *cipher_marker = (u8 *) strchr ((const char *) plain_marker, '*') + 1;
|
||||||
if (cipher_marker == NULL) return (PARSER_SEPARATOR_UNMATCHED);
|
if (cipher_marker == INVALID_SEPARATOR_POINTER) return (PARSER_SEPARATOR_UNMATCHED);
|
||||||
if (is_valid_hex_string (cipher_marker, 16) == false) return (PARSER_SALT_ENCODING);
|
if (is_valid_hex_string (cipher_marker, 16) == false) return (PARSER_SALT_ENCODING);
|
||||||
|
|
||||||
chacha20->iv[0] = hex_to_u32 ((const u8 *) iv_marker + 8);
|
chacha20->iv[0] = hex_to_u32 ((const u8 *) iv_marker + 8);
|
||||||
|
Loading…
Reference in New Issue
Block a user