summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Ramacher <sebastian+dev@ramacher.at>2013-11-06 17:24:19 +0100
committerDwayne Litzenberger <dlitz@dlitz.net>2014-06-22 17:26:16 -0700
commit2549c4dc2d47309a7635b85341e8450ce3eab9c6 (patch)
tree62d8b423d01285b57e407d00893fbd4f0d03f81e
parent8dcd95ed3ce3bcf799c2da66d9650ba24e875763 (diff)
downloadpycrypto-2549c4dc2d47309a7635b85341e8450ce3eab9c6.tar.gz
Workaround missing bit_AES defines
clang provides the same constant as bit_AESNI in some versions, and doesn't provide it at all in others. Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
-rw-r--r--src/cpuid.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/cpuid.c b/src/cpuid.c
index 5b4b405..46ece7d 100644
--- a/src/cpuid.c
+++ b/src/cpuid.c
@@ -24,8 +24,21 @@
#include "Python.h"
#include <stdint.h>
#include "config.h"
+
#ifdef HAVE_CPUID_H
#include <cpuid.h>
+
+/* it's bit_AES with gcc */
+#ifndef bit_AES
+/* but some versions of clang provide bit_AESNI instead */
+#ifdef bit_AESNI
+#define bit_AES bit_AESNI
+/* and others do not provide any define at all */
+#else
+#define bit_AES 0x02000000
+#endif
+#endif
+
#endif
#include "pycrypto_compat.h"