diff options
author | lloyd <[email protected]> | 2008-09-28 18:38:20 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-28 18:38:20 +0000 |
commit | 3dc4f54e780ebb5d92921d48733278412d52e2b0 (patch) | |
tree | 0e5a76b4c2c48c4fd71571ed90848edb1b780a3f /src/dh_op.cpp | |
parent | ed39cde548c5cbff3896dc4c9ab5803d1334dd29 (diff) |
Split def_ops into multiple files. Modularize DLIES
Diffstat (limited to 'src/dh_op.cpp')
-rw-r--r-- | src/dh_op.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/dh_op.cpp b/src/dh_op.cpp new file mode 100644 index 000000000..0bcfd4ef8 --- /dev/null +++ b/src/dh_op.cpp @@ -0,0 +1,41 @@ +/************************************************* +* DH Operations Source File * +* (C) 1999-2007 Jack Lloyd * +*************************************************/ + +#include <botan/eng_def.h> +#include <botan/pow_mod.h> +#include <botan/numthry.h> +#include <botan/reducer.h> + +namespace Botan { + +namespace { + +/************************************************* +* Default DH Operation * +*************************************************/ +class Default_DH_Op : public DH_Operation + { + public: + BigInt agree(const BigInt& i) const { return powermod_x_p(i); } + DH_Operation* clone() const { return new Default_DH_Op(*this); } + + Default_DH_Op(const DL_Group& group, const BigInt& x) : + powermod_x_p(x, group.get_p()) {} + private: + const Fixed_Exponent_Power_Mod powermod_x_p; + }; + +} + +/************************************************* +* Acquire a DH op * +*************************************************/ +DH_Operation* Default_Engine::dh_op(const DL_Group& group, + const BigInt& x) const + { + return new Default_DH_Op(group, x); + } + +} |