aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorSamuel Neves <sneves@dei.uc.pt>2017-11-22 21:00:17 +0000
committerJason A. Donenfeld <Jason@zx2c4.com>2017-11-22 22:55:50 +0100
commitc88b76aa81a33b7daef5f70ed06533e8a14a0598 (patch)
treed69b7ef5da4c659c6914fc867431cd3a86a956aa
parentcompat: support timespec64 on old kernels (diff)
downloadwireguard-monolithic-historical-c88b76aa81a33b7daef5f70ed06533e8a14a0598.tar.xz
wireguard-monolithic-historical-c88b76aa81a33b7daef5f70ed06533e8a14a0598.zip
poly1305-avx512: requires AVX512F+VL+BW
Signed-off-by: Samuel Neves <sneves@dei.uc.pt>
-rw-r--r--src/crypto/chacha20poly1305.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/crypto/chacha20poly1305.c b/src/crypto/chacha20poly1305.c
index 1de7a84..d419981 100644
--- a/src/crypto/chacha20poly1305.c
+++ b/src/crypto/chacha20poly1305.c
@@ -74,7 +74,12 @@ void __init chacha20poly1305_fpu_init(void)
chacha20poly1305_use_avx = boot_cpu_has(X86_FEATURE_AVX) && cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL);
chacha20poly1305_use_avx2 = boot_cpu_has(X86_FEATURE_AVX) && boot_cpu_has(X86_FEATURE_AVX2) && cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL);
#ifndef COMPAT_CANNOT_USE_AVX512
- chacha20poly1305_use_avx512 = boot_cpu_has(X86_FEATURE_AVX) && boot_cpu_has(X86_FEATURE_AVX2) && boot_cpu_has(X86_FEATURE_AVX512F) && cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM | XFEATURE_MASK_ZMM_Hi256, NULL);
+ /* ChaCha20 only needs AVX512F, but Poly1305 needs F+VL+BW. Since
+ * there's no hardware that actually supports one and not the other,
+ * we keep this as one flag. But should bizarre hardware ever be
+ * produced, we'll want to separate these out.
+ */
+ chacha20poly1305_use_avx512 = boot_cpu_has(X86_FEATURE_AVX) && boot_cpu_has(X86_FEATURE_AVX2) && boot_cpu_has(X86_FEATURE_AVX512F) && boot_cpu_has(X86_FEATURE_AVX512VL) && boot_cpu_has(X86_FEATURE_AVX512BW) && cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM | XFEATURE_MASK_ZMM_Hi256, NULL);
#endif
}
#elif defined(CONFIG_ARM) || defined(CONFIG_ARM64)