]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Rename ecc sqrt --> sqrt_ratio.
authorNiels Möller <nisse@lysator.liu.se>
Sat, 6 Nov 2021 15:38:41 +0000 (16:38 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Sat, 6 Nov 2021 15:38:41 +0000 (16:38 +0100)
* 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.

ChangeLog
ecc-internal.h
eddsa-decompress.c
testsuite/ecc-sqrt-test.c

index 02ffdc8174d4cf9d616d33793e875a2a00de2905..4af1e650660414eedb98f2a761a0bd023b61f96e 100644 (file)
--- 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.
index 76f505e8c75349ee46389e63866ba87d38e6bdb4..4d2d8f4112d666ba47fe93377e5c2e5c081afce8 100644 (file)
@@ -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
index dc92daa07cbfb26f9e56c0160b0b170055d4752e..1708f16f492f92758e3224b09874a85469e64b4b 100644 (file)
@@ -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);
index 90463faadff0564ca8b8d07ace26bb95f22bd320..4c70677dfd5aab8f1a0241022342aec7df0cb688 100644 (file)
@@ -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);