return (rc);
}
+static int eccompr(ec_curve *c, const ec *p)
+{
+ /* --- Just take the LSB of %$y$% ---
+ *
+ * Since @p@ is odd, either %$y$% or %$-y = p - y$% must be odd, so this
+ * disambiguates.
+ */
+
+ return (MP_ODDP(p->y));
+}
+
static void ecdestroy(ec_curve *c)
{
MP_DROP(c->a);
static const ec_ops ec_primeops = {
"prime",
ecdestroy, ec_stdsamep, ec_idin, ec_idout, ec_idfix,
- ecfind, ecneg, ecadd, ec_stdsub, ecdbl, eccheck
+ ecfind, ecneg, ecadd, ec_stdsub, ecdbl, eccheck, eccompr
};
static const ec_ops ec_primeprojops = {
"primeproj",
ecdestroy, ec_stdsamep, ec_projin, ec_projout, ec_projfix,
- ecfind, ecneg, ecprojadd, ec_stdsub, ecprojdbl, ecprojcheck
+ ecfind, ecneg, ecprojadd, ec_stdsub, ecprojdbl, ecprojcheck, eccompr
};
static const ec_ops ec_primeprojxops = {
"primeproj",
ecdestroy, ec_stdsamep, ec_projin, ec_projout, ec_projfix,
- ecfind, ecneg, ecprojadd, ec_stdsub, ecprojxdbl, ecprojcheck
+ ecfind, ecneg, ecprojadd, ec_stdsub, ecprojxdbl, ecprojcheck, eccompr
};
/*----- Test rig ----------------------------------------------------------*/