aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcryptobox/cryptobox.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-09 09:53:15 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-09 09:53:15 +0000
commit36193952d085c70eee36444a300eb3111ee9e22e (patch)
tree2ff07559420554aafc9dcdbb54f3a3dc84a98bba /src/libcryptobox/cryptobox.c
parentcf48651a586578019898a83ac5229339d142d782 (diff)
downloadrspamd-36193952d085c70eee36444a300eb3111ee9e22e.tar.gz
rspamd-36193952d085c70eee36444a300eb3111ee9e22e.zip
Check OSXSAVE flag.
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 ();
}