aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-05 21:24:35 +0000
committerlloyd <[email protected]>2010-03-05 21:24:35 +0000
commit3900bd1e5a9974eea4faee4a8159380ea67c6251 (patch)
treeee079b17d4531a730da3ef1e57c729de6412f3d0 /src
parent6b39750947767194af6503a79fe699527e499796 (diff)
On GMP 5.0 and later, use mpz_powm_sec, which is a version of modular
exponentiation that has countermeasures against side-channel attacks.
Diffstat (limited to 'src')
-rw-r--r--src/engine/gnump/gnump_pk.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/engine/gnump/gnump_pk.cpp b/src/engine/gnump/gnump_pk.cpp
index f26500dd5..3ca1f25ff 100644
--- a/src/engine/gnump/gnump_pk.cpp
+++ b/src/engine/gnump/gnump_pk.cpp
@@ -9,6 +9,12 @@
#include <botan/internal/gmp_wrap.h>
#include <gmp.h>
+/* GnuMP 5.0 and later have a side-channel resistent powm */
+#if defined(HAVE_MPZ_POWM_SEC)
+ #undef mpz_powm
+ #define mpz_powm mpz_powm_sec
+#endif
+
#if defined(BOTAN_HAS_RSA)
#include <botan/rsa.h>
#endif