@ -3037,6 +3037,19 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
if ( run_kernel_amp ( hashcat_ctx , device_param , pws_cnt ) = = - 1 ) return - 1 ;
}
if ( hashconfig - > opts_type & OPTS_TYPE_POST_AMP_UTF16LE )
{
if ( device_param - > is_cuda = = true )
{
if ( run_cuda_kernel_utf8toutf16le ( hashcat_ctx , device_param , device_param - > cuda_d_pws_buf , pws_cnt ) = = - 1 ) return - 1 ;
}
if ( device_param - > is_opencl = = true )
{
if ( run_opencl_kernel_utf8toutf16le ( hashcat_ctx , device_param , device_param - > opencl_d_pws_buf , pws_cnt ) = = - 1 ) return - 1 ;
}
}
if ( run_kernel ( hashcat_ctx , device_param , KERN_RUN_1 , pws_pos , pws_cnt , false , 0 ) = = - 1 ) return - 1 ;
if ( hashconfig - > opts_type & OPTS_TYPE_HOOK12 )
@ -3414,6 +3427,26 @@ int run_cuda_kernel_atinit (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *devic
return 0 ;
}
int run_cuda_kernel_utf8toutf16le ( hashcat_ctx_t * hashcat_ctx , hc_device_param_t * device_param , CUdeviceptr buf , const u64 num )
{
u64 num_elements = num ;
device_param - > kernel_params_utf8toutf16le [ 0 ] = ( void * ) & buf ;
device_param - > kernel_params_utf8toutf16le_buf64 [ 1 ] = num_elements ;
const u64 kernel_threads = device_param - > kernel_wgs_utf8toutf16le ;
num_elements = CEILDIV ( num_elements , kernel_threads ) ;
CUfunction function = device_param - > cuda_function_utf8toutf16le ;
if ( hc_cuLaunchKernel ( hashcat_ctx , function , num_elements , 1 , 1 , kernel_threads , 1 , 1 , 0 , device_param - > cuda_stream , device_param - > kernel_params_utf8toutf16le , NULL ) = = - 1 ) return - 1 ;
if ( hc_cuStreamSynchronize ( hashcat_ctx , device_param - > cuda_stream ) = = - 1 ) return - 1 ;
return 0 ;
}
int run_cuda_kernel_memset ( hashcat_ctx_t * hashcat_ctx , hc_device_param_t * device_param , CUdeviceptr buf , const u32 value , const u64 size )
{
const u64 num16d = size / 16 ;
@ -3495,6 +3528,34 @@ int run_opencl_kernel_atinit (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *dev
return 0 ;
}
int run_opencl_kernel_utf8toutf16le ( hashcat_ctx_t * hashcat_ctx , hc_device_param_t * device_param , cl_mem buf , const u64 num )
{
u64 num_elements = num ;
device_param - > kernel_params_utf8toutf16le_buf64 [ 1 ] = num_elements ;
const u64 kernel_threads = device_param - > kernel_wgs_utf8toutf16le ;
num_elements = round_up_multiple_64 ( num_elements , kernel_threads ) ;
cl_kernel kernel = device_param - > opencl_kernel_utf8toutf16le ;
const size_t global_work_size [ 3 ] = { num_elements , 1 , 1 } ;
const size_t local_work_size [ 3 ] = { kernel_threads , 1 , 1 } ;
if ( hc_clSetKernelArg ( hashcat_ctx , kernel , 0 , sizeof ( cl_mem ) , ( void * ) & buf ) = = - 1 ) return - 1 ;
if ( hc_clSetKernelArg ( hashcat_ctx , kernel , 1 , sizeof ( cl_ulong ) , device_param - > kernel_params_utf8toutf16le [ 1 ] ) = = - 1 ) return - 1 ;
if ( hc_clEnqueueNDRangeKernel ( hashcat_ctx , device_param - > opencl_command_queue , kernel , 1 , NULL , global_work_size , local_work_size , 0 , NULL , NULL ) = = - 1 ) return - 1 ;
if ( hc_clFlush ( hashcat_ctx , device_param - > opencl_command_queue ) = = - 1 ) return - 1 ;
if ( hc_clFinish ( hashcat_ctx , device_param - > opencl_command_queue ) = = - 1 ) return - 1 ;
return 0 ;
}
int run_opencl_kernel_memset ( hashcat_ctx_t * hashcat_ctx , hc_device_param_t * device_param , cl_mem buf , const u32 value , const u64 size )
{
const u64 num16d = size / 16 ;
@ -8681,6 +8742,18 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
if ( get_cuda_kernel_dynamic_local_mem_size ( hashcat_ctx , device_param - > cuda_function_decompress , & device_param - > kernel_dynamic_local_mem_size_decompress ) = = - 1 ) return - 1 ;
device_param - > kernel_preferred_wgs_multiple_decompress = device_param - > cuda_warp_size ;
// GPU utf8 to utf16le conversion
if ( hc_cuModuleGetFunction ( hashcat_ctx , & device_param - > cuda_function_utf8toutf16le , device_param - > cuda_module_shared , " gpu_utf8_to_utf16 " ) = = - 1 ) return - 1 ;
if ( get_cuda_kernel_wgs ( hashcat_ctx , device_param - > cuda_function_utf8toutf16le , & device_param - > kernel_wgs_utf8toutf16le ) = = - 1 ) return - 1 ;
if ( get_cuda_kernel_local_mem_size ( hashcat_ctx , device_param - > cuda_function_utf8toutf16le , & device_param - > kernel_local_mem_size_utf8toutf16le ) = = - 1 ) return - 1 ;
if ( get_cuda_kernel_dynamic_local_mem_size ( hashcat_ctx , device_param - > cuda_function_utf8toutf16le , & device_param - > kernel_dynamic_local_mem_size_utf8toutf16le ) = = - 1 ) return - 1 ;
device_param - > kernel_preferred_wgs_multiple_utf8toutf16le = device_param - > cuda_warp_size ;
}
if ( device_param - > is_opencl = = true )
@ -8720,6 +8793,18 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
if ( get_opencl_kernel_dynamic_local_mem_size ( hashcat_ctx , device_param , device_param - > opencl_kernel_decompress , & device_param - > kernel_dynamic_local_mem_size_decompress ) = = - 1 ) return - 1 ;
if ( get_opencl_kernel_preferred_wgs_multiple ( hashcat_ctx , device_param , device_param - > opencl_kernel_decompress , & device_param - > kernel_preferred_wgs_multiple_decompress ) = = - 1 ) return - 1 ;
// GPU utf8 to utf16le conversion
if ( hc_clCreateKernel ( hashcat_ctx , device_param - > opencl_program_shared , " gpu_utf8_to_utf16 " , & device_param - > opencl_kernel_utf8toutf16le ) = = - 1 ) return - 1 ;
if ( get_opencl_kernel_wgs ( hashcat_ctx , device_param , device_param - > opencl_kernel_utf8toutf16le , & device_param - > kernel_wgs_utf8toutf16le ) = = - 1 ) return - 1 ;
if ( get_opencl_kernel_local_mem_size ( hashcat_ctx , device_param , device_param - > opencl_kernel_utf8toutf16le , & device_param - > kernel_local_mem_size_utf8toutf16le ) = = - 1 ) return - 1 ;
if ( get_opencl_kernel_dynamic_local_mem_size ( hashcat_ctx , device_param , device_param - > opencl_kernel_utf8toutf16le , & device_param - > kernel_dynamic_local_mem_size_utf8toutf16le ) = = - 1 ) return - 1 ;
if ( get_opencl_kernel_preferred_wgs_multiple ( hashcat_ctx , device_param , device_param - > opencl_kernel_utf8toutf16le , & device_param - > kernel_preferred_wgs_multiple_utf8toutf16le ) = = - 1 ) return - 1 ;
}
}
@ -9417,6 +9502,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
device_param - > kernel_params_atinit [ 0 ] = NULL ;
device_param - > kernel_params_atinit [ 1 ] = & device_param - > kernel_params_atinit_buf64 [ 1 ] ;
device_param - > kernel_params_utf8toutf16le_buf64 [ 1 ] = 0 ; // gid_max
device_param - > kernel_params_utf8toutf16le [ 0 ] = NULL ;
device_param - > kernel_params_utf8toutf16le [ 1 ] = & device_param - > kernel_params_utf8toutf16le_buf64 [ 1 ] ;
device_param - > kernel_params_decompress_buf64 [ 3 ] = 0 ; // gid_max
if ( device_param - > is_cuda = = true )
@ -10058,6 +10148,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
if ( hc_clSetKernelArg ( hashcat_ctx , device_param - > opencl_kernel_atinit , 0 , sizeof ( cl_mem ) , device_param - > kernel_params_atinit [ 0 ] ) = = - 1 ) return - 1 ;
if ( hc_clSetKernelArg ( hashcat_ctx , device_param - > opencl_kernel_atinit , 1 , sizeof ( cl_ulong ) , device_param - > kernel_params_atinit [ 1 ] ) = = - 1 ) return - 1 ;
// GPU utf8 to utf16le init
if ( hc_clSetKernelArg ( hashcat_ctx , device_param - > opencl_kernel_utf8toutf16le , 0 , sizeof ( cl_mem ) , device_param - > kernel_params_utf8toutf16le [ 0 ] ) = = - 1 ) return - 1 ;
if ( hc_clSetKernelArg ( hashcat_ctx , device_param - > opencl_kernel_utf8toutf16le , 1 , sizeof ( cl_ulong ) , device_param - > kernel_params_utf8toutf16le [ 1 ] ) = = - 1 ) return - 1 ;
// GPU decompress
if ( hc_clSetKernelArg ( hashcat_ctx , device_param - > opencl_kernel_decompress , 0 , sizeof ( cl_mem ) , device_param - > kernel_params_decompress [ 0 ] ) = = - 1 ) return - 1 ;
@ -11242,6 +11337,7 @@ void backend_session_destroy (hashcat_ctx_t *hashcat_ctx)
device_param - > cuda_function_amp = NULL ;
device_param - > cuda_function_memset = NULL ;
device_param - > cuda_function_atinit = NULL ;
device_param - > cuda_function_utf8toutf16le = NULL ;
device_param - > cuda_function_decompress = NULL ;
device_param - > cuda_function_aux1 = NULL ;
device_param - > cuda_function_aux2 = NULL ;
@ -11313,6 +11409,7 @@ void backend_session_destroy (hashcat_ctx_t *hashcat_ctx)
if ( device_param - > opencl_kernel_amp ) hc_clReleaseKernel ( hashcat_ctx , device_param - > opencl_kernel_amp ) ;
if ( device_param - > opencl_kernel_memset ) hc_clReleaseKernel ( hashcat_ctx , device_param - > opencl_kernel_memset ) ;
if ( device_param - > opencl_kernel_atinit ) hc_clReleaseKernel ( hashcat_ctx , device_param - > opencl_kernel_atinit ) ;
if ( device_param - > opencl_kernel_utf8toutf16le ) hc_clReleaseKernel ( hashcat_ctx , device_param - > opencl_kernel_utf8toutf16le ) ;
if ( device_param - > opencl_kernel_decompress ) hc_clReleaseKernel ( hashcat_ctx , device_param - > opencl_kernel_decompress ) ;
if ( device_param - > opencl_kernel_aux1 ) hc_clReleaseKernel ( hashcat_ctx , device_param - > opencl_kernel_aux1 ) ;
if ( device_param - > opencl_kernel_aux2 ) hc_clReleaseKernel ( hashcat_ctx , device_param - > opencl_kernel_aux2 ) ;
@ -11382,6 +11479,7 @@ void backend_session_destroy (hashcat_ctx_t *hashcat_ctx)
device_param - > opencl_kernel_amp = NULL ;
device_param - > opencl_kernel_memset = NULL ;
device_param - > opencl_kernel_atinit = NULL ;
device_param - > opencl_kernel_utf8toutf16le = NULL ;
device_param - > opencl_kernel_decompress = NULL ;
device_param - > opencl_kernel_aux1 = NULL ;
device_param - > opencl_kernel_aux2 = NULL ;