1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 09:58:16 +00:00

Optimize some xxx_hmac_final functions

This commit is contained in:
jsteube 2019-04-14 15:59:03 +02:00
parent 9708275ac4
commit c34f75fe2d
11 changed files with 510 additions and 560 deletions

View File

@ -1057,29 +1057,24 @@ DECLSPEC void md4_hmac_final (md4_hmac_ctx_t *ctx)
{ {
md4_final (&ctx->ipad); md4_final (&ctx->ipad);
u32 t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32 t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32 t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32 t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = 0;
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 16;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = 0;
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
md4_update_64 (&ctx->opad, t0, t1, t2, t3, 16);
md4_final (&ctx->opad); md4_final (&ctx->opad);
} }
@ -1695,29 +1690,24 @@ DECLSPEC void md4_hmac_final_vector (md4_hmac_ctx_vector_t *ctx)
{ {
md4_final_vector (&ctx->ipad); md4_final_vector (&ctx->ipad);
u32x t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32x t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32x t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32x t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = 0;
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 16;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = 0;
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
md4_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 16);
md4_final_vector (&ctx->opad); md4_final_vector (&ctx->opad);
} }

View File

@ -1093,29 +1093,24 @@ DECLSPEC void md5_hmac_final (md5_hmac_ctx_t *ctx)
{ {
md5_final (&ctx->ipad); md5_final (&ctx->ipad);
u32 t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32 t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32 t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32 t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = 0;
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 16;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = 0;
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
md5_update_64 (&ctx->opad, t0, t1, t2, t3, 16);
md5_final (&ctx->opad); md5_final (&ctx->opad);
} }
@ -1767,29 +1762,24 @@ DECLSPEC void md5_hmac_final_vector (md5_hmac_ctx_vector_t *ctx)
{ {
md5_final_vector (&ctx->ipad); md5_final_vector (&ctx->ipad);
u32x t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32x t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32x t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32x t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = 0;
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 16;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = 0;
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
md5_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 16);
md5_final_vector (&ctx->opad); md5_final_vector (&ctx->opad);
} }

View File

@ -1191,29 +1191,24 @@ DECLSPEC void ripemd160_hmac_final (ripemd160_hmac_ctx_t *ctx)
{ {
ripemd160_final (&ctx->ipad); ripemd160_final (&ctx->ipad);
u32 t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32 t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32 t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32 t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 20;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
ripemd160_update_64 (&ctx->opad, t0, t1, t2, t3, 20);
ripemd160_final (&ctx->opad); ripemd160_final (&ctx->opad);
} }
@ -1964,29 +1959,24 @@ DECLSPEC void ripemd160_hmac_final_vector (ripemd160_hmac_ctx_vector_t *ctx)
{ {
ripemd160_final_vector (&ctx->ipad); ripemd160_final_vector (&ctx->ipad);
u32x t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32x t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32x t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32x t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 20;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
ripemd160_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 20);
ripemd160_final_vector (&ctx->opad); ripemd160_final_vector (&ctx->opad);
} }

View File

@ -1359,29 +1359,24 @@ DECLSPEC void sha1_hmac_final (sha1_hmac_ctx_t *ctx)
{ {
sha1_final (&ctx->ipad); sha1_final (&ctx->ipad);
u32 t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32 t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32 t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32 t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 20;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha1_update_64 (&ctx->opad, t0, t1, t2, t3, 20);
sha1_final (&ctx->opad); sha1_final (&ctx->opad);
} }
@ -2148,29 +2143,24 @@ DECLSPEC void sha1_hmac_final_vector (sha1_hmac_ctx_vector_t *ctx)
{ {
sha1_final_vector (&ctx->ipad); sha1_final_vector (&ctx->ipad);
u32x t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32x t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32x t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32x t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 20;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = 0;
t1[2] = 0;
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha1_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 20);
sha1_final_vector (&ctx->opad); sha1_final_vector (&ctx->opad);
} }

View File

@ -1108,29 +1108,24 @@ DECLSPEC void sha224_hmac_final (sha224_hmac_ctx_t *ctx)
{ {
sha224_final (&ctx->ipad); sha224_final (&ctx->ipad);
u32 t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32 t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32 t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32 t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = ctx->ipad.h[5];
ctx->opad.w1[2] = ctx->ipad.h[6];
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 28;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = ctx->ipad.h[5];
t1[2] = ctx->ipad.h[6];
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha224_update_64 (&ctx->opad, t0, t1, t2, t3, 28);
sha224_final (&ctx->opad); sha224_final (&ctx->opad);
} }
@ -1823,29 +1818,24 @@ DECLSPEC void sha224_hmac_final_vector (sha224_hmac_ctx_vector_t *ctx)
{ {
sha224_final_vector (&ctx->ipad); sha224_final_vector (&ctx->ipad);
u32x t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32x t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32x t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32x t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = ctx->ipad.h[5];
ctx->opad.w1[2] = ctx->ipad.h[6];
ctx->opad.w1[3] = 0:
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 28;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = ctx->ipad.h[5];
t1[2] = ctx->ipad.h[6];
t1[3] = 0;
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha224_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 28);
sha224_final_vector (&ctx->opad); sha224_final_vector (&ctx->opad);
} }

