1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 08:08:10 +00:00

minor: some code formatting changes for PKZIP

This commit is contained in:
philsmd 2019-06-07 17:24:13 +02:00
parent 316b2952b5
commit 01a511b9dd
No known key found for this signature in database
GPG Key ID: 4F25D016D9D6A8AF
26 changed files with 299 additions and 293 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;