aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/def_powm.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-09-30 21:13:38 +0000
committerlloyd <[email protected]>2008-09-30 21:13:38 +0000
commit3f0d484096e1e782f72e3cdf43853c7d9f309ee9 (patch)
tree341f05d66128321304aafc72df28854650e13ef1 /src/core/def_powm.cpp
parentb8115f4123a55510ab4f4840efb623de662a248f (diff)
parenta2c9be1a6bf801aac4d6d32759d51608f536d14a (diff)
propagate from branch 'net.randombit.botan' (head 9524e848cdacd0b56ded9bd6b51fd34b6a7d3fc4)
to branch 'net.randombit.botan.ecdsa' (head 8231f4285dce2d5ec754f7afa72e0d34807de061)
Diffstat (limited to 'src/core/def_powm.cpp')
-rw-r--r--src/core/def_powm.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/core/def_powm.cpp b/src/core/def_powm.cpp
new file mode 100644
index 000000000..a28438f5b
--- /dev/null
+++ b/src/core/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);
+ }
+
+}