2016-03-02 13:35:10 +00:00
|
|
|
/**
|
2016-09-11 20:20:15 +00:00
|
|
|
* Author......: See docs/credits.txt
|
2016-03-02 13:35:10 +00:00
|
|
|
* 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"
|
2016-05-25 21:04:26 +00:00
|
|
|
#include "inc_common.cl"
|
2017-08-11 09:25:47 +00:00
|
|
|
#include "inc_rp_optimized.h"
|
|
|
|
#include "inc_rp_optimized.cl"
|
2016-05-25 21:04:26 +00:00
|
|
|
#include "inc_simd.cl"
|
2019-03-21 22:00:38 +00:00
|
|
|
#include "inc_hash_sha1.cl"
|
2019-03-22 14:16:25 +00:00
|
|
|
#endif
|
2016-03-02 13:35:10 +00:00
|
|
|
|
2019-03-22 21:27:58 +00:00
|
|
|
KERNEL_FQ void m13300_m04 (KERN_ATTR_RULES ())
|
2016-03-02 13:35:10 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* modifier
|
|
|
|
*/
|
|
|
|
|
2017-08-19 14:39:22 +00:00
|
|
|
const u64 lid = get_local_id (0);
|
2016-03-02 13:35:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* base
|
|
|
|
*/
|
|
|
|
|
2017-08-19 14:39:22 +00:00
|
|
|
const u64 gid = get_global_id (0);
|
2016-03-02 13:35:10 +00:00
|
|
|
|
|
|
|
if (gid >= gid_max) return;
|
|
|
|
|
|
|
|
u32 pw_buf0[4];
|
|
|
|
u32 pw_buf1[4];
|
|
|
|
|
|
|
|
pw_buf0[0] = pws[gid].i[0];
|
|
|
|
pw_buf0[1] = pws[gid].i[1];
|
|
|
|
pw_buf0[2] = pws[gid].i[2];
|
|
|
|
pw_buf0[3] = pws[gid].i[3];
|
|
|
|
pw_buf1[0] = pws[gid].i[4];
|
|
|
|
pw_buf1[1] = pws[gid].i[5];
|
|
|
|
pw_buf1[2] = pws[gid].i[6];
|
|
|
|
pw_buf1[3] = pws[gid].i[7];
|
|
|
|
|
2018-11-20 14:26:46 +00:00
|
|
|
const u32 pw_len = pws[gid].pw_len & 63;
|
2016-03-02 13:35:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* loop
|
|
|
|
*/
|
|
|
|
|
|
|
|
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
|
|
|
{
|
|
|
|
u32x w0[4] = { 0 };
|
|
|
|
u32x w1[4] = { 0 };
|
|
|
|
u32x w2[4] = { 0 };
|
|
|
|
u32x w3[4] = { 0 };
|
|
|
|
|
2019-03-25 11:24:04 +00:00
|
|
|
const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
|
2016-03-02 13:35:10 +00:00
|
|
|
|
|
|
|
append_0x80_2x4_VV (w0, w1, out_len);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* sha1
|
|
|
|
*/
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
u32x w0_t = hc_swap32 (w0[0]);
|
|
|
|
u32x w1_t = hc_swap32 (w0[1]);
|
|
|
|
u32x w2_t = hc_swap32 (w0[2]);
|
|
|
|
u32x w3_t = hc_swap32 (w0[3]);
|
|
|
|
u32x w4_t = hc_swap32 (w1[0]);
|
|
|
|
u32x w5_t = hc_swap32 (w1[1]);
|
|
|
|
u32x w6_t = hc_swap32 (w1[2]);
|
|
|
|
u32x w7_t = hc_swap32 (w1[3]);
|
|
|
|
u32x w8_t = hc_swap32 (w2[0]);
|
|
|
|
u32x w9_t = hc_swap32 (w2[1]);
|
|
|
|
u32x wa_t = hc_swap32 (w2[2]);
|
|
|
|
u32x wb_t = hc_swap32 (w2[3]);
|
|
|
|
u32x wc_t = hc_swap32 (w3[0]);
|
|
|
|
u32x wd_t = hc_swap32 (w3[1]);
|
2016-03-02 13:35:10 +00:00
|
|
|
u32x we_t = 0;
|
|
|
|
u32x wf_t = out_len * 8;
|
|
|
|
|
|
|
|
u32x a = SHA1M_A;
|
|
|
|
u32x b = SHA1M_B;
|
|
|
|
u32x c = SHA1M_C;
|
|
|
|
u32x d = SHA1M_D;
|
|
|
|
u32x e = SHA1M_E;
|
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C00
|
|
|
|
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
2019-03-23 21:15:38 +00:00
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
2016-03-02 13:35:10 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C01
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
2016-03-02 13:35:10 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C02
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
2016-03-02 13:35:10 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C03
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
2016-03-02 13:35:10 +00:00
|
|
|
|
|
|
|
a += SHA1M_A;
|
|
|
|
e += SHA1M_E;
|
|
|
|
d += SHA1M_D;
|
|
|
|
c += SHA1M_C;
|
|
|
|
|
|
|
|
e &= 0x00000000;
|
|
|
|
|
|
|
|
COMPARE_M_SIMD (a, e, d, c);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-22 21:27:58 +00:00
|
|
|
KERNEL_FQ void m13300_m08 (KERN_ATTR_RULES ())
|
2016-03-02 13:35:10 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-03-22 21:27:58 +00:00
|
|
|
KERNEL_FQ void m13300_m16 (KERN_ATTR_RULES ())
|
2016-03-02 13:35:10 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-03-22 21:27:58 +00:00
|
|
|
KERNEL_FQ void m13300_s04 (KERN_ATTR_RULES ())
|
2016-03-02 13:35:10 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* modifier
|
|
|
|
*/
|
|
|
|
|
2017-08-19 14:39:22 +00:00
|
|
|
const u64 lid = get_local_id (0);
|
2016-03-02 13:35:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* base
|
|
|
|
*/
|
|
|
|
|
2017-08-19 14:39:22 +00:00
|
|
|
const u64 gid = get_global_id (0);
|
2016-03-02 13:35:10 +00:00
|
|
|
|
|
|
|
if (gid >= gid_max) return;
|
|
|
|
|
|
|
|
u32 pw_buf0[4];
|
|
|
|
u32 pw_buf1[4];
|
|
|
|
|
|
|
|
pw_buf0[0] = pws[gid].i[0];
|
|
|
|
pw_buf0[1] = pws[gid].i[1];
|
|
|
|
pw_buf0[2] = pws[gid].i[2];
|
|
|
|
pw_buf0[3] = pws[gid].i[3];
|
|
|
|
pw_buf1[0] = pws[gid].i[4];
|
|
|
|
pw_buf1[1] = pws[gid].i[5];
|
|
|
|
pw_buf1[2] = pws[gid].i[6];
|
|
|
|
pw_buf1[3] = pws[gid].i[7];
|
|
|
|
|
2018-11-20 14:26:46 +00:00
|
|
|
const u32 pw_len = pws[gid].pw_len & 63;
|
2016-03-02 13:35:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* digest
|
|
|
|
*/
|
|
|
|
|
|
|
|
const u32 search[4] =
|
|
|
|
{
|
|
|
|
digests_buf[digests_offset].digest_buf[DGST_R0],
|
|
|
|
digests_buf[digests_offset].digest_buf[DGST_R1],
|
|
|
|
digests_buf[digests_offset].digest_buf[DGST_R2],
|
|
|
|
digests_buf[digests_offset].digest_buf[DGST_R3]
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* loop
|
|
|
|
*/
|
|
|
|
|
|
|
|
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
|
|
|
{
|
|
|
|
u32x w0[4] = { 0 };
|
|
|
|
u32x w1[4] = { 0 };
|
|
|
|
u32x w2[4] = { 0 };
|
|
|
|
u32x w3[4] = { 0 };
|
|
|
|
|
2019-03-25 11:24:04 +00:00
|
|
|
const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
|
2016-03-02 13:35:10 +00:00
|
|
|
|
|
|
|
append_0x80_2x4_VV (w0, w1, out_len);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* sha1
|
|
|
|
*/
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
u32x w0_t = hc_swap32 (w0[0]);
|
|
|
|
u32x w1_t = hc_swap32 (w0[1]);
|
|
|
|
u32x w2_t = hc_swap32 (w0[2]);
|
|
|
|
u32x w3_t = hc_swap32 (w0[3]);
|
|
|
|
u32x w4_t = hc_swap32 (w1[0]);
|
|
|
|
u32x w5_t = hc_swap32 (w1[1]);
|
|
|
|
u32x w6_t = hc_swap32 (w1[2]);
|
|
|
|
u32x w7_t = hc_swap32 (w1[3]);
|
|
|
|
u32x w8_t = hc_swap32 (w2[0]);
|
|
|
|
u32x w9_t = hc_swap32 (w2[1]);
|
|
|
|
u32x wa_t = hc_swap32 (w2[2]);
|
|
|
|
u32x wb_t = hc_swap32 (w2[3]);
|
|
|
|
u32x wc_t = hc_swap32 (w3[0]);
|
|
|
|
u32x wd_t = hc_swap32 (w3[1]);
|
2016-03-02 13:35:10 +00:00
|
|
|
u32x we_t = 0;
|
|
|
|
u32x wf_t = out_len * 8;
|
|
|
|
|
|
|
|
u32x a = SHA1M_A;
|
|
|
|
u32x b = SHA1M_B;
|
|
|
|
u32x c = SHA1M_C;
|
|
|
|
u32x d = SHA1M_D;
|
|
|
|
u32x e = SHA1M_E;
|
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C00
|
|
|
|
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
|
|
|
|
SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
|
2019-03-23 21:15:38 +00:00
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
|
2016-03-02 13:35:10 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C01
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
|
2016-03-02 13:35:10 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C02
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
|
2016-03-02 13:35:10 +00:00
|
|
|
|
|
|
|
#undef K
|
|
|
|
#define K SHA1C03
|
|
|
|
|
2019-03-23 21:15:38 +00:00
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
|
|
|
|
w0_t = hc_rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
|
|
|
|
w1_t = hc_rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
|
|
|
|
w2_t = hc_rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
|
|
|
|
w3_t = hc_rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
|
|
|
|
w4_t = hc_rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
|
|
|
|
w5_t = hc_rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
|
|
|
|
w6_t = hc_rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
|
|
|
|
w7_t = hc_rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
|
|
|
|
w8_t = hc_rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
|
|
|
|
w9_t = hc_rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
|
|
|
|
wa_t = hc_rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
|
|
|
|
wb_t = hc_rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
|
|
|
|
wc_t = hc_rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
|
|
|
|
wd_t = hc_rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
|
|
|
|
we_t = hc_rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
|
|
|
|
wf_t = hc_rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
|
2016-03-02 13:35:10 +00:00
|
|
|
|
|
|
|
a += SHA1M_A;
|
|
|
|
e += SHA1M_E;
|
|
|
|
d += SHA1M_D;
|
|
|
|
c += SHA1M_C;
|
|
|
|
|
|
|
|
e &= 0x00000000;
|
|
|
|
|
2016-08-17 18:23:25 +00:00
|
|
|
COMPARE_S_SIMD (a, e, d, c);
|
2016-03-02 13:35:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-22 21:27:58 +00:00
|
|
|
KERNEL_FQ void m13300_s08 (KERN_ATTR_RULES ())
|
2016-03-02 13:35:10 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-03-22 21:27:58 +00:00
|
|
|
KERNEL_FQ void m13300_s16 (KERN_ATTR_RULES ())
|
2016-03-02 13:35:10 +00:00
|
|
|
{
|
|
|
|
}
|