summaryrefslogtreecommitdiffstats
path: root/botan/src/engine/def_engine/def_powm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'botan/src/engine/def_engine/def_powm.cpp')
-rw-r--r--botan/src/engine/def_engine/def_powm.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/botan/src/engine/def_engine/def_powm.cpp b/botan/src/engine/def_engine/def_powm.cpp
new file mode 100644
index 0000000..9e7a88a
--- /dev/null
+++ b/botan/src/engine/def_engine/def_powm.cpp
@@ -0,0 +1,24 @@
+/*
+* Modular Exponentiation
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#include <botan/def_eng.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);
+ }
+
+}