Lines Matching refs:group
88 void EC_pre_comp_free(EC_GROUP *group) in EC_pre_comp_free() argument
90 switch (group->pre_comp_type) { in EC_pre_comp_free()
95 EC_nistz256_pre_comp_free(group->pre_comp.nistz256); in EC_pre_comp_free()
100 EC_nistp224_pre_comp_free(group->pre_comp.nistp224); in EC_pre_comp_free()
103 EC_nistp256_pre_comp_free(group->pre_comp.nistp256); in EC_pre_comp_free()
106 EC_nistp521_pre_comp_free(group->pre_comp.nistp521); in EC_pre_comp_free()
115 EC_ec_pre_comp_free(group->pre_comp.ec); in EC_pre_comp_free()
118 group->pre_comp.ec = NULL; in EC_pre_comp_free()
121 void EC_GROUP_free(EC_GROUP *group) in EC_GROUP_free() argument
123 if (!group) in EC_GROUP_free()
126 if (group->meth->group_finish != 0) in EC_GROUP_free()
127 group->meth->group_finish(group); in EC_GROUP_free()
129 EC_pre_comp_free(group); in EC_GROUP_free()
130 BN_MONT_CTX_free(group->mont_data); in EC_GROUP_free()
131 EC_POINT_free(group->generator); in EC_GROUP_free()
132 BN_free(group->order); in EC_GROUP_free()
133 BN_free(group->cofactor); in EC_GROUP_free()
134 OPENSSL_free(group->seed); in EC_GROUP_free()
135 OPENSSL_free(group->propq); in EC_GROUP_free()
136 OPENSSL_free(group); in EC_GROUP_free()
140 void EC_GROUP_clear_free(EC_GROUP *group) in EC_GROUP_clear_free() argument
142 if (!group) in EC_GROUP_clear_free()
145 if (group->meth->group_clear_finish != 0) in EC_GROUP_clear_free()
146 group->meth->group_clear_finish(group); in EC_GROUP_clear_free()
147 else if (group->meth->group_finish != 0) in EC_GROUP_clear_free()
148 group->meth->group_finish(group); in EC_GROUP_clear_free()
150 EC_pre_comp_free(group); in EC_GROUP_clear_free()
151 BN_MONT_CTX_free(group->mont_data); in EC_GROUP_clear_free()
152 EC_POINT_clear_free(group->generator); in EC_GROUP_clear_free()
153 BN_clear_free(group->order); in EC_GROUP_clear_free()
154 BN_clear_free(group->cofactor); in EC_GROUP_clear_free()
155 OPENSSL_clear_free(group->seed, group->seed_len); in EC_GROUP_clear_free()
156 OPENSSL_clear_free(group, sizeof(*group)); in EC_GROUP_clear_free()
289 const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group) in EC_GROUP_method_of() argument
291 return group->meth; in EC_GROUP_method_of()
315 static int ec_guess_cofactor(EC_GROUP *group) { in ec_guess_cofactor() argument
324 if (BN_num_bits(group->order) <= (BN_num_bits(group->field) + 1) / 2 + 3) { in ec_guess_cofactor()
326 BN_zero(group->cofactor); in ec_guess_cofactor()
331 if ((ctx = BN_CTX_new_ex(group->libctx)) == NULL) in ec_guess_cofactor()
339 if (group->meth->field_type == NID_X9_62_characteristic_two_field) { in ec_guess_cofactor()
341 if (!BN_set_bit(q, BN_num_bits(group->field) - 1)) in ec_guess_cofactor()
344 if (!BN_copy(q, group->field)) in ec_guess_cofactor()
349 if (!BN_rshift1(group->cofactor, group->order) /* n/2 */ in ec_guess_cofactor()
350 || !BN_add(group->cofactor, group->cofactor, q) /* q + n/2 */ in ec_guess_cofactor()
352 || !BN_add(group->cofactor, group->cofactor, BN_value_one()) in ec_guess_cofactor()
354 || !BN_div(group->cofactor, NULL, group->cofactor, group->order, ctx)) in ec_guess_cofactor()
363 int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, in EC_GROUP_set_generator() argument
372 if (group->field == NULL || BN_is_zero(group->field) in EC_GROUP_set_generator()
373 || BN_is_negative(group->field)) { in EC_GROUP_set_generator()
384 || BN_num_bits(order) > BN_num_bits(group->field) + 1) { in EC_GROUP_set_generator()
399 if (group->generator == NULL) { in EC_GROUP_set_generator()
400 group->generator = EC_POINT_new(group); in EC_GROUP_set_generator()
401 if (group->generator == NULL) in EC_GROUP_set_generator()
404 if (!EC_POINT_copy(group->generator, generator)) in EC_GROUP_set_generator()
407 if (!BN_copy(group->order, order)) in EC_GROUP_set_generator()
412 if (!BN_copy(group->cofactor, cofactor)) in EC_GROUP_set_generator()
414 } else if (!ec_guess_cofactor(group)) { in EC_GROUP_set_generator()
415 BN_zero(group->cofactor); in EC_GROUP_set_generator()
424 if (BN_is_odd(group->order)) { in EC_GROUP_set_generator()
425 return ec_precompute_mont_data(group); in EC_GROUP_set_generator()
428 BN_MONT_CTX_free(group->mont_data); in EC_GROUP_set_generator()
429 group->mont_data = NULL; in EC_GROUP_set_generator()
433 const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group) in EC_GROUP_get0_generator() argument
435 return group->generator; in EC_GROUP_get0_generator()
438 BN_MONT_CTX *EC_GROUP_get_mont_data(const EC_GROUP *group) in EC_GROUP_get_mont_data() argument
440 return group->mont_data; in EC_GROUP_get_mont_data()
443 int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx) in EC_GROUP_get_order() argument
445 if (group->order == NULL) in EC_GROUP_get_order()
447 if (!BN_copy(order, group->order)) in EC_GROUP_get_order()
453 const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group) in EC_GROUP_get0_order() argument
455 return group->order; in EC_GROUP_get0_order()
458 int EC_GROUP_order_bits(const EC_GROUP *group) in EC_GROUP_order_bits() argument
460 return group->meth->group_order_bits(group); in EC_GROUP_order_bits()
463 int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, in EC_GROUP_get_cofactor() argument
467 if (group->cofactor == NULL) in EC_GROUP_get_cofactor()
469 if (!BN_copy(cofactor, group->cofactor)) in EC_GROUP_get_cofactor()
472 return !BN_is_zero(group->cofactor); in EC_GROUP_get_cofactor()
475 const BIGNUM *EC_GROUP_get0_cofactor(const EC_GROUP *group) in EC_GROUP_get0_cofactor() argument
477 return group->cofactor; in EC_GROUP_get0_cofactor()
480 void EC_GROUP_set_curve_name(EC_GROUP *group, int nid) in EC_GROUP_set_curve_name() argument
482 group->curve_name = nid; in EC_GROUP_set_curve_name()
483 group->asn1_flag = in EC_GROUP_set_curve_name()
489 int EC_GROUP_get_curve_name(const EC_GROUP *group) in EC_GROUP_get_curve_name() argument
491 return group->curve_name; in EC_GROUP_get_curve_name()
494 const BIGNUM *EC_GROUP_get0_field(const EC_GROUP *group) in EC_GROUP_get0_field() argument
496 return group->field; in EC_GROUP_get0_field()
499 int EC_GROUP_get_field_type(const EC_GROUP *group) in EC_GROUP_get_field_type() argument
501 return group->meth->field_type; in EC_GROUP_get_field_type()
504 void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag) in EC_GROUP_set_asn1_flag() argument
506 group->asn1_flag = flag; in EC_GROUP_set_asn1_flag()
509 int EC_GROUP_get_asn1_flag(const EC_GROUP *group) in EC_GROUP_get_asn1_flag() argument
511 return group->asn1_flag; in EC_GROUP_get_asn1_flag()
514 void EC_GROUP_set_point_conversion_form(EC_GROUP *group, in EC_GROUP_set_point_conversion_form() argument
517 group->asn1_form = form; in EC_GROUP_set_point_conversion_form()
521 *group) in EC_GROUP_get_point_conversion_form() argument
523 return group->asn1_form; in EC_GROUP_get_point_conversion_form()
526 size_t EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *p, size_t len) in EC_GROUP_set_seed() argument
528 OPENSSL_free(group->seed); in EC_GROUP_set_seed()
529 group->seed = NULL; in EC_GROUP_set_seed()
530 group->seed_len = 0; in EC_GROUP_set_seed()
535 if ((group->seed = OPENSSL_malloc(len)) == NULL) { in EC_GROUP_set_seed()
539 memcpy(group->seed, p, len); in EC_GROUP_set_seed()
540 group->seed_len = len; in EC_GROUP_set_seed()
545 unsigned char *EC_GROUP_get0_seed(const EC_GROUP *group) in EC_GROUP_get0_seed() argument
547 return group->seed; in EC_GROUP_get0_seed()
550 size_t EC_GROUP_get_seed_len(const EC_GROUP *group) in EC_GROUP_get_seed_len() argument
552 return group->seed_len; in EC_GROUP_get_seed_len()
555 int EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, in EC_GROUP_set_curve() argument
558 if (group->meth->group_set_curve == 0) { in EC_GROUP_set_curve()
562 return group->meth->group_set_curve(group, p, a, b, ctx); in EC_GROUP_set_curve()
565 int EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, in EC_GROUP_get_curve() argument
568 if (group->meth->group_get_curve == NULL) { in EC_GROUP_get_curve()
572 return group->meth->group_get_curve(group, p, a, b, ctx); in EC_GROUP_get_curve()
576 int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, in EC_GROUP_set_curve_GFp() argument
579 return EC_GROUP_set_curve(group, p, a, b, ctx); in EC_GROUP_set_curve_GFp()
582 int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, in EC_GROUP_get_curve_GFp() argument
585 return EC_GROUP_get_curve(group, p, a, b, ctx); in EC_GROUP_get_curve_GFp()
589 int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, in EC_GROUP_set_curve_GF2m() argument
592 return EC_GROUP_set_curve(group, p, a, b, ctx); in EC_GROUP_set_curve_GF2m()
595 int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, in EC_GROUP_get_curve_GF2m() argument
598 return EC_GROUP_get_curve(group, p, a, b, ctx); in EC_GROUP_get_curve_GF2m()
603 int EC_GROUP_get_degree(const EC_GROUP *group) in EC_GROUP_get_degree() argument
605 if (group->meth->group_get_degree == 0) { in EC_GROUP_get_degree()
609 return group->meth->group_get_degree(group); in EC_GROUP_get_degree()
612 int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx) in EC_GROUP_check_discriminant() argument
614 if (group->meth->group_check_discriminant == 0) { in EC_GROUP_check_discriminant()
618 return group->meth->group_check_discriminant(group, ctx); in EC_GROUP_check_discriminant()
715 EC_POINT *EC_POINT_new(const EC_GROUP *group) in EC_POINT_new() argument
719 if (group == NULL) { in EC_POINT_new()
723 if (group->meth->point_init == NULL) { in EC_POINT_new()
734 ret->meth = group->meth; in EC_POINT_new()
735 ret->curve_name = group->curve_name; in EC_POINT_new()
785 EC_POINT *EC_POINT_dup(const EC_POINT *a, const EC_GROUP *group) in EC_POINT_dup() argument
793 t = EC_POINT_new(group); in EC_POINT_dup()
811 int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point) in EC_POINT_set_to_infinity() argument
813 if (group->meth->point_set_to_infinity == 0) { in EC_POINT_set_to_infinity()
817 if (group->meth != point->meth) { in EC_POINT_set_to_infinity()
821 return group->meth->point_set_to_infinity(group, point); in EC_POINT_set_to_infinity()
825 int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, in EC_POINT_set_Jprojective_coordinates_GFp() argument
830 if (group->meth->field_type != NID_X9_62_prime_field) { in EC_POINT_set_Jprojective_coordinates_GFp()
834 if (!ec_point_is_compat(point, group)) { in EC_POINT_set_Jprojective_coordinates_GFp()
838 return ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp(group, point, in EC_POINT_set_Jprojective_coordinates_GFp()
842 int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, in EC_POINT_get_Jprojective_coordinates_GFp() argument
847 if (group->meth->field_type != NID_X9_62_prime_field) { in EC_POINT_get_Jprojective_coordinates_GFp()
851 if (!ec_point_is_compat(point, group)) { in EC_POINT_get_Jprojective_coordinates_GFp()
855 return ossl_ec_GFp_simple_get_Jprojective_coordinates_GFp(group, point, in EC_POINT_get_Jprojective_coordinates_GFp()
860 int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *point, in EC_POINT_set_affine_coordinates() argument
864 if (group->meth->point_set_affine_coordinates == NULL) { in EC_POINT_set_affine_coordinates()
868 if (!ec_point_is_compat(point, group)) { in EC_POINT_set_affine_coordinates()
872 if (!group->meth->point_set_affine_coordinates(group, point, x, y, ctx)) in EC_POINT_set_affine_coordinates()
875 if (EC_POINT_is_on_curve(group, point, ctx) <= 0) { in EC_POINT_set_affine_coordinates()
883 int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, in EC_POINT_set_affine_coordinates_GFp() argument
887 return EC_POINT_set_affine_coordinates(group, point, x, y, ctx); in EC_POINT_set_affine_coordinates_GFp()
891 int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, in EC_POINT_set_affine_coordinates_GF2m() argument
895 return EC_POINT_set_affine_coordinates(group, point, x, y, ctx); in EC_POINT_set_affine_coordinates_GF2m()
900 int EC_POINT_get_affine_coordinates(const EC_GROUP *group, in EC_POINT_get_affine_coordinates() argument
904 if (group->meth->point_get_affine_coordinates == NULL) { in EC_POINT_get_affine_coordinates()
908 if (!ec_point_is_compat(point, group)) { in EC_POINT_get_affine_coordinates()
912 if (EC_POINT_is_at_infinity(group, point)) { in EC_POINT_get_affine_coordinates()
916 return group->meth->point_get_affine_coordinates(group, point, x, y, ctx); in EC_POINT_get_affine_coordinates()
920 int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, in EC_POINT_get_affine_coordinates_GFp() argument
924 return EC_POINT_get_affine_coordinates(group, point, x, y, ctx); in EC_POINT_get_affine_coordinates_GFp()
928 int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, in EC_POINT_get_affine_coordinates_GF2m() argument
932 return EC_POINT_get_affine_coordinates(group, point, x, y, ctx); in EC_POINT_get_affine_coordinates_GF2m()
937 int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, in EC_POINT_add() argument
940 if (group->meth->add == 0) { in EC_POINT_add()
944 if (!ec_point_is_compat(r, group) || !ec_point_is_compat(a, group) in EC_POINT_add()
945 || !ec_point_is_compat(b, group)) { in EC_POINT_add()
949 return group->meth->add(group, r, a, b, ctx); in EC_POINT_add()
952 int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, in EC_POINT_dbl() argument
955 if (group->meth->dbl == 0) { in EC_POINT_dbl()
959 if (!ec_point_is_compat(r, group) || !ec_point_is_compat(a, group)) { in EC_POINT_dbl()
963 return group->meth->dbl(group, r, a, ctx); in EC_POINT_dbl()
966 int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx) in EC_POINT_invert() argument
968 if (group->meth->invert == 0) { in EC_POINT_invert()
972 if (!ec_point_is_compat(a, group)) { in EC_POINT_invert()
976 return group->meth->invert(group, a, ctx); in EC_POINT_invert()
979 int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) in EC_POINT_is_at_infinity() argument
981 if (group->meth->is_at_infinity == 0) { in EC_POINT_is_at_infinity()
985 if (!ec_point_is_compat(point, group)) { in EC_POINT_is_at_infinity()
989 return group->meth->is_at_infinity(group, point); in EC_POINT_is_at_infinity()
999 int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, in EC_POINT_is_on_curve() argument
1002 if (group->meth->is_on_curve == 0) { in EC_POINT_is_on_curve()
1006 if (!ec_point_is_compat(point, group)) { in EC_POINT_is_on_curve()
1010 return group->meth->is_on_curve(group, point, ctx); in EC_POINT_is_on_curve()
1013 int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, in EC_POINT_cmp() argument
1016 if (group->meth->point_cmp == 0) { in EC_POINT_cmp()
1020 if (!ec_point_is_compat(a, group) || !ec_point_is_compat(b, group)) { in EC_POINT_cmp()
1024 return group->meth->point_cmp(group, a, b, ctx); in EC_POINT_cmp()
1028 int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) in EC_POINT_make_affine() argument
1030 if (group->meth->make_affine == 0) { in EC_POINT_make_affine()
1034 if (!ec_point_is_compat(point, group)) { in EC_POINT_make_affine()
1038 return group->meth->make_affine(group, point, ctx); in EC_POINT_make_affine()
1041 int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, in EC_POINTs_make_affine() argument
1046 if (group->meth->points_make_affine == 0) { in EC_POINTs_make_affine()
1051 if (!ec_point_is_compat(points[i], group)) { in EC_POINTs_make_affine()
1056 return group->meth->points_make_affine(group, num, points, ctx); in EC_POINTs_make_affine()
1067 int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, in EC_POINTs_mul() argument
1077 if (!ec_point_is_compat(r, group)) { in EC_POINTs_mul()
1083 return EC_POINT_set_to_infinity(group, r); in EC_POINTs_mul()
1086 if (!ec_point_is_compat(points[i], group)) { in EC_POINTs_mul()
1101 if (group->meth->mul != NULL) in EC_POINTs_mul()
1102 ret = group->meth->mul(group, r, scalar, num, points, scalars, ctx); in EC_POINTs_mul()
1105 ret = ossl_ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx); in EC_POINTs_mul()
1114 int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, in EC_POINT_mul() argument
1123 if (!ec_point_is_compat(r, group) in EC_POINT_mul()
1124 || (point != NULL && !ec_point_is_compat(point, group))) { in EC_POINT_mul()
1130 return EC_POINT_set_to_infinity(group, r); in EC_POINT_mul()
1142 if (group->meth->mul != NULL) in EC_POINT_mul()
1143 ret = group->meth->mul(group, r, g_scalar, num, &point, &p_scalar, ctx); in EC_POINT_mul()
1146 ret = ossl_ec_wNAF_mul(group, r, g_scalar, num, &point, &p_scalar, ctx); in EC_POINT_mul()
1155 int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx) in EC_GROUP_precompute_mult() argument
1157 if (group->meth->mul == 0) in EC_GROUP_precompute_mult()
1159 return ossl_ec_wNAF_precompute_mult(group, ctx); in EC_GROUP_precompute_mult()
1161 if (group->meth->precompute_mult != 0) in EC_GROUP_precompute_mult()
1162 return group->meth->precompute_mult(group, ctx); in EC_GROUP_precompute_mult()
1167 int EC_GROUP_have_precompute_mult(const EC_GROUP *group) in EC_GROUP_have_precompute_mult() argument
1169 if (group->meth->mul == 0) in EC_GROUP_have_precompute_mult()
1171 return ossl_ec_wNAF_have_precompute_mult(group); in EC_GROUP_have_precompute_mult()
1173 if (group->meth->have_precompute_mult != 0) in EC_GROUP_have_precompute_mult()
1174 return group->meth->have_precompute_mult(group); in EC_GROUP_have_precompute_mult()
1185 static int ec_precompute_mont_data(EC_GROUP *group) in ec_precompute_mont_data() argument
1187 BN_CTX *ctx = BN_CTX_new_ex(group->libctx); in ec_precompute_mont_data()
1190 BN_MONT_CTX_free(group->mont_data); in ec_precompute_mont_data()
1191 group->mont_data = NULL; in ec_precompute_mont_data()
1196 group->mont_data = BN_MONT_CTX_new(); in ec_precompute_mont_data()
1197 if (group->mont_data == NULL) in ec_precompute_mont_data()
1200 if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) { in ec_precompute_mont_data()
1201 BN_MONT_CTX_free(group->mont_data); in ec_precompute_mont_data()
1202 group->mont_data = NULL; in ec_precompute_mont_data()
1226 int ossl_ec_group_simple_order_bits(const EC_GROUP *group) in ossl_ec_group_simple_order_bits() argument
1228 if (group->order == NULL) in ossl_ec_group_simple_order_bits()
1230 return BN_num_bits(group->order); in ossl_ec_group_simple_order_bits()
1233 static int ec_field_inverse_mod_ord(const EC_GROUP *group, BIGNUM *r, in ec_field_inverse_mod_ord() argument
1242 if (group->mont_data == NULL) in ec_field_inverse_mod_ord()
1262 if (!BN_sub(e, group->order, e)) in ec_field_inverse_mod_ord()
1268 if (!BN_mod_exp_mont(r, x, e, group->order, ctx, group->mont_data)) in ec_field_inverse_mod_ord()
1294 int ossl_ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res, in ossl_ec_group_do_inverse_ord() argument
1297 if (group->meth->field_inverse_mod_ord != NULL) in ossl_ec_group_do_inverse_ord()
1298 return group->meth->field_inverse_mod_ord(group, res, x, ctx); in ossl_ec_group_do_inverse_ord()
1300 return ec_field_inverse_mod_ord(group, res, x, ctx); in ossl_ec_group_do_inverse_ord()
1313 int ossl_ec_point_blind_coordinates(const EC_GROUP *group, EC_POINT *p, in ossl_ec_point_blind_coordinates() argument
1316 if (group->meth->blind_coordinates == NULL) in ossl_ec_point_blind_coordinates()
1319 return group->meth->blind_coordinates(group, p, ctx); in ossl_ec_point_blind_coordinates()
1322 int EC_GROUP_get_basis_type(const EC_GROUP *group) in EC_GROUP_get_basis_type() argument
1326 if (EC_GROUP_get_field_type(group) != NID_X9_62_characteristic_two_field) in EC_GROUP_get_basis_type()
1332 i < (int)OSSL_NELEM(group->poly) && group->poly[i] != 0; in EC_GROUP_get_basis_type()
1346 int EC_GROUP_get_trinomial_basis(const EC_GROUP *group, unsigned int *k) in EC_GROUP_get_trinomial_basis() argument
1348 if (group == NULL) in EC_GROUP_get_trinomial_basis()
1351 if (EC_GROUP_get_field_type(group) != NID_X9_62_characteristic_two_field in EC_GROUP_get_trinomial_basis()
1352 || !((group->poly[0] != 0) && (group->poly[1] != 0) in EC_GROUP_get_trinomial_basis()
1353 && (group->poly[2] == 0))) { in EC_GROUP_get_trinomial_basis()
1359 *k = group->poly[1]; in EC_GROUP_get_trinomial_basis()
1364 int EC_GROUP_get_pentanomial_basis(const EC_GROUP *group, unsigned int *k1, in EC_GROUP_get_pentanomial_basis() argument
1367 if (group == NULL) in EC_GROUP_get_pentanomial_basis()
1370 if (EC_GROUP_get_field_type(group) != NID_X9_62_characteristic_two_field in EC_GROUP_get_pentanomial_basis()
1371 || !((group->poly[0] != 0) && (group->poly[1] != 0) in EC_GROUP_get_pentanomial_basis()
1372 && (group->poly[2] != 0) && (group->poly[3] != 0) in EC_GROUP_get_pentanomial_basis()
1373 && (group->poly[4] == 0))) { in EC_GROUP_get_pentanomial_basis()
1379 *k1 = group->poly[3]; in EC_GROUP_get_pentanomial_basis()
1381 *k2 = group->poly[2]; in EC_GROUP_get_pentanomial_basis()
1383 *k3 = group->poly[1]; in EC_GROUP_get_pentanomial_basis()
1401 static EC_GROUP *ec_group_explicit_to_named(const EC_GROUP *group, in ec_group_explicit_to_named() argument
1409 const EC_POINT *point = EC_GROUP_get0_generator(group); in ec_group_explicit_to_named()
1410 const BIGNUM *order = EC_GROUP_get0_order(group); in ec_group_explicit_to_named()
1411 int no_seed = (EC_GROUP_get0_seed(group) == NULL); in ec_group_explicit_to_named()
1413 if ((dup = EC_GROUP_dup(group)) == NULL in ec_group_explicit_to_named()
1461 ret_group = (EC_GROUP *)group; in ec_group_explicit_to_named()
1502 int ossl_ec_group_set_params(EC_GROUP *group, const OSSL_PARAM params[]) in ossl_ec_group_set_params() argument
1513 EC_GROUP_set_point_conversion_form(group, format); in ossl_ec_group_set_params()
1522 EC_GROUP_set_asn1_flag(group, encoding_flag); in ossl_ec_group_set_params()
1529 || !EC_GROUP_set_seed(group, p->data, p->data_size)) { in ossl_ec_group_set_params()
1541 EC_GROUP *group = NULL; in EC_GROUP_new_from_params() local
1561 if ((group = group_new_from_name(ptmp, libctx, propq)) == NULL) in EC_GROUP_new_from_params()
1563 if (!ossl_ec_group_set_params(group, params)) { in EC_GROUP_new_from_params()
1564 EC_GROUP_free(group); in EC_GROUP_new_from_params()
1572 EC_GROUP_free(group); in EC_GROUP_new_from_params()
1575 group->decoded_from_explicit_params = decoded > 0; in EC_GROUP_new_from_params()
1576 return group; in EC_GROUP_new_from_params()
1645 group = EC_GROUP_new_curve_GFp(p, a, b, bnctx); in EC_GROUP_new_from_params()
1652 group = EC_GROUP_new_curve_GF2m(p, a, b, NULL); in EC_GROUP_new_from_params()
1653 if (group != NULL) { in EC_GROUP_new_from_params()
1654 field_bits = EC_GROUP_get_degree(group); in EC_GROUP_new_from_params()
1663 if (group == NULL) { in EC_GROUP_new_from_params()
1675 if (!EC_GROUP_set_seed(group, ptmp->data, ptmp->data_size)) in EC_GROUP_new_from_params()
1687 if ((point = EC_POINT_new(group)) == NULL) in EC_GROUP_new_from_params()
1689 EC_GROUP_set_point_conversion_form(group, in EC_GROUP_new_from_params()
1691 if (!EC_POINT_oct2point(group, point, buf, ptmp->data_size, bnctx)) { in EC_GROUP_new_from_params()
1716 if (!EC_GROUP_set_generator(group, point, order, cofactor)) { in EC_GROUP_new_from_params()
1721 named_group = ec_group_explicit_to_named(group, libctx, propq, bnctx); in EC_GROUP_new_from_params()
1726 if (named_group == group) { in EC_GROUP_new_from_params()
1741 EC_GROUP_set_asn1_flag(group, OPENSSL_EC_EXPLICIT_CURVE); in EC_GROUP_new_from_params()
1743 EC_GROUP_free(group); in EC_GROUP_new_from_params()
1744 group = named_group; in EC_GROUP_new_from_params()
1747 group->decoded_from_explicit_params = 1; in EC_GROUP_new_from_params()
1751 EC_GROUP_free(group); in EC_GROUP_new_from_params()
1752 group = NULL; in EC_GROUP_new_from_params()
1758 return group; in EC_GROUP_new_from_params()