-2021-11-06 Niels Möller <nisse@lysator.liu.se>
+2021-11-07 Niels Möller <nisse@lysator.liu.se>
+
+ * ecc-internal.h (struct ecc_modulo): Renamed sqrt_itch to
+ sqrt_ratio_itch.
+ * eddsa-decompress.c (_eddsa_decompress_itch): Updated.
+
+ * ecc-curve448.c (ECC_CURVE448_SQRT_RATIO_ITCH): Renamed, from ...
+ (ECC_CURVE448_SQRT_ITCH): ... old name.
+ (ecc_curve448_sqrt_ratio): Renamed, from ...
+ (ecc_curve448_sqrt): ... old name.
+ (_nettle_curve448): Updated.
+
+ * ecc-curve25519.c (ECC_25519_SQRT_RATIO_ITCH): Renamed, from ...
+ (ECC_25519_SQRT_ITCH): ... old name
+ (ecc_curve25519_sqrt_ratio): Renamed, from ...
+ (ecc_curve25519_sqrt): ... old name.
+ (_nettle_curve25519): Updated.
* ecc-internal.h (ecc_mod_sqrt_ratio_func): Renamed typedef...
(ecc_mod_sqrt_func): ... from old name.
#endif
/* Needs 2*n space + scratch for ecc_mod_pow_252m3. */
-#define ECC_25519_SQRT_ITCH (6*ECC_LIMB_SIZE)
+#define ECC_25519_SQRT_RATIO_ITCH (6*ECC_LIMB_SIZE)
static int
-ecc_curve25519_sqrt(const struct ecc_modulo *p, mp_limb_t *rp,
- const mp_limb_t *up, const mp_limb_t *vp,
- mp_limb_t *scratch)
+ecc_curve25519_sqrt_ratio(const struct ecc_modulo *p, mp_limb_t *rp,
+ const mp_limb_t *up, const mp_limb_t *vp,
+ mp_limb_t *scratch)
{
int pos, neg;
ECC_BMODP_SIZE,
0,
ECC_25519_INV_ITCH,
- ECC_25519_SQRT_ITCH,
+ ECC_25519_SQRT_RATIO_ITCH,
ecc_p,
ecc_Bmodp,
ecc_curve25519_modp,
ecc_curve25519_modp,
ecc_curve25519_inv,
- ecc_curve25519_sqrt,
+ ecc_curve25519_sqrt_ratio,
},
{
253,
*/
/* Needs 2*n space + scratch for ecc_mod_pow_446m224m1. */
-#define ECC_CURVE448_SQRT_ITCH (6*ECC_LIMB_SIZE)
+#define ECC_CURVE448_SQRT_RATIO_ITCH (6*ECC_LIMB_SIZE)
static int
-ecc_curve448_sqrt(const struct ecc_modulo *p, mp_limb_t *rp,
- const mp_limb_t *up, const mp_limb_t *vp,
- mp_limb_t *scratch)
+ecc_curve448_sqrt_ratio(const struct ecc_modulo *p, mp_limb_t *rp,
+ const mp_limb_t *up, const mp_limb_t *vp,
+ mp_limb_t *scratch)
{
#define uv scratch
#define u3v (scratch + ECC_LIMB_SIZE)
ECC_BMODP_SIZE,
0,
ECC_CURVE448_INV_ITCH,
- ECC_CURVE448_SQRT_ITCH,
+ ECC_CURVE448_SQRT_RATIO_ITCH,
ecc_p,
ecc_Bmodp,
ecc_curve448_modp,
ecc_curve448_modp,
ecc_curve448_inv,
- ecc_curve448_sqrt,
+ ecc_curve448_sqrt_ratio,
},
{
446,
mp_limb_t *vp, const mp_limb_t *ap,
mp_limb_t *scratch);
-/* Computes the square root of (u/v) (mod p) */
+/* Computes the square root of (u/v) (mod p). */
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,
unsigned short B_size;
unsigned short redc_size;
unsigned short invert_itch;
- unsigned short sqrt_itch;
+ unsigned short sqrt_ratio_itch;
const mp_limb_t *m;
/* B^size mod m. Expected to have at least 32 leading zeros
The following entries differ by powers of 2^{kc},
T[i] = 2^{kc} T[i-2^c]
- */
+ */
const mp_limb_t *pippenger_table;
};
ecc_mod_inv_func ecc_mod_inv;
/* Side channel silent. Requires that x < 2m, so checks if x == 0 or x == p */
-int ecc_mod_zero_p (const struct ecc_modulo *m, const mp_limb_t *xp);
+int
+ecc_mod_zero_p (const struct ecc_modulo *m, const mp_limb_t *xp);
void
ecc_mod_add (const struct ecc_modulo *m, mp_limb_t *rp,
P = Q != 0 Duplication of non-zero point
P = 0, Q != 0 or P != 0, Q = 0 One input zero
-
+
Correctly gives R = 0 if P = Q = 0 or P = -Q. */
void
ecc_add_jja (const struct ecc_curve *ecc,
/* Computes N * the group generator. N is an array of ecc_size()
limbs. It must be in the range 0 < N < group order, then R != 0,
and the algorithm can work without any intermediate values getting
- to zero. */
+ to zero. */
void
ecc_mul_g (const struct ecc_curve *ecc, mp_limb_t *r,
const mp_limb_t *np, mp_limb_t *scratch);
mp_size_t
_eddsa_decompress_itch (const struct ecc_curve *ecc)
{
- return 4*ecc->p.size + ecc->p.sqrt_itch;
+ return 4*ecc->p.size + ecc->p.sqrt_ratio_itch;
}
int
up = xalloc_limbs (m->size);
vp = xalloc_limbs (m->size);
rp = xalloc_limbs (2*m->size);
- scratch = xalloc_limbs (m->sqrt_itch);
+ scratch = xalloc_limbs (m->sqrt_ratio_itch);
/* Find a non-square */
for (z = 2; mpz_ui_kronecker (z, p) != -1; z++)