diff --git a/src/hashes.c b/src/hashes.c index 5c498beff..8b9cc71eb 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -573,16 +573,12 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) * load hashes, part II: allocate required memory, set pointers */ - hash_t *hashes_buf; - void *digests_buf; + hash_t *hashes_buf = (hash_t *) hccalloc (hashes_avail, sizeof (hash_t)); + void *digests_buf = (void *) hccalloc (hashes_avail, hashconfig->dgst_size); salt_t *salts_buf = NULL; void *esalts_buf = NULL; void *hook_salts_buf = NULL; - hashes_buf = (hash_t *) hccalloc (hashes_avail, sizeof (hash_t)); - - digests_buf = (void *) hccalloc (hashes_avail, hashconfig->dgst_size); - if ((user_options->username == true) || (hashconfig->opts_type & OPTS_TYPE_HASH_COPY)) { u32 hash_pos; diff --git a/src/hwmon.c b/src/hwmon.c index 51201ebac..4a2306e41 100644 --- a/src/hwmon.c +++ b/src/hwmon.c @@ -324,7 +324,7 @@ static int hm_SYSFS_get_pp_dpm_sclk (hashcat_ctx_t *hashcat_ctx, const int devic return -1; } - int clock = 0; + int clockfreq = 0; while (!feof (fd)) { @@ -342,14 +342,14 @@ static int hm_SYSFS_get_pp_dpm_sclk (hashcat_ctx_t *hashcat_ctx, const int devic int profile = 0; - int rc = sscanf (ptr, "%d: %dMhz", &profile, &clock); + int rc = sscanf (ptr, "%d: %dMhz", &profile, &clockfreq); if (rc == 2) break; } fclose (fd); - *val = clock; + *val = clockfreq; hcfree (syspath); @@ -377,7 +377,7 @@ static int hm_SYSFS_get_pp_dpm_mclk (hashcat_ctx_t *hashcat_ctx, const int devic return -1; } - int clock = 0; + int clockfreq = 0; while (!feof (fd)) { @@ -395,14 +395,14 @@ static int hm_SYSFS_get_pp_dpm_mclk (hashcat_ctx_t *hashcat_ctx, const int devic int profile = 0; - int rc = sscanf (ptr, "%d: %dMhz", &profile, &clock); + int rc = sscanf (ptr, "%d: %dMhz", &profile, &clockfreq); if (rc == 2) break; } fclose (fd); - *val = clock; + *val = clockfreq; hcfree (syspath); @@ -712,13 +712,13 @@ static int hm_NVML_nvmlDeviceGetCount (hashcat_ctx_t *hashcat_ctx, unsigned int return 0; } -static int hm_NVML_nvmlDeviceGetHandleByIndex (hashcat_ctx_t *hashcat_ctx, unsigned int index, nvmlDevice_t *device) +static int hm_NVML_nvmlDeviceGetHandleByIndex (hashcat_ctx_t *hashcat_ctx, unsigned int device_index, nvmlDevice_t *device) { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; NVML_PTR *nvml = hwmon_ctx->hm_nvml; - const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetHandleByIndex (index, device); + const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetHandleByIndex (device_index, device); if (nvml_rc != NVML_SUCCESS) { @@ -836,13 +836,13 @@ static int hm_NVML_nvmlDeviceGetUtilizationRates (hashcat_ctx_t *hashcat_ctx, nv return 0; } -static int hm_NVML_nvmlDeviceGetClockInfo (hashcat_ctx_t *hashcat_ctx, nvmlDevice_t device, nvmlClockType_t type, unsigned int *clock) +static int hm_NVML_nvmlDeviceGetClockInfo (hashcat_ctx_t *hashcat_ctx, nvmlDevice_t device, nvmlClockType_t type, unsigned int *clockfreq) { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; NVML_PTR *nvml = hwmon_ctx->hm_nvml; - const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetClockInfo (device, type, clock); + const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetClockInfo (device, type, clockfreq); if (nvml_rc != NVML_SUCCESS) { @@ -2840,16 +2840,16 @@ int hm_get_memoryspeed_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 dev if (hwmon_ctx->hm_sysfs) { - int clock; + int clockfreq; - if (hm_SYSFS_get_pp_dpm_mclk (hashcat_ctx, device_id, &clock) == -1) + if (hm_SYSFS_get_pp_dpm_mclk (hashcat_ctx, device_id, &clockfreq) == -1) { hwmon_ctx->hm_device[device_id].memoryspeed_get_supported = false; return -1; } - return clock; + return clockfreq; } } @@ -2857,16 +2857,16 @@ int hm_get_memoryspeed_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 dev { if (hwmon_ctx->hm_nvml) { - unsigned int clock; + unsigned int clockfreq; - if (hm_NVML_nvmlDeviceGetClockInfo (hashcat_ctx, hwmon_ctx->hm_device[device_id].nvml, NVML_CLOCK_MEM, &clock) == -1) + if (hm_NVML_nvmlDeviceGetClockInfo (hashcat_ctx, hwmon_ctx->hm_device[device_id].nvml, NVML_CLOCK_MEM, &clockfreq) == -1) { hwmon_ctx->hm_device[device_id].memoryspeed_get_supported = false; return -1; } - return clock; + return clockfreq; } } @@ -2906,16 +2906,16 @@ int hm_get_corespeed_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 devic if (hwmon_ctx->hm_sysfs) { - int clock; + int clockfreq; - if (hm_SYSFS_get_pp_dpm_sclk (hashcat_ctx, device_id, &clock) == -1) + if (hm_SYSFS_get_pp_dpm_sclk (hashcat_ctx, device_id, &clockfreq) == -1) { hwmon_ctx->hm_device[device_id].corespeed_get_supported = false; return -1; } - return clock; + return clockfreq; } } @@ -2923,16 +2923,16 @@ int hm_get_corespeed_with_device_id (hashcat_ctx_t *hashcat_ctx, const u32 devic { if (hwmon_ctx->hm_nvml) { - unsigned int clock; + unsigned int clockfreq; - if (hm_NVML_nvmlDeviceGetClockInfo (hashcat_ctx, hwmon_ctx->hm_device[device_id].nvml, NVML_CLOCK_SM, &clock) == -1) + if (hm_NVML_nvmlDeviceGetClockInfo (hashcat_ctx, hwmon_ctx->hm_device[device_id].nvml, NVML_CLOCK_SM, &clockfreq) == -1) { hwmon_ctx->hm_device[device_id].corespeed_get_supported = false; return -1; } - return clock; + return clockfreq; } } diff --git a/src/mpsp.c b/src/mpsp.c index 6bc0cf657..8fa11f954 100644 --- a/src/mpsp.c +++ b/src/mpsp.c @@ -531,13 +531,13 @@ static void mp_setup_sys (cs_t *mp_sys) mp_sys[7].cs_len = pos; } } -static int mp_setup_usr (hashcat_ctx_t *hashcat_ctx, cs_t *mp_sys, cs_t *mp_usr, char *buf, u32 index) +static int mp_setup_usr (hashcat_ctx_t *hashcat_ctx, cs_t *mp_sys, cs_t *mp_usr, char *buf, const u32 userindex) { FILE *fp = fopen (buf, "rb"); if (fp == NULL) // feof() in case if file is empty { - const int rc = mp_expand (hashcat_ctx, buf, strlen (buf), mp_sys, mp_usr, index, 1); + const int rc = mp_expand (hashcat_ctx, buf, strlen (buf), mp_sys, mp_usr, userindex, 1); if (rc == -1) return -1; } @@ -576,7 +576,7 @@ static int mp_setup_usr (hashcat_ctx_t *hashcat_ctx, cs_t *mp_sys, cs_t *mp_usr, return -1; } - const int rc = mp_expand (hashcat_ctx, mp_file, len, mp_sys, mp_usr, index, 0); + const int rc = mp_expand (hashcat_ctx, mp_file, len, mp_sys, mp_usr, userindex, 0); if (rc == -1) return -1; } @@ -584,11 +584,11 @@ static int mp_setup_usr (hashcat_ctx_t *hashcat_ctx, cs_t *mp_sys, cs_t *mp_usr, return 0; } -static void mp_reset_usr (cs_t *mp_usr, u32 index) +static void mp_reset_usr (cs_t *mp_usr, const u32 userindex) { - mp_usr[index].cs_len = 0; + mp_usr[userindex].cs_len = 0; - memset (mp_usr[index].cs_buf, 0, sizeof (mp_usr[index].cs_buf)); + memset (mp_usr[userindex].cs_buf, 0, sizeof (mp_usr[userindex].cs_buf)); } static int sp_setup_tbl (hashcat_ctx_t *hashcat_ctx)