aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine/def_engine/def_powm.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-11-08 20:58:33 +0000
committerlloyd <[email protected]>2008-11-08 20:58:33 +0000
commitbee2ca1cd5c59318d95d9363d82632aee253b913 (patch)
tree125a31fdccf62cf6a0fef72509384f4223f35374 /src/engine/def_engine/def_powm.cpp
parentde0e6d06a2efa362f9803be6ca5a3535c043ebc8 (diff)
Move most of the Default_Engine code into engine/def_engine, and the
engine base classes into src/engine
Diffstat (limited to 'src/engine/def_engine/def_powm.cpp')
-rw-r--r--src/engine/def_engine/def_powm.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/engine/def_engine/def_powm.cpp b/src/engine/def_engine/def_powm.cpp
new file mode 100644
index 000000000..a28438f5b
--- /dev/null
+++ b/src/engine/def_engine/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);
+ }
+
+}