diff options
author | lloyd <[email protected]> | 2008-11-08 21:30:31 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-11-08 21:30:31 +0000 |
commit | 28901d2b99d6b9066cfdff6329d26fb975c52809 (patch) | |
tree | 5a9f3f93004d4aa40013b5cafe25069e12fc8cb6 /src/pubkey/if_algo | |
parent | ce8c2d27fced15e87829852231d00c197f42bc20 (diff) |
Remove dependency on Default_Engine from pubkey code
Diffstat (limited to 'src/pubkey/if_algo')
-rw-r--r-- | src/pubkey/if_algo/if_op.cpp | 40 | ||||
-rw-r--r-- | src/pubkey/if_algo/if_op.h | 23 |
2 files changed, 24 insertions, 39 deletions
diff --git a/src/pubkey/if_algo/if_op.cpp b/src/pubkey/if_algo/if_op.cpp index 0b151bf3b..242911a2e 100644 --- a/src/pubkey/if_algo/if_op.cpp +++ b/src/pubkey/if_algo/if_op.cpp @@ -3,36 +3,11 @@ * (C) 1999-2007 Jack Lloyd * *************************************************/ -#include <botan/eng_def.h> -#include <botan/pow_mod.h> +#include <botan/if_op.h> #include <botan/numthry.h> -#include <botan/reducer.h> namespace Botan { -namespace { - -/************************************************* -* Default IF Operation * -*************************************************/ -class Default_IF_Op : public IF_Operation - { - public: - BigInt public_op(const BigInt& i) const - { return powermod_e_n(i); } - BigInt private_op(const BigInt&) const; - - IF_Operation* clone() const { return new Default_IF_Op(*this); } - - Default_IF_Op(const BigInt&, const BigInt&, const BigInt&, - const BigInt&, const BigInt&, const BigInt&, - const BigInt&, const BigInt&); - private: - Fixed_Exponent_Power_Mod powermod_e_n, powermod_d1_p, powermod_d2_q; - Modular_Reducer reducer; - BigInt c, q; - }; - /************************************************* * Default_IF_Op Constructor * *************************************************/ @@ -68,16 +43,3 @@ BigInt Default_IF_Op::private_op(const BigInt& i) const } } - -/************************************************* -* Acquire an IF op * -*************************************************/ -IF_Operation* Default_Engine::if_op(const BigInt& e, const BigInt& n, - const BigInt& d, const BigInt& p, - const BigInt& q, const BigInt& d1, - const BigInt& d2, const BigInt& c) const - { - return new Default_IF_Op(e, n, d, p, q, d1, d2, c); - } - -} diff --git a/src/pubkey/if_algo/if_op.h b/src/pubkey/if_algo/if_op.h index be9a4581c..c5ef350d2 100644 --- a/src/pubkey/if_algo/if_op.h +++ b/src/pubkey/if_algo/if_op.h @@ -7,6 +7,8 @@ #define BOTAN_IF_OP_H__ #include <botan/bigint.h> +#include <botan/pow_mod.h> +#include <botan/reducer.h> namespace Botan { @@ -22,6 +24,27 @@ class BOTAN_DLL IF_Operation virtual ~IF_Operation() {} }; +/************************************************* +* Default IF Operation * +*************************************************/ +class Default_IF_Op : public IF_Operation + { + public: + BigInt public_op(const BigInt& i) const + { return powermod_e_n(i); } + BigInt private_op(const BigInt&) const; + + IF_Operation* clone() const { return new Default_IF_Op(*this); } + + Default_IF_Op(const BigInt&, const BigInt&, const BigInt&, + const BigInt&, const BigInt&, const BigInt&, + const BigInt&, const BigInt&); + private: + Fixed_Exponent_Power_Mod powermod_e_n, powermod_d1_p, powermod_d2_q; + Modular_Reducer reducer; + BigInt c, q; + }; + } #endif |