summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2021-11-06 16:38:41 +0100
committerNiels Möller <nisse@lysator.liu.se>2021-11-06 16:38:41 +0100
commit03421be19e7b953bb3334044a4f1e7b14286cf46 (patch)
tree84676bbd542d79a37dd8dfedc554c3217edab905
parente519fbf8ffcc354389b0180389f4b7c07c692e70 (diff)
downloadnettle-03421be19e7b953bb3334044a4f1e7b14286cf46.tar.gz
Rename ecc sqrt --> sqrt_ratio.
* 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.
-rw-r--r--ChangeLog7
-rw-r--r--ecc-internal.h10
-rw-r--r--eddsa-decompress.c2
-rw-r--r--testsuite/ecc-sqrt-test.c6
4 files changed, 16 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 02ffdc81..4af1e650 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+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.
diff --git a/ecc-internal.h b/ecc-internal.h
index 76f505e8..4d2d8f41 100644
--- a/ecc-internal.h
+++ b/ecc-internal.h
@@ -126,10 +126,10 @@ typedef void ecc_mod_inv_func (const struct ecc_modulo *m,
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,
@@ -179,7 +179,7 @@ struct ecc_modulo
/* 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
diff --git a/eddsa-decompress.c b/eddsa-decompress.c
index dc92daa0..1708f16f 100644
--- a/eddsa-decompress.c
+++ b/eddsa-decompress.c
@@ -98,7 +98,7 @@ _eddsa_decompress (const struct ecc_curve *ecc, mp_limb_t *p,
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);
diff --git a/testsuite/ecc-sqrt-test.c b/testsuite/ecc-sqrt-test.c
index 90463faa..4c70677d 100644
--- a/testsuite/ecc-sqrt-test.c
+++ b/testsuite/ecc-sqrt-test.c
@@ -112,12 +112,12 @@ test_modulo (gmp_randstate_t rands, const struct ecc_modulo *m)
}
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",
@@ -165,7 +165,7 @@ test_main (void)
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);