1
mirror of https://github.com/hashcat/hashcat synced 2024-12-27 05:13:45 +01:00

Make it easier to include OpenCL kernels into modules

This commit is contained in:
jsteube 2019-04-04 20:01:37 +02:00
parent 9ced13cc94
commit d7d716f3ab
7 changed files with 68 additions and 104 deletions

View File

@ -26,42 +26,42 @@
* - P19: Type of the esalt_bufs structure with additional data, or void.
*/
#define KERN_ATTR(p2,p4,p5,p6,p19) \
GLOBAL_AS pw_t *pws, \
p2 const kernel_rule_t *rules_buf, \
GLOBAL_AS const pw_t *combs_buf, \
p4, \
GLOBAL_AS p5 *tmps, \
GLOBAL_AS p6 *hooks, \
GLOBAL_AS const u32 *bitmaps_buf_s1_a, \
GLOBAL_AS const u32 *bitmaps_buf_s1_b, \
GLOBAL_AS const u32 *bitmaps_buf_s1_c, \
GLOBAL_AS const u32 *bitmaps_buf_s1_d, \
GLOBAL_AS const u32 *bitmaps_buf_s2_a, \
GLOBAL_AS const u32 *bitmaps_buf_s2_b, \
GLOBAL_AS const u32 *bitmaps_buf_s2_c, \
GLOBAL_AS const u32 *bitmaps_buf_s2_d, \
GLOBAL_AS plain_t *plains_buf, \
GLOBAL_AS const digest_t *digests_buf, \
GLOBAL_AS u32 *hashes_shown, \
GLOBAL_AS const salt_t *salt_bufs, \
GLOBAL_AS const p19 *esalt_bufs, \
GLOBAL_AS u32 *d_return_buf, \
GLOBAL_AS void *d_extra0_buf, \
GLOBAL_AS void *d_extra1_buf, \
GLOBAL_AS void *d_extra2_buf, \
GLOBAL_AS void *d_extra3_buf, \
const u32 bitmap_mask, \
const u32 bitmap_shift1, \
const u32 bitmap_shift2, \
const u32 salt_pos, \
const u32 loop_pos, \
const u32 loop_cnt, \
const u32 il_cnt, \
const u32 digests_cnt, \
const u32 digests_offset, \
const u32 combs_mode, \
const u64 gid_max
#define KERN_ATTR(p2,p4,p5,p6,p19) \
MAYBE_UNUSED GLOBAL_AS pw_t *pws, \
MAYBE_UNUSED p2 const kernel_rule_t *rules_buf, \
MAYBE_UNUSED GLOBAL_AS const pw_t *combs_buf, \
MAYBE_UNUSED p4, \
MAYBE_UNUSED GLOBAL_AS p5 *tmps, \
MAYBE_UNUSED GLOBAL_AS p6 *hooks, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_a, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_b, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_c, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s1_d, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_a, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_b, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_c, \
MAYBE_UNUSED GLOBAL_AS const u32 *bitmaps_buf_s2_d, \
MAYBE_UNUSED GLOBAL_AS plain_t *plains_buf, \
MAYBE_UNUSED GLOBAL_AS const digest_t *digests_buf, \
MAYBE_UNUSED GLOBAL_AS u32 *hashes_shown, \
MAYBE_UNUSED GLOBAL_AS const salt_t *salt_bufs, \
MAYBE_UNUSED GLOBAL_AS const p19 *esalt_bufs, \
MAYBE_UNUSED GLOBAL_AS u32 *d_return_buf, \
MAYBE_UNUSED GLOBAL_AS void *d_extra0_buf, \
MAYBE_UNUSED GLOBAL_AS void *d_extra1_buf, \
MAYBE_UNUSED GLOBAL_AS void *d_extra2_buf, \
MAYBE_UNUSED GLOBAL_AS void *d_extra3_buf, \
MAYBE_UNUSED const u32 bitmap_mask, \
MAYBE_UNUSED const u32 bitmap_shift1, \
MAYBE_UNUSED const u32 bitmap_shift2, \
MAYBE_UNUSED const u32 salt_pos, \
MAYBE_UNUSED const u32 loop_pos, \
MAYBE_UNUSED const u32 loop_cnt, \
MAYBE_UNUSED const u32 il_cnt, \
MAYBE_UNUSED const u32 digests_cnt, \
MAYBE_UNUSED const u32 digests_offset, \
MAYBE_UNUSED const u32 combs_mode, \
MAYBE_UNUSED const u64 gid_max
/*
* Shortcut macros for usage in the actual kernels

View File

@ -18,6 +18,10 @@
#define KERNEL_FQ __kernel
#endif
#ifndef MAYBE_UNUSED
#define MAYBE_UNUSED
#endif
/**
* device type
*/

