163 /* A = qx * pz^2, B = qy * pz^3 */ |
163 /* A = qx * pz^2, B = qy * pz^3 */ |
164 MP_CHECKOK(group->meth->field_sqr(pz, A, group->meth)); |
164 MP_CHECKOK(group->meth->field_sqr(pz, A, group->meth)); |
165 MP_CHECKOK(group->meth->field_mul(A, pz, B, group->meth)); |
165 MP_CHECKOK(group->meth->field_mul(A, pz, B, group->meth)); |
166 MP_CHECKOK(group->meth->field_mul(A, qx, A, group->meth)); |
166 MP_CHECKOK(group->meth->field_mul(A, qx, A, group->meth)); |
167 MP_CHECKOK(group->meth->field_mul(B, qy, B, group->meth)); |
167 MP_CHECKOK(group->meth->field_mul(B, qy, B, group->meth)); |
|
168 |
|
169 /* |
|
170 * Additional checks for point equality and point at infinity |
|
171 */ |
|
172 if (mp_cmp(px, A) == 0 && mp_cmp(py, B) == 0) { |
|
173 /* POINT_DOUBLE(P) */ |
|
174 MP_CHECKOK(ec_GFp_pt_dbl_jm(px, py, pz, paz4, rx, ry, rz, raz4, |
|
175 scratch, group)); |
|
176 goto CLEANUP; |
|
177 } |
168 |
178 |
169 /* C = A - px, D = B - py */ |
179 /* C = A - px, D = B - py */ |
170 MP_CHECKOK(group->meth->field_sub(A, px, C, group->meth)); |
180 MP_CHECKOK(group->meth->field_sub(A, px, C, group->meth)); |
171 MP_CHECKOK(group->meth->field_sub(B, py, D, group->meth)); |
181 MP_CHECKOK(group->meth->field_sub(B, py, D, group->meth)); |
172 |
182 |