View File

@ -1108,29 +1108,24 @@ DECLSPEC void sha256_hmac_final (sha256_hmac_ctx_t *ctx)
{ {
sha256_final (&ctx->ipad); sha256_final (&ctx->ipad);
u32 t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32 t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32 t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32 t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = ctx->ipad.h[5];
ctx->opad.w1[2] = ctx->ipad.h[6];
ctx->opad.w1[3] = ctx->ipad.h[7];
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 32;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = ctx->ipad.h[5];
t1[2] = ctx->ipad.h[6];
t1[3] = ctx->ipad.h[7];
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha256_update_64 (&ctx->opad, t0, t1, t2, t3, 32);
sha256_final (&ctx->opad); sha256_final (&ctx->opad);
} }
@ -1823,29 +1818,24 @@ DECLSPEC void sha256_hmac_final_vector (sha256_hmac_ctx_vector_t *ctx)
{ {
sha256_final_vector (&ctx->ipad); sha256_final_vector (&ctx->ipad);
u32x t0[4]; ctx->opad.w0[0] = ctx->ipad.h[0];
u32x t1[4]; ctx->opad.w0[1] = ctx->ipad.h[1];
u32x t2[4]; ctx->opad.w0[2] = ctx->ipad.h[2];
u32x t3[4]; ctx->opad.w0[3] = ctx->ipad.h[3];
ctx->opad.w1[0] = ctx->ipad.h[4];
ctx->opad.w1[1] = ctx->ipad.h[5];
ctx->opad.w1[2] = ctx->ipad.h[6];
ctx->opad.w1[3] = ctx->ipad.h[7];
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = ctx->ipad.h[0]; ctx->opad.len += 32;
t0[1] = ctx->ipad.h[1];
t0[2] = ctx->ipad.h[2];
t0[3] = ctx->ipad.h[3];
t1[0] = ctx->ipad.h[4];
t1[1] = ctx->ipad.h[5];
t1[2] = ctx->ipad.h[6];
t1[3] = ctx->ipad.h[7];
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
sha256_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 32);
sha256_final_vector (&ctx->opad); sha256_final_vector (&ctx->opad);
} }

View File

