diff options
Diffstat (limited to 'eccrypto.cpp')
-rw-r--r-- | eccrypto.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/eccrypto.cpp b/eccrypto.cpp index 74cb95e..876ee79 100644 --- a/eccrypto.cpp +++ b/eccrypto.cpp @@ -535,10 +535,11 @@ bool DL_GroupParameters_EC<EC>::ValidateElement(unsigned int level, const Elemen if (gpc) pass = pass && gpc->Exponentiate(this->GetGroupPrecomputation(), Integer::One()) == g; } - if (level >= 2) + if (level >= 2 && pass) { const Integer &q = GetSubgroupOrder(); - pass = pass && IsIdentity(gpc ? gpc->Exponentiate(this->GetGroupPrecomputation(), q) : ExponentiateElement(g, q)); + Element gq = gpc ? gpc->Exponentiate(this->GetGroupPrecomputation(), q) : ExponentiateElement(g, q); + pass = pass && IsIdentity(gq); } return pass; } |