Lines Matching defs:group

117 void EC_GROUP_free(EC_GROUP *group)
119 if (!group)
122 if (group->meth->group_finish != 0)
123 group->meth->group_finish(group);
125 EC_EX_DATA_free_all_data(&group->extra_data);
127 if (group->generator != NULL)
128 EC_POINT_free(group->generator);
129 BN_free(&group->order);
130 BN_free(&group->cofactor);
132 if (group->seed)
133 OPENSSL_free(group->seed);
135 OPENSSL_free(group);
138 void EC_GROUP_clear_free(EC_GROUP *group)
140 if (!group)
143 if (group->meth->group_clear_finish != 0)
144 group->meth->group_clear_finish(group);
145 else if (group->meth->group_finish != 0)
146 group->meth->group_finish(group);
148 EC_EX_DATA_clear_free_all_data(&group->extra_data);
150 if (group->generator != NULL)
151 EC_POINT_clear_free(group->generator);
152 BN_clear_free(&group->order);
153 BN_clear_free(&group->cofactor);
155 if (group->seed) {
156 OPENSSL_cleanse(group->seed, group->seed_len);
157 OPENSSL_free(group->seed);
160 OPENSSL_cleanse(group, sizeof *group);
161 OPENSSL_free(group);
260 const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group)
262 return group->meth;
270 int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator,
278 if (group->generator == NULL) {
279 group->generator = EC_POINT_new(group);
280 if (group->generator == NULL)
283 if (!EC_POINT_copy(group->generator, generator))
287 if (!BN_copy(&group->order, order))
290 BN_zero(&group->order);
293 if (!BN_copy(&group->cofactor, cofactor))
296 BN_zero(&group->cofactor);
301 const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group)
303 return group->generator;
306 int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx)
308 if (!BN_copy(order, &group->order))
314 int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor,
317 if (!BN_copy(cofactor, &group->cofactor))
320 return !BN_is_zero(&group->cofactor);
323 void EC_GROUP_set_curve_name(EC_GROUP *group, int nid)
325 group->curve_name = nid;
328 int EC_GROUP_get_curve_name(const EC_GROUP *group)
330 return group->curve_name;
333 void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag)
335 group->asn1_flag = flag;
338 int EC_GROUP_get_asn1_flag(const EC_GROUP *group)
340 return group->asn1_flag;
343 void EC_GROUP_set_point_conversion_form(EC_GROUP *group,
346 group->asn1_form = form;
350 *group)
352 return group->asn1_form;
355 size_t EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *p, size_t len)
357 if (group->seed) {
358 OPENSSL_free(group->seed);
359 group->seed = NULL;
360 group->seed_len = 0;
366 if ((group->seed = OPENSSL_malloc(len)) == NULL)
368 memcpy(group->seed, p, len);
369 group->seed_len = len;
374 unsigned char *EC_GROUP_get0_seed(const EC_GROUP *group)
376 return group->seed;
379 size_t EC_GROUP_get_seed_len(const EC_GROUP *group)
381 return group->seed_len;
384 int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a,
387 if (group->meth->group_set_curve == 0) {
391 return group->meth->group_set_curve(group, p, a, b, ctx);
394 int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a,
397 if (group->meth->group_get_curve == 0) {
401 return group->meth->group_get_curve(group, p, a, b, ctx);
405 int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a,
408 if (group->meth->group_set_curve == 0) {
413 return group->meth->group_set_curve(group, p, a, b, ctx);
416 int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a,
419 if (group->meth->group_get_curve == 0) {
424 return group->meth->group_get_curve(group, p, a, b, ctx);
428 int EC_GROUP_get_degree(const EC_GROUP *group)
430 if (group->meth->group_get_degree == 0) {
434 return group->meth->group_get_degree(group);
437 int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx)
439 if (group->meth->group_check_discriminant == 0) {
444 return group->meth->group_check_discriminant(group, ctx);
666 EC_POINT *EC_POINT_new(const EC_GROUP *group)
670 if (group == NULL) {
674 if (group->meth->point_init == 0) {
685 ret->meth = group->meth;
733 EC_POINT *EC_POINT_dup(const EC_POINT *a, const EC_GROUP *group)
741 t = EC_POINT_new(group);
757 int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point)
759 if (group->meth->point_set_to_infinity == 0) {
764 if (group->meth != point->meth) {
768 return group->meth->point_set_to_infinity(group, point);
771 int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group,
776 if (group->meth->point_set_Jprojective_coordinates_GFp == 0) {
781 if (group->meth != point->meth) {
786 return group->meth->point_set_Jprojective_coordinates_GFp(group, point, x,
790 int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,
795 if (group->meth->point_get_Jprojective_coordinates_GFp == 0) {
800 if (group->meth != point->meth) {
805 return group->meth->point_get_Jprojective_coordinates_GFp(group, point, x,
809 int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group,
813 if (group->meth->point_set_affine_coordinates == 0) {
818 if (group->meth != point->meth) {
823 return group->meth->point_set_affine_coordinates(group, point, x, y, ctx);
827 int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group,
831 if (group->meth->point_set_affine_coordinates == 0) {
836 if (group->meth != point->meth) {
841 return group->meth->point_set_affine_coordinates(group, point, x, y, ctx);
845 int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,
849 if (group->meth->point_get_affine_coordinates == 0) {
854 if (group->meth != point->meth) {
859 return group->meth->point_get_affine_coordinates(group, point, x, y, ctx);
863 int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group,
867 if (group->meth->point_get_affine_coordinates == 0) {
872 if (group->meth != point->meth) {
877 return group->meth->point_get_affine_coordinates(group, point, x, y, ctx);
881 int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
884 if (group->meth->add == 0) {
888 if ((group->meth != r->meth) || (r->meth != a->meth)
893 return group->meth->add(group, r, a, b, ctx);
896 int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
899 if (group->meth->dbl == 0) {
903 if ((group->meth != r->meth) || (r->meth != a->meth)) {
907 return group->meth->dbl(group, r, a, ctx);
910 int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx)
912 if (group->meth->invert == 0) {
916 if (group->meth != a->meth) {
920 return group->meth->invert(group, a, ctx);
923 int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point)
925 if (group->meth->is_at_infinity == 0) {
930 if (group->meth != point->meth) {
934 return group->meth->is_at_infinity(group, point);
944 int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point,
947 if (group->meth->is_on_curve == 0) {
951 if (group->meth != point->meth) {
955 return group->meth->is_on_curve(group, point, ctx);
958 int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b,
961 if (group->meth->point_cmp == 0) {
965 if ((group->meth != a->meth) || (a->meth != b->meth)) {
969 return group->meth->point_cmp(group, a, b, ctx);
972 int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx)
974 if (group->meth->make_affine == 0) {
978 if (group->meth != point->meth) {
982 return group->meth->make_affine(group, point, ctx);
985 int EC_POINTs_make_affine(const EC_GROUP *group, size_t num,
990 if (group->meth->points_make_affine == 0) {
995 if (group->meth != points[i]->meth) {
1000 return group->meth->points_make_affine(group, num, points, ctx);
1004 * Functions for point multiplication. If group->meth->mul is 0, we use the
1009 int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
1013 if (group->meth->mul == 0)
1015 return ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx);
1017 return group->meth->mul(group, r, scalar, num, points, scalars, ctx);
1020 int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar,
1031 return EC_POINTs_mul(group, r, g_scalar,
1036 int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
1038 if (group->meth->mul == 0)
1040 return ec_wNAF_precompute_mult(group, ctx);
1042 if (group->meth->precompute_mult != 0)
1043 return group->meth->precompute_mult(group, ctx);
1048 int EC_GROUP_have_precompute_mult(const EC_GROUP *group)
1050 if (group->meth->mul == 0)
1052 return ec_wNAF_have_precompute_mult(group);
1054 if (group->meth->have_precompute_mult != 0)
1055 return group->meth->have_precompute_mult(group);