Home | History | Annotate | Download | only in ec

Lines Matching defs:group

290 int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator,
292 if (group->curve_name != NID_undef) {
298 if (group->generator == NULL) {
299 group->generator = EC_POINT_new(group);
300 if (group->generator == NULL) {
305 if (!EC_POINT_copy(group->generator, generator)) {
310 if (!BN_copy(&group->order, order)) {
314 BN_zero(&group->order);
318 if (!BN_copy(&group->cofactor, cofactor)) {
322 BN_zero(&group->cofactor);
329 EC_GROUP *group = NULL;
357 if (((group = ec_group_new(meth)) == NULL) ||
358 (!(group->meth->group_set_curve(group, p, a, b, ctx)))) {
363 if ((group = EC_GROUP_new_curve_GFp(p, a, b, ctx)) == NULL) {
369 if ((P = EC_POINT_new(group)) == NULL) {
380 if (!EC_POINT_set_affine_coordinates_GFp(group, P, x, y, ctx)) {
390 group->generator = P;
392 if (!BN_copy(&group->order, order) ||
393 !BN_set_word(&group->cofactor, (BN_ULONG)data->cofactor)) {
402 EC_GROUP_free(group);
403 group = NULL;
413 return group;
438 void EC_GROUP_free(EC_GROUP *group) {
439 if (!group) {
443 if (group->meth->group_finish != 0) {
444 group->meth->group_finish(group);
447 ec_pre_comp_free(group->pre_comp);
449 EC_POINT_free(group->generator);
450 BN_free(&group->order);
451 BN_free(&group->cofactor);
453 OPENSSL_free(group);
533 const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group) {
534 return group->generator;
537 int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx) {
538 if (!BN_copy(order, &group->order)) {
545 int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor,
547 if (!BN_copy(cofactor, &group->cofactor)) {
551 return !BN_is_zero(&group->cofactor);
554 int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *out_p, BIGNUM *out_a,
556 if (group->meth->group_get_curve == 0) {
561 return group->meth->group_get_curve(group, out_p, out_a, out_b, ctx);
564 int EC_GROUP_get_curve_name(const EC_GROUP *group) { return group->curve_name; }
566 int EC_GROUP_get_degree(const EC_GROUP *group) {
567 if (group->meth->group_get_degree == 0) {
572 return group->meth->group_get_degree(group);
575 int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx) {
576 if (group->meth->mul == 0) {
578 return ec_wNAF_precompute_mult(group, ctx);
581 if (group->meth->precompute_mult != 0) {
582 return group->meth->precompute_mult(group, ctx);
588 int EC_GROUP_have_precompute_mult(const EC_GROUP *group) {
589 if (group->meth->mul == 0) {
591 return ec_wNAF_have_precompute_mult(group);
594 if (group->meth->have_precompute_mult != 0) {
595 return group->meth->have_precompute_mult(group);
601 EC_POINT *EC_POINT_new(const EC_GROUP *group) {
604 if (group == NULL) {
608 if (group->meth->point_init == 0) {
619 ret->meth = group->meth;
669 EC_POINT *EC_POINT_dup(const EC_POINT *a, const EC_GROUP *group) {
677 t = EC_POINT_new(group);
691 int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point) {
692 if (group->meth->point_set_to_infinity == 0) {
697 if (group->meth != point->meth) {
701 return group->meth->point_set_to_infinity(group, point);
704 int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) {
705 if (group->meth->is_at_infinity == 0) {
710 if (group->meth != point->meth) {
714 return group->meth->is_at_infinity(group, point);
717 int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point,
719 if (group->meth->is_on_curve == 0) {
724 if (group->meth != point->meth) {
728 return group->meth->is_on_curve(group, point, ctx);
731 int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b,
733 if (group->meth->point_cmp == 0) {
737 if ((group->meth != a->meth) || (a->meth != b->meth)) {
741 return group->meth->point_cmp(group, a, b, ctx);
744 int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) {
745 if (group->meth->make_affine == 0) {
750 if (group->meth != point->meth) {
754 return group->meth->make_affine(group, point, ctx);
757 int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[],
761 if (group->meth->points_make_affine == 0) {
767 if (group->meth != points[i]->meth) {
772 return group->meth->points_make_affine(group, num, points, ctx);
775 int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,
778 if (group->meth->point_get_affine_coordinates == 0) {
783 if (group->meth != point->meth) {
788 return group->meth->point_get_affine_coordinates(group, point, x, y, ctx);
791 int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *point,
794 if (group->meth->point_set_affine_coordinates == 0) {
799 if (group->meth != point->meth) {
804 return group->meth->point_set_affine_coordinates(group, point, x, y, ctx);
807 int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
809 if (group->meth->add == 0) {
813 if ((group->meth != r->meth) || (r->meth != a->meth) ||
818 return group->meth->add(group, r, a, b, ctx);
822 int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
824 if (group->meth->dbl == 0) {
828 if ((group->meth != r->meth) || (r->meth != a->meth)) {
832 return group->meth->dbl(group, r, a, ctx);
836 int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx) {
837 if (group->meth->invert == 0) {
841 if (group->meth != a->meth) {
845 return group->meth->invert(group, a, ctx);
848 int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar,
858 return EC_POINTs_mul(group, r, g_scalar, (point != NULL && p_scalar != NULL),
862 int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
865 if (group->meth->mul == 0) {
867 return ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx);
870 return group->meth->mul(group, r, scalar, num, points, scalars, ctx);
873 int ec_point_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *point,
876 if (group->meth->point_set_Jprojective_coordinates_GFp == 0) {
881 if (group->meth != point->meth) {
886 return group->meth->point_set_Jprojective_coordinates_GFp(group, point, x, y,
890 void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag) {}
892 const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group) {
900 void EC_GROUP_set_point_conversion_form(EC_GROUP *group,