Lines Matching refs:R
188 static void ecp_sm2p256_point_double(P256_POINT *R, const P256_POINT *P) in ecp_sm2p256_point_double() argument
198 R->Z[i] = 0; 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()
210 ecp_sm2p256_sqr(R->Y, R->Y); in ecp_sm2p256_point_double()
211 ecp_sm2p256_mul(tmp2, R->Y, P->X); in ecp_sm2p256_point_double()
212 ecp_sm2p256_sqr(R->Y, R->Y); in ecp_sm2p256_point_double()
213 ecp_sm2p256_div_by_2(R->Y, R->Y); in ecp_sm2p256_point_double()
214 ecp_sm2p256_sqr(R->X, tmp1); in ecp_sm2p256_point_double()
216 ecp_sm2p256_sub(R->X, R->X, tmp0); in ecp_sm2p256_point_double()
217 ecp_sm2p256_sub(tmp0, tmp2, R->X); in ecp_sm2p256_point_double()
219 ecp_sm2p256_sub(tmp1, tmp0, R->Y); in ecp_sm2p256_point_double()
220 memcpy(R->Y, tmp1, 32); 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
236 R->X[i] = Q->X[i]; in ecp_sm2p256_point_add_affine()
237 R->Y[i] = Q->Y[i]; in ecp_sm2p256_point_add_affine()
238 R->Z[i] = 0; in ecp_sm2p256_point_add_affine()
240 R->Z[0] = 1; in ecp_sm2p256_point_add_affine()
263 ecp_sm2p256_point_double(R, &K); in ecp_sm2p256_point_add_affine()
266 R->Z[i] = 0; in ecp_sm2p256_point_add_affine()
272 ecp_sm2p256_mul(R->Z, P->Z, tmp0); in ecp_sm2p256_point_add_affine()
277 ecp_sm2p256_sqr(R->X, tmp1); in ecp_sm2p256_point_add_affine()
278 ecp_sm2p256_sub(R->X, R->X, tmp0); in ecp_sm2p256_point_add_affine()
279 ecp_sm2p256_sub(R->X, R->X, tmp3); in ecp_sm2p256_point_add_affine()
280 ecp_sm2p256_sub(tmp2, tmp2, R->X); in ecp_sm2p256_point_add_affine()
283 ecp_sm2p256_sub(R->Y, tmp2, tmp3); 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
298 R->X[i] = Q->X[i]; in ecp_sm2p256_point_add()
299 R->Y[i] = Q->Y[i]; in ecp_sm2p256_point_add()
300 R->Z[i] = Q->Z[i]; 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()
313 ecp_sm2p256_point_double(R, Q); 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()
325 ecp_sm2p256_mul(R->Y, tmp2, R->Y); in ecp_sm2p256_point_add()
326 ecp_sm2p256_mul(R->X, tmp2, P->X); in ecp_sm2p256_point_add()
327 ecp_sm2p256_sub(tmp0, tmp0, R->X); in ecp_sm2p256_point_add()
328 ecp_sm2p256_mul(R->Z, tmp0, R->Z); in ecp_sm2p256_point_add()
329 ecp_sm2p256_sub(tmp1, tmp1, R->Y); in ecp_sm2p256_point_add()
332 ecp_sm2p256_mul(tmp2, tmp2, R->X); in ecp_sm2p256_point_add()
333 ecp_sm2p256_sqr(R->X, tmp1); in ecp_sm2p256_point_add()
334 ecp_sm2p256_sub(R->X, R->X, tmp2); in ecp_sm2p256_point_add()
335 ecp_sm2p256_sub(R->X, R->X, tmp2); in ecp_sm2p256_point_add()
336 ecp_sm2p256_sub(R->X, R->X, tmp0); in ecp_sm2p256_point_add()
337 ecp_sm2p256_sub(tmp2, tmp2, R->X); in ecp_sm2p256_point_add()
339 ecp_sm2p256_mul(tmp0, tmp0, R->Y); in ecp_sm2p256_point_add()
340 ecp_sm2p256_sub(R->Y, tmp2, tmp0); in ecp_sm2p256_point_add()
345 static void ecp_sm2p256_point_G_mul_by_scalar(P256_POINT *R, const BN_ULONG *k) in ecp_sm2p256_point_G_mul_by_scalar() argument
350 memset(R, 0, sizeof(P256_POINT)); in ecp_sm2p256_point_G_mul_by_scalar()
358 memcpy(R->X, ecp_sm2p256_precomputed + index, 32); in ecp_sm2p256_point_G_mul_by_scalar()
359 memcpy(R->Y, ecp_sm2p256_precomputed + index + P256_LIMBS, 32); in ecp_sm2p256_point_G_mul_by_scalar()
360 R->Z[0] = 1; in ecp_sm2p256_point_G_mul_by_scalar()
371 ecp_sm2p256_point_add_affine(R, R, &Q); in ecp_sm2p256_point_G_mul_by_scalar()
380 static void ecp_sm2p256_point_P_mul_by_scalar(P256_POINT *R, const BN_ULONG *k, in ecp_sm2p256_point_P_mul_by_scalar() argument
387 memset(R, 0, sizeof(P256_POINT)); in ecp_sm2p256_point_P_mul_by_scalar()
412 memcpy(R, &precomputed[index], sizeof(P256_POINT)); in ecp_sm2p256_point_P_mul_by_scalar()
416 ecp_sm2p256_point_double(R, R); in ecp_sm2p256_point_P_mul_by_scalar()
417 ecp_sm2p256_point_double(R, R); in ecp_sm2p256_point_P_mul_by_scalar()
418 ecp_sm2p256_point_double(R, R); in ecp_sm2p256_point_P_mul_by_scalar()
419 ecp_sm2p256_point_double(R, R); in ecp_sm2p256_point_P_mul_by_scalar()
421 ecp_sm2p256_point_add(R, R, &precomputed[index]); in ecp_sm2p256_point_P_mul_by_scalar()
427 static void ecp_sm2p256_point_get_affine(P256_POINT_AFFINE *R, in ecp_sm2p256_point_get_affine() argument
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()
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()