aboutsummaryrefslogtreecommitdiffstats
path: root/src/pk/pubkey
diff options
context:
space:
mode:
Diffstat (limited to 'src/pk/pubkey')
-rw-r--r--src/pk/pubkey/dh_core.cpp67
-rw-r--r--src/pk/pubkey/dh_core.h38
-rw-r--r--src/pk/pubkey/dsa_core.cpp67
-rw-r--r--src/pk/pubkey/dsa_core.h36
-rw-r--r--src/pk/pubkey/ecc_core.cpp95
-rw-r--r--src/pk/pubkey/ecc_core.h74
-rw-r--r--src/pk/pubkey/elg_core.cpp95
-rw-r--r--src/pk/pubkey/elg_core.h43
-rw-r--r--src/pk/pubkey/if_core.cpp85
-rw-r--r--src/pk/pubkey/if_core.h44
-rw-r--r--src/pk/pubkey/info.txt12
-rw-r--r--src/pk/pubkey/nr_core.cpp60
-rw-r--r--src/pk/pubkey/nr_core.h36
13 files changed, 0 insertions, 752 deletions
diff --git a/src/pk/pubkey/dh_core.cpp b/src/pk/pubkey/dh_core.cpp
deleted file mode 100644
index a0586c444..000000000
--- a/src/pk/pubkey/dh_core.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*************************************************
-* PK Algorithm Core Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#include <botan/dh_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/dh_core.h b/src/pk/pubkey/dh_core.h
deleted file mode 100644
index 3735f31e1..000000000
--- a/src/pk/pubkey/dh_core.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*************************************************
-* DH Core Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#ifndef BOTAN_DH_CORE_H__
-#define BOTAN_DH_CORE_H__
-
-#include <botan/bigint.h>
-#include <botan/blinding.h>
-#include <botan/pk_ops.h>
-#include <botan/dl_group.h>
-
-namespace Botan {
-
-/*************************************************
-* DH Core *
-*************************************************/
-class BOTAN_DLL DH_Core
- {
- public:
- BigInt agree(const BigInt&) const;
-
- DH_Core& operator=(const DH_Core&);
-
- DH_Core() { op = 0; }
- DH_Core(const DH_Core&);
- DH_Core(RandomNumberGenerator& rng,
- const DL_Group&, const BigInt&);
- ~DH_Core() { delete op; }
- private:
- DH_Operation* op;
- Blinder blinder;
- };
-
-}
-
-#endif
diff --git a/src/pk/pubkey/dsa_core.cpp b/src/pk/pubkey/dsa_core.cpp
deleted file mode 100644
index aba1e61fb..000000000
--- a/src/pk/pubkey/dsa_core.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*************************************************
-* DSA Core Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#include <botan/dsa_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/dsa_core.h b/src/pk/pubkey/dsa_core.h
deleted file mode 100644
index 467f3c23f..000000000
--- a/src/pk/pubkey/dsa_core.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*************************************************
-* DSA Core Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#ifndef BOTAN_DSA_CORE_H__
-#define BOTAN_DSA_CORE_H__
-
-#include <botan/bigint.h>
-#include <botan/pk_ops.h>
-#include <botan/dl_group.h>
-
-namespace Botan {
-
-/*************************************************
-* DSA Core *
-*************************************************/
-class BOTAN_DLL DSA_Core
- {
- public:
- SecureVector<byte> sign(const byte[], u32bit, const BigInt&) const;
- bool verify(const byte[], u32bit, const byte[], u32bit) const;
-
- DSA_Core& operator=(const DSA_Core&);
-
- DSA_Core() { op = 0; }
- DSA_Core(const DSA_Core&);
- DSA_Core(const DL_Group&, const BigInt&, const BigInt& = 0);
- ~DSA_Core() { delete op; }
- private:
- DSA_Operation* op;
- };
-
-}
-
-#endif
diff --git a/src/pk/pubkey/ecc_core.cpp b/src/pk/pubkey/ecc_core.cpp
deleted file mode 100644
index 8d1d48b49..000000000
--- a/src/pk/pubkey/ecc_core.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*************************************************
-* ECDSA/ECKAEG Core Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#include <botan/ecc_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/ecc_core.h b/src/pk/pubkey/ecc_core.h
deleted file mode 100644
index 1124eaa2f..000000000
--- a/src/pk/pubkey/ecc_core.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*************************************************
-* ECC Core Header File *
-* (C) 1999-2007 Jack Lloyd *
-* (C) 2007 FlexSecure GmbH *
-*************************************************/
-
-#ifndef BOTAN_ECC_CORE_H__
-#define BOTAN_ECC_CORE_H__
-
-#include <botan/bigint.h>
-#include <botan/blinding.h>
-#include <botan/pk_ops.h>
-
-#if defined(BOTAN_HAS_ECDSA)
- #include <botan/ec_dompar.h>
-#endif
-
-namespace Botan {
-
-#if defined(BOTAN_HAS_ECDSA)
-/*************************************************
-* ECDSA Core *
-*************************************************/
-class ECDSA_Core
- {
- public:
- bool verify(const byte signature[], u32bit sig_len,
- const byte message[], u32bit mess_len) const;
-
- SecureVector<byte> sign(const byte message[], u32bit mess_len) const;
-
- ECDSA_Core& operator=(const ECDSA_Core&);
-
- ECDSA_Core() { op = 0; }
-
- ECDSA_Core(const ECDSA_Core&);
-
- ECDSA_Core(const EC_Domain_Params& dom_pars,
- const BigInt& priv_key,
- const PointGFp& pub_key);
-
- ~ECDSA_Core() { delete op; }
- private:
- ECDSA_Operation* op;
- };
-
-/*************************************************
-* ECKAEG Core *
-*************************************************/
-class ECKAEG_Core
- {
- public:
- SecureVector<byte> agree(const PointGFp&) const;
-
- ECKAEG_Core& operator=(const ECKAEG_Core&);
-
- ECKAEG_Core() { op = 0; }
-
- ECKAEG_Core(const ECKAEG_Core&);
-
- ECKAEG_Core(const EC_Domain_Params& dom_pars,
- const BigInt& priv_key,
- PointGFp const& pub_key);
-
- ~ECKAEG_Core() { delete op; }
- private:
- ECKAEG_Operation* op;
- Blinder blinder;
- };
-#endif
-
-}
-
-#endif
diff --git a/src/pk/pubkey/elg_core.cpp b/src/pk/pubkey/elg_core.cpp
deleted file mode 100644
index 1181e7534..000000000
--- a/src/pk/pubkey/elg_core.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*************************************************
-* ElGamal Core Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#include <botan/elg_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/elg_core.h b/src/pk/pubkey/elg_core.h
deleted file mode 100644
index 67966a452..000000000
--- a/src/pk/pubkey/elg_core.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*************************************************
-* ElGamal Core Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#ifndef BOTAN_ELGAMAL_CORE_H__
-#define BOTAN_ELGAMAL_CORE_H__
-
-#include <botan/pk_ops.h>
-#include <botan/bigint.h>
-#include <botan/blinding.h>
-#include <botan/dl_group.h>
-
-namespace Botan {
-
-/*************************************************
-* ElGamal Core *
-*************************************************/
-class BOTAN_DLL ELG_Core
- {
- public:
- SecureVector<byte> encrypt(const byte[], u32bit, const BigInt&) const;
- SecureVector<byte> decrypt(const byte[], u32bit) const;
-
- ELG_Core& operator=(const ELG_Core&);
-
- ELG_Core() { op = 0; }
- ELG_Core(const ELG_Core&);
-
- ELG_Core(const DL_Group&, const BigInt&);
- ELG_Core(RandomNumberGenerator&, const DL_Group&,
- const BigInt&, const BigInt&);
-
- ~ELG_Core() { delete op; }
- private:
- ELG_Operation* op;
- Blinder blinder;
- u32bit p_bytes;
- };
-
-}
-
-#endif
diff --git a/src/pk/pubkey/if_core.cpp b/src/pk/pubkey/if_core.cpp
deleted file mode 100644
index 97cacf9d8..000000000
--- a/src/pk/pubkey/if_core.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*************************************************
-* IF Algorithm Core Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#include <botan/if_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/if_core.h b/src/pk/pubkey/if_core.h
deleted file mode 100644
index b6afad950..000000000
--- a/src/pk/pubkey/if_core.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*************************************************
-* IF Algorithm Core Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#ifndef BOTAN_IF_CORE_H__
-#define BOTAN_IF_CORE_H__
-
-#include <botan/bigint.h>
-#include <botan/blinding.h>
-#include <botan/pk_ops.h>
-
-namespace Botan {
-
-/*************************************************
-* IF Core *
-*************************************************/
-class BOTAN_DLL IF_Core
- {
- public:
- BigInt public_op(const BigInt&) const;
- BigInt private_op(const BigInt&) const;
-
- IF_Core& operator=(const IF_Core&);
-
- IF_Core() { op = 0; }
- IF_Core(const IF_Core&);
-
- IF_Core(const BigInt&, const BigInt&);
-
- IF_Core(RandomNumberGenerator& rng,
- const BigInt&, const BigInt&,
- const BigInt&, const BigInt&, const BigInt&,
- const BigInt&, const BigInt&, const BigInt&);
-
- ~IF_Core() { delete op; }
- private:
- IF_Operation* op;
- Blinder blinder;
- };
-
-}
-
-#endif
diff --git a/src/pk/pubkey/info.txt b/src/pk/pubkey/info.txt
index 1c58c0e89..8c97aa744 100644
--- a/src/pk/pubkey/info.txt
+++ b/src/pk/pubkey/info.txt
@@ -11,21 +11,9 @@ asn1
</requires>
<add>
-dh_core.cpp
-dh_core.h
dh_op.cpp
-dsa_core.cpp
-dsa_core.h
dsa_op.cpp
-ecc_core.cpp
-ecc_core.h
-elg_core.cpp
-elg_core.h
elg_op.cpp
-if_core.cpp
-if_core.h
-nr_core.cpp
-nr_core.h
nr_op.cpp
pk_algs.cpp
pk_algs.h
diff --git a/src/pk/pubkey/nr_core.cpp b/src/pk/pubkey/nr_core.cpp
deleted file mode 100644
index f9dfa4024..000000000
--- a/src/pk/pubkey/nr_core.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*************************************************
-* NR Core Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#include <botan/nr_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/nr_core.h b/src/pk/pubkey/nr_core.h
deleted file mode 100644
index 416e31619..000000000
--- a/src/pk/pubkey/nr_core.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*************************************************
-* NR Core Header File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#ifndef BOTAN_NR_CORE_H__
-#define BOTAN_NR_CORE_H__
-
-#include <botan/bigint.h>
-#include <botan/pk_ops.h>
-#include <botan/dl_group.h>
-
-namespace Botan {
-
-/*************************************************
-* NR Core *
-*************************************************/
-class BOTAN_DLL NR_Core
- {
- public:
- SecureVector<byte> sign(const byte[], u32bit, const BigInt&) const;
- SecureVector<byte> verify(const byte[], u32bit) const;
-
- NR_Core& operator=(const NR_Core&);
-
- NR_Core() { op = 0; }
- NR_Core(const NR_Core&);
- NR_Core(const DL_Group&, const BigInt&, const BigInt& = 0);
- ~NR_Core() { delete op; }
- private:
- NR_Operation* op;
- };
-
-}
-
-#endif