diff options
author | lloyd <[email protected]> | 2008-06-27 13:54:26 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-06-27 13:54:26 +0000 |
commit | d1bc1ae91003bc10b46b0d1e38f0ac64080b4c81 (patch) | |
tree | 91ff95415bdff3aa8405b9ba377984d11e333b37 /src | |
parent | 1b4a1cd7b3e74bd3d3c34c6c89721536a6fe3a27 (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')
-rw-r--r-- | src/if_algo.cpp | 2 | ||||
-rw-r--r-- | src/pk_core.cpp | 15 |
2 files changed, 12 insertions, 5 deletions
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); } } |