mirror of
https://github.com/hashcat/hashcat
synced 2024-11-24 14:27:14 +01:00
Test optimization for kernel include in pure mode
This commit is contained in:
parent
a3b6e6f1b0
commit
74e3ede391
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1209,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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1281,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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1478,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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1578,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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1295,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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1295,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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1979,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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2096,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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -761,71 +761,115 @@ DECLSPEC void streebog256_update_64 (streebog256_ctx_t *ctx, u32 *w0, u32 *w1, u
|
||||
|
||||
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)
|
||||
{
|
||||
streebog256_transform (ctx, ctx->w0, ctx->w1, ctx->w2, ctx->w3);
|
||||
|
||||
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->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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1420,71 +1464,115 @@ DECLSPEC void streebog256_update_vector_64 (streebog256_ctx_vector_t *ctx, 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)
|
||||
{
|
||||
streebog256_transform_vector (ctx, ctx->w0, ctx->w1, ctx->w2, ctx->w3);
|
||||
|
||||
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->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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -761,71 +761,115 @@ DECLSPEC void streebog512_update_64 (streebog512_ctx_t *ctx, u32 *w0, u32 *w1, u
|
||||
|
||||
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)
|
||||
{
|
||||
streebog512_transform (ctx, ctx->w0, ctx->w1, ctx->w2, ctx->w3);
|
||||
|
||||
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->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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1439,71 +1483,115 @@ DECLSPEC void streebog512_update_vector_64 (streebog512_ctx_vector_t *ctx, 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)
|
||||
{
|
||||
streebog512_transform_vector (ctx, ctx->w0, ctx->w1, ctx->w2, ctx->w3);
|
||||
|
||||
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->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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2579,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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user