1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-29 19:38:18 +00:00

Add some missing function declarations

This commit is contained in:
jsteube 2018-02-06 13:06:10 +01:00
parent e59d5fd25e
commit bd9c17e49a
2 changed files with 68 additions and 67 deletions

View File

@ -58,7 +58,11 @@ int hc_clSetKernelArg (hashcat_ctx_t *hashcat_ctx, cl_kernel kernel,
int hc_clWaitForEvents (hashcat_ctx_t *hashcat_ctx, cl_uint num_events, const cl_event *event_list); int hc_clWaitForEvents (hashcat_ctx_t *hashcat_ctx, cl_uint num_events, const cl_event *event_list);
int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u64 gidd, pw_t *pw); int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u64 gidd, pw_t *pw);
int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 highest_pw_len, const u32 pws_cnt, const u32 fast_iteration, const u32 salt_pos); int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 highest_pw_len, const u32 pws_cnt, const u32 fast_iteration, const u32 salt_pos);
void rebuild_pws_compressed_append (hc_device_param_t *device_param, const u32 pws_cnt, const u8 chr);
int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 kern_run, const u64 num, const u32 event_update, const u32 iteration); int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 kern_run, const u64 num, const u32 event_update, const u32 iteration);
int run_kernel_mp (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 kern_run, const u64 num); int run_kernel_mp (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 kern_run, const u64 num);
int run_kernel_tm (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param); int run_kernel_tm (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param);
@ -66,6 +70,7 @@ int run_kernel_amp (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
int run_kernel_atinit (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u64 num); int run_kernel_atinit (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u64 num);
int run_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u32 value, const u64 size); int run_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u32 value, const u64 size);
int run_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u64 size); int run_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u64 size);
int run_kernel_decompress (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u64 num);
int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt); int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt);
int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt); int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt);

View File

@ -1415,6 +1415,57 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
return 0; return 0;
} }
void rebuild_pws_compressed_append (hc_device_param_t *device_param, const u32 pws_cnt, const u8 chr)
{
// this function is used if we have to modify the compressed pws buffer in order to
// append some data to each password candidate
u32 *tmp_pws_comp = (u32 *) hcmalloc (device_param->size_pws_comp);
pw_idx_t *tmp_pws_idx = (pw_idx_t *) hcmalloc (device_param->size_pws_idx);
for (u32 i = 0; i < pws_cnt; i++)
{
pw_idx_t *pw_idx_src = device_param->pws_idx + i;
pw_idx_t *pw_idx_dst = tmp_pws_idx + i;
const u32 src_off = pw_idx_src->off;
const u32 src_len = pw_idx_src->len;
u8 buf[256];
memcpy (buf, device_param->pws_comp + src_off, src_len);
buf[src_len] = chr;
const u32 dst_len = src_len + 1;
const u32 dst_pw_len4 = (dst_len + 3) & ~3; // round up to multiple of 4
const u32 dst_pw_len4_cnt = dst_pw_len4 / 4;
pw_idx_dst->cnt = dst_pw_len4_cnt;
pw_idx_dst->len = src_len; // this is intenionally! src_len can not be dst_len, we dont want the kernel to think 0x80 is part of the password
u8 *dst = (u8 *) (tmp_pws_comp + pw_idx_dst->off);
memcpy (dst, buf, dst_len);
memset (dst + dst_len, 0, dst_pw_len4 - dst_len);
// prepare next element
pw_idx_t *pw_idx_dst_next = pw_idx_dst + 1;
pw_idx_dst_next->off = pw_idx_dst->off + pw_idx_dst->cnt;
}
memcpy (device_param->pws_comp, tmp_pws_comp, device_param->size_pws_comp);
memcpy (device_param->pws_idx, tmp_pws_idx, device_param->size_pws_idx);
hcfree (tmp_pws_comp);
hcfree (tmp_pws_idx);
}
int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 kern_run, const u64 num, const u32 event_update, const u32 iteration) int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 kern_run, const u64 num, const u32 event_update, const u32 iteration)
{ {
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
@ -1901,58 +1952,6 @@ int run_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_para
return run_kernel_memset (hashcat_ctx, device_param, buf, 0, size); return run_kernel_memset (hashcat_ctx, device_param, buf, 0, size);
} }
void rebuild_pws_compressed_append (hc_device_param_t *device_param, const u32 pws_cnt, const u8 chr)
{
// this function is used if we have to modify the compressed pws buffer in order to
// append some data to each password candidate
u32 *tmp_pws_comp = (u32 *) hcmalloc (device_param->size_pws_comp);
pw_idx_t *tmp_pws_idx = (pw_idx_t *) hcmalloc (device_param->size_pws_idx);
for (u32 i = 0; i < pws_cnt; i++)
{
pw_idx_t *pw_idx_src = device_param->pws_idx + i;
pw_idx_t *pw_idx_dst = tmp_pws_idx + i;
const u32 src_off = pw_idx_src->off;
const u32 src_cnt = pw_idx_src->cnt;
const u32 src_len = pw_idx_src->len;
u8 buf[256];
memcpy (buf, device_param->pws_comp + src_off, src_len);
buf[src_len] = chr;
const u32 dst_len = src_len + 1;
const u32 dst_pw_len4 = (dst_len + 3) & ~3; // round up to multiple of 4
const u32 dst_pw_len4_cnt = dst_pw_len4 / 4;
pw_idx_dst->cnt = dst_pw_len4_cnt;
pw_idx_dst->len = src_len; // this is intenionally! src_len can not be dst_len, we dont want the kernel to think 0x80 is part of the password
u8 *dst = (u8 *) (tmp_pws_comp + pw_idx_dst->off);
memcpy (dst, buf, dst_len);
memset (dst + dst_len, 0, dst_pw_len4 - dst_len);
// prepare next element
pw_idx_t *pw_idx_dst_next = pw_idx_dst + 1;
pw_idx_dst_next->off = pw_idx_dst->off + pw_idx_dst->cnt;
}
memcpy (device_param->pws_comp, tmp_pws_comp, device_param->size_pws_comp);
memcpy (device_param->pws_idx, tmp_pws_idx, device_param->size_pws_idx);
hcfree (tmp_pws_comp);
hcfree (tmp_pws_idx);
}
int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt) int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt)
{ {
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx; combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
@ -3714,9 +3713,6 @@ static bool is_same_device_type (const hc_device_param_t *src, const hc_device_p
void opencl_ctx_devices_sync_tuning (hashcat_ctx_t *hashcat_ctx) void opencl_ctx_devices_sync_tuning (hashcat_ctx_t *hashcat_ctx)
{ {
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx; opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
user_options_t *user_options = hashcat_ctx->user_options;
if (opencl_ctx->enabled == false) return; if (opencl_ctx->enabled == false) return;