2015-12-04 14:47:52 +00:00
|
|
|
/**
|
2016-09-11 20:20:15 +00:00
|
|
|
* Author......: See docs/credits.txt
|
2015-12-04 14:47:52 +00:00
|
|
|
* License.....: MIT
|
|
|
|
*/
|
|
|
|
|
2017-07-04 09:22:48 +00:00
|
|
|
#define NEW_SIMD_CODE
|
|
|
|
|
2016-05-25 21:04:26 +00:00
|
|
|
#include "inc_vendor.cl"
|
2016-06-26 21:39:42 +00:00
|
|
|
#include "inc_hash_constants.h"
|
2016-05-25 21:04:26 +00:00
|
|
|
#include "inc_hash_functions.cl"
|
|
|
|
#include "inc_types.cl"
|
|
|
|
#include "inc_common.cl"
|
2017-07-04 09:22:48 +00:00
|
|
|
#include "inc_simd.cl"
|
|
|
|
#include "inc_hash_sha256.cl"
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-05-25 21:04:26 +00:00
|
|
|
#define COMPARE_S "inc_comp_single.cl"
|
|
|
|
#define COMPARE_M "inc_comp_multi.cl"
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2018-11-16 09:38:22 +00:00
|
|
|
__kernel void m05200_init (KERN_ATTR_TMPS (pwsafe3_tmp_t))
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* base
|
|
|
|
*/
|
|
|
|
|
2017-08-19 14:39:22 +00:00
|
|
|
const u64 gid = get_global_id (0);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if (gid >= gid_max) return;
|
|
|
|
|
2017-07-04 09:22:48 +00:00
|
|
|
sha256_ctx_t ctx;
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2017-07-04 09:22:48 +00:00
|
|
|
sha256_init (&ctx);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2018-11-20 14:32:41 +00:00
|
|
|
sha256_update_global_swap (&ctx, pws[gid].i, pws[gid].pw_len & 255);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2017-07-04 09:22:48 +00:00
|
|
|
sha256_update_global_swap (&ctx, salt_bufs[salt_pos].salt_buf, salt_bufs[salt_pos].salt_len);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2017-07-04 09:22:48 +00:00
|
|
|
sha256_final (&ctx);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2017-07-04 09:22:48 +00:00
|
|
|
tmps[gid].digest_buf[0] = ctx.h[0];
|
|
|
|
tmps[gid].digest_buf[1] = ctx.h[1];
|
|
|
|
tmps[gid].digest_buf[2] = ctx.h[2];
|
|
|
|
tmps[gid].digest_buf[3] = ctx.h[3];
|
|
|
|
tmps[gid].digest_buf[4] = ctx.h[4];
|
|
|
|
tmps[gid].digest_buf[5] = ctx.h[5];
|
|
|
|
tmps[gid].digest_buf[6] = ctx.h[6];
|
|
|
|
tmps[gid].digest_buf[7] = ctx.h[7];
|
2015-12-04 14:47:52 +00:00
|
|
|
}
|
|
|
|
|
2018-11-16 09:38:22 +00:00
|
|
|
__kernel void m05200_loop (KERN_ATTR_TMPS (pwsafe3_tmp_t))
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
2017-08-19 14:39:22 +00:00
|
|
|
const u64 gid = get_global_id (0);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2017-07-04 09:22:48 +00:00
|
|
|
if ((gid * VECT_SIZE) >= gid_max) return;
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2017-07-04 09:22:48 +00:00
|
|
|
u32x digest[8];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2017-07-04 09:22:48 +00:00
|
|
|
digest[0] = packv (tmps, digest_buf, gid, 0);
|
|
|
|
digest[1] = packv (tmps, digest_buf, gid, 1);
|
|
|
|
digest[2] = packv (tmps, digest_buf, gid, 2);
|
|
|
|
digest[3] = packv (tmps, digest_buf, gid, 3);
|
|
|
|
digest[4] = packv (tmps, digest_buf, gid, 4);
|
|
|
|
digest[5] = packv (tmps, digest_buf, gid, 5);
|
|
|
|
digest[6] = packv (tmps, digest_buf, gid, 6);
|
|
|
|
digest[7] = packv (tmps, digest_buf, gid, 7);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* init
|
|
|
|
*/
|
|
|
|
|
|
|
|
for (u32 i = 0; i < loop_cnt; i++)
|
|
|
|
{
|
2017-07-04 09:22:48 +00:00
|
|
|
u32x w0[4];
|
|
|
|
u32x w1[4];
|
|
|
|
u32x w2[4];
|
|
|
|
u32x w3[4];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
w0[0] = digest[0];
|
|
|
|
w0[1] = digest[1];
|
|
|
|
w0[2] = digest[2];
|
|
|
|
w0[3] = digest[3];
|
|
|
|
w1[0] = digest[4];
|
|
|
|
w1[1] = digest[5];
|
|
|
|
w1[2] = digest[6];
|
|
|
|
w1[3] = digest[7];
|
|
|
|
w2[0] = 0x80000000;
|
|
|
|
w2[1] = 0;
|
|
|
|
w2[2] = 0;
|
|
|
|
w2[3] = 0;
|
|
|
|
w3[0] = 0;
|
|
|
|
w3[1] = 0;
|
|
|
|
w3[2] = 0;
|
|
|
|
w3[3] = 32 * 8;
|
|
|
|
|
|
|
|
digest[0] = SHA256M_A;
|
|
|
|
digest[1] = SHA256M_B;
|
|
|
|
digest[2] = SHA256M_C;
|
|
|
|
digest[3] = SHA256M_D;
|
|
|
|
digest[4] = SHA256M_E;
|
|
|
|
digest[5] = SHA256M_F;
|
|
|
|
digest[6] = SHA256M_G;
|
|
|
|
digest[7] = SHA256M_H;
|
|
|
|
|
2017-07-04 09:22:48 +00:00
|
|
|
sha256_transform_vector (w0, w1, w2, w3, digest);
|
2015-12-04 14:47:52 +00:00
|
|
|
}
|
|
|
|
|
2017-07-04 09:22:48 +00:00
|
|
|
unpackv (tmps, digest_buf, gid, 0, digest[0]);
|
|
|
|
unpackv (tmps, digest_buf, gid, 1, digest[1]);
|
|
|
|
unpackv (tmps, digest_buf, gid, 2, digest[2]);
|
|
|
|
unpackv (tmps, digest_buf, gid, 3, digest[3]);
|
|
|
|
unpackv (tmps, digest_buf, gid, 4, digest[4]);
|
|
|
|
unpackv (tmps, digest_buf, gid, 5, digest[5]);
|
|
|
|
unpackv (tmps, digest_buf, gid, 6, digest[6]);
|
|
|
|
unpackv (tmps, digest_buf, gid, 7, digest[7]);
|
2015-12-04 14:47:52 +00:00
|
|
|
}
|
|
|
|
|
2018-11-16 09:38:22 +00:00
|
|
|
__kernel void m05200_comp (KERN_ATTR_TMPS (pwsafe3_tmp_t))
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* modifier
|
|
|
|
*/
|
|
|
|
|
2017-08-19 14:39:22 +00:00
|
|
|
const u64 gid = get_global_id (0);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
if (gid >= gid_max) return;
|
|
|
|
|
2017-08-19 14:39:22 +00:00
|
|
|
const u64 lid = get_local_id (0);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* digest
|
|
|
|
*/
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
const u32 r0 = tmps[gid].digest_buf[DGST_R0];
|
|
|
|
const u32 r1 = tmps[gid].digest_buf[DGST_R1];
|
|
|
|
const u32 r2 = tmps[gid].digest_buf[DGST_R2];
|
|
|
|
const u32 r3 = tmps[gid].digest_buf[DGST_R3];
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
#define il_pos 0
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
#include COMPARE_M
|
2015-12-04 14:47:52 +00:00
|
|
|
}
|