From fd8150769d7e0d4aeec443fe5906faf7ce4ddb7f Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 11 Sep 2019 18:05:01 -0700 Subject: [PATCH] Add casts where needed in C++ mode Otherwise, -fpermissive must be passed. --- include/filehandling.h | 2 +- src/backend.c | 178 ++++++++++++++++++++--------------------- src/brain.c | 4 +- src/filehandling.c | 2 +- src/folder.c | 6 +- src/hwmon.c | 94 +++++++++++----------- src/outfile_check.c | 2 +- src/potfile.c | 4 +- src/rp.c | 2 +- src/rp_cpu.c | 16 ++-- src/shared.c | 2 +- src/tuningdb.c | 8 +- 12 files changed, 161 insertions(+), 159 deletions(-) diff --git a/include/filehandling.h b/include/filehandling.h index 8b73699d4..88e9dc9d5 100644 --- a/include/filehandling.h +++ b/include/filehandling.h @@ -29,7 +29,7 @@ void hc_fflush (HCFILE *fp); void hc_fclose (HCFILE *fp); int hc_fputc (int c, HCFILE *fp); char *hc_fgets (char *buf, int len, HCFILE *fp); -size_t hc_fwrite (void *ptr, size_t size, size_t nmemb, HCFILE *fp); +size_t hc_fwrite (const void *ptr, size_t size, size_t nmemb, HCFILE *fp); size_t hc_fread (void *ptr, size_t size, size_t nmemb, HCFILE *fp); size_t fgetl (HCFILE *fp, char *line_buf, const size_t line_sz); diff --git a/src/backend.c b/src/backend.c index 832175b8a..fbf38be10 100644 --- a/src/backend.c +++ b/src/backend.c @@ -295,7 +295,7 @@ static bool cuda_test_instruction (hashcat_ctx_t *hashcat_ctx, const int sm_majo backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - NVRTC_PTR *nvrtc = backend_ctx->nvrtc; + NVRTC_PTR *nvrtc = (NVRTC_PTR *) backend_ctx->nvrtc; const nvrtcResult NVRTC_err = nvrtc->nvrtcCompileProgram (program, 3, (const char * const *) nvrtc_options); @@ -333,7 +333,7 @@ static bool cuda_test_instruction (hashcat_ctx_t *hashcat_ctx, const int sm_majo return false; } - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; CUmodule cuda_module; @@ -363,7 +363,7 @@ static bool opencl_test_instruction (hashcat_ctx_t *hashcat_ctx, cl_context cont backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; // LLVM seems to write an error message (if there's an error) directly to stderr // and not (as supposted to) into buffer for later request using clGetProgramBuildInfo() @@ -667,7 +667,7 @@ int nvrtc_init (hashcat_ctx_t *hashcat_ctx) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - NVRTC_PTR *nvrtc = backend_ctx->nvrtc; + NVRTC_PTR *nvrtc = (NVRTC_PTR *) backend_ctx->nvrtc; memset (nvrtc, 0, sizeof (NVRTC_PTR)); @@ -737,7 +737,7 @@ void nvrtc_close (hashcat_ctx_t *hashcat_ctx) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - NVRTC_PTR *nvrtc = backend_ctx->nvrtc; + NVRTC_PTR *nvrtc = (NVRTC_PTR *) backend_ctx->nvrtc; if (nvrtc) { @@ -756,7 +756,7 @@ int hc_nvrtcCreateProgram (hashcat_ctx_t *hashcat_ctx, nvrtcProgram *prog, const { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - NVRTC_PTR *nvrtc = backend_ctx->nvrtc; + NVRTC_PTR *nvrtc = (NVRTC_PTR *) backend_ctx->nvrtc; const nvrtcResult NVRTC_err = nvrtc->nvrtcCreateProgram (prog, src, name, numHeaders, headers, includeNames); @@ -774,7 +774,7 @@ int hc_nvrtcDestroyProgram (hashcat_ctx_t *hashcat_ctx, nvrtcProgram *prog) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - NVRTC_PTR *nvrtc = backend_ctx->nvrtc; + NVRTC_PTR *nvrtc = (NVRTC_PTR *) backend_ctx->nvrtc; const nvrtcResult NVRTC_err = nvrtc->nvrtcDestroyProgram (prog); @@ -792,7 +792,7 @@ int hc_nvrtcCompileProgram (hashcat_ctx_t *hashcat_ctx, nvrtcProgram prog, int n { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - NVRTC_PTR *nvrtc = backend_ctx->nvrtc; + NVRTC_PTR *nvrtc = (NVRTC_PTR *) backend_ctx->nvrtc; const nvrtcResult NVRTC_err = nvrtc->nvrtcCompileProgram (prog, numOptions, options); @@ -810,7 +810,7 @@ int hc_nvrtcGetProgramLogSize (hashcat_ctx_t *hashcat_ctx, nvrtcProgram prog, si { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - NVRTC_PTR *nvrtc = backend_ctx->nvrtc; + NVRTC_PTR *nvrtc = (NVRTC_PTR *) backend_ctx->nvrtc; const nvrtcResult NVRTC_err = nvrtc->nvrtcGetProgramLogSize (prog, logSizeRet); @@ -828,7 +828,7 @@ int hc_nvrtcGetProgramLog (hashcat_ctx_t *hashcat_ctx, nvrtcProgram prog, char * { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - NVRTC_PTR *nvrtc = backend_ctx->nvrtc; + NVRTC_PTR *nvrtc = (NVRTC_PTR *) backend_ctx->nvrtc; const nvrtcResult NVRTC_err = nvrtc->nvrtcGetProgramLog (prog, log); @@ -846,7 +846,7 @@ int hc_nvrtcGetPTXSize (hashcat_ctx_t *hashcat_ctx, nvrtcProgram prog, size_t *p { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - NVRTC_PTR *nvrtc = backend_ctx->nvrtc; + NVRTC_PTR *nvrtc = (NVRTC_PTR *) backend_ctx->nvrtc; const nvrtcResult NVRTC_err = nvrtc->nvrtcGetPTXSize (prog, ptxSizeRet); @@ -864,7 +864,7 @@ int hc_nvrtcGetPTX (hashcat_ctx_t *hashcat_ctx, nvrtcProgram prog, char *ptx) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - NVRTC_PTR *nvrtc = backend_ctx->nvrtc; + NVRTC_PTR *nvrtc = (NVRTC_PTR *) backend_ctx->nvrtc; const nvrtcResult NVRTC_err = nvrtc->nvrtcGetPTX (prog, ptx); @@ -882,7 +882,7 @@ int hc_nvrtcVersion (hashcat_ctx_t *hashcat_ctx, int *major, int *minor) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - NVRTC_PTR *nvrtc = backend_ctx->nvrtc; + NVRTC_PTR *nvrtc = (NVRTC_PTR *) backend_ctx->nvrtc; const nvrtcResult NVRTC_err = nvrtc->nvrtcVersion (major, minor); @@ -902,7 +902,7 @@ int cuda_init (hashcat_ctx_t *hashcat_ctx) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; memset (cuda, 0, sizeof (CUDA_PTR)); @@ -1000,7 +1000,7 @@ void cuda_close (hashcat_ctx_t *hashcat_ctx) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; if (cuda) { @@ -1019,7 +1019,7 @@ int hc_cuInit (hashcat_ctx_t *hashcat_ctx, unsigned int Flags) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuInit (Flags); @@ -1046,7 +1046,7 @@ int hc_cuDeviceGetAttribute (hashcat_ctx_t *hashcat_ctx, int *pi, CUdevice_attri { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuDeviceGetAttribute (pi, attrib, dev); @@ -1073,7 +1073,7 @@ int hc_cuDeviceGetCount (hashcat_ctx_t *hashcat_ctx, int *count) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuDeviceGetCount (count); @@ -1100,7 +1100,7 @@ int hc_cuDeviceGet (hashcat_ctx_t *hashcat_ctx, CUdevice* device, int ordinal) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuDeviceGet (device, ordinal); @@ -1127,7 +1127,7 @@ int hc_cuDeviceGetName (hashcat_ctx_t *hashcat_ctx, char *name, int len, CUdevic { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuDeviceGetName (name, len, dev); @@ -1154,7 +1154,7 @@ int hc_cuDeviceTotalMem (hashcat_ctx_t *hashcat_ctx, size_t *bytes, CUdevice dev { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuDeviceTotalMem (bytes, dev); @@ -1181,7 +1181,7 @@ int hc_cuDriverGetVersion (hashcat_ctx_t *hashcat_ctx, int *driverVersion) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuDriverGetVersion (driverVersion); @@ -1208,7 +1208,7 @@ int hc_cuCtxCreate (hashcat_ctx_t *hashcat_ctx, CUcontext *pctx, unsigned int fl { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuCtxCreate (pctx, flags, dev); @@ -1235,7 +1235,7 @@ int hc_cuCtxDestroy (hashcat_ctx_t *hashcat_ctx, CUcontext ctx) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuCtxDestroy (ctx); @@ -1262,7 +1262,7 @@ int hc_cuModuleLoadDataEx (hashcat_ctx_t *hashcat_ctx, CUmodule *module, const v { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuModuleLoadDataEx (module, image, numOptions, options, optionValues); @@ -1289,8 +1289,8 @@ int hc_cuModuleLoadDataExLog (hashcat_ctx_t *hashcat_ctx, CUmodule *module, cons { #define LOG_SIZE 8192 - char *info_log = hcmalloc (LOG_SIZE); - char *error_log = hcmalloc (LOG_SIZE); + char *info_log = (char *) hcmalloc (LOG_SIZE); + char *error_log = (char *) hcmalloc (LOG_SIZE); CUjit_option opts[6]; void *vals[6]; @@ -1336,7 +1336,7 @@ int hc_cuModuleUnload (hashcat_ctx_t *hashcat_ctx, CUmodule hmod) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuModuleUnload (hmod); @@ -1363,7 +1363,7 @@ int hc_cuCtxSetCurrent (hashcat_ctx_t *hashcat_ctx, CUcontext ctx) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuCtxSetCurrent (ctx); @@ -1390,7 +1390,7 @@ int hc_cuMemAlloc (hashcat_ctx_t *hashcat_ctx, CUdeviceptr *dptr, size_t bytesiz { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuMemAlloc (dptr, bytesize); @@ -1417,7 +1417,7 @@ int hc_cuMemFree (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dptr) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuMemFree (dptr); @@ -1444,7 +1444,7 @@ int hc_cuMemcpyDtoH (hashcat_ctx_t *hashcat_ctx, void *dstHost, CUdeviceptr srcD { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuMemcpyDtoH (dstHost, srcDevice, ByteCount); @@ -1471,7 +1471,7 @@ int hc_cuMemcpyDtoD (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dstDevice, CUdevice { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuMemcpyDtoD (dstDevice, srcDevice, ByteCount); @@ -1498,7 +1498,7 @@ int hc_cuMemcpyHtoD (hashcat_ctx_t *hashcat_ctx, CUdeviceptr dstDevice, const vo { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuMemcpyHtoD (dstDevice, srcHost, ByteCount); @@ -1525,7 +1525,7 @@ int hc_cuModuleGetFunction (hashcat_ctx_t *hashcat_ctx, CUfunction *hfunc, CUmod { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuModuleGetFunction (hfunc, hmod, name); @@ -1552,7 +1552,7 @@ int hc_cuModuleGetGlobal (hashcat_ctx_t *hashcat_ctx, CUdeviceptr *dptr, size_t { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuModuleGetGlobal (dptr, bytes, hmod, name); @@ -1579,7 +1579,7 @@ int hc_cuMemGetInfo (hashcat_ctx_t *hashcat_ctx, size_t *free, size_t *total) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuMemGetInfo (free, total); @@ -1606,7 +1606,7 @@ int hc_cuFuncGetAttribute (hashcat_ctx_t *hashcat_ctx, int *pi, CUfunction_attri { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuFuncGetAttribute (pi, attrib, hfunc); @@ -1633,7 +1633,7 @@ int hc_cuFuncSetAttribute (hashcat_ctx_t *hashcat_ctx, CUfunction hfunc, CUfunct { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuFuncSetAttribute (hfunc, attrib, value); @@ -1660,7 +1660,7 @@ int hc_cuStreamCreate (hashcat_ctx_t *hashcat_ctx, CUstream *phStream, unsigned { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuStreamCreate (phStream, Flags); @@ -1687,7 +1687,7 @@ int hc_cuStreamDestroy (hashcat_ctx_t *hashcat_ctx, CUstream hStream) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuStreamDestroy (hStream); @@ -1714,7 +1714,7 @@ int hc_cuStreamSynchronize (hashcat_ctx_t *hashcat_ctx, CUstream hStream) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuStreamSynchronize (hStream); @@ -1741,7 +1741,7 @@ int hc_cuLaunchKernel (hashcat_ctx_t *hashcat_ctx, CUfunction f, unsigned int gr { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuLaunchKernel (f, gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ, sharedMemBytes, hStream, kernelParams, extra); @@ -1768,7 +1768,7 @@ int hc_cuCtxSynchronize (hashcat_ctx_t *hashcat_ctx) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuCtxSynchronize (); @@ -1795,7 +1795,7 @@ int hc_cuEventCreate (hashcat_ctx_t *hashcat_ctx, CUevent *phEvent, unsigned int { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuEventCreate (phEvent, Flags); @@ -1822,7 +1822,7 @@ int hc_cuEventDestroy (hashcat_ctx_t *hashcat_ctx, CUevent hEvent) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuEventDestroy (hEvent); @@ -1849,7 +1849,7 @@ int hc_cuEventElapsedTime (hashcat_ctx_t *hashcat_ctx, float *pMilliseconds, CUe { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuEventElapsedTime (pMilliseconds, hStart, hEnd); @@ -1876,7 +1876,7 @@ int hc_cuEventQuery (hashcat_ctx_t *hashcat_ctx, CUevent hEvent) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuEventQuery (hEvent); @@ -1903,7 +1903,7 @@ int hc_cuEventRecord (hashcat_ctx_t *hashcat_ctx, CUevent hEvent, CUstream hStre { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuEventRecord (hEvent, hStream); @@ -1930,7 +1930,7 @@ int hc_cuEventSynchronize (hashcat_ctx_t *hashcat_ctx, CUevent hEvent) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuEventSynchronize (hEvent); @@ -1957,7 +1957,7 @@ int hc_cuCtxSetCacheConfig (hashcat_ctx_t *hashcat_ctx, CUfunc_cache config) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuCtxSetCacheConfig (config); @@ -1984,7 +1984,7 @@ int hc_cuCtxPushCurrent (hashcat_ctx_t *hashcat_ctx, CUcontext ctx) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuCtxPushCurrent (ctx); @@ -2011,7 +2011,7 @@ int hc_cuCtxPopCurrent (hashcat_ctx_t *hashcat_ctx, CUcontext *pctx) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - CUDA_PTR *cuda = backend_ctx->cuda; + CUDA_PTR *cuda = (CUDA_PTR *) backend_ctx->cuda; const CUresult CU_err = cuda->cuCtxPopCurrent (pctx); @@ -2041,7 +2041,7 @@ int ocl_init (hashcat_ctx_t *hashcat_ctx) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; memset (ocl, 0, sizeof (OCL_PTR)); @@ -2101,7 +2101,7 @@ void ocl_close (hashcat_ctx_t *hashcat_ctx) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; if (ocl) { @@ -2120,7 +2120,7 @@ int hc_clEnqueueNDRangeKernel (hashcat_ctx_t *hashcat_ctx, cl_command_queue comm { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clEnqueueNDRangeKernel (command_queue, kernel, work_dim, global_work_offset, global_work_size, local_work_size, num_events_in_wait_list, event_wait_list, event); @@ -2138,7 +2138,7 @@ int hc_clGetEventInfo (hashcat_ctx_t *hashcat_ctx, cl_event event, cl_event_info { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clGetEventInfo (event, param_name, param_value_size, param_value, param_value_size_ret); @@ -2156,7 +2156,7 @@ int hc_clFlush (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clFlush (command_queue); @@ -2174,7 +2174,7 @@ int hc_clFinish (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clFinish (command_queue); @@ -2192,7 +2192,7 @@ int hc_clSetKernelArg (hashcat_ctx_t *hashcat_ctx, cl_kernel kernel, cl_uint arg { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clSetKernelArg (kernel, arg_index, arg_size, arg_value); @@ -2210,7 +2210,7 @@ int hc_clEnqueueWriteBuffer (hashcat_ctx_t *hashcat_ctx, cl_command_queue comman { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clEnqueueWriteBuffer (command_queue, buffer, blocking_write, offset, size, ptr, num_events_in_wait_list, event_wait_list, event); @@ -2228,7 +2228,7 @@ int hc_clEnqueueCopyBuffer (hashcat_ctx_t *hashcat_ctx, cl_command_queue command { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clEnqueueCopyBuffer (command_queue, src_buffer, dst_buffer, src_offset, dst_offset, size, num_events_in_wait_list, event_wait_list, event); @@ -2246,7 +2246,7 @@ int hc_clEnqueueReadBuffer (hashcat_ctx_t *hashcat_ctx, cl_command_queue command { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clEnqueueReadBuffer (command_queue, buffer, blocking_read, offset, size, ptr, num_events_in_wait_list, event_wait_list, event); @@ -2264,7 +2264,7 @@ int hc_clGetPlatformIDs (hashcat_ctx_t *hashcat_ctx, cl_uint num_entries, cl_pla { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clGetPlatformIDs (num_entries, platforms, num_platforms); @@ -2282,7 +2282,7 @@ int hc_clGetPlatformInfo (hashcat_ctx_t *hashcat_ctx, cl_platform_id platform, c { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clGetPlatformInfo (platform, param_name, param_value_size, param_value, param_value_size_ret); @@ -2300,7 +2300,7 @@ int hc_clGetDeviceIDs (hashcat_ctx_t *hashcat_ctx, cl_platform_id platform, cl_d { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clGetDeviceIDs (platform, device_type, num_entries, devices, num_devices); @@ -2318,7 +2318,7 @@ int hc_clGetDeviceInfo (hashcat_ctx_t *hashcat_ctx, cl_device_id device, cl_devi { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clGetDeviceInfo (device, param_name, param_value_size, param_value, param_value_size_ret); @@ -2336,7 +2336,7 @@ int hc_clCreateContext (hashcat_ctx_t *hashcat_ctx, const cl_context_properties { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; cl_int CL_err; @@ -2356,7 +2356,7 @@ int hc_clCreateCommandQueue (hashcat_ctx_t *hashcat_ctx, cl_context context, cl_ { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; cl_int CL_err; @@ -2376,7 +2376,7 @@ int hc_clCreateBuffer (hashcat_ctx_t *hashcat_ctx, cl_context context, cl_mem_fl { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; cl_int CL_err; @@ -2396,7 +2396,7 @@ int hc_clCreateProgramWithSource (hashcat_ctx_t *hashcat_ctx, cl_context context { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; cl_int CL_err; @@ -2416,7 +2416,7 @@ int hc_clCreateProgramWithBinary (hashcat_ctx_t *hashcat_ctx, cl_context context { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; cl_int CL_err; @@ -2436,7 +2436,7 @@ int hc_clBuildProgram (hashcat_ctx_t *hashcat_ctx, cl_program program, cl_uint n { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clBuildProgram (program, num_devices, device_list, options, pfn_notify, user_data); @@ -2454,7 +2454,7 @@ int hc_clCreateKernel (hashcat_ctx_t *hashcat_ctx, cl_program program, const cha { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; cl_int CL_err; @@ -2474,7 +2474,7 @@ int hc_clReleaseMemObject (hashcat_ctx_t *hashcat_ctx, cl_mem mem) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clReleaseMemObject (mem); @@ -2492,7 +2492,7 @@ int hc_clReleaseKernel (hashcat_ctx_t *hashcat_ctx, cl_kernel kernel) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clReleaseKernel (kernel); @@ -2510,7 +2510,7 @@ int hc_clReleaseProgram (hashcat_ctx_t *hashcat_ctx, cl_program program) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clReleaseProgram (program); @@ -2528,7 +2528,7 @@ int hc_clReleaseCommandQueue (hashcat_ctx_t *hashcat_ctx, cl_command_queue comma { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clReleaseCommandQueue (command_queue); @@ -2546,7 +2546,7 @@ int hc_clReleaseContext (hashcat_ctx_t *hashcat_ctx, cl_context context) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clReleaseContext (context); @@ -2564,7 +2564,7 @@ int hc_clEnqueueMapBuffer (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_ { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; cl_int CL_err; @@ -2584,7 +2584,7 @@ int hc_clEnqueueUnmapMemObject (hashcat_ctx_t *hashcat_ctx, cl_command_queue com { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clEnqueueUnmapMemObject (command_queue, memobj, mapped_ptr, num_events_in_wait_list, event_wait_list, event); @@ -2602,7 +2602,7 @@ int hc_clGetKernelWorkGroupInfo (hashcat_ctx_t *hashcat_ctx, cl_kernel kernel, c { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clGetKernelWorkGroupInfo (kernel, device, param_name, param_value_size, param_value, param_value_size_ret); @@ -2620,7 +2620,7 @@ int hc_clGetProgramBuildInfo (hashcat_ctx_t *hashcat_ctx, cl_program program, cl { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clGetProgramBuildInfo (program, device, param_name, param_value_size, param_value, param_value_size_ret); @@ -2638,7 +2638,7 @@ int hc_clGetProgramInfo (hashcat_ctx_t *hashcat_ctx, cl_program program, cl_prog { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clGetProgramInfo (program, param_name, param_value_size, param_value, param_value_size_ret); @@ -2656,7 +2656,7 @@ int hc_clWaitForEvents (hashcat_ctx_t *hashcat_ctx, cl_uint num_events, const cl { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clWaitForEvents (num_events, event_list); @@ -2674,7 +2674,7 @@ int hc_clGetEventProfilingInfo (hashcat_ctx_t *hashcat_ctx, cl_event event, cl_p { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clGetEventProfilingInfo (event, param_name, param_value_size, param_value, param_value_size_ret); @@ -2692,7 +2692,7 @@ int hc_clReleaseEvent (hashcat_ctx_t *hashcat_ctx, cl_event event) { backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; const cl_int CL_err = ocl->clReleaseEvent (event); @@ -5606,7 +5606,7 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_EXTENSIONS, 0, NULL, &device_extensions_size) == -1) return -1; - char *device_extensions = hcmalloc (device_extensions_size + 1); + char *device_extensions = (char *) hcmalloc (device_extensions_size + 1); if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_EXTENSIONS, device_extensions_size, device_extensions, NULL) == -1) return -1; @@ -6070,7 +6070,7 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) cl_int CL_err; - OCL_PTR *ocl = backend_ctx->ocl; + OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl; tmp_device[c] = ocl->clCreateBuffer (context, CL_MEM_READ_WRITE, MAX_ALLOC_CHECKS_SIZE, NULL, &CL_err); diff --git a/src/brain.c b/src/brain.c index d67170cd4..3685d5111 100644 --- a/src/brain.c +++ b/src/brain.c @@ -66,7 +66,7 @@ u32 brain_compute_session (hashcat_ctx_t *hashcat_ctx) // digest u32 digests_cnt = hashes->digests_cnt; - u32 *digests_buf = hashes->digests_buf; + u32 *digests_buf = (u32 *) hashes->digests_buf; XXH64_update (state, digests_buf, digests_cnt * hashconfig->dgst_size); @@ -2306,7 +2306,7 @@ void *brain_server_handle_client (void *p) // short global alloc - brain_server_db_short_t *brain_server_db_short = hcmalloc (sizeof (brain_server_db_short_t)); + brain_server_db_short_t *brain_server_db_short = (brain_server_db_short_t *) hcmalloc (sizeof (brain_server_db_short_t)); brain_server_db_short->short_cnt = 0; brain_server_db_short->short_buf = (brain_server_hash_short_t *) hccalloc (passwords_max, sizeof (brain_server_hash_short_t)); diff --git a/src/filehandling.c b/src/filehandling.c index 9ea564f2a..0ed5fd1ab 100644 --- a/src/filehandling.c +++ b/src/filehandling.c @@ -137,7 +137,7 @@ size_t hc_fread (void *ptr, size_t size, size_t nmemb, HCFILE *fp) return n; } -size_t hc_fwrite (void *ptr, size_t size, size_t nmemb, HCFILE *fp) +size_t hc_fwrite (const void *ptr, size_t size, size_t nmemb, HCFILE *fp) { size_t n = -1; diff --git a/src/folder.c b/src/folder.c index 27b4837cb..db1e495b0 100644 --- a/src/folder.c +++ b/src/folder.c @@ -340,7 +340,7 @@ int folder_config_init (hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const char *ins return -1; } - char *install_dir = hcmalloc (HCBUFSIZ_TINY); + char *install_dir = (char *) hcmalloc (HCBUFSIZ_TINY); get_install_dir (install_dir, resolved_exec_path); @@ -359,8 +359,8 @@ int folder_config_init (hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const char *ins const char *home_dir = pwp->pw_dir; - profile_dir = hcmalloc (HCBUFSIZ_TINY); - session_dir = hcmalloc (HCBUFSIZ_TINY); + profile_dir = (char *) hcmalloc (HCBUFSIZ_TINY); + session_dir = (char *) hcmalloc (HCBUFSIZ_TINY); get_profile_dir (profile_dir, home_dir); get_session_dir (session_dir, profile_dir); diff --git a/src/hwmon.c b/src/hwmon.c index 905ce6e61..cc1414da5 100644 --- a/src/hwmon.c +++ b/src/hwmon.c @@ -18,7 +18,7 @@ static bool sysfs_init (hashcat_ctx_t *hashcat_ctx) { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - SYSFS_PTR *sysfs = hwmon_ctx->hm_sysfs; + SYSFS_PTR *sysfs = (SYSFS_PTR *) hwmon_ctx->hm_sysfs; memset (sysfs, 0, sizeof (SYSFS_PTR)); @@ -37,7 +37,7 @@ static void sysfs_close (hashcat_ctx_t *hashcat_ctx) { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - SYSFS_PTR *sysfs = hwmon_ctx->hm_sysfs; + SYSFS_PTR *sysfs = (SYSFS_PTR *) hwmon_ctx->hm_sysfs; if (sysfs) { @@ -69,7 +69,7 @@ static char *hm_SYSFS_get_syspath_hwmon (hashcat_ctx_t *hashcat_ctx, const int b return NULL; } - char *hwmon = hcmalloc (HCBUFSIZ_TINY); + char *hwmon = (char *) hcmalloc (HCBUFSIZ_TINY); snprintf (hwmon, HCBUFSIZ_TINY, "%s/hwmon", syspath); @@ -405,7 +405,7 @@ static int nvml_init (hashcat_ctx_t *hashcat_ctx) { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVML_PTR *nvml = hwmon_ctx->hm_nvml; + NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml; memset (nvml, 0, sizeof (NVML_PTR)); @@ -542,7 +542,7 @@ static void nvml_close (hashcat_ctx_t *hashcat_ctx) { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVML_PTR *nvml = hwmon_ctx->hm_nvml; + NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml; if (nvml) { @@ -562,9 +562,9 @@ static int hm_NVML_nvmlInit (hashcat_ctx_t *hashcat_ctx) { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVML_PTR *nvml = hwmon_ctx->hm_nvml; + NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml; - const nvmlReturn_t nvml_rc = nvml->nvmlInit (); + const nvmlReturn_t nvml_rc = (nvmlReturn_t) nvml->nvmlInit (); if (nvml_rc != NVML_SUCCESS) { @@ -582,9 +582,9 @@ static int hm_NVML_nvmlShutdown (hashcat_ctx_t *hashcat_ctx) { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVML_PTR *nvml = hwmon_ctx->hm_nvml; + NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml; - const nvmlReturn_t nvml_rc = nvml->nvmlShutdown (); + const nvmlReturn_t nvml_rc = (nvmlReturn_t) nvml->nvmlShutdown (); if (nvml_rc != NVML_SUCCESS) { @@ -602,7 +602,7 @@ static int hm_NVML_nvmlDeviceGetCount (hashcat_ctx_t *hashcat_ctx, unsigned int { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVML_PTR *nvml = hwmon_ctx->hm_nvml; + NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml; const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetCount (deviceCount); @@ -622,7 +622,7 @@ static int hm_NVML_nvmlDeviceGetHandleByIndex (hashcat_ctx_t *hashcat_ctx, unsig { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVML_PTR *nvml = hwmon_ctx->hm_nvml; + NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml; const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetHandleByIndex (device_index, device); @@ -642,7 +642,7 @@ static int hm_NVML_nvmlDeviceGetTemperature (hashcat_ctx_t *hashcat_ctx, nvmlDev { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVML_PTR *nvml = hwmon_ctx->hm_nvml; + NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml; const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetTemperature (device, sensorType, temp); @@ -662,7 +662,7 @@ static int hm_NVML_nvmlDeviceGetFanSpeed (hashcat_ctx_t *hashcat_ctx, nvmlDevice { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVML_PTR *nvml = hwmon_ctx->hm_nvml; + NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml; const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetFanSpeed (device, speed); @@ -682,7 +682,7 @@ static int hm_NVML_nvmlDeviceGetUtilizationRates (hashcat_ctx_t *hashcat_ctx, nv { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVML_PTR *nvml = hwmon_ctx->hm_nvml; + NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml; const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetUtilizationRates (device, utilization); @@ -702,7 +702,7 @@ static int hm_NVML_nvmlDeviceGetClockInfo (hashcat_ctx_t *hashcat_ctx, nvmlDevic { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVML_PTR *nvml = hwmon_ctx->hm_nvml; + NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml; const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetClockInfo (device, type, clockfreq); @@ -722,7 +722,7 @@ static int hm_NVML_nvmlDeviceGetTemperatureThreshold (hashcat_ctx_t *hashcat_ctx { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVML_PTR *nvml = hwmon_ctx->hm_nvml; + NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml; const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetTemperatureThreshold (device, thresholdType, temp); @@ -742,7 +742,7 @@ static int hm_NVML_nvmlDeviceGetCurrPcieLinkWidth (hashcat_ctx_t *hashcat_ctx, n { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVML_PTR *nvml = hwmon_ctx->hm_nvml; + NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml; const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetCurrPcieLinkWidth (device, currLinkWidth); @@ -762,7 +762,7 @@ static int hm_NVML_nvmlDeviceGetPciInfo (hashcat_ctx_t *hashcat_ctx, nvmlDevice_ { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVML_PTR *nvml = hwmon_ctx->hm_nvml; + NVML_PTR *nvml = (NVML_PTR *) hwmon_ctx->hm_nvml; const nvmlReturn_t nvml_rc = nvml->nvmlDeviceGetPciInfo (device, pci); @@ -784,7 +784,7 @@ static int nvapi_init (hashcat_ctx_t *hashcat_ctx) { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVAPI_PTR *nvapi = hwmon_ctx->hm_nvapi; + NVAPI_PTR *nvapi = (NVAPI_PTR *) hwmon_ctx->hm_nvapi; memset (nvapi, 0, sizeof (NVAPI_PTR)); @@ -837,7 +837,7 @@ static void nvapi_close (hashcat_ctx_t *hashcat_ctx) { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVAPI_PTR *nvapi = hwmon_ctx->hm_nvapi; + NVAPI_PTR *nvapi = (NVAPI_PTR *) hwmon_ctx->hm_nvapi; if (nvapi) { @@ -857,9 +857,9 @@ static int hm_NvAPI_Initialize (hashcat_ctx_t *hashcat_ctx) { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVAPI_PTR *nvapi = hwmon_ctx->hm_nvapi; + NVAPI_PTR *nvapi = (NVAPI_PTR *) hwmon_ctx->hm_nvapi; - const NvAPI_Status NvAPI_rc = nvapi->NvAPI_Initialize (); + const NvAPI_Status NvAPI_rc = (NvAPI_Status) nvapi->NvAPI_Initialize (); if (NvAPI_rc == NVAPI_LIBRARY_NOT_FOUND) return -1; @@ -881,9 +881,9 @@ static int hm_NvAPI_Unload (hashcat_ctx_t *hashcat_ctx) { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVAPI_PTR *nvapi = hwmon_ctx->hm_nvapi; + NVAPI_PTR *nvapi = (NVAPI_PTR *) hwmon_ctx->hm_nvapi; - const NvAPI_Status NvAPI_rc = nvapi->NvAPI_Unload (); + const NvAPI_Status NvAPI_rc = (NvAPI_Status) nvapi->NvAPI_Unload (); if (NvAPI_rc != NVAPI_OK) { @@ -903,9 +903,9 @@ static int hm_NvAPI_EnumPhysicalGPUs (hashcat_ctx_t *hashcat_ctx, NvPhysicalGpuH { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVAPI_PTR *nvapi = hwmon_ctx->hm_nvapi; + NVAPI_PTR *nvapi = (NVAPI_PTR *) hwmon_ctx->hm_nvapi; - const NvAPI_Status NvAPI_rc = nvapi->NvAPI_EnumPhysicalGPUs (nvGPUHandle, pGpuCount); + const NvAPI_Status NvAPI_rc = (NvAPI_Status) nvapi->NvAPI_EnumPhysicalGPUs (nvGPUHandle, pGpuCount); if (NvAPI_rc != NVAPI_OK) { @@ -925,9 +925,9 @@ static int hm_NvAPI_GPU_GetPerfPoliciesInfo (hashcat_ctx_t *hashcat_ctx, NvPhysi { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVAPI_PTR *nvapi = hwmon_ctx->hm_nvapi; + NVAPI_PTR *nvapi = (NVAPI_PTR *) hwmon_ctx->hm_nvapi; - const NvAPI_Status NvAPI_rc = nvapi->NvAPI_GPU_GetPerfPoliciesInfo (hPhysicalGpu, perfPolicies_info); + const NvAPI_Status NvAPI_rc = (NvAPI_Status) nvapi->NvAPI_GPU_GetPerfPoliciesInfo (hPhysicalGpu, perfPolicies_info); if (NvAPI_rc != NVAPI_OK) { @@ -947,9 +947,9 @@ static int hm_NvAPI_GPU_GetPerfPoliciesStatus (hashcat_ctx_t *hashcat_ctx, NvPhy { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVAPI_PTR *nvapi = hwmon_ctx->hm_nvapi; + NVAPI_PTR *nvapi = (NVAPI_PTR *) hwmon_ctx->hm_nvapi; - const NvAPI_Status NvAPI_rc = nvapi->NvAPI_GPU_GetPerfPoliciesStatus (hPhysicalGpu, perfPolicies_status); + const NvAPI_Status NvAPI_rc = (NvAPI_Status) nvapi->NvAPI_GPU_GetPerfPoliciesStatus (hPhysicalGpu, perfPolicies_status); if (NvAPI_rc != NVAPI_OK) { @@ -969,9 +969,9 @@ static int hm_NvAPI_GPU_GetBusId (hashcat_ctx_t *hashcat_ctx, NvPhysicalGpuHandl { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVAPI_PTR *nvapi = hwmon_ctx->hm_nvapi; + NVAPI_PTR *nvapi = (NVAPI_PTR *) hwmon_ctx->hm_nvapi; - const NvAPI_Status NvAPI_rc = nvapi->NvAPI_GPU_GetBusId (hPhysicalGpu, pBusId); + const NvAPI_Status NvAPI_rc = (NvAPI_Status) nvapi->NvAPI_GPU_GetBusId (hPhysicalGpu, pBusId); if (NvAPI_rc != NVAPI_OK) { @@ -991,9 +991,9 @@ static int hm_NvAPI_GPU_GetBusSlotId (hashcat_ctx_t *hashcat_ctx, NvPhysicalGpuH { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - NVAPI_PTR *nvapi = hwmon_ctx->hm_nvapi; + NVAPI_PTR *nvapi = (NVAPI_PTR *) hwmon_ctx->hm_nvapi; - const NvAPI_Status NvAPI_rc = nvapi->NvAPI_GPU_GetBusSlotId (hPhysicalGpu, pBusSlotId); + const NvAPI_Status NvAPI_rc = (NvAPI_Status) nvapi->NvAPI_GPU_GetBusSlotId (hPhysicalGpu, pBusSlotId); if (NvAPI_rc != NVAPI_OK) { @@ -1015,7 +1015,7 @@ static int adl_init (hashcat_ctx_t *hashcat_ctx) { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - ADL_PTR *adl = hwmon_ctx->hm_adl; + ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl; memset (adl, 0, sizeof (ADL_PTR)); @@ -1074,7 +1074,7 @@ static void adl_close (hashcat_ctx_t *hashcat_ctx) { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - ADL_PTR *adl = hwmon_ctx->hm_adl; + ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl; if (adl) { @@ -1089,7 +1089,7 @@ static int hm_ADL_Main_Control_Destroy (hashcat_ctx_t *hashcat_ctx) { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - ADL_PTR *adl = hwmon_ctx->hm_adl; + ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl; const int ADL_rc = adl->ADL_Main_Control_Destroy (); @@ -1107,7 +1107,7 @@ static int hm_ADL_Main_Control_Create (hashcat_ctx_t *hashcat_ctx, ADL_MAIN_MALL { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - ADL_PTR *adl = hwmon_ctx->hm_adl; + ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl; const int ADL_rc = adl->ADL_Main_Control_Create (callback, iEnumConnectedAdapters); @@ -1125,7 +1125,7 @@ static int hm_ADL_Adapter_NumberOfAdapters_Get (hashcat_ctx_t *hashcat_ctx, int { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - ADL_PTR *adl = hwmon_ctx->hm_adl; + ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl; const int ADL_rc = adl->ADL_Adapter_NumberOfAdapters_Get (lpNumAdapters); @@ -1143,7 +1143,7 @@ static int hm_ADL_Adapter_AdapterInfo_Get (hashcat_ctx_t *hashcat_ctx, LPAdapter { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - ADL_PTR *adl = hwmon_ctx->hm_adl; + ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl; const int ADL_rc = adl->ADL_Adapter_AdapterInfo_Get (lpInfo, iInputSize); @@ -1161,7 +1161,7 @@ static int hm_ADL_Overdrive5_Temperature_Get (hashcat_ctx_t *hashcat_ctx, int iA { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - ADL_PTR *adl = hwmon_ctx->hm_adl; + ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl; const int ADL_rc = adl->ADL_Overdrive5_Temperature_Get (iAdapterIndex, iThermalControllerIndex, lpTemperature); @@ -1179,7 +1179,7 @@ static int hm_ADL_Overdrive6_Temperature_Get (hashcat_ctx_t *hashcat_ctx, int iA { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - ADL_PTR *adl = hwmon_ctx->hm_adl; + ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl; const int ADL_rc = adl->ADL_Overdrive6_Temperature_Get (iAdapterIndex, iTemperature); @@ -1197,7 +1197,7 @@ static int hm_ADL_Overdrive_CurrentActivity_Get (hashcat_ctx_t *hashcat_ctx, int { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - ADL_PTR *adl = hwmon_ctx->hm_adl; + ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl; const int ADL_rc = adl->ADL_Overdrive5_CurrentActivity_Get (iAdapterIndex, lpActivity); @@ -1215,7 +1215,7 @@ static int hm_ADL_Overdrive5_FanSpeed_Get (hashcat_ctx_t *hashcat_ctx, int iAdap { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - ADL_PTR *adl = hwmon_ctx->hm_adl; + ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl; const int ADL_rc = adl->ADL_Overdrive5_FanSpeed_Get (iAdapterIndex, iThermalControllerIndex, lpFanSpeedValue); @@ -1233,7 +1233,7 @@ static int hm_ADL_Overdrive6_FanSpeed_Get (hashcat_ctx_t *hashcat_ctx, int iAdap { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - ADL_PTR *adl = hwmon_ctx->hm_adl; + ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl; const int ADL_rc = adl->ADL_Overdrive6_FanSpeed_Get (iAdapterIndex, lpFanSpeedInfo); @@ -1251,7 +1251,7 @@ static int hm_ADL_Overdrive_Caps (hashcat_ctx_t *hashcat_ctx, int iAdapterIndex, { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - ADL_PTR *adl = hwmon_ctx->hm_adl; + ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl; const int ADL_rc = adl->ADL_Overdrive_Caps (iAdapterIndex, od_supported, od_enabled, od_version); @@ -1269,7 +1269,7 @@ static int hm_ADL_Overdrive6_TargetTemperatureData_Get (hashcat_ctx_t *hashcat_c { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; - ADL_PTR *adl = hwmon_ctx->hm_adl; + ADL_PTR *adl = (ADL_PTR *) hwmon_ctx->hm_adl; const int ADL_rc = adl->ADL_Overdrive6_TargetTemperatureData_Get (iAdapterIndex, cur_temp, default_temp); diff --git a/src/outfile_check.c b/src/outfile_check.c index 84d47b1e9..02e3cb4fa 100644 --- a/src/outfile_check.c +++ b/src/outfile_check.c @@ -37,7 +37,7 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx) salt_t *salts_buf = hashes->salts_buf; const u32 salts_cnt = hashes->salts_cnt; - char *digests_buf = hashes->digests_buf; + char *digests_buf = (char *) hashes->digests_buf; char *root_directory = outcheck_ctx->root_directory; u32 outfile_check_timer = user_options->outfile_check_timer; diff --git a/src/potfile.c b/src/potfile.c index 58a247406..98804ae15 100644 --- a/src/potfile.c +++ b/src/potfile.c @@ -347,7 +347,7 @@ void potfile_update_hashes (hashcat_ctx_t *hashcat_ctx, hash_t *hash_buf, char * // the main search function is this: - void **found = tfind (&search_entry, (void **) &tree, sort_pot_tree_by_hash); + void **found = (void **) tfind (&search_entry, (void **) &tree, sort_pot_tree_by_hash); if (found) { @@ -451,7 +451,7 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx) // the following function searches if the "key" is already present and if not inserts the new entry: - void **found = tsearch (new_entry, (void **) &all_hashes_tree, sort_pot_tree_by_hash); + void **found = (void **) tsearch (new_entry, (void **) &all_hashes_tree, sort_pot_tree_by_hash); pot_tree_entry_t *found_entry = (pot_tree_entry_t *) *found; diff --git a/src/rp.c b/src/rp.c index 2fdce44ca..738ff4bb7 100644 --- a/src/rp.c +++ b/src/rp.c @@ -872,7 +872,7 @@ int kernel_rules_generate (hashcat_ctx_t *hashcat_ctx, kernel_rule_t **out_buf, const user_options_t *user_options = hashcat_ctx->user_options; u32 kernel_rules_cnt = 0; - kernel_rule_t *kernel_rules_buf = hccalloc (user_options->rp_gen, sizeof (kernel_rule_t)); + kernel_rule_t *kernel_rules_buf = (kernel_rule_t *) hccalloc (user_options->rp_gen, sizeof (kernel_rule_t)); char *rule_buf = (char *) hcmalloc (RP_RULE_SIZE); diff --git a/src/rp_cpu.c b/src/rp_cpu.c index 3070516ae..b9dc23e69 100644 --- a/src/rp_cpu.c +++ b/src/rp_cpu.c @@ -807,14 +807,16 @@ int _old_apply_rule (const char *rule, int rule_len, char in[RP_PASSWORD_SIZE], case RULE_OP_REJECT_NOT_CONTAIN: NEXT_RULEPOS (rule_pos); - char *match = strchr (out, rule_new[rule_pos]); - if (match != NULL) { - pos_mem = (int)(match - out); - } - else - { - return (RULE_RC_REJECT_ERROR); + const char *match = strchr (out, rule_new[rule_pos]); + if (match != NULL) + { + pos_mem = (int)(match - out); + } + else + { + return (RULE_RC_REJECT_ERROR); + } } break; diff --git a/src/shared.c b/src/shared.c index 009322c48..6fb7b1b1d 100644 --- a/src/shared.c +++ b/src/shared.c @@ -994,7 +994,7 @@ static int rounds_count_length (const char *input_buf, const int input_len) if (memcmp (input_buf, rounds, 7) == 0) { - char *next_pos = strchr (input_buf + 8, '$'); + const char *next_pos = strchr (input_buf + 8, '$'); if (next_pos == NULL) return -1; diff --git a/src/tuningdb.c b/src/tuningdb.c index 248f8d30a..f2a7f9ac5 100644 --- a/src/tuningdb.c +++ b/src/tuningdb.c @@ -342,7 +342,7 @@ tuning_db_entry_t *tuning_db_search (hashcat_ctx_t *hashcat_ctx, const char *dev { device_name_nospace[i] = 0; - tuning_db_alias_t *alias = bsearch (&a, tuning_db->alias_buf, tuning_db->alias_cnt, sizeof (tuning_db_alias_t), sort_by_tuning_db_alias); + tuning_db_alias_t *alias = (tuning_db_alias_t *) bsearch (&a, tuning_db->alias_buf, tuning_db->alias_cnt, sizeof (tuning_db_alias_t), sort_by_tuning_db_alias); if (alias == NULL) continue; @@ -372,7 +372,7 @@ tuning_db_entry_t *tuning_db_search (hashcat_ctx_t *hashcat_ctx, const char *dev s.attack_mode = (i & 2) ? -1 : attack_mode; s.hash_mode = (i & 4) ? -1 : hash_mode; - entry = bsearch (&s, tuning_db->entry_buf, tuning_db->entry_cnt, sizeof (tuning_db_entry_t), sort_by_tuning_db_entry); + entry = (tuning_db_entry_t *) bsearch (&s, tuning_db->entry_buf, tuning_db->entry_cnt, sizeof (tuning_db_entry_t), sort_by_tuning_db_entry); if (entry != NULL) break; @@ -386,7 +386,7 @@ tuning_db_entry_t *tuning_db_search (hashcat_ctx_t *hashcat_ctx, const char *dev { s.device_name = alias_name; - entry = bsearch (&s, tuning_db->entry_buf, tuning_db->entry_cnt, sizeof (tuning_db_entry_t), sort_by_tuning_db_entry); + entry = (tuning_db_entry_t *) bsearch (&s, tuning_db->entry_buf, tuning_db->entry_cnt, sizeof (tuning_db_entry_t), sort_by_tuning_db_entry); if (entry != NULL) break; } @@ -406,7 +406,7 @@ tuning_db_entry_t *tuning_db_search (hashcat_ctx_t *hashcat_ctx, const char *dev s.device_name = "DEVICE_TYPE_ACCELERATOR"; } - entry = bsearch (&s, tuning_db->entry_buf, tuning_db->entry_cnt, sizeof (tuning_db_entry_t), sort_by_tuning_db_entry); + entry = (tuning_db_entry_t *) bsearch (&s, tuning_db->entry_buf, tuning_db->entry_cnt, sizeof (tuning_db_entry_t), sort_by_tuning_db_entry); if (entry != NULL) break; }