aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/pk_core.h7
-rw-r--r--src/if_algo.cpp2
-rw-r--r--src/pk_core.cpp15
3 files changed, 17 insertions, 7 deletions
diff --git a/include/pk_core.h b/include/pk_core.h
index 78fc49314..d28e2315e 100644
--- a/include/pk_core.h
+++ b/include/pk_core.h
@@ -27,10 +27,13 @@ class BOTAN_DLL 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& = 0, const BigInt& = 0, const BigInt& = 0,
- const BigInt& = 0, const BigInt& = 0, const BigInt& = 0);
+ const BigInt&, const BigInt&, const BigInt&,
+ const BigInt&, const BigInt&, const BigInt&);
+
~IF_Core() { delete op; }
private:
IF_Operation* op;
diff --git a/src/if_algo.cpp b/src/if_algo.cpp
index e2178e5f1..072822f2a 100644
--- a/src/if_algo.cpp
+++ b/src/if_algo.cpp
@@ -162,7 +162,7 @@ PKCS8_Decoder* IF_Scheme_PrivateKey::pkcs8_decoder(RandomNumberGenerator& rng)
*************************************************/
void IF_Scheme_PublicKey::X509_load_hook(RandomNumberGenerator& rng)
{
- core = IF_Core(rng, e, n);
+ core = IF_Core(e, n);
load_check(rng);
}
diff --git a/src/pk_core.cpp b/src/pk_core.cpp
index 788190477..200e5c964 100644
--- a/src/pk_core.cpp
+++ b/src/pk_core.cpp
@@ -21,6 +21,15 @@ 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,
@@ -28,12 +37,10 @@ IF_Core::IF_Core(RandomNumberGenerator& rng,
{
op = Engine_Core::if_op(e, n, d, p, q, d1, d2, c);
- if(d != 0)
+ if(BLINDING_BITS)
{
BigInt k(rng, std::min(n.bits()-1, BLINDING_BITS));
-
- if(k != 0)
- blinder = Blinder(power_mod(k, e, n), inverse_mod(k, n), n);
+ blinder = Blinder(power_mod(k, e, n), inverse_mod(k, n), n);
}
}