aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-10-01 13:54:19 +0000
committerlloyd <[email protected]>2008-10-01 13:54:19 +0000
commit988ed628fb68deb32e8ff54cc1e4eb8d06f53f34 (patch)
tree9ea19bf8eade34332179de38f873050aed4decc3
parentc3cc27653551f2fddebcab66a0220df3d1a2ea66 (diff)
Split pk_core.cpp into algorithm-specific files
-rw-r--r--src/pk/pubkey/dh_core.cpp67
-rw-r--r--src/pk/pubkey/dsa_core.cpp67
-rw-r--r--src/pk/pubkey/ecc_core.cpp95
-rw-r--r--src/pk/pubkey/elg_core.cpp95
-rw-r--r--src/pk/pubkey/if_core.cpp85
-rw-r--r--src/pk/pubkey/info.txt7
-rw-r--r--src/pk/pubkey/nr_core.cpp60
-rw-r--r--src/pk/pubkey/pk_core.cpp381
8 files changed, 475 insertions, 382 deletions
diff --git a/src/pk/pubkey/dh_core.cpp b/src/pk/pubkey/dh_core.cpp
new file mode 100644
index 000000000..c88b387ea
--- /dev/null
+++ b/src/pk/pubkey/dh_core.cpp
@@ -0,0 +1,67 @@
+/*************************************************
+* PK Algorithm Core Source File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#include <botan/pk_core.h>
+#include <botan/numthry.h>
+#include <botan/engine.h>
+#include <botan/parsing.h>
+#include <algorithm>
+
+namespace Botan {
+
+namespace {
+
+const u32bit BLINDING_BITS = BOTAN_PRIVATE_KEY_OP_BLINDING_BITS;
+
+}
+
+/*************************************************
+* DH_Core Constructor *
+*************************************************/
+DH_Core::DH_Core(RandomNumberGenerator& rng,
+ const DL_Group& group, const BigInt& x)
+ {
+ op = Engine_Core::dh_op(group, x);
+
+ const BigInt& p = group.get_p();
+
+ BigInt k(rng, std::min(p.bits()-1, BLINDING_BITS));
+
+ if(k != 0)
+ blinder = Blinder(k, power_mod(inverse_mod(k, p), x, p), p);
+ }
+
+/*************************************************
+* DH_Core Copy Constructor *
+*************************************************/
+DH_Core::DH_Core(const DH_Core& core)
+ {
+ op = 0;
+ if(core.op)
+ op = core.op->clone();
+ blinder = core.blinder;
+ }
+
+/*************************************************
+* DH_Core Assignment Operator *
+*************************************************/
+DH_Core& DH_Core::operator=(const DH_Core& core)
+ {
+ delete op;
+ if(core.op)
+ op = core.op->clone();
+ blinder = core.blinder;
+ return (*this);
+ }
+
+/*************************************************
+* DH Operation *
+*************************************************/
+BigInt DH_Core::agree(const BigInt& i) const
+ {
+ return blinder.unblind(op->agree(blinder.blind(i)));
+ }
+
+}
diff --git a/src/pk/pubkey/dsa_core.cpp b/src/pk/pubkey/dsa_core.cpp
new file mode 100644
index 000000000..373b96d4f
--- /dev/null
+++ b/src/pk/pubkey/dsa_core.cpp
@@ -0,0 +1,67 @@
+/*************************************************
+* DSA Core Source File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#include <botan/pk_core.h>
+#include <botan/numthry.h>
+#include <botan/engine.h>
+#include <botan/parsing.h>
+#include <algorithm>
+
+namespace Botan {
+
+namespace {
+
+const u32bit BLINDING_BITS = BOTAN_PRIVATE_KEY_OP_BLINDING_BITS;
+
+}
+
+/*************************************************
+* DSA_Core Constructor *
+*************************************************/
+DSA_Core::DSA_Core(const DL_Group& group, const BigInt& y, const BigInt& x)
+ {
+ op = Engine_Core::dsa_op(group, y, x);
+ }
+
+/*************************************************
+* DSA_Core Copy Constructor *
+*************************************************/
+DSA_Core::DSA_Core(const DSA_Core& core)
+ {
+ op = 0;
+ if(core.op)
+ op = core.op->clone();
+ }
+
+/*************************************************
+* DSA_Core Assignment Operator *
+*************************************************/
+DSA_Core& DSA_Core::operator=(const DSA_Core& core)
+ {
+ delete op;
+ if(core.op)
+ op = core.op->clone();
+ return (*this);
+ }
+
+/*************************************************
+* DSA Verification Operation *
+*************************************************/
+bool DSA_Core::verify(const byte msg[], u32bit msg_length,
+ const byte sig[], u32bit sig_length) const
+ {
+ return op->verify(msg, msg_length, sig, sig_length);
+ }
+
+/*************************************************
+* DSA Signature Operation *
+*************************************************/
+SecureVector<byte> DSA_Core::sign(const byte in[], u32bit length,
+ const BigInt& k) const
+ {
+ return op->sign(in, length, k);
+ }
+
+}
diff --git a/src/pk/pubkey/ecc_core.cpp b/src/pk/pubkey/ecc_core.cpp
new file mode 100644
index 000000000..c7c734d05
--- /dev/null
+++ b/src/pk/pubkey/ecc_core.cpp
@@ -0,0 +1,95 @@
+/*************************************************
+* ECDSA/ECKAEG Core Source File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#include <botan/pk_core.h>
+#include <botan/numthry.h>
+#include <botan/engine.h>
+#include <botan/parsing.h>
+#include <algorithm>
+
+namespace Botan {
+
+#if defined(BOTAN_HAS_ECDSA)
+
+/*************************************************
+* ECKAEG_Core Constructor *
+*************************************************/
+ECKAEG_Core::ECKAEG_Core(const EC_Domain_Params& dom_pars,
+ const BigInt& priv_key,
+ const PointGFp& pub_key)
+ {
+ op = Engine_Core::eckaeg_op(dom_pars, priv_key, pub_key);
+ }
+
+/*************************************************
+* ECKAEG_Core Copy Constructor *
+*************************************************/
+ECKAEG_Core::ECKAEG_Core(const ECKAEG_Core& core)
+ {
+ op = 0;
+ if(core.op)
+ op = core.op->clone();
+ blinder = core.blinder;
+ }
+
+/*************************************************
+* ECKAEG_Core Assignment Operator *
+*************************************************/
+ECKAEG_Core& ECKAEG_Core::operator=(const ECKAEG_Core& core)
+ {
+ delete op;
+ if(core.op)
+ op = core.op->clone();
+ blinder = core.blinder;
+ return (*this);
+ }
+
+/*************************************************
+* ECKAEG Operation *
+*************************************************/
+SecureVector<byte> ECKAEG_Core::agree(const PointGFp& otherKey) const
+ {
+ //assert(op.get());
+ return op->agree(otherKey);
+ }
+
+/*************************************************
+* ECDSA Operation *
+*************************************************/
+bool ECDSA_Core::verify(const byte signature[], u32bit sig_len,
+ const byte message[], u32bit mess_len) const
+ {
+ //assert(op.get());
+ return op->verify(signature, sig_len, message, mess_len);
+ }
+
+SecureVector<byte> ECDSA_Core::sign(const byte message[], u32bit mess_len) const
+ {
+ //assert(op.get());
+ return op->sign(message, mess_len);
+ }
+
+ECDSA_Core& ECDSA_Core::operator=(const ECDSA_Core& core)
+ {
+ delete op;
+ if(core.op)
+ op = core.op->clone();
+ return (*this);
+ }
+
+ECDSA_Core::ECDSA_Core(const ECDSA_Core& core)
+ {
+ op = 0;
+ if(core.op)
+ op = core.op->clone();
+ }
+
+ECDSA_Core::ECDSA_Core(EC_Domain_Params const& dom_pars, const BigInt& priv_key, PointGFp const& pub_key)
+ {
+ op = Engine_Core::ecdsa_op(dom_pars, priv_key, pub_key);
+ }
+#endif
+
+}
diff --git a/src/pk/pubkey/elg_core.cpp b/src/pk/pubkey/elg_core.cpp
new file mode 100644
index 000000000..d3b74bf41
--- /dev/null
+++ b/src/pk/pubkey/elg_core.cpp
@@ -0,0 +1,95 @@
+/*************************************************
+* ElGamal Core Source File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#include <botan/pk_core.h>
+#include <botan/numthry.h>
+#include <botan/engine.h>
+#include <botan/parsing.h>
+#include <algorithm>
+
+namespace Botan {
+
+namespace {
+
+const u32bit BLINDING_BITS = BOTAN_PRIVATE_KEY_OP_BLINDING_BITS;
+
+}
+
+/*************************************************
+* ELG_Core Constructor *
+*************************************************/
+ELG_Core::ELG_Core(const DL_Group& group, const BigInt& y)
+ {
+ op = Engine_Core::elg_op(group, y, 0);
+ p_bytes = 0;
+ }
+
+/*************************************************
+* ELG_Core Constructor *
+*************************************************/
+ELG_Core::ELG_Core(RandomNumberGenerator& rng,
+ const DL_Group& group, const BigInt& y, const BigInt& x)
+ {
+ op = Engine_Core::elg_op(group, y, x);
+
+ const BigInt& p = group.get_p();
+ p_bytes = p.bytes();
+
+ if(BLINDING_BITS)
+ {
+ BigInt k(rng, std::min(p.bits()-1, BLINDING_BITS));
+ blinder = Blinder(k, power_mod(k, x, p), p);
+ }
+ }
+
+/*************************************************
+* ELG_Core Copy Constructor *
+*************************************************/
+ELG_Core::ELG_Core(const ELG_Core& core)
+ {
+ op = 0;
+ if(core.op)
+ op = core.op->clone();
+ blinder = core.blinder;
+ p_bytes = core.p_bytes;
+ }
+
+/*************************************************
+* ELG_Core Assignment Operator *
+*************************************************/
+ELG_Core& ELG_Core::operator=(const ELG_Core& core)
+ {
+ delete op;
+ if(core.op)
+ op = core.op->clone();
+ blinder = core.blinder;
+ p_bytes = core.p_bytes;
+ return (*this);
+ }
+
+/*************************************************
+* ElGamal Encrypt Operation *
+*************************************************/
+SecureVector<byte> ELG_Core::encrypt(const byte in[], u32bit length,
+ const BigInt& k) const
+ {
+ return op->encrypt(in, length, k);
+ }
+
+/*************************************************
+* ElGamal Decrypt Operation *
+*************************************************/
+SecureVector<byte> ELG_Core::decrypt(const byte in[], u32bit length) const
+ {
+ if(length != 2*p_bytes)
+ throw Invalid_Argument("ELG_Core::decrypt: Invalid message");
+
+ BigInt a(in, p_bytes);
+ BigInt b(in + p_bytes, p_bytes);
+
+ return BigInt::encode(blinder.unblind(op->decrypt(blinder.blind(a), b)));
+ }
+
+}
diff --git a/src/pk/pubkey/if_core.cpp b/src/pk/pubkey/if_core.cpp
new file mode 100644
index 000000000..c0401fb4c
--- /dev/null
+++ b/src/pk/pubkey/if_core.cpp
@@ -0,0 +1,85 @@
+/*************************************************
+* IF Algorithm Core Source File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#include <botan/pk_core.h>
+#include <botan/numthry.h>
+#include <botan/engine.h>
+#include <botan/parsing.h>
+#include <algorithm>
+
+namespace Botan {
+
+namespace {
+
+const u32bit BLINDING_BITS = BOTAN_PRIVATE_KEY_OP_BLINDING_BITS;
+
+}
+
+/*************************************************
+* IF_Core Constructor *
+*************************************************/
+IF_Core::IF_Core(const BigInt& e, const BigInt& n)
+ {
+ op = Engine_Core::if_op(e, n, 0, 0, 0, 0, 0, 0);
+ }
+
+
+/*************************************************
+* IF_Core Constructor *
+*************************************************/
+IF_Core::IF_Core(RandomNumberGenerator& rng,
+ const BigInt& e, const BigInt& n, const BigInt& d,
+ const BigInt& p, const BigInt& q,
+ const BigInt& d1, const BigInt& d2, const BigInt& c)
+ {
+ op = Engine_Core::if_op(e, n, d, p, q, d1, d2, c);
+
+ if(BLINDING_BITS)
+ {
+ BigInt k(rng, std::min(n.bits()-1, BLINDING_BITS));
+ blinder = Blinder(power_mod(k, e, n), inverse_mod(k, n), n);
+ }
+ }
+
+/*************************************************
+* IF_Core Copy Constructor *
+*************************************************/
+IF_Core::IF_Core(const IF_Core& core)
+ {
+ op = 0;
+ if(core.op)
+ op = core.op->clone();
+ blinder = core.blinder;
+ }
+
+/*************************************************
+* IF_Core Assignment Operator *
+*************************************************/
+IF_Core& IF_Core::operator=(const IF_Core& core)
+ {
+ delete op;
+ if(core.op)
+ op = core.op->clone();
+ blinder = core.blinder;
+ return (*this);
+ }
+
+/*************************************************
+* IF Public Operation *
+*************************************************/
+BigInt IF_Core::public_op(const BigInt& i) const
+ {
+ return op->public_op(i);
+ }
+
+/*************************************************
+* IF Private Operation *
+*************************************************/
+BigInt IF_Core::private_op(const BigInt& i) const
+ {
+ return blinder.unblind(op->private_op(blinder.blind(i)));
+ }
+
+}
diff --git a/src/pk/pubkey/info.txt b/src/pk/pubkey/info.txt
index 63ba3ffcb..c740a99ba 100644
--- a/src/pk/pubkey/info.txt
+++ b/src/pk/pubkey/info.txt
@@ -11,13 +11,18 @@ asn1
</requires>
<add>
+dh_core.cpp
dh_op.cpp
+dsa_core.cpp
dsa_op.cpp
+ecc_core.cpp
+elg_core.cpp
elg_op.cpp
+if_core.cpp
+nr_core.cpp
nr_op.cpp
pk_algs.cpp
pk_algs.h
-pk_core.cpp
pk_core.h
pk_keys.cpp
pk_keys.h
diff --git a/src/pk/pubkey/nr_core.cpp b/src/pk/pubkey/nr_core.cpp
new file mode 100644
index 000000000..45056241e
--- /dev/null
+++ b/src/pk/pubkey/nr_core.cpp
@@ -0,0 +1,60 @@
+/*************************************************
+* NR Core Source File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#include <botan/pk_core.h>
+#include <botan/numthry.h>
+#include <botan/engine.h>
+#include <botan/parsing.h>
+#include <algorithm>
+
+namespace Botan {
+
+/*************************************************
+* NR_Core Constructor *
+*************************************************/
+NR_Core::NR_Core(const DL_Group& group, const BigInt& y, const BigInt& x)
+ {
+ op = Engine_Core::nr_op(group, y, x);
+ }
+
+/*************************************************
+* NR_Core Copy Constructor *
+*************************************************/
+NR_Core::NR_Core(const NR_Core& core)
+ {
+ op = 0;
+ if(core.op)
+ op = core.op->clone();
+ }
+
+/*************************************************
+* NR_Core Assignment Operator *
+*************************************************/
+NR_Core& NR_Core::operator=(const NR_Core& core)
+ {
+ delete op;
+ if(core.op)
+ op = core.op->clone();
+ return (*this);
+ }
+
+/*************************************************
+* NR Verification Operation *
+*************************************************/
+SecureVector<byte> NR_Core::verify(const byte in[], u32bit length) const
+ {
+ return op->verify(in, length);
+ }
+
+/*************************************************
+* NR Signature Operation *
+*************************************************/
+SecureVector<byte> NR_Core::sign(const byte in[], u32bit length,
+ const BigInt& k) const
+ {
+ return op->sign(in, length, k);
+ }
+
+}
diff --git a/src/pk/pubkey/pk_core.cpp b/src/pk/pubkey/pk_core.cpp
deleted file mode 100644
index ca976bbee..000000000
--- a/src/pk/pubkey/pk_core.cpp
+++ /dev/null
@@ -1,381 +0,0 @@
-/*************************************************
-* PK Algorithm Core Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#include <botan/pk_core.h>
-#include <botan/numthry.h>
-#include <botan/engine.h>
-#include <botan/parsing.h>
-#include <algorithm>
-
-namespace Botan {
-
-namespace {
-
-const u32bit BLINDING_BITS = BOTAN_PRIVATE_KEY_OP_BLINDING_BITS;
-
-}
-
-/*************************************************
-* IF_Core Constructor *
-*************************************************/
-IF_Core::IF_Core(const BigInt& e, const BigInt& n)
- {
- op = Engine_Core::if_op(e, n, 0, 0, 0, 0, 0, 0);
- }
-
-
-/*************************************************
-* IF_Core Constructor *
-*************************************************/
-IF_Core::IF_Core(RandomNumberGenerator& rng,
- const BigInt& e, const BigInt& n, const BigInt& d,
- const BigInt& p, const BigInt& q,
- const BigInt& d1, const BigInt& d2, const BigInt& c)
- {
- op = Engine_Core::if_op(e, n, d, p, q, d1, d2, c);
-
- if(BLINDING_BITS)
- {
- BigInt k(rng, std::min(n.bits()-1, BLINDING_BITS));
- blinder = Blinder(power_mod(k, e, n), inverse_mod(k, n), n);
- }
- }
-
-/*************************************************
-* IF_Core Copy Constructor *
-*************************************************/
-IF_Core::IF_Core(const IF_Core& core)
- {
- op = 0;
- if(core.op)
- op = core.op->clone();
- blinder = core.blinder;
- }
-
-/*************************************************
-* IF_Core Assignment Operator *
-*************************************************/
-IF_Core& IF_Core::operator=(const IF_Core& core)
- {
- delete op;
- if(core.op)
- op = core.op->clone();
- blinder = core.blinder;
- return (*this);
- }
-
-/*************************************************
-* IF Public Operation *
-*************************************************/
-BigInt IF_Core::public_op(const BigInt& i) const
- {
- return op->public_op(i);
- }
-
-/*************************************************
-* IF Private Operation *
-*************************************************/
-BigInt IF_Core::private_op(const BigInt& i) const
- {
- return blinder.unblind(op->private_op(blinder.blind(i)));
- }
-
-/*************************************************
-* DSA_Core Constructor *
-*************************************************/
-DSA_Core::DSA_Core(const DL_Group& group, const BigInt& y, const BigInt& x)
- {
- op = Engine_Core::dsa_op(group, y, x);
- }
-
-/*************************************************
-* DSA_Core Copy Constructor *
-*************************************************/
-DSA_Core::DSA_Core(const DSA_Core& core)
- {
- op = 0;
- if(core.op)
- op = core.op->clone();
- }
-
-/*************************************************
-* DSA_Core Assignment Operator *
-*************************************************/
-DSA_Core& DSA_Core::operator=(const DSA_Core& core)
- {
- delete op;
- if(core.op)
- op = core.op->clone();
- return (*this);
- }
-
-/*************************************************
-* DSA Verification Operation *
-*************************************************/
-bool DSA_Core::verify(const byte msg[], u32bit msg_length,
- const byte sig[], u32bit sig_length) const
- {
- return op->verify(msg, msg_length, sig, sig_length);
- }
-
-/*************************************************
-* DSA Signature Operation *
-*************************************************/
-SecureVector<byte> DSA_Core::sign(const byte in[], u32bit length,
- const BigInt& k) const
- {
- return op->sign(in, length, k);
- }
-
-/*************************************************
-* NR_Core Constructor *
-*************************************************/
-NR_Core::NR_Core(const DL_Group& group, const BigInt& y, const BigInt& x)
- {
- op = Engine_Core::nr_op(group, y, x);
- }
-
-/*************************************************
-* NR_Core Copy Constructor *
-*************************************************/
-NR_Core::NR_Core(const NR_Core& core)
- {
- op = 0;
- if(core.op)
- op = core.op->clone();
- }
-
-/*************************************************
-* NR_Core Assignment Operator *
-*************************************************/
-NR_Core& NR_Core::operator=(const NR_Core& core)
- {
- delete op;
- if(core.op)
- op = core.op->clone();
- return (*this);
- }
-
-/*************************************************
-* NR Verification Operation *
-*************************************************/
-SecureVector<byte> NR_Core::verify(const byte in[], u32bit length) const
- {
- return op->verify(in, length);
- }
-
-/*************************************************
-* NR Signature Operation *
-*************************************************/
-SecureVector<byte> NR_Core::sign(const byte in[], u32bit length,
- const BigInt& k) const
- {
- return op->sign(in, length, k);
- }
-
-/*************************************************
-* ELG_Core Constructor *
-*************************************************/
-ELG_Core::ELG_Core(const DL_Group& group, const BigInt& y)
- {
- op = Engine_Core::elg_op(group, y, 0);
- p_bytes = 0;
- }
-
-/*************************************************
-* ELG_Core Constructor *
-*************************************************/
-ELG_Core::ELG_Core(RandomNumberGenerator& rng,
- const DL_Group& group, const BigInt& y, const BigInt& x)
- {
- op = Engine_Core::elg_op(group, y, x);
-
- const BigInt& p = group.get_p();
- p_bytes = p.bytes();
-
- if(BLINDING_BITS)
- {
- BigInt k(rng, std::min(p.bits()-1, BLINDING_BITS));
- blinder = Blinder(k, power_mod(k, x, p), p);
- }
- }
-
-/*************************************************
-* ELG_Core Copy Constructor *
-*************************************************/
-ELG_Core::ELG_Core(const ELG_Core& core)
- {
- op = 0;
- if(core.op)
- op = core.op->clone();
- blinder = core.blinder;
- p_bytes = core.p_bytes;
- }
-
-/*************************************************
-* ELG_Core Assignment Operator *
-*************************************************/
-ELG_Core& ELG_Core::operator=(const ELG_Core& core)
- {
- delete op;
- if(core.op)
- op = core.op->clone();
- blinder = core.blinder;
- p_bytes = core.p_bytes;
- return (*this);
- }
-
-/*************************************************
-* ElGamal Encrypt Operation *
-*************************************************/
-SecureVector<byte> ELG_Core::encrypt(const byte in[], u32bit length,
- const BigInt& k) const
- {
- return op->encrypt(in, length, k);
- }
-
-/*************************************************
-* ElGamal Decrypt Operation *
-*************************************************/
-SecureVector<byte> ELG_Core::decrypt(const byte in[], u32bit length) const
- {
- if(length != 2*p_bytes)
- throw Invalid_Argument("ELG_Core::decrypt: Invalid message");
-
- BigInt a(in, p_bytes);
- BigInt b(in + p_bytes, p_bytes);
-
- return BigInt::encode(blinder.unblind(op->decrypt(blinder.blind(a), b)));
- }
-
-/*************************************************
-* DH_Core Constructor *
-*************************************************/
-DH_Core::DH_Core(RandomNumberGenerator& rng,
- const DL_Group& group, const BigInt& x)
- {
- op = Engine_Core::dh_op(group, x);
-
- const BigInt& p = group.get_p();
-
- BigInt k(rng, std::min(p.bits()-1, BLINDING_BITS));
-
- if(k != 0)
- blinder = Blinder(k, power_mod(inverse_mod(k, p), x, p), p);
- }
-
-/*************************************************
-* DH_Core Copy Constructor *
-*************************************************/
-DH_Core::DH_Core(const DH_Core& core)
- {
- op = 0;
- if(core.op)
- op = core.op->clone();
- blinder = core.blinder;
- }
-
-/*************************************************
-* DH_Core Assignment Operator *
-*************************************************/
-DH_Core& DH_Core::operator=(const DH_Core& core)
- {
- delete op;
- if(core.op)
- op = core.op->clone();
- blinder = core.blinder;
- return (*this);
- }
-
-/*************************************************
-* DH Operation *
-*************************************************/
-BigInt DH_Core::agree(const BigInt& i) const
- {
- return blinder.unblind(op->agree(blinder.blind(i)));
- }
-
-#if defined(BOTAN_HAS_ECDSA)
-
-/*************************************************
-* ECKAEG_Core Constructor *
-*************************************************/
-ECKAEG_Core::ECKAEG_Core(const EC_Domain_Params& dom_pars,
- const BigInt& priv_key,
- const PointGFp& pub_key)
- {
- op = Engine_Core::eckaeg_op(dom_pars, priv_key, pub_key);
- }
-
-/*************************************************
-* ECKAEG_Core Copy Constructor *
-*************************************************/
-ECKAEG_Core::ECKAEG_Core(const ECKAEG_Core& core)
- {
- op = 0;
- if(core.op)
- op = core.op->clone();
- blinder = core.blinder;
- }
-
-/*************************************************
-* ECKAEG_Core Assignment Operator *
-*************************************************/
-ECKAEG_Core& ECKAEG_Core::operator=(const ECKAEG_Core& core)
- {
- delete op;
- if(core.op)
- op = core.op->clone();
- blinder = core.blinder;
- return (*this);
- }
-
-/*************************************************
-* ECKAEG Operation *
-*************************************************/
-SecureVector<byte> ECKAEG_Core::agree(const PointGFp& otherKey) const
- {
- //assert(op.get());
- return op->agree(otherKey);
- }
-
-/*************************************************
-* ECDSA Operation *
-*************************************************/
-bool ECDSA_Core::verify(const byte signature[], u32bit sig_len,
- const byte message[], u32bit mess_len) const
- {
- //assert(op.get());
- return op->verify(signature, sig_len, message, mess_len);
- }
-
-SecureVector<byte> ECDSA_Core::sign(const byte message[], u32bit mess_len) const
- {
- //assert(op.get());
- return op->sign(message, mess_len);
- }
-
-ECDSA_Core& ECDSA_Core::operator=(const ECDSA_Core& core)
- {
- delete op;
- if(core.op)
- op = core.op->clone();
- return (*this);
- }
-
-ECDSA_Core::ECDSA_Core(const ECDSA_Core& core)
- {
- op = 0;
- if(core.op)
- op = core.op->clone();
- }
-
-ECDSA_Core::ECDSA_Core(EC_Domain_Params const& dom_pars, const BigInt& priv_key, PointGFp const& pub_key)
- {
- op = Engine_Core::ecdsa_op(dom_pars, priv_key, pub_key);
- }
-#endif
-
-}