mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-23 23:19:09 +00:00
Fix cached kernel checksum building on oversized device version or driver version strings
This commit is contained in:
parent
aa1b7408a0
commit
6efe557cdc
@ -2685,14 +2685,17 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
char *device_name_chksum = (char *) hcmalloc (hashcat_ctx, HCBUFSIZ_TINY); VERIFY_PTR (device_name_chksum);
|
||||
|
||||
#if defined (__x86_64__)
|
||||
snprintf (device_name_chksum, HCBUFSIZ_TINY - 1, "%d-%u-%u-%s-%s-%s-%d", 64, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, comptime);
|
||||
const size_t dnclen = snprintf (device_name_chksum, HCBUFSIZ_TINY - 1, "%d-%u-%u-%s-%s-%s-%d-%u", 64, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, comptime, user_options->opencl_vector_width);
|
||||
#else
|
||||
snprintf (device_name_chksum, HCBUFSIZ_TINY - 1, "%d-%u-%u-%s-%s-%s-%d", 32, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, comptime);
|
||||
const size_t dnclen = snprintf (device_name_chksum, HCBUFSIZ_TINY - 1, "%d-%u-%u-%s-%s-%s-%d-%u", 32, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, comptime, user_options->opencl_vector_width);
|
||||
#endif
|
||||
|
||||
u32 device_name_digest[4] = { 0 };
|
||||
|
||||
md5_64 ((u32 *) device_name_chksum, device_name_digest);
|
||||
for (size_t i = 0; i < dnclen; i += 64)
|
||||
{
|
||||
md5_64 ((u32 *) (device_name_chksum + i), device_name_digest);
|
||||
}
|
||||
|
||||
snprintf (device_name_chksum, HCBUFSIZ_TINY - 1, "%08x", device_name_digest[0]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user