summaryrefslogtreecommitdiff
path: root/src/_fastmath.c
diff options
context:
space:
mode:
authorDwayne C. Litzenberger <dlitz@dlitz.net>2011-10-10 19:14:30 -0400
committerDwayne C. Litzenberger <dlitz@dlitz.net>2011-10-10 19:15:50 -0400
commit323ce9ef951378dc96ce14c9e514e9aa19ab39d9 (patch)
tree5986ee1d95f37cdb4605b5b4899667747ae40dfc /src/_fastmath.c
parent32114297da2450af00c4612596bc15da4f6256f2 (diff)
downloadpycrypto-323ce9ef951378dc96ce14c9e514e9aa19ab39d9.tar.gz
Fix libgmp/libmpir autodetection
Diffstat (limited to 'src/_fastmath.c')
-rw-r--r--src/_fastmath.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/_fastmath.c b/src/_fastmath.c
index f8e6f6a..eff3e29 100644
--- a/src/_fastmath.c
+++ b/src/_fastmath.c
@@ -31,15 +31,21 @@
#include "Python.h"
#include "pycrypto_compat.h"
#include <longintrepr.h> /* for conversions */
-#include <gmp.h>
#include "config.h"
+#if HAVE_LIBGMP
+# include <gmp.h>
+#elif HAVE_LIBMPIR
+# include <mpir.h>
+#else
+# error "Neither HAVE_LIBGMP nor HAVE_LIBMPIR are set. Can't build."
+#endif
/* If available, use mpz_powm_sec to avoid timing attacks.
* See the talk by Geremy Condra -
* "PyCon 2011: Through the Side Channel: Timing and Implementation Attacks in Python"
* http://blip.tv/pycon-us-videos-2009-2010-2011/pycon-2011-through-the-side-channel-timing-and-implementation-attacks-in-python-4897955
*/
-#if HAVE_DECL_MPZ_POWM_SEC == 1
+#if HAVE_DECL_MPZ_POWM_SEC
#define MPZ_POWM mpz_powm_sec
#else
#define MPZ_POWM mpz_powm