aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcryptobox
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-14 19:56:22 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-14 19:56:22 +0000
commit77cb03664e09fe19ad455cb69f757f1e46f62032 (patch)
treeec428e2c585f1737dee10de31f78afa9e7f21677 /src/libcryptobox
parentbf4709966a18cb77664afc0fa418591c4271d1f4 (diff)
downloadrspamd-77cb03664e09fe19ad455cb69f757f1e46f62032.tar.gz
rspamd-77cb03664e09fe19ad455cb69f757f1e46f62032.zip
Use __get_cpuid if available.
Diffstat (limited to 'src/libcryptobox')
-rw-r--r--src/libcryptobox/cryptobox.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libcryptobox/cryptobox.c b/src/libcryptobox/cryptobox.c
index d115f79c6..8674867d6 100644
--- a/src/libcryptobox/cryptobox.c
+++ b/src/libcryptobox/cryptobox.c
@@ -27,6 +27,9 @@
#include "poly1305/poly1305.h"
#include "curve25519/curve25519.h"
#include "ottery.h"
+#ifdef HAVE_CPUID_H
+#include <cpuid.h>
+#endif
unsigned long cpu_config = 0;
@@ -66,6 +69,9 @@ static void
rspamd_cryptobox_cpuid (gint cpu[4], gint info)
{
#if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
+# if defined(HAVE_GET_CPUID)
+ __get_cpuid (info, &cpu[0], &cpu[1], &cpu[2], &cpu[3]);
+# else
__asm__ __volatile__ (
"cpuid":
"=a" (cpu[0]),
@@ -74,6 +80,7 @@ rspamd_cryptobox_cpuid (gint cpu[4], gint info)
"=d" (cpu[3]) :
"a" (info), "c" (0)
);
+# endif
#else
memset (cpu, 0, sizeof (cpu));
#endif