From 316b2952b569a3d0b980c9a88a9875a55618ad12 Mon Sep 17 00:00:00 2001 From: philsmd Date: Fri, 7 Jun 2019 15:52:37 +0200 Subject: [PATCH 1/4] PKZIP: improve decompression and allow up to 320KB data length --- OpenCL/inc_zip_inflate.cl | 112 ++++++++++++++++++++++++++++++++++--- OpenCL/m17200_a0-pure.cl | 12 ++-- OpenCL/m17200_a1-pure.cl | 12 ++-- OpenCL/m17200_a3-pure.cl | 12 ++-- OpenCL/m17210_a0-pure.cl | 2 +- OpenCL/m17210_a1-pure.cl | 2 +- OpenCL/m17210_a3-pure.cl | 2 +- OpenCL/m17220_a0-pure.cl | 12 ++-- OpenCL/m17220_a1-pure.cl | 12 ++-- OpenCL/m17220_a3-pure.cl | 14 ++--- OpenCL/m17225_a0-pure.cl | 12 ++-- OpenCL/m17225_a1-pure.cl | 12 ++-- OpenCL/m17225_a3-pure.cl | 14 ++--- OpenCL/m17230_a0-pure.cl | 2 +- OpenCL/m17230_a1-pure.cl | 2 +- OpenCL/m17230_a3-pure.cl | 2 +- src/modules/module_17200.c | 9 +-- src/modules/module_17210.c | 4 +- src/modules/module_17220.c | 7 +-- src/modules/module_17225.c | 7 +-- src/modules/module_17230.c | 4 +- 21 files changed, 175 insertions(+), 92 deletions(-) diff --git a/OpenCL/inc_zip_inflate.cl b/OpenCL/inc_zip_inflate.cl index cd10fe077..787020e38 100644 --- a/OpenCL/inc_zip_inflate.cl +++ b/OpenCL/inc_zip_inflate.cl @@ -263,13 +263,13 @@ enum } \ MZ_MACRO_END -//case state_index:; #define TINFL_CR_RETURN(state_index, result) \ do \ { \ status = result; \ r->m_state = state_index; \ goto common_exit; \ + case state_index:; \ } \ MZ_MACRO_END @@ -411,7 +411,7 @@ typedef struct tinfl_decompressor m_decomp; mz_uint m_dict_ofs, m_dict_avail, m_first_call, m_has_flushed; int m_window_bits; - mz_uint8 m_dict[TINFL_LZ_DICT_SIZE]; + mz_uint8 m_dict[1]; // hashcat-patched: we do not need m_dict because we have our own output buffer tinfl_status m_last_status; } inflate_state; @@ -458,7 +458,7 @@ int mz_inflateEnd(mz_streamp pStream); int mz_inflateInit2(mz_streamp pStream, int window_bits, inflate_state*); -const mz_uint8 pIn_xor_byte (const mz_uint8 c, mz_streamp pStream) +DECLSPEC const mz_uint8 pIn_xor_byte (const mz_uint8 c, mz_streamp pStream) { mz_uint8 r = c; @@ -472,7 +472,7 @@ const mz_uint8 pIn_xor_byte (const mz_uint8 c, mz_streamp pStream) } -void memcpy_g(void *dest, GLOBAL_AS const void *src, size_t n, mz_streamp pStream){ +DECLSPEC void memcpy_g(void *dest, GLOBAL_AS const void *src, size_t n, mz_streamp pStream){ GLOBAL_AS char *csrc = (GLOBAL_AS char *)src; char *cdest = (char *)dest; for (int i=0; im_dict_avail)) ? MZ_STREAM_END : MZ_OK; } + +// hashcat-patched: helper function for shifted u32 + +DECLSPEC u32 GETSHIFTEDINT (u32 *a, const int n) +{ + const int d = n / 4; + const int m = n & 3; + + u64 tmp = hl32_to_64_S (a[d + 1], a[d + 0]); + + tmp >>= m * 8; + + return l32_from_64_S (tmp); +} + +// hashcat-patched: faster memcpy for our large (TINFL_LZ_DICT_SIZE) move of bytes from the old output to the window/lookup table + +DECLSPEC void hc_shift_inflate_dict (u8 *buf, const u32 offset, const u32 len) +{ + u32 *ptr = (u32 *) buf; + + // we need to use len - 4 here to avoid buffer overflows caused by the u64 type in GETSHIFTEDINT + + u32 i, j; + + for (i = 0, j = 0; i < len - 4; i += 4, j++) + { + ptr[j] = GETSHIFTEDINT (ptr, offset + i); + } + + // final step (last 4 bytes are special): + + ptr[j] = (buf[offset + i + 3] << 24) | (buf[offset + i + 2] << 16) | (buf[offset + i + 1] << 8) | buf[offset + i]; +} + +// hashcat-patched: the mz_inflate () function from above doesn't work for us because we need to allow larger input/output and +// we only need the crc32 checksum actually + +DECLSPEC int hc_inflate (mz_streamp pStream) +{ + // we can't use the full TINFL_LZ_DICT_SIZE buffer because even with only 16 input bytes + // we can get pretty close to our max available output buffer: + + // size_t in_bytes = MZ_MIN (TINFL_LZ_DICT_SIZE, pStream->avail_in); + size_t in_bytes = MZ_MIN (16, pStream->avail_in); + + mz_uint decomp_flags = ((pStream->avail_in - in_bytes) > 0) ? TINFL_FLAG_HAS_MORE_INPUT : 0; + + decomp_flags |= TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF; + + inflate_state *pState = pStream->state; + + size_t out_bytes = pStream->avail_out; + + tinfl_status status = tinfl_decompress (&pState->m_decomp, pStream->next_in, &in_bytes, pStream->next_out, pStream->next_out + pStream->total_out, &out_bytes, decomp_flags, pStream); + + for (int i = 0; i < out_bytes; i++) + { + pStream->crc32 = CRC32 (pStream->crc32, pStream->next_out[pStream->total_out + i], pStream->crc32tab); + } + + pStream->next_in += (mz_uint) in_bytes; + pStream->avail_in -= (mz_uint) in_bytes; + pStream->total_in += (mz_uint) in_bytes; + + pStream->avail_out -= out_bytes; + pStream->total_out += out_bytes; + + if (pStream->avail_out < TINFL_LZ_DICT_SIZE) + { + // reset: + + // move the last TINFL_LZ_DICT_SIZE bytes to the start of the output buffer + + // memcpy (pStream->next_out, pStream->next_out + pStream->total_out - TINFL_LZ_DICT_SIZE, TINFL_LZ_DICT_SIZE); + hc_shift_inflate_dict (pStream->next_out, pStream->total_out - TINFL_LZ_DICT_SIZE, TINFL_LZ_DICT_SIZE); + + pStream->avail_out = TINFL_LZ_DICT_SIZE; + pStream->total_out = TINFL_LZ_DICT_SIZE; + } + + if (status < 0) + { + return MZ_DATA_ERROR; + } + + if (in_bytes == 0) + { + return MZ_STREAM_END; + } + + if (pStream->avail_in == 0) + { + return MZ_STREAM_END; + } + + return (status == TINFL_STATUS_DONE) ? MZ_STREAM_END : MZ_OK; +} diff --git a/OpenCL/m17200_a0-pure.cl b/OpenCL/m17200_a0-pure.cl index fe5c5c65c..c8ef0c4ec 100644 --- a/OpenCL/m17200_a0-pure.cl +++ b/OpenCL/m17200_a0-pure.cl @@ -94,13 +94,13 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp #include "inc_rp.cl" #define MAX_LOCAL 512 // too much leaves no room for compiler optimizations, simply benchmark to find a good trade-off - make it as big as possible -#define TMPSIZ 32 +#define TMPSIZ (2 * TINFL_LZ_DICT_SIZE) #define CRC32(x,c,t) (((x) >> 8) ^ (t)[((x) ^ (c)) & 0xff]) #define MSB(x) ((x) >> 24) #define CONST 0x08088405 -#define MAX_DATA (16 * 1024 * 1024) +#define MAX_DATA (320 * 1024) #define update_key012(k0,k1,k2,c,t) \ { \ @@ -749,11 +749,11 @@ KERNEL_FQ void m17200_sxx (KERN_ATTR_RULES_ESALT (pkzip_t)) // inflateinit2 is needed because otherwise it checks for headers by default mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream); - int ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + int ret = hc_inflate (&infstream); while (ret == MZ_OK) { - ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + ret = hc_inflate (&infstream); } if (ret != MZ_STREAM_END) continue; // failed to inflate @@ -975,11 +975,11 @@ KERNEL_FQ void m17200_mxx (KERN_ATTR_RULES_ESALT (pkzip_t)) // inflateinit2 is needed because otherwise it checks for headers by default mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream); - int ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + int ret = hc_inflate (&infstream); while (ret == MZ_OK) { - ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + ret = hc_inflate (&infstream); } if (ret != MZ_STREAM_END) continue; // failed to inflate diff --git a/OpenCL/m17200_a1-pure.cl b/OpenCL/m17200_a1-pure.cl index 17d38756a..0813f88b9 100644 --- a/OpenCL/m17200_a1-pure.cl +++ b/OpenCL/m17200_a1-pure.cl @@ -92,13 +92,13 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp #include "inc_simd.cl" #define MAX_LOCAL 512 // too much leaves no room for compiler optimizations, simply benchmark to find a good trade-off - make it as big as possible -#define TMPSIZ 32 +#define TMPSIZ (2 * TINFL_LZ_DICT_SIZE) #define CRC32(x,c,t) (((x) >> 8) ^ (t)[((x) ^ (c)) & 0xff]) #define MSB(x) ((x) >> 24) #define CONST 0x08088405 -#define MAX_DATA (16 * 1024 * 1024) +#define MAX_DATA (320 * 1024) #define update_key012(k0,k1,k2,c,t) \ { \ @@ -751,11 +751,11 @@ KERNEL_FQ void m17200_sxx (KERN_ATTR_ESALT (pkzip_t)) // inflateinit2 is needed because otherwise it checks for headers by default mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream); - int ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + int ret = hc_inflate (&infstream); while (ret == MZ_OK) { - ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + ret = hc_inflate (&infstream); } if (ret != MZ_STREAM_END) continue; // failed to inflate @@ -981,11 +981,11 @@ KERNEL_FQ void m17200_mxx (KERN_ATTR_ESALT (pkzip_t)) // inflateinit2 is needed because otherwise it checks for headers by default mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream); - int ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + int ret = hc_inflate (&infstream); while (ret == MZ_OK) { - ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + ret = hc_inflate (&infstream); } if (ret != MZ_STREAM_END) continue; // failed to inflate diff --git a/OpenCL/m17200_a3-pure.cl b/OpenCL/m17200_a3-pure.cl index 9da3ed1bf..609e63904 100644 --- a/OpenCL/m17200_a3-pure.cl +++ b/OpenCL/m17200_a3-pure.cl @@ -92,13 +92,13 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp #include "inc_simd.cl" #define MAX_LOCAL 512 // too much leaves no room for compiler optimizations, simply benchmark to find a good trade-off - make it as big as possible -#define TMPSIZ 32 +#define TMPSIZ (2 * TINFL_LZ_DICT_SIZE) #define CRC32(x,c,t) (((x) >> 8) ^ (t)[((x) ^ (c)) & 0xff]) #define MSB(x) ((x) >> 24) #define CONST 0x08088405 -#define MAX_DATA (16 * 1024 * 1024) +#define MAX_DATA (320 * 1024) #define update_key012(k0,k1,k2,c,t) \ { \ @@ -764,11 +764,11 @@ KERNEL_FQ void m17200_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) // inflateinit2 is needed because otherwise it checks for headers by default mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream); - int ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + int ret = hc_inflate (&infstream); while (ret == MZ_OK) { - ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + ret = hc_inflate (&infstream); } if (ret != MZ_STREAM_END) continue; // failed to inflate @@ -1006,11 +1006,11 @@ KERNEL_FQ void m17200_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) // inflateinit2 is needed because otherwise it checks for headers by default mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream); - int ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + int ret = hc_inflate (&infstream); while (ret == MZ_OK) { - ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + ret = hc_inflate (&infstream); } if (ret != MZ_STREAM_END) continue; // failed to inflate diff --git a/OpenCL/m17210_a0-pure.cl b/OpenCL/m17210_a0-pure.cl index 305635e62..ca0147f78 100644 --- a/OpenCL/m17210_a0-pure.cl +++ b/OpenCL/m17210_a0-pure.cl @@ -100,7 +100,7 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp #define MSB(x) ((x) >> 24) #define CONST 0x08088405 -#define MAX_DATA (16 * 1024 * 1024) +#define MAX_DATA (320 * 1024) #define update_key012(k0,k1,k2,c,t) \ { \ diff --git a/OpenCL/m17210_a1-pure.cl b/OpenCL/m17210_a1-pure.cl index 5b19a7c97..cb00f93c7 100644 --- a/OpenCL/m17210_a1-pure.cl +++ b/OpenCL/m17210_a1-pure.cl @@ -98,7 +98,7 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp #define MSB(x) ((x) >> 24) #define CONST 0x08088405 -#define MAX_DATA (16 * 1024 * 1024) +#define MAX_DATA (320 * 1024) #define update_key012(k0,k1,k2,c,t) \ { \ diff --git a/OpenCL/m17210_a3-pure.cl b/OpenCL/m17210_a3-pure.cl index b4fcf7219..3fb23e036 100644 --- a/OpenCL/m17210_a3-pure.cl +++ b/OpenCL/m17210_a3-pure.cl @@ -98,7 +98,7 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp #define MSB(x) ((x) >> 24) #define CONST 0x08088405 -#define MAX_DATA (16 * 1024 * 1024) +#define MAX_DATA (320 * 1024) #define update_key012(k0,k1,k2,c,t) \ { \ diff --git a/OpenCL/m17220_a0-pure.cl b/OpenCL/m17220_a0-pure.cl index 59fbcd9b6..06b4a586c 100644 --- a/OpenCL/m17220_a0-pure.cl +++ b/OpenCL/m17220_a0-pure.cl @@ -94,13 +94,13 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp #include "inc_rp.cl" #define MAX_LOCAL 512 // too much leaves no room for compiler optimizations, simply benchmark to find a good trade-off - make it as big as possible -#define TMPSIZ 32 +#define TMPSIZ (2 * TINFL_LZ_DICT_SIZE) #define CRC32(x,c,t) (((x) >> 8) ^ (t)[((x) ^ (c)) & 0xff]) #define MSB(x) ((x) >> 24) #define CONST 0x08088405 -#define MAX_DATA (16 * 1024 * 1024) +#define MAX_DATA (320 * 1024) #define update_key012(k0,k1,k2,c,t) \ { \ @@ -750,11 +750,11 @@ KERNEL_FQ void m17220_sxx (KERN_ATTR_RULES_ESALT (pkzip_t)) // inflateinit2 is needed because otherwise it checks for headers by default mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream); - int ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + int ret = hc_inflate (&infstream); while (ret == MZ_OK) { - ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + ret = hc_inflate (&infstream); } if (ret != MZ_STREAM_END) break; // failed to inflate @@ -1015,11 +1015,11 @@ KERNEL_FQ void m17220_mxx (KERN_ATTR_RULES_ESALT (pkzip_t)) // inflateinit2 is needed because otherwise it checks for headers by default mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream); - int ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + int ret = hc_inflate (&infstream); while (ret == MZ_OK) { - ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + ret = hc_inflate (&infstream); } if (ret != MZ_STREAM_END) break; // failed to inflate diff --git a/OpenCL/m17220_a1-pure.cl b/OpenCL/m17220_a1-pure.cl index ee7df3834..50245bbfd 100644 --- a/OpenCL/m17220_a1-pure.cl +++ b/OpenCL/m17220_a1-pure.cl @@ -92,13 +92,13 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp #include "inc_simd.cl" #define MAX_LOCAL 512 // too much leaves no room for compiler optimizations, simply benchmark to find a good trade-off - make it as big as possible -#define TMPSIZ 32 +#define TMPSIZ (2 * TINFL_LZ_DICT_SIZE) #define CRC32(x,c,t) (((x) >> 8) ^ (t)[((x) ^ (c)) & 0xff]) #define MSB(x) ((x) >> 24) #define CONST 0x08088405 -#define MAX_DATA (16 * 1024 * 1024) +#define MAX_DATA (320 * 1024) #define update_key012(k0,k1,k2,c,t) \ { \ @@ -750,11 +750,11 @@ KERNEL_FQ void m17220_sxx (KERN_ATTR_ESALT (pkzip_t)) // inflateinit2 is needed because otherwise it checks for headers by default mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream); - int ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + int ret = hc_inflate (&infstream); while (ret == MZ_OK) { - ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + ret = hc_inflate (&infstream); } if (ret != MZ_STREAM_END) break; // failed to inflate @@ -1017,11 +1017,11 @@ KERNEL_FQ void m17220_mxx (KERN_ATTR_ESALT (pkzip_t)) // inflateinit2 is needed because otherwise it checks for headers by default mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream); - int ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + int ret = hc_inflate (&infstream); while (ret == MZ_OK) { - ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + ret = hc_inflate (&infstream); } if (ret != MZ_STREAM_END) break; // failed to inflate diff --git a/OpenCL/m17220_a3-pure.cl b/OpenCL/m17220_a3-pure.cl index fd5985aa4..dd7f75242 100644 --- a/OpenCL/m17220_a3-pure.cl +++ b/OpenCL/m17220_a3-pure.cl @@ -92,13 +92,13 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp #include "inc_simd.cl" #define MAX_LOCAL 512 // too much leaves no room for compiler optimizations, simply benchmark to find a good trade-off - make it as big as possible -#define TMPSIZ 32 +#define TMPSIZ (2 * TINFL_LZ_DICT_SIZE) #define CRC32(x,c,t) (((x) >> 8) ^ (t)[((x) ^ (c)) & 0xff]) #define MSB(x) ((x) >> 24) #define CONST 0x08088405 -#define MAX_DATA (16 * 1024 * 1024) +#define MAX_DATA (320 * 1024) #define update_key012(k0,k1,k2,c,t) \ { \ @@ -762,11 +762,11 @@ KERNEL_FQ void m17220_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) // inflateinit2 is needed because otherwise it checks for headers by default mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream); - int ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + int ret = hc_inflate (&infstream); while (ret == MZ_OK) { - ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + ret = hc_inflate (&infstream); } if (ret != MZ_STREAM_END) break; // failed to inflate @@ -1041,11 +1041,11 @@ KERNEL_FQ void m17220_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) // inflateinit2 is needed because otherwise it checks for headers by default mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream); - int ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + int ret = hc_inflate (&infstream); while (ret == MZ_OK) { - ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + ret = hc_inflate (&infstream); } if (ret != MZ_STREAM_END) break; // failed to inflate @@ -1078,4 +1078,4 @@ KERNEL_FQ void m17220_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) #undef CONST #undef MAX_DATA #undef update_key012 -#undef update_key3 \ No newline at end of file +#undef update_key3 diff --git a/OpenCL/m17225_a0-pure.cl b/OpenCL/m17225_a0-pure.cl index bcb6dfb06..3ece3235c 100644 --- a/OpenCL/m17225_a0-pure.cl +++ b/OpenCL/m17225_a0-pure.cl @@ -94,13 +94,13 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp #include "inc_rp.cl" #define MAX_LOCAL 512 // too much leaves no room for compiler optimizations, simply benchmark to find a good trade-off - make it as big as possible -#define TMPSIZ 32 +#define TMPSIZ (2 * TINFL_LZ_DICT_SIZE) #define CRC32(x,c,t) (((x) >> 8) ^ (t)[((x) ^ (c)) & 0xff]) #define MSB(x) ((x) >> 24) #define CONST 0x08088405 -#define MAX_DATA (16 * 1024 * 1024) +#define MAX_DATA (320 * 1024) #define update_key012(k0,k1,k2,c,t) \ { \ @@ -759,11 +759,11 @@ KERNEL_FQ void m17225_sxx (KERN_ATTR_RULES_ESALT (pkzip_t)) // inflateinit2 is needed because otherwise it checks for headers by default mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream); - int ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + int ret = hc_inflate (&infstream); while (ret == MZ_OK) { - ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + ret = hc_inflate (&infstream); } if (ret != MZ_STREAM_END) break; // failed to inflate @@ -1087,11 +1087,11 @@ KERNEL_FQ void m17225_mxx (KERN_ATTR_RULES_ESALT (pkzip_t)) // inflateinit2 is needed because otherwise it checks for headers by default mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream); - int ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + int ret = hc_inflate (&infstream); while (ret == MZ_OK) { - ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + ret = hc_inflate (&infstream); } if (ret != MZ_STREAM_END) break; // failed to inflate diff --git a/OpenCL/m17225_a1-pure.cl b/OpenCL/m17225_a1-pure.cl index 89c4aed42..e09b0cb73 100644 --- a/OpenCL/m17225_a1-pure.cl +++ b/OpenCL/m17225_a1-pure.cl @@ -92,13 +92,13 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp #include "inc_simd.cl" #define MAX_LOCAL 512 // too much leaves no room for compiler optimizations, simply benchmark to find a good trade-off - make it as big as possible -#define TMPSIZ 32 +#define TMPSIZ (2 * TINFL_LZ_DICT_SIZE) #define CRC32(x,c,t) (((x) >> 8) ^ (t)[((x) ^ (c)) & 0xff]) #define MSB(x) ((x) >> 24) #define CONST 0x08088405 -#define MAX_DATA (16 * 1024 * 1024) +#define MAX_DATA (320 * 1024) #define update_key012(k0,k1,k2,c,t) \ { \ @@ -759,11 +759,11 @@ KERNEL_FQ void m17225_sxx (KERN_ATTR_ESALT (pkzip_t)) // inflateinit2 is needed because otherwise it checks for headers by default mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream); - int ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + int ret = hc_inflate (&infstream); while (ret == MZ_OK) { - ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + ret = hc_inflate (&infstream); } if (ret != MZ_STREAM_END) break; // failed to inflate @@ -1088,11 +1088,11 @@ KERNEL_FQ void m17225_mxx (KERN_ATTR_ESALT (pkzip_t)) // inflateinit2 is needed because otherwise it checks for headers by default mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream); - int ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + int ret = hc_inflate (&infstream); while (ret == MZ_OK) { - ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + ret = hc_inflate (&infstream); } if (ret != MZ_STREAM_END) break; // failed to inflate diff --git a/OpenCL/m17225_a3-pure.cl b/OpenCL/m17225_a3-pure.cl index 651c53642..e15bdc10c 100644 --- a/OpenCL/m17225_a3-pure.cl +++ b/OpenCL/m17225_a3-pure.cl @@ -92,13 +92,13 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp #include "inc_simd.cl" #define MAX_LOCAL 512 // too much leaves no room for compiler optimizations, simply benchmark to find a good trade-off - make it as big as possible -#define TMPSIZ 32 +#define TMPSIZ (2 * TINFL_LZ_DICT_SIZE) #define CRC32(x,c,t) (((x) >> 8) ^ (t)[((x) ^ (c)) & 0xff]) #define MSB(x) ((x) >> 24) #define CONST 0x08088405 -#define MAX_DATA (16 * 1024 * 1024) +#define MAX_DATA (320 * 1024) #define update_key012(k0,k1,k2,c,t) \ { \ @@ -771,11 +771,11 @@ KERNEL_FQ void m17225_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) // inflateinit2 is needed because otherwise it checks for headers by default mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream); - int ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + int ret = hc_inflate (&infstream); while (ret == MZ_OK) { - ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + ret = hc_inflate (&infstream); } if (ret != MZ_STREAM_END) break; // failed to inflate @@ -1112,11 +1112,11 @@ KERNEL_FQ void m17225_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) // inflateinit2 is needed because otherwise it checks for headers by default mz_inflateInit2 (&infstream, -MAX_WBITS, &pStream); - int ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + int ret = hc_inflate (&infstream); while (ret == MZ_OK) { - ret = mz_inflate (&infstream, Z_SYNC_FLUSH); + ret = hc_inflate (&infstream); } if (ret != MZ_STREAM_END) break; // failed to inflate @@ -1202,4 +1202,4 @@ KERNEL_FQ void m17225_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) #undef CONST #undef MAX_DATA #undef update_key012 -#undef update_key3 \ No newline at end of file +#undef update_key3 diff --git a/OpenCL/m17230_a0-pure.cl b/OpenCL/m17230_a0-pure.cl index bec98b9a2..13446a9cf 100644 --- a/OpenCL/m17230_a0-pure.cl +++ b/OpenCL/m17230_a0-pure.cl @@ -100,7 +100,7 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp #define MSB(x) ((x) >> 24) #define CONST 0x08088405 -#define MAX_DATA (16 * 1024 * 1024) +#define MAX_DATA (320 * 1024) #define update_key012(k0,k1,k2,c,t) \ { \ diff --git a/OpenCL/m17230_a1-pure.cl b/OpenCL/m17230_a1-pure.cl index 37820e532..49319fdd8 100644 --- a/OpenCL/m17230_a1-pure.cl +++ b/OpenCL/m17230_a1-pure.cl @@ -98,7 +98,7 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp #define MSB(x) ((x) >> 24) #define CONST 0x08088405 -#define MAX_DATA (16 * 1024 * 1024) +#define MAX_DATA (320 * 1024) #define update_key012(k0,k1,k2,c,t) \ { \ diff --git a/OpenCL/m17230_a3-pure.cl b/OpenCL/m17230_a3-pure.cl index 2e34dd3e9..dd13703df 100644 --- a/OpenCL/m17230_a3-pure.cl +++ b/OpenCL/m17230_a3-pure.cl @@ -98,7 +98,7 @@ Related publication: https://scitepress.org/PublicationsDetail.aspx?ID=KLPzPqStp #define MSB(x) ((x) >> 24) #define CONST 0x08088405 -#define MAX_DATA (16 * 1024 * 1024) +#define MAX_DATA (320 * 1024) #define update_key012(k0,k1,k2,c,t) \ { \ diff --git a/src/modules/module_17200.c b/src/modules/module_17200.c index 9c01c4b6f..35c24196d 100644 --- a/src/modules/module_17200.c +++ b/src/modules/module_17200.c @@ -107,8 +107,7 @@ static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; static const char *ST_PASS = "hashcat"; static const char *ST_HASH = "$pkzip2$1*1*2*0*e3*1c5*eda7a8de*0*28*8*e3*eda7*5096*a9fc1f4e951c8fb3031a6f903e5f4e3211c8fdc4671547bf77f6f682afbfcc7475d83898985621a7af9bccd1349d1976500a68c48f630b7f22d7a0955524d768e34868880461335417ddd149c65a917c0eb0a4bf7224e24a1e04cf4ace5eef52205f4452e66ded937db9545f843a68b1e84a2e933cc05fb36d3db90e6c5faf1bee2249fdd06a7307849902a8bb24ec7e8a0886a4544ca47979a9dfeefe034bdfc5bd593904cfe9a5309dd199d337d3183f307c2cb39622549a5b9b8b485b7949a4803f63f67ca427a0640ad3793a519b2476c52198488e3e2e04cac202d624fb7d13c2*$/pkzip2$"; -#define MAX_DATA (16 * 1024 * 1024) -#define MAX_LEN (32 * 1024) +#define MAX_DATA (320 * 1024) // this is required to force mingw to accept the packed attribute #pragma pack(push,1) @@ -227,14 +226,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE p = strtok(NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; pkzip->hash.uncompressed_length = strtoul(p, NULL, 16); - if (pkzip->hash.compressed_length > MAX_DATA * 4) + if (pkzip->hash.compressed_length > MAX_DATA) { return PARSER_TOKEN_LENGTH; } - if (pkzip->hash.uncompressed_length > MAX_LEN) - { - return PARSER_HASH_LENGTH; - } p = strtok(NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; diff --git a/src/modules/module_17210.c b/src/modules/module_17210.c index 8d395a2a1..a2fbabcf9 100644 --- a/src/modules/module_17210.c +++ b/src/modules/module_17210.c @@ -107,7 +107,7 @@ static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; static const char *ST_PASS = "hashcat"; static const char *ST_HASH = "$pkzip2$1*1*2*0*1d1*1c5*eda7a8de*0*28*0*1d1*eda7*5096*1dea673da43d9fc7e2be1a1f4f664269fceb6cb88723a97408ae1fe07f774d31d1442ea8485081e63f919851ca0b7588d5e3442317fff19fe547a4ef97492ed75417c427eea3c4e146e16c100a2f8b6abd7e5988dc967e5a0e51f641401605d673630ea52ebb04da4b388489901656532c9aa474ca090dbac7cf8a21428d57b42a71da5f3d83fed927361e5d385ca8e480a6d42dea5b4bf497d3a24e79fc7be37c8d1721238cbe9e1ea3ae1eb91fc02aabdf33070d718d5105b70b3d7f3d2c28b3edd822e89a5abc0c8fee117c7fbfbfd4b4c8e130977b75cb0b1da080bfe1c0859e6483c42f459c8069d45a76220e046e6c2a2417392fd87e4aa4a2559eaab3baf78a77a1b94d8c8af16a977b4bb45e3da211838ad044f209428dba82666bf3d54d4eed82c64a9b3444a44746b9e398d0516a2596d84243b4a1d7e87d9843f38e45b6be67fd980107f3ad7b8453d87300e6c51ac9f5e3f6c3b702654440c543b1d808b62f7a313a83b31a6faaeedc2620de7057cd0df80f70346fe2d4dccc318f0b5ed128bcf0643e63d754bb05f53afb2b0fa90b34b538b2ad3648209dff587df4fa18698e4fa6d858ad44aa55d2bba3b08dfdedd3e28b8b7caf394d5d9d95e452c2ab1c836b9d74538c2f0d24b9b577*$/pkzip2$"; -#define MAX_DATA (16 * 1024 * 1024) +#define MAX_DATA (320 * 1024) // this is required to force mingw to accept the packed attribute #pragma pack(push,1) @@ -226,7 +226,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE p = strtok(NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; pkzip->hash.uncompressed_length = strtoul(p, NULL, 16); - if (pkzip->hash.uncompressed_length > MAX_DATA * 4) + if (pkzip->hash.compressed_length > MAX_DATA) { return PARSER_TOKEN_LENGTH; } diff --git a/src/modules/module_17220.c b/src/modules/module_17220.c index 864f9c84c..ce3072f88 100644 --- a/src/modules/module_17220.c +++ b/src/modules/module_17220.c @@ -107,8 +107,7 @@ static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; static const char *ST_PASS = "hashcat"; static const char *ST_HASH = "$pkzip2$3*1*1*0*8*24*a425*8827*d1730095cd829e245df04ebba6c52c0573d49d3bbeab6cb385b7fa8a28dcccd3098bfdd7*1*0*8*24*2a74*882a*51281ac874a60baedc375ca645888d29780e20d4076edd1e7154a99bde982152a736311f*2*0*e3*1c5*eda7a8de*0*29*8*e3*eda7*5096*1455781b59707f5151139e018bdcfeebfc89bc37e372883a7ec0670a5eafc622feb338f9b021b6601a674094898a91beac70e41e675f77702834ca6156111a1bf7361bc9f3715d77dfcdd626634c68354c6f2e5e0a7b1e1ce84a44e632d0f6e36019feeab92fb7eac9dda8df436e287aafece95d042059a1b27d533c5eab62c1c559af220dc432f2eb1a38a70f29e8f3cb5a207704274d1e305d7402180fd47e026522792f5113c52a116d5bb25b67074ffd6f4926b221555234aabddc69775335d592d5c7d22462b75de1259e8342a9ba71cb06223d13c7f51f13be2ad76352c3b8ed*$/pkzip2$"; -#define MAX_DATA (16 * 1024 * 1024) -#define MAX_LEN (32 * 1024) +#define MAX_DATA (320 * 1024) // this is required to force mingw to accept the packed attribute #pragma pack(push,1) @@ -233,10 +232,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { return PARSER_TOKEN_LENGTH; } - if (pkzip->hashes[i].uncompressed_length > MAX_LEN) - { - return PARSER_HASH_LENGTH; - } p = strtok(NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; diff --git a/src/modules/module_17225.c b/src/modules/module_17225.c index cc378f0ec..34718c2d9 100644 --- a/src/modules/module_17225.c +++ b/src/modules/module_17225.c @@ -107,8 +107,7 @@ static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; static const char *ST_PASS = "hashcat"; static const char *ST_HASH = "$pkzip2$3*1*1*0*0*24*3e2c*3ef8*0619e9d17ff3f994065b99b1fa8aef41c056edf9fa4540919c109742dcb32f797fc90ce0*1*0*8*24*431a*3f26*18e2461c0dbad89bd9cc763067a020c89b5e16195b1ac5fa7fb13bd246d000b6833a2988*2*0*23*17*1e3c1a16*2e4*2f*0*23*1e3c*3f2d*54ea4dbc711026561485bbd191bf300ae24fa0997f3779b688cdad323985f8d3bb8b0c*$/pkzip2$"; -#define MAX_DATA (16 * 1024 * 1024) -#define MAX_LEN (32 * 1024) +#define MAX_DATA (320 * 1024) // this is required to force mingw to accept the packed attribute #pragma pack(push,1) @@ -233,10 +232,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { return PARSER_TOKEN_LENGTH; } - if (pkzip->hashes[i].uncompressed_length > MAX_LEN) - { - return PARSER_HASH_LENGTH; - } p = strtok(NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; diff --git a/src/modules/module_17230.c b/src/modules/module_17230.c index 1386b5a67..ff922e49b 100644 --- a/src/modules/module_17230.c +++ b/src/modules/module_17230.c @@ -107,7 +107,7 @@ static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; static const char *ST_PASS = "hashcat"; static const char *ST_HASH = "$pkzip2$8*1*1*0*8*24*a425*8827*3bd479d541019c2f32395046b8fbca7e1dca218b9b5414975be49942c3536298e9cc939e*1*0*8*24*2a74*882a*537af57c30fd9fd4b3eefa9ce55b6bff3bbfada237a7c1dace8ebf3bb0de107426211da3*1*0*8*24*2a74*882a*5f406b4858d3489fd4a6a6788798ac9b924b5d0ca8b8e5a6371739c9edcfd28c82f75316*1*0*8*24*2a74*882a*1843aca546b2ea68bd844d1e99d4f74d86417248eb48dd5e956270e42a331c18ea13f5ed*1*0*8*24*2a74*882a*aca3d16543bbfb2e5d2659f63802e0fa5b33e0a1f8ae47334019b4f0b6045d3d8eda3af1*1*0*8*24*2a74*882a*fbe0efc9e10ae1fc9b169bd060470bf3e39f09f8d83bebecd5216de02b81e35fe7e7b2f2*1*0*8*24*2a74*882a*537886dbabffbb7cac77deb01dc84760894524e6966183b4478a4ef56f0c657375a235a1*1*0*8*24*eda7*5096*40eb30ef1ddd9b77b894ed46abf199b480f1e5614fde510855f92ae7b8026a11f80e4d5f*$/pkzip2$"; -#define MAX_DATA (16 * 1024 * 1024) +#define MAX_DATA (320 * 1024) // this is required to force mingw to accept the packed attribute #pragma pack(push,1) @@ -229,7 +229,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE p = strtok(NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; pkzip->hashes[i].uncompressed_length = strtoul(p, NULL, 16); - if (pkzip->hashes[i].compressed_length > MAX_DATA * 4) + if (pkzip->hashes[i].compressed_length > MAX_DATA) { return PARSER_TOKEN_LENGTH; } From 01a511b9ddcecb4c60a580568e64091d376035e2 Mon Sep 17 00:00:00 2001 From: philsmd Date: Fri, 7 Jun 2019 17:24:13 +0200 Subject: [PATCH 2/4] minor: some code formatting changes for PKZIP --- OpenCL/m17200_a0-pure.cl | 18 ++++----- OpenCL/m17200_a1-pure.cl | 18 ++++----- OpenCL/m17200_a3-pure.cl | 18 ++++----- OpenCL/m17210_a0-pure.cl | 8 ++-- OpenCL/m17210_a1-pure.cl | 8 ++-- OpenCL/m17210_a3-pure.cl | 8 ++-- OpenCL/m17220_a0-pure.cl | 18 ++++----- OpenCL/m17220_a1-pure.cl | 18 ++++----- OpenCL/m17220_a3-pure.cl | 18 ++++----- OpenCL/m17225_a0-pure.cl | 18 ++++----- OpenCL/m17225_a1-pure.cl | 18 ++++----- OpenCL/m17225_a3-pure.cl | 18 ++++----- OpenCL/m17230_a0-pure.cl | 8 ++-- OpenCL/m17230_a1-pure.cl | 8 ++-- OpenCL/m17230_a3-pure.cl | 8 ++-- OpenCL/m20500_a0-pure.cl | 4 +- OpenCL/m20500_a1-pure.cl | 4 +- OpenCL/m20500_a3-pure.cl | 4 +- OpenCL/m20510_a0-pure.cl | 2 +- OpenCL/m20510_a1-pure.cl | 2 +- OpenCL/m20510_a3-pure.cl | 2 +- src/modules/module_17200.c | 72 ++++++++++++++++++------------------ src/modules/module_17210.c | 71 ++++++++++++++++++------------------ src/modules/module_17220.c | 73 +++++++++++++++++++------------------ src/modules/module_17225.c | 73 +++++++++++++++++++------------------ src/modules/module_17230.c | 75 +++++++++++++++++++------------------- 26 files changed, 299 insertions(+), 293 deletions(-) diff --git a/OpenCL/m17200_a0-pure.cl b/OpenCL/m17200_a0-pure.cl index c8ef0c4ec..288d7f571 100644 --- a/OpenCL/m17200_a0-pure.cl +++ b/OpenCL/m17200_a0-pure.cl @@ -325,22 +325,22 @@ DECLSPEC int check_inflate_code2 (u8 *next) u32 ncode; u32 ncount[2]; // ends up being an array of 8 u8 count values. But we can clear it, and later 'check' it with 2 u32 instructions. u8 *count; // this will point to ncount array. NOTE, this is alignment required 'safe' for Sparc systems or others requiring alignment. - hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24); + hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24); next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back. hold >>= 3; // we already processed 3 bits count = (u8*)ncount; - if (257+(hold&0x1F) > 286) + if (257 + (hold & 0x1F) > 286) { return 0; // nlen, but we do not use it. } hold >>= 5; - if (1+(hold&0x1F) > 30) + if (1 + (hold & 0x1F) > 30) { return 0; // ndist, but we do not use it. } hold >>= 5; - ncode = 4+(hold&0xF); + ncode = 4 + (hold & 0xF); hold >>= 4; // we have 15 bits left. @@ -410,7 +410,7 @@ DECLSPEC int check_inflate_code1 (u8 *next, int left) u32 whave = 0, op, bits, hold,len; code here1; - hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24); + hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24); next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back. left -= 4; hold >>= 3; // we already processed 3 bits @@ -550,7 +550,7 @@ KERNEL_FQ void m17200_sxx (KERN_ATTR_RULES_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -559,7 +559,7 @@ KERNEL_FQ void m17200_sxx (KERN_ATTR_RULES_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hash.data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; @@ -788,7 +788,7 @@ KERNEL_FQ void m17200_mxx (KERN_ATTR_RULES_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -797,7 +797,7 @@ KERNEL_FQ void m17200_mxx (KERN_ATTR_RULES_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hash.data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; diff --git a/OpenCL/m17200_a1-pure.cl b/OpenCL/m17200_a1-pure.cl index 0813f88b9..421c39f95 100644 --- a/OpenCL/m17200_a1-pure.cl +++ b/OpenCL/m17200_a1-pure.cl @@ -323,22 +323,22 @@ DECLSPEC int check_inflate_code2 (u8 *next) u32 ncode; u32 ncount[2]; // ends up being an array of 8 u8 count values. But we can clear it, and later 'check' it with 2 u32 instructions. u8 *count; // this will point to ncount array. NOTE, this is alignment required 'safe' for Sparc systems or others requiring alignment. - hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24); + hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24); next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back. hold >>= 3; // we already processed 3 bits count = (u8*)ncount; - if (257+(hold&0x1F) > 286) + if (257 + (hold & 0x1F) > 286) { return 0; // nlen, but we do not use it. } hold >>= 5; - if (1+(hold&0x1F) > 30) + if (1 + (hold & 0x1F) > 30) { return 0; // ndist, but we do not use it. } hold >>= 5; - ncode = 4+(hold&0xF); + ncode = 4 + (hold & 0xF); hold >>= 4; // we have 15 bits left. @@ -408,7 +408,7 @@ DECLSPEC int check_inflate_code1 (u8 *next, int left) u32 whave = 0, op, bits, hold,len; code here1; - hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24); + hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24); next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back. left -= 4; hold >>= 3; // we already processed 3 bits @@ -548,7 +548,7 @@ KERNEL_FQ void m17200_sxx (KERN_ATTR_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -557,7 +557,7 @@ KERNEL_FQ void m17200_sxx (KERN_ATTR_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hash.data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; @@ -790,7 +790,7 @@ KERNEL_FQ void m17200_mxx (KERN_ATTR_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -799,7 +799,7 @@ KERNEL_FQ void m17200_mxx (KERN_ATTR_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hash.data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; diff --git a/OpenCL/m17200_a3-pure.cl b/OpenCL/m17200_a3-pure.cl index 609e63904..ae444f85b 100644 --- a/OpenCL/m17200_a3-pure.cl +++ b/OpenCL/m17200_a3-pure.cl @@ -325,22 +325,22 @@ DECLSPEC int check_inflate_code2 (u8 *next) u32 ncode; u32 ncount[2]; // ends up being an array of 8 u8 count values. But we can clear it, and later 'check' it with 2 u32 instructions. u8 *count; // this will point to ncount array. NOTE, this is alignment required 'safe' for Sparc systems or others requiring alignment. - hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24); + hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24); next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back. hold >>= 3; // we already processed 3 bits count = (u8*)ncount; - if (257+(hold&0x1F) > 286) + if (257 + (hold & 0x1F) > 286) { return 0; // nlen, but we do not use it. } hold >>= 5; - if (1+(hold&0x1F) > 30) + if (1 + (hold & 0x1F) > 30) { return 0; // ndist, but we do not use it. } hold >>= 5; - ncode = 4+(hold&0xF); + ncode = 4 + (hold & 0xF); hold >>= 4; // we have 15 bits left. @@ -409,7 +409,7 @@ DECLSPEC int check_inflate_code1 (u8 *next, int left) u32 whave = 0, op, bits, hold,len; code here1; - hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24); + hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24); next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back. left -= 4; hold >>= 3; // we already processed 3 bits @@ -549,7 +549,7 @@ KERNEL_FQ void m17200_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -558,7 +558,7 @@ KERNEL_FQ void m17200_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hash.data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; @@ -803,7 +803,7 @@ KERNEL_FQ void m17200_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -812,7 +812,7 @@ KERNEL_FQ void m17200_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hash.data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; diff --git a/OpenCL/m17210_a0-pure.cl b/OpenCL/m17210_a0-pure.cl index ca0147f78..2888eaedd 100644 --- a/OpenCL/m17210_a0-pure.cl +++ b/OpenCL/m17210_a0-pure.cl @@ -241,7 +241,7 @@ KERNEL_FQ void m17210_sxx (KERN_ATTR_RULES_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -250,7 +250,7 @@ KERNEL_FQ void m17210_sxx (KERN_ATTR_RULES_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hash.data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; @@ -480,7 +480,7 @@ KERNEL_FQ void m17210_mxx (KERN_ATTR_RULES_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -489,7 +489,7 @@ KERNEL_FQ void m17210_mxx (KERN_ATTR_RULES_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hash.data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; diff --git a/OpenCL/m17210_a1-pure.cl b/OpenCL/m17210_a1-pure.cl index cb00f93c7..1adfe9839 100644 --- a/OpenCL/m17210_a1-pure.cl +++ b/OpenCL/m17210_a1-pure.cl @@ -239,7 +239,7 @@ KERNEL_FQ void m17210_sxx (KERN_ATTR_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -248,7 +248,7 @@ KERNEL_FQ void m17210_sxx (KERN_ATTR_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hash.data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; @@ -480,7 +480,7 @@ KERNEL_FQ void m17210_mxx (KERN_ATTR_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -489,7 +489,7 @@ KERNEL_FQ void m17210_mxx (KERN_ATTR_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hash.data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; diff --git a/OpenCL/m17210_a3-pure.cl b/OpenCL/m17210_a3-pure.cl index 3fb23e036..1a89b07ff 100644 --- a/OpenCL/m17210_a3-pure.cl +++ b/OpenCL/m17210_a3-pure.cl @@ -239,7 +239,7 @@ KERNEL_FQ void m17210_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -248,7 +248,7 @@ KERNEL_FQ void m17210_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hash.data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; @@ -492,7 +492,7 @@ KERNEL_FQ void m17210_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -501,7 +501,7 @@ KERNEL_FQ void m17210_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hash.data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; diff --git a/OpenCL/m17220_a0-pure.cl b/OpenCL/m17220_a0-pure.cl index 06b4a586c..9f3456ccb 100644 --- a/OpenCL/m17220_a0-pure.cl +++ b/OpenCL/m17220_a0-pure.cl @@ -323,22 +323,22 @@ DECLSPEC int check_inflate_code2 (u8 *next) u32 ncode; u32 ncount[2]; // ends up being an array of 8 u8 count values. But we can clear it, and later 'check' it with 2 u32 instructions. u8 *count; // this will point to ncount array. NOTE, this is alignment required 'safe' for Sparc systems or others requiring alignment. - hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24); + hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24); next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back. hold >>= 3; // we already processed 3 bits count = (u8*)ncount; - if (257+(hold&0x1F) > 286) + if (257 + (hold & 0x1F) > 286) { return 0; // nlen, but we do not use it. } hold >>= 5; - if (1+(hold&0x1F) > 30) + if (1 + (hold & 0x1F) > 30) { return 0; // ndist, but we do not use it. } hold >>= 5; - ncode = 4+(hold&0xF); + ncode = 4 + (hold & 0xF); hold >>= 4; // we have 15 bits left. @@ -408,7 +408,7 @@ DECLSPEC int check_inflate_code1 (u8 *next, int left) u32 whave = 0, op, bits, hold,len; code here1; - hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24); + hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24); next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back. left -= 4; hold >>= 3; // we already processed 3 bits @@ -548,7 +548,7 @@ KERNEL_FQ void m17220_sxx (KERN_ATTR_RULES_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -557,7 +557,7 @@ KERNEL_FQ void m17220_sxx (KERN_ATTR_RULES_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; @@ -813,7 +813,7 @@ KERNEL_FQ void m17220_mxx (KERN_ATTR_RULES_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -822,7 +822,7 @@ KERNEL_FQ void m17220_mxx (KERN_ATTR_RULES_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; diff --git a/OpenCL/m17220_a1-pure.cl b/OpenCL/m17220_a1-pure.cl index 50245bbfd..e03a0340e 100644 --- a/OpenCL/m17220_a1-pure.cl +++ b/OpenCL/m17220_a1-pure.cl @@ -321,22 +321,22 @@ DECLSPEC int check_inflate_code2 (u8 *next) u32 ncode; u32 ncount[2]; // ends up being an array of 8 u8 count values. But we can clear it, and later 'check' it with 2 u32 instructions. u8 *count; // this will point to ncount array. NOTE, this is alignment required 'safe' for Sparc systems or others requiring alignment. - hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24); + hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24); next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back. hold >>= 3; // we already processed 3 bits count = (u8*)ncount; - if (257+(hold&0x1F) > 286) + if (257 + (hold & 0x1F) > 286) { return 0; // nlen, but we do not use it. } hold >>= 5; - if (1+(hold&0x1F) > 30) + if (1 + (hold & 0x1F) > 30) { return 0; // ndist, but we do not use it. } hold >>= 5; - ncode = 4+(hold&0xF); + ncode = 4 + (hold & 0xF); hold >>= 4; // we have 15 bits left. @@ -406,7 +406,7 @@ DECLSPEC int check_inflate_code1 (u8 *next, int left) u32 whave = 0, op, bits, hold,len; code here1; - hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24); + hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24); next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back. left -= 4; hold >>= 3; // we already processed 3 bits @@ -546,7 +546,7 @@ KERNEL_FQ void m17220_sxx (KERN_ATTR_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -555,7 +555,7 @@ KERNEL_FQ void m17220_sxx (KERN_ATTR_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; @@ -813,7 +813,7 @@ KERNEL_FQ void m17220_mxx (KERN_ATTR_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -822,7 +822,7 @@ KERNEL_FQ void m17220_mxx (KERN_ATTR_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; diff --git a/OpenCL/m17220_a3-pure.cl b/OpenCL/m17220_a3-pure.cl index dd7f75242..e785c25a2 100644 --- a/OpenCL/m17220_a3-pure.cl +++ b/OpenCL/m17220_a3-pure.cl @@ -321,22 +321,22 @@ DECLSPEC int check_inflate_code2 (u8 *next) u32 ncode; u32 ncount[2]; // ends up being an array of 8 u8 count values. But we can clear it, and later 'check' it with 2 u32 instructions. u8 *count; // this will point to ncount array. NOTE, this is alignment required 'safe' for Sparc systems or others requiring alignment. - hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24); + hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24); next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back. hold >>= 3; // we already processed 3 bits count = (u8*)ncount; - if (257+(hold&0x1F) > 286) + if (257 + (hold & 0x1F) > 286) { return 0; // nlen, but we do not use it. } hold >>= 5; - if (1+(hold&0x1F) > 30) + if (1 + (hold & 0x1F) > 30) { return 0; // ndist, but we do not use it. } hold >>= 5; - ncode = 4+(hold&0xF); + ncode = 4 + (hold & 0xF); hold >>= 4; // we have 15 bits left. @@ -406,7 +406,7 @@ DECLSPEC int check_inflate_code1 (u8 *next, int left) u32 whave = 0, op, bits, hold,len; code here1; - hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24); + hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24); next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back. left -= 4; hold >>= 3; // we already processed 3 bits @@ -546,7 +546,7 @@ KERNEL_FQ void m17220_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -555,7 +555,7 @@ KERNEL_FQ void m17220_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; @@ -825,7 +825,7 @@ KERNEL_FQ void m17220_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -834,7 +834,7 @@ KERNEL_FQ void m17220_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; diff --git a/OpenCL/m17225_a0-pure.cl b/OpenCL/m17225_a0-pure.cl index 3ece3235c..a54dc41f6 100644 --- a/OpenCL/m17225_a0-pure.cl +++ b/OpenCL/m17225_a0-pure.cl @@ -323,22 +323,22 @@ DECLSPEC int check_inflate_code2 (u8 *next) u32 ncode; u32 ncount[2]; // ends up being an array of 8 u8 count values. But we can clear it, and later 'check' it with 2 u32 instructions. u8 *count; // this will point to ncount array. NOTE, this is alignment required 'safe' for Sparc systems or others requiring alignment. - hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24); + hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24); next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back. hold >>= 3; // we already processed 3 bits count = (u8*)ncount; - if (257+(hold&0x1F) > 286) + if (257 + (hold & 0x1F) > 286) { return 0; // nlen, but we do not use it. } hold >>= 5; - if (1+(hold&0x1F) > 30) + if (1 + (hold & 0x1F) > 30) { return 0; // ndist, but we do not use it. } hold >>= 5; - ncode = 4+(hold&0xF); + ncode = 4 + (hold & 0xF); hold >>= 4; // we have 15 bits left. @@ -408,7 +408,7 @@ DECLSPEC int check_inflate_code1 (u8 *next, int left) u32 whave = 0, op, bits, hold,len; code here1; - hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24); + hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24); next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back. left -= 4; hold >>= 3; // we already processed 3 bits @@ -548,7 +548,7 @@ KERNEL_FQ void m17225_sxx (KERN_ATTR_RULES_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -557,7 +557,7 @@ KERNEL_FQ void m17225_sxx (KERN_ATTR_RULES_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; @@ -876,7 +876,7 @@ KERNEL_FQ void m17225_mxx (KERN_ATTR_RULES_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -885,7 +885,7 @@ KERNEL_FQ void m17225_mxx (KERN_ATTR_RULES_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; diff --git a/OpenCL/m17225_a1-pure.cl b/OpenCL/m17225_a1-pure.cl index e09b0cb73..74b96af27 100644 --- a/OpenCL/m17225_a1-pure.cl +++ b/OpenCL/m17225_a1-pure.cl @@ -321,22 +321,22 @@ DECLSPEC int check_inflate_code2 (u8 *next) u32 ncode; u32 ncount[2]; // ends up being an array of 8 u8 count values. But we can clear it, and later 'check' it with 2 u32 instructions. u8 *count; // this will point to ncount array. NOTE, this is alignment required 'safe' for Sparc systems or others requiring alignment. - hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24); + hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24); next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back. hold >>= 3; // we already processed 3 bits count = (u8*)ncount; - if (257+(hold&0x1F) > 286) + if (257 + (hold & 0x1F) > 286) { return 0; // nlen, but we do not use it. } hold >>= 5; - if (1+(hold&0x1F) > 30) + if (1 + (hold & 0x1F) > 30) { return 0; // ndist, but we do not use it. } hold >>= 5; - ncode = 4+(hold&0xF); + ncode = 4 + (hold & 0xF); hold >>= 4; // we have 15 bits left. @@ -406,7 +406,7 @@ DECLSPEC int check_inflate_code1 (u8 *next, int left) u32 whave = 0, op, bits, hold,len; code here1; - hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24); + hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24); next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back. left -= 4; hold >>= 3; // we already processed 3 bits @@ -546,7 +546,7 @@ KERNEL_FQ void m17225_sxx (KERN_ATTR_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -555,7 +555,7 @@ KERNEL_FQ void m17225_sxx (KERN_ATTR_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; @@ -875,7 +875,7 @@ KERNEL_FQ void m17225_mxx (KERN_ATTR_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -884,7 +884,7 @@ KERNEL_FQ void m17225_mxx (KERN_ATTR_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; diff --git a/OpenCL/m17225_a3-pure.cl b/OpenCL/m17225_a3-pure.cl index e15bdc10c..145a70977 100644 --- a/OpenCL/m17225_a3-pure.cl +++ b/OpenCL/m17225_a3-pure.cl @@ -321,22 +321,22 @@ DECLSPEC int check_inflate_code2 (u8 *next) u32 ncode; u32 ncount[2]; // ends up being an array of 8 u8 count values. But we can clear it, and later 'check' it with 2 u32 instructions. u8 *count; // this will point to ncount array. NOTE, this is alignment required 'safe' for Sparc systems or others requiring alignment. - hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24); + hold = *next + (((u32)next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24); next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back. hold >>= 3; // we already processed 3 bits count = (u8*)ncount; - if (257+(hold&0x1F) > 286) + if (257 + (hold & 0x1F) > 286) { return 0; // nlen, but we do not use it. } hold >>= 5; - if (1+(hold&0x1F) > 30) + if (1 + (hold & 0x1F) > 30) { return 0; // ndist, but we do not use it. } hold >>= 5; - ncode = 4+(hold&0xF); + ncode = 4 + (hold & 0xF); hold >>= 4; // we have 15 bits left. @@ -406,7 +406,7 @@ DECLSPEC int check_inflate_code1 (u8 *next, int left) u32 whave = 0, op, bits, hold,len; code here1; - hold = *next + (((u32)next[1])<<8) + (((u32)next[2])<<16) + (((u32)next[3])<<24); + hold = *next + (((u32) next[1]) << 8) + (((u32) next[2]) << 16) + (((u32) next[3]) << 24); next += 3; // we pre-increment when pulling it in the loop, thus we need to be 1 byte back. left -= 4; hold >>= 3; // we already processed 3 bits @@ -546,7 +546,7 @@ KERNEL_FQ void m17225_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -555,7 +555,7 @@ KERNEL_FQ void m17225_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; @@ -887,7 +887,7 @@ KERNEL_FQ void m17225_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -896,7 +896,7 @@ KERNEL_FQ void m17225_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; diff --git a/OpenCL/m17230_a0-pure.cl b/OpenCL/m17230_a0-pure.cl index 13446a9cf..c9bbfbfa0 100644 --- a/OpenCL/m17230_a0-pure.cl +++ b/OpenCL/m17230_a0-pure.cl @@ -241,7 +241,7 @@ KERNEL_FQ void m17230_sxx (KERN_ATTR_RULES_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -250,7 +250,7 @@ KERNEL_FQ void m17230_sxx (KERN_ATTR_RULES_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; @@ -411,7 +411,7 @@ KERNEL_FQ void m17230_mxx (KERN_ATTR_RULES_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -420,7 +420,7 @@ KERNEL_FQ void m17230_mxx (KERN_ATTR_RULES_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; diff --git a/OpenCL/m17230_a1-pure.cl b/OpenCL/m17230_a1-pure.cl index 49319fdd8..6f04fc962 100644 --- a/OpenCL/m17230_a1-pure.cl +++ b/OpenCL/m17230_a1-pure.cl @@ -239,7 +239,7 @@ KERNEL_FQ void m17230_sxx (KERN_ATTR_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -248,7 +248,7 @@ KERNEL_FQ void m17230_sxx (KERN_ATTR_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; @@ -411,7 +411,7 @@ KERNEL_FQ void m17230_mxx (KERN_ATTR_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -420,7 +420,7 @@ KERNEL_FQ void m17230_mxx (KERN_ATTR_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; diff --git a/OpenCL/m17230_a3-pure.cl b/OpenCL/m17230_a3-pure.cl index dd13703df..be1b266fe 100644 --- a/OpenCL/m17230_a3-pure.cl +++ b/OpenCL/m17230_a3-pure.cl @@ -239,7 +239,7 @@ KERNEL_FQ void m17230_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -248,7 +248,7 @@ KERNEL_FQ void m17230_sxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; @@ -425,7 +425,7 @@ KERNEL_FQ void m17230_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); LOCAL_VK u32 l_data[MAX_LOCAL]; @@ -434,7 +434,7 @@ KERNEL_FQ void m17230_mxx (KERN_ATTR_VECTOR_ESALT (pkzip_t)) l_data[i] = esalt_bufs[digests_offset].hashes[0].data[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; diff --git a/OpenCL/m20500_a0-pure.cl b/OpenCL/m20500_a0-pure.cl index 5dfd4a2c9..b8a2c9ea9 100644 --- a/OpenCL/m20500_a0-pure.cl +++ b/OpenCL/m20500_a0-pure.cl @@ -172,7 +172,7 @@ KERNEL_FQ void m20500_sxx (KERN_ATTR_RULES ()) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; @@ -246,7 +246,7 @@ KERNEL_FQ void m20500_mxx (KERN_ATTR_RULES ()) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; diff --git a/OpenCL/m20500_a1-pure.cl b/OpenCL/m20500_a1-pure.cl index e253c14d9..3edd2e86b 100644 --- a/OpenCL/m20500_a1-pure.cl +++ b/OpenCL/m20500_a1-pure.cl @@ -170,7 +170,7 @@ KERNEL_FQ void m20500_sxx (KERN_ATTR_BASIC ()) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; @@ -246,7 +246,7 @@ KERNEL_FQ void m20500_mxx (KERN_ATTR_BASIC ()) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; diff --git a/OpenCL/m20500_a3-pure.cl b/OpenCL/m20500_a3-pure.cl index 4765e83c7..27b4b0765 100644 --- a/OpenCL/m20500_a3-pure.cl +++ b/OpenCL/m20500_a3-pure.cl @@ -266,7 +266,7 @@ KERNEL_FQ void m20500_sxx (KERN_ATTR_VECTOR ()) l_icrc32tab[i] = icrc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; @@ -380,7 +380,7 @@ KERNEL_FQ void m20500_mxx (KERN_ATTR_VECTOR ()) l_crc32tab[i] = crc32tab[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; diff --git a/OpenCL/m20510_a0-pure.cl b/OpenCL/m20510_a0-pure.cl index 12aeeff4d..7185b9a3e 100644 --- a/OpenCL/m20510_a0-pure.cl +++ b/OpenCL/m20510_a0-pure.cl @@ -509,7 +509,7 @@ KERNEL_FQ void m20510_sxx (KERN_ATTR_RULES ()) l_lsbk0_count1[i] = lsbk0_count1[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; diff --git a/OpenCL/m20510_a1-pure.cl b/OpenCL/m20510_a1-pure.cl index 6c0f757bf..07382dce3 100644 --- a/OpenCL/m20510_a1-pure.cl +++ b/OpenCL/m20510_a1-pure.cl @@ -507,7 +507,7 @@ KERNEL_FQ void m20510_sxx (KERN_ATTR_BASIC ()) l_lsbk0_count1[i] = lsbk0_count1[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; diff --git a/OpenCL/m20510_a3-pure.cl b/OpenCL/m20510_a3-pure.cl index 19612b0b0..92293d6a6 100644 --- a/OpenCL/m20510_a3-pure.cl +++ b/OpenCL/m20510_a3-pure.cl @@ -507,7 +507,7 @@ KERNEL_FQ void m20510_sxx (KERN_ATTR_VECTOR ()) l_lsbk0_count1[i] = lsbk0_count1[i]; } - SYNC_THREADS(); + SYNC_THREADS (); if (gid >= gid_max) return; diff --git a/src/modules/module_17200.c b/src/modules/module_17200.c index 35c24196d..eeaa277c1 100644 --- a/src/modules/module_17200.c +++ b/src/modules/module_17200.c @@ -186,91 +186,93 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE char input[line_len + 1]; input[line_len] = '\0'; - memcpy(&input, line_buf, line_len); + memcpy (&input, line_buf, line_len); - char *p = strtok(input, "*"); + char *p = strtok (input, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - if (strncmp(p, SIGNATURE_PKZIP_V1, 7) != 0 && strncmp(p, SIGNATURE_PKZIP_V2, 8) != 0) return PARSER_SIGNATURE_UNMATCHED; + if (strncmp (p, SIGNATURE_PKZIP_V1, 7) != 0 && strncmp (p, SIGNATURE_PKZIP_V2, 8) != 0) return PARSER_SIGNATURE_UNMATCHED; pkzip->version = 1; - if(strlen(p) == 9) pkzip->version = 2; + + if (strlen (p) == 9) pkzip->version = 2; char sub[2]; - sub[0] = p[strlen(p) - 1]; + + sub[0] = p[strlen (p) - 1]; sub[1] = '\0'; - pkzip->hash_count = atoi(sub); + pkzip->hash_count = atoi (sub); // check here that the hash_count is valid for the attack type - if(pkzip->hash_count != 1) return PARSER_HASH_VALUE; + if (pkzip->hash_count != 1) return PARSER_HASH_VALUE; - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->checksum_size = atoi(p); + pkzip->checksum_size = atoi (p); if (pkzip->checksum_size != 1 && pkzip->checksum_size != 2) return PARSER_HASH_LENGTH; - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hash.data_type_enum = atoi(p); + pkzip->hash.data_type_enum = atoi (p); if (pkzip->hash.data_type_enum > 3) return PARSER_HASH_LENGTH; - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hash.magic_type_enum = atoi(p); + pkzip->hash.magic_type_enum = atoi (p); - if(pkzip->hash.data_type_enum > 1) + if (pkzip->hash.data_type_enum > 1) { - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hash.compressed_length = strtoul(p, NULL, 16); + pkzip->hash.compressed_length = strtoul (p, NULL, 16); - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hash.uncompressed_length = strtoul(p, NULL, 16); + pkzip->hash.uncompressed_length = strtoul (p, NULL, 16); if (pkzip->hash.compressed_length > MAX_DATA) { return PARSER_TOKEN_LENGTH; } - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - sscanf(p, "%x", &(pkzip->hash.crc32)); + sscanf (p, "%x", &(pkzip->hash.crc32)); - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hash.offset = strtoul(p, NULL, 16); + pkzip->hash.offset = strtoul (p, NULL, 16); - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hash.additional_offset = strtoul(p, NULL, 16); + pkzip->hash.additional_offset = strtoul (p, NULL, 16); } - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hash.compression_type = atoi(p); + pkzip->hash.compression_type = atoi (p); if (pkzip->hash.compression_type != 8) return PARSER_PKZIP_CT_UNMATCHED; - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hash.data_length = strtoul(p, NULL, 16); + pkzip->hash.data_length = strtoul (p, NULL, 16); - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - sscanf(p, "%hx", &(pkzip->hash.checksum_from_crc)); - if(pkzip->version == 2) + sscanf (p, "%hx", &(pkzip->hash.checksum_from_crc)); + if (pkzip->version == 2) { - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - sscanf(p, "%hx", &(pkzip->hash.checksum_from_timestamp)); + sscanf (p, "%hx", &(pkzip->hash.checksum_from_timestamp)); } else { pkzip->hash.checksum_from_timestamp = pkzip->hash.checksum_from_crc; } - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - hex_to_binary(p, strlen(p), (char *) &(pkzip->hash.data)); + hex_to_binary (p, strlen (p), (char *) &(pkzip->hash.data)); // fake salt u32 *ptr = (u32 *) pkzip->hash.data; diff --git a/src/modules/module_17210.c b/src/modules/module_17210.c index a2fbabcf9..5cdd67c99 100644 --- a/src/modules/module_17210.c +++ b/src/modules/module_17210.c @@ -186,91 +186,92 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE char input[line_len + 1]; input[line_len] = '\0'; - memcpy(&input, line_buf, line_len); + memcpy (&input, line_buf, line_len); - char *p = strtok(input, "*"); + char *p = strtok (input, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - if (strncmp(p, SIGNATURE_PKZIP_V1, 7) != 0 && strncmp(p, SIGNATURE_PKZIP_V2, 8) != 0) return PARSER_SIGNATURE_UNMATCHED; + if (strncmp (p, SIGNATURE_PKZIP_V1, 7) != 0 && strncmp (p, SIGNATURE_PKZIP_V2, 8) != 0) return PARSER_SIGNATURE_UNMATCHED; pkzip->version = 1; - if(strlen(p) == 9) pkzip->version = 2; + + if (strlen (p) == 9) pkzip->version = 2; char sub[2]; - sub[0] = p[strlen(p) - 1]; + sub[0] = p[strlen (p) - 1]; sub[1] = '\0'; - pkzip->hash_count = atoi(sub); + pkzip->hash_count = atoi (sub); // check here that the hash_count is valid for the attack type - if(pkzip->hash_count != 1) return PARSER_HASH_VALUE; + if (pkzip->hash_count != 1) return PARSER_HASH_VALUE; - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->checksum_size = atoi(p); + pkzip->checksum_size = atoi (p); if (pkzip->checksum_size != 1 && pkzip->checksum_size != 2) return PARSER_HASH_LENGTH; - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hash.data_type_enum = atoi(p); + pkzip->hash.data_type_enum = atoi (p); if (pkzip->hash.data_type_enum > 3) return PARSER_HASH_LENGTH; - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hash.magic_type_enum = atoi(p); + pkzip->hash.magic_type_enum = atoi (p); - if(pkzip->hash.data_type_enum > 1) + if (pkzip->hash.data_type_enum > 1) { - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hash.compressed_length = strtoul(p, NULL, 16); + pkzip->hash.compressed_length = strtoul (p, NULL, 16); - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hash.uncompressed_length = strtoul(p, NULL, 16); + pkzip->hash.uncompressed_length = strtoul (p, NULL, 16); if (pkzip->hash.compressed_length > MAX_DATA) { return PARSER_TOKEN_LENGTH; } - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - sscanf(p, "%x", &(pkzip->hash.crc32)); + sscanf (p, "%x", & (pkzip->hash.crc32)); - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hash.offset = strtoul(p, NULL, 16); + pkzip->hash.offset = strtoul (p, NULL, 16); - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hash.additional_offset = strtoul(p, NULL, 16); + pkzip->hash.additional_offset = strtoul (p, NULL, 16); } - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hash.compression_type = atoi(p); + pkzip->hash.compression_type = atoi (p); if (pkzip->hash.compression_type != 0) return PARSER_PKZIP_CT_UNMATCHED; - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hash.data_length = strtoul(p, NULL, 16); + pkzip->hash.data_length = strtoul (p, NULL, 16); - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - sscanf(p, "%hx", &(pkzip->hash.checksum_from_crc)); - if(pkzip->version == 2) + sscanf (p, "%hx", &(pkzip->hash.checksum_from_crc)); + if (pkzip->version == 2) { - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - sscanf(p, "%hx", &(pkzip->hash.checksum_from_timestamp)); + sscanf (p, "%hx", &(pkzip->hash.checksum_from_timestamp)); } else { pkzip->hash.checksum_from_timestamp = pkzip->hash.checksum_from_crc; } - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - hex_to_binary(p, strlen(p), (char *) &(pkzip->hash.data)); + hex_to_binary (p, strlen (p), (char *) &(pkzip->hash.data)); // fake salt u32 *ptr = (u32 *) pkzip->hash.data; diff --git a/src/modules/module_17220.c b/src/modules/module_17220.c index ce3072f88..2bb3cc714 100644 --- a/src/modules/module_17220.c +++ b/src/modules/module_17220.c @@ -186,93 +186,94 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE char input[line_len + 1]; input[line_len] = '\0'; - memcpy(&input, line_buf, line_len); + memcpy (&input, line_buf, line_len); - char *p = strtok(input, "*"); + char *p = strtok (input, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - if (strncmp(p, SIGNATURE_PKZIP_V1, 7) != 0 && strncmp(p, SIGNATURE_PKZIP_V2, 8) != 0) return PARSER_SIGNATURE_UNMATCHED; + if (strncmp (p, SIGNATURE_PKZIP_V1, 7) != 0 && strncmp (p, SIGNATURE_PKZIP_V2, 8) != 0) return PARSER_SIGNATURE_UNMATCHED; pkzip->version = 1; - if(strlen(p) == 9) pkzip->version = 2; + + if (strlen (p) == 9) pkzip->version = 2; char sub[2]; - sub[0] = p[strlen(p) - 1]; + sub[0] = p[strlen (p) - 1]; sub[1] = '\0'; - pkzip->hash_count = atoi(sub); + pkzip->hash_count = atoi (sub); // check here that the hash_count is valid for the attack type - if(pkzip->hash_count > 8) return PARSER_HASH_VALUE; + if (pkzip->hash_count > 8) return PARSER_HASH_VALUE; - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->checksum_size = atoi(p); + pkzip->checksum_size = atoi (p); if (pkzip->checksum_size != 1 && pkzip->checksum_size != 2) return PARSER_HASH_LENGTH; - for(int i = 0; i < pkzip->hash_count; i++) + for (int i = 0; i < pkzip->hash_count; i++) { - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].data_type_enum = atoi(p); + pkzip->hashes[i].data_type_enum = atoi (p); if (pkzip->hashes[i].data_type_enum > 3) return PARSER_HASH_LENGTH; - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].magic_type_enum = atoi(p); + pkzip->hashes[i].magic_type_enum = atoi (p); - if(pkzip->hashes[i].data_type_enum > 1) + if (pkzip->hashes[i].data_type_enum > 1) { - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].compressed_length = strtoul(p, NULL, 16); + pkzip->hashes[i].compressed_length = strtoul (p, NULL, 16); - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].uncompressed_length = strtoul(p, NULL, 16); + pkzip->hashes[i].uncompressed_length = strtoul (p, NULL, 16); if (pkzip->hashes[i].compressed_length > MAX_DATA) { return PARSER_TOKEN_LENGTH; } - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - sscanf(p, "%x", &(pkzip->hashes[i].crc32)); + sscanf (p, "%x", &(pkzip->hashes[i].crc32)); - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].offset = strtoul(p, NULL, 16); + pkzip->hashes[i].offset = strtoul (p, NULL, 16); - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].additional_offset = strtoul(p, NULL, 16); + pkzip->hashes[i].additional_offset = strtoul (p, NULL, 16); } - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].compression_type = atoi(p); + pkzip->hashes[i].compression_type = atoi (p); if (pkzip->hashes[i].compression_type != 8) return PARSER_PKZIP_CT_UNMATCHED; - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].data_length = strtoul(p, NULL, 16); + pkzip->hashes[i].data_length = strtoul (p, NULL, 16); - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - sscanf(p, "%hx", &(pkzip->hashes[i].checksum_from_crc)); - if(pkzip->version == 2) + sscanf (p, "%hx", &(pkzip->hashes[i].checksum_from_crc)); + if (pkzip->version == 2) { - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - sscanf(p, "%hx", &(pkzip->hashes[i].checksum_from_timestamp)); + sscanf (p, "%hx", &(pkzip->hashes[i].checksum_from_timestamp)); } else { pkzip->hashes[i].checksum_from_timestamp = pkzip->hashes[i].checksum_from_crc; } - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - hex_to_binary(p, strlen(p), (char *) &(pkzip->hashes[i].data)); + hex_to_binary (p, strlen (p), (char *) &(pkzip->hashes[i].data)); // fake salt u32 *ptr = (u32 *) pkzip->hashes[i].data; diff --git a/src/modules/module_17225.c b/src/modules/module_17225.c index 34718c2d9..bc82d8e89 100644 --- a/src/modules/module_17225.c +++ b/src/modules/module_17225.c @@ -186,93 +186,94 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE char input[line_len + 1]; input[line_len] = '\0'; - memcpy(&input, line_buf, line_len); + memcpy (&input, line_buf, line_len); - char *p = strtok(input, "*"); + char *p = strtok (input, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - if (strncmp(p, SIGNATURE_PKZIP_V1, 7) != 0 && strncmp(p, SIGNATURE_PKZIP_V2, 8) != 0) return PARSER_SIGNATURE_UNMATCHED; + if (strncmp (p, SIGNATURE_PKZIP_V1, 7) != 0 && strncmp (p, SIGNATURE_PKZIP_V2, 8) != 0) return PARSER_SIGNATURE_UNMATCHED; pkzip->version = 1; - if(strlen(p) == 9) pkzip->version = 2; + + if (strlen (p) == 9) pkzip->version = 2; char sub[2]; - sub[0] = p[strlen(p) - 1]; + sub[0] = p[strlen (p) - 1]; sub[1] = '\0'; - pkzip->hash_count = atoi(sub); + pkzip->hash_count = atoi (sub); // check here that the hash_count is valid for the attack type - if(pkzip->hash_count > 8) return PARSER_HASH_VALUE; + if (pkzip->hash_count > 8) return PARSER_HASH_VALUE; - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->checksum_size = atoi(p); + pkzip->checksum_size = atoi (p); if (pkzip->checksum_size != 1 && pkzip->checksum_size != 2) return PARSER_HASH_LENGTH; - for(int i = 0; i < pkzip->hash_count; i++) + for (int i = 0; i < pkzip->hash_count; i++) { - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].data_type_enum = atoi(p); + pkzip->hashes[i].data_type_enum = atoi (p); if (pkzip->hashes[i].data_type_enum > 3) return PARSER_HASH_LENGTH; - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].magic_type_enum = atoi(p); + pkzip->hashes[i].magic_type_enum = atoi (p); - if(pkzip->hashes[i].data_type_enum > 1) + if (pkzip->hashes[i].data_type_enum > 1) { - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].compressed_length = strtoul(p, NULL, 16); + pkzip->hashes[i].compressed_length = strtoul (p, NULL, 16); - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].uncompressed_length = strtoul(p, NULL, 16); + pkzip->hashes[i].uncompressed_length = strtoul (p, NULL, 16); if (pkzip->hashes[i].compressed_length > MAX_DATA) { return PARSER_TOKEN_LENGTH; } - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - sscanf(p, "%x", &(pkzip->hashes[i].crc32)); + sscanf (p, "%x", &(pkzip->hashes[i].crc32)); - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].offset = strtoul(p, NULL, 16); + pkzip->hashes[i].offset = strtoul (p, NULL, 16); - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].additional_offset = strtoul(p, NULL, 16); + pkzip->hashes[i].additional_offset = strtoul (p, NULL, 16); } - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].compression_type = atoi(p); + pkzip->hashes[i].compression_type = atoi (p); if (pkzip->hashes[i].compression_type != 8 && pkzip->hashes[i].compression_type != 0) return PARSER_HASH_VALUE; - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].data_length = strtoul(p, NULL, 16); + pkzip->hashes[i].data_length = strtoul (p, NULL, 16); - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - sscanf(p, "%hx", &(pkzip->hashes[i].checksum_from_crc)); - if(pkzip->version == 2) + sscanf (p, "%hx", &(pkzip->hashes[i].checksum_from_crc)); + if (pkzip->version == 2) { - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - sscanf(p, "%hx", &(pkzip->hashes[i].checksum_from_timestamp)); + sscanf (p, "%hx", &(pkzip->hashes[i].checksum_from_timestamp)); } else { pkzip->hashes[i].checksum_from_timestamp = pkzip->hashes[i].checksum_from_crc; } - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - hex_to_binary(p, strlen(p), (char *) &(pkzip->hashes[i].data)); + hex_to_binary (p, strlen (p), (char *) &(pkzip->hashes[i].data)); // fake salt u32 *ptr = (u32 *) pkzip->hashes[i].data; diff --git a/src/modules/module_17230.c b/src/modules/module_17230.c index ff922e49b..5a628f263 100644 --- a/src/modules/module_17230.c +++ b/src/modules/module_17230.c @@ -186,94 +186,95 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE char input[line_len + 1]; input[line_len] = '\0'; - memcpy(&input, line_buf, line_len); + memcpy (&input, line_buf, line_len); - char *p = strtok(input, "*"); + char *p = strtok (input, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - if (strncmp(p, SIGNATURE_PKZIP_V1, 7) != 0 && strncmp(p, SIGNATURE_PKZIP_V2, 8) != 0) return PARSER_SIGNATURE_UNMATCHED; + if (strncmp (p, SIGNATURE_PKZIP_V1, 7) != 0 && strncmp (p, SIGNATURE_PKZIP_V2, 8) != 0) return PARSER_SIGNATURE_UNMATCHED; pkzip->version = 1; - if(strlen(p) == 9) pkzip->version = 2; + + if (strlen (p) == 9) pkzip->version = 2; char sub[2]; - sub[0] = p[strlen(p) - 1]; + sub[0] = p[strlen (p) - 1]; sub[1] = '\0'; - pkzip->hash_count = atoi(sub); + pkzip->hash_count = atoi (sub); // check here that the hash_count is valid for the attack type - if(pkzip->hash_count > 8) return PARSER_HASH_VALUE; - if(pkzip->hash_count < 3) return PARSER_HASH_VALUE; + if (pkzip->hash_count > 8) return PARSER_HASH_VALUE; + if (pkzip->hash_count < 3) return PARSER_HASH_VALUE; - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->checksum_size = atoi(p); + pkzip->checksum_size = atoi (p); if (pkzip->checksum_size != 1 && pkzip->checksum_size != 2) return PARSER_HASH_LENGTH; - for(int i = 0; i < pkzip->hash_count; i++) + for (int i = 0; i < pkzip->hash_count; i++) { - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].data_type_enum = atoi(p); + pkzip->hashes[i].data_type_enum = atoi (p); if (pkzip->hashes[i].data_type_enum > 3) return PARSER_HASH_LENGTH; - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].magic_type_enum = atoi(p); + pkzip->hashes[i].magic_type_enum = atoi (p); - if(pkzip->hashes[i].data_type_enum > 1) + if (pkzip->hashes[i].data_type_enum > 1) { - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].compressed_length = strtoul(p, NULL, 16); + pkzip->hashes[i].compressed_length = strtoul (p, NULL, 16); - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].uncompressed_length = strtoul(p, NULL, 16); + pkzip->hashes[i].uncompressed_length = strtoul (p, NULL, 16); if (pkzip->hashes[i].compressed_length > MAX_DATA) { return PARSER_TOKEN_LENGTH; } - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - sscanf(p, "%x", &(pkzip->hashes[i].crc32)); + sscanf (p, "%x", &(pkzip->hashes[i].crc32)); - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].offset = strtoul(p, NULL, 16); + pkzip->hashes[i].offset = strtoul (p, NULL, 16); - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].additional_offset = strtoul(p, NULL, 16); + pkzip->hashes[i].additional_offset = strtoul (p, NULL, 16); } - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].compression_type = atoi(p); + pkzip->hashes[i].compression_type = atoi (p); if (pkzip->hashes[i].compression_type != 8 && pkzip->hashes[i].compression_type != 0) return PARSER_PKZIP_CT_UNMATCHED; - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - pkzip->hashes[i].data_length = strtoul(p, NULL, 16); + pkzip->hashes[i].data_length = strtoul (p, NULL, 16); - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - sscanf(p, "%hx", &(pkzip->hashes[i].checksum_from_crc)); - if(pkzip->version == 2) + sscanf (p, "%hx", &(pkzip->hashes[i].checksum_from_crc)); + if (pkzip->version == 2) { - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - sscanf(p, "%hx", &(pkzip->hashes[i].checksum_from_timestamp)); + sscanf (p, "%hx", &(pkzip->hashes[i].checksum_from_timestamp)); } else { pkzip->hashes[i].checksum_from_timestamp = pkzip->hashes[i].checksum_from_crc; } - p = strtok(NULL, "*"); + p = strtok (NULL, "*"); if (p == NULL) return PARSER_HASH_LENGTH; - hex_to_binary(p, strlen(p), (char *) &(pkzip->hashes[i].data)); + hex_to_binary (p, strlen (p), (char *) &(pkzip->hashes[i].data)); // fake salt u32 *ptr = (u32 *) pkzip->hashes[i].data; From a6617282568fb1c37b2f96a9e53076fc06d2f5e3 Mon Sep 17 00:00:00 2001 From: philsmd Date: Fri, 7 Jun 2019 19:42:28 +0200 Subject: [PATCH 3/4] pkzip: for u32 use MAX_DATA / 4 --- OpenCL/m17200_a0-pure.cl | 2 +- OpenCL/m17200_a1-pure.cl | 2 +- OpenCL/m17200_a3-pure.cl | 2 +- OpenCL/m17210_a0-pure.cl | 2 +- OpenCL/m17210_a1-pure.cl | 2 +- OpenCL/m17210_a3-pure.cl | 2 +- OpenCL/m17220_a0-pure.cl | 2 +- OpenCL/m17220_a1-pure.cl | 2 +- OpenCL/m17220_a3-pure.cl | 2 +- OpenCL/m17225_a0-pure.cl | 2 +- OpenCL/m17225_a1-pure.cl | 2 +- OpenCL/m17225_a3-pure.cl | 2 +- OpenCL/m17230_a0-pure.cl | 2 +- OpenCL/m17230_a1-pure.cl | 2 +- OpenCL/m17230_a3-pure.cl | 2 +- src/modules/module_17200.c | 2 +- src/modules/module_17210.c | 2 +- src/modules/module_17220.c | 2 +- src/modules/module_17225.c | 2 +- src/modules/module_17230.c | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) diff --git a/OpenCL/m17200_a0-pure.cl b/OpenCL/m17200_a0-pure.cl index 288d7f571..a8c64de0e 100644 --- a/OpenCL/m17200_a0-pure.cl +++ b/OpenCL/m17200_a0-pure.cl @@ -132,7 +132,7 @@ struct pkzip_hash u32 data_length; u16 checksum_from_crc; u16 checksum_from_timestamp; - u32 data[MAX_DATA]; + u32 data[MAX_DATA / 4]; // a quarter because of the u32 type } __attribute__((packed)); diff --git a/OpenCL/m17200_a1-pure.cl b/OpenCL/m17200_a1-pure.cl index 421c39f95..4b1e614d5 100644 --- a/OpenCL/m17200_a1-pure.cl +++ b/OpenCL/m17200_a1-pure.cl @@ -130,7 +130,7 @@ struct pkzip_hash u32 data_length; u16 checksum_from_crc; u16 checksum_from_timestamp; - u32 data[MAX_DATA]; + u32 data[MAX_DATA / 4]; // a quarter because of the u32 type } __attribute__((packed)); diff --git a/OpenCL/m17200_a3-pure.cl b/OpenCL/m17200_a3-pure.cl index ae444f85b..e92224aa4 100644 --- a/OpenCL/m17200_a3-pure.cl +++ b/OpenCL/m17200_a3-pure.cl @@ -130,7 +130,7 @@ struct pkzip_hash u32 data_length; u16 checksum_from_crc; u16 checksum_from_timestamp; - u32 data[MAX_DATA]; + u32 data[MAX_DATA / 4]; // a quarter because of the u32 type } __attribute__((packed)); diff --git a/OpenCL/m17210_a0-pure.cl b/OpenCL/m17210_a0-pure.cl index 2888eaedd..95bde75a9 100644 --- a/OpenCL/m17210_a0-pure.cl +++ b/OpenCL/m17210_a0-pure.cl @@ -132,7 +132,7 @@ struct pkzip_hash u32 data_length; u16 checksum_from_crc; u16 checksum_from_timestamp; - u32 data[MAX_DATA]; + u32 data[MAX_DATA / 4]; // a quarter because of the u32 type } __attribute__((packed)); diff --git a/OpenCL/m17210_a1-pure.cl b/OpenCL/m17210_a1-pure.cl index 1adfe9839..75b9935c7 100644 --- a/OpenCL/m17210_a1-pure.cl +++ b/OpenCL/m17210_a1-pure.cl @@ -130,7 +130,7 @@ struct pkzip_hash u32 data_length; u16 checksum_from_crc; u16 checksum_from_timestamp; - u32 data[MAX_DATA]; + u32 data[MAX_DATA / 4]; // a quarter because of the u32 type } __attribute__((packed)); diff --git a/OpenCL/m17210_a3-pure.cl b/OpenCL/m17210_a3-pure.cl index 1a89b07ff..4ed4e06df 100644 --- a/OpenCL/m17210_a3-pure.cl +++ b/OpenCL/m17210_a3-pure.cl @@ -130,7 +130,7 @@ struct pkzip_hash u32 data_length; u16 checksum_from_crc; u16 checksum_from_timestamp; - u32 data[MAX_DATA]; + u32 data[MAX_DATA / 4]; // a quarter because of the u32 type } __attribute__((packed)); diff --git a/OpenCL/m17220_a0-pure.cl b/OpenCL/m17220_a0-pure.cl index 9f3456ccb..f1fb4677a 100644 --- a/OpenCL/m17220_a0-pure.cl +++ b/OpenCL/m17220_a0-pure.cl @@ -132,7 +132,7 @@ struct pkzip_hash u32 data_length; u16 checksum_from_crc; u16 checksum_from_timestamp; - u32 data[MAX_DATA]; + u32 data[MAX_DATA / 4]; // a quarter because of the u32 type } __attribute__((packed)); diff --git a/OpenCL/m17220_a1-pure.cl b/OpenCL/m17220_a1-pure.cl index e03a0340e..ca188bd32 100644 --- a/OpenCL/m17220_a1-pure.cl +++ b/OpenCL/m17220_a1-pure.cl @@ -130,7 +130,7 @@ struct pkzip_hash u32 data_length; u16 checksum_from_crc; u16 checksum_from_timestamp; - u32 data[MAX_DATA]; + u32 data[MAX_DATA / 4]; // a quarter because of the u32 type } __attribute__((packed)); diff --git a/OpenCL/m17220_a3-pure.cl b/OpenCL/m17220_a3-pure.cl index e785c25a2..0149f5ba8 100644 --- a/OpenCL/m17220_a3-pure.cl +++ b/OpenCL/m17220_a3-pure.cl @@ -130,7 +130,7 @@ struct pkzip_hash u32 data_length; u16 checksum_from_crc; u16 checksum_from_timestamp; - u32 data[MAX_DATA]; + u32 data[MAX_DATA / 4]; // a quarter because of the u32 type } __attribute__((packed)); diff --git a/OpenCL/m17225_a0-pure.cl b/OpenCL/m17225_a0-pure.cl index a54dc41f6..c46572539 100644 --- a/OpenCL/m17225_a0-pure.cl +++ b/OpenCL/m17225_a0-pure.cl @@ -132,7 +132,7 @@ struct pkzip_hash u32 data_length; u16 checksum_from_crc; u16 checksum_from_timestamp; - u32 data[MAX_DATA]; + u32 data[MAX_DATA / 4]; // a quarter because of the u32 type } __attribute__((packed)); diff --git a/OpenCL/m17225_a1-pure.cl b/OpenCL/m17225_a1-pure.cl index 74b96af27..be2f66b00 100644 --- a/OpenCL/m17225_a1-pure.cl +++ b/OpenCL/m17225_a1-pure.cl @@ -130,7 +130,7 @@ struct pkzip_hash u32 data_length; u16 checksum_from_crc; u16 checksum_from_timestamp; - u32 data[MAX_DATA]; + u32 data[MAX_DATA / 4]; // a quarter because of the u32 type } __attribute__((packed)); diff --git a/OpenCL/m17225_a3-pure.cl b/OpenCL/m17225_a3-pure.cl index 145a70977..32db34f67 100644 --- a/OpenCL/m17225_a3-pure.cl +++ b/OpenCL/m17225_a3-pure.cl @@ -130,7 +130,7 @@ struct pkzip_hash u32 data_length; u16 checksum_from_crc; u16 checksum_from_timestamp; - u32 data[MAX_DATA]; + u32 data[MAX_DATA / 4]; // a quarter because of the u32 type } __attribute__((packed)); diff --git a/OpenCL/m17230_a0-pure.cl b/OpenCL/m17230_a0-pure.cl index c9bbfbfa0..456542b55 100644 --- a/OpenCL/m17230_a0-pure.cl +++ b/OpenCL/m17230_a0-pure.cl @@ -132,7 +132,7 @@ struct pkzip_hash u32 data_length; u16 checksum_from_crc; u16 checksum_from_timestamp; - u32 data[MAX_DATA]; + u32 data[MAX_DATA / 4]; // a quarter because of the u32 type } __attribute__((packed)); diff --git a/OpenCL/m17230_a1-pure.cl b/OpenCL/m17230_a1-pure.cl index 6f04fc962..a067e8b6d 100644 --- a/OpenCL/m17230_a1-pure.cl +++ b/OpenCL/m17230_a1-pure.cl @@ -130,7 +130,7 @@ struct pkzip_hash u32 data_length; u16 checksum_from_crc; u16 checksum_from_timestamp; - u32 data[MAX_DATA]; + u32 data[MAX_DATA / 4]; // a quarter because of the u32 type } __attribute__((packed)); diff --git a/OpenCL/m17230_a3-pure.cl b/OpenCL/m17230_a3-pure.cl index be1b266fe..144ff73b8 100644 --- a/OpenCL/m17230_a3-pure.cl +++ b/OpenCL/m17230_a3-pure.cl @@ -130,7 +130,7 @@ struct pkzip_hash u32 data_length; u16 checksum_from_crc; u16 checksum_from_timestamp; - u32 data[MAX_DATA]; + u32 data[MAX_DATA / 4]; // a quarter because of the u32 type } __attribute__((packed)); diff --git a/src/modules/module_17200.c b/src/modules/module_17200.c index eeaa277c1..1ada27f2c 100644 --- a/src/modules/module_17200.c +++ b/src/modules/module_17200.c @@ -125,7 +125,7 @@ struct pkzip_hash u32 data_length; u16 checksum_from_crc; u16 checksum_from_timestamp; - u32 data[MAX_DATA]; + u32 data[MAX_DATA / 4]; // a quarter because of the u32 type } __attribute__((packed)); diff --git a/src/modules/module_17210.c b/src/modules/module_17210.c index 5cdd67c99..ce3236aa3 100644 --- a/src/modules/module_17210.c +++ b/src/modules/module_17210.c @@ -125,7 +125,7 @@ struct pkzip_hash u32 data_length; u16 checksum_from_crc; u16 checksum_from_timestamp; - u32 data[MAX_DATA]; + u32 data[MAX_DATA / 4]; // a quarter because of the u32 type } __attribute__((packed)); diff --git a/src/modules/module_17220.c b/src/modules/module_17220.c index 2bb3cc714..ec06d95c6 100644 --- a/src/modules/module_17220.c +++ b/src/modules/module_17220.c @@ -125,7 +125,7 @@ struct pkzip_hash u32 data_length; u16 checksum_from_crc; u16 checksum_from_timestamp; - u32 data[MAX_DATA]; + u32 data[MAX_DATA / 4]; // a quarter because of the u32 type } __attribute__((packed)); diff --git a/src/modules/module_17225.c b/src/modules/module_17225.c index bc82d8e89..326bc12d0 100644 --- a/src/modules/module_17225.c +++ b/src/modules/module_17225.c @@ -125,7 +125,7 @@ struct pkzip_hash u32 data_length; u16 checksum_from_crc; u16 checksum_from_timestamp; - u32 data[MAX_DATA]; + u32 data[MAX_DATA / 4]; // a quarter because of the u32 type } __attribute__((packed)); diff --git a/src/modules/module_17230.c b/src/modules/module_17230.c index 5a628f263..fadc785c2 100644 --- a/src/modules/module_17230.c +++ b/src/modules/module_17230.c @@ -125,7 +125,7 @@ struct pkzip_hash u32 data_length; u16 checksum_from_crc; u16 checksum_from_timestamp; - u32 data[MAX_DATA]; + u32 data[MAX_DATA / 4]; // a quarter because of the u32 type } __attribute__((packed)); From 98759fba9534f78ba9d362628a5f3e04e401f830 Mon Sep 17 00:00:00 2001 From: philsmd <921533+philsmd@users.noreply.github.com> Date: Fri, 7 Jun 2019 20:14:15 +0200 Subject: [PATCH 4/4] pkzip: some more missing DECLSPEC found DECLSPEC should be specified on each and every OpenCL kernel function (in general) --- OpenCL/inc_zip_inflate.cl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/OpenCL/inc_zip_inflate.cl b/OpenCL/inc_zip_inflate.cl index 787020e38..d43d6bc10 100644 --- a/OpenCL/inc_zip_inflate.cl +++ b/OpenCL/inc_zip_inflate.cl @@ -180,7 +180,7 @@ typedef int mz_bool; typedef mz_uint64 tinfl_bit_buf_t; -void memcpy(void *dest, const void *src, u32 n){ +DECLSPEC void memcpy(void *dest, const void *src, u32 n){ char *csrc = (char *)src; char *cdest = (char *)dest; for (int i=0; i 0) { *dst = (u8) c; @@ -447,15 +447,15 @@ typedef struct mz_stream_s typedef mz_stream *mz_streamp; - -void miniz_def_free_func(void *opaque, void *address); -void *miniz_def_alloc_func(void *opaque, size_t items, size_t size); -int mz_inflate(mz_streamp pStream, int flush); -int mz_inflateEnd(mz_streamp pStream); +// hashcat-patched: not needed functions: +// void miniz_def_free_func(void *opaque, void *address); +// void *miniz_def_alloc_func(void *opaque, size_t items, size_t size); +DECLSPEC int mz_inflate(mz_streamp pStream, int flush); +DECLSPEC int mz_inflateEnd(mz_streamp pStream); -int mz_inflateInit2(mz_streamp pStream, int window_bits, inflate_state*); +DECLSPEC int mz_inflateInit2(mz_streamp pStream, int window_bits, inflate_state*); DECLSPEC const mz_uint8 pIn_xor_byte (const mz_uint8 c, mz_streamp pStream)