summaryrefslogtreecommitdiff
path: root/ecc-j-to-a.c
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2014-09-23 13:14:02 +0200
committerNiels Möller <nisse@lysator.liu.se>2014-09-23 13:14:02 +0200
commita3328c58174827dbec966748a074db439d8e151a (patch)
treeb7a724adcbd13eabf2c79cbfbc81b9378ba7e14f /ecc-j-to-a.c
parent64b9a7f8b361db607a64fd1366dc74f1b73da1e9 (diff)
downloadnettle-a3328c58174827dbec966748a074db439d8e151a.tar.gz
ecc_mod_inv interface and allocation changes.
Diffstat (limited to 'ecc-j-to-a.c')
-rw-r--r--ecc-j-to-a.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/ecc-j-to-a.c b/ecc-j-to-a.c
index 8c52eb36..2e48b94d 100644
--- a/ecc-j-to-a.c
+++ b/ecc-j-to-a.c
@@ -52,7 +52,7 @@ ecc_j_to_a (const struct ecc_curve *ecc,
mp_limb_t *scratch)
{
#define izp scratch
-#define up (scratch + ecc->p.size)
+#define up (scratch + 2*ecc->p.size)
#define iz2p (scratch + ecc->p.size)
#define iz3p (scratch + 2*ecc->p.size)
#define izBp (scratch + 3*ecc->p.size)
@@ -65,10 +65,7 @@ ecc_j_to_a (const struct ecc_curve *ecc,
/* Set v = (r_z / B^2)^-1,
r_x = p_x v^2 / B^3 = ((v/B * v)/B * p_x)/B
- r_y = p_y v^3 / B^4 = (((v/B * v)/B * v)/B * p_x)/B
-
- Skip the first redc, if we want to stay in Montgomery
- representation.
+ r_y = p_y v^3 / B^4 = (((v/B * v)/B * v)/B * p_y)/B
*/
mpn_copyi (up, p + 2*ecc->p.size, ecc->p.size);