aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/math/numbertheory/monty.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-07-03 12:14:53 -0400
committerJack Lloyd <[email protected]>2018-07-31 16:15:08 -0400
commit6f86811b1deec35c96fb97bac2d5ec60630a28d7 (patch)
tree6f53f6020473c567e95f623ca89b95a72e0edd7f /src/lib/math/numbertheory/monty.cpp
parentc1a423591da7c48bbe9357a8ca5b2361c6f33c40 (diff)
Add Lucas test from FIPS 186-4
This eliminates an issue identified in the paper "Prime and Prejudice: Primality Testing Under Adversarial Conditions" by Albrecht, Massimo, Paterson and Somorovsky where DL_Group::verify_group with strong=false would accept a composite q with probability 1/4096, which is exactly as the error bound is documented, but still unfortunate.
Diffstat (limited to 'src/lib/math/numbertheory/monty.cpp')
-rw-r--r--src/lib/math/numbertheory/monty.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/math/numbertheory/monty.cpp b/src/lib/math/numbertheory/monty.cpp
index b91560fd5..61a10eae5 100644
--- a/src/lib/math/numbertheory/monty.cpp
+++ b/src/lib/math/numbertheory/monty.cpp
@@ -13,7 +13,7 @@ namespace Botan {
Montgomery_Params::Montgomery_Params(const BigInt& p,
const Modular_Reducer& mod_p)
{
- if(p.is_negative() || p.is_even())
+ if(p.is_even() || p < 3)
throw Invalid_Argument("Montgomery_Params invalid modulus");
m_p = p;