1
mirror of https://github.com/hashcat/hashcat synced 2024-12-23 14:13:43 +01:00
This commit is contained in:
Brandon Chalk 2019-04-16 10:03:05 -07:00
commit 0a4ce19915
542 changed files with 5238 additions and 4123 deletions

View File

@ -377,7 +377,7 @@ DECLSPEC u64 hc_rotr64_S (const u64 a, const int n)
DECLSPEC u64 hc_rotl64_S (const u64 a, const int n)
{
return hc_rotr64_S (a, n);
return hc_rotr64_S (a, 64 - n);
}
#if HAS_VPERM

View File

@ -110,71 +110,115 @@ DECLSPEC void md4_update_64 (md4_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3,
ctx->len += len;
if ((pos + len) < 64)
if (pos == 0)
{
switch_buffer_by_offset_le_S (w0, w1, w2, w3, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
if (len == 64)
{
md4_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
if ((pos + len) < 64)
{
switch_buffer_by_offset_le_S (w0, w1, w2, w3, pos);
switch_buffer_by_offset_carry_le_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
switch_buffer_by_offset_carry_le_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
md4_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
md4_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
}
}
@ -754,7 +798,9 @@ DECLSPEC void md4_hmac_init_64 (md4_hmac_ctx_t *ctx, const u32 *w0, const u32 *w
md4_init (&ctx->ipad);
md4_update_64 (&ctx->ipad, t0, t1, t2, t3, 64);
md4_transform (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad
@ -777,7 +823,9 @@ DECLSPEC void md4_hmac_init_64 (md4_hmac_ctx_t *ctx, const u32 *w0, const u32 *w
md4_init (&ctx->opad);
md4_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
md4_transform (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
}
DECLSPEC void md4_hmac_init (md4_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1057,29 +1105,24 @@ DECLSPEC void md4_hmac_final (md4_hmac_ctx_t *ctx)
{
md4_final (&ctx->ipad);
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
ctx->opad.w0[0] = ctx->ipad.h[0];
ctx->opad.w0[1] = ctx->ipad.h[1];
ctx->opad.w0[2] = ctx->ipad.h[2];
ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = 0;
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0];
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = 0;
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
md4_update_64 (&ctx->opad, t0, t1, t2, t3, 16);
ctx->opad.len += 16;
md4_final (&ctx->opad);
}
@ -1210,71 +1253,115 @@ DECLSPEC void md4_update_vector_64 (md4_ctx_vector_t *ctx, u32x *w0, u32x *w1, u
ctx->len += len;
if ((pos + len) < 64)
if (pos == 0)
{
switch_buffer_by_offset_le (w0, w1, w2, w3, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
if (len == 64)
{
md4_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
if ((pos + len) < 64)
{
switch_buffer_by_offset_le (w0, w1, w2, w3, pos);
switch_buffer_by_offset_carry_le (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
switch_buffer_by_offset_carry_le (w0, w1, w2, w3, c0, c1, c2, c3, pos);
md4_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
md4_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
}
}
@ -1598,7 +1685,9 @@ DECLSPEC void md4_hmac_init_vector_64 (md4_hmac_ctx_vector_t *ctx, const u32x *w
md4_init_vector (&ctx->ipad);
md4_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64);
md4_transform_vector (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad
@ -1621,7 +1710,9 @@ DECLSPEC void md4_hmac_init_vector_64 (md4_hmac_ctx_vector_t *ctx, const u32x *w
md4_init_vector (&ctx->opad);
md4_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
md4_transform_vector (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
}
DECLSPEC void md4_hmac_init_vector (md4_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
@ -1695,29 +1786,24 @@ DECLSPEC void md4_hmac_final_vector (md4_hmac_ctx_vector_t *ctx)
{
md4_final_vector (&ctx->ipad);
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
ctx->opad.w0[0] = ctx->ipad.h[0];
ctx->opad.w0[1] = ctx->ipad.h[1];
ctx->opad.w0[2] = ctx->ipad.h[2];
ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = 0;
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0];
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = 0;
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
md4_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 16);
ctx->opad.len += 16;
md4_final_vector (&ctx->opad);
}

View File

@ -146,71 +146,115 @@ DECLSPEC void md5_update_64 (md5_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3,
ctx->len += len;
if ((pos + len) < 64)
if (pos == 0)
{
switch_buffer_by_offset_le_S (w0, w1, w2, w3, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
if (len == 64)
{
md5_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
if ((pos + len) < 64)
{
switch_buffer_by_offset_le_S (w0, w1, w2, w3, pos);
switch_buffer_by_offset_carry_le_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
switch_buffer_by_offset_carry_le_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
md5_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
md5_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
}
}
@ -790,7 +834,9 @@ DECLSPEC void md5_hmac_init_64 (md5_hmac_ctx_t *ctx, const u32 *w0, const u32 *w
md5_init (&ctx->ipad);
md5_update_64 (&ctx->ipad, t0, t1, t2, t3, 64);
md5_transform (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad
@ -813,7 +859,9 @@ DECLSPEC void md5_hmac_init_64 (md5_hmac_ctx_t *ctx, const u32 *w0, const u32 *w
md5_init (&ctx->opad);
md5_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
md5_transform (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
}
DECLSPEC void md5_hmac_init (md5_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1093,29 +1141,24 @@ DECLSPEC void md5_hmac_final (md5_hmac_ctx_t *ctx)
{
md5_final (&ctx->ipad);
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
ctx->opad.w0[0] = ctx->ipad.h[0];
ctx->opad.w0[1] = ctx->ipad.h[1];
ctx->opad.w0[2] = ctx->ipad.h[2];
ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = 0;
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0];
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = 0;
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
md5_update_64 (&ctx->opad, t0, t1, t2, t3, 16);
ctx->opad.len += 16;
md5_final (&ctx->opad);
}
@ -1282,71 +1325,115 @@ DECLSPEC void md5_update_vector_64 (md5_ctx_vector_t *ctx, u32x *w0, u32x *w1, u
ctx->len += len;
if ((pos + len) < 64)
if (pos == 0)
{
switch_buffer_by_offset_le (w0, w1, w2, w3, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
if (len == 64)
{
md5_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
if ((pos + len) < 64)
{
switch_buffer_by_offset_le (w0, w1, w2, w3, pos);
switch_buffer_by_offset_carry_le (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
switch_buffer_by_offset_carry_le (w0, w1, w2, w3, c0, c1, c2, c3, pos);
md5_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
md5_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
}
}
@ -1670,7 +1757,9 @@ DECLSPEC void md5_hmac_init_vector_64 (md5_hmac_ctx_vector_t *ctx, const u32x *w
md5_init_vector (&ctx->ipad);
md5_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64);
md5_transform_vector (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad
@ -1693,7 +1782,9 @@ DECLSPEC void md5_hmac_init_vector_64 (md5_hmac_ctx_vector_t *ctx, const u32x *w
md5_init_vector (&ctx->opad);
md5_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
md5_transform_vector (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
}
DECLSPEC void md5_hmac_init_vector (md5_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
@ -1767,29 +1858,24 @@ DECLSPEC void md5_hmac_final_vector (md5_hmac_ctx_vector_t *ctx)
{
md5_final_vector (&ctx->ipad);
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
ctx->opad.w0[0] = ctx->ipad.h[0];
ctx->opad.w0[1] = ctx->ipad.h[1];
ctx->opad.w0[2] = ctx->ipad.h[2];
ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = 0;
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0];
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = 0;
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
md5_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 16);
ctx->opad.len += 16;
md5_final_vector (&ctx->opad);
}

View File

@ -244,71 +244,115 @@ DECLSPEC void ripemd160_update_64 (ripemd160_ctx_t *ctx, u32 *w0, u32 *w1, u32 *
ctx->len += len;
if ((pos + len) < 64)
if (pos == 0)
{
switch_buffer_by_offset_le_S (w0, w1, w2, w3, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
if (len == 64)
{
ripemd160_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
if ((pos + len) < 64)
{
switch_buffer_by_offset_le_S (w0, w1, w2, w3, pos);
switch_buffer_by_offset_carry_le_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
switch_buffer_by_offset_carry_le_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ripemd160_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
ripemd160_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
}
}
@ -888,7 +932,9 @@ DECLSPEC void ripemd160_hmac_init_64 (ripemd160_hmac_ctx_t *ctx, const u32 *w0,
ripemd160_init (&ctx->ipad);
ripemd160_update_64 (&ctx->ipad, t0, t1, t2, t3, 64);
ripemd160_transform (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad
@ -911,7 +957,9 @@ DECLSPEC void ripemd160_hmac_init_64 (ripemd160_hmac_ctx_t *ctx, const u32 *w0,
ripemd160_init (&ctx->opad);
ripemd160_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
ripemd160_transform (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
}
DECLSPEC void ripemd160_hmac_init (ripemd160_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1191,29 +1239,24 @@ DECLSPEC void ripemd160_hmac_final (ripemd160_hmac_ctx_t *ctx)
{
ripemd160_final (&ctx->ipad);
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
ctx->opad.w0[0] = ctx->ipad.h[0];
ctx->opad.w0[1] = ctx->ipad.h[1];
ctx->opad.w0[2] = ctx->ipad.h[2];
ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0];
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
ripemd160_update_64 (&ctx->opad, t0, t1, t2, t3, 20);
ctx->opad.len += 20;
ripemd160_final (&ctx->opad);
}
@ -1479,71 +1522,115 @@ DECLSPEC void ripemd160_update_vector_64 (ripemd160_ctx_vector_t *ctx, u32x *w0,
ctx->len += len;
if ((pos + len) < 64)
if (pos == 0)
{
switch_buffer_by_offset_le (w0, w1, w2, w3, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
if (len == 64)
{
ripemd160_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
if ((pos + len) < 64)
{
switch_buffer_by_offset_le (w0, w1, w2, w3, pos);
switch_buffer_by_offset_carry_le (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
switch_buffer_by_offset_carry_le (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ripemd160_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
ripemd160_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
}
}
@ -1867,7 +1954,9 @@ DECLSPEC void ripemd160_hmac_init_vector_64 (ripemd160_hmac_ctx_vector_t *ctx, c
ripemd160_init_vector (&ctx->ipad);
ripemd160_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64);
ripemd160_transform_vector (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad
@ -1890,7 +1979,9 @@ DECLSPEC void ripemd160_hmac_init_vector_64 (ripemd160_hmac_ctx_vector_t *ctx, c
ripemd160_init_vector (&ctx->opad);
ripemd160_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
ripemd160_transform_vector (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
}
DECLSPEC void ripemd160_hmac_init_vector (ripemd160_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
@ -1964,29 +2055,24 @@ DECLSPEC void ripemd160_hmac_final_vector (ripemd160_hmac_ctx_vector_t *ctx)
{
ripemd160_final_vector (&ctx->ipad);
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
ctx->opad.w0[0] = ctx->ipad.h[0];
ctx->opad.w0[1] = ctx->ipad.h[1];
ctx->opad.w0[2] = ctx->ipad.h[2];
ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0];
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
ripemd160_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 20);
ctx->opad.len += 20;
ripemd160_final_vector (&ctx->opad);
}

View File

@ -176,71 +176,115 @@ DECLSPEC void sha1_update_64 (sha1_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w
ctx->len += len;
if ((pos + len) < 64)
if (pos == 0)
{
switch_buffer_by_offset_be_S (w0, w1, w2, w3, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
if (len == 64)
{
sha1_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
if ((pos + len) < 64)
{
switch_buffer_by_offset_be_S (w0, w1, w2, w3, pos);
switch_buffer_by_offset_carry_be_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
switch_buffer_by_offset_carry_be_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
sha1_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
sha1_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
}
}
@ -1056,7 +1100,9 @@ DECLSPEC void sha1_hmac_init_64 (sha1_hmac_ctx_t *ctx, const u32 *w0, const u32
sha1_init (&ctx->ipad);
sha1_update_64 (&ctx->ipad, t0, t1, t2, t3, 64);
sha1_transform (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad
@ -1079,7 +1125,9 @@ DECLSPEC void sha1_hmac_init_64 (sha1_hmac_ctx_t *ctx, const u32 *w0, const u32
sha1_init (&ctx->opad);
sha1_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
sha1_transform (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
}
DECLSPEC void sha1_hmac_init (sha1_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1359,29 +1407,24 @@ DECLSPEC void sha1_hmac_final (sha1_hmac_ctx_t *ctx)
{
sha1_final (&ctx->ipad);
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
ctx->opad.w0[0] = ctx->ipad.h[0];
ctx->opad.w0[1] = ctx->ipad.h[1];
ctx->opad.w0[2] = ctx->ipad.h[2];
ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0];
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha1_update_64 (&ctx->opad, t0, t1, t2, t3, 20);
ctx->opad.len += 20;
sha1_final (&ctx->opad);
}
@ -1579,71 +1622,115 @@ DECLSPEC void sha1_update_vector_64 (sha1_ctx_vector_t *ctx, u32x *w0, u32x *w1,
ctx->len += len;
if ((pos + len) < 64)
if (pos == 0)
{
switch_buffer_by_offset_be (w0, w1, w2, w3, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
if (len == 64)
{
sha1_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
if ((pos + len) < 64)
{
switch_buffer_by_offset_be (w0, w1, w2, w3, pos);
switch_buffer_by_offset_carry_be (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
switch_buffer_by_offset_carry_be (w0, w1, w2, w3, c0, c1, c2, c3, pos);
sha1_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
sha1_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
}
}
@ -2051,7 +2138,9 @@ DECLSPEC void sha1_hmac_init_vector_64 (sha1_hmac_ctx_vector_t *ctx, const u32x
sha1_init_vector (&ctx->ipad);
sha1_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64);
sha1_transform_vector (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad
@ -2074,7 +2163,9 @@ DECLSPEC void sha1_hmac_init_vector_64 (sha1_hmac_ctx_vector_t *ctx, const u32x
sha1_init_vector (&ctx->opad);
sha1_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
sha1_transform_vector (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
}
DECLSPEC void sha1_hmac_init_vector (sha1_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
@ -2148,29 +2239,24 @@ DECLSPEC void sha1_hmac_final_vector (sha1_hmac_ctx_vector_t *ctx)
{
sha1_final_vector (&ctx->ipad);
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
ctx->opad.w0[0] = ctx->ipad.h[0];
ctx->opad.w0[1] = ctx->ipad.h[1];
ctx->opad.w0[2] = ctx->ipad.h[2];
ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0];
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha1_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 20);
ctx->opad.len += 20;
sha1_final_vector (&ctx->opad);
}

View File

@ -161,71 +161,115 @@ DECLSPEC void sha224_update_64 (sha224_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u3
ctx->len += len;
if ((pos + len) < 64)
if (pos == 0)
{
switch_buffer_by_offset_be_S (w0, w1, w2, w3, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
if (len == 64)
{
sha224_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
if ((pos + len) < 64)
{
switch_buffer_by_offset_be_S (w0, w1, w2, w3, pos);
switch_buffer_by_offset_carry_be_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
switch_buffer_by_offset_carry_be_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
sha224_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
sha224_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
}
}
@ -805,7 +849,9 @@ DECLSPEC void sha224_hmac_init_64 (sha224_hmac_ctx_t *ctx, const u32 *w0, const
sha224_init (&ctx->ipad);
sha224_update_64 (&ctx->ipad, t0, t1, t2, t3, 64);
sha224_transform (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad
@ -828,7 +874,9 @@ DECLSPEC void sha224_hmac_init_64 (sha224_hmac_ctx_t *ctx, const u32 *w0, const
sha224_init (&ctx->opad);
sha224_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
sha224_transform (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
}
DECLSPEC void sha224_hmac_init (sha224_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1108,29 +1156,24 @@ DECLSPEC void sha224_hmac_final (sha224_hmac_ctx_t *ctx)
{
sha224_final (&ctx->ipad);
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
ctx->opad.w0[0] = ctx->ipad.h[0];
ctx->opad.w0[1] = ctx->ipad.h[1];
ctx->opad.w0[2] = ctx->ipad.h[2];
ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = ctx->ipad.h[5];
ctx->opad.w1[2] = ctx->ipad.h[6];
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0];
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = ctx->ipad.h[5];
t1[2] = ctx->ipad.h[6];
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha224_update_64 (&ctx->opad, t0, t1, t2, t3, 28);
ctx->opad.len += 28;
sha224_final (&ctx->opad);
}
@ -1296,71 +1339,115 @@ DECLSPEC void sha224_update_vector_64 (sha224_ctx_vector_t *ctx, u32x *w0, u32x
ctx->len += len;
if ((pos + len) < 64)
if (pos == 0)
{
switch_buffer_by_offset_be (w0, w1, w2, w3, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
if (len == 64)
{
sha224_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
if ((pos + len) < 64)
{
switch_buffer_by_offset_be (w0, w1, w2, w3, pos);
switch_buffer_by_offset_carry_be (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
switch_buffer_by_offset_carry_be (w0, w1, w2, w3, c0, c1, c2, c3, pos);
sha224_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
sha224_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
}
}
@ -1726,7 +1813,9 @@ DECLSPEC void sha224_hmac_init_vector_64 (sha224_hmac_ctx_vector_t *ctx, const u
sha224_init_vector (&ctx->ipad);
sha224_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64);
sha224_transform_vector (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad
@ -1749,7 +1838,9 @@ DECLSPEC void sha224_hmac_init_vector_64 (sha224_hmac_ctx_vector_t *ctx, const u
sha224_init_vector (&ctx->opad);
sha224_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
sha224_transform_vector (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
}
DECLSPEC void sha224_hmac_init_vector (sha224_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
@ -1823,29 +1914,24 @@ DECLSPEC void sha224_hmac_final_vector (sha224_hmac_ctx_vector_t *ctx)
{
sha224_final_vector (&ctx->ipad);
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
ctx->opad.w0[0] = ctx->ipad.h[0];
ctx->opad.w0[1] = ctx->ipad.h[1];
ctx->opad.w0[2] = ctx->ipad.h[2];
ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = ctx->ipad.h[5];
ctx->opad.w1[2] = ctx->ipad.h[6];
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0];
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = ctx->ipad.h[5];
t1[2] = ctx->ipad.h[6];
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha224_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 28);
ctx->opad.len += 28;
sha224_final_vector (&ctx->opad);
}

View File

@ -161,71 +161,115 @@ DECLSPEC void sha256_update_64 (sha256_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u3
ctx->len += len;
if ((pos + len) < 64)
if (pos == 0)
{
switch_buffer_by_offset_be_S (w0, w1, w2, w3, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
if (len == 64)
{
sha256_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
if ((pos + len) < 64)
{
switch_buffer_by_offset_be_S (w0, w1, w2, w3, pos);
switch_buffer_by_offset_carry_be_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
switch_buffer_by_offset_carry_be_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
sha256_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
sha256_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
}
}
@ -805,7 +849,9 @@ DECLSPEC void sha256_hmac_init_64 (sha256_hmac_ctx_t *ctx, const u32 *w0, const
sha256_init (&ctx->ipad);
sha256_update_64 (&ctx->ipad, t0, t1, t2, t3, 64);
sha256_transform (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad
@ -828,7 +874,9 @@ DECLSPEC void sha256_hmac_init_64 (sha256_hmac_ctx_t *ctx, const u32 *w0, const
sha256_init (&ctx->opad);
sha256_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
sha256_transform (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
}
DECLSPEC void sha256_hmac_init (sha256_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1108,29 +1156,24 @@ DECLSPEC void sha256_hmac_final (sha256_hmac_ctx_t *ctx)
{
sha256_final (&ctx->ipad);
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
ctx->opad.w0[0] = ctx->ipad.h[0];
ctx->opad.w0[1] = ctx->ipad.h[1];
ctx->opad.w0[2] = ctx->ipad.h[2];
ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = ctx->ipad.h[5];
ctx->opad.w1[2] = ctx->ipad.h[6];
ctx->opad.w1[3] = ctx->ipad.h[7];
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0];
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = ctx->ipad.h[5];
t1[2] = ctx->ipad.h[6];
t1[3] = ctx->ipad.h[7];
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha256_update_64 (&ctx->opad, t0, t1, t2, t3, 32);
ctx->opad.len += 32;
sha256_final (&ctx->opad);
}
@ -1296,71 +1339,115 @@ DECLSPEC void sha256_update_vector_64 (sha256_ctx_vector_t *ctx, u32x *w0, u32x
ctx->len += len;
if ((pos + len) < 64)
if (pos == 0)
{
switch_buffer_by_offset_be (w0, w1, w2, w3, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
if (len == 64)
{
sha256_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
if ((pos + len) < 64)
{
switch_buffer_by_offset_be (w0, w1, w2, w3, pos);
switch_buffer_by_offset_carry_be (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
switch_buffer_by_offset_carry_be (w0, w1, w2, w3, c0, c1, c2, c3, pos);
sha256_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
sha256_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h);
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
}
}
@ -1726,7 +1813,9 @@ DECLSPEC void sha256_hmac_init_vector_64 (sha256_hmac_ctx_vector_t *ctx, const u
sha256_init_vector (&ctx->ipad);
sha256_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64);
sha256_transform_vector (t0, t1, t2, t3, ctx->ipad.h);
ctx->ipad.len = 64;
// opad
@ -1749,7 +1838,9 @@ DECLSPEC void sha256_hmac_init_vector_64 (sha256_hmac_ctx_vector_t *ctx, const u
sha256_init_vector (&ctx->opad);
sha256_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
sha256_transform_vector (t0, t1, t2, t3, ctx->opad.h);
ctx->opad.len = 64;
}
DECLSPEC void sha256_hmac_init_vector (sha256_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
@ -1823,29 +1914,24 @@ DECLSPEC void sha256_hmac_final_vector (sha256_hmac_ctx_vector_t *ctx)
{
sha256_final_vector (&ctx->ipad);
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
ctx->opad.w0[0] = ctx->ipad.h[0];
ctx->opad.w0[1] = ctx->ipad.h[1];
ctx->opad.w0[2] = ctx->ipad.h[2];
ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = ctx->ipad.h[5];
ctx->opad.w1[2] = ctx->ipad.h[6];
ctx->opad.w1[3] = ctx->ipad.h[7];
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0];
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = ctx->ipad.h[5];
t1[2] = ctx->ipad.h[6];
t1[3] = ctx->ipad.h[7];
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha256_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 32);
ctx->opad.len += 32;
sha256_final_vector (&ctx->opad);
}

View File

@ -181,123 +181,199 @@ DECLSPEC void sha384_update_128 (sha384_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u
ctx->len += len;
if ((pos + len) < 128)
if (pos == 0)
{
switch_buffer_by_offset_8x4_be_S (w0, w1, w2, w3, w4, w5, w6, w7, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w4[0] = w4[0];
ctx->w4[1] = w4[1];
ctx->w4[2] = w4[2];
ctx->w4[3] = w4[3];
ctx->w5[0] = w5[0];
ctx->w5[1] = w5[1];
ctx->w5[2] = w5[2];
ctx->w5[3] = w5[3];
ctx->w6[0] = w6[0];
ctx->w6[1] = w6[1];
ctx->w6[2] = w6[2];
ctx->w6[3] = w6[3];
ctx->w7[0] = w7[0];
ctx->w7[1] = w7[1];
ctx->w7[2] = w7[2];
ctx->w7[3] = w7[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
if (len == 128)
{
sha384_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h);
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
ctx->w4[0] = 0;
ctx->w4[1] = 0;
ctx->w4[2] = 0;
ctx->w4[3] = 0;
ctx->w5[0] = 0;
ctx->w5[1] = 0;
ctx->w5[2] = 0;
ctx->w5[3] = 0;
ctx->w6[0] = 0;
ctx->w6[1] = 0;
ctx->w6[2] = 0;
ctx->w6[3] = 0;
ctx->w7[0] = 0;
ctx->w7[1] = 0;
ctx->w7[2] = 0;
ctx->w7[3] = 0;
}
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
u32 c4[4] = { 0 };
u32 c5[4] = { 0 };
u32 c6[4] = { 0 };
u32 c7[4] = { 0 };
if ((pos + len) < 128)
{
switch_buffer_by_offset_8x4_be_S (w0, w1, w2, w3, w4, w5, w6, w7, pos);
switch_buffer_by_offset_8x4_carry_be_S (w0, w1, w2, w3, w4, w5, w6, w7, c0, c1, c2, c3, c4, c5, c6, c7, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
u32 c4[4] = { 0 };
u32 c5[4] = { 0 };
u32 c6[4] = { 0 };
u32 c7[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
switch_buffer_by_offset_8x4_carry_be_S (w0, w1, w2, w3, w4, w5, w6, w7, c0, c1, c2, c3, c4, c5, c6, c7, pos);
sha384_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
ctx->w4[0] = c4[0];
ctx->w4[1] = c4[1];
ctx->w4[2] = c4[2];
ctx->w4[3] = c4[3];
ctx->w5[0] = c5[0];
ctx->w5[1] = c5[1];
ctx->w5[2] = c5[2];
ctx->w5[3] = c5[3];
ctx->w6[0] = c6[0];
ctx->w6[1] = c6[1];
ctx->w6[2] = c6[2];
ctx->w6[3] = c6[3];
ctx->w7[0] = c7[0];
ctx->w7[1] = c7[1];
ctx->w7[2] = c7[2];
ctx->w7[3] = c7[3];
sha384_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h);
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
ctx->w4[0] = c4[0];
ctx->w4[1] = c4[1];
ctx->w4[2] = c4[2];
ctx->w4[3] = c4[3];
ctx->w5[0] = c5[0];
ctx->w5[1] = c5[1];
ctx->w5[2] = c5[2];
ctx->w5[3] = c5[3];
ctx->w6[0] = c6[0];
ctx->w6[1] = c6[1];
ctx->w6[2] = c6[2];
ctx->w6[3] = c6[3];
ctx->w7[0] = c7[0];
ctx->w7[1] = c7[1];
ctx->w7[2] = c7[2];
ctx->w7[3] = c7[3];
}
}
}
@ -1281,7 +1357,9 @@ DECLSPEC void sha384_hmac_init_128 (sha384_hmac_ctx_t *ctx, const u32 *w0, const
sha384_init (&ctx->ipad);
sha384_update_128 (&ctx->ipad, t0, t1, t2, t3, t4, t5, t6, t7, 128);
sha384_transform (t0, t1, t2, t3, t4, t5, t6, t7, ctx->ipad.h);
ctx->ipad.len = 128;
// opad
@ -1320,7 +1398,9 @@ DECLSPEC void sha384_hmac_init_128 (sha384_hmac_ctx_t *ctx, const u32 *w0, const
sha384_init (&ctx->opad);
sha384_update_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 128);
sha384_transform (t0, t1, t2, t3, t4, t5, t6, t7, ctx->opad.h);
ctx->opad.len = 128;
}
DECLSPEC void sha384_hmac_init (sha384_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1744,49 +1824,40 @@ DECLSPEC void sha384_hmac_final (sha384_hmac_ctx_t *ctx)
{
sha384_final (&ctx->ipad);
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
u32 t4[4];
u32 t5[4];
u32 t6[4];
u32 t7[4];
ctx->opad.w0[0] = h32_from_64_S (ctx->ipad.h[0]);
ctx->opad.w0[1] = l32_from_64_S (ctx->ipad.h[0]);
ctx->opad.w0[2] = h32_from_64_S (ctx->ipad.h[1]);
ctx->opad.w0[3] = l32_from_64_S (ctx->ipad.h[1]);
ctx->opad.w1[0] = h32_from_64_S (ctx->ipad.h[2]);
ctx->opad.w1[1] = l32_from_64_S (ctx->ipad.h[2]);
ctx->opad.w1[2] = h32_from_64_S (ctx->ipad.h[3]);
ctx->opad.w1[3] = l32_from_64_S (ctx->ipad.h[3]);
ctx->opad.w2[0] = h32_from_64_S (ctx->ipad.h[4]);
ctx->opad.w2[1] = l32_from_64_S (ctx->ipad.h[4]);
ctx->opad.w2[2] = h32_from_64_S (ctx->ipad.h[5]);
ctx->opad.w2[3] = l32_from_64_S (ctx->ipad.h[5]);
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
ctx->opad.w4[0] = 0;
ctx->opad.w4[1] = 0;
ctx->opad.w4[2] = 0;
ctx->opad.w4[3] = 0;
ctx->opad.w5[0] = 0;
ctx->opad.w5[1] = 0;
ctx->opad.w5[2] = 0;
ctx->opad.w5[3] = 0;
ctx->opad.w6[0] = 0;
ctx->opad.w6[1] = 0;
ctx->opad.w6[2] = 0;
ctx->opad.w6[3] = 0;
ctx->opad.w7[0] = 0;
ctx->opad.w7[1] = 0;
ctx->opad.w7[2] = 0;
ctx->opad.w7[3] = 0;
t0[0] = h32_from_64_S (ctx->ipad.h[0]);
t0[1] = l32_from_64_S (ctx->ipad.h[0]);
t0[2] = h32_from_64_S (ctx->ipad.h[1]);
t0[3] = l32_from_64_S (ctx->ipad.h[1]);
t1[0] = h32_from_64_S (ctx->ipad.h[2]);
t1[1] = l32_from_64_S (ctx->ipad.h[2]);
t1[2] = h32_from_64_S (ctx->ipad.h[3]);
t1[3] = l32_from_64_S (ctx->ipad.h[3]);
t2[0] = h32_from_64_S (ctx->ipad.h[4]);
t2[1] = l32_from_64_S (ctx->ipad.h[4]);
t2[2] = h32_from_64_S (ctx->ipad.h[5]);
t2[3] = l32_from_64_S (ctx->ipad.h[5]);
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
t4[0] = 0;
t4[1] = 0;
t4[2] = 0;
t4[3] = 0;
t5[0] = 0;
t5[1] = 0;
t5[2] = 0;
t5[3] = 0;
t6[0] = 0;
t6[1] = 0;
t6[2] = 0;
t6[3] = 0;
t7[0] = 0;
t7[1] = 0;
t7[2] = 0;
t7[3] = 0;
sha384_update_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 48);
ctx->opad.len += 48;
sha384_final (&ctx->opad);
}
@ -1984,123 +2055,199 @@ DECLSPEC void sha384_update_vector_128 (sha384_ctx_vector_t *ctx, u32x *w0, u32x
ctx->len += len;
if ((pos + len) < 128)
if (pos == 0)
{
switch_buffer_by_offset_8x4_be (w0, w1, w2, w3, w4, w5, w6, w7, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w4[0] = w4[0];
ctx->w4[1] = w4[1];
ctx->w4[2] = w4[2];
ctx->w4[3] = w4[3];
ctx->w5[0] = w5[0];
ctx->w5[1] = w5[1];
ctx->w5[2] = w5[2];
ctx->w5[3] = w5[3];
ctx->w6[0] = w6[0];
ctx->w6[1] = w6[1];
ctx->w6[2] = w6[2];
ctx->w6[3] = w6[3];
ctx->w7[0] = w7[0];
ctx->w7[1] = w7[1];
ctx->w7[2] = w7[2];
ctx->w7[3] = w7[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
if (len == 128)
{
sha384_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h);
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
ctx->w4[0] = 0;
ctx->w4[1] = 0;
ctx->w4[2] = 0;
ctx->w4[3] = 0;
ctx->w5[0] = 0;
ctx->w5[1] = 0;
ctx->w5[2] = 0;
ctx->w5[3] = 0;
ctx->w6[0] = 0;
ctx->w6[1] = 0;
ctx->w6[2] = 0;
ctx->w6[3] = 0;
ctx->w7[0] = 0;
ctx->w7[1] = 0;
ctx->w7[2] = 0;
ctx->w7[3] = 0;
}
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
u32x c4[4] = { 0 };
u32x c5[4] = { 0 };
u32x c6[4] = { 0 };
u32x c7[4] = { 0 };
if ((pos + len) < 128)
{
switch_buffer_by_offset_8x4_be (w0, w1, w2, w3, w4, w5, w6, w7, pos);
switch_buffer_by_offset_8x4_carry_be (w0, w1, w2, w3, w4, w5, w6, w7, c0, c1, c2, c3, c4, c5, c6, c7, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
u32x c4[4] = { 0 };
u32x c5[4] = { 0 };
u32x c6[4] = { 0 };
u32x c7[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
switch_buffer_by_offset_8x4_carry_be (w0, w1, w2, w3, w4, w5, w6, w7, c0, c1, c2, c3, c4, c5, c6, c7, pos);
sha384_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
ctx->w4[0] = c4[0];
ctx->w4[1] = c4[1];
ctx->w4[2] = c4[2];
ctx->w4[3] = c4[3];
ctx->w5[0] = c5[0];
ctx->w5[1] = c5[1];
ctx->w5[2] = c5[2];
ctx->w5[3] = c5[3];
ctx->w6[0] = c6[0];
ctx->w6[1] = c6[1];
ctx->w6[2] = c6[2];
ctx->w6[3] = c6[3];
ctx->w7[0] = c7[0];
ctx->w7[1] = c7[1];
ctx->w7[2] = c7[2];
ctx->w7[3] = c7[3];
sha384_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h);
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
ctx->w4[0] = c4[0];
ctx->w4[1] = c4[1];
ctx->w4[2] = c4[2];
ctx->w4[3] = c4[3];
ctx->w5[0] = c5[0];
ctx->w5[1] = c5[1];
ctx->w5[2] = c5[2];
ctx->w5[3] = c5[3];
ctx->w6[0] = c6[0];
ctx->w6[1] = c6[1];
ctx->w6[2] = c6[2];
ctx->w6[3] = c6[3];
ctx->w7[0] = c7[0];
ctx->w7[1] = c7[1];
ctx->w7[2] = c7[2];
ctx->w7[3] = c7[3];
}
}
}
@ -2710,7 +2857,9 @@ DECLSPEC void sha384_hmac_init_vector_128 (sha384_hmac_ctx_vector_t *ctx, const
sha384_init_vector (&ctx->ipad);
sha384_update_vector_128 (&ctx->ipad, t0, t1, t2, t3, t4, t5, t6, t7, 128);
sha384_transform_vector (t0, t1, t2, t3, t4, t5, t6, t7, ctx->ipad.h);
ctx->ipad.len = 128;
// opad
@ -2749,7 +2898,9 @@ DECLSPEC void sha384_hmac_init_vector_128 (sha384_hmac_ctx_vector_t *ctx, const
sha384_init_vector (&ctx->opad);
sha384_update_vector_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 128);
sha384_transform_vector (t0, t1, t2, t3, t4, t5, t6, t7, ctx->opad.h);
ctx->opad.len = 128;
}
DECLSPEC void sha384_hmac_init_vector (sha384_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
@ -2859,49 +3010,40 @@ DECLSPEC void sha384_hmac_final_vector (sha384_hmac_ctx_vector_t *ctx)
{
sha384_final_vector (&ctx->ipad);
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
u32x t4[4];
u32x t5[4];
u32x t6[4];
u32x t7[4];
ctx->opad.w0[0] = h32_from_64 (ctx->ipad.h[0]);
ctx->opad.w0[1] = l32_from_64 (ctx->ipad.h[0]);
ctx->opad.w0[2] = h32_from_64 (ctx->ipad.h[1]);
ctx->opad.w0[3] = l32_from_64 (ctx->ipad.h[1]);
ctx->opad.w1[0] = h32_from_64 (ctx->ipad.h[2]);
ctx->opad.w1[1] = l32_from_64 (ctx->ipad.h[2]);
ctx->opad.w1[2] = h32_from_64 (ctx->ipad.h[3]);
ctx->opad.w1[3] = l32_from_64 (ctx->ipad.h[3]);
ctx->opad.w2[0] = h32_from_64 (ctx->ipad.h[4]);
ctx->opad.w2[1] = l32_from_64 (ctx->ipad.h[4]);
ctx->opad.w2[2] = h32_from_64 (ctx->ipad.h[5]);
ctx->opad.w2[3] = l32_from_64 (ctx->ipad.h[5]);
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
ctx->opad.w4[0] = 0;
ctx->opad.w4[1] = 0;
ctx->opad.w4[2] = 0;
ctx->opad.w4[3] = 0;
ctx->opad.w5[0] = 0;
ctx->opad.w5[1] = 0;
ctx->opad.w5[2] = 0;
ctx->opad.w5[3] = 0;
ctx->opad.w6[0] = 0;
ctx->opad.w6[1] = 0;
ctx->opad.w6[2] = 0;
ctx->opad.w6[3] = 0;
ctx->opad.w7[0] = 0;
ctx->opad.w7[1] = 0;
ctx->opad.w7[2] = 0;
ctx->opad.w7[3] = 0;
t0[0] = h32_from_64 (ctx->ipad.h[0]);
t0[1] = l32_from_64 (ctx->ipad.h[0]);
t0[2] = h32_from_64 (ctx->ipad.h[1]);
t0[3] = l32_from_64 (ctx->ipad.h[1]);
t1[0] = h32_from_64 (ctx->ipad.h[2]);
t1[1] = l32_from_64 (ctx->ipad.h[2]);
t1[2] = h32_from_64 (ctx->ipad.h[3]);
t1[3] = l32_from_64 (ctx->ipad.h[3]);
t2[0] = h32_from_64 (ctx->ipad.h[4]);
t2[1] = l32_from_64 (ctx->ipad.h[4]);
t2[2] = h32_from_64 (ctx->ipad.h[5]);
t2[3] = l32_from_64 (ctx->ipad.h[5]);
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
t4[0] = 0;
t4[1] = 0;
t4[2] = 0;
t4[3] = 0;
t5[0] = 0;
t5[1] = 0;
t5[2] = 0;
t5[3] = 0;
t6[0] = 0;
t6[1] = 0;
t6[2] = 0;
t6[3] = 0;
t7[0] = 0;
t7[1] = 0;
t7[2] = 0;
t7[3] = 0;
sha384_update_vector_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 48);
ctx->opad.len += 48;
sha384_final_vector (&ctx->opad);
}

View File

@ -181,123 +181,199 @@ DECLSPEC void sha512_update_128 (sha512_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u
ctx->len += len;
if ((pos + len) < 128)
if (pos == 0)
{
switch_buffer_by_offset_8x4_be_S (w0, w1, w2, w3, w4, w5, w6, w7, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w4[0] = w4[0];
ctx->w4[1] = w4[1];
ctx->w4[2] = w4[2];
ctx->w4[3] = w4[3];
ctx->w5[0] = w5[0];
ctx->w5[1] = w5[1];
ctx->w5[2] = w5[2];
ctx->w5[3] = w5[3];
ctx->w6[0] = w6[0];
ctx->w6[1] = w6[1];
ctx->w6[2] = w6[2];
ctx->w6[3] = w6[3];
ctx->w7[0] = w7[0];
ctx->w7[1] = w7[1];
ctx->w7[2] = w7[2];
ctx->w7[3] = w7[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
if (len == 128)
{
sha512_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h);
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
ctx->w4[0] = 0;
ctx->w4[1] = 0;
ctx->w4[2] = 0;
ctx->w4[3] = 0;
ctx->w5[0] = 0;
ctx->w5[1] = 0;
ctx->w5[2] = 0;
ctx->w5[3] = 0;
ctx->w6[0] = 0;
ctx->w6[1] = 0;
ctx->w6[2] = 0;
ctx->w6[3] = 0;
ctx->w7[0] = 0;
ctx->w7[1] = 0;
ctx->w7[2] = 0;
ctx->w7[3] = 0;
}
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
u32 c4[4] = { 0 };
u32 c5[4] = { 0 };
u32 c6[4] = { 0 };
u32 c7[4] = { 0 };
if ((pos + len) < 128)
{
switch_buffer_by_offset_8x4_be_S (w0, w1, w2, w3, w4, w5, w6, w7, pos);
switch_buffer_by_offset_8x4_carry_be_S (w0, w1, w2, w3, w4, w5, w6, w7, c0, c1, c2, c3, c4, c5, c6, c7, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
u32 c4[4] = { 0 };
u32 c5[4] = { 0 };
u32 c6[4] = { 0 };
u32 c7[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
switch_buffer_by_offset_8x4_carry_be_S (w0, w1, w2, w3, w4, w5, w6, w7, c0, c1, c2, c3, c4, c5, c6, c7, pos);
sha512_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
ctx->w4[0] = c4[0];
ctx->w4[1] = c4[1];
ctx->w4[2] = c4[2];
ctx->w4[3] = c4[3];
ctx->w5[0] = c5[0];
ctx->w5[1] = c5[1];
ctx->w5[2] = c5[2];
ctx->w5[3] = c5[3];
ctx->w6[0] = c6[0];
ctx->w6[1] = c6[1];
ctx->w6[2] = c6[2];
ctx->w6[3] = c6[3];
ctx->w7[0] = c7[0];
ctx->w7[1] = c7[1];
ctx->w7[2] = c7[2];
ctx->w7[3] = c7[3];
sha512_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h);
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
ctx->w4[0] = c4[0];
ctx->w4[1] = c4[1];
ctx->w4[2] = c4[2];
ctx->w4[3] = c4[3];
ctx->w5[0] = c5[0];
ctx->w5[1] = c5[1];
ctx->w5[2] = c5[2];
ctx->w5[3] = c5[3];
ctx->w6[0] = c6[0];
ctx->w6[1] = c6[1];
ctx->w6[2] = c6[2];
ctx->w6[3] = c6[3];
ctx->w7[0] = c7[0];
ctx->w7[1] = c7[1];
ctx->w7[2] = c7[2];
ctx->w7[3] = c7[3];
}
}
}
@ -1281,7 +1357,9 @@ DECLSPEC void sha512_hmac_init_128 (sha512_hmac_ctx_t *ctx, const u32 *w0, const
sha512_init (&ctx->ipad);
sha512_update_128 (&ctx->ipad, t0, t1, t2, t3, t4, t5, t6, t7, 128);
sha512_transform (t0, t1, t2, t3, t4, t5, t6, t7, ctx->ipad.h);
ctx->ipad.len = 128;
// opad
@ -1320,7 +1398,9 @@ DECLSPEC void sha512_hmac_init_128 (sha512_hmac_ctx_t *ctx, const u32 *w0, const
sha512_init (&ctx->opad);
sha512_update_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 128);
sha512_transform (t0, t1, t2, t3, t4, t5, t6, t7, ctx->opad.h);
ctx->opad.len = 128;
}
DECLSPEC void sha512_hmac_init (sha512_hmac_ctx_t *ctx, const u32 *w, const int len)
@ -1861,49 +1941,40 @@ DECLSPEC void sha512_hmac_final (sha512_hmac_ctx_t *ctx)
{
sha512_final (&ctx->ipad);
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
u32 t4[4];
u32 t5[4];
u32 t6[4];
u32 t7[4];
ctx->opad.w0[0] = h32_from_64_S (ctx->ipad.h[0]);
ctx->opad.w0[1] = l32_from_64_S (ctx->ipad.h[0]);
ctx->opad.w0[2] = h32_from_64_S (ctx->ipad.h[1]);
ctx->opad.w0[3] = l32_from_64_S (ctx->ipad.h[1]);
ctx->opad.w1[0] = h32_from_64_S (ctx->ipad.h[2]);
ctx->opad.w1[1] = l32_from_64_S (ctx->ipad.h[2]);
ctx->opad.w1[2] = h32_from_64_S (ctx->ipad.h[3]);
ctx->opad.w1[3] = l32_from_64_S (ctx->ipad.h[3]);
ctx->opad.w2[0] = h32_from_64_S (ctx->ipad.h[4]);
ctx->opad.w2[1] = l32_from_64_S (ctx->ipad.h[4]);
ctx->opad.w2[2] = h32_from_64_S (ctx->ipad.h[5]);
ctx->opad.w2[3] = l32_from_64_S (ctx->ipad.h[5]);
ctx->opad.w3[0] = h32_from_64_S (ctx->ipad.h[6]);
ctx->opad.w3[1] = l32_from_64_S (ctx->ipad.h[6]);
ctx->opad.w3[2] = h32_from_64_S (ctx->ipad.h[7]);
ctx->opad.w3[3] = l32_from_64_S (ctx->ipad.h[7]);
ctx->opad.w4[0] = 0;
ctx->opad.w4[1] = 0;
ctx->opad.w4[2] = 0;
ctx->opad.w4[3] = 0;
ctx->opad.w5[0] = 0;
ctx->opad.w5[1] = 0;
ctx->opad.w5[2] = 0;
ctx->opad.w5[3] = 0;
ctx->opad.w6[0] = 0;
ctx->opad.w6[1] = 0;
ctx->opad.w6[2] = 0;
ctx->opad.w6[3] = 0;
ctx->opad.w7[0] = 0;
ctx->opad.w7[1] = 0;
ctx->opad.w7[2] = 0;
ctx->opad.w7[3] = 0;
t0[0] = h32_from_64_S (ctx->ipad.h[0]);
t0[1] = l32_from_64_S (ctx->ipad.h[0]);
t0[2] = h32_from_64_S (ctx->ipad.h[1]);
t0[3] = l32_from_64_S (ctx->ipad.h[1]);
t1[0] = h32_from_64_S (ctx->ipad.h[2]);
t1[1] = l32_from_64_S (ctx->ipad.h[2]);
t1[2] = h32_from_64_S (ctx->ipad.h[3]);
t1[3] = l32_from_64_S (ctx->ipad.h[3]);
t2[0] = h32_from_64_S (ctx->ipad.h[4]);
t2[1] = l32_from_64_S (ctx->ipad.h[4]);
t2[2] = h32_from_64_S (ctx->ipad.h[5]);
t2[3] = l32_from_64_S (ctx->ipad.h[5]);
t3[0] = h32_from_64_S (ctx->ipad.h[6]);
t3[1] = l32_from_64_S (ctx->ipad.h[6]);
t3[2] = h32_from_64_S (ctx->ipad.h[7]);
t3[3] = l32_from_64_S (ctx->ipad.h[7]);
t4[0] = 0;
t4[1] = 0;
t4[2] = 0;
t4[3] = 0;
t5[0] = 0;
t5[1] = 0;
t5[2] = 0;
t5[3] = 0;
t6[0] = 0;
t6[1] = 0;
t6[2] = 0;
t6[3] = 0;
t7[0] = 0;
t7[1] = 0;
t7[2] = 0;
t7[3] = 0;
sha512_update_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 64);
ctx->opad.len += 64;
sha512_final (&ctx->opad);
}
@ -2101,123 +2172,199 @@ DECLSPEC void sha512_update_vector_128 (sha512_ctx_vector_t *ctx, u32x *w0, u32x
ctx->len += len;
if ((pos + len) < 128)
if (pos == 0)
{
switch_buffer_by_offset_8x4_be (w0, w1, w2, w3, w4, w5, w6, w7, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w4[0] = w4[0];
ctx->w4[1] = w4[1];
ctx->w4[2] = w4[2];
ctx->w4[3] = w4[3];
ctx->w5[0] = w5[0];
ctx->w5[1] = w5[1];
ctx->w5[2] = w5[2];
ctx->w5[3] = w5[3];
ctx->w6[0] = w6[0];
ctx->w6[1] = w6[1];
ctx->w6[2] = w6[2];
ctx->w6[3] = w6[3];
ctx->w7[0] = w7[0];
ctx->w7[1] = w7[1];
ctx->w7[2] = w7[2];
ctx->w7[3] = w7[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
if (len == 128)
{
sha512_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h);
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
ctx->w4[0] = 0;
ctx->w4[1] = 0;
ctx->w4[2] = 0;
ctx->w4[3] = 0;
ctx->w5[0] = 0;
ctx->w5[1] = 0;
ctx->w5[2] = 0;
ctx->w5[3] = 0;
ctx->w6[0] = 0;
ctx->w6[1] = 0;
ctx->w6[2] = 0;
ctx->w6[3] = 0;
ctx->w7[0] = 0;
ctx->w7[1] = 0;
ctx->w7[2] = 0;
ctx->w7[3] = 0;
}
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
u32x c4[4] = { 0 };
u32x c5[4] = { 0 };
u32x c6[4] = { 0 };
u32x c7[4] = { 0 };
if ((pos + len) < 128)
{
switch_buffer_by_offset_8x4_be (w0, w1, w2, w3, w4, w5, w6, w7, pos);
switch_buffer_by_offset_8x4_carry_be (w0, w1, w2, w3, w4, w5, w6, w7, c0, c1, c2, c3, c4, c5, c6, c7, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
u32x c4[4] = { 0 };
u32x c5[4] = { 0 };
u32x c6[4] = { 0 };
u32x c7[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
switch_buffer_by_offset_8x4_carry_be (w0, w1, w2, w3, w4, w5, w6, w7, c0, c1, c2, c3, c4, c5, c6, c7, pos);
sha512_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w4[0] |= w4[0];
ctx->w4[1] |= w4[1];
ctx->w4[2] |= w4[2];
ctx->w4[3] |= w4[3];
ctx->w5[0] |= w5[0];
ctx->w5[1] |= w5[1];
ctx->w5[2] |= w5[2];
ctx->w5[3] |= w5[3];
ctx->w6[0] |= w6[0];
ctx->w6[1] |= w6[1];
ctx->w6[2] |= w6[2];
ctx->w6[3] |= w6[3];
ctx->w7[0] |= w7[0];
ctx->w7[1] |= w7[1];
ctx->w7[2] |= w7[2];
ctx->w7[3] |= w7[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
ctx->w4[0] = c4[0];
ctx->w4[1] = c4[1];
ctx->w4[2] = c4[2];
ctx->w4[3] = c4[3];
ctx->w5[0] = c5[0];
ctx->w5[1] = c5[1];
ctx->w5[2] = c5[2];
ctx->w5[3] = c5[3];
ctx->w6[0] = c6[0];
ctx->w6[1] = c6[1];
ctx->w6[2] = c6[2];
ctx->w6[3] = c6[3];
ctx->w7[0] = c7[0];
ctx->w7[1] = c7[1];
ctx->w7[2] = c7[2];
ctx->w7[3] = c7[3];
sha512_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->w4, ctx->w5, ctx->w6, ctx->w7, ctx->h);
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
ctx->w4[0] = c4[0];
ctx->w4[1] = c4[1];
ctx->w4[2] = c4[2];
ctx->w4[3] = c4[3];
ctx->w5[0] = c5[0];
ctx->w5[1] = c5[1];
ctx->w5[2] = c5[2];
ctx->w5[3] = c5[3];
ctx->w6[0] = c6[0];
ctx->w6[1] = c6[1];
ctx->w6[2] = c6[2];
ctx->w6[3] = c6[3];
ctx->w7[0] = c7[0];
ctx->w7[1] = c7[1];
ctx->w7[2] = c7[2];
ctx->w7[3] = c7[3];
}
}
}
@ -2827,7 +2974,9 @@ DECLSPEC void sha512_hmac_init_vector_128 (sha512_hmac_ctx_vector_t *ctx, const
sha512_init_vector (&ctx->ipad);
sha512_update_vector_128 (&ctx->ipad, t0, t1, t2, t3, t4, t5, t6, t7, 128);
sha512_transform_vector (t0, t1, t2, t3, t4, t5, t6, t7, ctx->ipad.h);
ctx->ipad.len = 128;
// opad
@ -2866,7 +3015,9 @@ DECLSPEC void sha512_hmac_init_vector_128 (sha512_hmac_ctx_vector_t *ctx, const
sha512_init_vector (&ctx->opad);
sha512_update_vector_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 128);
sha512_transform_vector (t0, t1, t2, t3, t4, t5, t6, t7, ctx->opad.h);
ctx->opad.len = 128;
}
DECLSPEC void sha512_hmac_init_vector (sha512_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
@ -2976,49 +3127,40 @@ DECLSPEC void sha512_hmac_final_vector (sha512_hmac_ctx_vector_t *ctx)
{
sha512_final_vector (&ctx->ipad);
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
u32x t4[4];
u32x t5[4];
u32x t6[4];
u32x t7[4];
ctx->opad.w0[0] = h32_from_64 (ctx->ipad.h[0]);
ctx->opad.w0[1] = l32_from_64 (ctx->ipad.h[0]);
ctx->opad.w0[2] = h32_from_64 (ctx->ipad.h[1]);
ctx->opad.w0[3] = l32_from_64 (ctx->ipad.h[1]);
ctx->opad.w1[0] = h32_from_64 (ctx->ipad.h[2]);
ctx->opad.w1[1] = l32_from_64 (ctx->ipad.h[2]);
ctx->opad.w1[2] = h32_from_64 (ctx->ipad.h[3]);
ctx->opad.w1[3] = l32_from_64 (ctx->ipad.h[3]);
ctx->opad.w2[0] = h32_from_64 (ctx->ipad.h[4]);
ctx->opad.w2[1] = l32_from_64 (ctx->ipad.h[4]);
ctx->opad.w2[2] = h32_from_64 (ctx->ipad.h[5]);
ctx->opad.w2[3] = l32_from_64 (ctx->ipad.h[5]);
ctx->opad.w3[0] = h32_from_64 (ctx->ipad.h[6]);
ctx->opad.w3[1] = l32_from_64 (ctx->ipad.h[6]);
ctx->opad.w3[2] = h32_from_64 (ctx->ipad.h[7]);
ctx->opad.w3[3] = l32_from_64 (ctx->ipad.h[7]);
ctx->opad.w4[0] = 0;
ctx->opad.w4[1] = 0;
ctx->opad.w4[2] = 0;
ctx->opad.w4[3] = 0;
ctx->opad.w5[0] = 0;
ctx->opad.w5[1] = 0;
ctx->opad.w5[2] = 0;
ctx->opad.w5[3] = 0;
ctx->opad.w6[0] = 0;
ctx->opad.w6[1] = 0;
ctx->opad.w6[2] = 0;
ctx->opad.w6[3] = 0;
ctx->opad.w7[0] = 0;
ctx->opad.w7[1] = 0;
ctx->opad.w7[2] = 0;
ctx->opad.w7[3] = 0;
t0[0] = h32_from_64 (ctx->ipad.h[0]);
t0[1] = l32_from_64 (ctx->ipad.h[0]);
t0[2] = h32_from_64 (ctx->ipad.h[1]);
t0[3] = l32_from_64 (ctx->ipad.h[1]);
t1[0] = h32_from_64 (ctx->ipad.h[2]);
t1[1] = l32_from_64 (ctx->ipad.h[2]);
t1[2] = h32_from_64 (ctx->ipad.h[3]);
t1[3] = l32_from_64 (ctx->ipad.h[3]);
t2[0] = h32_from_64 (ctx->ipad.h[4]);
t2[1] = l32_from_64 (ctx->ipad.h[4]);
t2[2] = h32_from_64 (ctx->ipad.h[5]);
t2[3] = l32_from_64 (ctx->ipad.h[5]);
t3[0] = h32_from_64 (ctx->ipad.h[6]);
t3[1] = l32_from_64 (ctx->ipad.h[6]);
t3[2] = h32_from_64 (ctx->ipad.h[7]);
t3[3] = l32_from_64 (ctx->ipad.h[7]);
t4[0] = 0;
t4[1] = 0;
t4[2] = 0;
t4[3] = 0;
t5[0] = 0;
t5[1] = 0;
t5[2] = 0;
t5[3] = 0;
t6[0] = 0;
t6[1] = 0;
t6[2] = 0;
t6[3] = 0;
t7[0] = 0;
t7[1] = 0;
t7[2] = 0;
t7[3] = 0;
sha512_update_vector_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 64);
ctx->opad.len += 64;
sha512_final_vector (&ctx->opad);
}

View File

@ -8,7 +8,7 @@
#include "inc_common.h"
#include "inc_hash_streebog256.h"
CONSTANT_AS u64a sbob_sl64[8][256] =
CONSTANT_AS u64a sbob256_sl64[8][256] =
{
{
0xd031c397ce553fe6, 0x16ba5b01b006b525, 0xa89bade6296e70c8, 0x6a1f525d77d3435b,
@ -540,7 +540,7 @@ CONSTANT_AS u64a sbob_sl64[8][256] =
},
};
CONSTANT_AS u64a sbob_rc64[12][8] =
CONSTANT_AS u64a sbob256_rc64[12][8] =
{
{
0xe9daca1eda5b08b1, 0x1f7c65c0812fcbeb, 0x16d0452e43766a2f, 0xfcc485758db84e71,
@ -712,7 +712,7 @@ DECLSPEC void streebog256_g (u64 *h, const u64 *n, const u64 *m, SHM_TYPE u64a (
for (int i = 0; i < 8; i++)
{
t[i] = k[i] ^ sbob_rc64[r][i];
t[i] = k[i] ^ sbob256_rc64[r][i];
}
#ifdef _unroll
@ -757,77 +757,119 @@ DECLSPEC void streebog256_transform (streebog256_ctx_t *ctx, const u32 *w0, cons
DECLSPEC void streebog256_update_64 (streebog256_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{
const int pos = ctx->len;
const int pos = ctx->len & 63;
if ((pos + len) < 64)
ctx->len += len;
if (pos == 0)
{
switch_buffer_by_offset_be_S (w0, w1, w2, w3, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
if (len == 64)
{
streebog256_transform (ctx, ctx->w0, ctx->w1, ctx->w2, ctx->w3);
ctx->len += len;
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
if ((pos + len) < 64)
{
switch_buffer_by_offset_be_S (w0, w1, w2, w3, pos);
switch_buffer_by_offset_carry_be_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
switch_buffer_by_offset_carry_be_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
streebog256_transform (ctx, ctx->w0, ctx->w1, ctx->w2, ctx->w3);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
streebog256_transform (ctx, ctx->w0, ctx->w1, ctx->w2, ctx->w3);
ctx->len = (pos + len) & 63;
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
}
}
@ -1022,7 +1064,7 @@ DECLSPEC void streebog256_final (streebog256_ctx_t *ctx)
streebog256_g (ctx->h, ctx->n, m, ctx->s_sbob_sl64);
u64 sizebuf[8] = { 0 };
sizebuf[7] = hc_swap64_S ((u64) (ctx->len << 3));
sizebuf[7] = hc_swap64_S ((u64) (pos << 3));
streebog256_add (ctx->n, sizebuf);
@ -1063,7 +1105,9 @@ DECLSPEC void streebog256_hmac_init_64 (streebog256_hmac_ctx_t *ctx, const u32 *
streebog256_init (&ctx->ipad, s_sbob_sl64);
streebog256_update_64 (&ctx->ipad, t0, t1, t2, t3, 64);
streebog256_transform (&ctx->ipad, t0, t1, t2, t3);
ctx->ipad.len = 64;
// opad
@ -1086,7 +1130,9 @@ DECLSPEC void streebog256_hmac_init_64 (streebog256_hmac_ctx_t *ctx, const u32 *
streebog256_init (&ctx->opad, s_sbob_sl64);
streebog256_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
streebog256_transform (&ctx->opad, t0, t1, t2, t3);
ctx->opad.len = 64;
}
DECLSPEC void streebog256_hmac_init (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
@ -1227,29 +1273,24 @@ DECLSPEC void streebog256_hmac_final (streebog256_hmac_ctx_t *ctx)
{
streebog256_final (&ctx->ipad);
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
ctx->opad.w0[0] = h32_from_64_S (ctx->ipad.h[3]);
ctx->opad.w0[1] = l32_from_64_S (ctx->ipad.h[3]);
ctx->opad.w0[2] = h32_from_64_S (ctx->ipad.h[2]);
ctx->opad.w0[3] = l32_from_64_S (ctx->ipad.h[2]);
ctx->opad.w1[0] = h32_from_64_S (ctx->ipad.h[1]);
ctx->opad.w1[1] = l32_from_64_S (ctx->ipad.h[1]);
ctx->opad.w1[2] = h32_from_64_S (ctx->ipad.h[0]);
ctx->opad.w1[3] = l32_from_64_S (ctx->ipad.h[0]);
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = h32_from_64_S (ctx->ipad.h[3]);
t0[1] = l32_from_64_S (ctx->ipad.h[3]);
t0[2] = h32_from_64_S (ctx->ipad.h[2]);
t0[3] = l32_from_64_S (ctx->ipad.h[2]);
t1[0] = h32_from_64_S (ctx->ipad.h[1]);
t1[1] = l32_from_64_S (ctx->ipad.h[1]);
t1[2] = h32_from_64_S (ctx->ipad.h[0]);
t1[3] = l32_from_64_S (ctx->ipad.h[0]);
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
streebog256_update_64 (&ctx->opad, t0, t1, t2, t3, 32);
ctx->opad.len += 32;
streebog256_final (&ctx->opad);
}
@ -1374,7 +1415,7 @@ DECLSPEC void streebog256_g_vector (u64x *h, const u64x *n, const u64x *m, SHM_T
for (int i = 0; i < 8; i++)
{
t[i] = k[i] ^ sbob_rc64[r][i];
t[i] = k[i] ^ sbob256_rc64[r][i];
}
#ifdef _unroll
@ -1419,77 +1460,119 @@ DECLSPEC void streebog256_transform_vector (streebog256_ctx_vector_t *ctx, const
DECLSPEC void streebog256_update_vector_64 (streebog256_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{
const int pos = ctx->len;
const int pos = ctx->len & 63;
if ((pos + len) < 64)
ctx->len += len;
if (pos == 0)
{
switch_buffer_by_offset_be (w0, w1, w2, w3, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
if (len == 64)
{
streebog256_transform_vector (ctx, ctx->w0, ctx->w1, ctx->w2, ctx->w3);
ctx->len += len;
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
if ((pos + len) < 64)
{
switch_buffer_by_offset_be (w0, w1, w2, w3, pos);
switch_buffer_by_offset_carry_be (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
switch_buffer_by_offset_carry_be (w0, w1, w2, w3, c0, c1, c2, c3, pos);
streebog256_transform_vector (ctx, ctx->w0, ctx->w1, ctx->w2, ctx->w3);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
streebog256_transform_vector (ctx, ctx->w0, ctx->w1, ctx->w2, ctx->w3);
ctx->len = (pos + len) & 63;
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
}
}
@ -1627,7 +1710,7 @@ DECLSPEC void streebog256_final_vector (streebog256_ctx_vector_t *ctx)
streebog256_g_vector (ctx->h, ctx->n, m, ctx->s_sbob_sl64);
u64x sizebuf[8] = { 0 };
sizebuf[7] = hc_swap64 ((u64x) (ctx->len << 3));
sizebuf[7] = hc_swap64 ((u64x) (pos << 3));
streebog256_add_vector (ctx->n, sizebuf);
@ -1668,7 +1751,9 @@ DECLSPEC void streebog256_hmac_init_vector_64 (streebog256_hmac_ctx_vector_t *ct
streebog256_init_vector (&ctx->ipad, s_sbob_sl64);
streebog256_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64);
streebog256_transform_vector (&ctx->ipad, t0, t1, t2, t3);
ctx->ipad.len = 64;
// opad
@ -1691,7 +1776,9 @@ DECLSPEC void streebog256_hmac_init_vector_64 (streebog256_hmac_ctx_vector_t *ct
streebog256_init_vector (&ctx->opad, s_sbob_sl64);
streebog256_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
streebog256_transform_vector (&ctx->opad, t0, t1, t2, t3);
ctx->opad.len = 64;
}
DECLSPEC void streebog256_hmac_init_vector (streebog256_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
@ -1822,29 +1909,24 @@ DECLSPEC void streebog256_hmac_final_vector (streebog256_hmac_ctx_vector_t *ctx)
{
streebog256_final_vector (&ctx->ipad);
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
ctx->opad.w0[0] = h32_from_64 (ctx->ipad.h[3]);
ctx->opad.w0[1] = l32_from_64 (ctx->ipad.h[3]);
ctx->opad.w0[2] = h32_from_64 (ctx->ipad.h[2]);
ctx->opad.w0[3] = l32_from_64 (ctx->ipad.h[2]);
ctx->opad.w1[0] = h32_from_64 (ctx->ipad.h[1]);
ctx->opad.w1[1] = l32_from_64 (ctx->ipad.h[1]);
ctx->opad.w1[2] = h32_from_64 (ctx->ipad.h[0]);
ctx->opad.w1[3] = l32_from_64 (ctx->ipad.h[0]);
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = h32_from_64 (ctx->ipad.h[3]);
t0[1] = l32_from_64 (ctx->ipad.h[3]);
t0[2] = h32_from_64 (ctx->ipad.h[2]);
t0[3] = l32_from_64 (ctx->ipad.h[2]);
t1[0] = h32_from_64 (ctx->ipad.h[1]);
t1[1] = l32_from_64 (ctx->ipad.h[1]);
t1[2] = h32_from_64 (ctx->ipad.h[0]);
t1[3] = l32_from_64 (ctx->ipad.h[0]);
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
streebog256_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 32);
ctx->opad.len += 32;
streebog256_final_vector (&ctx->opad);
}

View File

@ -8,7 +8,7 @@
#include "inc_common.h"
#include "inc_hash_streebog512.h"
CONSTANT_AS u64a sbob_sl64[8][256] =
CONSTANT_AS u64a sbob512_sl64[8][256] =
{
{
0xd031c397ce553fe6, 0x16ba5b01b006b525, 0xa89bade6296e70c8, 0x6a1f525d77d3435b,
@ -540,7 +540,7 @@ CONSTANT_AS u64a sbob_sl64[8][256] =
},
};
CONSTANT_AS u64a sbob_rc64[12][8] =
CONSTANT_AS u64a sbob512_rc64[12][8] =
{
{
0xe9daca1eda5b08b1, 0x1f7c65c0812fcbeb, 0x16d0452e43766a2f, 0xfcc485758db84e71,
@ -712,7 +712,7 @@ DECLSPEC void streebog512_g (u64 *h, const u64 *n, const u64 *m, SHM_TYPE u64a (
for (int i = 0; i < 8; i++)
{
t[i] = k[i] ^ sbob_rc64[r][i];
t[i] = k[i] ^ sbob512_rc64[r][i];
}
#ifdef _unroll
@ -757,77 +757,119 @@ DECLSPEC void streebog512_transform (streebog512_ctx_t *ctx, const u32 *w0, cons
DECLSPEC void streebog512_update_64 (streebog512_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
{
const int pos = ctx->len;
const int pos = ctx->len & 63;
if ((pos + len) < 64)
ctx->len += len;
if (pos == 0)
{
switch_buffer_by_offset_be_S (w0, w1, w2, w3, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
if (len == 64)
{
streebog512_transform (ctx, ctx->w0, ctx->w1, ctx->w2, ctx->w3);
ctx->len += len;
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
if ((pos + len) < 64)
{
switch_buffer_by_offset_be_S (w0, w1, w2, w3, pos);
switch_buffer_by_offset_carry_be_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
switch_buffer_by_offset_carry_be_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
streebog512_transform (ctx, ctx->w0, ctx->w1, ctx->w2, ctx->w3);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
streebog512_transform (ctx, ctx->w0, ctx->w1, ctx->w2, ctx->w3);
ctx->len = (pos + len) & 63;
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
}
}
@ -1022,7 +1064,7 @@ DECLSPEC void streebog512_final (streebog512_ctx_t *ctx)
streebog512_g (ctx->h, ctx->n, m, ctx->s_sbob_sl64);
u64 sizebuf[8] = { 0 };
sizebuf[7] = hc_swap64_S ((u64) (ctx->len << 3));
sizebuf[7] = hc_swap64_S ((u64) (pos << 3));
streebog512_add (ctx->n, sizebuf);
@ -1063,7 +1105,9 @@ DECLSPEC void streebog512_hmac_init_64 (streebog512_hmac_ctx_t *ctx, const u32 *
streebog512_init (&ctx->ipad, s_sbob_sl64);
streebog512_update_64 (&ctx->ipad, t0, t1, t2, t3, 64);
streebog512_transform (&ctx->ipad, t0, t1, t2, t3);
ctx->ipad.len = 64;
// opad
@ -1086,7 +1130,9 @@ DECLSPEC void streebog512_hmac_init_64 (streebog512_hmac_ctx_t *ctx, const u32 *
streebog512_init (&ctx->opad, s_sbob_sl64);
streebog512_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
streebog512_transform (&ctx->opad, t0, t1, t2, t3);
ctx->opad.len = 64;
}
DECLSPEC void streebog512_hmac_init (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
@ -1227,29 +1273,43 @@ DECLSPEC void streebog512_hmac_final (streebog512_hmac_ctx_t *ctx)
{
streebog512_final (&ctx->ipad);
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
ctx->opad.w0[0] = h32_from_64_S (ctx->ipad.h[7]);
ctx->opad.w0[1] = l32_from_64_S (ctx->ipad.h[7]);
ctx->opad.w0[2] = h32_from_64_S (ctx->ipad.h[6]);
ctx->opad.w0[3] = l32_from_64_S (ctx->ipad.h[6]);
ctx->opad.w1[0] = h32_from_64_S (ctx->ipad.h[5]);
ctx->opad.w1[1] = l32_from_64_S (ctx->ipad.h[5]);
ctx->opad.w1[2] = h32_from_64_S (ctx->ipad.h[4]);
ctx->opad.w1[3] = l32_from_64_S (ctx->ipad.h[4]);
ctx->opad.w2[0] = h32_from_64_S (ctx->ipad.h[3]);
ctx->opad.w2[1] = l32_from_64_S (ctx->ipad.h[3]);
ctx->opad.w2[2] = h32_from_64_S (ctx->ipad.h[2]);
ctx->opad.w2[3] = l32_from_64_S (ctx->ipad.h[2]);
ctx->opad.w3[0] = h32_from_64_S (ctx->ipad.h[1]);
ctx->opad.w3[1] = l32_from_64_S (ctx->ipad.h[1]);
ctx->opad.w3[2] = h32_from_64_S (ctx->ipad.h[0]);
ctx->opad.w3[3] = l32_from_64_S (ctx->ipad.h[0]);
t0[0] = h32_from_64_S (ctx->ipad.h[7]);
t0[1] = l32_from_64_S (ctx->ipad.h[7]);
t0[2] = h32_from_64_S (ctx->ipad.h[6]);
t0[3] = l32_from_64_S (ctx->ipad.h[6]);
t1[0] = h32_from_64_S (ctx->ipad.h[5]);
t1[1] = l32_from_64_S (ctx->ipad.h[5]);
t1[2] = h32_from_64_S (ctx->ipad.h[4]);
t1[3] = l32_from_64_S (ctx->ipad.h[4]);
t2[0] = h32_from_64_S (ctx->ipad.h[3]);
t2[1] = l32_from_64_S (ctx->ipad.h[3]);
t2[2] = h32_from_64_S (ctx->ipad.h[2]);
t2[3] = l32_from_64_S (ctx->ipad.h[2]);
t3[0] = h32_from_64_S (ctx->ipad.h[1]);
t3[1] = l32_from_64_S (ctx->ipad.h[1]);
t3[2] = h32_from_64_S (ctx->ipad.h[0]);
t3[3] = l32_from_64_S (ctx->ipad.h[0]);
ctx->opad.len = 0;
streebog512_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
streebog512_transform (&ctx->opad, ctx->opad.w0, ctx->opad.w1, ctx->opad.w2, ctx->opad.w3);
ctx->opad.w0[0] = 0;
ctx->opad.w0[1] = 0;
ctx->opad.w0[2] = 0;
ctx->opad.w0[3] = 0;
ctx->opad.w1[0] = 0;
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
streebog512_final (&ctx->opad);
}
@ -1374,7 +1434,7 @@ DECLSPEC void streebog512_g_vector (u64x *h, const u64x *n, const u64x *m, SHM_T
for (int i = 0; i < 8; i++)
{
t[i] = k[i] ^ sbob_rc64[r][i];
t[i] = k[i] ^ sbob512_rc64[r][i];
}
#ifdef _unroll
@ -1419,77 +1479,119 @@ DECLSPEC void streebog512_transform_vector (streebog512_ctx_vector_t *ctx, const
DECLSPEC void streebog512_update_vector_64 (streebog512_ctx_vector_t *ctx, u32x *w0, u32x *w1, u32x *w2, u32x *w3, const int len)
{
const int pos = ctx->len;
const int pos = ctx->len & 63;
if ((pos + len) < 64)
ctx->len += len;
if (pos == 0)
{
switch_buffer_by_offset_be (w0, w1, w2, w3, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
if (len == 64)
{
streebog512_transform_vector (ctx, ctx->w0, ctx->w1, ctx->w2, ctx->w3);
ctx->len += len;
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
if ((pos + len) < 64)
{
switch_buffer_by_offset_be (w0, w1, w2, w3, pos);
switch_buffer_by_offset_carry_be (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
switch_buffer_by_offset_carry_be (w0, w1, w2, w3, c0, c1, c2, c3, pos);
streebog512_transform_vector (ctx, ctx->w0, ctx->w1, ctx->w2, ctx->w3);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
streebog512_transform_vector (ctx, ctx->w0, ctx->w1, ctx->w2, ctx->w3);
ctx->len = (pos + len) & 63;
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
}
}
@ -1627,7 +1729,7 @@ DECLSPEC void streebog512_final_vector (streebog512_ctx_vector_t *ctx)
streebog512_g_vector (ctx->h, ctx->n, m, ctx->s_sbob_sl64);
u64x sizebuf[8] = { 0 };
sizebuf[7] = hc_swap64 ((u64x) (ctx->len << 3));
sizebuf[7] = hc_swap64 ((u64x) (pos << 3));
streebog512_add_vector (ctx->n, sizebuf);
@ -1668,7 +1770,9 @@ DECLSPEC void streebog512_hmac_init_vector_64 (streebog512_hmac_ctx_vector_t *ct
streebog512_init_vector (&ctx->ipad, s_sbob_sl64);
streebog512_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64);
streebog512_transform_vector (&ctx->ipad, t0, t1, t2, t3);
ctx->ipad.len = 64;
// opad
@ -1691,7 +1795,9 @@ DECLSPEC void streebog512_hmac_init_vector_64 (streebog512_hmac_ctx_vector_t *ct
streebog512_init_vector (&ctx->opad, s_sbob_sl64);
streebog512_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
streebog512_transform_vector (&ctx->opad, t0, t1, t2, t3);
ctx->opad.len = 64;
}
DECLSPEC void streebog512_hmac_init_vector (streebog512_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
@ -1822,29 +1928,43 @@ DECLSPEC void streebog512_hmac_final_vector (streebog512_hmac_ctx_vector_t *ctx)
{
streebog512_final_vector (&ctx->ipad);
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
ctx->opad.w0[0] = h32_from_64 (ctx->ipad.h[7]);
ctx->opad.w0[1] = l32_from_64 (ctx->ipad.h[7]);
ctx->opad.w0[2] = h32_from_64 (ctx->ipad.h[6]);
ctx->opad.w0[3] = l32_from_64 (ctx->ipad.h[6]);
ctx->opad.w1[0] = h32_from_64 (ctx->ipad.h[5]);
ctx->opad.w1[1] = l32_from_64 (ctx->ipad.h[5]);
ctx->opad.w1[2] = h32_from_64 (ctx->ipad.h[4]);
ctx->opad.w1[3] = l32_from_64 (ctx->ipad.h[4]);
ctx->opad.w2[0] = h32_from_64 (ctx->ipad.h[3]);
ctx->opad.w2[1] = l32_from_64 (ctx->ipad.h[3]);
ctx->opad.w2[2] = h32_from_64 (ctx->ipad.h[2]);
ctx->opad.w2[3] = l32_from_64 (ctx->ipad.h[2]);
ctx->opad.w3[0] = h32_from_64 (ctx->ipad.h[1]);
ctx->opad.w3[1] = l32_from_64 (ctx->ipad.h[1]);
ctx->opad.w3[2] = h32_from_64 (ctx->ipad.h[0]);
ctx->opad.w3[3] = l32_from_64 (ctx->ipad.h[0]);
t0[0] = h32_from_64 (ctx->ipad.h[7]);
t0[1] = l32_from_64 (ctx->ipad.h[7]);
t0[2] = h32_from_64 (ctx->ipad.h[6]);
t0[3] = l32_from_64 (ctx->ipad.h[6]);
t1[0] = h32_from_64 (ctx->ipad.h[5]);
t1[1] = l32_from_64 (ctx->ipad.h[5]);
t1[2] = h32_from_64 (ctx->ipad.h[4]);
t1[3] = l32_from_64 (ctx->ipad.h[4]);
t2[0] = h32_from_64 (ctx->ipad.h[3]);
t2[1] = l32_from_64 (ctx->ipad.h[3]);
t2[2] = h32_from_64 (ctx->ipad.h[2]);
t2[3] = l32_from_64 (ctx->ipad.h[2]);
t3[0] = h32_from_64 (ctx->ipad.h[1]);
t3[1] = l32_from_64 (ctx->ipad.h[1]);
t3[2] = h32_from_64 (ctx->ipad.h[0]);
t3[3] = l32_from_64 (ctx->ipad.h[0]);
ctx->opad.len = 0;
streebog512_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
streebog512_transform_vector (&ctx->opad, ctx->opad.w0, ctx->opad.w1, ctx->opad.w2, ctx->opad.w3);
ctx->opad.w0[0] = 0;
ctx->opad.w0[1] = 0;
ctx->opad.w0[2] = 0;
ctx->opad.w0[3] = 0;
ctx->opad.w1[0] = 0;
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
streebog512_final_vector (&ctx->opad);
}

View File

@ -1325,71 +1325,115 @@ DECLSPEC void whirlpool_update_64 (whirlpool_ctx_t *ctx, u32 *w0, u32 *w1, u32 *
ctx->len += len;
if ((pos + len) < 64)
if (pos == 0)
{
switch_buffer_by_offset_be_S (w0, w1, w2, w3, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
if (len == 64)
{
whirlpool_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h, ctx->s_Ch, ctx->s_Cl);
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
if ((pos + len) < 64)
{
switch_buffer_by_offset_be_S (w0, w1, w2, w3, pos);
switch_buffer_by_offset_carry_be_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
switch_buffer_by_offset_carry_be_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
whirlpool_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h, ctx->s_Ch, ctx->s_Cl);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
whirlpool_transform (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h, ctx->s_Ch, ctx->s_Cl);
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
}
}
@ -1969,7 +2013,9 @@ DECLSPEC void whirlpool_hmac_init_64 (whirlpool_hmac_ctx_t *ctx, const u32 *w0,
whirlpool_init (&ctx->ipad, s_Ch, s_Cl);
whirlpool_update_64 (&ctx->ipad, t0, t1, t2, t3, 64);
whirlpool_transform (t0, t1, t2, t3, ctx->ipad.h, ctx->ipad.s_Ch, ctx->ipad.s_Cl);
ctx->ipad.len = 64;
// opad
@ -1992,7 +2038,9 @@ DECLSPEC void whirlpool_hmac_init_64 (whirlpool_hmac_ctx_t *ctx, const u32 *w0,
whirlpool_init (&ctx->opad, s_Ch, s_Cl);
whirlpool_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
whirlpool_transform (t0, t1, t2, t3, ctx->opad.h, ctx->opad.s_Ch, ctx->opad.s_Cl);
ctx->opad.len = 64;
}
DECLSPEC void whirlpool_hmac_init (whirlpool_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256])
@ -2272,29 +2320,43 @@ DECLSPEC void whirlpool_hmac_final (whirlpool_hmac_ctx_t *ctx)
{
whirlpool_final (&ctx->ipad);
u32 t0[4];
u32 t1[4];
u32 t2[4];
u32 t3[4];
ctx->opad.w0[0] = ctx->ipad.h[ 0];
ctx->opad.w0[1] = ctx->ipad.h[ 1];
ctx->opad.w0[2] = ctx->ipad.h[ 2];
ctx->opad.w0[3] = ctx->ipad.h[ 3];
ctx->opad.w1[0] = ctx->ipad.h[ 4];
ctx->opad.w1[1] = ctx->ipad.h[ 5];
ctx->opad.w1[2] = ctx->ipad.h[ 6];
ctx->opad.w1[3] = ctx->ipad.h[ 7];
ctx->opad.w2[0] = ctx->ipad.h[ 8];
ctx->opad.w2[1] = ctx->ipad.h[ 9];
ctx->opad.w2[2] = ctx->ipad.h[10];
ctx->opad.w2[3] = ctx->ipad.h[11];
ctx->opad.w3[0] = ctx->ipad.h[12];
ctx->opad.w3[1] = ctx->ipad.h[13];
ctx->opad.w3[2] = ctx->ipad.h[14];
ctx->opad.w3[3] = ctx->ipad.h[15];
t0[0] = ctx->ipad.h[ 0];
t0[1] = ctx->ipad.h[ 1];
t0[2] = ctx->ipad.h[ 2];
t0[3] = ctx->ipad.h[ 3];
t1[0] = ctx->ipad.h[ 4];
t1[1] = ctx->ipad.h[ 5];
t1[2] = ctx->ipad.h[ 6];
t1[3] = ctx->ipad.h[ 7];
t2[0] = ctx->ipad.h[ 8];
t2[1] = ctx->ipad.h[ 9];
t2[2] = ctx->ipad.h[10];
t2[3] = ctx->ipad.h[11];
t3[0] = ctx->ipad.h[12];
t3[1] = ctx->ipad.h[13];
t3[2] = ctx->ipad.h[14];
t3[3] = ctx->ipad.h[15];
ctx->opad.len += 64;
whirlpool_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
whirlpool_transform (ctx->opad.w0, ctx->opad.w1, ctx->opad.w2, ctx->opad.w3, ctx->opad.h, ctx->opad.s_Ch, ctx->opad.s_Cl);
ctx->opad.w0[0] = 0;
ctx->opad.w0[1] = 0;
ctx->opad.w0[2] = 0;
ctx->opad.w0[3] = 0;
ctx->opad.w1[0] = 0;
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
whirlpool_final (&ctx->opad);
}
@ -2561,71 +2623,115 @@ DECLSPEC void whirlpool_update_vector_64 (whirlpool_ctx_vector_t *ctx, u32x *w0,
ctx->len += len;
if ((pos + len) < 64)
if (pos == 0)
{
switch_buffer_by_offset_be (w0, w1, w2, w3, pos);
ctx->w0[0] = w0[0];
ctx->w0[1] = w0[1];
ctx->w0[2] = w0[2];
ctx->w0[3] = w0[3];
ctx->w1[0] = w1[0];
ctx->w1[1] = w1[1];
ctx->w1[2] = w1[2];
ctx->w1[3] = w1[3];
ctx->w2[0] = w2[0];
ctx->w2[1] = w2[1];
ctx->w2[2] = w2[2];
ctx->w2[3] = w2[3];
ctx->w3[0] = w3[0];
ctx->w3[1] = w3[1];
ctx->w3[2] = w3[2];
ctx->w3[3] = w3[3];
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
if (len == 64)
{
whirlpool_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h, ctx->s_Ch, ctx->s_Cl);
ctx->w0[0] = 0;
ctx->w0[1] = 0;
ctx->w0[2] = 0;
ctx->w0[3] = 0;
ctx->w1[0] = 0;
ctx->w1[1] = 0;
ctx->w1[2] = 0;
ctx->w1[3] = 0;
ctx->w2[0] = 0;
ctx->w2[1] = 0;
ctx->w2[2] = 0;
ctx->w2[3] = 0;
ctx->w3[0] = 0;
ctx->w3[1] = 0;
ctx->w3[2] = 0;
ctx->w3[3] = 0;
}
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
if ((pos + len) < 64)
{
switch_buffer_by_offset_be (w0, w1, w2, w3, pos);
switch_buffer_by_offset_carry_be (w0, w1, w2, w3, c0, c1, c2, c3, pos);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
switch_buffer_by_offset_carry_be (w0, w1, w2, w3, c0, c1, c2, c3, pos);
whirlpool_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h, ctx->s_Ch, ctx->s_Cl);
ctx->w0[0] |= w0[0];
ctx->w0[1] |= w0[1];
ctx->w0[2] |= w0[2];
ctx->w0[3] |= w0[3];
ctx->w1[0] |= w1[0];
ctx->w1[1] |= w1[1];
ctx->w1[2] |= w1[2];
ctx->w1[3] |= w1[3];
ctx->w2[0] |= w2[0];
ctx->w2[1] |= w2[1];
ctx->w2[2] |= w2[2];
ctx->w2[3] |= w2[3];
ctx->w3[0] |= w3[0];
ctx->w3[1] |= w3[1];
ctx->w3[2] |= w3[2];
ctx->w3[3] |= w3[3];
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
whirlpool_transform_vector (ctx->w0, ctx->w1, ctx->w2, ctx->w3, ctx->h, ctx->s_Ch, ctx->s_Cl);
ctx->w0[0] = c0[0];
ctx->w0[1] = c0[1];
ctx->w0[2] = c0[2];
ctx->w0[3] = c0[3];
ctx->w1[0] = c1[0];
ctx->w1[1] = c1[1];
ctx->w1[2] = c1[2];
ctx->w1[3] = c1[3];
ctx->w2[0] = c2[0];
ctx->w2[1] = c2[1];
ctx->w2[2] = c2[2];
ctx->w2[3] = c2[3];
ctx->w3[0] = c3[0];
ctx->w3[1] = c3[1];
ctx->w3[2] = c3[2];
ctx->w3[3] = c3[3];
}
}
}
@ -2949,7 +3055,9 @@ DECLSPEC void whirlpool_hmac_init_vector_64 (whirlpool_hmac_ctx_vector_t *ctx, c
whirlpool_init_vector (&ctx->ipad, s_Ch, s_Cl);
whirlpool_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64);
whirlpool_transform_vector (t0, t1, t2, t3, ctx->ipad.h, ctx->ipad.s_Ch, ctx->ipad.s_Cl);
ctx->ipad.len = 64;
// opad
@ -2972,7 +3080,9 @@ DECLSPEC void whirlpool_hmac_init_vector_64 (whirlpool_hmac_ctx_vector_t *ctx, c
whirlpool_init_vector (&ctx->opad, s_Ch, s_Cl);
whirlpool_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
whirlpool_transform_vector (t0, t1, t2, t3, ctx->opad.h, ctx->opad.s_Ch, ctx->opad.s_Cl);
ctx->opad.len = 64;
}
DECLSPEC void whirlpool_hmac_init_vector (whirlpool_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u32 (*s_Ch)[256], SHM_TYPE u32 (*s_Cl)[256])
@ -3046,29 +3156,43 @@ DECLSPEC void whirlpool_hmac_final_vector (whirlpool_hmac_ctx_vector_t *ctx)
{
whirlpool_final_vector (&ctx->ipad);
u32x t0[4];
u32x t1[4];
u32x t2[4];
u32x t3[4];
ctx->opad.w0[0] = ctx->ipad.h[ 0];
ctx->opad.w0[1] = ctx->ipad.h[ 1];
ctx->opad.w0[2] = ctx->ipad.h[ 2];
ctx->opad.w0[3] = ctx->ipad.h[ 3];
ctx->opad.w1[0] = ctx->ipad.h[ 4];
ctx->opad.w1[1] = ctx->ipad.h[ 5];
ctx->opad.w1[2] = ctx->ipad.h[ 6];
ctx->opad.w1[3] = ctx->ipad.h[ 7];
ctx->opad.w2[0] = ctx->ipad.h[ 8];
ctx->opad.w2[1] = ctx->ipad.h[ 9];
ctx->opad.w2[2] = ctx->ipad.h[10];
ctx->opad.w2[3] = ctx->ipad.h[11];
ctx->opad.w3[0] = ctx->ipad.h[12];
ctx->opad.w3[1] = ctx->ipad.h[13];
ctx->opad.w3[2] = ctx->ipad.h[14];
ctx->opad.w3[3] = ctx->ipad.h[15];
t0[0] = ctx->ipad.h[ 0];
t0[1] = ctx->ipad.h[ 1];
t0[2] = ctx->ipad.h[ 2];
t0[3] = ctx->ipad.h[ 3];
t1[0] = ctx->ipad.h[ 4];
t1[1] = ctx->ipad.h[ 5];
t1[2] = ctx->ipad.h[ 6];
t1[3] = ctx->ipad.h[ 7];
t2[0] = ctx->ipad.h[ 8];
t2[1] = ctx->ipad.h[ 9];
t2[2] = ctx->ipad.h[10];
t2[3] = ctx->ipad.h[11];
t3[0] = ctx->ipad.h[12];
t3[1] = ctx->ipad.h[13];
t3[2] = ctx->ipad.h[14];
t3[3] = ctx->ipad.h[15];
ctx->opad.len += 64;
whirlpool_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
whirlpool_transform_vector (ctx->opad.w0, ctx->opad.w1, ctx->opad.w2, ctx->opad.w3, ctx->opad.h, ctx->opad.s_Ch, ctx->opad.s_Cl);
ctx->opad.w0[0] = 0;
ctx->opad.w0[1] = 0;
ctx->opad.w0[2] = 0;
ctx->opad.w0[3] = 0;
ctx->opad.w1[0] = 0;
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
whirlpool_final_vector (&ctx->opad);
}

View File

@ -80,13 +80,14 @@
/**
* function declarations can have a large influence depending on the opencl runtime
* fast but pure kernels on rocm is a good example
*/
#if defined IS_CPU
#define DECLSPEC inline
#elif defined IS_GPU
#if defined IS_AMD
#define DECLSPEC inline
#define DECLSPEC inline static
#else
#define DECLSPEC
#endif

View File

@ -30,7 +30,7 @@
a -= t; \
}
DECLSPEC static void m00000m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m00000m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier
@ -202,7 +202,7 @@ DECLSPEC static void m00000m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
}
}
DECLSPEC static void m00000s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m00000s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00000_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -99,7 +99,7 @@ KERNEL_FQ void m00000_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}

View File

@ -36,7 +36,7 @@ KERNEL_FQ void m00010_mxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
@ -103,7 +103,7 @@ KERNEL_FQ void m00010_sxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00010_mxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
@ -97,7 +97,7 @@ KERNEL_FQ void m00010_sxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}

View File

@ -30,7 +30,7 @@
a -= t; \
}
DECLSPEC static void m00010m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m00010m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier
@ -251,7 +251,7 @@ DECLSPEC static void m00010m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
}
}
DECLSPEC static void m00010s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m00010s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00010_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -41,7 +41,7 @@ KERNEL_FQ void m00010_mxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
@ -110,7 +110,7 @@ KERNEL_FQ void m00010_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -119,7 +119,7 @@ KERNEL_FQ void m00010_sxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}

View File

@ -13,7 +13,7 @@
#include "inc_hash_md5.cl"
#endif
DECLSPEC static void m00020m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
DECLSPEC void m00020m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
{
/**
* modifier
@ -188,7 +188,7 @@ DECLSPEC static void m00020m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_l
}
}
DECLSPEC static void m00020s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
DECLSPEC void m00020s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00020_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -105,7 +105,7 @@ KERNEL_FQ void m00020_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}

View File

@ -36,7 +36,7 @@ KERNEL_FQ void m00030_mxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
@ -103,7 +103,7 @@ KERNEL_FQ void m00030_sxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00030_mxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
@ -97,7 +97,7 @@ KERNEL_FQ void m00030_sxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}

View File

@ -30,7 +30,7 @@
a -= t; \
}
DECLSPEC static void m00030m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m00030m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier
@ -251,7 +251,7 @@ DECLSPEC static void m00030m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
}
}
DECLSPEC static void m00030s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m00030s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00030_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -41,7 +41,7 @@ KERNEL_FQ void m00030_mxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
@ -110,7 +110,7 @@ KERNEL_FQ void m00030_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -119,7 +119,7 @@ KERNEL_FQ void m00030_sxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}

View File

@ -13,7 +13,7 @@
#include "inc_hash_md5.cl"
#endif
DECLSPEC static void m00040m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
DECLSPEC void m00040m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
{
/**
* modifier
@ -188,7 +188,7 @@ DECLSPEC static void m00040m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_l
}
}
DECLSPEC static void m00040s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
DECLSPEC void m00040s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00040_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -105,7 +105,7 @@ KERNEL_FQ void m00040_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}

View File

@ -15,7 +15,7 @@
#include "inc_hash_md5.cl"
#endif
DECLSPEC static void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
DECLSPEC void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{
w0[0] = w0[0] ^ 0x36363636;
w0[1] = w0[1] ^ 0x36363636;
@ -66,7 +66,7 @@ DECLSPEC static void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x
md5_transform_vector (w0, w1, w2, w3, opad);
}
DECLSPEC static void hmac_md5_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
DECLSPEC void hmac_md5_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
{
digest[0] = ipad[0];
digest[1] = ipad[1];

View File

@ -36,7 +36,7 @@ KERNEL_FQ void m00050_mxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
@ -101,7 +101,7 @@ KERNEL_FQ void m00050_sxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}

View File

@ -13,7 +13,7 @@
#include "inc_hash_md5.cl"
#endif
DECLSPEC static void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
DECLSPEC void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{
w0[0] = w0[0] ^ 0x36363636;
w0[1] = w0[1] ^ 0x36363636;
@ -64,7 +64,7 @@ DECLSPEC static void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x
md5_transform_vector (w0, w1, w2, w3, opad);
}
DECLSPEC static void hmac_md5_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
DECLSPEC void hmac_md5_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
{
digest[0] = ipad[0];
digest[1] = ipad[1];

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00050_mxx (KERN_ATTR_BASIC ())
u32 w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -41,7 +41,7 @@ KERNEL_FQ void m00050_mxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
@ -122,7 +122,7 @@ KERNEL_FQ void m00050_sxx (KERN_ATTR_BASIC ())
u32 w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -131,7 +131,7 @@ KERNEL_FQ void m00050_sxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}

View File

@ -13,7 +13,7 @@
#include "inc_hash_md5.cl"
#endif
DECLSPEC static void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
DECLSPEC void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{
w0[0] = w0[0] ^ 0x36363636;
w0[1] = w0[1] ^ 0x36363636;
@ -64,7 +64,7 @@ DECLSPEC static void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x
md5_transform_vector (w0, w1, w2, w3, opad);
}
DECLSPEC static void hmac_md5_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
DECLSPEC void hmac_md5_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
{
digest[0] = ipad[0];
digest[1] = ipad[1];
@ -98,7 +98,7 @@ DECLSPEC static void hmac_md5_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x
md5_transform_vector (w0, w1, w2, w3, digest);
}
DECLSPEC static void m00050m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
DECLSPEC void m00050m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
{
/**
* modifier
@ -203,7 +203,7 @@ DECLSPEC static void m00050m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_l
}
}
DECLSPEC static void m00050s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
DECLSPEC void m00050s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00050_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -41,7 +41,7 @@ KERNEL_FQ void m00050_mxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
@ -108,7 +108,7 @@ KERNEL_FQ void m00050_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -117,7 +117,7 @@ KERNEL_FQ void m00050_sxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}

View File

@ -15,7 +15,7 @@
#include "inc_hash_md5.cl"
#endif
DECLSPEC static void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
DECLSPEC void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{
w0[0] = w0[0] ^ 0x36363636;
w0[1] = w0[1] ^ 0x36363636;
@ -66,7 +66,7 @@ DECLSPEC static void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x
md5_transform_vector (w0, w1, w2, w3, opad);
}
DECLSPEC static void hmac_md5_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
DECLSPEC void hmac_md5_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
{
digest[0] = ipad[0];
digest[1] = ipad[1];

View File

@ -36,7 +36,7 @@ KERNEL_FQ void m00060_mxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
@ -103,7 +103,7 @@ KERNEL_FQ void m00060_sxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}

View File

@ -13,7 +13,7 @@
#include "inc_hash_md5.cl"
#endif
DECLSPEC static void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
DECLSPEC void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{
w0[0] = w0[0] ^ 0x36363636;
w0[1] = w0[1] ^ 0x36363636;
@ -64,7 +64,7 @@ DECLSPEC static void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x
md5_transform_vector (w0, w1, w2, w3, opad);
}
DECLSPEC static void hmac_md5_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
DECLSPEC void hmac_md5_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
{
digest[0] = ipad[0];
digest[1] = ipad[1];

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00060_mxx (KERN_ATTR_BASIC ())
u32 w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -41,7 +41,7 @@ KERNEL_FQ void m00060_mxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
@ -124,7 +124,7 @@ KERNEL_FQ void m00060_sxx (KERN_ATTR_BASIC ())
u32 w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -133,7 +133,7 @@ KERNEL_FQ void m00060_sxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}

View File

@ -13,7 +13,7 @@
#include "inc_hash_md5.cl"
#endif
DECLSPEC static void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
DECLSPEC void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{
w0[0] = w0[0] ^ 0x36363636;
w0[1] = w0[1] ^ 0x36363636;
@ -64,7 +64,7 @@ DECLSPEC static void hmac_md5_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x
md5_transform_vector (w0, w1, w2, w3, opad);
}
DECLSPEC static void hmac_md5_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
DECLSPEC void hmac_md5_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
{
digest[0] = ipad[0];
digest[1] = ipad[1];
@ -98,7 +98,7 @@ DECLSPEC static void hmac_md5_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x
md5_transform_vector (w0, w1, w2, w3, digest);
}
DECLSPEC static void m00060m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
DECLSPEC void m00060m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
{
/**
* modifier
@ -201,7 +201,7 @@ DECLSPEC static void m00060m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_l
}
}
DECLSPEC static void m00060s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
DECLSPEC void m00060s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00060_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -41,7 +41,7 @@ KERNEL_FQ void m00060_mxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
@ -110,7 +110,7 @@ KERNEL_FQ void m00060_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -119,7 +119,7 @@ KERNEL_FQ void m00060_sxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}

View File

@ -13,7 +13,7 @@
#include "inc_hash_sha1.cl"
#endif
DECLSPEC static void m00100m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m00100m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier
@ -257,7 +257,7 @@ DECLSPEC static void m00100m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
}
}
DECLSPEC static void m00100s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m00100s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00100_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -99,7 +99,7 @@ KERNEL_FQ void m00100_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}

View File

@ -36,7 +36,7 @@ KERNEL_FQ void m00110_mxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}
@ -103,7 +103,7 @@ KERNEL_FQ void m00110_sxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00110_mxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}
@ -97,7 +97,7 @@ KERNEL_FQ void m00110_sxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}

View File

@ -13,7 +13,7 @@
#include "inc_hash_sha1.cl"
#endif
DECLSPEC static void m00110m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m00110m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier
@ -305,7 +305,7 @@ DECLSPEC static void m00110m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
}
}
DECLSPEC static void m00110s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m00110s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00110_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -41,7 +41,7 @@ KERNEL_FQ void m00110_mxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}
@ -110,7 +110,7 @@ KERNEL_FQ void m00110_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -119,7 +119,7 @@ KERNEL_FQ void m00110_sxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}

View File

@ -13,7 +13,7 @@
#include "inc_hash_sha1.cl"
#endif
DECLSPEC static void m00120m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
DECLSPEC void m00120m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
{
/**
* modifier
@ -232,7 +232,7 @@ DECLSPEC static void m00120m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_l
}
}
DECLSPEC static void m00120s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
DECLSPEC void m00120s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00120_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -105,7 +105,7 @@ KERNEL_FQ void m00120_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}

View File

@ -36,7 +36,7 @@ KERNEL_FQ void m00130_mxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}
@ -103,7 +103,7 @@ KERNEL_FQ void m00130_sxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00130_mxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}
@ -97,7 +97,7 @@ KERNEL_FQ void m00130_sxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}

View File

@ -13,7 +13,7 @@
#include "inc_hash_sha1.cl"
#endif
DECLSPEC static void m00130m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m00130m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier
@ -305,7 +305,7 @@ DECLSPEC static void m00130m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
}
}
DECLSPEC static void m00130s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m00130s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00130_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -41,7 +41,7 @@ KERNEL_FQ void m00130_mxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}
@ -110,7 +110,7 @@ KERNEL_FQ void m00130_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -119,7 +119,7 @@ KERNEL_FQ void m00130_sxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}

View File

@ -13,7 +13,7 @@
#include "inc_hash_sha1.cl"
#endif
DECLSPEC static void m00140m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
DECLSPEC void m00140m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
{
/**
* modifier
@ -232,7 +232,7 @@ DECLSPEC static void m00140m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_l
}
}
DECLSPEC static void m00140s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
DECLSPEC void m00140s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00140_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -105,7 +105,7 @@ KERNEL_FQ void m00140_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}

View File

@ -15,7 +15,7 @@
#include "inc_hash_sha1.cl"
#endif
DECLSPEC static void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
DECLSPEC void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{
w0[0] = w0[0] ^ 0x36363636;
w0[1] = w0[1] ^ 0x36363636;
@ -68,7 +68,7 @@ DECLSPEC static void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x
sha1_transform_vector (w0, w1, w2, w3, opad);
}
DECLSPEC static void hmac_sha1_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
DECLSPEC void hmac_sha1_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
{
digest[0] = ipad[0];
digest[1] = ipad[1];

View File

@ -36,7 +36,7 @@ KERNEL_FQ void m00150_mxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}
@ -101,7 +101,7 @@ KERNEL_FQ void m00150_sxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}

View File

@ -13,7 +13,7 @@
#include "inc_hash_sha1.cl"
#endif
DECLSPEC static void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
DECLSPEC void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{
w0[0] = w0[0] ^ 0x36363636;
w0[1] = w0[1] ^ 0x36363636;
@ -66,7 +66,7 @@ DECLSPEC static void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x
sha1_transform_vector (w0, w1, w2, w3, opad);
}
DECLSPEC static void hmac_sha1_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
DECLSPEC void hmac_sha1_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
{
digest[0] = ipad[0];
digest[1] = ipad[1];

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00150_mxx (KERN_ATTR_BASIC ())
u32 w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = hc_swap32_S (pws[gid].i[idx]);
}
@ -41,7 +41,7 @@ KERNEL_FQ void m00150_mxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}
@ -122,7 +122,7 @@ KERNEL_FQ void m00150_sxx (KERN_ATTR_BASIC ())
u32 w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = hc_swap32_S (pws[gid].i[idx]);
}
@ -131,7 +131,7 @@ KERNEL_FQ void m00150_sxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}

View File

@ -13,7 +13,7 @@
#include "inc_hash_sha1.cl"
#endif
DECLSPEC static void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
DECLSPEC void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{
w0[0] = w0[0] ^ 0x36363636;
w0[1] = w0[1] ^ 0x36363636;
@ -66,7 +66,7 @@ DECLSPEC static void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x
sha1_transform_vector (w0, w1, w2, w3, opad);
}
DECLSPEC static void hmac_sha1_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
DECLSPEC void hmac_sha1_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
{
digest[0] = ipad[0];
digest[1] = ipad[1];
@ -102,7 +102,7 @@ DECLSPEC static void hmac_sha1_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x
sha1_transform_vector (w0, w1, w2, w3, digest);
}
DECLSPEC static void m00150m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
DECLSPEC void m00150m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
{
/**
* modifier
@ -207,7 +207,7 @@ DECLSPEC static void m00150m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_l
}
}
DECLSPEC static void m00150s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
DECLSPEC void m00150s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00150_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -41,7 +41,7 @@ KERNEL_FQ void m00150_mxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}
@ -108,7 +108,7 @@ KERNEL_FQ void m00150_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -117,7 +117,7 @@ KERNEL_FQ void m00150_sxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}

View File

@ -15,7 +15,7 @@
#include "inc_hash_sha1.cl"
#endif
DECLSPEC static void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
DECLSPEC void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{
w0[0] = w0[0] ^ 0x36363636;
w0[1] = w0[1] ^ 0x36363636;
@ -68,7 +68,7 @@ DECLSPEC static void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x
sha1_transform_vector (w0, w1, w2, w3, opad);
}
DECLSPEC static void hmac_sha1_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
DECLSPEC void hmac_sha1_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
{
digest[0] = ipad[0];
digest[1] = ipad[1];

View File

@ -36,7 +36,7 @@ KERNEL_FQ void m00160_mxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}
@ -103,7 +103,7 @@ KERNEL_FQ void m00160_sxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}

View File

@ -13,7 +13,7 @@
#include "inc_hash_sha1.cl"
#endif
DECLSPEC static void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
DECLSPEC void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{
w0[0] = w0[0] ^ 0x36363636;
w0[1] = w0[1] ^ 0x36363636;
@ -66,7 +66,7 @@ DECLSPEC static void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x
sha1_transform_vector (w0, w1, w2, w3, opad);
}
DECLSPEC static void hmac_sha1_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
DECLSPEC void hmac_sha1_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
{
digest[0] = ipad[0];
digest[1] = ipad[1];

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00160_mxx (KERN_ATTR_BASIC ())
u32 w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = hc_swap32_S (pws[gid].i[idx]);
}
@ -41,7 +41,7 @@ KERNEL_FQ void m00160_mxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}
@ -124,7 +124,7 @@ KERNEL_FQ void m00160_sxx (KERN_ATTR_BASIC ())
u32 w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = hc_swap32_S (pws[gid].i[idx]);
}
@ -133,7 +133,7 @@ KERNEL_FQ void m00160_sxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}

View File

@ -13,7 +13,7 @@
#include "inc_hash_sha1.cl"
#endif
DECLSPEC static void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
DECLSPEC void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{
w0[0] = w0[0] ^ 0x36363636;
w0[1] = w0[1] ^ 0x36363636;
@ -66,7 +66,7 @@ DECLSPEC static void hmac_sha1_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x
sha1_transform_vector (w0, w1, w2, w3, opad);
}
DECLSPEC static void hmac_sha1_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
DECLSPEC void hmac_sha1_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
{
digest[0] = ipad[0];
digest[1] = ipad[1];
@ -102,7 +102,7 @@ DECLSPEC static void hmac_sha1_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x
sha1_transform_vector (w0, w1, w2, w3, digest);
}
DECLSPEC static void m00160m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
DECLSPEC void m00160m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
{
/**
* modifier
@ -205,7 +205,7 @@ DECLSPEC static void m00160m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_l
}
}
DECLSPEC static void m00160s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
DECLSPEC void m00160s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00160_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -41,7 +41,7 @@ KERNEL_FQ void m00160_mxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}
@ -110,7 +110,7 @@ KERNEL_FQ void m00160_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -119,7 +119,7 @@ KERNEL_FQ void m00160_sxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}

View File

@ -89,7 +89,7 @@
} \
}
DECLSPEC static void m00200m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m00200m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier
@ -235,7 +235,7 @@ DECLSPEC static void m00200m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
}
}
DECLSPEC static void m00200s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m00200s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier

View File

@ -13,7 +13,7 @@
#include "inc_hash_sha1.cl"
#endif
DECLSPEC static void m00300m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m00300m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier
@ -382,7 +382,7 @@ DECLSPEC static void m00300m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
}
}
DECLSPEC static void m00300s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m00300s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00300_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -122,7 +122,7 @@ KERNEL_FQ void m00300_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}

View File

@ -77,7 +77,7 @@ KERNEL_FQ void m00400_loop (KERN_ATTR_TMPS (phpass_tmp_t))
u32 w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}

View File

@ -23,7 +23,7 @@ typedef struct md5crypt_tmp
#define md5crypt_magic 0x00243124u
DECLSPEC static void memcat16 (u32 *block0, u32 *block1, u32 *block2, u32 *block3, const u32 offset, const u32 *append)
DECLSPEC void memcat16 (u32 *block0, u32 *block1, u32 *block2, u32 *block3, const u32 offset, const u32 *append)
{
u32 tmp0;
u32 tmp1;
@ -130,7 +130,7 @@ DECLSPEC static void memcat16 (u32 *block0, u32 *block1, u32 *block2, u32 *block
}
}
DECLSPEC static void memcat16_x80 (u32 *block0, u32 *block1, u32 *block2, u32 *block3, const u32 offset, const u32 *append)
DECLSPEC void memcat16_x80 (u32 *block0, u32 *block1, u32 *block2, u32 *block3, const u32 offset, const u32 *append)
{
u32 tmp0;
u32 tmp1;
@ -239,7 +239,7 @@ DECLSPEC static void memcat16_x80 (u32 *block0, u32 *block1, u32 *block2, u32 *b
}
}
DECLSPEC static void memcat8 (u32 *block0, u32 *block1, u32 *block2, u32 *block3, const u32 offset, const u32 *append)
DECLSPEC void memcat8 (u32 *block0, u32 *block1, u32 *block2, u32 *block3, const u32 offset, const u32 *append)
{
u32 tmp0;
u32 tmp1;
@ -324,7 +324,7 @@ DECLSPEC static void memcat8 (u32 *block0, u32 *block1, u32 *block2, u32 *block3
}
}
DECLSPEC static void append_sign (u32 *block0, u32 *block1, const u32 block_len)
DECLSPEC void append_sign (u32 *block0, u32 *block1, const u32 block_len)
{
switch (block_len)
{
@ -406,7 +406,7 @@ DECLSPEC static void append_sign (u32 *block0, u32 *block1, const u32 block_len)
}
}
DECLSPEC static void append_1st (u32 *block0, u32 *block1, u32 *block2, u32 *block3, const u32 block_len, const u32 append)
DECLSPEC void append_1st (u32 *block0, u32 *block1, u32 *block2, u32 *block3, const u32 block_len, const u32 append)
{
switch (block_len)
{

View File

@ -41,7 +41,7 @@ KERNEL_FQ void m00500_init (KERN_ATTR_TMPS (md5crypt_tmp_t))
u32 w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -50,7 +50,7 @@ KERNEL_FQ void m00500_init (KERN_ATTR_TMPS (md5crypt_tmp_t))
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
@ -147,7 +147,7 @@ KERNEL_FQ void m00500_loop (KERN_ATTR_TMPS (md5crypt_tmp_t))
u32 w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -156,7 +156,7 @@ KERNEL_FQ void m00500_loop (KERN_ATTR_TMPS (md5crypt_tmp_t))
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}

View File

@ -51,7 +51,7 @@ typedef struct blake2
BLAKE2B_G (r,7,v[ 3],v[ 4],v[ 9],v[14]); \
} while(0)
DECLSPEC static void blake2b_transform (u64x *h, u64x *t, u64x *f, u64x *m, u64x *v, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x out_len, const u8 isFinal)
DECLSPEC void blake2b_transform (u64x *h, u64x *t, u64x *f, u64x *m, u64x *v, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x out_len, const u8 isFinal)
{
if (isFinal)
f[0] = -1;

View File

@ -49,7 +49,7 @@ typedef struct blake2
BLAKE2B_G (r,7,v[ 3],v[ 4],v[ 9],v[14]); \
} while(0)
DECLSPEC static void blake2b_transform (u64x *h, u64x *t, u64x *f, u64x *m, u64x *v, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x out_len, const u8 isFinal)
DECLSPEC void blake2b_transform (u64x *h, u64x *t, u64x *f, u64x *m, u64x *v, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x out_len, const u8 isFinal)
{
if (isFinal)
f[0] = -1;

View File

@ -49,7 +49,7 @@ typedef struct blake2
BLAKE2B_G (r,7,v[ 3],v[ 4],v[ 9],v[14]); \
} while(0)
DECLSPEC static void blake2b_transform (u64x *h, u64x *t, u64x *f, u64x *m, u64x *v, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x out_len, const u8 isFinal)
DECLSPEC void blake2b_transform (u64x *h, u64x *t, u64x *f, u64x *m, u64x *v, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, const u32x out_len, const u8 isFinal)
{
if (isFinal)
f[0] = -1;

View File

@ -28,7 +28,7 @@
a -= t; \
}
DECLSPEC static void m00900m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m00900m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier
@ -164,7 +164,7 @@ DECLSPEC static void m00900m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
}
}
DECLSPEC static void m00900s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m00900s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m00900_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -99,7 +99,7 @@ KERNEL_FQ void m00900_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}

View File

@ -28,7 +28,7 @@
a -= t; \
}
DECLSPEC static void m01000m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m01000m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier
@ -164,7 +164,7 @@ DECLSPEC static void m01000m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
}
}
DECLSPEC static void m01000s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m01000s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m01000_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -99,7 +99,7 @@ KERNEL_FQ void m01000_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}

View File

@ -36,7 +36,7 @@ KERNEL_FQ void m01100_mxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
@ -116,7 +116,7 @@ KERNEL_FQ void m01100_sxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m01100_mxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
@ -110,7 +110,7 @@ KERNEL_FQ void m01100_sxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}

View File

@ -13,7 +13,7 @@
#include "inc_hash_md4.cl"
#endif
DECLSPEC static void m01100m (LOCAL_AS salt_t *s_salt_buf, u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m01100m (LOCAL_AS salt_t *s_salt_buf, u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier
@ -248,7 +248,7 @@ DECLSPEC static void m01100m (LOCAL_AS salt_t *s_salt_buf, u32 *w, const u32 pw_
}
}
DECLSPEC static void m01100s (LOCAL_AS salt_t *s_salt_buf, u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m01100s (LOCAL_AS salt_t *s_salt_buf, u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m01100_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -41,7 +41,7 @@ KERNEL_FQ void m01100_mxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}
@ -123,7 +123,7 @@ KERNEL_FQ void m01100_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -132,7 +132,7 @@ KERNEL_FQ void m01100_sxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = salt_bufs[salt_pos].salt_buf[idx];
}

View File

@ -26,7 +26,7 @@
g = 0; \
}
DECLSPEC static void m01300m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m01300m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier
@ -145,7 +145,7 @@ DECLSPEC static void m01300m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
}
}
DECLSPEC static void m01300s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m01300s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m01300_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -99,7 +99,7 @@ KERNEL_FQ void m01300_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}

View File

@ -27,7 +27,7 @@
h = 0; \
}
DECLSPEC static void m01400m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m01400m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier
@ -146,7 +146,7 @@ DECLSPEC static void m01400m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
}
}
DECLSPEC static void m01400s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m01400s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m01400_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -99,7 +99,7 @@ KERNEL_FQ void m01400_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}

View File

@ -36,7 +36,7 @@ KERNEL_FQ void m01410_mxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}
@ -103,7 +103,7 @@ KERNEL_FQ void m01410_sxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m01410_mxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}
@ -97,7 +97,7 @@ KERNEL_FQ void m01410_sxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}

View File

@ -27,7 +27,7 @@
h = 0; \
}
DECLSPEC static void m01410m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m01410m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier
@ -197,7 +197,7 @@ DECLSPEC static void m01410m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
}
}
DECLSPEC static void m01410s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m01410s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m01410_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -41,7 +41,7 @@ KERNEL_FQ void m01410_mxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}
@ -110,7 +110,7 @@ KERNEL_FQ void m01410_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -119,7 +119,7 @@ KERNEL_FQ void m01410_sxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}

View File

@ -27,7 +27,7 @@
h = 0; \
}
DECLSPEC static void m01420m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
DECLSPEC void m01420m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
{
/**
* modifier
@ -221,7 +221,7 @@ DECLSPEC static void m01420m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_l
}
}
DECLSPEC static void m01420s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
DECLSPEC void m01420s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m01420_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -105,7 +105,7 @@ KERNEL_FQ void m01420_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}

View File

@ -36,7 +36,7 @@ KERNEL_FQ void m01430_mxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}
@ -103,7 +103,7 @@ KERNEL_FQ void m01430_sxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m01430_mxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}
@ -97,7 +97,7 @@ KERNEL_FQ void m01430_sxx (KERN_ATTR_BASIC ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}

View File

@ -27,7 +27,7 @@
h = 0; \
}
DECLSPEC static void m01430m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m01430m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier
@ -197,7 +197,7 @@ DECLSPEC static void m01430m (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
}
}
DECLSPEC static void m01430s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
DECLSPEC void m01430s (u32 *w, const u32 pw_len, KERN_ATTR_VECTOR ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m01430_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -41,7 +41,7 @@ KERNEL_FQ void m01430_mxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}
@ -110,7 +110,7 @@ KERNEL_FQ void m01430_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -119,7 +119,7 @@ KERNEL_FQ void m01430_sxx (KERN_ATTR_VECTOR ())
u32x s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}

View File

@ -27,7 +27,7 @@
h = 0; \
}
DECLSPEC static void m01440m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
DECLSPEC void m01440m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
{
/**
* modifier
@ -221,7 +221,7 @@ DECLSPEC static void m01440m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_l
}
}
DECLSPEC static void m01440s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
DECLSPEC void m01440s (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KERN_ATTR_BASIC ())
{
/**
* modifier

View File

@ -32,7 +32,7 @@ KERNEL_FQ void m01440_mxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}
@ -105,7 +105,7 @@ KERNEL_FQ void m01440_sxx (KERN_ATTR_VECTOR ())
u32x w[64] = { 0 };
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
{
w[idx] = pws[gid].i[idx];
}

View File

@ -15,7 +15,7 @@
#include "inc_hash_sha256.cl"
#endif
DECLSPEC static void hmac_sha256_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
DECLSPEC void hmac_sha256_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad)
{
w0[0] = w0[0] ^ 0x36363636;
w0[1] = w0[1] ^ 0x36363636;
@ -74,7 +74,7 @@ DECLSPEC static void hmac_sha256_pad (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u3
sha256_transform_vector (w0, w1, w2, w3, opad);
}
DECLSPEC static void hmac_sha256_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
DECLSPEC void hmac_sha256_run (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *ipad, u32x *opad, u32x *digest)
{
digest[0] = ipad[0];
digest[1] = ipad[1];

View File

@ -36,7 +36,7 @@ KERNEL_FQ void m01450_mxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}
@ -101,7 +101,7 @@ KERNEL_FQ void m01450_sxx (KERN_ATTR_RULES ())
u32 s[64] = { 0 };
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
for (u32 i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
{
s[idx] = hc_swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
}

Some files were not shown because too many files have changed in this diff Show More