@ -1744,49 +1744,40 @@ DECLSPEC void sha384_hmac_final (sha384_hmac_ctx_t *ctx)
{ {
sha384_final (&ctx->ipad); sha384_final (&ctx->ipad);
u32 t0[4]; ctx->opad.w0[0] = h32_from_64_S (ctx->ipad.h[0]);
u32 t1[4]; ctx->opad.w0[1] = l32_from_64_S (ctx->ipad.h[0]);
u32 t2[4]; ctx->opad.w0[2] = h32_from_64_S (ctx->ipad.h[1]);
u32 t3[4]; ctx->opad.w0[3] = l32_from_64_S (ctx->ipad.h[1]);
u32 t4[4]; ctx->opad.w1[0] = h32_from_64_S (ctx->ipad.h[2]);
u32 t5[4]; ctx->opad.w1[1] = l32_from_64_S (ctx->ipad.h[2]);
u32 t6[4]; ctx->opad.w1[2] = h32_from_64_S (ctx->ipad.h[3]);
u32 t7[4]; ctx->opad.w1[3] = l32_from_64_S (ctx->ipad.h[3]);
ctx->opad.w2[0] = h32_from_64_S (ctx->ipad.h[4]);
ctx->opad.w2[1] = l32_from_64_S (ctx->ipad.h[4]);
ctx->opad.w2[2] = h32_from_64_S (ctx->ipad.h[5]);
ctx->opad.w2[3] = l32_from_64_S (ctx->ipad.h[5]);
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
ctx->opad.w4[0] = 0;
ctx->opad.w4[1] = 0;
ctx->opad.w4[2] = 0;
ctx->opad.w4[3] = 0;
ctx->opad.w5[0] = 0;
ctx->opad.w5[1] = 0;
ctx->opad.w5[2] = 0;
ctx->opad.w5[3] = 0;
ctx->opad.w6[0] = 0;
ctx->opad.w6[1] = 0;
ctx->opad.w6[2] = 0;
ctx->opad.w6[3] = 0;
ctx->opad.w7[0] = 0;
ctx->opad.w7[1] = 0;
ctx->opad.w7[2] = 0;
ctx->opad.w7[3] = 0;
t0[0] = h32_from_64_S (ctx->ipad.h[0]); ctx->opad.len += 48;
t0[1] = l32_from_64_S (ctx->ipad.h[0]);
t0[2] = h32_from_64_S (ctx->ipad.h[1]);
t0[3] = l32_from_64_S (ctx->ipad.h[1]);
t1[0] = h32_from_64_S (ctx->ipad.h[2]);
t1[1] = l32_from_64_S (ctx->ipad.h[2]);
t1[2] = h32_from_64_S (ctx->ipad.h[3]);
t1[3] = l32_from_64_S (ctx->ipad.h[3]);
t2[0] = h32_from_64_S (ctx->ipad.h[4]);
t2[1] = l32_from_64_S (ctx->ipad.h[4]);
t2[2] = h32_from_64_S (ctx->ipad.h[5]);
t2[3] = l32_from_64_S (ctx->ipad.h[5]);
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
t4[0] = 0;
t4[1] = 0;
t4[2] = 0;
t4[3] = 0;
t5[0] = 0;
t5[1] = 0;
t5[2] = 0;
t5[3] = 0;
t6[0] = 0;
t6[1] = 0;
t6[2] = 0;
t6[3] = 0;
t7[0] = 0;
t7[1] = 0;
t7[2] = 0;
t7[3] = 0;
sha384_update_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 48);
sha384_final (&ctx->opad); sha384_final (&ctx->opad);
} }
@ -2859,49 +2850,40 @@ DECLSPEC void sha384_hmac_final_vector (sha384_hmac_ctx_vector_t *ctx)
{ {
sha384_final_vector (&ctx->ipad); sha384_final_vector (&ctx->ipad);
u32x t0[4]; ctx->opad.w0[0] = h32_from_64 (ctx->ipad.h[0]);
u32x t1[4]; ctx->opad.w0[1] = l32_from_64 (ctx->ipad.h[0]);
u32x t2[4]; ctx->opad.w0[2] = h32_from_64 (ctx->ipad.h[1]);
u32x t3[4]; ctx->opad.w0[3] = l32_from_64 (ctx->ipad.h[1]);
u32x t4[4]; ctx->opad.w1[0] = h32_from_64 (ctx->ipad.h[2]);
u32x t5[4]; ctx->opad.w1[1] = l32_from_64 (ctx->ipad.h[2]);
u32x t6[4]; ctx->opad.w1[2] = h32_from_64 (ctx->ipad.h[3]);
u32x t7[4]; ctx->opad.w1[3] = l32_from_64 (ctx->ipad.h[3]);
ctx->opad.w2[0] = h32_from_64 (ctx->ipad.h[4]);
ctx->opad.w2[1] = l32_from_64 (ctx->ipad.h[4]);
ctx->opad.w2[2] = h32_from_64 (ctx->ipad.h[5]);
ctx->opad.w2[3] = l32_from_64 (ctx->ipad.h[5]);
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
ctx->opad.w4[0] = 0;
ctx->opad.w4[1] = 0;
ctx->opad.w4[2] = 0;
ctx->opad.w4[3] = 0;
ctx->opad.w5[0] = 0;
ctx->opad.w5[1] = 0;
ctx->opad.w5[2] = 0;
ctx->opad.w5[3] = 0;
ctx->opad.w6[0] = 0;
ctx->opad.w6[1] = 0;
ctx->opad.w6[2] = 0;
ctx->opad.w6[3] = 0;
ctx->opad.w7[0] = 0;
ctx->opad.w7[1] = 0;
ctx->opad.w7[2] = 0;
ctx->opad.w7[3] = 0;
t0[0] = h32_from_64 (ctx->ipad.h[0]); ctx->opad.len += 48;
t0[1] = l32_from_64 (ctx->ipad.h[0]);
t0[2] = h32_from_64 (ctx->ipad.h[1]);
t0[3] = l32_from_64 (ctx->ipad.h[1]);
t1[0] = h32_from_64 (ctx->ipad.h[2]);
t1[1] = l32_from_64 (ctx->ipad.h[2]);
t1[2] = h32_from_64 (ctx->ipad.h[3]);
t1[3] = l32_from_64 (ctx->ipad.h[3]);
t2[0] = h32_from_64 (ctx->ipad.h[4]);
t2[1] = l32_from_64 (ctx->ipad.h[4]);
t2[2] = h32_from_64 (ctx->ipad.h[5]);
t2[3] = l32_from_64 (ctx->ipad.h[5]);
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
t4[0] = 0;
t4[1] = 0;
t4[2] = 0;
t4[3] = 0;
t5[0] = 0;
t5[1] = 0;
t5[2] = 0;
t5[3] = 0;
t6[0] = 0;
t6[1] = 0;
t6[2] = 0;
t6[3] = 0;
t7[0] = 0;
t7[1] = 0;
t7[2] = 0;
t7[3] = 0;
sha384_update_vector_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 48);
sha384_final_vector (&ctx->opad); sha384_final_vector (&ctx->opad);
} }

View File

