19 fp_t A_times_one_third, A_squared, C_squared;
20 fp_t t, r, s, u, aux, tmp, y;
21 fp_t s0, s1, s2, s0_squared, v;
26 fp_mul(A_times_one_third, ONE_THIRD, input_A[0]);
28 fp_sqr(A_squared, input_A[0]);
30 fp_sqr(C_squared, input_A[1]);
33 fp_add(t, C_squared, C_squared);
39 fp_mul(r, A_squared, input_A[0]);
47 fp_add(s, A_times_one_third, A_times_one_third);
59 fp_add(y, C_squared, C_squared);
88 fp_mul(tmp, v, s0_squared);
104 fp_sub(t, s1, s0_squared);
107 fp_sub(r, s1, s0_squared);
110 fp_add(s, s2, s0_squared);
112 fp_sub(u, s0_squared, s2);
116 fp_cset(output[0], t, -test_s1);
117 fp_cset(output[1], r, -test_s1);
118 fp_cset(output[0], s, -test_s2);
119 fp_cset(output[1], u, -test_s2);
122 fp_mul(output[2], s0, input_A[1]);
123 fp_mul(aux, s0, A_times_one_third);
124 fp_sub(output[0], output[0], aux);
125 fp_sub(output[1], output[1], aux);
130 fp_mul(v, input_A[1], output[0]);
131 fp_mul(t, output[2], input_A[0]);
133 fp_mul(aux, s, output[2]);
134 fp_mul(aux, aux, input_A[1]);
141 fp_cswap(output[0], output[1], -test_sqr);
145 fp_t r_squared, s_squared, r_cubed;
146 fp_t aux, alpha_cubed, alpha, rd;
151 fp_sqr(r_squared, input_t[0]);
153 fp_sqr(s_squared, input_t[1]);
155 fp_mul(r_cubed, r_squared, input_t[0]);
157 fp_mul(output_A[1], s_squared, input_t[1]);
159 fp_mul(aux, s_squared, input_t[0]);
162 fp_sub(alpha_cubed, r_squared, s_squared);
163 fp_mul(alpha_cubed, alpha_cubed, input_t[0]);
169 fp_mul(rd, input_t[0], alpha);
170 fp_add(rd, rd, r_squared);
174 fp_add(r_squared, rd, rd);
175 fp_add(rd, rd, r_squared);
179 fp_mul(r_squared, s_squared, alpha);
180 fp_sub(output_A[0], rd, r_squared);