optimizing 21200 pure kernels: move sha1(salt) outside the loop

pull/2140/head
Gabriele Gristina 5 years ago
parent 9e9adfcd7d
commit 7c08184ea5

@ -73,6 +73,20 @@ KERNEL_FQ void m21200_mxx (KERN_ATTR_RULES ())
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
sha1_ctx_t ctx0;
sha1_init (&ctx0);
sha1_update_swap (&ctx0, s, salt_len);
sha1_final (&ctx0);
const u32 a0 = ctx0.h[0];
const u32 b0 = ctx0.h[1];
const u32 c0 = ctx0.h[2];
const u32 d0 = ctx0.h[3];
const u32 e0 = ctx0.h[4];
/**
* loop
*/
@ -88,20 +102,6 @@ KERNEL_FQ void m21200_mxx (KERN_ATTR_RULES ())
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
sha1_ctx_t ctx0;
sha1_init (&ctx0);
sha1_update_swap (&ctx0, s, salt_len);
sha1_final (&ctx0);
const u32 a0 = ctx0.h[0];
const u32 b0 = ctx0.h[1];
const u32 c0 = ctx0.h[2];
const u32 d0 = ctx0.h[3];
const u32 e0 = ctx0.h[4];
md5_ctx_t ctx1;
md5_init (&ctx1);
@ -244,6 +244,20 @@ KERNEL_FQ void m21200_sxx (KERN_ATTR_RULES ())
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
sha1_ctx_t ctx0;
sha1_init (&ctx0);
sha1_update_swap (&ctx0, s, salt_len);
sha1_final (&ctx0);
const u32 a0 = ctx0.h[0];
const u32 b0 = ctx0.h[1];
const u32 c0 = ctx0.h[2];
const u32 d0 = ctx0.h[3];
const u32 e0 = ctx0.h[4];
/**
* loop
*/
@ -259,20 +273,6 @@ KERNEL_FQ void m21200_sxx (KERN_ATTR_RULES ())
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
sha1_ctx_t ctx0;
sha1_init (&ctx0);
sha1_update_swap (&ctx0, s, salt_len);
sha1_final (&ctx0);
const u32 a0 = ctx0.h[0];
const u32 b0 = ctx0.h[1];
const u32 c0 = ctx0.h[2];
const u32 d0 = ctx0.h[3];
const u32 e0 = ctx0.h[4];
md5_ctx_t ctx1;
md5_init (&ctx1);

@ -69,6 +69,20 @@ KERNEL_FQ void m21200_mxx (KERN_ATTR_BASIC ())
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
sha1_ctx_t ctx0;
sha1_init (&ctx0);
sha1_update_swap (&ctx0, s, salt_len);
sha1_final (&ctx0);
const u32 a0 = ctx0.h[0];
const u32 b0 = ctx0.h[1];
const u32 c0 = ctx0.h[2];
const u32 d0 = ctx0.h[3];
const u32 e0 = ctx0.h[4];
md5_ctx_t ctx11;
md5_init (&ctx11);
@ -86,20 +100,6 @@ KERNEL_FQ void m21200_mxx (KERN_ATTR_BASIC ())
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
sha1_ctx_t ctx0;
sha1_init (&ctx0);
sha1_update_swap (&ctx0, s, salt_len);
sha1_final (&ctx0);
const u32 a0 = ctx0.h[0];
const u32 b0 = ctx0.h[1];
const u32 c0 = ctx0.h[2];
const u32 d0 = ctx0.h[3];
const u32 e0 = ctx0.h[4];
md5_ctx_t ctx1 = ctx11;
md5_update_global (&ctx1, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
@ -238,6 +238,20 @@ KERNEL_FQ void m21200_sxx (KERN_ATTR_BASIC ())
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
sha1_ctx_t ctx0;
sha1_init (&ctx0);
sha1_update_swap (&ctx0, s, salt_len);
sha1_final (&ctx0);
const u32 a0 = ctx0.h[0];
const u32 b0 = ctx0.h[1];
const u32 c0 = ctx0.h[2];
const u32 d0 = ctx0.h[3];
const u32 e0 = ctx0.h[4];
md5_ctx_t ctx11;
md5_init (&ctx11);
@ -255,20 +269,6 @@ KERNEL_FQ void m21200_sxx (KERN_ATTR_BASIC ())
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
sha1_ctx_t ctx0;
sha1_init (&ctx0);
sha1_update_swap (&ctx0, s, salt_len);
sha1_final (&ctx0);
const u32 a0 = ctx0.h[0];
const u32 b0 = ctx0.h[1];
const u32 c0 = ctx0.h[2];
const u32 d0 = ctx0.h[3];
const u32 e0 = ctx0.h[4];
md5_ctx_t ctx1 = ctx11;
md5_update_global (&ctx1, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);

@ -78,6 +78,20 @@ KERNEL_FQ void m21200_mxx (KERN_ATTR_VECTOR ())
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
sha1_ctx_t ctx0;
sha1_init (&ctx0);
sha1_update_swap (&ctx0, s, salt_len);
sha1_final (&ctx0);
const u32x a0 = ctx0.h[0];
const u32x b0 = ctx0.h[1];
const u32x c0 = ctx0.h[2];
const u32x d0 = ctx0.h[3];
const u32x e0 = ctx0.h[4];
/**
* loop
*/
@ -97,20 +111,6 @@ KERNEL_FQ void m21200_mxx (KERN_ATTR_VECTOR ())
w[0] = w0;
sha1_ctx_vector_t ctx0;
sha1_init_vector (&ctx0);
sha1_update_vector_swap (&ctx0, s, salt_len);
sha1_final_vector (&ctx0);
const u32x a0 = ctx0.h[0];
const u32x b0 = ctx0.h[1];
const u32x c0 = ctx0.h[2];
const u32x d0 = ctx0.h[3];
const u32x e0 = ctx0.h[4];
md5_ctx_vector_t ctx1;
md5_init_vector (&ctx1);
@ -260,6 +260,20 @@ KERNEL_FQ void m21200_sxx (KERN_ATTR_VECTOR ())
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
sha1_ctx_t ctx0;
sha1_init (&ctx0);
sha1_update_swap (&ctx0, s, salt_len);
sha1_final (&ctx0);
const u32x a0 = ctx0.h[0];
const u32x b0 = ctx0.h[1];
const u32x c0 = ctx0.h[2];
const u32x d0 = ctx0.h[3];
const u32x e0 = ctx0.h[4];
/**
* loop
*/
@ -279,20 +293,6 @@ KERNEL_FQ void m21200_sxx (KERN_ATTR_VECTOR ())
w[0] = w0;
sha1_ctx_vector_t ctx0;
sha1_init_vector (&ctx0);
sha1_update_vector_swap (&ctx0, s, salt_len);
sha1_final_vector (&ctx0);
const u32x a0 = ctx0.h[0];
const u32x b0 = ctx0.h[1];
const u32x c0 = ctx0.h[2];
const u32x d0 = ctx0.h[3];
const u32x e0 = ctx0.h[4];
md5_ctx_vector_t ctx1;
md5_init_vector (&ctx1);

Loading…
Cancel
Save