diff options
author | lloyd <[email protected]> | 2010-03-05 17:46:37 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-05 17:46:37 +0000 |
commit | c80b4df255c2dc1e4a2e100e62469e3c0f1d38a8 (patch) | |
tree | 737ac5a23f4b2df9d4a8906a0407d33043a15fde /src/math/numbertheory/pow_mod.cpp | |
parent | be9d7d1031bba2cd4f415d114389a1f50c61d44b (diff) |
Inline Engine_Core::mod_exp into singler caller, and delete
Diffstat (limited to 'src/math/numbertheory/pow_mod.cpp')
-rw-r--r-- | src/math/numbertheory/pow_mod.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/math/numbertheory/pow_mod.cpp b/src/math/numbertheory/pow_mod.cpp index 8d6bac699..e98364fea 100644 --- a/src/math/numbertheory/pow_mod.cpp +++ b/src/math/numbertheory/pow_mod.cpp @@ -6,7 +6,8 @@ */ #include <botan/pow_mod.h> -#include <botan/internal/pk_engine.h> +#include <botan/libstate.h> +#include <botan/engine.h> namespace Botan { @@ -55,7 +56,23 @@ Power_Mod::~Power_Mod() void Power_Mod::set_modulus(const BigInt& n, Usage_Hints hints) const { delete core; - core = ((n == 0) ? 0 : Engine_Core::mod_exp(n, hints)); + core = 0; + + if(n != 0) + { + Algorithm_Factory::Engine_Iterator i(global_state().algorithm_factory()); + + while(const Engine* engine = i.next()) + { + core = engine->mod_exp(n, hints); + + if(core) + break; + } + + if(!core) + throw Lookup_Error("Power_Mod: Unable to find a working engine"); + } } /* |