Lines Matching refs:group
98 int ossl_ec_GFp_simple_group_init(EC_GROUP *group) in ossl_ec_GFp_simple_group_init() argument
100 group->field = BN_new(); in ossl_ec_GFp_simple_group_init()
101 group->a = BN_new(); in ossl_ec_GFp_simple_group_init()
102 group->b = BN_new(); in ossl_ec_GFp_simple_group_init()
103 if (group->field == NULL || group->a == NULL || group->b == NULL) { in ossl_ec_GFp_simple_group_init()
104 BN_free(group->field); in ossl_ec_GFp_simple_group_init()
105 BN_free(group->a); in ossl_ec_GFp_simple_group_init()
106 BN_free(group->b); in ossl_ec_GFp_simple_group_init()
109 group->a_is_minus3 = 0; in ossl_ec_GFp_simple_group_init()
113 void ossl_ec_GFp_simple_group_finish(EC_GROUP *group) in ossl_ec_GFp_simple_group_finish() argument
115 BN_free(group->field); in ossl_ec_GFp_simple_group_finish()
116 BN_free(group->a); in ossl_ec_GFp_simple_group_finish()
117 BN_free(group->b); in ossl_ec_GFp_simple_group_finish()
120 void ossl_ec_GFp_simple_group_clear_finish(EC_GROUP *group) in ossl_ec_GFp_simple_group_clear_finish() argument
122 BN_clear_free(group->field); in ossl_ec_GFp_simple_group_clear_finish()
123 BN_clear_free(group->a); in ossl_ec_GFp_simple_group_clear_finish()
124 BN_clear_free(group->b); in ossl_ec_GFp_simple_group_clear_finish()
141 int ossl_ec_GFp_simple_group_set_curve(EC_GROUP *group, in ossl_ec_GFp_simple_group_set_curve() argument
156 ctx = new_ctx = BN_CTX_new_ex(group->libctx); in ossl_ec_GFp_simple_group_set_curve()
167 if (!BN_copy(group->field, p)) in ossl_ec_GFp_simple_group_set_curve()
169 BN_set_negative(group->field, 0); in ossl_ec_GFp_simple_group_set_curve()
174 if (group->meth->field_encode != NULL) { in ossl_ec_GFp_simple_group_set_curve()
175 if (!group->meth->field_encode(group, group->a, tmp_a, ctx)) in ossl_ec_GFp_simple_group_set_curve()
177 } else if (!BN_copy(group->a, tmp_a)) in ossl_ec_GFp_simple_group_set_curve()
181 if (!BN_nnmod(group->b, b, p, ctx)) in ossl_ec_GFp_simple_group_set_curve()
183 if (group->meth->field_encode != NULL) in ossl_ec_GFp_simple_group_set_curve()
184 if (!group->meth->field_encode(group, group->b, group->b, ctx)) in ossl_ec_GFp_simple_group_set_curve()
190 group->a_is_minus3 = (0 == BN_cmp(tmp_a, group->field)); in ossl_ec_GFp_simple_group_set_curve()
200 int ossl_ec_GFp_simple_group_get_curve(const EC_GROUP *group, BIGNUM *p, in ossl_ec_GFp_simple_group_get_curve() argument
207 if (!BN_copy(p, group->field)) in ossl_ec_GFp_simple_group_get_curve()
212 if (group->meth->field_decode != NULL) { in ossl_ec_GFp_simple_group_get_curve()
214 ctx = new_ctx = BN_CTX_new_ex(group->libctx); in ossl_ec_GFp_simple_group_get_curve()
219 if (!group->meth->field_decode(group, a, group->a, ctx)) in ossl_ec_GFp_simple_group_get_curve()
223 if (!group->meth->field_decode(group, b, group->b, ctx)) in ossl_ec_GFp_simple_group_get_curve()
228 if (!BN_copy(a, group->a)) in ossl_ec_GFp_simple_group_get_curve()
232 if (!BN_copy(b, group->b)) in ossl_ec_GFp_simple_group_get_curve()
245 int ossl_ec_GFp_simple_group_get_degree(const EC_GROUP *group) in ossl_ec_GFp_simple_group_get_degree() argument
247 return BN_num_bits(group->field); in ossl_ec_GFp_simple_group_get_degree()
250 int ossl_ec_GFp_simple_group_check_discriminant(const EC_GROUP *group, in ossl_ec_GFp_simple_group_check_discriminant() argument
255 const BIGNUM *p = group->field; in ossl_ec_GFp_simple_group_check_discriminant()
259 ctx = new_ctx = BN_CTX_new_ex(group->libctx); in ossl_ec_GFp_simple_group_check_discriminant()
274 if (group->meth->field_decode != NULL) { in ossl_ec_GFp_simple_group_check_discriminant()
275 if (!group->meth->field_decode(group, a, group->a, ctx)) in ossl_ec_GFp_simple_group_check_discriminant()
277 if (!group->meth->field_decode(group, b, group->b, ctx)) in ossl_ec_GFp_simple_group_check_discriminant()
280 if (!BN_copy(a, group->a)) in ossl_ec_GFp_simple_group_check_discriminant()
282 if (!BN_copy(b, group->b)) in ossl_ec_GFp_simple_group_check_discriminant()
367 int ossl_ec_GFp_simple_point_set_to_infinity(const EC_GROUP *group, in ossl_ec_GFp_simple_point_set_to_infinity() argument
375 int ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp(const EC_GROUP *group, in ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp() argument
386 ctx = new_ctx = BN_CTX_new_ex(group->libctx); in ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp()
392 if (!BN_nnmod(point->X, x, group->field, ctx)) in ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp()
394 if (group->meth->field_encode) { in ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp()
395 if (!group->meth->field_encode(group, point->X, point->X, ctx)) in ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp()
401 if (!BN_nnmod(point->Y, y, group->field, ctx)) in ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp()
403 if (group->meth->field_encode) { in ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp()
404 if (!group->meth->field_encode(group, point->Y, point->Y, ctx)) in ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp()
412 if (!BN_nnmod(point->Z, z, group->field, ctx)) in ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp()
415 if (group->meth->field_encode) { in ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp()
416 if (Z_is_one && (group->meth->field_set_to_one != 0)) { in ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp()
417 if (!group->meth->field_set_to_one(group, point->Z, ctx)) in ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp()
420 if (!group-> in ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp()
421 meth->field_encode(group, point->Z, point->Z, ctx)) in ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp()
435 int ossl_ec_GFp_simple_get_Jprojective_coordinates_GFp(const EC_GROUP *group, in ossl_ec_GFp_simple_get_Jprojective_coordinates_GFp() argument
443 if (group->meth->field_decode != NULL) { in ossl_ec_GFp_simple_get_Jprojective_coordinates_GFp()
445 ctx = new_ctx = BN_CTX_new_ex(group->libctx); in ossl_ec_GFp_simple_get_Jprojective_coordinates_GFp()
451 if (!group->meth->field_decode(group, x, point->X, ctx)) in ossl_ec_GFp_simple_get_Jprojective_coordinates_GFp()
455 if (!group->meth->field_decode(group, y, point->Y, ctx)) in ossl_ec_GFp_simple_get_Jprojective_coordinates_GFp()
459 if (!group->meth->field_decode(group, z, point->Z, ctx)) in ossl_ec_GFp_simple_get_Jprojective_coordinates_GFp()
484 int ossl_ec_GFp_simple_point_set_affine_coordinates(const EC_GROUP *group, in ossl_ec_GFp_simple_point_set_affine_coordinates() argument
497 return EC_POINT_set_Jprojective_coordinates_GFp(group, point, x, y, in ossl_ec_GFp_simple_point_set_affine_coordinates()
501 int ossl_ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *group, in ossl_ec_GFp_simple_point_get_affine_coordinates() argument
511 if (EC_POINT_is_at_infinity(group, point)) { in ossl_ec_GFp_simple_point_get_affine_coordinates()
517 ctx = new_ctx = BN_CTX_new_ex(group->libctx); in ossl_ec_GFp_simple_point_get_affine_coordinates()
532 if (group->meth->field_decode != NULL) { in ossl_ec_GFp_simple_point_get_affine_coordinates()
533 if (!group->meth->field_decode(group, Z, point->Z, ctx)) in ossl_ec_GFp_simple_point_get_affine_coordinates()
541 if (group->meth->field_decode != NULL) { in ossl_ec_GFp_simple_point_get_affine_coordinates()
543 if (!group->meth->field_decode(group, x, point->X, ctx)) in ossl_ec_GFp_simple_point_get_affine_coordinates()
547 if (!group->meth->field_decode(group, y, point->Y, ctx)) in ossl_ec_GFp_simple_point_get_affine_coordinates()
561 if (!group->meth->field_inv(group, Z_1, Z_, ctx)) { in ossl_ec_GFp_simple_point_get_affine_coordinates()
566 if (group->meth->field_encode == NULL) { in ossl_ec_GFp_simple_point_get_affine_coordinates()
568 if (!group->meth->field_sqr(group, Z_2, Z_1, ctx)) in ossl_ec_GFp_simple_point_get_affine_coordinates()
571 if (!BN_mod_sqr(Z_2, Z_1, group->field, ctx)) in ossl_ec_GFp_simple_point_get_affine_coordinates()
580 if (!group->meth->field_mul(group, x, point->X, Z_2, ctx)) in ossl_ec_GFp_simple_point_get_affine_coordinates()
585 if (group->meth->field_encode == NULL) { in ossl_ec_GFp_simple_point_get_affine_coordinates()
589 if (!group->meth->field_mul(group, Z_3, Z_2, Z_1, ctx)) in ossl_ec_GFp_simple_point_get_affine_coordinates()
592 if (!BN_mod_mul(Z_3, Z_2, Z_1, group->field, ctx)) in ossl_ec_GFp_simple_point_get_affine_coordinates()
600 if (!group->meth->field_mul(group, y, point->Y, Z_3, ctx)) in ossl_ec_GFp_simple_point_get_affine_coordinates()
613 int ossl_ec_GFp_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, in ossl_ec_GFp_simple_add() argument
625 return EC_POINT_dbl(group, r, a, ctx); in ossl_ec_GFp_simple_add()
626 if (EC_POINT_is_at_infinity(group, a)) in ossl_ec_GFp_simple_add()
628 if (EC_POINT_is_at_infinity(group, b)) in ossl_ec_GFp_simple_add()
631 field_mul = group->meth->field_mul; in ossl_ec_GFp_simple_add()
632 field_sqr = group->meth->field_sqr; in ossl_ec_GFp_simple_add()
633 p = group->field; in ossl_ec_GFp_simple_add()
636 ctx = new_ctx = BN_CTX_new_ex(group->libctx); in ossl_ec_GFp_simple_add()
667 if (!field_sqr(group, n0, b->Z, ctx)) in ossl_ec_GFp_simple_add()
669 if (!field_mul(group, n1, a->X, n0, ctx)) in ossl_ec_GFp_simple_add()
673 if (!field_mul(group, n0, n0, b->Z, ctx)) in ossl_ec_GFp_simple_add()
675 if (!field_mul(group, n2, a->Y, n0, ctx)) in ossl_ec_GFp_simple_add()
689 if (!field_sqr(group, n0, a->Z, ctx)) in ossl_ec_GFp_simple_add()
691 if (!field_mul(group, n3, b->X, n0, ctx)) in ossl_ec_GFp_simple_add()
695 if (!field_mul(group, n0, n0, a->Z, ctx)) in ossl_ec_GFp_simple_add()
697 if (!field_mul(group, n4, b->Y, n0, ctx)) in ossl_ec_GFp_simple_add()
714 ret = EC_POINT_dbl(group, r, a, ctx); in ossl_ec_GFp_simple_add()
746 if (!field_mul(group, n0, a->Z, b->Z, ctx)) in ossl_ec_GFp_simple_add()
749 if (!field_mul(group, r->Z, n0, n5, ctx)) in ossl_ec_GFp_simple_add()
756 if (!field_sqr(group, n0, n6, ctx)) in ossl_ec_GFp_simple_add()
758 if (!field_sqr(group, n4, n5, ctx)) in ossl_ec_GFp_simple_add()
760 if (!field_mul(group, n3, n1, n4, ctx)) in ossl_ec_GFp_simple_add()
774 if (!field_mul(group, n0, n0, n6, ctx)) in ossl_ec_GFp_simple_add()
776 if (!field_mul(group, n5, n4, n5, ctx)) in ossl_ec_GFp_simple_add()
778 if (!field_mul(group, n1, n2, n5, ctx)) in ossl_ec_GFp_simple_add()
798 int ossl_ec_GFp_simple_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, in ossl_ec_GFp_simple_dbl() argument
809 if (EC_POINT_is_at_infinity(group, a)) { in ossl_ec_GFp_simple_dbl()
815 field_mul = group->meth->field_mul; in ossl_ec_GFp_simple_dbl()
816 field_sqr = group->meth->field_sqr; in ossl_ec_GFp_simple_dbl()
817 p = group->field; in ossl_ec_GFp_simple_dbl()
820 ctx = new_ctx = BN_CTX_new_ex(group->libctx); in ossl_ec_GFp_simple_dbl()
841 if (!field_sqr(group, n0, a->X, ctx)) in ossl_ec_GFp_simple_dbl()
847 if (!BN_mod_add_quick(n1, n0, group->a, p)) in ossl_ec_GFp_simple_dbl()
850 } else if (group->a_is_minus3) { in ossl_ec_GFp_simple_dbl()
851 if (!field_sqr(group, n1, a->Z, ctx)) in ossl_ec_GFp_simple_dbl()
857 if (!field_mul(group, n1, n0, n2, ctx)) in ossl_ec_GFp_simple_dbl()
868 if (!field_sqr(group, n0, a->X, ctx)) in ossl_ec_GFp_simple_dbl()
874 if (!field_sqr(group, n1, a->Z, ctx)) in ossl_ec_GFp_simple_dbl()
876 if (!field_sqr(group, n1, n1, ctx)) in ossl_ec_GFp_simple_dbl()
878 if (!field_mul(group, n1, n1, group->a, ctx)) in ossl_ec_GFp_simple_dbl()
890 if (!field_mul(group, n0, a->Y, a->Z, ctx)) in ossl_ec_GFp_simple_dbl()
899 if (!field_sqr(group, n3, a->Y, ctx)) in ossl_ec_GFp_simple_dbl()
901 if (!field_mul(group, n2, a->X, n3, ctx)) in ossl_ec_GFp_simple_dbl()
910 if (!field_sqr(group, r->X, n1, ctx)) in ossl_ec_GFp_simple_dbl()
917 if (!field_sqr(group, n0, n3, ctx)) in ossl_ec_GFp_simple_dbl()
926 if (!field_mul(group, n0, n1, n0, ctx)) in ossl_ec_GFp_simple_dbl()
940 int ossl_ec_GFp_simple_invert(const EC_GROUP *group, EC_POINT *point, in ossl_ec_GFp_simple_invert() argument
943 if (EC_POINT_is_at_infinity(group, point) || BN_is_zero(point->Y)) in ossl_ec_GFp_simple_invert()
947 return BN_usub(point->Y, group->field, point->Y); in ossl_ec_GFp_simple_invert()
950 int ossl_ec_GFp_simple_is_at_infinity(const EC_GROUP *group, in ossl_ec_GFp_simple_is_at_infinity() argument
956 int ossl_ec_GFp_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, in ossl_ec_GFp_simple_is_on_curve() argument
967 if (EC_POINT_is_at_infinity(group, point)) in ossl_ec_GFp_simple_is_on_curve()
970 field_mul = group->meth->field_mul; in ossl_ec_GFp_simple_is_on_curve()
971 field_sqr = group->meth->field_sqr; in ossl_ec_GFp_simple_is_on_curve()
972 p = group->field; in ossl_ec_GFp_simple_is_on_curve()
975 ctx = new_ctx = BN_CTX_new_ex(group->libctx); in ossl_ec_GFp_simple_is_on_curve()
999 if (!field_sqr(group, rh, point->X, ctx)) in ossl_ec_GFp_simple_is_on_curve()
1003 if (!field_sqr(group, tmp, point->Z, ctx)) in ossl_ec_GFp_simple_is_on_curve()
1005 if (!field_sqr(group, Z4, tmp, ctx)) in ossl_ec_GFp_simple_is_on_curve()
1007 if (!field_mul(group, Z6, Z4, tmp, ctx)) in ossl_ec_GFp_simple_is_on_curve()
1011 if (group->a_is_minus3) { in ossl_ec_GFp_simple_is_on_curve()
1018 if (!field_mul(group, rh, rh, point->X, ctx)) in ossl_ec_GFp_simple_is_on_curve()
1021 if (!field_mul(group, tmp, Z4, group->a, ctx)) in ossl_ec_GFp_simple_is_on_curve()
1025 if (!field_mul(group, rh, rh, point->X, ctx)) in ossl_ec_GFp_simple_is_on_curve()
1030 if (!field_mul(group, tmp, group->b, Z6, ctx)) in ossl_ec_GFp_simple_is_on_curve()
1038 if (!BN_mod_add_quick(rh, rh, group->a, p)) in ossl_ec_GFp_simple_is_on_curve()
1040 if (!field_mul(group, rh, rh, point->X, ctx)) in ossl_ec_GFp_simple_is_on_curve()
1043 if (!BN_mod_add_quick(rh, rh, group->b, p)) in ossl_ec_GFp_simple_is_on_curve()
1048 if (!field_sqr(group, tmp, point->Y, ctx)) in ossl_ec_GFp_simple_is_on_curve()
1059 int ossl_ec_GFp_simple_cmp(const EC_GROUP *group, const EC_POINT *a, in ossl_ec_GFp_simple_cmp() argument
1077 if (EC_POINT_is_at_infinity(group, a)) { in ossl_ec_GFp_simple_cmp()
1078 return EC_POINT_is_at_infinity(group, b) ? 0 : 1; in ossl_ec_GFp_simple_cmp()
1081 if (EC_POINT_is_at_infinity(group, b)) in ossl_ec_GFp_simple_cmp()
1088 field_mul = group->meth->field_mul; in ossl_ec_GFp_simple_cmp()
1089 field_sqr = group->meth->field_sqr; in ossl_ec_GFp_simple_cmp()
1092 ctx = new_ctx = BN_CTX_new_ex(group->libctx); in ossl_ec_GFp_simple_cmp()
1113 if (!field_sqr(group, Zb23, b->Z, ctx)) in ossl_ec_GFp_simple_cmp()
1115 if (!field_mul(group, tmp1, a->X, Zb23, ctx)) in ossl_ec_GFp_simple_cmp()
1121 if (!field_sqr(group, Za23, a->Z, ctx)) in ossl_ec_GFp_simple_cmp()
1123 if (!field_mul(group, tmp2, b->X, Za23, ctx)) in ossl_ec_GFp_simple_cmp()
1136 if (!field_mul(group, Zb23, Zb23, b->Z, ctx)) in ossl_ec_GFp_simple_cmp()
1138 if (!field_mul(group, tmp1, a->Y, Zb23, ctx)) in ossl_ec_GFp_simple_cmp()
1144 if (!field_mul(group, Za23, Za23, a->Z, ctx)) in ossl_ec_GFp_simple_cmp()
1146 if (!field_mul(group, tmp2, b->Y, Za23, ctx)) in ossl_ec_GFp_simple_cmp()
1167 int ossl_ec_GFp_simple_make_affine(const EC_GROUP *group, EC_POINT *point, in ossl_ec_GFp_simple_make_affine() argument
1174 if (point->Z_is_one || EC_POINT_is_at_infinity(group, point)) in ossl_ec_GFp_simple_make_affine()
1178 ctx = new_ctx = BN_CTX_new_ex(group->libctx); in ossl_ec_GFp_simple_make_affine()
1189 if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx)) in ossl_ec_GFp_simple_make_affine()
1191 if (!EC_POINT_set_affine_coordinates(group, point, x, y, ctx)) in ossl_ec_GFp_simple_make_affine()
1206 int ossl_ec_GFp_simple_points_make_affine(const EC_GROUP *group, size_t num, in ossl_ec_GFp_simple_points_make_affine() argument
1219 ctx = new_ctx = BN_CTX_new_ex(group->libctx); in ossl_ec_GFp_simple_points_make_affine()
1248 if (group->meth->field_set_to_one != 0) { in ossl_ec_GFp_simple_points_make_affine()
1249 if (!group->meth->field_set_to_one(group, prod_Z[0], ctx)) in ossl_ec_GFp_simple_points_make_affine()
1259 if (!group-> in ossl_ec_GFp_simple_points_make_affine()
1260 meth->field_mul(group, prod_Z[i], prod_Z[i - 1], points[i]->Z, in ossl_ec_GFp_simple_points_make_affine()
1274 if (!group->meth->field_inv(group, tmp, prod_Z[num - 1], ctx)) { in ossl_ec_GFp_simple_points_make_affine()
1278 if (group->meth->field_encode != NULL) { in ossl_ec_GFp_simple_points_make_affine()
1284 if (!group->meth->field_encode(group, tmp, tmp, ctx)) in ossl_ec_GFp_simple_points_make_affine()
1286 if (!group->meth->field_encode(group, tmp, tmp, ctx)) in ossl_ec_GFp_simple_points_make_affine()
1300 if (!group-> in ossl_ec_GFp_simple_points_make_affine()
1301 meth->field_mul(group, tmp_Z, prod_Z[i - 1], tmp, ctx)) in ossl_ec_GFp_simple_points_make_affine()
1306 if (!group->meth->field_mul(group, tmp, tmp, points[i]->Z, ctx)) in ossl_ec_GFp_simple_points_make_affine()
1328 if (!group->meth->field_sqr(group, tmp, p->Z, ctx)) in ossl_ec_GFp_simple_points_make_affine()
1330 if (!group->meth->field_mul(group, p->X, p->X, tmp, ctx)) in ossl_ec_GFp_simple_points_make_affine()
1333 if (!group->meth->field_mul(group, tmp, tmp, p->Z, ctx)) in ossl_ec_GFp_simple_points_make_affine()
1335 if (!group->meth->field_mul(group, p->Y, p->Y, tmp, ctx)) in ossl_ec_GFp_simple_points_make_affine()
1338 if (group->meth->field_set_to_one != 0) { in ossl_ec_GFp_simple_points_make_affine()
1339 if (!group->meth->field_set_to_one(group, p->Z, ctx)) in ossl_ec_GFp_simple_points_make_affine()
1365 int ossl_ec_GFp_simple_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, in ossl_ec_GFp_simple_field_mul() argument
1368 return BN_mod_mul(r, a, b, group->field, ctx); in ossl_ec_GFp_simple_field_mul()
1371 int ossl_ec_GFp_simple_field_sqr(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, in ossl_ec_GFp_simple_field_sqr() argument
1374 return BN_mod_sqr(r, a, group->field, ctx); in ossl_ec_GFp_simple_field_sqr()
1383 int ossl_ec_GFp_simple_field_inv(const EC_GROUP *group, BIGNUM *r, in ossl_ec_GFp_simple_field_inv() argument
1391 && (ctx = new_ctx = BN_CTX_secure_new_ex(group->libctx)) == NULL) in ossl_ec_GFp_simple_field_inv()
1399 if (!BN_priv_rand_range_ex(e, group->field, 0, ctx)) in ossl_ec_GFp_simple_field_inv()
1404 if (!group->meth->field_mul(group, r, a, e, ctx)) in ossl_ec_GFp_simple_field_inv()
1407 if (!BN_mod_inverse(r, r, group->field, ctx)) { in ossl_ec_GFp_simple_field_inv()
1412 if (!group->meth->field_mul(group, r, r, e, ctx)) in ossl_ec_GFp_simple_field_inv()
1430 int ossl_ec_GFp_simple_blind_coordinates(const EC_GROUP *group, EC_POINT *p, in ossl_ec_GFp_simple_blind_coordinates() argument
1452 ret = BN_priv_rand_range_ex(lambda, group->field, 0, ctx); in ossl_ec_GFp_simple_blind_coordinates()
1461 if ((group->meth->field_encode != NULL in ossl_ec_GFp_simple_blind_coordinates()
1462 && !group->meth->field_encode(group, lambda, lambda, ctx)) in ossl_ec_GFp_simple_blind_coordinates()
1463 || !group->meth->field_mul(group, p->Z, p->Z, lambda, ctx) in ossl_ec_GFp_simple_blind_coordinates()
1464 || !group->meth->field_sqr(group, temp, lambda, ctx) in ossl_ec_GFp_simple_blind_coordinates()
1465 || !group->meth->field_mul(group, p->X, p->X, temp, ctx) in ossl_ec_GFp_simple_blind_coordinates()
1466 || !group->meth->field_mul(group, temp, temp, lambda, ctx) in ossl_ec_GFp_simple_blind_coordinates()
1467 || !group->meth->field_mul(group, p->Y, p->Y, temp, ctx)) in ossl_ec_GFp_simple_blind_coordinates()
1493 int ossl_ec_GFp_simple_ladder_pre(const EC_GROUP *group, in ossl_ec_GFp_simple_ladder_pre() argument
1506 || !group->meth->field_sqr(group, t3, p->X, ctx) in ossl_ec_GFp_simple_ladder_pre()
1507 || !BN_mod_sub_quick(t4, t3, group->a, group->field) in ossl_ec_GFp_simple_ladder_pre()
1508 || !group->meth->field_sqr(group, t4, t4, ctx) in ossl_ec_GFp_simple_ladder_pre()
1509 || !group->meth->field_mul(group, t5, p->X, group->b, ctx) in ossl_ec_GFp_simple_ladder_pre()
1510 || !BN_mod_lshift_quick(t5, t5, 3, group->field) in ossl_ec_GFp_simple_ladder_pre()
1512 || !BN_mod_sub_quick(r->X, t4, t5, group->field) in ossl_ec_GFp_simple_ladder_pre()
1513 || !BN_mod_add_quick(t1, t3, group->a, group->field) in ossl_ec_GFp_simple_ladder_pre()
1514 || !group->meth->field_mul(group, t2, p->X, t1, ctx) in ossl_ec_GFp_simple_ladder_pre()
1515 || !BN_mod_add_quick(t2, group->b, t2, group->field) in ossl_ec_GFp_simple_ladder_pre()
1517 || !BN_mod_lshift_quick(r->Z, t2, 2, group->field)) in ossl_ec_GFp_simple_ladder_pre()
1522 if (!BN_priv_rand_range_ex(r->Y, group->field, 0, ctx)) in ossl_ec_GFp_simple_ladder_pre()
1528 if (!BN_priv_rand_range_ex(s->Z, group->field, 0, ctx)) in ossl_ec_GFp_simple_ladder_pre()
1533 if (group->meth->field_encode != NULL in ossl_ec_GFp_simple_ladder_pre()
1534 && (!group->meth->field_encode(group, r->Y, r->Y, ctx) in ossl_ec_GFp_simple_ladder_pre()
1535 || !group->meth->field_encode(group, s->Z, s->Z, ctx))) in ossl_ec_GFp_simple_ladder_pre()
1539 if (!group->meth->field_mul(group, r->Z, r->Z, r->Y, ctx) in ossl_ec_GFp_simple_ladder_pre()
1540 || !group->meth->field_mul(group, r->X, r->X, r->Y, ctx) in ossl_ec_GFp_simple_ladder_pre()
1541 || !group->meth->field_mul(group, s->X, p->X, s->Z, ctx)) /* s := p */ in ossl_ec_GFp_simple_ladder_pre()
1563 int ossl_ec_GFp_simple_ladder_step(const EC_GROUP *group, in ossl_ec_GFp_simple_ladder_step() argument
1580 || !group->meth->field_mul(group, t6, r->X, s->X, ctx) in ossl_ec_GFp_simple_ladder_step()
1581 || !group->meth->field_mul(group, t0, r->Z, s->Z, ctx) in ossl_ec_GFp_simple_ladder_step()
1582 || !group->meth->field_mul(group, t4, r->X, s->Z, ctx) in ossl_ec_GFp_simple_ladder_step()
1583 || !group->meth->field_mul(group, t3, r->Z, s->X, ctx) in ossl_ec_GFp_simple_ladder_step()
1584 || !group->meth->field_mul(group, t5, group->a, t0, ctx) in ossl_ec_GFp_simple_ladder_step()
1585 || !BN_mod_add_quick(t5, t6, t5, group->field) in ossl_ec_GFp_simple_ladder_step()
1586 || !BN_mod_add_quick(t6, t3, t4, group->field) in ossl_ec_GFp_simple_ladder_step()
1587 || !group->meth->field_mul(group, t5, t6, t5, ctx) in ossl_ec_GFp_simple_ladder_step()
1588 || !group->meth->field_sqr(group, t0, t0, ctx) in ossl_ec_GFp_simple_ladder_step()
1589 || !BN_mod_lshift_quick(t2, group->b, 2, group->field) in ossl_ec_GFp_simple_ladder_step()
1590 || !group->meth->field_mul(group, t0, t2, t0, ctx) in ossl_ec_GFp_simple_ladder_step()
1591 || !BN_mod_lshift1_quick(t5, t5, group->field) in ossl_ec_GFp_simple_ladder_step()
1592 || !BN_mod_sub_quick(t3, t4, t3, group->field) in ossl_ec_GFp_simple_ladder_step()
1594 || !group->meth->field_sqr(group, s->Z, t3, ctx) in ossl_ec_GFp_simple_ladder_step()
1595 || !group->meth->field_mul(group, t4, s->Z, p->X, ctx) in ossl_ec_GFp_simple_ladder_step()
1596 || !BN_mod_add_quick(t0, t0, t5, group->field) in ossl_ec_GFp_simple_ladder_step()
1598 || !BN_mod_sub_quick(s->X, t0, t4, group->field) in ossl_ec_GFp_simple_ladder_step()
1599 || !group->meth->field_sqr(group, t4, r->X, ctx) in ossl_ec_GFp_simple_ladder_step()
1600 || !group->meth->field_sqr(group, t5, r->Z, ctx) in ossl_ec_GFp_simple_ladder_step()
1601 || !group->meth->field_mul(group, t6, t5, group->a, ctx) in ossl_ec_GFp_simple_ladder_step()
1602 || !BN_mod_add_quick(t1, r->X, r->Z, group->field) in ossl_ec_GFp_simple_ladder_step()
1603 || !group->meth->field_sqr(group, t1, t1, ctx) in ossl_ec_GFp_simple_ladder_step()
1604 || !BN_mod_sub_quick(t1, t1, t4, group->field) in ossl_ec_GFp_simple_ladder_step()
1605 || !BN_mod_sub_quick(t1, t1, t5, group->field) in ossl_ec_GFp_simple_ladder_step()
1606 || !BN_mod_sub_quick(t3, t4, t6, group->field) in ossl_ec_GFp_simple_ladder_step()
1607 || !group->meth->field_sqr(group, t3, t3, ctx) in ossl_ec_GFp_simple_ladder_step()
1608 || !group->meth->field_mul(group, t0, t5, t1, ctx) in ossl_ec_GFp_simple_ladder_step()
1609 || !group->meth->field_mul(group, t0, t2, t0, ctx) in ossl_ec_GFp_simple_ladder_step()
1611 || !BN_mod_sub_quick(r->X, t3, t0, group->field) in ossl_ec_GFp_simple_ladder_step()
1612 || !BN_mod_add_quick(t3, t4, t6, group->field) in ossl_ec_GFp_simple_ladder_step()
1613 || !group->meth->field_sqr(group, t4, t5, ctx) in ossl_ec_GFp_simple_ladder_step()
1614 || !group->meth->field_mul(group, t4, t4, t2, ctx) in ossl_ec_GFp_simple_ladder_step()
1615 || !group->meth->field_mul(group, t1, t1, t3, ctx) in ossl_ec_GFp_simple_ladder_step()
1616 || !BN_mod_lshift1_quick(t1, t1, group->field) in ossl_ec_GFp_simple_ladder_step()
1618 || !BN_mod_add_quick(r->Z, t4, t1, group->field)) in ossl_ec_GFp_simple_ladder_step()
1651 int ossl_ec_GFp_simple_ladder_post(const EC_GROUP *group, in ossl_ec_GFp_simple_ladder_post() argument
1659 return EC_POINT_set_to_infinity(group, r); in ossl_ec_GFp_simple_ladder_post()
1663 || !EC_POINT_invert(group, r, ctx)) in ossl_ec_GFp_simple_ladder_post()
1678 || !BN_mod_lshift1_quick(t4, p->Y, group->field) in ossl_ec_GFp_simple_ladder_post()
1679 || !group->meth->field_mul(group, t6, r->X, t4, ctx) in ossl_ec_GFp_simple_ladder_post()
1680 || !group->meth->field_mul(group, t6, s->Z, t6, ctx) in ossl_ec_GFp_simple_ladder_post()
1681 || !group->meth->field_mul(group, t5, r->Z, t6, ctx) in ossl_ec_GFp_simple_ladder_post()
1682 || !BN_mod_lshift1_quick(t1, group->b, group->field) in ossl_ec_GFp_simple_ladder_post()
1683 || !group->meth->field_mul(group, t1, s->Z, t1, ctx) in ossl_ec_GFp_simple_ladder_post()
1684 || !group->meth->field_sqr(group, t3, r->Z, ctx) in ossl_ec_GFp_simple_ladder_post()
1685 || !group->meth->field_mul(group, t2, t3, t1, ctx) in ossl_ec_GFp_simple_ladder_post()
1686 || !group->meth->field_mul(group, t6, r->Z, group->a, ctx) in ossl_ec_GFp_simple_ladder_post()
1687 || !group->meth->field_mul(group, t1, p->X, r->X, ctx) in ossl_ec_GFp_simple_ladder_post()
1688 || !BN_mod_add_quick(t1, t1, t6, group->field) in ossl_ec_GFp_simple_ladder_post()
1689 || !group->meth->field_mul(group, t1, s->Z, t1, ctx) in ossl_ec_GFp_simple_ladder_post()
1690 || !group->meth->field_mul(group, t0, p->X, r->Z, ctx) in ossl_ec_GFp_simple_ladder_post()
1691 || !BN_mod_add_quick(t6, r->X, t0, group->field) in ossl_ec_GFp_simple_ladder_post()
1692 || !group->meth->field_mul(group, t6, t6, t1, ctx) in ossl_ec_GFp_simple_ladder_post()
1693 || !BN_mod_add_quick(t6, t6, t2, group->field) in ossl_ec_GFp_simple_ladder_post()
1694 || !BN_mod_sub_quick(t0, t0, r->X, group->field) in ossl_ec_GFp_simple_ladder_post()
1695 || !group->meth->field_sqr(group, t0, t0, ctx) in ossl_ec_GFp_simple_ladder_post()
1696 || !group->meth->field_mul(group, t0, t0, s->X, ctx) in ossl_ec_GFp_simple_ladder_post()
1697 || !BN_mod_sub_quick(t0, t6, t0, group->field) in ossl_ec_GFp_simple_ladder_post()
1698 || !group->meth->field_mul(group, t1, s->Z, t4, ctx) in ossl_ec_GFp_simple_ladder_post()
1699 || !group->meth->field_mul(group, t1, t3, t1, ctx) in ossl_ec_GFp_simple_ladder_post()
1700 || (group->meth->field_decode != NULL in ossl_ec_GFp_simple_ladder_post()
1701 && !group->meth->field_decode(group, t1, t1, ctx)) in ossl_ec_GFp_simple_ladder_post()
1702 || !group->meth->field_inv(group, t1, t1, ctx) in ossl_ec_GFp_simple_ladder_post()
1703 || (group->meth->field_encode != NULL in ossl_ec_GFp_simple_ladder_post()
1704 && !group->meth->field_encode(group, t1, t1, ctx)) in ossl_ec_GFp_simple_ladder_post()
1705 || !group->meth->field_mul(group, r->X, t5, t1, ctx) in ossl_ec_GFp_simple_ladder_post()
1706 || !group->meth->field_mul(group, r->Y, t0, t1, ctx)) in ossl_ec_GFp_simple_ladder_post()
1709 if (group->meth->field_set_to_one != NULL) { in ossl_ec_GFp_simple_ladder_post()
1710 if (!group->meth->field_set_to_one(group, r->Z, ctx)) in ossl_ec_GFp_simple_ladder_post()