diff options
author | lloyd <[email protected]> | 2014-04-25 00:37:28 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-04-25 00:37:28 +0000 |
commit | b9bee0898aed28bfaf560f85cd63d1534813c257 (patch) | |
tree | 888350b90fffaf2a1cf9e42441b9dfda3df5cabc /src/lib/pubkey/if_algo/if_algo.cpp | |
parent | 6c0912310f611286cd28b06a45e5dca8899ac04d (diff) |
Any fixed MR iterations is probably wrong for somebody. Allow the user
to specify a probability as well as if n was randomly chosen or not.
If the input is random use a better bounds to reduce the number of
needed tests.
Diffstat (limited to 'src/lib/pubkey/if_algo/if_algo.cpp')
-rw-r--r-- | src/lib/pubkey/if_algo/if_algo.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/pubkey/if_algo/if_algo.cpp b/src/lib/pubkey/if_algo/if_algo.cpp index f6aeb69db..339c4e317 100644 --- a/src/lib/pubkey/if_algo/if_algo.cpp +++ b/src/lib/pubkey/if_algo/if_algo.cpp @@ -130,12 +130,12 @@ bool IF_Scheme_PrivateKey::check_key(RandomNumberGenerator& rng, if(n < 35 || n.is_even() || e < 2 || d < 2 || p < 3 || q < 3 || p*q != n) return false; - if(!strong) - return true; - if(d1 != d % (p - 1) || d2 != d % (q - 1) || c != inverse_mod(q, p)) return false; - if(!check_prime(p, rng) || !check_prime(q, rng)) + + const size_t prob = (strong) ? 56 : 12; + + if(!is_prime(p, rng, prob) || !is_prime(q, rng, prob)) return false; return true; } |