Lines Matching refs:P
188 static void ecp_sm2p256_point_double(P256_POINT *R, const P256_POINT *P) in ecp_sm2p256_point_double() argument
196 if (is_zeros(P->Z)) { in ecp_sm2p256_point_double()
203 ecp_sm2p256_sqr(tmp0, P->Z); in ecp_sm2p256_point_double()
204 ecp_sm2p256_sub(tmp1, P->X, tmp0); in ecp_sm2p256_point_double()
205 ecp_sm2p256_add(tmp0, P->X, tmp0); in ecp_sm2p256_point_double()
208 ecp_sm2p256_add(R->Y, P->Y, P->Y); in ecp_sm2p256_point_double()
209 ecp_sm2p256_mul(R->Z, R->Y, P->Z); in ecp_sm2p256_point_double()
211 ecp_sm2p256_mul(tmp2, R->Y, P->X); in ecp_sm2p256_point_double()
224 static void ecp_sm2p256_point_add_affine(P256_POINT *R, const P256_POINT *P, in ecp_sm2p256_point_add_affine() argument
234 if (is_zeros(P->Z)) { in ecp_sm2p256_point_add_affine()
245 ecp_sm2p256_sqr(tmp0, P->Z); in ecp_sm2p256_point_add_affine()
246 ecp_sm2p256_mul(tmp1, tmp0, P->Z); in ecp_sm2p256_point_add_affine()
249 ecp_sm2p256_sub(tmp0, tmp0, P->X); in ecp_sm2p256_point_add_affine()
250 ecp_sm2p256_sub(tmp1, tmp1, P->Y); in ecp_sm2p256_point_add_affine()
272 ecp_sm2p256_mul(R->Z, P->Z, tmp0); in ecp_sm2p256_point_add_affine()
275 ecp_sm2p256_mul(tmp2, tmp2, P->X); in ecp_sm2p256_point_add_affine()
282 ecp_sm2p256_mul(tmp3, tmp3, P->Y); in ecp_sm2p256_point_add_affine()
287 static void ecp_sm2p256_point_add(P256_POINT *R, const P256_POINT *P, in ecp_sm2p256_point_add() argument
296 if (is_zeros(P->Z)) { in ecp_sm2p256_point_add()
306 R->X[i] = P->X[i]; in ecp_sm2p256_point_add()
307 R->Y[i] = P->Y[i]; in ecp_sm2p256_point_add()
308 R->Z[i] = P->Z[i]; in ecp_sm2p256_point_add()
312 } else if (is_point_equal(P, Q)) { in ecp_sm2p256_point_add()
318 ecp_sm2p256_sqr(tmp0, P->Z); in ecp_sm2p256_point_add()
319 ecp_sm2p256_mul(tmp1, tmp0, P->Z); in ecp_sm2p256_point_add()
322 ecp_sm2p256_mul(R->Y, P->Y, Q->Z); in ecp_sm2p256_point_add()
323 ecp_sm2p256_mul(R->Z, Q->Z, P->Z); in ecp_sm2p256_point_add()
326 ecp_sm2p256_mul(R->X, tmp2, P->X); in ecp_sm2p256_point_add()
381 P256_POINT_AFFINE P) in ecp_sm2p256_point_P_mul_by_scalar() argument
393 memcpy(precomputed[1].X, P.X, 32); in ecp_sm2p256_point_P_mul_by_scalar()
394 memcpy(precomputed[1].Y, P.Y, 32); in ecp_sm2p256_point_P_mul_by_scalar()
405 ecp_sm2p256_point_add_affine(&precomputed[i], &precomputed[i - 1], &P); in ecp_sm2p256_point_P_mul_by_scalar()
428 const P256_POINT *P) in ecp_sm2p256_point_get_affine() argument
433 if (is_one(P->Z)) { in ecp_sm2p256_point_get_affine()
434 memcpy(R->X, P->X, 32); in ecp_sm2p256_point_get_affine()
435 memcpy(R->Y, P->Y, 32); in ecp_sm2p256_point_get_affine()
439 ecp_sm2p256_mod_inverse(z_inv3, P->Z); in ecp_sm2p256_point_get_affine()
441 ecp_sm2p256_mul(R->X, P->X, z_inv2); in ecp_sm2p256_point_get_affine()
443 ecp_sm2p256_mul(R->Y, P->Y, z_inv3); in ecp_sm2p256_point_get_affine()