summaryrefslogtreecommitdiffstats
path: root/old/botan/src/pubkey/if_algo/if_op.h
diff options
context:
space:
mode:
Diffstat (limited to 'old/botan/src/pubkey/if_algo/if_op.h')
-rw-r--r--old/botan/src/pubkey/if_algo/if_op.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/old/botan/src/pubkey/if_algo/if_op.h b/old/botan/src/pubkey/if_algo/if_op.h
new file mode 100644
index 0000000..516902f
--- /dev/null
+++ b/old/botan/src/pubkey/if_algo/if_op.h
@@ -0,0 +1,52 @@
+/*
+* IF Operations
+* (C) 1999-2008 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#ifndef BOTAN_IF_OP_H__
+#define BOTAN_IF_OP_H__
+
+#include <botan/bigint.h>
+#include <botan/pow_mod.h>
+#include <botan/reducer.h>
+
+namespace Botan {
+
+/*
+* IF Operation
+*/
+class BOTAN_DLL IF_Operation
+ {
+ public:
+ virtual BigInt public_op(const BigInt&) const = 0;
+ virtual BigInt private_op(const BigInt&) const = 0;
+ virtual IF_Operation* clone() const = 0;
+ virtual ~IF_Operation() {}
+ };
+
+/*
+* Default IF Operation
+*/
+class BOTAN_DLL 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