aboutsummaryrefslogtreecommitdiffstats
path: root/src/math/numbertheory
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-08 19:39:38 +0000
committerlloyd <[email protected]>2010-03-08 19:39:38 +0000
commitbd79f42e733a1119033f049effdd341916f38c62 (patch)
treec0d8a065e0b5e8106364bd355a5618d28627b0de /src/math/numbertheory
parent868c7f7d9c306e6e15d24f2b32e529aa1956516e (diff)
Add back in blinding to RSA, RW, ElGamal, and DH.
There are multiple unsatisfactory elements to the current solution, as compared to how blinding was previously done: Firstly, blinding is only used in the baseline implementations; the code using OpenSSL and GMP is not protected by blinding at all. Secondly, at the point we need to set up blinding, there is no access to a PRNG. Currently I am going with a quite nasty solution, of using a private key parameter to seed a simple PRNG constructed as: SHA-512(TS1 || private_key_param || public_key_param || TS2) I really want to fix both of these elements but I'm not sure how to do so easily.
Diffstat (limited to 'src/math/numbertheory')
-rw-r--r--src/math/numbertheory/blinding.cpp49
-rw-r--r--src/math/numbertheory/blinding.h34
-rw-r--r--src/math/numbertheory/info.txt2
3 files changed, 0 insertions, 85 deletions
diff --git a/src/math/numbertheory/blinding.cpp b/src/math/numbertheory/blinding.cpp
deleted file mode 100644
index c6a3fd1bd..000000000
--- a/src/math/numbertheory/blinding.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-* Blinder
-* (C) 1999-2007 Jack Lloyd
-*
-* Distributed under the terms of the Botan license
-*/
-
-#include <botan/blinding.h>
-#include <botan/numthry.h>
-
-namespace Botan {
-
-/*
-* Blinder Constructor
-*/
-Blinder::Blinder(const BigInt& e, const BigInt& d, const BigInt& n)
- {
- if(e < 1 || d < 1 || n < 1)
- throw Invalid_Argument("Blinder: Arguments too small");
-
- reducer = Modular_Reducer(n);
- this->e = e;
- this->d = d;
- }
-
-/*
-* Blind a number
-*/
-BigInt Blinder::blind(const BigInt& i) const
- {
- if(!reducer.initialized())
- return i;
-
- e = reducer.square(e);
- d = reducer.square(d);
- return reducer.multiply(i, e);
- }
-
-/*
-* Unblind a number
-*/
-BigInt Blinder::unblind(const BigInt& i) const
- {
- if(!reducer.initialized())
- return i;
- return reducer.multiply(i, d);
- }
-
-}
diff --git a/src/math/numbertheory/blinding.h b/src/math/numbertheory/blinding.h
deleted file mode 100644
index 5f7f9e6b7..000000000
--- a/src/math/numbertheory/blinding.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-* Blinder
-* (C) 1999-2007 Jack Lloyd
-*
-* Distributed under the terms of the Botan license
-*/
-
-#ifndef BOTAN_BLINDER_H__
-#define BOTAN_BLINDER_H__
-
-#include <botan/bigint.h>
-#include <botan/reducer.h>
-
-namespace Botan {
-
-/*
-* Blinding Function Object
-*/
-class BOTAN_DLL Blinder
- {
- public:
- BigInt blind(const BigInt&) const;
- BigInt unblind(const BigInt&) const;
-
- Blinder() {}
- Blinder(const BigInt&, const BigInt&, const BigInt&);
- private:
- Modular_Reducer reducer;
- mutable BigInt e, d;
- };
-
-}
-
-#endif
diff --git a/src/math/numbertheory/info.txt b/src/math/numbertheory/info.txt
index 58851e055..18349ef78 100644
--- a/src/math/numbertheory/info.txt
+++ b/src/math/numbertheory/info.txt
@@ -3,7 +3,6 @@ load_on auto
define BIGINT_MATH
<header:public>
-blinding.h
curve_gfp.h
numthry.h
point_gfp.h
@@ -16,7 +15,6 @@ def_powm.h
</header:internal>
<source>
-blinding.cpp
dsa_gen.cpp
jacobi.cpp
make_prm.cpp