mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-22 05:31:11 +00:00
Add missing backports from code base v6.2.2
Fix context to thread management Fix missing code in selftest.c, autotune.c, hashes.c, dispatch.c and backend.c Use IS_HIP depending code makes it easier for future optimization related to inline assembly calls - instead of using IS_CUDA || IS_HIP See TODO markers for more optimizations / next steps
This commit is contained in:
parent
5fd51268ca
commit
1b84a9e53b
@ -3,10 +3,6 @@
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
#ifdef IS_HIP
|
||||
#include <hip/hip_runtime.h>
|
||||
#endif
|
||||
|
||||
#include "inc_vendor.h"
|
||||
#include "inc_types.h"
|
||||
#include "inc_platform.h"
|
||||
|
@ -105,7 +105,6 @@
|
||||
MAYBE_UNUSED const u64 pws_pos, \
|
||||
MAYBE_UNUSED const u64 gid_max
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Shortcut macros for usage in the actual kernels
|
||||
*
|
||||
|
@ -2,9 +2,6 @@
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
#ifdef IS_HIP
|
||||
#include <hip_runtime.h>
|
||||
#endif
|
||||
|
||||
#include "inc_vendor.h"
|
||||
#include "inc_types.h"
|
||||
@ -63,7 +60,111 @@ DECLSPEC u64 rotr64_S (const u64 a, const int n)
|
||||
|
||||
#endif
|
||||
|
||||
#if defined IS_CUDA || defined IS_HIP
|
||||
#if defined IS_CUDA
|
||||
|
||||
#if ATTACK_EXEC == 11
|
||||
|
||||
CONSTANT_VK u32 generic_constant[8192]; // 32k
|
||||
|
||||
#if ATTACK_KERN == 0
|
||||
#define bfs_buf g_bfs_buf
|
||||
#define rules_buf ((const kernel_rule_t *) generic_constant)
|
||||
#define words_buf_s g_words_buf_s
|
||||
#define words_buf_r g_words_buf_r
|
||||
#elif ATTACK_KERN == 1
|
||||
#define bfs_buf g_bfs_buf
|
||||
#define rules_buf g_rules_buf
|
||||
#define words_buf_s g_words_buf_s
|
||||
#define words_buf_r g_words_buf_r
|
||||
#elif ATTACK_KERN == 3
|
||||
#define rules_buf g_rules_buf
|
||||
#define bfs_buf ((const bf_t *) generic_constant)
|
||||
#define words_buf_s ((const bs_word_t *) generic_constant)
|
||||
#define words_buf_r ((const u32x *) generic_constant)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
DECLSPEC u32 hc_atomic_dec (GLOBAL_AS u32 *p)
|
||||
{
|
||||
volatile const u32 val = 1;
|
||||
|
||||
return atomicSub (p, val);
|
||||
}
|
||||
|
||||
DECLSPEC u32 hc_atomic_inc (GLOBAL_AS u32 *p)
|
||||
{
|
||||
volatile const u32 val = 1;
|
||||
|
||||
return atomicAdd (p, val);
|
||||
}
|
||||
|
||||
DECLSPEC u32 hc_atomic_or (GLOBAL_AS u32 *p, volatile const u32 val)
|
||||
{
|
||||
return atomicOr (p, val);
|
||||
}
|
||||
|
||||
DECLSPEC size_t get_global_id (const u32 dimindx __attribute__((unused)))
|
||||
{
|
||||
return (blockIdx.x * blockDim.x) + threadIdx.x;
|
||||
}
|
||||
|
||||
DECLSPEC size_t get_local_id (const u32 dimindx __attribute__((unused)))
|
||||
{
|
||||
return threadIdx.x;
|
||||
}
|
||||
|
||||
DECLSPEC size_t get_local_size (const u32 dimindx __attribute__((unused)))
|
||||
{
|
||||
// verify
|
||||
return blockDim.x;
|
||||
}
|
||||
|
||||
DECLSPEC u32x rotl32 (const u32x a, const int n)
|
||||
{
|
||||
return ((a << n) | ((a >> (32 - n))));
|
||||
}
|
||||
|
||||
DECLSPEC u32x rotr32 (const u32x a, const int n)
|
||||
{
|
||||
return ((a >> n) | ((a << (32 - n))));
|
||||
}
|
||||
|
||||
DECLSPEC u32 rotl32_S (const u32 a, const int n)
|
||||
{
|
||||
return ((a << n) | ((a >> (32 - n))));
|
||||
}
|
||||
|
||||
DECLSPEC u32 rotr32_S (const u32 a, const int n)
|
||||
{
|
||||
return ((a >> n) | ((a << (32 - n))));
|
||||
}
|
||||
|
||||
DECLSPEC u64x rotl64 (const u64x a, const int n)
|
||||
{
|
||||
return ((a << n) | ((a >> (64 - n))));
|
||||
}
|
||||
|
||||
DECLSPEC u64x rotr64 (const u64x a, const int n)
|
||||
{
|
||||
return ((a >> n) | ((a << (64 - n))));
|
||||
}
|
||||
|
||||
DECLSPEC u64 rotl64_S (const u64 a, const int n)
|
||||
{
|
||||
return ((a << n) | ((a >> (64 - n))));
|
||||
}
|
||||
|
||||
DECLSPEC u64 rotr64_S (const u64 a, const int n)
|
||||
{
|
||||
return ((a >> n) | ((a << (64 - n))));
|
||||
}
|
||||
|
||||
#define FIXED_THREAD_COUNT(n) __launch_bounds__((n), 0)
|
||||
#define SYNC_THREADS() __syncthreads ()
|
||||
#endif
|
||||
|
||||
#if defined IS_HIP
|
||||
|
||||
#if ATTACK_EXEC == 11
|
||||
|
||||
|
@ -21,7 +21,7 @@ DECLSPEC u64 rotl64_S (const u64 a, const int n);
|
||||
DECLSPEC u64 rotr64_S (const u64 a, const int n);
|
||||
#endif
|
||||
|
||||
#if defined IS_CUDA || defined IS_HIP
|
||||
#ifdef IS_CUDA
|
||||
DECLSPEC u32 hc_atomic_dec (volatile GLOBAL_AS u32 *p);
|
||||
DECLSPEC u32 hc_atomic_inc (volatile GLOBAL_AS u32 *p);
|
||||
DECLSPEC u32 hc_atomic_or (volatile GLOBAL_AS u32 *p, volatile const u32 val);
|
||||
@ -39,10 +39,29 @@ DECLSPEC u64x rotr64 (const u64x a, const int n);
|
||||
DECLSPEC u64 rotl64_S (const u64 a, const int n);
|
||||
DECLSPEC u64 rotr64_S (const u64 a, const int n);
|
||||
|
||||
#ifdef IS_HIP
|
||||
#define rotate(a,n) (((a) << (n)) | ((a) >> (32 - (n))))
|
||||
//#define rotate(a,n) (((a) << (n)) | ((a) >> (32 - (n))))
|
||||
#define bitselect(a,b,c) ((a) ^ ((c) & ((b) ^ (a))))
|
||||
#endif
|
||||
|
||||
#ifdef IS_HIP
|
||||
DECLSPEC u32 hc_atomic_dec (volatile GLOBAL_AS u32 *p);
|
||||
DECLSPEC u32 hc_atomic_inc (volatile GLOBAL_AS u32 *p);
|
||||
DECLSPEC u32 hc_atomic_or (volatile GLOBAL_AS u32 *p, volatile const u32 val);
|
||||
|
||||
DECLSPEC size_t get_global_id (const u32 dimindx __attribute__((unused)));
|
||||
DECLSPEC size_t get_local_id (const u32 dimindx __attribute__((unused)));
|
||||
DECLSPEC size_t get_local_size (const u32 dimindx __attribute__((unused)));
|
||||
|
||||
DECLSPEC u32x rotl32 (const u32x a, const int n);
|
||||
DECLSPEC u32x rotr32 (const u32x a, const int n);
|
||||
DECLSPEC u32 rotl32_S (const u32 a, const int n);
|
||||
DECLSPEC u32 rotr32_S (const u32 a, const int n);
|
||||
DECLSPEC u64x rotl64 (const u64x a, const int n);
|
||||
DECLSPEC u64x rotr64 (const u64x a, const int n);
|
||||
DECLSPEC u64 rotl64_S (const u64 a, const int n);
|
||||
DECLSPEC u64 rotr64_S (const u64 a, const int n);
|
||||
|
||||
//#define rotate(a,n) (((a) << (n)) | ((a) >> (32 - (n))))
|
||||
#define bitselect(a,b,c) ((a) ^ ((c) & ((b) ^ (a))))
|
||||
#endif
|
||||
|
||||
|
@ -16,12 +16,12 @@
|
||||
#define DIGESTS_OFFSET digests_offset_host
|
||||
#endif
|
||||
|
||||
#if defined IS_CUDA || defined IS_HIP
|
||||
#ifdef IS_CUDA
|
||||
//https://docs.nvidia.com/cuda/nvrtc/index.html#integer-size
|
||||
typedef unsigned char uchar;
|
||||
typedef unsigned short ushort;
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned long long xulong;
|
||||
typedef unsigned long long ulong;
|
||||
#endif
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
@ -68,7 +68,7 @@ typedef u64 u64x;
|
||||
#define make_u64x (u64)
|
||||
|
||||
#else
|
||||
#if defined IS_CUDA || defined IS_HIP
|
||||
#if defined IS_CUDA
|
||||
|
||||
#if VECT_SIZE == 2
|
||||
|
||||
|
@ -16,6 +16,10 @@
|
||||
#define IS_OPENCL
|
||||
#endif
|
||||
|
||||
#ifdef IS_HIP
|
||||
#include <hip/hip_runtime.h>
|
||||
#endif
|
||||
|
||||
#if defined IS_NATIVE
|
||||
#define CONSTANT_VK
|
||||
#define CONSTANT_AS
|
||||
@ -23,7 +27,14 @@
|
||||
#define LOCAL_VK
|
||||
#define LOCAL_AS
|
||||
#define KERNEL_FQ
|
||||
#elif (defined IS_CUDA) || (defined IS_HIP)
|
||||
#elif defined IS_CUDA
|
||||
#define CONSTANT_VK __constant__
|
||||
#define CONSTANT_AS
|
||||
#define GLOBAL_AS
|
||||
#define LOCAL_VK __shared__
|
||||
#define LOCAL_AS
|
||||
#define KERNEL_FQ extern "C" __global__
|
||||
#elif defined IS_HIP
|
||||
#define CONSTANT_VK __constant__
|
||||
#define CONSTANT_AS
|
||||
#define GLOBAL_AS
|
||||
@ -78,12 +89,14 @@
|
||||
#define IS_MESA
|
||||
#define IS_GENERIC
|
||||
#elif VENDOR_ID == (1 << 5)
|
||||
//#define IS_NV //TODO: FIX ME HIP
|
||||
#define IS_POCL
|
||||
#define IS_GENERIC
|
||||
#define IS_NV
|
||||
#elif VENDOR_ID == (1 << 6)
|
||||
#define IS_POCL
|
||||
#define IS_GENERIC
|
||||
#elif VENDOR_ID == (1 << 8)
|
||||
#define IS_AMD_USE_HIP
|
||||
// TODO HIP optimization potential
|
||||
#define IS_GENERIC
|
||||
#else
|
||||
#define IS_GENERIC
|
||||
#endif
|
||||
@ -116,14 +129,12 @@
|
||||
*/
|
||||
|
||||
#if defined IS_AMD && defined IS_GPU
|
||||
#define DECLSPEC inline static __device__
|
||||
#else
|
||||
#ifdef IS_HIP
|
||||
#define DECLSPEC inline static
|
||||
#elif defined IS_HIP
|
||||
#define DECLSPEC __device__
|
||||
#else
|
||||
#define DECLSPEC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* AMD specific
|
||||
@ -141,11 +152,18 @@
|
||||
// Whitelist some OpenCL specific functions
|
||||
// This could create more stable kernels on systems with bad OpenCL drivers
|
||||
|
||||
#if defined IS_CUDA || defined IS_HIP
|
||||
#ifdef IS_CUDA
|
||||
#define USE_BITSELECT
|
||||
#define USE_ROTATE
|
||||
#endif
|
||||
|
||||
#ifdef IS_HIP
|
||||
//TODO HIP
|
||||
//#define USE_BITSELECT
|
||||
//#define USE_ROTATE
|
||||
//#define USE_SWIZZLE
|
||||
#endif
|
||||
|
||||
#ifdef IS_ROCM
|
||||
#define USE_BITSELECT
|
||||
#define USE_ROTATE
|
||||
|
@ -126,6 +126,11 @@ KERNEL_FQ void gpu_memset (GLOBAL_AS uint4 *buf, const u32 value, const u64 gid_
|
||||
r.y = value;
|
||||
r.z = value;
|
||||
r.w = value;
|
||||
#elif defined IS_HIP
|
||||
r.x = value;
|
||||
r.y = value;
|
||||
r.z = value;
|
||||
r.w = value;
|
||||
#endif
|
||||
|
||||
buf[gid] = r;
|
||||
|
@ -25,18 +25,18 @@ static const char CL_VENDOR_POCL[] = "The pocl project";
|
||||
int cuda_init (hashcat_ctx_t *hashcat_ctx);
|
||||
void cuda_close (hashcat_ctx_t *hashcat_ctx);
|
||||
|
||||
int nvrtc_init (hashcat_ctx_t *hashcat_ctx);
|
||||
void nvrtc_close (hashcat_ctx_t *hashcat_ctx);
|
||||
|
||||
int hip_init (hashcat_ctx_t *hashcat_ctx);
|
||||
void hip_close (hashcat_ctx_t *hashcat_ctx);
|
||||
|
||||
int hiprtc_init (hashcat_ctx_t *hashcat_ctx);
|
||||
void hiprtc_close (hashcat_ctx_t *hashcat_ctx);
|
||||
|
||||
int ocl_init (hashcat_ctx_t *hashcat_ctx);
|
||||
void ocl_close (hashcat_ctx_t *hashcat_ctx);
|
||||
|
||||
int nvrtc_init (hashcat_ctx_t *hashcat_ctx);
|
||||
void nvrtc_close (hashcat_ctx_t *hashcat_ctx);
|
||||
|
||||
int hiprtc_init (hashcat_ctx_t *hashcat_ctx);
|
||||
void hiprtc_close (hashcat_ctx_t *hashcat_ctx);
|
||||
|
||||
int hc_nvrtcCreateProgram (hashcat_ctx_t *hashcat_ctx, nvrtcProgram *prog, const char *src, const char *name, int numHeaders, const char * const *headers, const char * const *includeNames);
|
||||
int hc_nvrtcDestroyProgram (hashcat_ctx_t *hashcat_ctx, nvrtcProgram *prog);
|
||||
int hc_nvrtcCompileProgram (hashcat_ctx_t *hashcat_ctx, nvrtcProgram prog, int numOptions, const char * const *options);
|
||||
@ -85,15 +85,14 @@ int hc_cuLinkAddData (hashcat_ctx_t *hashcat_ctx, CUlinkState state,
|
||||
int hc_cuLinkDestroy (hashcat_ctx_t *hashcat_ctx, CUlinkState state);
|
||||
int hc_cuLinkComplete (hashcat_ctx_t *hashcat_ctx, CUlinkState state, void **cubinOut, size_t *sizeOut);
|
||||
|
||||
|
||||
int hc_hiprtcCreateProgram (hashcat_ctx_t *hashcat_ctx, hiprtcProgram *prog, const char *src, const char *name, int numHeaders, const char * const *headers, const char * const *includeNames);
|
||||
int hc_hiprtcDestroyProgram (hashcat_ctx_t *hashcat_ctx, hiprtcProgram *prog);
|
||||
int hc_hiprtcCompileProgram (hashcat_ctx_t *hashcat_ctx, hiprtcProgram prog, int numOptions, const char * const *options);
|
||||
int hc_hiprtcGetProgramLogSize (hashcat_ctx_t *hashcat_ctx, hiprtcProgram prog, size_t *logSizeRet);
|
||||
int hc_hiprtcGetProgramLog (hashcat_ctx_t *hashcat_ctx, hiprtcProgram prog, char *log);
|
||||
int hc_hiprtcGetCodeSize (hashcat_ctx_t *hashcat_ctx, hiprtcProgram prog, size_t *ptxSizeRet);
|
||||
int hc_hiprtcGetCode (hashcat_ctx_t *hashcat_ctx, hiprtcProgram prog, char *ptx);
|
||||
int hc_hiprtcVersion (hashcat_ctx_t *hashcat_ctx, int *major, int *minor);
|
||||
int hc_nvrtcCreateProgram (hashcat_ctx_t *hashcat_ctx, nvrtcProgram *prog, const char *src, const char *name, int numHeaders, const char * const *headers, const char * const *includeNames);
|
||||
int hc_nvrtcDestroyProgram (hashcat_ctx_t *hashcat_ctx, nvrtcProgram *prog);
|
||||
int hc_nvrtcCompileProgram (hashcat_ctx_t *hashcat_ctx, nvrtcProgram prog, int numOptions, const char * const *options);
|
||||
int hc_nvrtcGetProgramLogSize (hashcat_ctx_t *hashcat_ctx, nvrtcProgram prog, size_t *logSizeRet);
|
||||
int hc_nvrtcGetProgramLog (hashcat_ctx_t *hashcat_ctx, nvrtcProgram prog, char *log);
|
||||
int hc_nvrtcGetPTXSize (hashcat_ctx_t *hashcat_ctx, nvrtcProgram prog, size_t *ptxSizeRet);
|
||||
int hc_nvrtcGetPTX (hashcat_ctx_t *hashcat_ctx, nvrtcProgram prog, char *ptx);
|
||||
int hc_nvrtcVersion (hashcat_ctx_t *hashcat_ctx, int *major, int *minor);
|
||||
|
||||
int hc_hipCtxCreate (hashcat_ctx_t *hashcat_ctx, HIPcontext *pctx, unsigned int flags, HIPdevice dev);
|
||||
int hc_hipCtxDestroy (hashcat_ctx_t *hashcat_ctx, HIPcontext ctx);
|
||||
@ -132,8 +131,7 @@ int hc_hipCtxPopCurrent (hashcat_ctx_t *hashcat_ctx, HIPcontext *pctx)
|
||||
int hc_hipLinkCreate (hashcat_ctx_t *hashcat_ctx, unsigned int numOptions, HIPjit_option *options, void **optionValues, HIPlinkState *stateOut);
|
||||
int hc_hipLinkAddData (hashcat_ctx_t *hashcat_ctx, HIPlinkState state, HIPjitInputType type, void *data, size_t size, const char *name, unsigned int numOptions, HIPjit_option *options, void **optionValues);
|
||||
int hc_hipLinkDestroy (hashcat_ctx_t *hashcat_ctx, HIPlinkState state);
|
||||
int hc_hipLinkComplete (hashcat_ctx_t *hashcat_ctx, HIPlinkState state, void **hipbinOut, size_t *sizeOut);
|
||||
|
||||
int hc_hipLinkComplete (hashcat_ctx_t *hashcat_ctx, HIPlinkState state, void **cubinOut, size_t *sizeOut);
|
||||
|
||||
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_clCompileProgram (hashcat_ctx_t *hashcat_ctx, cl_program program, cl_uint num_devices, const cl_device_id *device_list, const char *options, cl_uint num_input_headers, const cl_program *input_headers, const char **header_include_names, void (CL_CALLBACK *pfn_notify) (cl_program program, void *user_data), void *user_data);
|
||||
@ -183,6 +181,7 @@ int run_cuda_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *de
|
||||
int run_cuda_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, CUdeviceptr buf, const u64 size);
|
||||
|
||||
int run_hip_kernel_atinit (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, HIPdeviceptr buf, const u64 num);
|
||||
int run_hip_kernel_utf8toutf16le (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, HIPdeviceptr buf, const u64 num);
|
||||
int run_hip_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, HIPdeviceptr buf, const u32 value, const u64 size);
|
||||
int run_hip_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, HIPdeviceptr buf, const u64 size);
|
||||
|
||||
|
170
include/types.h
170
include/types.h
@ -184,6 +184,7 @@ typedef enum vendor_id
|
||||
VENDOR_ID_NV = (1U << 5),
|
||||
VENDOR_ID_POCL = (1U << 6),
|
||||
VENDOR_ID_AMD_USE_INTEL = (1U << 7),
|
||||
VENDOR_ID_AMD_USE_HIP = (1U << 8),
|
||||
VENDOR_ID_GENERIC = (1U << 31)
|
||||
|
||||
} vendor_id_t;
|
||||
@ -696,114 +697,114 @@ typedef enum user_options_map
|
||||
IDX_ATTACK_MODE = 'a',
|
||||
IDX_BACKEND_DEVICES = 'd',
|
||||
IDX_BACKEND_IGNORE_CUDA = 0xff01,
|
||||
IDX_BACKEND_IGNORE_HIP = 0xff4d,
|
||||
IDX_BACKEND_IGNORE_OPENCL = 0xff02,
|
||||
IDX_BACKEND_IGNORE_HIP = 0xff02,
|
||||
IDX_BACKEND_IGNORE_OPENCL = 0xff03,
|
||||
IDX_BACKEND_INFO = 'I',
|
||||
IDX_BACKEND_VECTOR_WIDTH = 0xff03,
|
||||
IDX_BENCHMARK_ALL = 0xff04,
|
||||
IDX_BACKEND_VECTOR_WIDTH = 0xff04,
|
||||
IDX_BENCHMARK_ALL = 0xff05,
|
||||
IDX_BENCHMARK = 'b',
|
||||
IDX_BITMAP_MAX = 0xff05,
|
||||
IDX_BITMAP_MIN = 0xff06,
|
||||
IDX_BITMAP_MAX = 0xff06,
|
||||
IDX_BITMAP_MIN = 0xff07,
|
||||
#ifdef WITH_BRAIN
|
||||
IDX_BRAIN_CLIENT = 'z',
|
||||
IDX_BRAIN_CLIENT_FEATURES = 0xff07,
|
||||
IDX_BRAIN_HOST = 0xff08,
|
||||
IDX_BRAIN_PASSWORD = 0xff09,
|
||||
IDX_BRAIN_PORT = 0xff0a,
|
||||
IDX_BRAIN_SERVER = 0xff0b,
|
||||
IDX_BRAIN_SERVER_TIMER = 0xff0c,
|
||||
IDX_BRAIN_SESSION = 0xff0d,
|
||||
IDX_BRAIN_SESSION_WHITELIST = 0xff0e,
|
||||
IDX_BRAIN_CLIENT_FEATURES = 0xff08,
|
||||
IDX_BRAIN_HOST = 0xff09,
|
||||
IDX_BRAIN_PASSWORD = 0xff0a,
|
||||
IDX_BRAIN_PORT = 0xff0b,
|
||||
IDX_BRAIN_SERVER = 0xff0c,
|
||||
IDX_BRAIN_SERVER_TIMER = 0xff0d,
|
||||
IDX_BRAIN_SESSION = 0xff0e,
|
||||
IDX_BRAIN_SESSION_WHITELIST = 0xff0f,
|
||||
#endif
|
||||
IDX_CPU_AFFINITY = 0xff0f,
|
||||
IDX_CPU_AFFINITY = 0xff10,
|
||||
IDX_CUSTOM_CHARSET_1 = '1',
|
||||
IDX_CUSTOM_CHARSET_2 = '2',
|
||||
IDX_CUSTOM_CHARSET_3 = '3',
|
||||
IDX_CUSTOM_CHARSET_4 = '4',
|
||||
IDX_DEBUG_FILE = 0xff10,
|
||||
IDX_DEBUG_MODE = 0xff11,
|
||||
IDX_ENCODING_FROM = 0xff12,
|
||||
IDX_ENCODING_TO = 0xff13,
|
||||
IDX_HASH_INFO = 0xff14,
|
||||
IDX_FORCE = 0xff15,
|
||||
IDX_HWMON_DISABLE = 0xff16,
|
||||
IDX_HWMON_TEMP_ABORT = 0xff17,
|
||||
IDX_DEBUG_FILE = 0xff11,
|
||||
IDX_DEBUG_MODE = 0xff12,
|
||||
IDX_ENCODING_FROM = 0xff13,
|
||||
IDX_ENCODING_TO = 0xff14,
|
||||
IDX_HASH_INFO = 0xff15,
|
||||
IDX_FORCE = 0xff16,
|
||||
IDX_HWMON_DISABLE = 0xff17,
|
||||
IDX_HWMON_TEMP_ABORT = 0xff18,
|
||||
IDX_HASH_MODE = 'm',
|
||||
IDX_HCCAPX_MESSAGE_PAIR = 0xff18,
|
||||
IDX_HCCAPX_MESSAGE_PAIR = 0xff19,
|
||||
IDX_HELP = 'h',
|
||||
IDX_HEX_CHARSET = 0xff19,
|
||||
IDX_HEX_SALT = 0xff1a,
|
||||
IDX_HEX_WORDLIST = 0xff1b,
|
||||
IDX_HOOK_THREADS = 0xff1c,
|
||||
IDX_IDENTIFY = 0xff1d,
|
||||
IDX_HEX_CHARSET = 0xff1a,
|
||||
IDX_HEX_SALT = 0xff1b,
|
||||
IDX_HEX_WORDLIST = 0xff1c,
|
||||
IDX_HOOK_THREADS = 0xff1d,
|
||||
IDX_IDENTIFY = 0xff1e,
|
||||
IDX_INCREMENT = 'i',
|
||||
IDX_INCREMENT_MAX = 0xff1e,
|
||||
IDX_INCREMENT_MIN = 0xff1f,
|
||||
IDX_INDUCTION_DIR = 0xff20,
|
||||
IDX_KEEP_GUESSING = 0xff21,
|
||||
IDX_INCREMENT_MAX = 0xff1f,
|
||||
IDX_INCREMENT_MIN = 0xff20,
|
||||
IDX_INDUCTION_DIR = 0xff21,
|
||||
IDX_KEEP_GUESSING = 0xff22,
|
||||
IDX_KERNEL_ACCEL = 'n',
|
||||
IDX_KERNEL_LOOPS = 'u',
|
||||
IDX_KERNEL_THREADS = 'T',
|
||||
IDX_KEYBOARD_LAYOUT_MAPPING = 0xff22,
|
||||
IDX_KEYSPACE = 0xff23,
|
||||
IDX_LEFT = 0xff24,
|
||||
IDX_KEYBOARD_LAYOUT_MAPPING = 0xff23,
|
||||
IDX_KEYSPACE = 0xff24,
|
||||
IDX_LEFT = 0xff25,
|
||||
IDX_LIMIT = 'l',
|
||||
IDX_LOGFILE_DISABLE = 0xff25,
|
||||
IDX_LOOPBACK = 0xff26,
|
||||
IDX_MACHINE_READABLE = 0xff27,
|
||||
IDX_MARKOV_CLASSIC = 0xff28,
|
||||
IDX_MARKOV_DISABLE = 0xff29,
|
||||
IDX_MARKOV_HCSTAT2 = 0xff2a,
|
||||
IDX_MARKOV_INVERSE = 0xff2b,
|
||||
IDX_LOGFILE_DISABLE = 0xff26,
|
||||
IDX_LOOPBACK = 0xff27,
|
||||
IDX_MACHINE_READABLE = 0xff28,
|
||||
IDX_MARKOV_CLASSIC = 0xff29,
|
||||
IDX_MARKOV_DISABLE = 0xff2a,
|
||||
IDX_MARKOV_HCSTAT2 = 0xff2b,
|
||||
IDX_MARKOV_INVERSE = 0xff2c,
|
||||
IDX_MARKOV_THRESHOLD = 't',
|
||||
IDX_NONCE_ERROR_CORRECTIONS = 0xff2c,
|
||||
IDX_NONCE_ERROR_CORRECTIONS = 0xff2d,
|
||||
IDX_OPENCL_DEVICE_TYPES = 'D',
|
||||
IDX_OPTIMIZED_KERNEL_ENABLE = 'O',
|
||||
IDX_OUTFILE_AUTOHEX_DISABLE = 0xff2d,
|
||||
IDX_OUTFILE_CHECK_DIR = 0xff2e,
|
||||
IDX_OUTFILE_CHECK_TIMER = 0xff2f,
|
||||
IDX_OUTFILE_FORMAT = 0xff30,
|
||||
IDX_OUTFILE_AUTOHEX_DISABLE = 0xff2e,
|
||||
IDX_OUTFILE_CHECK_DIR = 0xff2f,
|
||||
IDX_OUTFILE_CHECK_TIMER = 0xff30,
|
||||
IDX_OUTFILE_FORMAT = 0xff31,
|
||||
IDX_OUTFILE = 'o',
|
||||
IDX_POTFILE_DISABLE = 0xff31,
|
||||
IDX_POTFILE_PATH = 0xff32,
|
||||
IDX_PROGRESS_ONLY = 0xff33,
|
||||
IDX_QUIET = 0xff34,
|
||||
IDX_REMOVE = 0xff35,
|
||||
IDX_REMOVE_TIMER = 0xff36,
|
||||
IDX_RESTORE = 0xff37,
|
||||
IDX_RESTORE_DISABLE = 0xff38,
|
||||
IDX_RESTORE_FILE_PATH = 0xff39,
|
||||
IDX_POTFILE_DISABLE = 0xff32,
|
||||
IDX_POTFILE_PATH = 0xff33,
|
||||
IDX_PROGRESS_ONLY = 0xff34,
|
||||
IDX_QUIET = 0xff35,
|
||||
IDX_REMOVE = 0xff36,
|
||||
IDX_REMOVE_TIMER = 0xff37,
|
||||
IDX_RESTORE = 0xff38,
|
||||
IDX_RESTORE_DISABLE = 0xff39,
|
||||
IDX_RESTORE_FILE_PATH = 0xff3a,
|
||||
IDX_RP_FILE = 'r',
|
||||
IDX_RP_GEN_FUNC_MAX = 0xff3a,
|
||||
IDX_RP_GEN_FUNC_MIN = 0xff3b,
|
||||
IDX_RP_GEN_FUNC_MAX = 0xff3b,
|
||||
IDX_RP_GEN_FUNC_MIN = 0xff3c,
|
||||
IDX_RP_GEN = 'g',
|
||||
IDX_RP_GEN_SEED = 0xff3c,
|
||||
IDX_RP_GEN_SEED = 0xff3d,
|
||||
IDX_RULE_BUF_L = 'j',
|
||||
IDX_RULE_BUF_R = 'k',
|
||||
IDX_RUNTIME = 0xff3d,
|
||||
IDX_SCRYPT_TMTO = 0xff3e,
|
||||
IDX_RUNTIME = 0xff3e,
|
||||
IDX_SCRYPT_TMTO = 0xff3f,
|
||||
IDX_SEGMENT_SIZE = 'c',
|
||||
IDX_SELF_TEST_DISABLE = 0xff3f,
|
||||
IDX_SELF_TEST_DISABLE = 0xff40,
|
||||
IDX_SEPARATOR = 'p',
|
||||
IDX_SESSION = 0xff40,
|
||||
IDX_SHOW = 0xff41,
|
||||
IDX_SESSION = 0xff41,
|
||||
IDX_SHOW = 0xff42,
|
||||
IDX_SKIP = 's',
|
||||
IDX_SLOW_CANDIDATES = 'S',
|
||||
IDX_SPEED_ONLY = 0xff42,
|
||||
IDX_SPIN_DAMP = 0xff43,
|
||||
IDX_STATUS = 0xff44,
|
||||
IDX_STATUS_JSON = 0xff45,
|
||||
IDX_STATUS_TIMER = 0xff46,
|
||||
IDX_STDOUT_FLAG = 0xff47,
|
||||
IDX_STDIN_TIMEOUT_ABORT = 0xff48,
|
||||
IDX_TRUECRYPT_KEYFILES = 0xff49,
|
||||
IDX_USERNAME = 0xff4a,
|
||||
IDX_VERACRYPT_KEYFILES = 0xff4b,
|
||||
IDX_VERACRYPT_PIM_START = 0xff4c,
|
||||
IDX_VERACRYPT_PIM_STOP = 0xff4d,
|
||||
IDX_SPEED_ONLY = 0xff43,
|
||||
IDX_SPIN_DAMP = 0xff44,
|
||||
IDX_STATUS = 0xff45,
|
||||
IDX_STATUS_JSON = 0xff46,
|
||||
IDX_STATUS_TIMER = 0xff47,
|
||||
IDX_STDOUT_FLAG = 0xff48,
|
||||
IDX_STDIN_TIMEOUT_ABORT = 0xff49,
|
||||
IDX_TRUECRYPT_KEYFILES = 0xff4a,
|
||||
IDX_USERNAME = 0xff4b,
|
||||
IDX_VERACRYPT_KEYFILES = 0xff4c,
|
||||
IDX_VERACRYPT_PIM_START = 0xff4d,
|
||||
IDX_VERACRYPT_PIM_STOP = 0xff4e,
|
||||
IDX_VERSION_LOWER = 'v',
|
||||
IDX_VERSION = 'V',
|
||||
IDX_WORDLIST_AUTOHEX_DISABLE = 0xff4e,
|
||||
IDX_WORDLIST_AUTOHEX_DISABLE = 0xff4f,
|
||||
IDX_WORKLOAD_PROFILE = 'w',
|
||||
|
||||
} user_options_map_t;
|
||||
@ -1503,12 +1504,14 @@ typedef struct hc_device_param
|
||||
|
||||
HIPfunction hip_function1;
|
||||
HIPfunction hip_function12;
|
||||
HIPfunction hip_function2p;
|
||||
HIPfunction hip_function2;
|
||||
HIPfunction hip_function2e;
|
||||
HIPfunction hip_function23;
|
||||
HIPfunction hip_function3;
|
||||
HIPfunction hip_function4;
|
||||
HIPfunction hip_function_init2;
|
||||
HIPfunction hip_function_loop2p;
|
||||
HIPfunction hip_function_loop2;
|
||||
HIPfunction hip_function_mp;
|
||||
HIPfunction hip_function_mp_l;
|
||||
@ -1517,6 +1520,7 @@ typedef struct hc_device_param
|
||||
HIPfunction hip_function_tm;
|
||||
HIPfunction hip_function_memset;
|
||||
HIPfunction hip_function_atinit;
|
||||
HIPfunction hip_function_utf8toutf16le;
|
||||
HIPfunction hip_function_decompress;
|
||||
HIPfunction hip_function_aux1;
|
||||
HIPfunction hip_function_aux2;
|
||||
@ -1527,8 +1531,6 @@ typedef struct hc_device_param
|
||||
HIPdeviceptr hip_d_pws_amp_buf;
|
||||
HIPdeviceptr hip_d_pws_comp_buf;
|
||||
HIPdeviceptr hip_d_pws_idx;
|
||||
HIPdeviceptr hip_d_words_buf_l;
|
||||
HIPdeviceptr hip_d_words_buf_r;
|
||||
HIPdeviceptr hip_d_rules;
|
||||
HIPdeviceptr hip_d_rules_c;
|
||||
HIPdeviceptr hip_d_combs;
|
||||
@ -1653,9 +1655,9 @@ typedef struct backend_ctx
|
||||
{
|
||||
bool enabled;
|
||||
|
||||
void *ocl;
|
||||
void *cuda;
|
||||
void *hip;
|
||||
void *ocl;
|
||||
|
||||
void *nvrtc;
|
||||
void *hiprtc;
|
||||
@ -1667,6 +1669,7 @@ typedef struct backend_ctx
|
||||
|
||||
int backend_devices_cnt;
|
||||
int backend_devices_active;
|
||||
|
||||
int cuda_devices_cnt;
|
||||
int cuda_devices_active;
|
||||
int hip_devices_cnt;
|
||||
@ -1704,7 +1707,10 @@ typedef struct backend_ctx
|
||||
int nvrtc_driver_version;
|
||||
int cuda_driver_version;
|
||||
|
||||
// cuda
|
||||
// hip
|
||||
|
||||
int rc_hip_init;
|
||||
int rc_hiprtc_init;
|
||||
|
||||
int hiprtc_driver_version;
|
||||
int hip_driver_version;
|
||||
|
@ -4,7 +4,7 @@
|
||||
##
|
||||
|
||||
SHARED ?= 0
|
||||
DEBUG := 1
|
||||
DEBUG := 0
|
||||
PRODUCTION := 0
|
||||
PRODUCTION_VERSION := v6.2.2
|
||||
ENABLE_CUBIN ?= 1
|
||||
|
@ -157,8 +157,9 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
|
||||
const u32 kernel_power_max = device_param->hardware_power * kernel_accel_max;
|
||||
|
||||
int CL_rc;
|
||||
int CU_rc;
|
||||
int HIP_rc;
|
||||
int CL_rc;
|
||||
|
||||
if (device_param->is_cuda == true)
|
||||
{
|
||||
@ -167,6 +168,13 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
if (CU_rc == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
HIP_rc = run_hip_kernel_atinit (hashcat_ctx, device_param, device_param->hip_d_pws_buf, kernel_power_max);
|
||||
|
||||
if (HIP_rc == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
CL_rc = run_opencl_kernel_atinit (hashcat_ctx, device_param, device_param->opencl_d_pws_buf, kernel_power_max);
|
||||
@ -190,6 +198,13 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
if (CU_rc == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
HIP_rc = hc_hipMemcpyDtoD (hashcat_ctx, device_param->hip_d_rules_c, device_param->hip_d_rules, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t));
|
||||
|
||||
if (HIP_rc == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
CL_rc = hc_clEnqueueCopyBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_rules, device_param->opencl_d_rules_c, 0, 0, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t), 0, NULL, NULL);
|
||||
@ -383,6 +398,27 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
if (CU_rc == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
int HIP_rc;
|
||||
|
||||
HIP_rc = run_hip_kernel_memset (hashcat_ctx, device_param, device_param->hip_d_pws_buf, 0, device_param->size_pws);
|
||||
|
||||
if (HIP_rc == -1) return -1;
|
||||
|
||||
HIP_rc = run_hip_kernel_memset (hashcat_ctx, device_param, device_param->hip_d_plain_bufs, 0, device_param->size_plains);
|
||||
|
||||
if (HIP_rc == -1) return -1;
|
||||
|
||||
HIP_rc = run_hip_kernel_memset (hashcat_ctx, device_param, device_param->hip_d_digests_shown, 0, device_param->size_shown);
|
||||
|
||||
if (HIP_rc == -1) return -1;
|
||||
|
||||
HIP_rc = run_hip_kernel_memset (hashcat_ctx, device_param, device_param->hip_d_result, 0, device_param->size_results);
|
||||
|
||||
if (HIP_rc == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
int CL_rc;
|
||||
@ -456,6 +492,11 @@ HC_API_CALL void *thread_autotune (void *p)
|
||||
if (rc_cuCtxSetCurrent == -1) return NULL;
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
if (hc_hipCtxPushCurrent (hashcat_ctx, device_param->hip_context) == -1) return NULL;
|
||||
}
|
||||
|
||||
const int rc_autotune = autotune (hashcat_ctx, device_param);
|
||||
|
||||
if (rc_autotune == -1)
|
||||
@ -463,5 +504,10 @@ HC_API_CALL void *thread_autotune (void *p)
|
||||
// we should do something here, tell hashcat main that autotune failed to abort
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
if (hc_hipCtxPopCurrent (hashcat_ctx, &device_param->hip_context) == -1) return NULL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
3882
src/backend.c
3882
src/backend.c
File diff suppressed because it is too large
Load Diff
@ -350,6 +350,11 @@ HC_API_CALL void *thread_calc_stdin (void *p)
|
||||
if (hc_cuCtxSetCurrent (hashcat_ctx, device_param->cuda_context) == -1) return NULL;
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
if (hc_hipCtxPushCurrent (hashcat_ctx, device_param->hip_context) == -1) return NULL;
|
||||
}
|
||||
|
||||
if (calc_stdin (hashcat_ctx, device_param) == -1)
|
||||
{
|
||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||
@ -357,6 +362,11 @@ HC_API_CALL void *thread_calc_stdin (void *p)
|
||||
status_ctx->devices_status = STATUS_ERROR;
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
if (hc_hipCtxPopCurrent (hashcat_ctx, &device_param->hip_context) == -1) return NULL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1584,6 +1594,11 @@ HC_API_CALL void *thread_calc (void *p)
|
||||
if (hc_cuCtxSetCurrent (hashcat_ctx, device_param->cuda_context) == -1) return NULL;
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
if (hc_hipCtxPushCurrent (hashcat_ctx, device_param->hip_context) == -1) return NULL;
|
||||
}
|
||||
|
||||
if (calc (hashcat_ctx, device_param) == -1)
|
||||
{
|
||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||
@ -1591,5 +1606,10 @@ HC_API_CALL void *thread_calc (void *p)
|
||||
status_ctx->devices_status = STATUS_ERROR;
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
if (hc_hipCtxPopCurrent (hashcat_ctx, &device_param->hip_context) == -1) return NULL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
34
src/hashes.c
34
src/hashes.c
@ -322,6 +322,11 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl
|
||||
hc_cuMemcpyDtoH (hashcat_ctx, tmps, device_param->cuda_d_tmps + (plain->gidvid * hashconfig->tmp_size), hashconfig->tmp_size);
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
hc_hipMemcpyDtoH (hashcat_ctx, tmps, device_param->hip_d_tmps + (plain->gidvid * hashconfig->tmp_size), hashconfig->tmp_size);
|
||||
}
|
||||
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_tmps, CL_TRUE, plain->gidvid * hashconfig->tmp_size, hashconfig->tmp_size, tmps, 0, NULL, NULL);
|
||||
@ -481,6 +486,7 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
u32 num_cracked = 0;
|
||||
|
||||
int CU_rc;
|
||||
int HIP_rc;
|
||||
int CL_rc;
|
||||
|
||||
if (device_param->is_cuda == true)
|
||||
@ -490,6 +496,13 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
if (CU_rc == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
HIP_rc = hc_hipMemcpyDtoH (hashcat_ctx, &num_cracked, device_param->hip_d_result, sizeof (u32));
|
||||
|
||||
if (HIP_rc == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
CL_rc = hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_result, CL_TRUE, 0, sizeof (u32), &num_cracked, 0, NULL, NULL);
|
||||
@ -516,6 +529,13 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
if (CU_rc == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
HIP_rc = hc_hipMemcpyDtoH (hashcat_ctx, cracked, device_param->hip_d_plain_bufs, num_cracked * sizeof (plain_t));
|
||||
|
||||
if (HIP_rc == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
CL_rc = hc_clEnqueueReadBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_plain_bufs, CL_TRUE, 0, num_cracked * sizeof (plain_t), cracked, 0, NULL, NULL);
|
||||
@ -573,6 +593,13 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
if (CU_rc == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
HIP_rc = hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_digests_shown + (salt_buf->digests_offset * sizeof (u32)), &hashes->digests_shown_tmp[salt_buf->digests_offset], salt_buf->digests_cnt * sizeof (u32));
|
||||
|
||||
if (HIP_rc == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_digests_shown, CL_TRUE, salt_buf->digests_offset * sizeof (u32), salt_buf->digests_cnt * sizeof (u32), &hashes->digests_shown_tmp[salt_buf->digests_offset], 0, NULL, NULL);
|
||||
@ -611,6 +638,13 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
if (CU_rc == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
HIP_rc = hc_hipMemcpyHtoD (hashcat_ctx, device_param->hip_d_result, &num_cracked, sizeof (u32));
|
||||
|
||||
if (HIP_rc == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_result, CL_TRUE, 0, sizeof (u32), &num_cracked, 0, NULL, NULL);
|
||||
|
137
src/selftest.c
137
src/selftest.c
@ -32,6 +32,13 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
device_param->kernel_params[18] = &device_param->cuda_d_st_esalts_buf;
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
device_param->kernel_params[15] = &device_param->hip_d_st_digests_buf;
|
||||
device_param->kernel_params[17] = &device_param->hip_d_st_salts_buf;
|
||||
device_param->kernel_params[18] = &device_param->hip_d_st_esalts_buf;
|
||||
}
|
||||
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
device_param->kernel_params[15] = &device_param->opencl_d_st_digests_buf;
|
||||
@ -91,6 +98,11 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_buf, &pw, 1 * sizeof (pw_t)) == -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 (device_param->is_opencl == true)
|
||||
{
|
||||
if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_buf, CL_TRUE, 0, 1 * sizeof (pw_t), &pw, 0, NULL, NULL) == -1) return -1;
|
||||
@ -126,6 +138,11 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_buf, &pw, 1 * sizeof (pw_t)) == -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 (device_param->is_opencl == true)
|
||||
{
|
||||
if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_buf, CL_TRUE, 0, 1 * sizeof (pw_t), &pw, 0, NULL, NULL) == -1) return -1;
|
||||
@ -190,6 +207,13 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_buf, &pw, 1 * sizeof (pw_t)) == -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 (hashcat_ctx, device_param->hip_d_pws_buf, &pw, 1 * sizeof (pw_t)) == -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_TRUE, 0, 1 * sizeof (pw_t), &comb, 0, NULL, NULL) == -1) return -1;
|
||||
@ -225,6 +249,11 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_buf, &pw, 1 * sizeof (pw_t)) == -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 (device_param->is_opencl == true)
|
||||
{
|
||||
if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_buf, CL_TRUE, 0, 1 * sizeof (pw_t), &pw, 0, NULL, NULL) == -1) return -1;
|
||||
@ -276,6 +305,11 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_bfs_c, &bf, 1 * sizeof (bf_t)) == -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 (device_param->is_opencl == true)
|
||||
{
|
||||
if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_bfs_c, CL_TRUE, 0, 1 * sizeof (bf_t), &bf, 0, NULL, NULL) == -1) return -1;
|
||||
@ -372,6 +406,11 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_buf, &pw, 1 * sizeof (pw_t)) == -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 (device_param->is_opencl == true)
|
||||
{
|
||||
if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_buf, CL_TRUE, 0, 1 * sizeof (pw_t), &pw, 0, NULL, NULL) == -1) return -1;
|
||||
@ -400,6 +439,11 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_pws_buf, &pw, 1 * sizeof (pw_t)) == -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 (device_param->is_opencl == true)
|
||||
{
|
||||
if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_pws_buf, CL_TRUE, 0, 1 * sizeof (pw_t), &pw, 0, NULL, NULL) == -1) return -1;
|
||||
@ -446,6 +490,11 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
if (run_cuda_kernel_utf8toutf16le (hashcat_ctx, device_param, device_param->cuda_d_pws_buf, 1) == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
if (run_hip_kernel_utf8toutf16le (hashcat_ctx, device_param, device_param->hip_d_pws_buf, 1) == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
if (run_opencl_kernel_utf8toutf16le (hashcat_ctx, device_param, device_param->opencl_d_pws_buf, 1) == -1) return -1;
|
||||
@ -463,6 +512,11 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
if (hc_cuMemcpyDtoH (hashcat_ctx, device_param->hooks_buf, device_param->cuda_d_hooks, device_param->size_hooks) == -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 (device_param->is_opencl == true)
|
||||
{
|
||||
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;
|
||||
@ -475,6 +529,11 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_hooks, device_param->hooks_buf, device_param->size_hooks) == -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 (device_param->is_opencl == true)
|
||||
{
|
||||
if (hc_clEnqueueWriteBuffer (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;
|
||||
@ -526,6 +585,11 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
if (hc_cuMemcpyDtoH (hashcat_ctx, device_param->hooks_buf, device_param->cuda_d_hooks, device_param->size_hooks) == -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 (device_param->is_opencl == true)
|
||||
{
|
||||
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;
|
||||
@ -538,6 +602,11 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
if (hc_cuMemcpyHtoD (hashcat_ctx, device_param->cuda_d_hooks, device_param->hooks_buf, device_param->size_hooks) == -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 (device_param->is_opencl == true)
|
||||
{
|
||||
if (hc_clEnqueueWriteBuffer (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;
|
||||
@ -617,6 +686,11 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
if (hc_cuMemcpyDtoH (hashcat_ctx, &num_cracked, device_param->cuda_d_result, sizeof (u32)) == -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 (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;
|
||||
@ -646,6 +720,20 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
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)
|
||||
{
|
||||
device_param->kernel_params[15] = &device_param->hip_d_digests_buf;
|
||||
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 (device_param->is_opencl == true)
|
||||
{
|
||||
device_param->kernel_params[15] = &device_param->opencl_d_digests_buf;
|
||||
@ -667,6 +755,11 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_rules_c, device_param->size_rules_c) == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_rules_c, device_param->size_rules_c) == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
if (run_opencl_kernel_bzero (hashcat_ctx, device_param, device_param->opencl_d_rules_c, device_param->size_rules_c) == -1) return -1;
|
||||
@ -681,6 +774,11 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_rules_c, device_param->size_rules_c) == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_rules_c, device_param->size_rules_c) == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
if (run_opencl_kernel_bzero (hashcat_ctx, device_param, device_param->opencl_d_rules_c, device_param->size_rules_c) == -1) return -1;
|
||||
@ -693,6 +791,11 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_combs_c, device_param->size_combs) == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_combs_c, device_param->size_combs) == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
if (run_opencl_kernel_bzero (hashcat_ctx, device_param, device_param->opencl_d_combs_c, device_param->size_combs) == -1) return -1;
|
||||
@ -705,6 +808,11 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
if (run_cuda_kernel_bzero (hashcat_ctx, device_param, device_param->cuda_d_bfs_c, device_param->size_bfs) == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
if (run_hip_kernel_bzero (hashcat_ctx, device_param, device_param->hip_d_bfs_c, device_param->size_bfs) == -1) return -1;
|
||||
}
|
||||
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
if (run_opencl_kernel_bzero (hashcat_ctx, device_param, device_param->opencl_d_bfs_c, device_param->size_bfs) == -1) return -1;
|
||||
@ -713,19 +821,25 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
}
|
||||
|
||||
// check return
|
||||
//TODO: Add HIP in the above test.
|
||||
if (num_cracked == 0 && false)
|
||||
|
||||
if (num_cracked == 0)
|
||||
{
|
||||
hc_thread_mutex_lock (status_ctx->mux_display);
|
||||
|
||||
if (device_param->is_cuda == true)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "* Device #%u: ATTENTION! CUDA kernel self-test failed.", device_param->device_id + 1);
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "* Device #%u: ATTENTION! HIP kernel self-test failed.", device_param->device_id + 1);
|
||||
}
|
||||
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "* Device #%u: ATTENTION! OpenCL kernel self-test failed.", device_param->device_id + 1);
|
||||
}
|
||||
if (device_param->is_cuda == true)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "* Device #%u: ATTENTION! CUDA kernel self-test failed.", device_param->device_id + 1);
|
||||
}
|
||||
|
||||
event_log_warning (hashcat_ctx, "Your device driver installation is probably broken.");
|
||||
event_log_warning (hashcat_ctx, "See also: https://hashcat.net/faq/wrongdriver");
|
||||
@ -735,6 +849,7 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -763,6 +878,11 @@ HC_API_CALL void *thread_selftest (void *p)
|
||||
if (hc_cuCtxSetCurrent (hashcat_ctx, device_param->cuda_context) == -1) return NULL;
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
if (hc_hipCtxPushCurrent (hashcat_ctx, device_param->hip_context) == -1) return NULL;
|
||||
}
|
||||
|
||||
const int rc_selftest = selftest (hashcat_ctx, device_param);
|
||||
|
||||
if (user_options->benchmark == true)
|
||||
@ -781,5 +901,10 @@ HC_API_CALL void *thread_selftest (void *p)
|
||||
}
|
||||
}
|
||||
|
||||
if (device_param->is_hip == true)
|
||||
{
|
||||
if (hc_hipCtxPopCurrent (hashcat_ctx, &device_param->hip_context) == -1) return NULL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user