aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/crypto/zinc
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-09-27 05:07:28 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-10-02 03:41:49 +0200
commit2f6995456ea8019ed7124578feeb1b5738978d5a (patch)
treeb68ba40a00dfa3827ab14d87095a26c62a6a9f71 /src/crypto/zinc
parentblake2s: feed fpu functions PAGE_SIZE at a time (diff)
downloadwireguard-monolithic-historical-2f6995456ea8019ed7124578feeb1b5738978d5a.tar.xz
wireguard-monolithic-historical-2f6995456ea8019ed7124578feeb1b5738978d5a.zip
blake2s: rename arch function and use slicker le32 helper
Diffstat (limited to 'src/crypto/zinc')
-rw-r--r--src/crypto/zinc/blake2s/blake2s-x86_64-glue.h5
-rw-r--r--src/crypto/zinc/blake2s/blake2s.c14
2 files changed, 8 insertions, 11 deletions
diff --git a/src/crypto/zinc/blake2s/blake2s-x86_64-glue.h b/src/crypto/zinc/blake2s/blake2s-x86_64-glue.h
index 83d56e9..1f331cb 100644
--- a/src/crypto/zinc/blake2s/blake2s-x86_64-glue.h
+++ b/src/crypto/zinc/blake2s/blake2s-x86_64-glue.h
@@ -34,8 +34,9 @@ static void __init blake2s_fpu_init(void)
#endif
}
-static inline bool blake2s_arch(struct blake2s_state *state, const u8 *block,
- size_t nblocks, const u32 inc)
+static inline bool blake2s_compress_arch(struct blake2s_state *state,
+ const u8 *block, size_t nblocks,
+ const u32 inc)
{
simd_context_t simd_context;
diff --git a/src/crypto/zinc/blake2s/blake2s.c b/src/crypto/zinc/blake2s/blake2s.c
index bd7146b..8e22824 100644
--- a/src/crypto/zinc/blake2s/blake2s.c
+++ b/src/crypto/zinc/blake2s/blake2s.c
@@ -120,8 +120,9 @@ static void __init blake2s_fpu_init(void)
{
}
-static inline bool blake2s_arch(struct blake2s_state *state, const u8 *block,
- const size_t nblocks, const u32 inc)
+static inline bool blake2s_compress_arch(struct blake2s_state *state,
+ const u8 *block, size_t nblocks,
+ const u32 inc)
{
return false;
}
@@ -139,18 +140,13 @@ static inline void blake2s_compress(struct blake2s_state *state,
BUG_ON(nblocks > 1 && inc != BLAKE2S_BLOCK_SIZE);
#endif
- if (blake2s_arch(state, block, nblocks, inc))
+ if (blake2s_compress_arch(state, block, nblocks, inc))
return;
while (nblocks > 0) {
blake2s_increment_counter(state, inc);
-
-#ifdef __LITTLE_ENDIAN
memcpy(m, block, BLAKE2S_BLOCK_SIZE);
-#else
- for (i = 0; i < 16; ++i)
- m[i] = get_unaligned_le32(block + i * sizeof(m[i]));
-#endif
+ le32_to_cpu_array(m, ARRAY_SIZE(m));
memcpy(v, state->h, 32);
v[ 8] = blake2s_iv[0];
v[ 9] = blake2s_iv[1];