* ecc-internal.h (ecc_mod_sqrt_ratio_func): Renamed typedef...
(ecc_mod_sqrt_func): ... from old name.
(struct ecc_modulo): Renamed corresponding function pointer to
sqrt_ratio. Updated all uses.
+2021-11-06 Niels Möller <nisse@lysator.liu.se>
+
+ * ecc-internal.h (ecc_mod_sqrt_ratio_func): Renamed typedef...
+ (ecc_mod_sqrt_func): ... from old name.
+ (struct ecc_modulo): Renamed corresponding function pointer to
+ sqrt_ratio. Updated all uses.
+
2021-10-26 Niels Möller <nisse@lysator.liu.se>
* ecc-mod-arith.c (ecc_mod_zero_p): New function.
mp_limb_t *scratch);
/* Computes the square root of (u/v) (mod p) */
-typedef int ecc_mod_sqrt_func (const struct ecc_modulo *m,
- mp_limb_t *rp,
- const mp_limb_t *up, const mp_limb_t *vp,
- mp_limb_t *scratch);
+typedef int ecc_mod_sqrt_ratio_func (const struct ecc_modulo *m,
+ mp_limb_t *rp,
+ const mp_limb_t *up, const mp_limb_t *vp,
+ mp_limb_t *scratch);
/* Allows in-place operation with r == p, but not r == q */
typedef void ecc_add_func (const struct ecc_curve *ecc,
/* For moduli where we use redc, the invert and sqrt functions work
with inputs and outputs in redc form. */
ecc_mod_inv_func *invert;
- ecc_mod_sqrt_func *sqrt;
+ ecc_mod_sqrt_ratio_func *sqrt_ratio;
};
/* Represents an elliptic curve of the form
ecc_mod_sub (&ecc->p, up, ecc->unit, y2);
else
ecc_mod_sub (&ecc->p, up, y2, ecc->unit);
- res &= ecc->p.sqrt (&ecc->p, tp, up, vp, scratch_out);
+ res &= ecc->p.sqrt_ratio (&ecc->p, tp, up, vp, scratch_out);
cy = mpn_sub_n (xp, tp, ecc->p.m, ecc->p.size);
cnd_copy (cy, xp, tp, ecc->p.size);
}
mpz_limbs_copy (up, u, m->size);
mpz_limbs_copy (vp, v, m->size);
- if (!m->sqrt (m, rp, up, vp, scratch))
+ if (!m->sqrt_ratio (m, rp, up, vp, scratch))
{
mpz_mul_ui (u, u, z);
mpz_mod (u, u, p);
mpz_limbs_copy (up, u, m->size);
- if (!m->sqrt (m, rp, up, vp, scratch))
+ if (!m->sqrt_ratio (m, rp, up, vp, scratch))
{
fprintf (stderr, "m->sqrt returned failure, bit_size = %d\n"
"u = 0x",
gmp_randinit_default (rands);
for (i = 0; ecc_curves[i]; i++)
{
- if (ecc_curves[i]->p.sqrt)
+ if (ecc_curves[i]->p.sqrt_ratio)
test_modulo (rands, &ecc_curves[i]->p);
}
gmp_randclear (rands);