1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-27 02:18:21 +00:00

Merge pull request #443 from neheb/master

Fix GCC sign warnings
This commit is contained in:
Jens Steube 2016-07-27 11:17:55 +02:00 committed by GitHub
commit 804ee28ff1
4 changed files with 42 additions and 42 deletions

View File

@ -152,15 +152,15 @@ static inline int CPU_ISSET (int num, cpu_set_t *cs) { return (cs->count & (1 <
#define CL_VENDOR_NV "NVIDIA Corporation"
#define CL_VENDOR_POCL "The pocl project"
#define VENDOR_ID_AMD (1 << 0)
#define VENDOR_ID_APPLE (1 << 1)
#define VENDOR_ID_INTEL_BEIGNET (1 << 2)
#define VENDOR_ID_INTEL_SDK (1 << 3)
#define VENDOR_ID_MESA (1 << 4)
#define VENDOR_ID_NV (1 << 5)
#define VENDOR_ID_POCL (1 << 6)
#define VENDOR_ID_AMD_USE_INTEL (1 << 7)
#define VENDOR_ID_GENERIC (1 << 31)
#define VENDOR_ID_AMD (1u << 0)
#define VENDOR_ID_APPLE (1u << 1)
#define VENDOR_ID_INTEL_BEIGNET (1u << 2)
#define VENDOR_ID_INTEL_SDK (1u << 3)
#define VENDOR_ID_MESA (1u << 4)
#define VENDOR_ID_NV (1u << 5)
#define VENDOR_ID_POCL (1u << 6)
#define VENDOR_ID_AMD_USE_INTEL (1u << 7)
#define VENDOR_ID_GENERIC (1u << 31)
#define BLOCK_SIZE 64

View File

@ -3592,7 +3592,7 @@ static int autotune (hc_device_param_t *device_param)
{
for (int i = 0; i < STEPS_CNT; i++)
{
const u32 kernel_accel_try = 1 << i;
const u32 kernel_accel_try = 1u << i;
if (kernel_accel_try < kernel_accel_min) continue;
if (kernel_accel_try > kernel_accel_max) break;
@ -13845,14 +13845,14 @@ int main (int argc, char **argv)
if (bitmap_max < bitmap_min) bitmap_max = bitmap_min;
uint *bitmap_s1_a = (uint *) mymalloc ((1 << bitmap_max) * sizeof (uint));
uint *bitmap_s1_b = (uint *) mymalloc ((1 << bitmap_max) * sizeof (uint));
uint *bitmap_s1_c = (uint *) mymalloc ((1 << bitmap_max) * sizeof (uint));
uint *bitmap_s1_d = (uint *) mymalloc ((1 << bitmap_max) * sizeof (uint));
uint *bitmap_s2_a = (uint *) mymalloc ((1 << bitmap_max) * sizeof (uint));
uint *bitmap_s2_b = (uint *) mymalloc ((1 << bitmap_max) * sizeof (uint));
uint *bitmap_s2_c = (uint *) mymalloc ((1 << bitmap_max) * sizeof (uint));
uint *bitmap_s2_d = (uint *) mymalloc ((1 << bitmap_max) * sizeof (uint));
uint *bitmap_s1_a = (uint *) mymalloc ((1u << bitmap_max) * sizeof (uint));
uint *bitmap_s1_b = (uint *) mymalloc ((1u << bitmap_max) * sizeof (uint));
uint *bitmap_s1_c = (uint *) mymalloc ((1u << bitmap_max) * sizeof (uint));
uint *bitmap_s1_d = (uint *) mymalloc ((1u << bitmap_max) * sizeof (uint));
uint *bitmap_s2_a = (uint *) mymalloc ((1u << bitmap_max) * sizeof (uint));
uint *bitmap_s2_b = (uint *) mymalloc ((1u << bitmap_max) * sizeof (uint));
uint *bitmap_s2_c = (uint *) mymalloc ((1u << bitmap_max) * sizeof (uint));
uint *bitmap_s2_d = (uint *) mymalloc ((1u << bitmap_max) * sizeof (uint));
uint bitmap_bits;
uint bitmap_nums;
@ -13863,7 +13863,7 @@ int main (int argc, char **argv)
{
if (data.quiet == 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits);
bitmap_nums = 1 << bitmap_bits;
bitmap_nums = 1u << bitmap_bits;
bitmap_mask = bitmap_nums - 1;
@ -13877,7 +13877,7 @@ int main (int argc, char **argv)
break;
}
bitmap_nums = 1 << bitmap_bits;
bitmap_nums = 1u << bitmap_bits;
bitmap_mask = bitmap_nums - 1;
@ -14167,7 +14167,7 @@ int main (int argc, char **argv)
for (uint platform_id = 0; platform_id < platforms_cnt; platform_id++)
{
if ((opencl_platforms_filter & (1 << platform_id)) == 0) continue;
if ((opencl_platforms_filter & (1u << platform_id)) == 0) continue;
cl_platform_id platform = platforms[platform_id];
@ -14299,7 +14299,7 @@ int main (int argc, char **argv)
platform_vendor_id = VENDOR_ID_GENERIC;
}
uint platform_skipped = ((opencl_platforms_filter & (1 << platform_id)) == 0);
uint platform_skipped = ((opencl_platforms_filter & (1u << platform_id)) == 0);
CL_err = hc_clGetDeviceIDs (data.ocl, platform, CL_DEVICE_TYPE_ALL, DEVICES_MAX, platform_devices, &platform_devices_cnt);
@ -14806,7 +14806,7 @@ int main (int argc, char **argv)
// skipped
device_param->skipped |= ((devices_filter & (1 << device_id)) == 0);
device_param->skipped |= ((devices_filter & (1u << device_id)) == 0);
device_param->skipped |= ((device_types_filter & (device_type)) == 0);
// driver_version
@ -15849,7 +15849,7 @@ int main (int argc, char **argv)
{
size_scrypt = (128 * scrypt_r) * scrypt_N;
size_scrypt /= 1 << tmto;
size_scrypt /= 1u << tmto;
size_scrypt *= device_param->device_processors * device_param->kernel_threads * device_param->kernel_accel_max;

View File

@ -21,7 +21,7 @@ static u32 generate_cmask (u32 buf)
static void truncate_right (u32 w0[4], u32 w1[4], const u32 len)
{
const u32 tmp = (1 << ((len % 4) * 8)) - 1;
const u32 tmp = (1u << ((len % 4) * 8)) - 1;
switch (len / 4)
{
@ -74,7 +74,7 @@ static void truncate_right (u32 w0[4], u32 w1[4], const u32 len)
static void truncate_left (u32 w0[4], u32 w1[4], const u32 len)
{
const u32 tmp = ~((1 << ((len % 4) * 8)) - 1);
const u32 tmp = ~((1u << ((len % 4) * 8)) - 1);
switch (len / 4)
{
@ -1322,7 +1322,7 @@ static u32 rule_op_mangle_delete_last (const u32 p0, const u32 p1, u32 buf0[4],
const u32 in_len1 = in_len - 1;
const u32 tmp = (1 << ((in_len1 & 3) * 8)) - 1;
const u32 tmp = (1u << ((in_len1 & 3) * 8)) - 1;
switch (in_len1 / 4)
{
@ -1350,7 +1350,7 @@ static u32 rule_op_mangle_delete_at (const u32 p0, const u32 p1, u32 buf0[4], u3
lshift_block (buf0, buf1, tib40, tib41);
const u32 ml = (1 << ((p0 & 3) * 8)) - 1;
const u32 ml = (1u << ((p0 & 3) * 8)) - 1;
const u32 mr = ~ml;
switch (p0 / 4)
@ -1451,7 +1451,7 @@ static u32 rule_op_mangle_omit (const u32 p0, const u32 p1, u32 buf0[4], u32 buf
lshift_block_N (buf0, buf1, tib40, tib41, p1);
const u32 ml = (1 << ((p0 & 3) * 8)) - 1;
const u32 ml = (1u << ((p0 & 3) * 8)) - 1;
const u32 mr = ~ml;
switch (p0 / 4)
@ -1530,7 +1530,7 @@ static u32 rule_op_mangle_insert (const u32 p0, const u32 p1, u32 buf0[4], u32 b
const u32 p1n = p1 << ((p0 & 3) * 8);
const u32 ml = (1 << ((p0 & 3) * 8)) - 1;
const u32 ml = (1u << ((p0 & 3) * 8)) - 1;
const u32 mr = 0xffffff00 << ((p0 & 3) * 8);

View File

@ -4584,7 +4584,7 @@ void set_cpu_affinity (char *cpu_affinity)
}
#ifdef _WIN
aff_mask |= 1 << (cpu_id - 1);
aff_mask |= 1u << (cpu_id - 1);
#elif _POSIX
CPU_SET ((cpu_id - 1), &cpuset);
#endif
@ -5508,7 +5508,7 @@ uint setup_opencl_platforms_filter (char *opencl_platforms)
exit (-1);
}
opencl_platforms_filter |= 1 << (platform - 1);
opencl_platforms_filter |= 1u << (platform - 1);
} while ((next = strtok (NULL, ",")) != NULL);
@ -5543,7 +5543,7 @@ u32 setup_devices_filter (char *opencl_devices)
exit (-1);
}
devices_filter |= 1 << (device_id - 1);
devices_filter |= 1u << (device_id - 1);
} while ((next = strtok (NULL, ",")) != NULL);
@ -5578,7 +5578,7 @@ cl_device_type setup_device_types_filter (char *opencl_device_types)
exit (-1);
}
device_types_filter |= 1 << device_type;
device_types_filter |= 1u << device_type;
} while ((next = strtok (NULL, ",")) != NULL);
@ -10099,7 +10099,7 @@ int bcrypt_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf)
char *iter_pos = input_buf + 4;
salt->salt_iter = 1 << atoi (iter_pos);
salt->salt_iter = 1u << atoi (iter_pos);
char *salt_pos = strchr (iter_pos, '$');
@ -10835,7 +10835,7 @@ int phpass_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf)
char *iter_pos = input_buf + 3;
uint salt_iter = 1 << itoa64_to_int (iter_pos[0]);
uint salt_iter = 1u << itoa64_to_int (iter_pos[0]);
if (salt_iter > 0x80000000) return (PARSER_SALT_ITERATION);
@ -13445,7 +13445,7 @@ int sha1aix_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf)
salt->salt_sign[0] = atoi (salt_iter);
salt->salt_iter = (1 << atoi (salt_iter)) - 1;
salt->salt_iter = (1u << atoi (salt_iter)) - 1;
hash_pos++;
@ -13494,7 +13494,7 @@ int sha256aix_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf)
salt->salt_sign[0] = atoi (salt_iter);
salt->salt_iter = (1 << atoi (salt_iter)) - 1;
salt->salt_iter = (1u << atoi (salt_iter)) - 1;
hash_pos++;
@ -13546,7 +13546,7 @@ int sha512aix_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf)
salt->salt_sign[0] = atoi (salt_iter);
salt->salt_iter = (1 << atoi (salt_iter)) - 1;
salt->salt_iter = (1u << atoi (salt_iter)) - 1;
hash_pos++;
@ -14479,7 +14479,7 @@ int drupal7_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf)
char *iter_pos = input_buf + 3;
uint salt_iter = 1 << itoa64_to_int (iter_pos[0]);
uint salt_iter = 1u << itoa64_to_int (iter_pos[0]);
if (salt_iter > 0x80000000) return (PARSER_SALT_ITERATION);
@ -19060,7 +19060,7 @@ int seven_zip_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf)
salt->salt_sign[0] = iter;
salt->salt_iter = 1 << iter;
salt->salt_iter = 1u << iter;
/**
* digest
@ -19679,7 +19679,7 @@ int rar5_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf)
salt->salt_sign[0] = iterations;
salt->salt_iter = ((1 << iterations) + 32) - 1;
salt->salt_iter = ((1u << iterations) + 32) - 1;
/**
* digest buf