curve448-eh-to-x.c (nettle-3.7.1) | : | curve448-eh-to-x.c (nettle-3.7.2) | ||
---|---|---|---|---|

skipping to change at line 55 | skipping to change at line 55 | |||

Montgomery curve, and return the x coordinate. */ | Montgomery curve, and return the x coordinate. */ | |||

void | void | |||

curve448_eh_to_x (mp_limb_t *xp, const mp_limb_t *p, mp_limb_t *scratch) | curve448_eh_to_x (mp_limb_t *xp, const mp_limb_t *p, mp_limb_t *scratch) | |||

{ | { | |||

#define up p | #define up p | |||

#define vp (p + ecc->p.size) | #define vp (p + ecc->p.size) | |||

#define t0 scratch | #define t0 scratch | |||

#define tp (scratch + ecc->p.size) | #define tp (scratch + ecc->p.size) | |||

const struct ecc_curve *ecc = &_nettle_curve448; | const struct ecc_curve *ecc = &_nettle_curve448; | |||

mp_limb_t cy; | ||||

/* If u = U/W and v = V/W are the coordinates of the point on | /* If u = U/W and v = V/W are the coordinates of the point on | |||

edwards448 we get the curve448 x coordinate as | edwards448 we get the curve448 x coordinate as | |||

x = v^2 / u^2 = (V/W)^2 / (U/W)^2 = (V/U)^2 | x = v^2 / u^2 = (V/W)^2 / (U/W)^2 = (V/U)^2 | |||

*/ | */ | |||

/* Needs a total of 5*size storage. */ | /* Needs a total of 5*size storage. */ | |||

ecc->p.invert (&ecc->p, t0, up, tp); | ecc->p.invert (&ecc->p, t0, up, tp); | |||

ecc_mod_mul (&ecc->p, t0, t0, vp, tp); | ecc_mod_mul (&ecc->p, t0, t0, vp, tp); | |||

ecc_mod_sqr (&ecc->p, t0, t0, tp); | ecc_mod_sqr_canonical (&ecc->p, xp, t0, tp); | |||

cy = mpn_sub_n (xp, t0, ecc->p.m, ecc->p.size); | ||||

cnd_copy (cy, xp, t0, ecc->p.size); | ||||

#undef up | #undef up | |||

#undef vp | #undef vp | |||

#undef t0 | #undef t0 | |||

#undef tp | #undef tp | |||

} | } | |||

End of changes. 3 change blocks. | ||||

4 lines changed or deleted | | 1 lines changed or added |