1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 08:08:10 +00:00

Fix status screen current password query

This commit is contained in:
Jens Steube 2019-05-14 15:25:36 +02:00
parent f84eaa2e4d
commit ce8a6fde0a
2 changed files with 77 additions and 2 deletions

View File

@ -71,6 +71,8 @@ int hc_cuModuleUnload (hashcat_ctx_t *hashcat_ctx, CUmodule hmod);
int hc_cuStreamCreate (hashcat_ctx_t *hashcat_ctx, CUstream *phStream, unsigned int Flags);
int hc_cuStreamDestroy (hashcat_ctx_t *hashcat_ctx, CUstream hStream);
int hc_cuStreamSynchronize (hashcat_ctx_t *hashcat_ctx, CUstream hStream);
int hc_cuCtxPushCurrent (hashcat_ctx_t *hashcat_ctx, CUcontext ctx);
int hc_cuCtxPopCurrent (hashcat_ctx_t *hashcat_ctx, CUcontext *pctx);
int hc_clBuildProgram (hashcat_ctx_t *hashcat_ctx, cl_program program, cl_uint num_devices, const cl_device_id *device_list, const char *options, void (CL_CALLBACK *pfn_notify) (cl_program program, void *user_data), void *user_data);
int hc_clCreateBuffer (hashcat_ctx_t *hashcat_ctx, cl_context context, cl_mem_flags flags, size_t size, void *host_ptr, cl_mem *mem);

View File

@ -1922,6 +1922,59 @@ int hc_cuCtxSetCacheConfig (hashcat_ctx_t *hashcat_ctx, CUfunc_cache config)
return 0;
}
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;
const CUresult CU_err = cuda->cuCtxPushCurrent (ctx);
if (CU_err != CUDA_SUCCESS)
{
const char *pStr = NULL;
if (cuda->cuGetErrorString (CU_err, &pStr) == CUDA_SUCCESS)
{
event_log_error (hashcat_ctx, "cuCtxPushCurrent(): %s", pStr);
}
else
{
event_log_error (hashcat_ctx, "cuCtxPushCurrent(): %d", CU_err);
}
return -1;
}
return 0;
}
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;
const CUresult CU_err = cuda->cuCtxPopCurrent (pctx);
if (CU_err != CUDA_SUCCESS)
{
const char *pStr = NULL;
if (cuda->cuGetErrorString (CU_err, &pStr) == CUDA_SUCCESS)
{
event_log_error (hashcat_ctx, "cuCtxPopCurrent(): %s", pStr);
}
else
{
event_log_error (hashcat_ctx, "cuCtxPopCurrent(): %d", CU_err);
}
return -1;
}
return 0;
}
// OpenCL
@ -2607,7 +2660,17 @@ int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, c
if (device_param->is_cuda == true)
{
const int CU_rc = hc_cuMemcpyDtoH (hashcat_ctx, &pw_idx, device_param->cuda_d_pws_idx + (gidd * sizeof (pw_idx_t)), sizeof (pw_idx_t));
int CU_rc;
CU_rc = hc_cuCtxPushCurrent (hashcat_ctx, device_param->cuda_context);
if (CU_rc == -1) return -1;
CU_rc = hc_cuMemcpyDtoH (hashcat_ctx, &pw_idx, device_param->cuda_d_pws_idx + (gidd * sizeof (pw_idx_t)), sizeof (pw_idx_t));
if (CU_rc == -1) return -1;
CU_rc = hc_cuCtxPopCurrent (hashcat_ctx, &device_param->cuda_context);
if (CU_rc == -1) return -1;
}
@ -2627,7 +2690,17 @@ int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, c
{
if (cnt > 0)
{
const int CU_rc = hc_cuMemcpyDtoH (hashcat_ctx,pw->i, device_param->cuda_d_pws_comp_buf + (off * sizeof (u32)), cnt * sizeof (u32));
int CU_rc;
CU_rc = hc_cuCtxPushCurrent (hashcat_ctx, device_param->cuda_context);
if (CU_rc == -1) return -1;
CU_rc = hc_cuMemcpyDtoH (hashcat_ctx,pw->i, device_param->cuda_d_pws_comp_buf + (off * sizeof (u32)), cnt * sizeof (u32));
if (CU_rc == -1) return -1;
CU_rc = hc_cuCtxPopCurrent (hashcat_ctx, &device_param->cuda_context);
if (CU_rc == -1) return -1;
}