Lines Matching defs:group

139 int ec_GF2m_simple_group_init(EC_GROUP *group)
141 BN_init(&group->field);
142 BN_init(&group->a);
143 BN_init(&group->b);
151 void ec_GF2m_simple_group_finish(EC_GROUP *group)
153 BN_free(&group->field);
154 BN_free(&group->a);
155 BN_free(&group->b);
162 void ec_GF2m_simple_group_clear_finish(EC_GROUP *group)
164 BN_clear_free(&group->field);
165 BN_clear_free(&group->a);
166 BN_clear_free(&group->b);
167 group->poly[0] = 0;
168 group->poly[1] = 0;
169 group->poly[2] = 0;
170 group->poly[3] = 0;
171 group->poly[4] = 0;
172 group->poly[5] = -1;
208 int ec_GF2m_simple_group_set_curve(EC_GROUP *group,
214 /* group->field */
215 if (!BN_copy(&group->field, p))
217 i = BN_GF2m_poly2arr(&group->field, group->poly, 6) - 1;
223 /* group->a */
224 if (!BN_GF2m_mod_arr(&group->a, a, group->poly))
226 if (bn_wexpand(&group->a, (int)(group->poly[0] + BN_BITS2 - 1) / BN_BITS2)
229 for (i = group->a.top; i < group->a.dmax; i++)
230 group->a.d[i] = 0;
232 /* group->b */
233 if (!BN_GF2m_mod_arr(&group->b, b, group->poly))
235 if (bn_wexpand(&group->b, (int)(group->poly[0] + BN_BITS2 - 1) / BN_BITS2)
238 for (i = group->b.top; i < group->b.dmax; i++)
239 group->b.d[i] = 0;
250 int ec_GF2m_simple_group_get_curve(const EC_GROUP *group, BIGNUM *p,
256 if (!BN_copy(p, &group->field))
261 if (!BN_copy(a, &group->a))
266 if (!BN_copy(b, &group->b))
280 int ec_GF2m_simple_group_get_degree(const EC_GROUP *group)
282 return BN_num_bits(&group->field) - 1;
289 int ec_GF2m_simple_group_check_discriminant(const EC_GROUP *group,
309 if (!BN_GF2m_mod_arr(b, &group->b, group->poly))
376 int ec_GF2m_simple_point_set_to_infinity(const EC_GROUP *group,
388 int ec_GF2m_simple_point_set_affine_coordinates(const EC_GROUP *group,
420 int ec_GF2m_simple_point_get_affine_coordinates(const EC_GROUP *group,
427 if (EC_POINT_is_at_infinity(group, point)) {
458 int ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
465 if (EC_POINT_is_at_infinity(group, a)) {
471 if (EC_POINT_is_at_infinity(group, b)) {
501 if (!EC_POINT_get_affine_coordinates_GF2m(group, a, x0, y0, ctx))
510 if (!EC_POINT_get_affine_coordinates_GF2m(group, b, x1, y1, ctx))
519 if (!group->meth->field_div(group, s, s, t, ctx))
521 if (!group->meth->field_sqr(group, x2, s, ctx))
523 if (!BN_GF2m_add(x2, x2, &group->a))
531 if (!EC_POINT_set_to_infinity(group, r))
536 if (!group->meth->field_div(group, s, y1, x1, ctx))
541 if (!group->meth->field_sqr(group, x2, s, ctx))
545 if (!BN_GF2m_add(x2, x2, &group->a))
551 if (!group->meth->field_mul(group, y2, y2, s, ctx))
558 if (!EC_POINT_set_affine_coordinates_GF2m(group, r, x2, y2, ctx))
574 int ec_GF2m_simple_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
577 return ec_GF2m_simple_add(group, r, a, a, ctx);
580 int ec_GF2m_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx)
582 if (EC_POINT_is_at_infinity(group, point) || BN_is_zero(&point->Y))
586 if (!EC_POINT_make_affine(group, point, ctx))
592 int ec_GF2m_simple_is_at_infinity(const EC_GROUP *group,
603 int ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point,
613 if (EC_POINT_is_at_infinity(group, point))
616 field_mul = group->meth->field_mul;
617 field_sqr = group->meth->field_sqr;
641 if (!BN_GF2m_add(lh, &point->X, &group->a))
643 if (!field_mul(group, lh, lh, &point->X, ctx))
647 if (!field_mul(group, lh, lh, &point->X, ctx))
649 if (!BN_GF2m_add(lh, lh, &group->b))
651 if (!field_sqr(group, y2, &point->Y, ctx))
671 int ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a,
678 if (EC_POINT_is_at_infinity(group, a)) {
679 return EC_POINT_is_at_infinity(group, b) ? 0 : 1;
682 if (EC_POINT_is_at_infinity(group, b))
704 if (!EC_POINT_get_affine_coordinates_GF2m(group, a, aX, aY, ctx))
706 if (!EC_POINT_get_affine_coordinates_GF2m(group, b, bX, bY, ctx))
719 int ec_GF2m_simple_make_affine(const EC_GROUP *group, EC_POINT *point,
726 if (point->Z_is_one || EC_POINT_is_at_infinity(group, point))
741 if (!EC_POINT_get_affine_coordinates_GF2m(group, point, x, y, ctx))
763 int ec_GF2m_simple_points_make_affine(const EC_GROUP *group, size_t num,
769 if (!group->meth->make_affine(group, points[i], ctx))
777 int ec_GF2m_simple_field_mul(const EC_GROUP *group, BIGNUM *r,
780 return BN_GF2m_mod_mul_arr(r, a, b, group->poly, ctx);
784 int ec_GF2m_simple_field_sqr(const EC_GROUP *group, BIGNUM *r,
787 return BN_GF2m_mod_sqr_arr(r, a, group->poly, ctx);
791 int ec_GF2m_simple_field_div(const EC_GROUP *group, BIGNUM *r,
794 return BN_GF2m_mod_div(r, a, b, &group->field, ctx);