From 01a511b9ddcecb4c60a580568e64091d376035e2 Mon Sep 17 00:00:00 2001 From: philsmd Date: Fri, 7 Jun 2019 17:24:13 +0200 Subject: [PATCH] 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;