Lines Matching refs:p
62 static void point_double_internal(curve448_point_t p, const curve448_point_t q, in point_double_internal() argument
70 gf_add_nr(p->t, q->y, q->x); /* 2+e */ in point_double_internal()
71 ossl_gf_sqr(b, p->t); in point_double_internal()
73 gf_sub_nr(p->t, a, c); /* 3+e */ in point_double_internal()
74 ossl_gf_sqr(p->x, q->z); in point_double_internal()
75 gf_add_nr(p->z, p->x, p->x); /* 2+e */ in point_double_internal()
76 gf_subx_nr(a, p->z, p->t, 4); /* 6+e */ in point_double_internal()
79 ossl_gf_mul(p->x, a, b); in point_double_internal()
80 ossl_gf_mul(p->z, p->t, a); in point_double_internal()
81 ossl_gf_mul(p->y, p->t, d); in point_double_internal()
83 ossl_gf_mul(p->t, b, d); in point_double_internal()
86 void ossl_curve448_point_double(curve448_point_t p, const curve448_point_t q) in ossl_curve448_point_double() argument
88 point_double_internal(p, q, 0); in ossl_curve448_point_double()
168 static void add_pniels_to_pt(curve448_point_t p, const pniels_t pn, in add_pniels_to_pt() argument
173 ossl_gf_mul(L0, p->z, pn->z); in add_pniels_to_pt()
174 gf_copy(p->z, L0); in add_pniels_to_pt()
175 add_niels_to_pt(p, pn->n, before_double); in add_pniels_to_pt()
178 static void sub_pniels_from_pt(curve448_point_t p, const pniels_t pn, in sub_pniels_from_pt() argument
183 ossl_gf_mul(L0, p->z, pn->z); in sub_pniels_from_pt()
184 gf_copy(p->z, L0); in sub_pniels_from_pt()
185 sub_niels_from_pt(p, pn->n, before_double); in sub_pniels_from_pt()
189 ossl_curve448_point_eq(const curve448_point_t p, in ossl_curve448_point_eq() argument
196 ossl_gf_mul(a, p->y, q->x); in ossl_curve448_point_eq()
197 ossl_gf_mul(b, q->y, p->x); in ossl_curve448_point_eq()
204 ossl_curve448_point_valid(const curve448_point_t p) in ossl_curve448_point_valid() argument
209 ossl_gf_mul(a, p->x, p->y); in ossl_curve448_point_valid()
210 ossl_gf_mul(b, p->z, p->t); in ossl_curve448_point_valid()
212 ossl_gf_sqr(a, p->x); in ossl_curve448_point_valid()
213 ossl_gf_sqr(b, p->y); in ossl_curve448_point_valid()
215 ossl_gf_sqr(b, p->t); in ossl_curve448_point_valid()
217 ossl_gf_sqr(b, p->z); in ossl_curve448_point_valid()
220 out &= ~gf_eq(p->z, ZERO); in ossl_curve448_point_valid()
282 const curve448_point_t p) in ossl_curve448_point_mul_by_ratio_and_encode_like_eddsa() argument
288 curve448_point_copy(q, p); in ossl_curve448_point_mul_by_ratio_and_encode_like_eddsa()
329 curve448_point_t p, in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio() argument
341 succ = gf_deserialize(p->y, enc2, 1, 0); in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
344 ossl_gf_sqr(p->x, p->y); in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
345 gf_sub(p->z, ONE, p->x); /* num = 1-y^2 */ in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
346 gf_mulw(p->t, p->x, EDWARDS_D); /* dy^2 */ in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
347 gf_sub(p->t, ONE, p->t); /* denom = 1-dy^2 or 1-d + dy^2 */ in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
349 ossl_gf_mul(p->x, p->z, p->t); in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
350 succ &= gf_isr(p->t, p->x); /* 1/sqrt(num * denom) */ in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
352 ossl_gf_mul(p->x, p->t, p->z); /* sqrt(num / denom) */ in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
353 gf_cond_neg(p->x, gf_lobit(p->x) ^ low); in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
354 gf_copy(p->z, ONE); in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
360 ossl_gf_sqr(c, p->x); in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
361 ossl_gf_sqr(a, p->y); in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
363 gf_add(p->t, p->y, p->x); in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
364 ossl_gf_sqr(b, p->t); in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
366 gf_sub(p->t, a, c); in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
367 ossl_gf_sqr(p->x, p->z); in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
368 gf_add(p->z, p->x, p->x); in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
369 gf_sub(a, p->z, d); in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
370 ossl_gf_mul(p->x, a, b); in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
371 ossl_gf_mul(p->z, p->t, a); in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
372 ossl_gf_mul(p->y, p->t, d); in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
373 ossl_gf_mul(p->t, b, d); in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
381 assert(ossl_curve448_point_valid(p) || ~succ); in ossl_curve448_point_decode_like_eddsa_and_mul_by_ratio()
469 const curve448_point_t p) in ossl_curve448_point_mul_by_ratio_and_encode_like_x448() argument
473 curve448_point_copy(q, p); in ossl_curve448_point_mul_by_ratio_and_encode_like_x448()
487 curve448_point_t p; in ossl_x448_derive_public_key() local
502 ossl_curve448_precomputed_scalarmul(p, ossl_curve448_precomputed_base, in ossl_x448_derive_public_key()
504 ossl_curve448_point_mul_by_ratio_and_encode_like_x448(out, p); in ossl_x448_derive_public_key()
505 ossl_curve448_point_destroy(p); in ossl_x448_derive_public_key()