aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate/def_powm.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-10-26 02:18:05 +0000
committerlloyd <[email protected]>2008-10-26 02:18:05 +0000
commit17231ebbb95cc45cca50eabc4799c3058fc78ee9 (patch)
tree72b419fcd6a398463ccd0f763dc8bc639ab88b5c /src/libstate/def_powm.cpp
parent6f2a68c40d85026da907c8ce5366998f14a99d9c (diff)
Move libstate and selftest out of core/ dir to toplevel
Diffstat (limited to 'src/libstate/def_powm.cpp')
-rw-r--r--src/libstate/def_powm.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libstate/def_powm.cpp b/src/libstate/def_powm.cpp
new file mode 100644
index 000000000..a28438f5b
--- /dev/null
+++ b/src/libstate/def_powm.cpp
@@ -0,0 +1,22 @@
+/*************************************************
+* Modular Exponentiation Source File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#include <botan/eng_def.h>
+#include <botan/def_powm.h>
+
+namespace Botan {
+
+/*************************************************
+* Choose a modular exponentation algorithm *
+*************************************************/
+Modular_Exponentiator*
+Default_Engine::mod_exp(const BigInt& n, Power_Mod::Usage_Hints hints) const
+ {
+ if(n.is_odd())
+ return new Montgomery_Exponentiator(n, hints);
+ return new Fixed_Window_Exponentiator(n, hints);
+ }
+
+}