8 for (i = 0; ecc_curves[i]; i++)
10 const struct ecc_curve *ecc = ecc_curves[i];
11 mp_limb_t *g = xalloc_limbs (ecc_size_j (ecc));
12 mp_limb_t *g2 = xalloc_limbs (ecc_size_j (ecc));
13 mp_limb_t *g3 = xalloc_limbs (ecc_size_j (ecc));
14 mp_limb_t *p = xalloc_limbs (ecc_size_j (ecc));
15 mp_limb_t *scratch = xalloc_limbs (ECC_ADD_JJJ_ITCH(ecc->p.size));
17 if (ecc->p.bit_size == 255)
19 mp_limb_t *z = xalloc_limbs (ecc_size_j (ecc));
20 /* Zero point has x = 0, y = 1, z = 1 */
21 mpn_zero (z, 3*ecc->p.size);
22 z[ecc->p.size] = z[2*ecc->p.size] = 1;
24 ecc_a_to_j (ecc, g, ecc->g);
26 ecc_add_ehh (ecc, p, z, z, scratch);
27 test_ecc_mul_h (i, 0, p);
29 ecc_add_eh (ecc, p, z, z, scratch);
30 test_ecc_mul_h (i, 0, p);
32 ecc_add_ehh (ecc, p, g, p, scratch);
33 test_ecc_mul_h (i, 1, p);
35 ecc_add_eh (ecc, p, z, g, scratch);
36 test_ecc_mul_h (i, 1, p);
38 ecc_add_ehh (ecc, g2, g, p, scratch);
39 test_ecc_mul_h (i, 2, g2);
41 ecc_add_eh (ecc, g2, g, g, scratch);
42 test_ecc_mul_h (i, 2, g2);
44 ecc_add_ehh (ecc, g3, g, g2, scratch);
45 test_ecc_mul_h (i, 3, g3);
47 ecc_add_eh (ecc, g3, g2, g, scratch);
48 test_ecc_mul_h (i, 3, g3);
50 ecc_add_ehh (ecc, p, g, g3, scratch);
51 test_ecc_mul_h (i, 4, p);
53 ecc_add_eh (ecc, p, g3, g, scratch);
54 test_ecc_mul_h (i, 4, p);
56 ecc_add_ehh (ecc, p, g2, g2, scratch);
57 test_ecc_mul_h (i, 4, p);
63 ecc_a_to_j (ecc, g, ecc->g);
65 ecc_dup_jj (ecc, g2, g, scratch);
66 test_ecc_mul_h (i, 2, g2);
68 ecc_add_jjj (ecc, g3, g, g2, scratch);
69 test_ecc_mul_h (i, 3, g3);
71 ecc_add_jjj (ecc, g3, g2, g, scratch);
72 test_ecc_mul_h (i, 3, g3);
74 ecc_add_jjj (ecc, p, g, g3, scratch);
75 test_ecc_mul_h (i, 4, p);
77 ecc_add_jjj (ecc, p, g3, g, scratch);
78 test_ecc_mul_h (i, 4, p);
80 ecc_dup_jj (ecc, p, g2, scratch);
81 test_ecc_mul_h (i, 4, p);