aboutsummaryrefslogtreecommitdiffstats
path: root/src/pk_core.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-06-27 13:54:26 +0000
committerlloyd <[email protected]>2008-06-27 13:54:26 +0000
commitd1bc1ae91003bc10b46b0d1e38f0ac64080b4c81 (patch)
tree91ff95415bdff3aa8405b9ba377984d11e333b37 /src/pk_core.cpp
parent1b4a1cd7b3e74bd3d3c34c6c89721536a6fe3a27 (diff)
Split IF_Core constructor into two, one for public keys and one for private.
Public version doesn't need an RNG argument.
Diffstat (limited to 'src/pk_core.cpp')
-rw-r--r--src/pk_core.cpp15
1 files changed, 11 insertions, 4 deletions
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);
}
}