aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-05 16:25:43 +0000
committerlloyd <[email protected]>2010-03-05 16:25:43 +0000
commitc52cfb67263a9bb227c4b6fb0a0e37ab388f933a (patch)
treefdd87d05cae6e30e84c60d518ae1f99f80bbabff
parentdf56028cad58fad04b9866326cb62700af8f2fbe (diff)
Remove NR and DSA specific hooks
-rw-r--r--src/engine/def_engine/def_pk_ops.cpp41
-rw-r--r--src/engine/def_engine/default_engine.h9
-rw-r--r--src/engine/engine.h20
-rw-r--r--src/libstate/pk_engine.cpp38
-rw-r--r--src/libstate/pk_engine.h16
-rw-r--r--src/pubkey/dsa/dsa.cpp13
-rw-r--r--src/pubkey/dsa/dsa.h6
-rw-r--r--src/pubkey/dsa/dsa_core.cpp63
-rw-r--r--src/pubkey/dsa/dsa_core.h37
-rw-r--r--src/pubkey/dsa/dsa_op.cpp73
-rw-r--r--src/pubkey/dsa/dsa_op.h59
-rw-r--r--src/pubkey/dsa/info.txt12
-rw-r--r--src/pubkey/nr/nr.cpp15
-rw-r--r--src/pubkey/nr/nr.h6
-rw-r--r--src/pubkey/nr/nr_core.cpp62
-rw-r--r--src/pubkey/nr/nr_core.h37
-rw-r--r--src/pubkey/nr/nr_op.cpp71
-rw-r--r--src/pubkey/nr/nr_op.h53
18 files changed, 5 insertions, 626 deletions
diff --git a/src/engine/def_engine/def_pk_ops.cpp b/src/engine/def_engine/def_pk_ops.cpp
index 57d17f662..ce23cd8db 100644
--- a/src/engine/def_engine/def_pk_ops.cpp
+++ b/src/engine/def_engine/def_pk_ops.cpp
@@ -7,27 +7,13 @@
#include <botan/internal/default_engine.h>
-#if defined(BOTAN_HAS_IF_PUBLIC_KEY_FAMILY)
- #include <botan/if_op.h>
-#endif
-
-#if defined(BOTAN_HAS_DSA)
- #include <botan/dsa_op.h>
-#endif
-
-#if defined(BOTAN_HAS_NYBERG_RUEPPEL)
- #include <botan/nr_op.h>
-#endif
-
-#if defined(BOTAN_HAS_ELGAMAL)
- #include <botan/elg_op.h>
-#endif
-
#if defined(BOTAN_HAS_RSA)
+ #include <botan/if_op.h>
#include <botan/rsa.h>
#endif
#if defined(BOTAN_HAS_RW)
+ #include <botan/if_op.h>
#include <botan/rw.h>
#endif
@@ -41,6 +27,7 @@
#if defined(BOTAN_HAS_ELGAMAL)
#include <botan/elgamal.h>
+ #include <botan/elg_op.h>
#endif
#if defined(BOTAN_HAS_GOST_3410_2001)
@@ -164,28 +151,6 @@ IF_Operation* Default_Engine::if_op(const BigInt& e, const BigInt& n,
}
#endif
-#if defined(BOTAN_HAS_DSA)
-/*
-* Acquire a DSA op
-*/
-DSA_Operation* Default_Engine::dsa_op(const DL_Group& group, const BigInt& y,
- const BigInt& x) const
- {
- return new Default_DSA_Op(group, y, x);
- }
-#endif
-
-#if defined(BOTAN_HAS_NYBERG_RUEPPEL)
-/*
-* Acquire a NR op
-*/
-NR_Operation* Default_Engine::nr_op(const DL_Group& group, const BigInt& y,
- const BigInt& x) const
- {
- return new Default_NR_Op(group, y, x);
- }
-#endif
-
#if defined(BOTAN_HAS_ELGAMAL)
/*
* Acquire an ElGamal op
diff --git a/src/engine/def_engine/default_engine.h b/src/engine/def_engine/default_engine.h
index 4e21fb3a5..d74f61459 100644
--- a/src/engine/def_engine/default_engine.h
+++ b/src/engine/def_engine/default_engine.h
@@ -34,15 +34,6 @@ class Default_Engine : public Engine
const BigInt&, const BigInt&) const;
#endif
-#if defined(BOTAN_HAS_DSA)
- DSA_Operation* dsa_op(const DL_Group&, const BigInt&,
- const BigInt&) const;
-#endif
-
-#if defined(BOTAN_HAS_NYBERG_RUEPPEL)
- NR_Operation* nr_op(const DL_Group&, const BigInt&, const BigInt&) const;
-#endif
-
#if defined(BOTAN_HAS_ELGAMAL)
ELG_Operation* elg_op(const DL_Group&, const BigInt&,
const BigInt&) const;
diff --git a/src/engine/engine.h b/src/engine/engine.h
index b0bbf5b14..c62a7f956 100644
--- a/src/engine/engine.h
+++ b/src/engine/engine.h
@@ -25,14 +25,6 @@
#include <botan/if_op.h>
#endif
-#if defined(BOTAN_HAS_DSA)
- #include <botan/dsa_op.h>
-#endif
-
-#if defined(BOTAN_HAS_NYBERG_RUEPPEL)
- #include <botan/nr_op.h>
-#endif
-
#if defined(BOTAN_HAS_ELGAMAL)
#include <botan/elg_op.h>
#endif
@@ -102,18 +94,6 @@ class BOTAN_DLL Engine
{ return 0; }
#endif
-#if defined(BOTAN_HAS_DSA)
- virtual DSA_Operation* dsa_op(const DL_Group&, const BigInt&,
- const BigInt&) const
- { return 0; }
-#endif
-
-#if defined(BOTAN_HAS_NYBERG_RUEPPEL)
- virtual NR_Operation* nr_op(const DL_Group&, const BigInt&,
- const BigInt&) const
- { return 0; }
-#endif
-
#if defined(BOTAN_HAS_ELGAMAL)
virtual ELG_Operation* elg_op(const DL_Group&, const BigInt&,
const BigInt&) const
diff --git a/src/libstate/pk_engine.cpp b/src/libstate/pk_engine.cpp
index 51aaa073e..d4187adc1 100644
--- a/src/libstate/pk_engine.cpp
+++ b/src/libstate/pk_engine.cpp
@@ -34,44 +34,6 @@ IF_Operation* if_op(const BigInt& e, const BigInt& n, const BigInt& d,
}
#endif
-#if defined(BOTAN_HAS_DSA)
-/*
-* Acquire a DSA op
-*/
-DSA_Operation* dsa_op(const DL_Group& group, const BigInt& y, const BigInt& x)
- {
- Algorithm_Factory::Engine_Iterator i(global_state().algorithm_factory());
-
- while(const Engine* engine = i.next())
- {
- DSA_Operation* op = engine->dsa_op(group, y, x);
- if(op)
- return op;
- }
-
- throw Lookup_Error("Engine_Core::dsa_op: Unable to find a working engine");
- }
-#endif
-
-#if defined(BOTAN_HAS_NYBERG_RUEPPEL)
-/*
-* Acquire a NR op
-*/
-NR_Operation* nr_op(const DL_Group& group, const BigInt& y, const BigInt& x)
- {
- Algorithm_Factory::Engine_Iterator i(global_state().algorithm_factory());
-
- while(const Engine* engine = i.next())
- {
- NR_Operation* op = engine->nr_op(group, y, x);
- if(op)
- return op;
- }
-
- throw Lookup_Error("Engine_Core::nr_op: Unable to find a working engine");
- }
-#endif
-
#if defined(BOTAN_HAS_ELGAMAL)
/*
* Acquire an ElGamal op
diff --git a/src/libstate/pk_engine.h b/src/libstate/pk_engine.h
index e6399058e..3bc1a90f1 100644
--- a/src/libstate/pk_engine.h
+++ b/src/libstate/pk_engine.h
@@ -15,14 +15,6 @@
#include <botan/if_op.h>
#endif
-#if defined(BOTAN_HAS_DSA)
- #include <botan/dsa_op.h>
-#endif
-
-#if defined(BOTAN_HAS_NYBERG_RUEPPEL)
- #include <botan/nr_op.h>
-#endif
-
#if defined(BOTAN_HAS_ELGAMAL)
#include <botan/elg_op.h>
#endif
@@ -46,14 +38,6 @@ IF_Operation* if_op(const BigInt&, const BigInt&, const BigInt&,
const BigInt&, const BigInt&);
#endif
-#if defined(BOTAN_HAS_DSA)
-DSA_Operation* dsa_op(const DL_Group&, const BigInt&, const BigInt&);
-#endif
-
-#if defined(BOTAN_HAS_NYBERG_RUEPPEL)
-NR_Operation* nr_op(const DL_Group&, const BigInt&, const BigInt&);
-#endif
-
#if defined(BOTAN_HAS_ELGAMAL)
ELG_Operation* elg_op(const DL_Group&, const BigInt&, const BigInt&);
#endif
diff --git a/src/pubkey/dsa/dsa.cpp b/src/pubkey/dsa/dsa.cpp
index 52df9827f..60414195d 100644
--- a/src/pubkey/dsa/dsa.cpp
+++ b/src/pubkey/dsa/dsa.cpp
@@ -19,16 +19,6 @@ DSA_PublicKey::DSA_PublicKey(const DL_Group& grp, const BigInt& y1)
{
group = grp;
y = y1;
- core = DSA_Core(group, y);
- }
-
-/*
-* DSA Verification Function
-*/
-bool DSA_PublicKey::verify(const byte msg[], u32bit msg_len,
- const byte sig[], u32bit sig_len) const
- {
- return core.verify(msg, msg_len, sig, sig_len);
}
/*
@@ -46,8 +36,6 @@ DSA_PrivateKey::DSA_PrivateKey(RandomNumberGenerator& rng,
y = power_mod(group_g(), x, group_p());
- core = DSA_Core(group, y, x);
-
if(x_arg == 0)
gen_check(rng);
else
@@ -60,7 +48,6 @@ DSA_PrivateKey::DSA_PrivateKey(const AlgorithmIdentifier& alg_id,
DL_Scheme_PrivateKey(alg_id, key_bits, DL_Group::ANSI_X9_57)
{
y = power_mod(group_g(), x, group_p());
- core = DSA_Core(group, y, x);
load_check(rng);
}
diff --git a/src/pubkey/dsa/dsa.h b/src/pubkey/dsa/dsa.h
index 68ae34235..f8db77a1b 100644
--- a/src/pubkey/dsa/dsa.h
+++ b/src/pubkey/dsa/dsa.h
@@ -12,7 +12,6 @@
#include <botan/pk_ops.h>
#include <botan/reducer.h>
#include <botan/pow_mod.h>
-#include <botan/dsa_core.h>
namespace Botan {
@@ -30,20 +29,15 @@ class BOTAN_DLL DSA_PublicKey : public PK_Verifying_wo_MR_Key,
u32bit message_part_size() const { return group_q().bytes(); }
u32bit max_input_bits() const { return group_q().bits(); }
- bool verify(const byte msg[], u32bit msg_len,
- const byte sig[], u32bit sig_len) const;
-
DSA_PublicKey(const AlgorithmIdentifier& alg_id,
const MemoryRegion<byte>& key_bits) :
DL_Scheme_PublicKey(alg_id, key_bits, DL_Group::ANSI_X9_57)
{
- core = DSA_Core(group, y);
}
DSA_PublicKey(const DL_Group& group, const BigInt& y);
protected:
DSA_PublicKey() {}
- DSA_Core core;
};
/*
diff --git a/src/pubkey/dsa/dsa_core.cpp b/src/pubkey/dsa/dsa_core.cpp
deleted file mode 100644
index d952e10eb..000000000
--- a/src/pubkey/dsa/dsa_core.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-* DSA Core
-* (C) 1999-2007 Jack Lloyd
-*
-* Distributed under the terms of the Botan license
-*/
-
-#include <botan/dsa_core.h>
-#include <botan/numthry.h>
-#include <botan/internal/pk_engine.h>
-#include <botan/parsing.h>
-#include <algorithm>
-
-namespace Botan {
-
-/*
-* 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/pubkey/dsa/dsa_core.h b/src/pubkey/dsa/dsa_core.h
deleted file mode 100644
index 8bb16211f..000000000
--- a/src/pubkey/dsa/dsa_core.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-* DSA Core
-* (C) 1999-2007 Jack Lloyd
-*
-* Distributed under the terms of the Botan license
-*/
-
-#ifndef BOTAN_DSA_CORE_H__
-#define BOTAN_DSA_CORE_H__
-
-#include <botan/dsa_op.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/pubkey/dsa/dsa_op.cpp b/src/pubkey/dsa/dsa_op.cpp
deleted file mode 100644
index 5b921441d..000000000
--- a/src/pubkey/dsa/dsa_op.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-* DSA Operations
-* (C) 1999-2007 Jack Lloyd
-*
-* Distributed under the terms of the Botan license
-*/
-
-#include <botan/dsa_op.h>
-
-namespace Botan {
-
-/*
-* Default_DSA_Op Constructor
-*/
-Default_DSA_Op::Default_DSA_Op(const DL_Group& grp, const BigInt& y1,
- const BigInt& x1) : x(x1), y(y1), group(grp)
- {
- powermod_g_p = Fixed_Base_Power_Mod(group.get_g(), group.get_p());
- powermod_y_p = Fixed_Base_Power_Mod(y, group.get_p());
- mod_p = Modular_Reducer(group.get_p());
- mod_q = Modular_Reducer(group.get_q());
- }
-
-/*
-* Default DSA Verify Operation
-*/
-bool Default_DSA_Op::verify(const byte msg[], u32bit msg_len,
- const byte sig[], u32bit sig_len) const
- {
- const BigInt& q = group.get_q();
-
- if(sig_len != 2*q.bytes() || msg_len > q.bytes())
- return false;
-
- BigInt r(sig, q.bytes());
- BigInt s(sig + q.bytes(), q.bytes());
- BigInt i(msg, msg_len);
-
- if(r <= 0 || r >= q || s <= 0 || s >= q)
- return false;
-
- s = inverse_mod(s, q);
- s = mod_p.multiply(powermod_g_p(mod_q.multiply(s, i)),
- powermod_y_p(mod_q.multiply(s, r)));
-
- return (mod_q.reduce(s) == r);
- }
-
-/*
-* Default DSA Sign Operation
-*/
-SecureVector<byte> Default_DSA_Op::sign(const byte in[], u32bit length,
- const BigInt& k) const
- {
- if(x == 0)
- throw Internal_Error("Default_DSA_Op::sign: No private key");
-
- const BigInt& q = group.get_q();
- BigInt i(in, length);
-
- BigInt r = mod_q.reduce(powermod_g_p(k));
- BigInt s = mod_q.multiply(inverse_mod(k, q), mul_add(x, r, i));
-
- if(r.is_zero() || s.is_zero())
- throw Internal_Error("Default_DSA_Op::sign: r or s was zero");
-
- SecureVector<byte> output(2*q.bytes());
- r.binary_encode(output + (output.size() / 2 - r.bytes()));
- s.binary_encode(output + (output.size() - s.bytes()));
- return output;
- }
-
-}
diff --git a/src/pubkey/dsa/dsa_op.h b/src/pubkey/dsa/dsa_op.h
deleted file mode 100644
index 47a9d09e1..000000000
--- a/src/pubkey/dsa/dsa_op.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-* DSA Operations
-* (C) 1999-2008 Jack Lloyd
-*
-* Distributed under the terms of the Botan license
-*/
-
-#ifndef BOTAN_DSA_OPS_H__
-#define BOTAN_DSA_OPS_H__
-
-#include <botan/numthry.h>
-#include <botan/pow_mod.h>
-#include <botan/reducer.h>
-#include <botan/dl_group.h>
-
-namespace Botan {
-
-/*
-* DSA Operation
-*/
-class BOTAN_DLL DSA_Operation
- {
- public:
- virtual bool verify(const byte msg[], u32bit msg_len,
- const byte sig[], u32bit sig_len) const = 0;
-
- virtual SecureVector<byte> sign(const byte msg[], u32bit msg_len,
- const BigInt& k) const = 0;
-
- virtual DSA_Operation* clone() const = 0;
-
- virtual ~DSA_Operation() {}
- };
-
-/*
-* Botan's Default DSA Operation
-*/
-class BOTAN_DLL Default_DSA_Op : public DSA_Operation
- {
- public:
- bool verify(const byte msg[], u32bit msg_len,
- const byte sig[], u32bit sig_len) const;
-
- SecureVector<byte> sign(const byte msg[], u32bit msg_len,
- const BigInt& k) const;
-
- DSA_Operation* clone() const { return new Default_DSA_Op(*this); }
-
- Default_DSA_Op(const DL_Group&, const BigInt&, const BigInt&);
- private:
- const BigInt x, y;
- const DL_Group group;
- Fixed_Base_Power_Mod powermod_g_p, powermod_y_p;
- Modular_Reducer mod_p, mod_q;
- };
-
-}
-
-#endif
diff --git a/src/pubkey/dsa/info.txt b/src/pubkey/dsa/info.txt
index 1248cf68d..d59fe7aa7 100644
--- a/src/pubkey/dsa/info.txt
+++ b/src/pubkey/dsa/info.txt
@@ -1,17 +1,5 @@
define DSA
-<header:public>
-dsa.h
-dsa_core.h
-dsa_op.h
-</header:public>
-
-<source>
-dsa.cpp
-dsa_core.cpp
-dsa_op.cpp
-</source>
-
<requires>
dl_algo
dl_group
diff --git a/src/pubkey/nr/nr.cpp b/src/pubkey/nr/nr.cpp
index 700e93092..540cfa281 100644
--- a/src/pubkey/nr/nr.cpp
+++ b/src/pubkey/nr/nr.cpp
@@ -16,7 +16,6 @@ NR_PublicKey::NR_PublicKey(const AlgorithmIdentifier& alg_id,
const MemoryRegion<byte>& key_bits) :
DL_Scheme_PublicKey(alg_id, key_bits, DL_Group::ANSI_X9_57)
{
- core = NR_Core(group, y);
}
/*
@@ -26,16 +25,6 @@ NR_PublicKey::NR_PublicKey(const DL_Group& grp, const BigInt& y1)
{
group = grp;
y = y1;
-
- core = NR_Core(group, y);
- }
-
-/*
-* Nyberg-Rueppel Verification Function
-*/
-SecureVector<byte> NR_PublicKey::verify(const byte sig[], u32bit sig_len) const
- {
- return core.verify(sig, sig_len);
}
/*
@@ -53,8 +42,6 @@ NR_PrivateKey::NR_PrivateKey(RandomNumberGenerator& rng,
y = power_mod(group_g(), x, group_p());
- core = NR_Core(group, y, x);
-
if(x_arg == 0)
gen_check(rng);
else
@@ -68,8 +55,6 @@ NR_PrivateKey::NR_PrivateKey(const AlgorithmIdentifier& alg_id,
{
y = power_mod(group_g(), x, group_p());
- core = NR_Core(group, y, x);
-
load_check(rng);
}
diff --git a/src/pubkey/nr/nr.h b/src/pubkey/nr/nr.h
index 7a6aaf8fb..c6c7d871c 100644
--- a/src/pubkey/nr/nr.h
+++ b/src/pubkey/nr/nr.h
@@ -10,7 +10,8 @@
#include <botan/dl_algo.h>
#include <botan/pk_ops.h>
-#include <botan/nr_core.h>
+#include <botan/numthry.h>
+#include <botan/reducer.h>
namespace Botan {
@@ -23,8 +24,6 @@ class BOTAN_DLL NR_PublicKey : public PK_Verifying_with_MR_Key,
public:
std::string algo_name() const { return "NR"; }
- SecureVector<byte> verify(const byte sig[], u32bit sig_len) const;
-
DL_Group::Format group_format() const { return DL_Group::ANSI_X9_57; }
u32bit message_parts() const { return 2; }
@@ -37,7 +36,6 @@ class BOTAN_DLL NR_PublicKey : public PK_Verifying_with_MR_Key,
NR_PublicKey(const DL_Group& group, const BigInt& pub_key);
protected:
NR_PublicKey() {}
- NR_Core core;
};
/*
diff --git a/src/pubkey/nr/nr_core.cpp b/src/pubkey/nr/nr_core.cpp
deleted file mode 100644
index a87c32d60..000000000
--- a/src/pubkey/nr/nr_core.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-* NR Core
-* (C) 1999-2007 Jack Lloyd
-*
-* Distributed under the terms of the Botan license
-*/
-
-#include <botan/nr_core.h>
-#include <botan/numthry.h>
-#include <botan/internal/pk_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/pubkey/nr/nr_core.h b/src/pubkey/nr/nr_core.h
deleted file mode 100644
index 483773622..000000000
--- a/src/pubkey/nr/nr_core.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-* NR Core
-* (C) 1999-2007 Jack Lloyd
-*
-* Distributed under the terms of the Botan license
-*/
-
-#ifndef BOTAN_NR_CORE_H__
-#define BOTAN_NR_CORE_H__
-
-#include <botan/nr_op.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
diff --git a/src/pubkey/nr/nr_op.cpp b/src/pubkey/nr/nr_op.cpp
deleted file mode 100644
index b5efa3d37..000000000
--- a/src/pubkey/nr/nr_op.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-* NR Operations
-* (C) 1999-2007 Jack Lloyd
-*
-* Distributed under the terms of the Botan license
-*/
-
-#include <botan/nr_op.h>
-
-namespace Botan {
-
-/*
-* Default_NR_Op Constructor
-*/
-Default_NR_Op::Default_NR_Op(const DL_Group& grp, const BigInt& y1,
- const BigInt& x1) : x(x1), y(y1), group(grp)
- {
- powermod_g_p = Fixed_Base_Power_Mod(group.get_g(), group.get_p());
- powermod_y_p = Fixed_Base_Power_Mod(y, group.get_p());
- mod_p = Modular_Reducer(group.get_p());
- mod_q = Modular_Reducer(group.get_q());
- }
-
-/*
-* Default NR Verify Operation
-*/
-SecureVector<byte> Default_NR_Op::verify(const byte in[], u32bit length) const
- {
- const BigInt& q = group.get_q();
-
- if(length != 2*q.bytes())
- return false;
-
- BigInt c(in, q.bytes());
- BigInt d(in + q.bytes(), q.bytes());
-
- if(c.is_zero() || c >= q || d >= q)
- throw Invalid_Argument("Default_NR_Op::verify: Invalid signature");
-
- BigInt i = mod_p.multiply(powermod_g_p(d), powermod_y_p(c));
- return BigInt::encode(mod_q.reduce(c - i));
- }
-
-/*
-* Default NR Sign Operation
-*/
-SecureVector<byte> Default_NR_Op::sign(const byte in[], u32bit length,
- const BigInt& k) const
- {
- if(x == 0)
- throw Internal_Error("Default_NR_Op::sign: No private key");
-
- const BigInt& q = group.get_q();
-
- BigInt f(in, length);
-
- if(f >= q)
- throw Invalid_Argument("Default_NR_Op::sign: Input is out of range");
-
- BigInt c = mod_q.reduce(powermod_g_p(k) + f);
- if(c.is_zero())
- throw Internal_Error("Default_NR_Op::sign: c was zero");
- BigInt d = mod_q.reduce(k - x * c);
-
- SecureVector<byte> output(2*q.bytes());
- c.binary_encode(output + (output.size() / 2 - c.bytes()));
- d.binary_encode(output + (output.size() - d.bytes()));
- return output;
- }
-
-}
diff --git a/src/pubkey/nr/nr_op.h b/src/pubkey/nr/nr_op.h
deleted file mode 100644
index cba1465f2..000000000
--- a/src/pubkey/nr/nr_op.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-* NR Operations
-* (C) 1999-2008 Jack Lloyd
-*
-* Distributed under the terms of the Botan license
-*/
-
-#ifndef BOTAN_NR_OPS_H__
-#define BOTAN_NR_OPS_H__
-
-#include <botan/pow_mod.h>
-#include <botan/numthry.h>
-#include <botan/reducer.h>
-#include <botan/dl_group.h>
-
-namespace Botan {
-
-/*
-* NR Operation
-*/
-class BOTAN_DLL NR_Operation
- {
- public:
- virtual SecureVector<byte> verify(const byte[], u32bit) const = 0;
- virtual SecureVector<byte> sign(const byte[], u32bit,
- const BigInt&) const = 0;
- virtual NR_Operation* clone() const = 0;
- virtual ~NR_Operation() {}
- };
-
-/*
-* Botan's Default NR Operation
-*/
-class BOTAN_DLL Default_NR_Op : public NR_Operation
- {
- public:
- SecureVector<byte> verify(const byte[], u32bit) const;
- SecureVector<byte> sign(const byte[], u32bit, const BigInt&) const;
-
- NR_Operation* clone() const { return new Default_NR_Op(*this); }
-
- Default_NR_Op(const DL_Group&, const BigInt&, const BigInt&);
- private:
- const BigInt x, y;
- const DL_Group group;
- Fixed_Base_Power_Mod powermod_g_p, powermod_y_p;
- Modular_Reducer mod_p, mod_q;
- };
-
-
-}
-
-#endif