aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcryptobox/cryptobox.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcryptobox/cryptobox.c')
-rw-r--r--src/libcryptobox/cryptobox.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/libcryptobox/cryptobox.c b/src/libcryptobox/cryptobox.c
index ecc3b5cfc..b99368c5a 100644
--- a/src/libcryptobox/cryptobox.c
+++ b/src/libcryptobox/cryptobox.c
@@ -90,20 +90,24 @@ rspamd_cryptobox_init (void)
rspamd_cryptobox_cpuid (cpu, 1);
if (nid > 1) {
- if ((cpu[3] & ((gint)1 << 26))) {
- cpu_config |= CPUID_SSE2;
- }
- if ((cpu[2] & ((gint)1 << 28))) {
- cpu_config |= CPUID_AVX;
- }
- }
- if (nid > 7) {
- rspamd_cryptobox_cpuid (cpu, 7);
- if ((cpu[1] & ((gint)1 << 5))) {
- cpu_config |= CPUID_AVX2;
+ /* Check OSXSAVE bit first of all */
+ if ((cpu[2] & ((gint)1 << 9))) {
+ if ((cpu[3] & ((gint)1 << 26))) {
+ cpu_config |= CPUID_SSE2;
+ }
+ if ((cpu[2] & ((gint)1 << 28))) {
+ cpu_config |= CPUID_AVX;
+ }
+ if (nid > 7) {
+ rspamd_cryptobox_cpuid (cpu, 7);
+ if ((cpu[1] & ((gint)1 << 5))) {
+ cpu_config |= CPUID_AVX2;
+ }
+ }
}
}
+
chacha_load ();
poly1305_load ();
}