update CheckMOVCondition() according to http://eprint.iacr.org/2007/343
parent
800bd3ad85
commit
8edb9adc83
|
|
@ -46,11 +46,15 @@ static inline Integer ConvertToInteger(const Integer &x)
|
|||
|
||||
static bool CheckMOVCondition(const Integer &q, const Integer &r)
|
||||
{
|
||||
// see "Updated standards for validating elliptic curves", http://eprint.iacr.org/2007/343
|
||||
Integer t = 1;
|
||||
unsigned int n=q.BitCount(), m=r.BitCount();
|
||||
unsigned int n = q.IsEven() ? 1 : q.BitCount(), m = r.BitCount();
|
||||
|
||||
for (unsigned int i=n; DiscreteLogWorkFactor(i)<m/2; i+=n)
|
||||
{
|
||||
if (q.IsEven())
|
||||
t = (t+t)%r;
|
||||
else
|
||||
t = (t*q)%r;
|
||||
if (t == 1)
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -658,10 +658,10 @@ bool ValidateEC2N()
|
|||
#if 0 // TODO: turn this back on when I make EC2N faster for pentanomial basis
|
||||
cout << "Testing SEC 2 recommended curves..." << endl;
|
||||
OID oid;
|
||||
while (!(oid = ECParameters<EC2N>::GetNextRecommendedParametersOID(oid)).m_values.empty())
|
||||
while (!(oid = DL_GroupParameters_EC<EC2N>::GetNextRecommendedParametersOID(oid)).m_values.empty())
|
||||
{
|
||||
ECParameters<EC2N> params(oid);
|
||||
bool fail = !params.ValidateParameters(GlobalRNG());
|
||||
DL_GroupParameters_EC<EC2N> params(oid);
|
||||
bool fail = !params.Validate(GlobalRNG(), 2);
|
||||
cout << (fail ? "FAILED" : "passed") << " " << params.GetCurve().GetField().MaxElementBitLength() << " bits" << endl;
|
||||
pass = pass && !fail;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue