summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-06-29 23:15:30 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2016-06-29 23:15:30 +0200
commit49668ee002a779a814c56defd8436a91424649ab (patch)
tree03805764cc595f770f203b1e94a48a080d0cf4af
parent5a137558a6c1e1d7d00dc534534cb4d0d960bab7 (diff)
chacha20poly1305: use more standard way of testing FPU features
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--src/crypto/chacha20poly1305.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/crypto/chacha20poly1305.c b/src/crypto/chacha20poly1305.c
index e4d2e0a..9f21060 100644
--- a/src/crypto/chacha20poly1305.c
+++ b/src/crypto/chacha20poly1305.c
@@ -37,14 +37,9 @@ static bool chacha20poly1305_use_ssse3 = false;
static bool chacha20poly1305_use_sse2 = false;
void chacha20poly1305_init(void)
{
- chacha20poly1305_use_sse2 = cpu_has_xmm2;
+ chacha20poly1305_use_sse2 = boot_cpu_has(X86_FEATURE_XMM2);
chacha20poly1305_use_ssse3 = boot_cpu_has(X86_FEATURE_SSSE3);
- chacha20poly1305_use_avx2 = cpu_has_avx && cpu_has_avx2 &&
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)
- cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL);
-#else
- cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, NULL);
-#endif
+ chacha20poly1305_use_avx2 = boot_cpu_has(X86_FEATURE_AVX2);
}
#else
void chacha20poly1305_init(void) { }