@ -1861,49 +1861,40 @@ DECLSPEC void sha512_hmac_final (sha512_hmac_ctx_t *ctx)
{ {
sha512_final (&ctx->ipad); sha512_final (&ctx->ipad);
u32 t0[4]; ctx->opad.w0[0] = h32_from_64_S (ctx->ipad.h[0]);
u32 t1[4]; ctx->opad.w0[1] = l32_from_64_S (ctx->ipad.h[0]);
u32 t2[4]; ctx->opad.w0[2] = h32_from_64_S (ctx->ipad.h[1]);
u32 t3[4]; ctx->opad.w0[3] = l32_from_64_S (ctx->ipad.h[1]);
u32 t4[4]; ctx->opad.w1[0] = h32_from_64_S (ctx->ipad.h[2]);
u32 t5[4]; ctx->opad.w1[1] = l32_from_64_S (ctx->ipad.h[2]);
u32 t6[4]; ctx->opad.w1[2] = h32_from_64_S (ctx->ipad.h[3]);
u32 t7[4]; ctx->opad.w1[3] = l32_from_64_S (ctx->ipad.h[3]);
ctx->opad.w2[0] = h32_from_64_S (ctx->ipad.h[4]);
ctx->opad.w2[1] = l32_from_64_S (ctx->ipad.h[4]);
ctx->opad.w2[2] = h32_from_64_S (ctx->ipad.h[5]);
ctx->opad.w2[3] = l32_from_64_S (ctx->ipad.h[5]);
ctx->opad.w3[0] = h32_from_64_S (ctx->ipad.h[6]);
ctx->opad.w3[1] = l32_from_64_S (ctx->ipad.h[6]);
ctx->opad.w3[2] = h32_from_64_S (ctx->ipad.h[7]);
ctx->opad.w3[3] = l32_from_64_S (ctx->ipad.h[7]);
ctx->opad.w4[0] = 0;
ctx->opad.w4[1] = 0;
ctx->opad.w4[2] = 0;
ctx->opad.w4[3] = 0;
ctx->opad.w5[0] = 0;
ctx->opad.w5[1] = 0;
ctx->opad.w5[2] = 0;
ctx->opad.w5[3] = 0;
ctx->opad.w6[0] = 0;
ctx->opad.w6[1] = 0;
ctx->opad.w6[2] = 0;
ctx->opad.w6[3] = 0;
ctx->opad.w7[0] = 0;
ctx->opad.w7[1] = 0;
ctx->opad.w7[2] = 0;
ctx->opad.w7[3] = 0;
t0[0] = h32_from_64_S (ctx->ipad.h[0]); ctx->opad.len += 64;
t0[1] = l32_from_64_S (ctx->ipad.h[0]);
t0[2] = h32_from_64_S (ctx->ipad.h[1]);
t0[3] = l32_from_64_S (ctx->ipad.h[1]);
t1[0] = h32_from_64_S (ctx->ipad.h[2]);
t1[1] = l32_from_64_S (ctx->ipad.h[2]);
t1[2] = h32_from_64_S (ctx->ipad.h[3]);
t1[3] = l32_from_64_S (ctx->ipad.h[3]);
t2[0] = h32_from_64_S (ctx->ipad.h[4]);
t2[1] = l32_from_64_S (ctx->ipad.h[4]);
t2[2] = h32_from_64_S (ctx->ipad.h[5]);
t2[3] = l32_from_64_S (ctx->ipad.h[5]);
t3[0] = h32_from_64_S (ctx->ipad.h[6]);
t3[1] = l32_from_64_S (ctx->ipad.h[6]);
t3[2] = h32_from_64_S (ctx->ipad.h[7]);
t3[3] = l32_from_64_S (ctx->ipad.h[7]);
t4[0] = 0;
t4[1] = 0;
t4[2] = 0;
t4[3] = 0;
t5[0] = 0;
t5[1] = 0;
t5[2] = 0;
t5[3] = 0;
t6[0] = 0;
t6[1] = 0;
t6[2] = 0;
t6[3] = 0;
t7[0] = 0;
t7[1] = 0;
t7[2] = 0;
t7[3] = 0;
sha512_update_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 64);
sha512_final (&ctx->opad); sha512_final (&ctx->opad);
} }
@ -2976,49 +2967,40 @@ DECLSPEC void sha512_hmac_final_vector (sha512_hmac_ctx_vector_t *ctx)
{ {
sha512_final_vector (&ctx->ipad); sha512_final_vector (&ctx->ipad);
u32x t0[4]; ctx->opad.w0[0] = h32_from_64 (ctx->ipad.h[0]);
u32x t1[4]; ctx->opad.w0[1] = l32_from_64 (ctx->ipad.h[0]);
u32x t2[4]; ctx->opad.w0[2] = h32_from_64 (ctx->ipad.h[1]);
u32x t3[4]; ctx->opad.w0[3] = l32_from_64 (ctx->ipad.h[1]);
u32x t4[4]; ctx->opad.w1[0] = h32_from_64 (ctx->ipad.h[2]);
u32x t5[4]; ctx->opad.w1[1] = l32_from_64 (ctx->ipad.h[2]);
u32x t6[4]; ctx->opad.w1[2] = h32_from_64 (ctx->ipad.h[3]);
u32x t7[4]; ctx->opad.w1[3] = l32_from_64 (ctx->ipad.h[3]);
ctx->opad.w2[0] = h32_from_64 (ctx->ipad.h[4]);
ctx->opad.w2[1] = l32_from_64 (ctx->ipad.h[4]);
ctx->opad.w2[2] = h32_from_64 (ctx->ipad.h[5]);
ctx->opad.w2[3] = l32_from_64 (ctx->ipad.h[5]);
ctx->opad.w3[0] = h32_from_64 (ctx->ipad.h[6]);
ctx->opad.w3[1] = l32_from_64 (ctx->ipad.h[6]);
ctx->opad.w3[2] = h32_from_64 (ctx->ipad.h[7]);
ctx->opad.w3[3] = l32_from_64 (ctx->ipad.h[7]);
ctx->opad.w4[0] = 0;
ctx->opad.w4[1] = 0;
ctx->opad.w4[2] = 0;
ctx->opad.w4[3] = 0;
ctx->opad.w5[0] = 0;
ctx->opad.w5[1] = 0;
ctx->opad.w5[2] = 0;
ctx->opad.w5[3] = 0;
ctx->opad.w6[0] = 0;
ctx->opad.w6[1] = 0;
ctx->opad.w6[2] = 0;
ctx->opad.w6[3] = 0;
ctx->opad.w7[0] = 0;
ctx->opad.w7[1] = 0;
ctx->opad.w7[2] = 0;
ctx->opad.w7[3] = 0;
t0[0] = h32_from_64 (ctx->ipad.h[0]); ctx->opad.len += 64;
t0[1] = l32_from_64 (ctx->ipad.h[0]);
t0[2] = h32_from_64 (ctx->ipad.h[1]);
t0[3] = l32_from_64 (ctx->ipad.h[1]);
t1[0] = h32_from_64 (ctx->ipad.h[2]);
t1[1] = l32_from_64 (ctx->ipad.h[2]);
t1[2] = h32_from_64 (ctx->ipad.h[3]);
t1[3] = l32_from_64 (ctx->ipad.h[3]);
t2[0] = h32_from_64 (ctx->ipad.h[4]);
t2[1] = l32_from_64 (ctx->ipad.h[4]);
t2[2] = h32_from_64 (ctx->ipad.h[5]);
t2[3] = l32_from_64 (ctx->ipad.h[5]);
t3[0] = h32_from_64 (ctx->ipad.h[6]);
t3[1] = l32_from_64 (ctx->ipad.h[6]);
t3[2] = h32_from_64 (ctx->ipad.h[7]);
t3[3] = l32_from_64 (ctx->ipad.h[7]);
t4[0] = 0;
t4[1] = 0;
t4[2] = 0;
t4[3] = 0;
t5[0] = 0;
t5[1] = 0;
t5[2] = 0;
t5[3] = 0;
t6[0] = 0;
t6[1] = 0;
t6[2] = 0;
t6[3] = 0;
t7[0] = 0;
t7[1] = 0;
t7[2] = 0;
t7[3] = 0;
sha512_update_vector_128 (&ctx->opad, t0, t1, t2, t3, t4, t5, t6, t7, 64);
sha512_final_vector (&ctx->opad); sha512_final_vector (&ctx->opad);
} }

