@ -72,6 +72,10 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
tmp . pw_len = ( u32 ) tmp_len ;
}
pw_t pw ;
pw_t comb ;
bf_t bf ;
u32 highest_pw_len = 0 ;
if ( user_options - > slow_candidates = = true )
@ -81,8 +85,6 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
device_param - > kernel_params_buf32 [ 30 ] = 1 ;
}
pw_t pw ;
memset ( & pw , 0 , sizeof ( pw ) ) ;
char * pw_ptr = ( char * ) & pw . i ;
@ -95,17 +97,17 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if ( device_param - > is_cuda = = true )
{
if ( hc_cuMemcpyHtoD ( hashcat_ctx , device_param - > cuda_d_pws_buf , & pw , 1 * sizeof ( pw_t ) ) = = - 1 ) return - 1 ;
if ( hc_cuMemcpyHtoD Async ( hashcat_ctx , device_param - > cuda_d_pws_buf , & pw , 1 * sizeof ( pw_t ) , device_param - > cuda_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_hip = = true )
{
if ( hc_hipMemcpyHtoD ( hashcat_ctx , device_param - > hip_d_pws_buf , & pw , 1 * sizeof ( pw_t ) ) = = - 1 ) return - 1 ;
if ( hc_hipMemcpyHtoD Async ( hashcat_ctx , device_param - > hip_d_pws_buf , & pw , 1 * sizeof ( pw_t ) , device_param - > hip_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_opencl = = true )
{
if ( hc_clEnqueueWriteBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_pws_buf , CL_ TRU E, 0 , 1 * sizeof ( pw_t ) , & pw , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
if ( hc_clEnqueueWriteBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_pws_buf , CL_ FALS E, 0 , 1 * sizeof ( pw_t ) , & pw , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
}
}
else
@ -116,8 +118,6 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
{
device_param - > kernel_params_buf32 [ 30 ] = 1 ;
pw_t pw ;
memset ( & pw , 0 , sizeof ( pw ) ) ;
char * pw_ptr = ( char * ) & pw . i ;
@ -135,17 +135,17 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if ( device_param - > is_cuda = = true )
{
if ( hc_cuMemcpyHtoD ( hashcat_ctx , device_param - > cuda_d_pws_buf , & pw , 1 * sizeof ( pw_t ) ) = = - 1 ) return - 1 ;
if ( hc_cuMemcpyHtoD Async ( hashcat_ctx , device_param - > cuda_d_pws_buf , & pw , 1 * sizeof ( pw_t ) , device_param - > cuda_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_hip = = true )
{
if ( hc_hipMemcpyHtoD ( hashcat_ctx , device_param - > hip_d_pws_buf , & pw , 1 * sizeof ( pw_t ) ) = = - 1 ) return - 1 ;
if ( hc_hipMemcpyHtoD Async ( hashcat_ctx , device_param - > hip_d_pws_buf , & pw , 1 * sizeof ( pw_t ) , device_param - > hip_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_opencl = = true )
{
if ( hc_clEnqueueWriteBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_pws_buf , CL_ TRU E, 0 , 1 * sizeof ( pw_t ) , & pw , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
if ( hc_clEnqueueWriteBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_pws_buf , CL_ FALS E, 0 , 1 * sizeof ( pw_t ) , & pw , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
}
}
else if ( user_options_extra - > attack_kern = = ATTACK_KERN_COMBI )
@ -153,8 +153,6 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
device_param - > kernel_params_buf32 [ 30 ] = 1 ;
device_param - > kernel_params_buf32 [ 33 ] = COMBINATOR_MODE_BASE_LEFT ;
pw_t pw ;
memset ( & pw , 0 , sizeof ( pw ) ) ;
char * pw_ptr = ( char * ) & pw . i ;
@ -170,8 +168,6 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
uppercase ( ( u8 * ) pw_ptr , pw . pw_len ) ;
}
pw_t comb ;
memset ( & comb , 0 , sizeof ( comb ) ) ;
char * comb_ptr = ( char * ) & comb . i ;
@ -202,23 +198,23 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if ( device_param - > is_cuda = = true )
{
if ( hc_cuMemcpyHtoD ( hashcat_ctx , device_param - > cuda_d_combs_c , & comb , 1 * sizeof ( pw_t ) ) = = - 1 ) return - 1 ;
if ( hc_cuMemcpyHtoD Async ( hashcat_ctx , device_param - > cuda_d_combs_c , & comb , 1 * sizeof ( pw_t ) , device_param - > cuda_stream ) = = - 1 ) return - 1 ;
if ( hc_cuMemcpyHtoD ( hashcat_ctx , device_param - > cuda_d_pws_buf , & pw , 1 * sizeof ( pw_t ) ) = = - 1 ) return - 1 ;
if ( hc_cuMemcpyHtoD Async ( hashcat_ctx , device_param - > cuda_d_pws_buf , & pw , 1 * sizeof ( pw_t ) , device_param - > cuda_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_hip = = true )
{
if ( hc_hipMemcpyHtoD ( hashcat_ctx , device_param - > hip_d_combs_c , & comb , 1 * sizeof ( pw_t ) ) = = - 1 ) return - 1 ;
if ( hc_hipMemcpyHtoD Async ( hashcat_ctx , device_param - > hip_d_combs_c , & comb , 1 * sizeof ( pw_t ) , device_param - > hip_stream ) = = - 1 ) return - 1 ;
if ( hc_hipMemcpyHtoD ( hashcat_ctx , device_param - > hip_d_pws_buf , & pw , 1 * sizeof ( pw_t ) ) = = - 1 ) return - 1 ;
if ( hc_hipMemcpyHtoD Async ( hashcat_ctx , device_param - > hip_d_pws_buf , & pw , 1 * sizeof ( pw_t ) , device_param - > hip_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_opencl = = true )
{
if ( hc_clEnqueueWriteBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_combs_c , CL_ TRU E, 0 , 1 * sizeof ( pw_t ) , & comb , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
if ( hc_clEnqueueWriteBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_combs_c , CL_ FALS E, 0 , 1 * sizeof ( pw_t ) , & comb , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
if ( hc_clEnqueueWriteBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_pws_buf , CL_ TRU E, 0 , 1 * sizeof ( pw_t ) , & pw , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
if ( hc_clEnqueueWriteBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_pws_buf , CL_ FALS E, 0 , 1 * sizeof ( pw_t ) , & pw , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
}
}
else if ( user_options_extra - > attack_kern = = ATTACK_KERN_BF )
@ -227,8 +223,6 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if ( hashconfig - > opts_type & OPTS_TYPE_TM_KERNEL )
{
pw_t pw ;
memset ( & pw , 0 , sizeof ( pw ) ) ;
char * pw_ptr = ( char * ) & pw . i ;
@ -246,23 +240,21 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if ( device_param - > is_cuda = = true )
{
if ( hc_cuMemcpyHtoD ( hashcat_ctx , device_param - > cuda_d_pws_buf , & pw , 1 * sizeof ( pw_t ) ) = = - 1 ) return - 1 ;
if ( hc_cuMemcpyHtoD Async ( hashcat_ctx , device_param - > cuda_d_pws_buf , & pw , 1 * sizeof ( pw_t ) , device_param - > cuda_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_hip = = true )
{
if ( hc_hipMemcpyHtoD ( hashcat_ctx , device_param - > hip_d_pws_buf , & pw , 1 * sizeof ( pw_t ) ) = = - 1 ) return - 1 ;
if ( hc_hipMemcpyHtoD Async ( hashcat_ctx , device_param - > hip_d_pws_buf , & pw , 1 * sizeof ( pw_t ) , device_param - > hip_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_opencl = = true )
{
if ( hc_clEnqueueWriteBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_pws_buf , CL_ TRU E, 0 , 1 * sizeof ( pw_t ) , & pw , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
if ( hc_clEnqueueWriteBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_pws_buf , CL_ FALS E, 0 , 1 * sizeof ( pw_t ) , & pw , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
}
}
else
{
bf_t bf ;
memset ( & bf , 0 , sizeof ( bf ) ) ;
char * bf_ptr = ( char * ) & bf . i ;
@ -302,21 +294,19 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if ( device_param - > is_cuda = = true )
{
if ( hc_cuMemcpyHtoD ( hashcat_ctx , device_param - > cuda_d_bfs_c , & bf , 1 * sizeof ( bf_t ) ) = = - 1 ) return - 1 ;
if ( hc_cuMemcpyHtoD Async ( hashcat_ctx , device_param - > cuda_d_bfs_c , & bf , 1 * sizeof ( bf_t ) , device_param - > cuda_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_hip = = true )
{
if ( hc_hipMemcpyHtoD ( hashcat_ctx , device_param - > hip_d_bfs_c , & bf , 1 * sizeof ( bf_t ) ) = = - 1 ) return - 1 ;
if ( hc_hipMemcpyHtoD Async ( hashcat_ctx , device_param - > hip_d_bfs_c , & bf , 1 * sizeof ( bf_t ) , device_param - > hip_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_opencl = = true )
{
if ( hc_clEnqueueWriteBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_bfs_c , CL_ TRU E, 0 , 1 * sizeof ( bf_t ) , & bf , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
if ( hc_clEnqueueWriteBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_bfs_c , CL_ FALS E, 0 , 1 * sizeof ( bf_t ) , & bf , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
}
pw_t pw ;
memset ( & pw , 0 , sizeof ( pw ) ) ;
char * pw_ptr = ( char * ) & pw . i ;
@ -403,17 +393,17 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if ( device_param - > is_cuda = = true )
{
if ( hc_cuMemcpyHtoD ( hashcat_ctx , device_param - > cuda_d_pws_buf , & pw , 1 * sizeof ( pw_t ) ) = = - 1 ) return - 1 ;
if ( hc_cuMemcpyHtoD Async ( hashcat_ctx , device_param - > cuda_d_pws_buf , & pw , 1 * sizeof ( pw_t ) , device_param - > cuda_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_hip = = true )
{
if ( hc_hipMemcpyHtoD ( hashcat_ctx , device_param - > hip_d_pws_buf , & pw , 1 * sizeof ( pw_t ) ) = = - 1 ) return - 1 ;
if ( hc_hipMemcpyHtoD Async ( hashcat_ctx , device_param - > hip_d_pws_buf , & pw , 1 * sizeof ( pw_t ) , device_param - > hip_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_opencl = = true )
{
if ( hc_clEnqueueWriteBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_pws_buf , CL_ TRU E, 0 , 1 * sizeof ( pw_t ) , & pw , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
if ( hc_clEnqueueWriteBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_pws_buf , CL_ FALS E, 0 , 1 * sizeof ( pw_t ) , & pw , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
}
highest_pw_len = pw . pw_len ;
@ -422,8 +412,6 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
}
else
{
pw_t pw ;
memset ( & pw , 0 , sizeof ( pw ) ) ;
char * pw_ptr = ( char * ) & pw . i ;
@ -436,17 +424,17 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if ( device_param - > is_cuda = = true )
{
if ( hc_cuMemcpyHtoD ( hashcat_ctx , device_param - > cuda_d_pws_buf , & pw , 1 * sizeof ( pw_t ) ) = = - 1 ) return - 1 ;
if ( hc_cuMemcpyHtoD Async ( hashcat_ctx , device_param - > cuda_d_pws_buf , & pw , 1 * sizeof ( pw_t ) , device_param - > cuda_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_hip = = true )
{
if ( hc_hipMemcpyHtoD ( hashcat_ctx , device_param - > hip_d_pws_buf , & pw , 1 * sizeof ( pw_t ) ) = = - 1 ) return - 1 ;
if ( hc_hipMemcpyHtoD Async ( hashcat_ctx , device_param - > hip_d_pws_buf , & pw , 1 * sizeof ( pw_t ) , device_param - > hip_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_opencl = = true )
{
if ( hc_clEnqueueWriteBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_pws_buf , CL_ TRU E, 0 , 1 * sizeof ( pw_t ) , & pw , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
if ( hc_clEnqueueWriteBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_pws_buf , CL_ FALS E, 0 , 1 * sizeof ( pw_t ) , & pw , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
}
}
}
@ -513,16 +501,21 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if ( device_param - > is_cuda = = true )
{
if ( hc_cuMemcpyDtoH ( hashcat_ctx , device_param - > hooks_buf , device_param - > cuda_d_hooks , device_param - > size_hooks ) = = - 1 ) return - 1 ;
if ( hc_cuMemcpyDtoHAsync ( hashcat_ctx , device_param - > hooks_buf , device_param - > cuda_d_hooks , device_param - > size_hooks , device_param - > cuda_stream ) = = - 1 ) return - 1 ;
if ( hc_cuStreamSynchronize ( hashcat_ctx , device_param - > cuda_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_hip = = true )
{
if ( hc_hipMemcpyDtoH ( hashcat_ctx , device_param - > hooks_buf , device_param - > hip_d_hooks , device_param - > size_hooks ) = = - 1 ) return - 1 ;
if ( hc_hipMemcpyDtoHAsync ( hashcat_ctx , device_param - > hooks_buf , device_param - > hip_d_hooks , device_param - > size_hooks , device_param - > hip_stream ) = = - 1 ) return - 1 ;
if ( hc_hipStreamSynchronize ( hashcat_ctx , device_param - > hip_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_opencl = = true )
{
/* blocking */
if ( hc_clEnqueueReadBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_hooks , CL_TRUE , 0 , device_param - > size_hooks , device_param - > hooks_buf , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
}
@ -530,17 +523,17 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if ( device_param - > is_cuda = = true )
{
if ( hc_cuMemcpyHtoD ( hashcat_ctx , device_param - > cuda_d_hooks , device_param - > hooks_buf , device_param - > size_hooks ) = = - 1 ) return - 1 ;
if ( hc_cuMemcpyHtoD Async ( hashcat_ctx , device_param - > cuda_d_hooks , device_param - > hooks_buf , device_param - > size_hooks , device_param - > cuda_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_hip = = true )
{
if ( hc_hipMemcpyHtoD ( hashcat_ctx , device_param - > hip_d_hooks , device_param - > hooks_buf , device_param - > size_hooks ) = = - 1 ) return - 1 ;
if ( hc_hipMemcpyHtoD Async ( hashcat_ctx , device_param - > hip_d_hooks , device_param - > hooks_buf , device_param - > size_hooks , device_param - > hip_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_opencl = = true )
{
if ( hc_clEnqueueWriteBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_hooks , CL_ TRU E, 0 , device_param - > size_hooks , device_param - > hooks_buf , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
if ( hc_clEnqueueWriteBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_hooks , CL_ FALS E, 0 , device_param - > size_hooks , device_param - > hooks_buf , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
}
}
@ -586,16 +579,21 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if ( device_param - > is_cuda = = true )
{
if ( hc_cuMemcpyDtoH ( hashcat_ctx , device_param - > hooks_buf , device_param - > cuda_d_hooks , device_param - > size_hooks ) = = - 1 ) return - 1 ;
if ( hc_cuMemcpyDtoHAsync ( hashcat_ctx , device_param - > hooks_buf , device_param - > cuda_d_hooks , device_param - > size_hooks , device_param - > cuda_stream ) = = - 1 ) return - 1 ;
if ( hc_cuStreamSynchronize ( hashcat_ctx , device_param - > cuda_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_hip = = true )
{
if ( hc_hipMemcpyDtoH ( hashcat_ctx , device_param - > hooks_buf , device_param - > hip_d_hooks , device_param - > size_hooks ) = = - 1 ) return - 1 ;
if ( hc_hipMemcpyDtoHAsync ( hashcat_ctx , device_param - > hooks_buf , device_param - > hip_d_hooks , device_param - > size_hooks , device_param - > hip_stream ) = = - 1 ) return - 1 ;
if ( hc_hipStreamSynchronize ( hashcat_ctx , device_param - > hip_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_opencl = = true )
{
/* blocking */
if ( hc_clEnqueueReadBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_hooks , CL_TRUE , 0 , device_param - > size_hooks , device_param - > hooks_buf , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
}
@ -603,17 +601,17 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if ( device_param - > is_cuda = = true )
{
if ( hc_cuMemcpyHtoD ( hashcat_ctx , device_param - > cuda_d_hooks , device_param - > hooks_buf , device_param - > size_hooks ) = = - 1 ) return - 1 ;
if ( hc_cuMemcpyHtoD Async ( hashcat_ctx , device_param - > cuda_d_hooks , device_param - > hooks_buf , device_param - > size_hooks , device_param - > cuda_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_hip = = true )
{
if ( hc_hipMemcpyHtoD ( hashcat_ctx , device_param - > hip_d_hooks , device_param - > hooks_buf , device_param - > size_hooks ) = = - 1 ) return - 1 ;
if ( hc_hipMemcpyHtoD Async ( hashcat_ctx , device_param - > hip_d_hooks , device_param - > hooks_buf , device_param - > size_hooks , device_param - > hip_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_opencl = = true )
{
if ( hc_clEnqueueWriteBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_hooks , CL_ TRU E, 0 , device_param - > size_hooks , device_param - > hooks_buf , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
if ( hc_clEnqueueWriteBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_hooks , CL_ FALS E, 0 , device_param - > size_hooks , device_param - > hooks_buf , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
}
}
}
@ -687,19 +685,27 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
u32 num_cracked = 0 ;
cl_event opencl_event ;
if ( device_param - > is_cuda = = true )
{
if ( hc_cuMemcpyDtoH ( hashcat_ctx , & num_cracked , device_param - > cuda_d_result , sizeof ( u32 ) ) = = - 1 ) return - 1 ;
if ( hc_cuMemcpyDtoHAsync ( hashcat_ctx , & num_cracked , device_param - > cuda_d_result , sizeof ( u32 ) , device_param - > cuda_stream ) = = - 1 ) return - 1 ;
if ( hc_cuEventRecord ( hashcat_ctx , device_param - > cuda_event3 , device_param - > cuda_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_hip = = true )
{
if ( hc_hipMemcpyDtoH ( hashcat_ctx , & num_cracked , device_param - > hip_d_result , sizeof ( u32 ) ) = = - 1 ) return - 1 ;
if ( hc_hipMemcpyDtoHAsync ( hashcat_ctx , & num_cracked , device_param - > hip_d_result , sizeof ( u32 ) , device_param - > hip_stream ) = = - 1 ) return - 1 ;
if ( hc_hipEventRecord ( hashcat_ctx , device_param - > hip_event3 , device_param - > hip_stream ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_opencl = = true )
{
if ( hc_clEnqueueReadBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_result , CL_TRUE , 0 , sizeof ( u32 ) , & num_cracked , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
if ( hc_clEnqueueReadBuffer ( hashcat_ctx , device_param - > opencl_command_queue , device_param - > opencl_d_result , CL_FALSE , 0 , sizeof ( u32 ) , & num_cracked , 0 , NULL , & opencl_event ) = = - 1 ) return - 1 ;
if ( hc_clFlush ( hashcat_ctx , device_param - > opencl_command_queue ) = = - 1 ) return - 1 ;
}
// finish : cleanup and restore
@ -718,12 +724,12 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
device_param - > kernel_params [ 17 ] = & device_param - > cuda_d_salt_bufs ;
device_param - > kernel_params [ 18 ] = & device_param - > cuda_d_esalt_bufs ;
if ( run_cuda_kernel_bzero ( hashcat_ctx , device_param , device_param - > cuda_d_pws_buf , device_param - > size_pws ) = = - 1 ) return - 1 ;
if ( run_cuda_kernel_bzero ( hashcat_ctx , device_param , device_param - > cuda_d_tmps , device_param - > size_tmps ) = = - 1 ) return - 1 ;
if ( run_cuda_kernel_bzero ( hashcat_ctx , device_param , device_param - > cuda_d_hooks , device_param - > size_hooks ) = = - 1 ) return - 1 ;
if ( run_cuda_kernel_bzero ( hashcat_ctx , device_param , device_param - > cuda_d_plain_bufs , device_param - > size_plains ) = = - 1 ) return - 1 ;
if ( run_cuda_kernel_bzero ( hashcat_ctx , device_param , device_param - > cuda_d_digests_shown , device_param - > size_shown ) = = - 1 ) return - 1 ;
if ( run_cuda_kernel_bzero ( hashcat_ctx , device_param , device_param - > cuda_d_result , device_param - > size_results ) = = - 1 ) return - 1 ;
if ( run_cuda_kernel_bzero ( hashcat_ctx , device_param , device_param - > cuda_d_pws_buf , device_param - > size_pws ) = = - 1 ) return - 1 ;
if ( run_cuda_kernel_bzero ( hashcat_ctx , device_param , device_param - > cuda_d_tmps , device_param - > size_tmps ) = = - 1 ) return - 1 ;
if ( run_cuda_kernel_bzero ( hashcat_ctx , device_param , device_param - > cuda_d_hooks , device_param - > size_hooks ) = = - 1 ) return - 1 ;
if ( run_cuda_kernel_bzero ( hashcat_ctx , device_param , device_param - > cuda_d_plain_bufs , device_param - > size_plains ) = = - 1 ) return - 1 ;
if ( run_cuda_kernel_bzero ( hashcat_ctx , device_param , device_param - > cuda_d_digests_shown , device_param - > size_shown ) = = - 1 ) return - 1 ;
if ( run_cuda_kernel_bzero ( hashcat_ctx , device_param , device_param - > cuda_d_result , device_param - > size_results ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_hip = = true )
@ -732,12 +738,12 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
device_param - > kernel_params [ 17 ] = & device_param - > hip_d_salt_bufs ;
device_param - > kernel_params [ 18 ] = & device_param - > hip_d_esalt_bufs ;
if ( run_hip_kernel_bzero ( hashcat_ctx , device_param , device_param - > hip_d_pws_buf , device_param - > size_pws ) = = - 1 ) return - 1 ;
if ( run_hip_kernel_bzero ( hashcat_ctx , device_param , device_param - > hip_d_tmps , device_param - > size_tmps ) = = - 1 ) return - 1 ;
if ( run_hip_kernel_bzero ( hashcat_ctx , device_param , device_param - > hip_d_hooks , device_param - > size_hooks ) = = - 1 ) return - 1 ;
if ( run_hip_kernel_bzero ( hashcat_ctx , device_param , device_param - > hip_d_plain_bufs , device_param - > size_plains ) = = - 1 ) return - 1 ;
if ( run_hip_kernel_bzero ( hashcat_ctx , device_param , device_param - > hip_d_digests_shown , device_param - > size_shown ) = = - 1 ) return - 1 ;
if ( run_hip_kernel_bzero ( hashcat_ctx , device_param , device_param - > hip_d_result , device_param - > size_results ) = = - 1 ) return - 1 ;
if ( run_hip_kernel_bzero ( hashcat_ctx , device_param , device_param - > hip_d_pws_buf , device_param - > size_pws ) = = - 1 ) return - 1 ;
if ( run_hip_kernel_bzero ( hashcat_ctx , device_param , device_param - > hip_d_tmps , device_param - > size_tmps ) = = - 1 ) return - 1 ;
if ( run_hip_kernel_bzero ( hashcat_ctx , device_param , device_param - > hip_d_hooks , device_param - > size_hooks ) = = - 1 ) return - 1 ;
if ( run_hip_kernel_bzero ( hashcat_ctx , device_param , device_param - > hip_d_plain_bufs , device_param - > size_plains ) = = - 1 ) return - 1 ;
if ( run_hip_kernel_bzero ( hashcat_ctx , device_param , device_param - > hip_d_digests_shown , device_param - > size_shown ) = = - 1 ) return - 1 ;
if ( run_hip_kernel_bzero ( hashcat_ctx , device_param , device_param - > hip_d_result , device_param - > size_results ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_opencl = = true )
@ -826,8 +832,25 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
}
}
// check return
// synchronize and ..
if ( device_param - > is_cuda = = true )
{
if ( hc_cuEventSynchronize ( hashcat_ctx , device_param - > cuda_event3 ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_hip = = true )
{
if ( hc_hipEventSynchronize ( hashcat_ctx , device_param - > hip_event3 ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_opencl = = true )
{
if ( hc_clWaitForEvents ( hashcat_ctx , 1 , & opencl_event ) = = - 1 ) return - 1 ;
if ( hc_clReleaseEvent ( hashcat_ctx , opencl_event ) = = - 1 ) return - 1 ;
}
// check return
if ( num_cracked = = 0 )
{
hc_thread_mutex_lock ( status_ctx - > mux_display ) ;
@ -909,13 +932,22 @@ HC_API_CALL void *thread_selftest (void *p)
if ( device_param - > is_cuda = = true )
{
if ( hc_cuStreamSynchronize ( hashcat_ctx , device_param - > cuda_stream ) = = - 1 ) return NULL ;
if ( hc_cuCtxPopCurrent ( hashcat_ctx , & device_param - > cuda_context ) = = - 1 ) return NULL ;
}
if ( device_param - > is_hip = = true )
{
if ( hc_hipStreamSynchronize ( hashcat_ctx , device_param - > hip_stream ) = = - 1 ) return NULL ;
if ( hc_hipCtxPopCurrent ( hashcat_ctx , & device_param - > hip_context ) = = - 1 ) return NULL ;
}
if ( device_param - > is_opencl = = true )
{
if ( hc_clFinish ( hashcat_ctx , device_param - > opencl_command_queue ) = = - 1 ) return NULL ;
}
return NULL ;
}