Lines Matching refs:group

85 void EC_pre_comp_free(EC_GROUP *group)  in EC_pre_comp_free()  argument
87 switch (group->pre_comp_type) { in EC_pre_comp_free()
92 EC_nistz256_pre_comp_free(group->pre_comp.nistz256); in EC_pre_comp_free()
97 EC_nistp224_pre_comp_free(group->pre_comp.nistp224); in EC_pre_comp_free()
100 EC_nistp256_pre_comp_free(group->pre_comp.nistp256); in EC_pre_comp_free()
103 ossl_ec_nistp384_pre_comp_free(group->pre_comp.nistp384); in EC_pre_comp_free()
106 EC_nistp521_pre_comp_free(group->pre_comp.nistp521); in EC_pre_comp_free()
116 EC_ec_pre_comp_free(group->pre_comp.ec); in EC_pre_comp_free()
119 group->pre_comp.ec = NULL; in EC_pre_comp_free()
122 void EC_GROUP_free(EC_GROUP *group) in EC_GROUP_free() argument
124 if (!group) in EC_GROUP_free()
127 if (group->meth->group_finish != 0) in EC_GROUP_free()
128 group->meth->group_finish(group); in EC_GROUP_free()
130 EC_pre_comp_free(group); in EC_GROUP_free()
131 BN_MONT_CTX_free(group->mont_data); in EC_GROUP_free()
132 EC_POINT_free(group->generator); in EC_GROUP_free()
133 BN_free(group->order); in EC_GROUP_free()
134 BN_free(group->cofactor); in EC_GROUP_free()
135 OPENSSL_free(group->seed); in EC_GROUP_free()
136 OPENSSL_free(group->propq); in EC_GROUP_free()
137 OPENSSL_free(group); in EC_GROUP_free()
141 void EC_GROUP_clear_free(EC_GROUP *group) in EC_GROUP_clear_free() argument
143 if (!group) in EC_GROUP_clear_free()
146 if (group->meth->group_clear_finish != 0) in EC_GROUP_clear_free()
147 group->meth->group_clear_finish(group); in EC_GROUP_clear_free()
148 else if (group->meth->group_finish != 0) in EC_GROUP_clear_free()
149 group->meth->group_finish(group); in EC_GROUP_clear_free()
151 EC_pre_comp_free(group); in EC_GROUP_clear_free()
152 BN_MONT_CTX_free(group->mont_data); in EC_GROUP_clear_free()
153 EC_POINT_clear_free(group->generator); in EC_GROUP_clear_free()
154 BN_clear_free(group->order); in EC_GROUP_clear_free()
155 BN_clear_free(group->cofactor); in EC_GROUP_clear_free()
156 OPENSSL_clear_free(group->seed, group->seed_len); in EC_GROUP_clear_free()
157 OPENSSL_clear_free(group, sizeof(*group)); in EC_GROUP_clear_free()
292 const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group) in EC_GROUP_method_of() argument
294 return group->meth; in EC_GROUP_method_of()
318 static int ec_guess_cofactor(EC_GROUP *group) { in ec_guess_cofactor() argument
327 if (BN_num_bits(group->order) <= (BN_num_bits(group->field) + 1) / 2 + 3) { in ec_guess_cofactor()
329 BN_zero(group->cofactor); in ec_guess_cofactor()
334 if ((ctx = BN_CTX_new_ex(group->libctx)) == NULL) in ec_guess_cofactor()
342 if (group->meth->field_type == NID_X9_62_characteristic_two_field) { in ec_guess_cofactor()
344 if (!BN_set_bit(q, BN_num_bits(group->field) - 1)) in ec_guess_cofactor()
347 if (!BN_copy(q, group->field)) in ec_guess_cofactor()
352 if (!BN_rshift1(group->cofactor, group->order) /* n/2 */ in ec_guess_cofactor()
353 || !BN_add(group->cofactor, group->cofactor, q) /* q + n/2 */ in ec_guess_cofactor()
355 || !BN_add(group->cofactor, group->cofactor, BN_value_one()) in ec_guess_cofactor()
357 || !BN_div(group->cofactor, NULL, group->cofactor, group->order, ctx)) in ec_guess_cofactor()
366 int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, in EC_GROUP_set_generator() argument
375 if (group->field == NULL || BN_is_zero(group->field) in EC_GROUP_set_generator()
376 || BN_is_negative(group->field)) { in EC_GROUP_set_generator()
387 || BN_num_bits(order) > BN_num_bits(group->field) + 1) { in EC_GROUP_set_generator()
402 if (group->generator == NULL) { in EC_GROUP_set_generator()
403 group->generator = EC_POINT_new(group); in EC_GROUP_set_generator()
404 if (group->generator == NULL) in EC_GROUP_set_generator()
407 if (!EC_POINT_copy(group->generator, generator)) in EC_GROUP_set_generator()
410 if (!BN_copy(group->order, order)) in EC_GROUP_set_generator()
415 if (!BN_copy(group->cofactor, cofactor)) in EC_GROUP_set_generator()
417 } else if (!ec_guess_cofactor(group)) { in EC_GROUP_set_generator()
418 BN_zero(group->cofactor); in EC_GROUP_set_generator()
427 if (BN_is_odd(group->order)) { in EC_GROUP_set_generator()
428 return ec_precompute_mont_data(group); in EC_GROUP_set_generator()
431 BN_MONT_CTX_free(group->mont_data); in EC_GROUP_set_generator()
432 group->mont_data = NULL; in EC_GROUP_set_generator()
436 const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group) in EC_GROUP_get0_generator() argument
438 return group->generator; in EC_GROUP_get0_generator()
441 BN_MONT_CTX *EC_GROUP_get_mont_data(const EC_GROUP *group) in EC_GROUP_get_mont_data() argument
443 return group->mont_data; in EC_GROUP_get_mont_data()
446 int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx) in EC_GROUP_get_order() argument
448 if (group->order == NULL) in EC_GROUP_get_order()
450 if (!BN_copy(order, group->order)) in EC_GROUP_get_order()
456 const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group) in EC_GROUP_get0_order() argument
458 return group->order; in EC_GROUP_get0_order()
461 int EC_GROUP_order_bits(const EC_GROUP *group) in EC_GROUP_order_bits() argument
463 return group->meth->group_order_bits(group); in EC_GROUP_order_bits()
466 int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, in EC_GROUP_get_cofactor() argument
470 if (group->cofactor == NULL) in EC_GROUP_get_cofactor()
472 if (!BN_copy(cofactor, group->cofactor)) in EC_GROUP_get_cofactor()
475 return !BN_is_zero(group->cofactor); in EC_GROUP_get_cofactor()
478 const BIGNUM *EC_GROUP_get0_cofactor(const EC_GROUP *group) in EC_GROUP_get0_cofactor() argument
480 return group->cofactor; in EC_GROUP_get0_cofactor()
483 void EC_GROUP_set_curve_name(EC_GROUP *group, int nid) in EC_GROUP_set_curve_name() argument
485 group->curve_name = nid; in EC_GROUP_set_curve_name()
486 group->asn1_flag = in EC_GROUP_set_curve_name()
492 int EC_GROUP_get_curve_name(const EC_GROUP *group) in EC_GROUP_get_curve_name() argument
494 return group->curve_name; in EC_GROUP_get_curve_name()
497 const BIGNUM *EC_GROUP_get0_field(const EC_GROUP *group) in EC_GROUP_get0_field() argument
499 return group->field; in EC_GROUP_get0_field()
502 int EC_GROUP_get_field_type(const EC_GROUP *group) in EC_GROUP_get_field_type() argument
504 return group->meth->field_type; in EC_GROUP_get_field_type()
507 void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag) in EC_GROUP_set_asn1_flag() argument
509 group->asn1_flag = flag; in EC_GROUP_set_asn1_flag()
512 int EC_GROUP_get_asn1_flag(const EC_GROUP *group) in EC_GROUP_get_asn1_flag() argument
514 return group->asn1_flag; in EC_GROUP_get_asn1_flag()
517 void EC_GROUP_set_point_conversion_form(EC_GROUP *group, in EC_GROUP_set_point_conversion_form() argument
520 group->asn1_form = form; in EC_GROUP_set_point_conversion_form()
524 *group) in EC_GROUP_get_point_conversion_form() argument
526 return group->asn1_form; in EC_GROUP_get_point_conversion_form()
529 size_t EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *p, size_t len) in EC_GROUP_set_seed() argument
531 OPENSSL_free(group->seed); in EC_GROUP_set_seed()
532 group->seed = NULL; in EC_GROUP_set_seed()
533 group->seed_len = 0; in EC_GROUP_set_seed()
538 if ((group->seed = OPENSSL_malloc(len)) == NULL) in EC_GROUP_set_seed()
540 memcpy(group->seed, p, len); in EC_GROUP_set_seed()
541 group->seed_len = len; in EC_GROUP_set_seed()
546 unsigned char *EC_GROUP_get0_seed(const EC_GROUP *group) in EC_GROUP_get0_seed() argument
548 return group->seed; in EC_GROUP_get0_seed()
551 size_t EC_GROUP_get_seed_len(const EC_GROUP *group) in EC_GROUP_get_seed_len() argument
553 return group->seed_len; in EC_GROUP_get_seed_len()
556 int EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, in EC_GROUP_set_curve() argument
559 if (group->meth->group_set_curve == 0) { in EC_GROUP_set_curve()
563 return group->meth->group_set_curve(group, p, a, b, ctx); in EC_GROUP_set_curve()
566 int EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, in EC_GROUP_get_curve() argument
569 if (group->meth->group_get_curve == NULL) { in EC_GROUP_get_curve()
573 return group->meth->group_get_curve(group, p, a, b, ctx); in EC_GROUP_get_curve()
577 int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, in EC_GROUP_set_curve_GFp() argument
580 return EC_GROUP_set_curve(group, p, a, b, ctx); in EC_GROUP_set_curve_GFp()
583 int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, in EC_GROUP_get_curve_GFp() argument
586 return EC_GROUP_get_curve(group, p, a, b, ctx); in EC_GROUP_get_curve_GFp()
590 int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, in EC_GROUP_set_curve_GF2m() argument
593 return EC_GROUP_set_curve(group, p, a, b, ctx); in EC_GROUP_set_curve_GF2m()
596 int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, in EC_GROUP_get_curve_GF2m() argument
599 return EC_GROUP_get_curve(group, p, a, b, ctx); in EC_GROUP_get_curve_GF2m()
604 int EC_GROUP_get_degree(const EC_GROUP *group) in EC_GROUP_get_degree() argument
606 if (group->meth->group_get_degree == 0) { in EC_GROUP_get_degree()
610 return group->meth->group_get_degree(group); in EC_GROUP_get_degree()
613 int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx) in EC_GROUP_check_discriminant() argument
615 if (group->meth->group_check_discriminant == 0) { in EC_GROUP_check_discriminant()
619 return group->meth->group_check_discriminant(group, ctx); in EC_GROUP_check_discriminant()
716 EC_POINT *EC_POINT_new(const EC_GROUP *group) in EC_POINT_new() argument
720 if (group == NULL) { in EC_POINT_new()
724 if (group->meth->point_init == NULL) { in EC_POINT_new()
733 ret->meth = group->meth; in EC_POINT_new()
734 ret->curve_name = group->curve_name; in EC_POINT_new()
788 EC_POINT *EC_POINT_dup(const EC_POINT *a, const EC_GROUP *group) in EC_POINT_dup() argument
796 t = EC_POINT_new(group); in EC_POINT_dup()
814 int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point) in EC_POINT_set_to_infinity() argument
816 if (group->meth->point_set_to_infinity == 0) { in EC_POINT_set_to_infinity()
820 if (group->meth != point->meth) { in EC_POINT_set_to_infinity()
824 return group->meth->point_set_to_infinity(group, point); in EC_POINT_set_to_infinity()
828 int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, in EC_POINT_set_Jprojective_coordinates_GFp() argument
833 if (group->meth->field_type != NID_X9_62_prime_field) { in EC_POINT_set_Jprojective_coordinates_GFp()
837 if (!ec_point_is_compat(point, group)) { in EC_POINT_set_Jprojective_coordinates_GFp()
841 return ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp(group, point, in EC_POINT_set_Jprojective_coordinates_GFp()
845 int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, in EC_POINT_get_Jprojective_coordinates_GFp() argument
850 if (group->meth->field_type != NID_X9_62_prime_field) { in EC_POINT_get_Jprojective_coordinates_GFp()
854 if (!ec_point_is_compat(point, group)) { in EC_POINT_get_Jprojective_coordinates_GFp()
858 return ossl_ec_GFp_simple_get_Jprojective_coordinates_GFp(group, point, in EC_POINT_get_Jprojective_coordinates_GFp()
863 int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *point, in EC_POINT_set_affine_coordinates() argument
867 if (group->meth->point_set_affine_coordinates == NULL) { in EC_POINT_set_affine_coordinates()
871 if (!ec_point_is_compat(point, group)) { in EC_POINT_set_affine_coordinates()
875 if (!group->meth->point_set_affine_coordinates(group, point, x, y, ctx)) in EC_POINT_set_affine_coordinates()
878 if (EC_POINT_is_on_curve(group, point, ctx) <= 0) { in EC_POINT_set_affine_coordinates()
886 int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, in EC_POINT_set_affine_coordinates_GFp() argument
890 return EC_POINT_set_affine_coordinates(group, point, x, y, ctx); in EC_POINT_set_affine_coordinates_GFp()
894 int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, in EC_POINT_set_affine_coordinates_GF2m() argument
898 return EC_POINT_set_affine_coordinates(group, point, x, y, ctx); in EC_POINT_set_affine_coordinates_GF2m()
903 int EC_POINT_get_affine_coordinates(const EC_GROUP *group, in EC_POINT_get_affine_coordinates() argument
907 if (group->meth->point_get_affine_coordinates == NULL) { in EC_POINT_get_affine_coordinates()
911 if (!ec_point_is_compat(point, group)) { in EC_POINT_get_affine_coordinates()
915 if (EC_POINT_is_at_infinity(group, point)) { in EC_POINT_get_affine_coordinates()
919 return group->meth->point_get_affine_coordinates(group, point, x, y, ctx); in EC_POINT_get_affine_coordinates()
923 int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, in EC_POINT_get_affine_coordinates_GFp() argument
927 return EC_POINT_get_affine_coordinates(group, point, x, y, ctx); in EC_POINT_get_affine_coordinates_GFp()
931 int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, in EC_POINT_get_affine_coordinates_GF2m() argument
935 return EC_POINT_get_affine_coordinates(group, point, x, y, ctx); in EC_POINT_get_affine_coordinates_GF2m()
940 int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, in EC_POINT_add() argument
943 if (group->meth->add == 0) { in EC_POINT_add()
947 if (!ec_point_is_compat(r, group) || !ec_point_is_compat(a, group) in EC_POINT_add()
948 || !ec_point_is_compat(b, group)) { in EC_POINT_add()
952 return group->meth->add(group, r, a, b, ctx); in EC_POINT_add()
955 int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, in EC_POINT_dbl() argument
958 if (group->meth->dbl == 0) { in EC_POINT_dbl()
962 if (!ec_point_is_compat(r, group) || !ec_point_is_compat(a, group)) { in EC_POINT_dbl()
966 return group->meth->dbl(group, r, a, ctx); in EC_POINT_dbl()
969 int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx) in EC_POINT_invert() argument
971 if (group->meth->invert == 0) { in EC_POINT_invert()
975 if (!ec_point_is_compat(a, group)) { in EC_POINT_invert()
979 return group->meth->invert(group, a, ctx); in EC_POINT_invert()
982 int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) in EC_POINT_is_at_infinity() argument
984 if (group->meth->is_at_infinity == 0) { in EC_POINT_is_at_infinity()
988 if (!ec_point_is_compat(point, group)) { in EC_POINT_is_at_infinity()
992 return group->meth->is_at_infinity(group, point); in EC_POINT_is_at_infinity()
1002 int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, in EC_POINT_is_on_curve() argument
1005 if (group->meth->is_on_curve == 0) { in EC_POINT_is_on_curve()
1009 if (!ec_point_is_compat(point, group)) { in EC_POINT_is_on_curve()
1013 return group->meth->is_on_curve(group, point, ctx); in EC_POINT_is_on_curve()
1016 int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, in EC_POINT_cmp() argument
1019 if (group->meth->point_cmp == 0) { in EC_POINT_cmp()
1023 if (!ec_point_is_compat(a, group) || !ec_point_is_compat(b, group)) { in EC_POINT_cmp()
1027 return group->meth->point_cmp(group, a, b, ctx); in EC_POINT_cmp()
1031 int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) in EC_POINT_make_affine() argument
1033 if (group->meth->make_affine == 0) { in EC_POINT_make_affine()
1037 if (!ec_point_is_compat(point, group)) { in EC_POINT_make_affine()
1041 return group->meth->make_affine(group, point, ctx); in EC_POINT_make_affine()
1044 int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, in EC_POINTs_make_affine() argument
1049 if (group->meth->points_make_affine == 0) { in EC_POINTs_make_affine()
1054 if (!ec_point_is_compat(points[i], group)) { in EC_POINTs_make_affine()
1059 return group->meth->points_make_affine(group, num, points, ctx); in EC_POINTs_make_affine()
1070 int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, in EC_POINTs_mul() argument
1080 if (!ec_point_is_compat(r, group)) { in EC_POINTs_mul()
1086 return EC_POINT_set_to_infinity(group, r); in EC_POINTs_mul()
1089 if (!ec_point_is_compat(points[i], group)) { in EC_POINTs_mul()
1104 if (group->meth->mul != NULL) in EC_POINTs_mul()
1105 ret = group->meth->mul(group, r, scalar, num, points, scalars, ctx); in EC_POINTs_mul()
1108 ret = ossl_ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx); in EC_POINTs_mul()
1117 int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, in EC_POINT_mul() argument
1126 if (!ec_point_is_compat(r, group) in EC_POINT_mul()
1127 || (point != NULL && !ec_point_is_compat(point, group))) { in EC_POINT_mul()
1133 return EC_POINT_set_to_infinity(group, r); in EC_POINT_mul()
1145 if (group->meth->mul != NULL) in EC_POINT_mul()
1146 ret = group->meth->mul(group, r, g_scalar, num, &point, &p_scalar, ctx); in EC_POINT_mul()
1149 ret = ossl_ec_wNAF_mul(group, r, g_scalar, num, &point, &p_scalar, ctx); in EC_POINT_mul()
1158 int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx) in EC_GROUP_precompute_mult() argument
1160 if (group->meth->mul == 0) in EC_GROUP_precompute_mult()
1162 return ossl_ec_wNAF_precompute_mult(group, ctx); in EC_GROUP_precompute_mult()
1164 if (group->meth->precompute_mult != 0) in EC_GROUP_precompute_mult()
1165 return group->meth->precompute_mult(group, ctx); in EC_GROUP_precompute_mult()
1170 int EC_GROUP_have_precompute_mult(const EC_GROUP *group) in EC_GROUP_have_precompute_mult() argument
1172 if (group->meth->mul == 0) in EC_GROUP_have_precompute_mult()
1174 return ossl_ec_wNAF_have_precompute_mult(group); in EC_GROUP_have_precompute_mult()
1176 if (group->meth->have_precompute_mult != 0) in EC_GROUP_have_precompute_mult()
1177 return group->meth->have_precompute_mult(group); in EC_GROUP_have_precompute_mult()
1188 static int ec_precompute_mont_data(EC_GROUP *group) in ec_precompute_mont_data() argument
1190 BN_CTX *ctx = BN_CTX_new_ex(group->libctx); in ec_precompute_mont_data()
1193 BN_MONT_CTX_free(group->mont_data); in ec_precompute_mont_data()
1194 group->mont_data = NULL; in ec_precompute_mont_data()
1199 group->mont_data = BN_MONT_CTX_new(); in ec_precompute_mont_data()
1200 if (group->mont_data == NULL) in ec_precompute_mont_data()
1203 if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) { in ec_precompute_mont_data()
1204 BN_MONT_CTX_free(group->mont_data); in ec_precompute_mont_data()
1205 group->mont_data = NULL; in ec_precompute_mont_data()
1229 int ossl_ec_group_simple_order_bits(const EC_GROUP *group) in ossl_ec_group_simple_order_bits() argument
1231 if (group->order == NULL) in ossl_ec_group_simple_order_bits()
1233 return BN_num_bits(group->order); in ossl_ec_group_simple_order_bits()
1236 static int ec_field_inverse_mod_ord(const EC_GROUP *group, BIGNUM *r, in ec_field_inverse_mod_ord() argument
1245 if (group->mont_data == NULL) in ec_field_inverse_mod_ord()
1265 if (!BN_sub(e, group->order, e)) in ec_field_inverse_mod_ord()
1271 if (!BN_mod_exp_mont(r, x, e, group->order, ctx, group->mont_data)) in ec_field_inverse_mod_ord()
1297 int ossl_ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res, in ossl_ec_group_do_inverse_ord() argument
1300 if (group->meth->field_inverse_mod_ord != NULL) in ossl_ec_group_do_inverse_ord()
1301 return group->meth->field_inverse_mod_ord(group, res, x, ctx); in ossl_ec_group_do_inverse_ord()
1303 return ec_field_inverse_mod_ord(group, res, x, ctx); in ossl_ec_group_do_inverse_ord()
1316 int ossl_ec_point_blind_coordinates(const EC_GROUP *group, EC_POINT *p, in ossl_ec_point_blind_coordinates() argument
1319 if (group->meth->blind_coordinates == NULL) in ossl_ec_point_blind_coordinates()
1322 return group->meth->blind_coordinates(group, p, ctx); in ossl_ec_point_blind_coordinates()
1325 int EC_GROUP_get_basis_type(const EC_GROUP *group) in EC_GROUP_get_basis_type() argument
1329 if (EC_GROUP_get_field_type(group) != NID_X9_62_characteristic_two_field) in EC_GROUP_get_basis_type()
1335 i < (int)OSSL_NELEM(group->poly) && group->poly[i] != 0; in EC_GROUP_get_basis_type()
1349 int EC_GROUP_get_trinomial_basis(const EC_GROUP *group, unsigned int *k) in EC_GROUP_get_trinomial_basis() argument
1351 if (group == NULL) in EC_GROUP_get_trinomial_basis()
1354 if (EC_GROUP_get_field_type(group) != NID_X9_62_characteristic_two_field in EC_GROUP_get_trinomial_basis()
1355 || !((group->poly[0] != 0) && (group->poly[1] != 0) in EC_GROUP_get_trinomial_basis()
1356 && (group->poly[2] == 0))) { in EC_GROUP_get_trinomial_basis()
1362 *k = group->poly[1]; in EC_GROUP_get_trinomial_basis()
1367 int EC_GROUP_get_pentanomial_basis(const EC_GROUP *group, unsigned int *k1, in EC_GROUP_get_pentanomial_basis() argument
1370 if (group == NULL) in EC_GROUP_get_pentanomial_basis()
1373 if (EC_GROUP_get_field_type(group) != NID_X9_62_characteristic_two_field in EC_GROUP_get_pentanomial_basis()
1374 || !((group->poly[0] != 0) && (group->poly[1] != 0) in EC_GROUP_get_pentanomial_basis()
1375 && (group->poly[2] != 0) && (group->poly[3] != 0) in EC_GROUP_get_pentanomial_basis()
1376 && (group->poly[4] == 0))) { in EC_GROUP_get_pentanomial_basis()
1382 *k1 = group->poly[3]; in EC_GROUP_get_pentanomial_basis()
1384 *k2 = group->poly[2]; in EC_GROUP_get_pentanomial_basis()
1386 *k3 = group->poly[1]; in EC_GROUP_get_pentanomial_basis()
1404 static EC_GROUP *ec_group_explicit_to_named(const EC_GROUP *group, in ec_group_explicit_to_named() argument
1412 const EC_POINT *point = EC_GROUP_get0_generator(group); in ec_group_explicit_to_named()
1413 const BIGNUM *order = EC_GROUP_get0_order(group); in ec_group_explicit_to_named()
1414 int no_seed = (EC_GROUP_get0_seed(group) == NULL); in ec_group_explicit_to_named()
1416 if ((dup = EC_GROUP_dup(group)) == NULL in ec_group_explicit_to_named()
1464 ret_group = (EC_GROUP *)group; in ec_group_explicit_to_named()
1505 int ossl_ec_group_set_params(EC_GROUP *group, const OSSL_PARAM params[]) in ossl_ec_group_set_params() argument
1516 EC_GROUP_set_point_conversion_form(group, format); in ossl_ec_group_set_params()
1525 EC_GROUP_set_asn1_flag(group, encoding_flag); in ossl_ec_group_set_params()
1532 || !EC_GROUP_set_seed(group, p->data, p->data_size)) { in ossl_ec_group_set_params()
1544 EC_GROUP *group = NULL; in EC_GROUP_new_from_params() local
1564 if ((group = group_new_from_name(ptmp, libctx, propq)) == NULL) in EC_GROUP_new_from_params()
1566 if (!ossl_ec_group_set_params(group, params)) { in EC_GROUP_new_from_params()
1567 EC_GROUP_free(group); in EC_GROUP_new_from_params()
1575 EC_GROUP_free(group); in EC_GROUP_new_from_params()
1578 group->decoded_from_explicit_params = decoded > 0; in EC_GROUP_new_from_params()
1579 return group; in EC_GROUP_new_from_params()
1648 group = EC_GROUP_new_curve_GFp(p, a, b, bnctx); in EC_GROUP_new_from_params()
1655 group = EC_GROUP_new_curve_GF2m(p, a, b, NULL); in EC_GROUP_new_from_params()
1656 if (group != NULL) { in EC_GROUP_new_from_params()
1657 field_bits = EC_GROUP_get_degree(group); in EC_GROUP_new_from_params()
1666 if (group == NULL) { in EC_GROUP_new_from_params()
1678 if (!EC_GROUP_set_seed(group, ptmp->data, ptmp->data_size)) in EC_GROUP_new_from_params()
1690 if ((point = EC_POINT_new(group)) == NULL) in EC_GROUP_new_from_params()
1692 EC_GROUP_set_point_conversion_form(group, in EC_GROUP_new_from_params()
1694 if (!EC_POINT_oct2point(group, point, buf, ptmp->data_size, bnctx)) { in EC_GROUP_new_from_params()
1719 if (!EC_GROUP_set_generator(group, point, order, cofactor)) { in EC_GROUP_new_from_params()
1724 named_group = ec_group_explicit_to_named(group, libctx, propq, bnctx); in EC_GROUP_new_from_params()
1729 if (named_group == group) { in EC_GROUP_new_from_params()
1744 EC_GROUP_set_asn1_flag(group, OPENSSL_EC_EXPLICIT_CURVE); in EC_GROUP_new_from_params()
1746 EC_GROUP_free(group); in EC_GROUP_new_from_params()
1747 group = named_group; in EC_GROUP_new_from_params()
1750 group->decoded_from_explicit_params = 1; in EC_GROUP_new_from_params()
1754 EC_GROUP_free(group); in EC_GROUP_new_from_params()
1755 group = NULL; in EC_GROUP_new_from_params()
1761 return group; in EC_GROUP_new_from_params()
1765 OSSL_PARAM *EC_GROUP_to_params(const EC_GROUP *group, OSSL_LIB_CTX *libctx, in EC_GROUP_to_params() argument
1773 if (group == NULL) in EC_GROUP_to_params()
1787 group, tmpl, NULL, libctx, propq, bnctx, &gen_buf)) in EC_GROUP_to_params()