summaryrefslogtreecommitdiff
path: root/gfpcrypt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gfpcrypt.cpp')
-rw-r--r--gfpcrypt.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/gfpcrypt.cpp b/gfpcrypt.cpp
index a82c492..6d9ffce 100644
--- a/gfpcrypt.cpp
+++ b/gfpcrypt.cpp
@@ -148,8 +148,11 @@ bool DL_GroupParameters_IntegerBased::ValidateElement(unsigned int level, const
// and at most 1 bit is leaked if it's false
bool fullValidate = (GetFieldType() == 2 && level >= 3) || !FastSubgroupCheckAvailable();
- if (fullValidate)
- pass = pass && IsIdentity(gpc ? gpc->Exponentiate(GetGroupPrecomputation(), q) : ExponentiateElement(g, q));
+ if (fullValidate && pass)
+ {
+ Integer gp = gpc ? gpc->Exponentiate(GetGroupPrecomputation(), q) : ExponentiateElement(g, q);
+ pass = pass && IsIdentity(gp);
+ }
else if (GetFieldType() == 1)
pass = pass && Jacobi(g, p) == 1;
}