aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/if_algo
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-05 17:40:45 +0000
committerlloyd <[email protected]>2010-03-05 17:40:45 +0000
commitbe9d7d1031bba2cd4f415d114389a1f50c61d44b (patch)
treec6714d8c40ac685c98e4b8bfbacdd14d99d64a63 /src/pubkey/if_algo
parentcdd1a1509ffc74c74bd902d55a7a85ab9e2afe78 (diff)
Remove IF_Core
Diffstat (limited to 'src/pubkey/if_algo')
-rw-r--r--src/pubkey/if_algo/if_algo.cpp4
-rw-r--r--src/pubkey/if_algo/if_algo.h3
-rw-r--r--src/pubkey/if_algo/if_core.cpp83
-rw-r--r--src/pubkey/if_algo/if_core.h45
-rw-r--r--src/pubkey/if_algo/if_op.cpp47
-rw-r--r--src/pubkey/if_algo/if_op.h52
-rw-r--r--src/pubkey/if_algo/info.txt12
7 files changed, 1 insertions, 245 deletions
diff --git a/src/pubkey/if_algo/if_algo.cpp b/src/pubkey/if_algo/if_algo.cpp
index 1acbad02c..759c30c61 100644
--- a/src/pubkey/if_algo/if_algo.cpp
+++ b/src/pubkey/if_algo/if_algo.cpp
@@ -78,8 +78,6 @@ IF_Scheme_PrivateKey::IF_Scheme_PrivateKey(RandomNumberGenerator& rng,
if(version != 0)
throw Decoding_Error("Unknown PKCS #1 key format version");
- core = IF_Core(rng, e, n, d, p, q, d1, d2, c);
-
load_check(rng);
}
@@ -109,8 +107,6 @@ IF_Scheme_PrivateKey::IF_Scheme_PrivateKey(RandomNumberGenerator& rng,
d2 = d % (q - 1);
c = inverse_mod(q, p);
- core = IF_Core(rng, e, n, d, p, q, d1, d2, c);
-
load_check(rng);
}
diff --git a/src/pubkey/if_algo/if_algo.h b/src/pubkey/if_algo/if_algo.h
index d35c8245f..65bb8aed4 100644
--- a/src/pubkey/if_algo/if_algo.h
+++ b/src/pubkey/if_algo/if_algo.h
@@ -8,7 +8,7 @@
#ifndef BOTAN_IF_ALGO_H__
#define BOTAN_IF_ALGO_H__
-#include <botan/if_core.h>
+#include <botan/bigint.h>
#include <botan/x509_key.h>
#include <botan/pkcs8.h>
#include <botan/pk_ops.h>
@@ -52,7 +52,6 @@ class BOTAN_DLL IF_Scheme_PublicKey : public virtual Public_Key
IF_Scheme_PublicKey() {}
BigInt n, e;
- IF_Core core;
};
/**
diff --git a/src/pubkey/if_algo/if_core.cpp b/src/pubkey/if_algo/if_core.cpp
deleted file mode 100644
index 41ebfe8dd..000000000
--- a/src/pubkey/if_algo/if_core.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
-* IF Algorithm Core
-* (C) 1999-2007 Jack Lloyd
-*
-* Distributed under the terms of the Botan license
-*/
-
-#include <botan/if_core.h>
-#include <botan/numthry.h>
-#include <botan/internal/pk_engine.h>
-#include <botan/parsing.h>
-#include <algorithm>
-
-namespace Botan {
-
-/*
-* 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)
- {
- const u32bit BLINDING_BITS = BOTAN_PRIVATE_KEY_OP_BLINDING_BITS;
-
- 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/pubkey/if_algo/if_core.h b/src/pubkey/if_algo/if_core.h
deleted file mode 100644
index b7f487706..000000000
--- a/src/pubkey/if_algo/if_core.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-* IF Algorithm Core
-* (C) 1999-2007 Jack Lloyd
-*
-* Distributed under the terms of the Botan license
-*/
-
-#ifndef BOTAN_IF_CORE_H__
-#define BOTAN_IF_CORE_H__
-
-#include <botan/if_op.h>
-#include <botan/blinding.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/pubkey/if_algo/if_op.cpp b/src/pubkey/if_algo/if_op.cpp
deleted file mode 100644
index 27aef453e..000000000
--- a/src/pubkey/if_algo/if_op.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
-* IF (RSA/RW) Operation
-* (C) 1999-2007 Jack Lloyd
-*
-* Distributed under the terms of the Botan license
-*/
-
-#include <botan/if_op.h>
-#include <botan/numthry.h>
-
-namespace Botan {
-
-/*
-* Default_IF_Op Constructor
-*/
-Default_IF_Op::Default_IF_Op(const BigInt& e, const BigInt& n, const BigInt&,
- const BigInt& p, const BigInt& q,
- const BigInt& d1, const BigInt& d2,
- const BigInt& c)
- {
- powermod_e_n = Fixed_Exponent_Power_Mod(e, n);
-
- if(d1 != 0 && d2 != 0 && p != 0 && q != 0)
- {
- powermod_d1_p = Fixed_Exponent_Power_Mod(d1, p);
- powermod_d2_q = Fixed_Exponent_Power_Mod(d2, q);
- reducer = Modular_Reducer(p);
- this->c = c;
- this->q = q;
- }
- }
-
-/*
-* Default IF Private Operation
-*/
-BigInt Default_IF_Op::private_op(const BigInt& i) const
- {
- if(q == 0)
- throw Internal_Error("Default_IF_Op::private_op: No private key");
-
- BigInt j1 = powermod_d1_p(i);
- BigInt j2 = powermod_d2_q(i);
- j1 = reducer.reduce(sub_mul(j1, j2, c));
- return mul_add(j1, q, j2);
- }
-
-}
diff --git a/src/pubkey/if_algo/if_op.h b/src/pubkey/if_algo/if_op.h
deleted file mode 100644
index 516902fd9..000000000
--- a/src/pubkey/if_algo/if_op.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-* 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
diff --git a/src/pubkey/if_algo/info.txt b/src/pubkey/if_algo/info.txt
index c0914cd15..32e50e684 100644
--- a/src/pubkey/if_algo/info.txt
+++ b/src/pubkey/if_algo/info.txt
@@ -2,18 +2,6 @@ define IF_PUBLIC_KEY_FAMILY
load_on dep
-<header:public>
-if_algo.h
-if_core.h
-if_op.h
-</header:public>
-
-<source>
-if_algo.cpp
-if_core.cpp
-if_op.cpp
-</source>
-
<requires>
asn1
bigint