View File

@ -1227,29 +1227,24 @@ DECLSPEC void streebog256_hmac_final (streebog256_hmac_ctx_t *ctx)
{ {
streebog256_final (&ctx->ipad); streebog256_final (&ctx->ipad);
u32 t0[4]; ctx->opad.w0[0] = h32_from_64_S (ctx->ipad.h[3]);
u32 t1[4]; ctx->opad.w0[1] = l32_from_64_S (ctx->ipad.h[3]);
u32 t2[4]; ctx->opad.w0[2] = h32_from_64_S (ctx->ipad.h[2]);
u32 t3[4]; ctx->opad.w0[3] = l32_from_64_S (ctx->ipad.h[2]);
ctx->opad.w1[0] = h32_from_64_S (ctx->ipad.h[1]);
ctx->opad.w1[1] = l32_from_64_S (ctx->ipad.h[1]);
ctx->opad.w1[2] = h32_from_64_S (ctx->ipad.h[0]);
ctx->opad.w1[3] = l32_from_64_S (ctx->ipad.h[0]);
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = h32_from_64_S (ctx->ipad.h[3]); ctx->opad.len += 32;
t0[1] = l32_from_64_S (ctx->ipad.h[3]);
t0[2] = h32_from_64_S (ctx->ipad.h[2]);
t0[3] = l32_from_64_S (ctx->ipad.h[2]);
t1[0] = h32_from_64_S (ctx->ipad.h[1]);
t1[1] = l32_from_64_S (ctx->ipad.h[1]);
t1[2] = h32_from_64_S (ctx->ipad.h[0]);
t1[3] = l32_from_64_S (ctx->ipad.h[0]);
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
streebog256_update_64 (&ctx->opad, t0, t1, t2, t3, 32);
streebog256_final (&ctx->opad); streebog256_final (&ctx->opad);
} }
@ -1822,29 +1817,24 @@ DECLSPEC void streebog256_hmac_final_vector (streebog256_hmac_ctx_vector_t *ctx)
{ {
streebog256_final_vector (&ctx->ipad); streebog256_final_vector (&ctx->ipad);
u32x t0[4]; ctx->opad.w0[0] = h32_from_64 (ctx->ipad.h[3]);
u32x t1[4]; ctx->opad.w0[1] = l32_from_64 (ctx->ipad.h[3]);
u32x t2[4]; ctx->opad.w0[2] = h32_from_64 (ctx->ipad.h[2]);
u32x t3[4]; ctx->opad.w0[3] = l32_from_64 (ctx->ipad.h[2]);
ctx->opad.w1[0] = h32_from_64 (ctx->ipad.h[1]);
ctx->opad.w1[1] = l32_from_64 (ctx->ipad.h[1]);
ctx->opad.w1[2] = h32_from_64 (ctx->ipad.h[0]);
ctx->opad.w1[3] = l32_from_64 (ctx->ipad.h[0]);
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
t0[0] = h32_from_64 (ctx->ipad.h[3]); ctx->opad.len += 32;
t0[1] = l32_from_64 (ctx->ipad.h[3]);
t0[2] = h32_from_64 (ctx->ipad.h[2]);
t0[3] = l32_from_64 (ctx->ipad.h[2]);
t1[0] = h32_from_64 (ctx->ipad.h[1]);
t1[1] = l32_from_64 (ctx->ipad.h[1]);
t1[2] = h32_from_64 (ctx->ipad.h[0]);
t1[3] = l32_from_64 (ctx->ipad.h[0]);
t2[0] = 0;
t2[1] = 0;
t2[2] = 0;
t2[3] = 0;
t3[0] = 0;
t3[1] = 0;
t3[2] = 0;
t3[3] = 0;
streebog256_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 32);
streebog256_final_vector (&ctx->opad); streebog256_final_vector (&ctx->opad);
} }

