aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/crypto/chacha20.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-08-06 18:31:18 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-08-06 19:25:29 +0200
commit5856479cdaf7e87f2bc46881246607ec3b887dae (patch)
treebfff84bd6d34cfefa014681629b55a5081d0ed54 /src/crypto/chacha20.c
parentcompat: better atomic acquire/release backport (diff)
downloadwireguard-monolithic-historical-5856479cdaf7e87f2bc46881246607ec3b887dae.tar.xz
wireguard-monolithic-historical-5856479cdaf7e87f2bc46881246607ec3b887dae.zip
crypto: move simd context to specific type
Suggested-by: Andy Lutomirski <luto@kernel.org>
Diffstat (limited to 'src/crypto/chacha20.c')
-rw-r--r--src/crypto/chacha20.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/crypto/chacha20.c b/src/crypto/chacha20.c
index a65ec8b..29f7e6b 100644
--- a/src/crypto/chacha20.c
+++ b/src/crypto/chacha20.c
@@ -151,9 +151,9 @@ static void chacha20_generic(u8 *out, const u8 *in, u32 len, const u32 key[8], c
}
}
-void chacha20(struct chacha20_ctx *state, u8 *dst, const u8 *src, u32 len, bool have_simd)
+void chacha20(struct chacha20_ctx *state, u8 *dst, const u8 *src, u32 len, simd_context_t simd_context)
{
- if (!have_simd
+ if (simd_context != HAVE_FULL_SIMD
#if defined(CONFIG_X86_64)
|| !chacha20_use_ssse3
@@ -227,10 +227,10 @@ static void hchacha20_generic(u8 derived_key[CHACHA20_KEY_SIZE], const u8 nonce[
out[7] = cpu_to_le32(x[15]);
}
-void hchacha20(u8 derived_key[CHACHA20_KEY_SIZE], const u8 nonce[HCHACHA20_NONCE_SIZE], const u8 key[HCHACHA20_KEY_SIZE], bool have_simd)
+void hchacha20(u8 derived_key[CHACHA20_KEY_SIZE], const u8 nonce[HCHACHA20_NONCE_SIZE], const u8 key[HCHACHA20_KEY_SIZE], simd_context_t simd_context)
{
#if defined(CONFIG_X86_64) && defined(CONFIG_AS_SSSE3)
- if (have_simd && chacha20_use_ssse3) {
+ if (simd_context == HAVE_FULL_SIMD && chacha20_use_ssse3) {
hchacha20_ssse3(derived_key, nonce, key);
return;
}