aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-04 17:46:28 +0000
committerlloyd <[email protected]>2010-03-04 17:46:28 +0000
commit996a01840a7cc920c430a32ffb2a59498055187e (patch)
tree0d45740daf70efd7a4c365e1e0172512dbb44352
parent19853ce387c62b220b90019674251b334b823823 (diff)
Cleanups
-rw-r--r--src/pubkey/if_algo/if_algo.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/pubkey/if_algo/if_algo.cpp b/src/pubkey/if_algo/if_algo.cpp
index f793789cf..1acbad02c 100644
--- a/src/pubkey/if_algo/if_algo.cpp
+++ b/src/pubkey/if_algo/if_algo.cpp
@@ -94,7 +94,7 @@ IF_Scheme_PrivateKey::IF_Scheme_PrivateKey(RandomNumberGenerator& rng,
q = prime2;
e = exp;
d = d_exp;
- n = mod;
+ n = mod.is_nonzero() ? mod : p * q;
if(d == 0)
{
@@ -105,10 +105,9 @@ IF_Scheme_PrivateKey::IF_Scheme_PrivateKey(RandomNumberGenerator& rng,
d = inverse_mod(e, inv_for_d);
}
- if(n == 0) n = p * q;
- if(d1 == 0) d1 = d % (p - 1);
- if(d2 == 0) d2 = d % (q - 1);
- if(c == 0) c = inverse_mod(q, p);
+ d1 = d % (p - 1);
+ d2 = d % (q - 1);
+ c = inverse_mod(q, p);
core = IF_Core(rng, e, n, d, p, q, d1, d2, c);