View File

@ -1227,29 +1227,43 @@ DECLSPEC void streebog512_hmac_final (streebog512_hmac_ctx_t *ctx)
{ {
streebog512_final (&ctx->ipad); streebog512_final (&ctx->ipad);
u32 t0[4]; ctx->opad.w0[0] = h32_from_64_S (ctx->ipad.h[7]);
u32 t1[4]; ctx->opad.w0[1] = l32_from_64_S (ctx->ipad.h[7]);
u32 t2[4]; ctx->opad.w0[2] = h32_from_64_S (ctx->ipad.h[6]);
u32 t3[4]; ctx->opad.w0[3] = l32_from_64_S (ctx->ipad.h[6]);
ctx->opad.w1[0] = h32_from_64_S (ctx->ipad.h[5]);
ctx->opad.w1[1] = l32_from_64_S (ctx->ipad.h[5]);
ctx->opad.w1[2] = h32_from_64_S (ctx->ipad.h[4]);
ctx->opad.w1[3] = l32_from_64_S (ctx->ipad.h[4]);
ctx->opad.w2[0] = h32_from_64_S (ctx->ipad.h[3]);
ctx->opad.w2[1] = l32_from_64_S (ctx->ipad.h[3]);
ctx->opad.w2[2] = h32_from_64_S (ctx->ipad.h[2]);
ctx->opad.w2[3] = l32_from_64_S (ctx->ipad.h[2]);
ctx->opad.w3[0] = h32_from_64_S (ctx->ipad.h[1]);
ctx->opad.w3[1] = l32_from_64_S (ctx->ipad.h[1]);
ctx->opad.w3[2] = h32_from_64_S (ctx->ipad.h[0]);
ctx->opad.w3[3] = l32_from_64_S (ctx->ipad.h[0]);
t0[0] = h32_from_64_S (ctx->ipad.h[7]); ctx->opad.len = 0;
t0[1] = l32_from_64_S (ctx->ipad.h[7]);
t0[2] = h32_from_64_S (ctx->ipad.h[6]);
t0[3] = l32_from_64_S (ctx->ipad.h[6]);
t1[0] = h32_from_64_S (ctx->ipad.h[5]);
t1[1] = l32_from_64_S (ctx->ipad.h[5]);
t1[2] = h32_from_64_S (ctx->ipad.h[4]);
t1[3] = l32_from_64_S (ctx->ipad.h[4]);
t2[0] = h32_from_64_S (ctx->ipad.h[3]);
t2[1] = l32_from_64_S (ctx->ipad.h[3]);
t2[2] = h32_from_64_S (ctx->ipad.h[2]);
t2[3] = l32_from_64_S (ctx->ipad.h[2]);
t3[0] = h32_from_64_S (ctx->ipad.h[1]);
t3[1] = l32_from_64_S (ctx->ipad.h[1]);
t3[2] = h32_from_64_S (ctx->ipad.h[0]);
t3[3] = l32_from_64_S (ctx->ipad.h[0]);
streebog512_update_64 (&ctx->opad, t0, t1, t2, t3, 64); streebog512_transform (&ctx->opad, ctx->opad.w0, ctx->opad.w1, ctx->opad.w2, ctx->opad.w3);
ctx->opad.w0[0] = 0;
ctx->opad.w0[1] = 0;
ctx->opad.w0[2] = 0;
ctx->opad.w0[3] = 0;
ctx->opad.w1[0] = 0;
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
streebog512_final (&ctx->opad); streebog512_final (&ctx->opad);
} }
@ -1822,29 +1836,43 @@ DECLSPEC void streebog512_hmac_final_vector (streebog512_hmac_ctx_vector_t *ctx)
{ {
streebog512_final_vector (&ctx->ipad); streebog512_final_vector (&ctx->ipad);
u32x t0[4]; ctx->opad.w0[0] = h32_from_64 (ctx->ipad.h[7]);
u32x t1[4]; ctx->opad.w0[1] = l32_from_64 (ctx->ipad.h[7]);
u32x t2[4]; ctx->opad.w0[2] = h32_from_64 (ctx->ipad.h[6]);
u32x t3[4]; ctx->opad.w0[3] = l32_from_64 (ctx->ipad.h[6]);
ctx->opad.w1[0] = h32_from_64 (ctx->ipad.h[5]);
ctx->opad.w1[1] = l32_from_64 (ctx->ipad.h[5]);
ctx->opad.w1[2] = h32_from_64 (ctx->ipad.h[4]);
ctx->opad.w1[3] = l32_from_64 (ctx->ipad.h[4]);
ctx->opad.w2[0] = h32_from_64 (ctx->ipad.h[3]);
ctx->opad.w2[1] = l32_from_64 (ctx->ipad.h[3]);
ctx->opad.w2[2] = h32_from_64 (ctx->ipad.h[2]);
ctx->opad.w2[3] = l32_from_64 (ctx->ipad.h[2]);
ctx->opad.w3[0] = h32_from_64 (ctx->ipad.h[1]);
ctx->opad.w3[1] = l32_from_64 (ctx->ipad.h[1]);
ctx->opad.w3[2] = h32_from_64 (ctx->ipad.h[0]);
ctx->opad.w3[3] = l32_from_64 (ctx->ipad.h[0]);
t0[0] = h32_from_64 (ctx->ipad.h[7]); ctx->opad.len = 0;
t0[1] = l32_from_64 (ctx->ipad.h[7]);
t0[2] = h32_from_64 (ctx->ipad.h[6]);
t0[3] = l32_from_64 (ctx->ipad.h[6]);
t1[0] = h32_from_64 (ctx->ipad.h[5]);
t1[1] = l32_from_64 (ctx->ipad.h[5]);
t1[2] = h32_from_64 (ctx->ipad.h[4]);
t1[3] = l32_from_64 (ctx->ipad.h[4]);
t2[0] = h32_from_64 (ctx->ipad.h[3]);
t2[1] = l32_from_64 (ctx->ipad.h[3]);
t2[2] = h32_from_64 (ctx->ipad.h[2]);
t2[3] = l32_from_64 (ctx->ipad.h[2]);
t3[0] = h32_from_64 (ctx->ipad.h[1]);
t3[1] = l32_from_64 (ctx->ipad.h[1]);
t3[2] = h32_from_64 (ctx->ipad.h[0]);
t3[3] = l32_from_64 (ctx->ipad.h[0]);
streebog512_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64); streebog512_transform_vector (&ctx->opad, ctx->opad.w0, ctx->opad.w1, ctx->opad.w2, ctx->opad.w3);
ctx->opad.w0[0] = 0;
ctx->opad.w0[1] = 0;
ctx->opad.w0[2] = 0;
ctx->opad.w0[3] = 0;
ctx->opad.w1[0] = 0;
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
streebog512_final_vector (&ctx->opad); streebog512_final_vector (&ctx->opad);
} }

