]> source.dussan.org Git - rspamd.git/commitdiff
Check OSXSAVE flag.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 9 Feb 2015 09:53:15 +0000 (09:53 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 9 Feb 2015 09:53:15 +0000 (09:53 +0000)
src/libcryptobox/cryptobox.c

index ecc3b5cfcf21f4c8c3939fce759e67f6fd1e4c08..b99368c5a1fa4edf925ec81578bd9da80763a27f 100644 (file)
@@ -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 ();
 }