• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /barrelfish-2018-10-04/lib/openssl-1.0.0d/crypto/ec/

Lines Matching refs:group

127 int ec_GF2m_simple_group_init(EC_GROUP *group)
129 BN_init(&group->field);
130 BN_init(&group->a);
131 BN_init(&group->b);
139 void ec_GF2m_simple_group_finish(EC_GROUP *group)
141 BN_free(&group->field);
142 BN_free(&group->a);
143 BN_free(&group->b);
150 void ec_GF2m_simple_group_clear_finish(EC_GROUP *group)
152 BN_clear_free(&group->field);
153 BN_clear_free(&group->a);
154 BN_clear_free(&group->b);
155 group->poly[0] = 0;
156 group->poly[1] = 0;
157 group->poly[2] = 0;
158 group->poly[3] = 0;
159 group->poly[4] = 0;
160 group->poly[5] = -1;
188 int ec_GF2m_simple_group_set_curve(EC_GROUP *group,
193 /* group->field */
194 if (!BN_copy(&group->field, p)) goto err;
195 i = BN_GF2m_poly2arr(&group->field, group->poly, 6) - 1;
202 /* group->a */
203 if (!BN_GF2m_mod_arr(&group->a, a, group->poly)) goto err;
204 if(bn_wexpand(&group->a, (int)(group->poly[0] + BN_BITS2 - 1) / BN_BITS2) == NULL) goto err;
205 for (i = group->a.top; i < group->a.dmax; i++) group->a.d[i] = 0;
207 /* group->b */
208 if (!BN_GF2m_mod_arr(&group->b, b, group->poly)) goto err;
209 if(bn_wexpand(&group->b, (int)(group->poly[0] + BN_BITS2 - 1) / BN_BITS2) == NULL) goto err;
210 for (i = group->b.top; i < group->b.dmax; i++) group->b.d[i] = 0;
221 int ec_GF2m_simple_group_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx)
227 if (!BN_copy(p, &group->field)) return 0;
232 if (!BN_copy(a, &group->a)) goto err;
237 if (!BN_copy(b, &group->b)) goto err;
248 int ec_GF2m_simple_group_get_degree(const EC_GROUP *group)
250 return BN_num_bits(&group->field)-1;
257 int ec_GF2m_simple_group_check_discriminant(const EC_GROUP *group, BN_CTX *ctx)
276 if (!BN_GF2m_mod_arr(b, &group->b, group->poly)) goto err;
338 int ec_GF2m_simple_point_set_to_infinity(const EC_GROUP *group, EC_POINT *point)
349 int ec_GF2m_simple_point_set_affine_coordinates(const EC_GROUP *group, EC_POINT *point,
376 int ec_GF2m_simple_point_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *point,
381 if (EC_POINT_is_at_infinity(group, point))
424 int ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *point,
450 if (!BN_GF2m_mod_arr(x, x_, group->poly)) goto err;
453 if (!BN_GF2m_mod_sqrt_arr(y, &group->b, group->poly, ctx)) goto err;
457 if (!group->meth->field_sqr(group, tmp, x, ctx)) goto err;
458 if (!group->meth->field_div(group, tmp, &group->b, tmp, ctx)) goto err;
459 if (!BN_GF2m_add(tmp, &group->a, tmp)) goto err;
461 if (!BN_GF2m_mod_solve_quad_arr(z, tmp, group->poly, ctx))
475 if (!group->meth->field_mul(group, y, x, z, ctx)) goto err;
482 if (!EC_POINT_set_affine_coordinates_GF2m(group, point, x, y, ctx)) goto err;
498 size_t ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, point_conversion_form_t form,
515 if (EC_POINT_is_at_infinity(group, point))
532 field_len = (EC_GROUP_get_degree(group) + 7) / 8;
558 if (!EC_POINT_get_affine_coordinates_GF2m(group, point, x, y, ctx)) goto err;
563 if (!group->meth->field_div(group, yxi, y, x, ctx)) goto err;
630 int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
669 return EC_POINT_set_to_infinity(group, point);
672 field_len = (EC_GROUP_get_degree(group) + 7) / 8;
695 if (BN_ucmp(x, &group->field) >= 0)
703 if (!EC_POINT_set_compressed_coordinates_GF2m(group, point, x, y_bit, ctx)) goto err;
708 if (BN_ucmp(y, &group->field) >= 0)
715 if (!group->meth->field_div(group, yxi, y, x, ctx)) goto err;
723 if (!EC_POINT_set_affine_coordinates_GF2m(group, point, x, y, ctx)) goto err;
726 if (!EC_POINT_is_on_curve(group, point, ctx)) /* test required by X9.62 */
745 int ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx)
751 if (EC_POINT_is_at_infinity(group, a))
757 if (EC_POINT_is_at_infinity(group, b))
788 if (!EC_POINT_get_affine_coordinates_GF2m(group, a, x0, y0, ctx)) goto err;
797 if (!EC_POINT_get_affine_coordinates_GF2m(group, b, x1, y1, ctx)) goto err;
805 if (!group->meth->field_div(group, s, s, t, ctx)) goto err;
806 if (!group->meth->field_sqr(group, x2, s, ctx)) goto err;
807 if (!BN_GF2m_add(x2, x2, &group->a)) goto err;
815 if (!EC_POINT_set_to_infinity(group, r)) goto err;
819 if (!group->meth->field_div(group, s, y1, x1, ctx)) goto err;
822 if (!group->meth->field_sqr(group, x2, s, ctx)) goto err;
824 if (!BN_GF2m_add(x2, x2, &group->a)) goto err;
828 if (!group->meth->field_mul(group, y2, y2, s, ctx)) goto err;
832 if (!EC_POINT_set_affine_coordinates_GF2m(group, r, x2, y2, ctx)) goto err;
847 int ec_GF2m_simple_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx)
849 return ec_GF2m_simple_add(group, r, a, a, ctx);
853 int ec_GF2m_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx)
855 if (EC_POINT_is_at_infinity(group, point) || BN_is_zero(&point->Y))
859 if (!EC_POINT_make_affine(group, point, ctx)) return 0;
865 int ec_GF2m_simple_is_at_infinity(const EC_GROUP *group, const EC_POINT *point)
875 int ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx)
883 if (EC_POINT_is_at_infinity(group, point))
886 field_mul = group->meth->field_mul;
887 field_sqr = group->meth->field_sqr;
909 if (!BN_GF2m_add(lh, &point->X, &group->a)) goto err;
910 if (!field_mul(group, lh, lh, &point->X, ctx)) goto err;
912 if (!field_mul(group, lh, lh, &point->X, ctx)) goto err;
913 if (!BN_GF2m_add(lh, lh, &group->b)) goto err;
914 if (!field_sqr(group, y2, &point->Y, ctx)) goto err;
930 int ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx)
936 if (EC_POINT_is_at_infinity(group, a))
938 return EC_POINT_is_at_infinity(group, b) ? 0 : 1;
941 if (EC_POINT_is_at_infinity(group, b))
963 if (!EC_POINT_get_affine_coordinates_GF2m(group, a, aX, aY, ctx)) goto err;
964 if (!EC_POINT_get_affine_coordinates_GF2m(group, b, bX, bY, ctx)) goto err;
975 int ec_GF2m_simple_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx)
981 if (point->Z_is_one || EC_POINT_is_at_infinity(group, point))
996 if (!EC_POINT_get_affine_coordinates_GF2m(group, point, x, y, ctx)) goto err;
1011 int ec_GF2m_simple_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx)
1017 if (!group->meth->make_affine(group, points[i], ctx)) return 0;
1025 int ec_GF2m_simple_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
1027 return BN_GF2m_mod_mul_arr(r, a, b, group->poly, ctx);
1032 int ec_GF2m_simple_field_sqr(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
1034 return BN_GF2m_mod_sqr_arr(r, a, group->poly, ctx);
1039 int ec_GF2m_simple_field_div(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
1041 return BN_GF2m_mod_div(r, a, b, &group->field, ctx);