View File

@ -2272,29 +2272,43 @@ DECLSPEC void whirlpool_hmac_final (whirlpool_hmac_ctx_t *ctx)
{ {
whirlpool_final (&ctx->ipad); whirlpool_final (&ctx->ipad);
u32 t0[4]; ctx->opad.w0[0] = ctx->ipad.h[ 0];
u32 t1[4]; ctx->opad.w0[1] = ctx->ipad.h[ 1];
u32 t2[4]; ctx->opad.w0[2] = ctx->ipad.h[ 2];
u32 t3[4]; ctx->opad.w0[3] = ctx->ipad.h[ 3];
ctx->opad.w1[0] = ctx->ipad.h[ 4];
ctx->opad.w1[1] = ctx->ipad.h[ 5];
ctx->opad.w1[2] = ctx->ipad.h[ 6];
ctx->opad.w1[3] = ctx->ipad.h[ 7];
ctx->opad.w2[0] = ctx->ipad.h[ 8];
ctx->opad.w2[1] = ctx->ipad.h[ 9];
ctx->opad.w2[2] = ctx->ipad.h[10];
ctx->opad.w2[3] = ctx->ipad.h[11];
ctx->opad.w3[0] = ctx->ipad.h[12];
ctx->opad.w3[1] = ctx->ipad.h[13];
ctx->opad.w3[2] = ctx->ipad.h[14];
ctx->opad.w3[3] = ctx->ipad.h[15];
t0[0] = ctx->ipad.h[ 0]; ctx->opad.len += 64;
t0[1] = ctx->ipad.h[ 1];
t0[2] = ctx->ipad.h[ 2];
t0[3] = ctx->ipad.h[ 3];
t1[0] = ctx->ipad.h[ 4];
t1[1] = ctx->ipad.h[ 5];
t1[2] = ctx->ipad.h[ 6];
t1[3] = ctx->ipad.h[ 7];
t2[0] = ctx->ipad.h[ 8];
t2[1] = ctx->ipad.h[ 9];
t2[2] = ctx->ipad.h[10];
t2[3] = ctx->ipad.h[11];
t3[0] = ctx->ipad.h[12];
t3[1] = ctx->ipad.h[13];
t3[2] = ctx->ipad.h[14];
t3[3] = ctx->ipad.h[15];
whirlpool_update_64 (&ctx->opad, t0, t1, t2, t3, 64); whirlpool_transform (ctx->opad.w0, ctx->opad.w1, ctx->opad.w2, ctx->opad.w3, ctx->opad.h, ctx->opad.s_Ch, ctx->opad.s_Cl);
ctx->opad.w0[0] = 0;
ctx->opad.w0[1] = 0;
ctx->opad.w0[2] = 0;
ctx->opad.w0[3] = 0;
ctx->opad.w1[0] = 0;
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
whirlpool_final (&ctx->opad); whirlpool_final (&ctx->opad);
} }
@ -3046,29 +3060,43 @@ DECLSPEC void whirlpool_hmac_final_vector (whirlpool_hmac_ctx_vector_t *ctx)
{ {
whirlpool_final_vector (&ctx->ipad); whirlpool_final_vector (&ctx->ipad);
u32x t0[4]; ctx->opad.w0[0] = ctx->ipad.h[ 0];
u32x t1[4]; ctx->opad.w0[1] = ctx->ipad.h[ 1];
u32x t2[4]; ctx->opad.w0[2] = ctx->ipad.h[ 2];
u32x t3[4]; ctx->opad.w0[3] = ctx->ipad.h[ 3];
ctx->opad.w1[0] = ctx->ipad.h[ 4];
ctx->opad.w1[1] = ctx->ipad.h[ 5];
ctx->opad.w1[2] = ctx->ipad.h[ 6];
ctx->opad.w1[3] = ctx->ipad.h[ 7];
ctx->opad.w2[0] = ctx->ipad.h[ 8];
ctx->opad.w2[1] = ctx->ipad.h[ 9];
ctx->opad.w2[2] = ctx->ipad.h[10];
ctx->opad.w2[3] = ctx->ipad.h[11];
ctx->opad.w3[0] = ctx->ipad.h[12];
ctx->opad.w3[1] = ctx->ipad.h[13];
ctx->opad.w3[2] = ctx->ipad.h[14];
ctx->opad.w3[3] = ctx->ipad.h[15];
t0[0] = ctx->ipad.h[ 0]; ctx->opad.len += 64;
t0[1] = ctx->ipad.h[ 1];
t0[2] = ctx->ipad.h[ 2];
t0[3] = ctx->ipad.h[ 3];
t1[0] = ctx->ipad.h[ 4];
t1[1] = ctx->ipad.h[ 5];
t1[2] = ctx->ipad.h[ 6];
t1[3] = ctx->ipad.h[ 7];
t2[0] = ctx->ipad.h[ 8];
t2[1] = ctx->ipad.h[ 9];
t2[2] = ctx->ipad.h[10];
t2[3] = ctx->ipad.h[11];
t3[0] = ctx->ipad.h[12];
t3[1] = ctx->ipad.h[13];
t3[2] = ctx->ipad.h[14];
t3[3] = ctx->ipad.h[15];
whirlpool_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64); whirlpool_transform_vector (ctx->opad.w0, ctx->opad.w1, ctx->opad.w2, ctx->opad.w3, ctx->opad.h, ctx->opad.s_Ch, ctx->opad.s_Cl);
ctx->opad.w0[0] = 0;
ctx->opad.w0[1] = 0;
ctx->opad.w0[2] = 0;
ctx->opad.w0[3] = 0;
ctx->opad.w1[0] = 0;
ctx->opad.w1[1] = 0;
ctx->opad.w1[2] = 0;
ctx->opad.w1[3] = 0;
ctx->opad.w2[0] = 0;
ctx->opad.w2[1] = 0;
ctx->opad.w2[2] = 0;
ctx->opad.w2[3] = 0;
ctx->opad.w3[0] = 0;
ctx->opad.w3[1] = 0;
ctx->opad.w3[2] = 0;
ctx->opad.w3[3] = 0;
whirlpool_final_vector (&ctx->opad); whirlpool_final_vector (&ctx->opad);
} }