diff --git a/OpenCL/m03200-pure.cl b/OpenCL/m03200-pure.cl index 5f701666f..7d874c130 100644 --- a/OpenCL/m03200-pure.cl +++ b/OpenCL/m03200-pure.cl @@ -300,6 +300,15 @@ CONSTANT_VK u32a c_sbox3[256] = 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6 }; +CONSTANT_VK u32a c_pbox[18] = +{ + 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, + 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, + 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, + 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, + 0x9216d5d9, 0x8979fb1b +}; + #define BF_ROUND(L,R,N) \ { \ u32 tmp; \ @@ -440,9 +449,12 @@ KERNEL_FQ void __attribute__((reqd_work_group_size(FIXED_LOCAL_SIZE, 1, 1))) m03 salt_buf[2] = salt_bufs[salt_pos].salt_buf[2]; salt_buf[3] = salt_bufs[salt_pos].salt_buf[3]; - /** - * do the key setup - */ + u32 P[18]; + + for (u32 i = 0; i < 18; i++) + { + P[i] = c_pbox[i]; + } LOCAL_VK u32 S0_all[FIXED_LOCAL_SIZE][256]; LOCAL_VK u32 S1_all[FIXED_LOCAL_SIZE][256]; @@ -454,17 +466,6 @@ KERNEL_FQ void __attribute__((reqd_work_group_size(FIXED_LOCAL_SIZE, 1, 1))) m03 LOCAL_AS u32 *S2 = S2_all[lid]; LOCAL_AS u32 *S3 = S3_all[lid]; - // initstate - - u32 P[18] = - { - 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, - 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, - 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, - 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, - 0x9216d5d9, 0x8979fb1b - }; - for (u32 i = 0; i < 256; i++) { S0[i] = c_sbox0[i]; diff --git a/docs/changes.txt b/docs/changes.txt index 711e1407d..d11b9d156 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -56,6 +56,7 @@ ## Improvements ## +- Startup Checks: Improved the pidfile check: Do not just check for existing PID but also check executable filename - Cracking bcrypt and Password Safe v2: Use a feedback from the OpenCL runtime to dynamically find out optimal thread count - Bitcoin Wallet: Be more user friendly by allowing a larger data range for ckey and public_key - Building: Updated BUILD.md diff --git a/src/backend.c b/src/backend.c index 4c19b24fa..3d56ab9d8 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1302,13 +1302,13 @@ int hc_cuModuleLoadDataExLog (hashcat_ctx_t *hashcat_ctx, CUmodule *module, cons const int rc_cuModuleLoadDataEx = hc_cuModuleLoadDataEx (hashcat_ctx, module, image, 6, opts, vals); #if defined (DEBUG) - printf ("cuModuleLoadDataEx() Info Log (%ld):\n%s\n\n", strlen (info_log), info_log); - printf ("cuModuleLoadDataEx() Error Log (%ld):\n%s\n\n", strlen (error_log), error_log); + printf ("cuModuleLoadDataEx() Info Log (%d):\n%s\n\n", (int) strlen (info_log), info_log); + printf ("cuModuleLoadDataEx() Error Log (%d):\n%s\n\n", (int) strlen (error_log), error_log); #else if (rc_cuModuleLoadDataEx == -1) { - printf ("cuModuleLoadDataEx() Info Log (%ld):\n%s\n\n", strlen (info_log), info_log); - printf ("cuModuleLoadDataEx() Error Log (%ld):\n%s\n\n", strlen (error_log), error_log); + printf ("cuModuleLoadDataEx() Info Log (%d):\n%s\n\n", (int) strlen (info_log), info_log); + printf ("cuModuleLoadDataEx() Error Log (%d):\n%s\n\n", (int) strlen (error_log), error_log); } #endif diff --git a/src/pidfile.c b/src/pidfile.c index 8654d41a8..a366d48ae 100644 --- a/src/pidfile.c +++ b/src/pidfile.c @@ -72,17 +72,46 @@ static int check_running_process (hashcat_ctx_t *hashcat_ctx) char *pidbin; - hc_asprintf (&pidbin, "/proc/%u/cmdline", pd->pid); + hc_asprintf (&pidbin, "/proc/%u/exe", pd->pid); if (hc_path_exist (pidbin) == true) { - event_log_error (hashcat_ctx, "Already an instance running on pid %u", pd->pid); + // pid info + + char *pidexe = (char *) hcmalloc (HCBUFSIZ_TINY); + + const ssize_t pidexe_len = readlink (pidbin, pidexe, HCBUFSIZ_TINY - 1); + + pidexe[pidexe_len] = 0; + + // self info + + char *selfexe = (char *) hcmalloc (HCBUFSIZ_TINY); + + const ssize_t selfexe_len = readlink ("/proc/self/exe", selfexe, HCBUFSIZ_TINY - 1); + + selfexe[selfexe_len] = 0; + + // compare + + const int r = strncmp (pidexe, selfexe, selfexe_len); + + if (r == 0) + { + event_log_error (hashcat_ctx, "Already an instance '%s' running on pid %u", pidexe, pd->pid); + } + + hcfree (selfexe); + + hcfree (pidexe); hcfree (pd); hcfree (pidbin); - return -1; + if (r == 0) return -1; + + return 0; } hcfree (pidbin);