aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/crypto/blake2s.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-12-26 15:45:12 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2016-12-26 15:45:12 +0100
commit9eadd2955df88f1c7392366ae12b1f7fd867a0ef (patch)
tree67d3eab6918128cc5ba5b86a8c023aa01d9113c0 /src/crypto/blake2s.c
parentcookie: optimize (diff)
downloadwireguard-monolithic-historical-9eadd2955df88f1c7392366ae12b1f7fd867a0ef.tar.xz
wireguard-monolithic-historical-9eadd2955df88f1c7392366ae12b1f7fd867a0ef.zip
blake2s: cleanup
Diffstat (limited to 'src/crypto/blake2s.c')
-rw-r--r--src/crypto/blake2s.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/crypto/blake2s.c b/src/crypto/blake2s.c
index 0d3281e..32b1bc3 100644
--- a/src/crypto/blake2s.c
+++ b/src/crypto/blake2s.c
@@ -58,8 +58,6 @@ static inline void blake2s_increment_counter(struct blake2s_state *state, const
state->t[1] += (state->t[0] < inc);
}
-/* init2 xors IV with input parameter block */
-__attribute__((optimize("unroll-loops")))
static inline void blake2s_init_param(struct blake2s_state *state, const blake2s_param *param)
{
const u32 *p;
@@ -106,7 +104,6 @@ void blake2s_init_key(struct blake2s_state *state, const u8 outlen, const void *
memzero_explicit(block, BLAKE2S_BLOCKBYTES);
}
-__attribute__((optimize("unroll-loops")))
static inline void blake2s_compress(struct blake2s_state *state, const u8 block[BLAKE2S_BLOCKBYTES])
{
u32 m[16];
@@ -129,13 +126,13 @@ static inline void blake2s_compress(struct blake2s_state *state, const u8 block[
v[15] = state->f[1] ^ blake2s_iv[7];
#define G(r,i,a,b,c,d) \
do { \
- a = a + b + m[blake2s_sigma[r][2 * i + 0]]; \
+ a += b + m[blake2s_sigma[r][2 * i + 0]]; \
d = ror32(d ^ a, 16); \
- c = c + d; \
+ c += d; \
b = ror32(b ^ c, 12); \
- a = a + b + m[blake2s_sigma[r][2 * i + 1]]; \
+ a += b + m[blake2s_sigma[r][2 * i + 1]]; \
d = ror32(d ^ a, 8); \
- c = c + d; \
+ c += d; \
b = ror32(b ^ c, 7); \
} while(0)
#define ROUND(r) \
@@ -191,7 +188,6 @@ void blake2s_update(struct blake2s_state *state, const u8 *in, u64 inlen)
}
}
-__attribute__((optimize("unroll-loops")))
void blake2s_final(struct blake2s_state *state, u8 *out, u8 outlen)
{
u8 buffer[BLAKE2S_OUTBYTES] = { 0 };
@@ -240,7 +236,6 @@ void blake2s(u8 *out, const u8 *in, const u8 *key, const u8 outlen, u64 inlen, c
blake2s_final(&state, out, outlen);
}
-__attribute__((optimize("unroll-loops")))
void blake2s_hmac(u8 *out, const u8 *in, const u8 *key, const u8 outlen, const u64 inlen, const u64 keylen)
{
struct blake2s_state state;