2019-02-27 16:53:00 +00:00
|
|
|
/**
|
|
|
|
* Author......: See docs/credits.txt
|
|
|
|
* License.....: MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
//#define NEW_SIMD_CODE
|
|
|
|
|
2019-03-22 14:16:25 +00:00
|
|
|
#ifdef KERNEL_STATIC
|
2019-03-21 22:00:38 +00:00
|
|
|
#include "inc_vendor.h"
|
|
|
|
#include "inc_types.h"
|
2019-04-26 11:59:43 +00:00
|
|
|
#include "inc_platform.cl"
|
2019-02-27 16:53:00 +00:00
|
|
|
#include "inc_common.cl"
|
|
|
|
#include "inc_simd.cl"
|
|
|
|
#include "inc_hash_sha256.cl"
|
2019-03-22 14:16:25 +00:00
|
|
|
#endif
|
2019-02-27 16:53:00 +00:00
|
|
|
|
|
|
|
#define COMPARE_S "inc_comp_single.cl"
|
|
|
|
#define COMPARE_M "inc_comp_multi.cl"
|
|
|
|
|
|
|
|
typedef struct qnx_sha256_tmp
|
|
|
|
{
|
|
|
|
sha256_ctx_t sha256_ctx;
|
|
|
|
|
|
|
|
} qnx_sha256_tmp_t;
|
|
|
|
|
2019-03-22 21:27:58 +00:00
|
|
|
KERNEL_FQ void m19100_init (KERN_ATTR_TMPS (qnx_sha256_tmp_t))
|
2019-02-27 16:53:00 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* base
|
|
|
|
*/
|
|
|
|
|
|
|
|
const u64 gid = get_global_id (0);
|
|
|
|
|
|
|
|
if (gid >= gid_max) return;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* init
|
|
|
|
*/
|
|
|
|
|
|
|
|
sha256_ctx_t sha256_ctx;
|
|
|
|
|
|
|
|
sha256_init (&sha256_ctx);
|
|
|
|
|
2020-09-29 13:56:32 +00:00
|
|
|
sha256_update_global_swap (&sha256_ctx, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len);
|
2019-02-27 16:53:00 +00:00
|
|
|
|
|
|
|
sha256_update_global_swap (&sha256_ctx, pws[gid].i, pws[gid].pw_len);
|
|
|
|
|
|
|
|
tmps[gid].sha256_ctx = sha256_ctx;
|
|
|
|
}
|
|
|
|
|
2019-03-22 21:27:58 +00:00
|
|
|
KERNEL_FQ void m19100_loop (KERN_ATTR_TMPS (qnx_sha256_tmp_t))
|
2019-02-27 16:53:00 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* base
|
|
|
|
*/
|
|
|
|
|
|
|
|
const u64 gid = get_global_id (0);
|
|
|
|
|
|
|
|
if (gid >= gid_max) return;
|
|
|
|
|
|
|
|
sha256_ctx_t sha256_ctx = tmps[gid].sha256_ctx;
|
|
|
|
|
|
|
|
for (u32 i = 0; i < loop_cnt; i++)
|
|
|
|
{
|
|
|
|
sha256_update_global_swap (&sha256_ctx, pws[gid].i, pws[gid].pw_len);
|
|
|
|
}
|
|
|
|
|
|
|
|
tmps[gid].sha256_ctx = sha256_ctx;
|
|
|
|
}
|
|
|
|
|
2019-03-22 21:27:58 +00:00
|
|
|
KERNEL_FQ void m19100_comp (KERN_ATTR_TMPS (qnx_sha256_tmp_t))
|
2019-02-27 16:53:00 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* modifier
|
|
|
|
*/
|
|
|
|
|
|
|
|
const u64 gid = get_global_id (0);
|
|
|
|
const u64 lid = get_local_id (0);
|
|
|
|
|
|
|
|
if (gid >= gid_max) return;
|
|
|
|
|
|
|
|
sha256_ctx_t sha256_ctx = tmps[gid].sha256_ctx;
|
|
|
|
|
|
|
|
sha256_final (&sha256_ctx);
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
const u32 r0 = hc_swap32_S (sha256_ctx.h[0]);
|
|
|
|
const u32 r1 = hc_swap32_S (sha256_ctx.h[1]);
|
|
|
|
const u32 r2 = hc_swap32_S (sha256_ctx.h[2]);
|
|
|
|
const u32 r3 = hc_swap32_S (sha256_ctx.h[3]);
|
2019-02-27 16:53:00 +00:00
|
|
|
|
|
|
|
#define il_pos 0
|
|
|
|
|
2019-03-22 14:16:25 +00:00
|
|
|
#ifdef KERNEL_STATIC
|
2019-02-27 16:53:00 +00:00
|
|
|
#include COMPARE_M
|
2019-03-22 14:16:25 +00:00
|
|
|
#endif
|
2019-02-27 16:53:00 +00:00
|
|
|
}
|