mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-08 23:01:14 +00:00
Remove truncation of buffer in hc_enc_next() to workaround AMD JiT compiler (legacy) issue
This commit is contained in:
parent
bb1460d851
commit
9813811493
@ -2064,8 +2064,8 @@ DECLSPEC int hc_enc_has_next (hc_enc_t *hc_enc, const int sz)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Input buffer and Output buffer size has to be multiple of 16 and at least of size 16
|
||||
// The output buffer will by zero padded
|
||||
// Input buffer and Output buffer size has to be multiple of 4 and at least of size 4.
|
||||
// The output buffer is not zero padded, so entire buffer has to be set all zero before entering this function or truncated afterwards.
|
||||
|
||||
DECLSPEC int hc_enc_next (hc_enc_t *hc_enc, const u32 *src_buf, const int src_len, const int src_sz, u32 *dst_buf, const int dst_sz)
|
||||
{
|
||||
@ -2193,20 +2193,6 @@ DECLSPEC int hc_enc_next (hc_enc_t *hc_enc, const u32 *src_buf, const int src_le
|
||||
}
|
||||
}
|
||||
|
||||
if (dst_pos < dst_sz)
|
||||
{
|
||||
const int dst_block = dst_pos / 16;
|
||||
|
||||
truncate_block_4x4_le_S (dst_buf + (dst_block * 4), dst_pos & 15);
|
||||
|
||||
const int zero_block = dst_block + 1;
|
||||
|
||||
for (int i = zero_block * 16, j = zero_block * 4; i < dst_sz; i += 4, j += 1)
|
||||
{
|
||||
dst_buf[j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
hc_enc->pos = src_pos;
|
||||
|
||||
return dst_pos;
|
||||
@ -2338,20 +2324,6 @@ DECLSPEC int hc_enc_next_global (hc_enc_t *hc_enc, GLOBAL_AS const u32 *src_buf,
|
||||
}
|
||||
}
|
||||
|
||||
if (dst_pos < dst_sz)
|
||||
{
|
||||
const int dst_block = dst_pos / 16;
|
||||
|
||||
truncate_block_4x4_le_S (dst_buf + (dst_block * 4), dst_pos & 15);
|
||||
|
||||
const int zero_block = dst_block + 1;
|
||||
|
||||
for (int i = zero_block * 16, j = zero_block * 4; i < dst_sz; i += 4, j += 1)
|
||||
{
|
||||
dst_buf[j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
hc_enc->pos = src_pos;
|
||||
|
||||
return dst_pos;
|
||||
|
@ -371,7 +371,7 @@ DECLSPEC void md4_update_utf16le (md4_ctx_t *ctx, const u32 *w, const int len)
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -431,7 +431,7 @@ DECLSPEC void md4_update_utf16le_swap (md4_ctx_t *ctx, const u32 *w, const int l
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -680,7 +680,7 @@ DECLSPEC void md4_update_global_utf16le (md4_ctx_t *ctx, GLOBAL_AS const u32 *w,
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -740,7 +740,7 @@ DECLSPEC void md4_update_global_utf16le_swap (md4_ctx_t *ctx, GLOBAL_AS const u3
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
|
@ -407,7 +407,7 @@ DECLSPEC void md5_update_utf16le (md5_ctx_t *ctx, const u32 *w, const int len)
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -467,7 +467,7 @@ DECLSPEC void md5_update_utf16le_swap (md5_ctx_t *ctx, const u32 *w, const int l
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -716,7 +716,7 @@ DECLSPEC void md5_update_global_utf16le (md5_ctx_t *ctx, GLOBAL_AS const u32 *w,
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -776,7 +776,7 @@ DECLSPEC void md5_update_global_utf16le_swap (md5_ctx_t *ctx, GLOBAL_AS const u3
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
|
@ -505,7 +505,7 @@ DECLSPEC void ripemd160_update_utf16le (ripemd160_ctx_t *ctx, const u32 *w, cons
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -565,7 +565,7 @@ DECLSPEC void ripemd160_update_utf16le_swap (ripemd160_ctx_t *ctx, const u32 *w,
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -814,7 +814,7 @@ DECLSPEC void ripemd160_update_global_utf16le (ripemd160_ctx_t *ctx, GLOBAL_AS c
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -874,7 +874,7 @@ DECLSPEC void ripemd160_update_global_utf16le_swap (ripemd160_ctx_t *ctx, GLOBAL
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
|
@ -620,7 +620,7 @@ DECLSPEC void sha1_update_utf16le (sha1_ctx_t *ctx, const u32 *w, const int len)
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -680,7 +680,7 @@ DECLSPEC void sha1_update_utf16le_swap (sha1_ctx_t *ctx, const u32 *w, const int
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -1047,7 +1047,7 @@ DECLSPEC void sha1_update_global_utf16le (sha1_ctx_t *ctx, GLOBAL_AS const u32 *
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -1107,7 +1107,7 @@ DECLSPEC void sha1_update_global_utf16le_swap (sha1_ctx_t *ctx, GLOBAL_AS const
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
|
@ -422,7 +422,7 @@ DECLSPEC void sha224_update_utf16le (sha224_ctx_t *ctx, const u32 *w, const int
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -482,7 +482,7 @@ DECLSPEC void sha224_update_utf16le_swap (sha224_ctx_t *ctx, const u32 *w, const
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -731,7 +731,7 @@ DECLSPEC void sha224_update_global_utf16le (sha224_ctx_t *ctx, GLOBAL_AS const u
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -791,7 +791,7 @@ DECLSPEC void sha224_update_global_utf16le_swap (sha224_ctx_t *ctx, GLOBAL_AS co
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
|
@ -422,7 +422,7 @@ DECLSPEC void sha256_update_utf16le (sha256_ctx_t *ctx, const u32 *w, const int
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -482,7 +482,7 @@ DECLSPEC void sha256_update_utf16le_swap (sha256_ctx_t *ctx, const u32 *w, const
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -731,7 +731,7 @@ DECLSPEC void sha256_update_global_utf16le (sha256_ctx_t *ctx, GLOBAL_AS const u
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -791,7 +791,7 @@ DECLSPEC void sha256_update_global_utf16le_swap (sha256_ctx_t *ctx, GLOBAL_AS co
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
|
@ -630,7 +630,7 @@ DECLSPEC void sha384_update_utf16le (sha384_ctx_t *ctx, const u32 *w, const int
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[32];
|
||||
u32 enc_buf[32] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -714,7 +714,7 @@ DECLSPEC void sha384_update_utf16le_swap (sha384_ctx_t *ctx, const u32 *w, const
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[32];
|
||||
u32 enc_buf[32] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -1139,7 +1139,7 @@ DECLSPEC void sha384_update_global_utf16le (sha384_ctx_t *ctx, GLOBAL_AS const u
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[32];
|
||||
u32 enc_buf[32] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -1223,7 +1223,7 @@ DECLSPEC void sha384_update_global_utf16le_swap (sha384_ctx_t *ctx, GLOBAL_AS co
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[32];
|
||||
u32 enc_buf[32] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
|
@ -630,7 +630,7 @@ DECLSPEC void sha512_update_utf16le (sha512_ctx_t *ctx, const u32 *w, const int
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[32];
|
||||
u32 enc_buf[32] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -714,7 +714,7 @@ DECLSPEC void sha512_update_utf16le_swap (sha512_ctx_t *ctx, const u32 *w, const
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[32];
|
||||
u32 enc_buf[32] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -1139,7 +1139,7 @@ DECLSPEC void sha512_update_global_utf16le (sha512_ctx_t *ctx, GLOBAL_AS const u
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[32];
|
||||
u32 enc_buf[32] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -1223,7 +1223,7 @@ DECLSPEC void sha512_update_global_utf16le_swap (sha512_ctx_t *ctx, GLOBAL_AS co
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[32];
|
||||
u32 enc_buf[32] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
|
@ -1026,7 +1026,7 @@ DECLSPEC void whirlpool_update_utf16le (whirlpool_ctx_t *ctx, const u32 *w, cons
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -1086,7 +1086,7 @@ DECLSPEC void whirlpool_update_utf16le_swap (whirlpool_ctx_t *ctx, const u32 *w,
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -1335,7 +1335,7 @@ DECLSPEC void whirlpool_update_global_utf16le (whirlpool_ctx_t *ctx, GLOBAL_AS c
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
@ -1395,7 +1395,7 @@ DECLSPEC void whirlpool_update_global_utf16le_swap (whirlpool_ctx_t *ctx, GLOBAL
|
||||
|
||||
while (hc_enc_has_next (&hc_enc, len))
|
||||
{
|
||||
u32 enc_buf[16];
|
||||
u32 enc_buf[16] = { 0 };
|
||||
|
||||
const int enc_len = hc_enc_next_global (&hc_enc, w, len, 256, enc_buf, sizeof (enc_buf));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user