View File

@ -15,6 +15,14 @@
#define HAS_VBFE 0
#define VECT_SIZE 1
#ifdef DGST_ELEM
typedef struct digest
{
u32 digest_buf[DGST_ELEM];
} digest_t;
#endif
u32 atomic_dec (u32 *p);
u32 atomic_inc (u32 *p);

View File

@ -10,8 +10,13 @@
#include "convert.h"
#include "shared.h"
#include "memory.h"
#define DGST_ELEM 4
#include "emu_general.h"
#include "emu_inc_cipher_aes.h"
#include "emu_inc_hash_md5.h"
#include "m02500-pure.cl"
static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL;
static const u32 DGST_POS0 = 0;
@ -114,23 +119,6 @@ typedef struct hccapx hccapx_t;
#pragma pack(pop)
#define DGST_ELEM 4
typedef struct digest
{
u32 digest_buf[DGST_ELEM];
} digest_t;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include "emu_general.h"
#include "inc_vendor.h"
#include "m02500-pure.cl"
#pragma GCC diagnostic pop
static void to_hccapx_t (const hashes_t *hashes, hccapx_t *hccapx, const u32 salt_pos, const u32 digest_pos)
{
const salt_t *salts_buf = hashes->salts_buf;

View File

@ -10,8 +10,13 @@
#include "convert.h"
#include "shared.h"
#include "memory.h"
#define DGST_ELEM 4
#include "emu_general.h"
#include "emu_inc_cipher_aes.h"
#include "emu_inc_hash_md5.h"
#include "m02501-pure.cl"
static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL;
static const u32 DGST_POS0 = 0;
@ -111,23 +116,6 @@ typedef struct hccapx hccapx_t;
#pragma pack(pop)
#define DGST_ELEM 4
typedef struct digest
{
u32 digest_buf[DGST_ELEM];
} digest_t;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include "emu_general.h"
#include "inc_vendor.h"
#include "m02501-pure.cl"
#pragma GCC diagnostic pop
static void to_hccapx_t (const hashes_t *hashes, hccapx_t *hccapx, const u32 salt_pos, const u32 digest_pos)
{
const salt_t *salts_buf = hashes->salts_buf;

View File

@ -11,6 +11,11 @@
#include "shared.h"
#include "memory.h"
#define DGST_ELEM 4
#include "emu_general.h"
#include "m16800-pure.cl"
static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL;
static const u32 DGST_POS0 = 0;
static const u32 DGST_POS1 = 1;
@ -70,23 +75,6 @@ typedef struct wpa_pbkdf2_tmp
} wpa_pbkdf2_tmp_t;
*/
#define DGST_ELEM 4
typedef struct digest
{
u32 digest_buf[DGST_ELEM];
} digest_t;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include "emu_general.h"
#include "inc_vendor.h"
#include "m16800-pure.cl"
#pragma GCC diagnostic pop
const char *module_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
{
const char *mask = "?a?a?a?a?a?a?a?a";

View File

@ -11,6 +11,11 @@
#include "shared.h"
#include "memory.h"
#define DGST_ELEM 4
#include "emu_general.h"
#include "m16801-pure.cl"
static const u32 ATTACK_EXEC = ATTACK_EXEC_OUTSIDE_KERNEL;
static const u32 DGST_POS0 = 0;
static const u32 DGST_POS1 = 1;
@ -67,23 +72,6 @@ typedef struct wpa_pmk_tmp
} wpa_pmk_tmp_t;
*/
#define DGST_ELEM 4
typedef struct digest
{
u32 digest_buf[DGST_ELEM];
} digest_t;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include "emu_general.h"
#include "inc_vendor.h"
#include "m16801-pure.cl"
#pragma GCC diagnostic pop
const char *module_benchmark_mask (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
{
const char *mask = "?a?a?a?a?a?a?a?axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";