summaryrefslogtreecommitdiffstats
path: root/old/botan/build/botan/dh_op.h
diff options
context:
space:
mode:
Diffstat (limited to 'old/botan/build/botan/dh_op.h')
-rw-r--r--old/botan/build/botan/dh_op.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/old/botan/build/botan/dh_op.h b/old/botan/build/botan/dh_op.h
new file mode 100644
index 0000000..50f3d78
--- /dev/null
+++ b/old/botan/build/botan/dh_op.h
@@ -0,0 +1,45 @@
+/*
+* DH Operations
+* (C) 1999-2008 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#ifndef BOTAN_DH_OPS_H__
+#define BOTAN_DH_OPS_H__
+
+#include <botan/dl_group.h>
+#include <botan/reducer.h>
+#include <botan/pow_mod.h>
+
+namespace Botan {
+
+/*
+* DH Operation Interface
+*/
+class BOTAN_DLL DH_Operation
+ {
+ public:
+ virtual BigInt agree(const BigInt&) const = 0;
+ virtual DH_Operation* clone() const = 0;
+ virtual ~DH_Operation() {}
+ };
+
+/*
+* Botan's Default DH Operation
+*/
+class BOTAN_DLL 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:
+ Fixed_Exponent_Power_Mod powermod_x_p;
+ };
+
+}
+
+#endif