• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/openssl-1.0.2h/crypto/ec/

Lines Matching refs:group

118 void EC_GROUP_free(EC_GROUP *group)
120 if (!group)
123 if (group->meth->group_finish != 0)
124 group->meth->group_finish(group);
126 EC_EX_DATA_free_all_data(&group->extra_data);
128 if (EC_GROUP_VERSION(group) && group->mont_data)
129 BN_MONT_CTX_free(group->mont_data);
131 if (group->generator != NULL)
132 EC_POINT_free(group->generator);
133 BN_free(&group->order);
134 BN_free(&group->cofactor);
136 if (group->seed)
137 OPENSSL_free(group->seed);
139 OPENSSL_free(group);
142 void EC_GROUP_clear_free(EC_GROUP *group)
144 if (!group)
147 if (group->meth->group_clear_finish != 0)
148 group->meth->group_clear_finish(group);
149 else if (group->meth->group_finish != 0)
150 group->meth->group_finish(group);
152 EC_EX_DATA_clear_free_all_data(&group->extra_data);
154 if (EC_GROUP_VERSION(group) && group->mont_data)
155 BN_MONT_CTX_free(group->mont_data);
157 if (group->generator != NULL)
158 EC_POINT_clear_free(group->generator);
159 BN_clear_free(&group->order);
160 BN_clear_free(&group->cofactor);
162 if (group->seed) {
163 OPENSSL_cleanse(group->seed, group->seed_len);
164 OPENSSL_free(group->seed);
167 OPENSSL_cleanse(group, sizeof *group);
168 OPENSSL_free(group);
283 const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group)
285 return group->meth;
293 int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator,
301 if (group->generator == NULL) {
302 group->generator = EC_POINT_new(group);
303 if (group->generator == NULL)
306 if (!EC_POINT_copy(group->generator, generator))
310 if (!BN_copy(&group->order, order))
313 BN_zero(&group->order);
316 if (!BN_copy(&group->cofactor, cofactor))
319 BN_zero(&group->cofactor);
324 * |group->mont_data| will be NULL in this case.
326 ec_precompute_mont_data(group);
331 const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group)
333 return group->generator;
336 BN_MONT_CTX *EC_GROUP_get_mont_data(const EC_GROUP *group)
338 return EC_GROUP_VERSION(group) ? group->mont_data : NULL;
341 int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx)
343 if (!BN_copy(order, &group->order))
349 int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor,
352 if (!BN_copy(cofactor, &group->cofactor))
355 return !BN_is_zero(&group->cofactor);
358 void EC_GROUP_set_curve_name(EC_GROUP *group, int nid)
360 group->curve_name = nid;
363 int EC_GROUP_get_curve_name(const EC_GROUP *group)
365 return group->curve_name;
368 void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag)
370 group->asn1_flag &= ~EC_GROUP_ASN1_FLAG_MASK;
371 group->asn1_flag |= flag & EC_GROUP_ASN1_FLAG_MASK;
374 int EC_GROUP_get_asn1_flag(const EC_GROUP *group)
376 return group->asn1_flag & EC_GROUP_ASN1_FLAG_MASK;
379 void EC_GROUP_set_point_conversion_form(EC_GROUP *group,
382 group->asn1_form = form;
386 *group)
388 return group->asn1_form;
391 size_t EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *p, size_t len)
393 if (group->seed) {
394 OPENSSL_free(group->seed);
395 group->seed = NULL;
396 group->seed_len = 0;
402 if ((group->seed = OPENSSL_malloc(len)) == NULL)
404 memcpy(group->seed, p, len);
405 group->seed_len = len;
410 unsigned char *EC_GROUP_get0_seed(const EC_GROUP *group)
412 return group->seed;
415 size_t EC_GROUP_get_seed_len(const EC_GROUP *group)
417 return group->seed_len;
420 int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a,
423 if (group->meth->group_set_curve == 0) {
427 return group->meth->group_set_curve(group, p, a, b, ctx);
430 int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a,
433 if (group->meth->group_get_curve == 0) {
437 return group->meth->group_get_curve(group, p, a, b, ctx);
441 int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a,
444 if (group->meth->group_set_curve == 0) {
449 return group->meth->group_set_curve(group, p, a, b, ctx);
452 int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a,
455 if (group->meth->group_get_curve == 0) {
460 return group->meth->group_get_curve(group, p, a, b, ctx);
464 int EC_GROUP_get_degree(const EC_GROUP *group)
466 if (group->meth->group_get_degree == 0) {
470 return group->meth->group_get_degree(group);
473 int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx)
475 if (group->meth->group_check_discriminant == 0) {
480 return group->meth->group_check_discriminant(group, ctx);
702 EC_POINT *EC_POINT_new(const EC_GROUP *group)
706 if (group == NULL) {
710 if (group->meth->point_init == 0) {
721 ret->meth = group->meth;
769 EC_POINT *EC_POINT_dup(const EC_POINT *a, const EC_GROUP *group)
777 t = EC_POINT_new(group);
793 int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point)
795 if (group->meth->point_set_to_infinity == 0) {
800 if (group->meth != point->meth) {
804 return group->meth->point_set_to_infinity(group, point);
807 int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group,
812 if (group->meth->point_set_Jprojective_coordinates_GFp == 0) {
817 if (group->meth != point->meth) {
822 return group->meth->point_set_Jprojective_coordinates_GFp(group, point, x,
826 int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,
831 if (group->meth->point_get_Jprojective_coordinates_GFp == 0) {
836 if (group->meth != point->meth) {
841 return group->meth->point_get_Jprojective_coordinates_GFp(group, point, x,
845 int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group,
849 if (group->meth->point_set_affine_coordinates == 0) {
854 if (group->meth != point->meth) {
859 return group->meth->point_set_affine_coordinates(group, point, x, y, ctx);
863 int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group,
867 if (group->meth->point_set_affine_coordinates == 0) {
872 if (group->meth != point->meth) {
877 return group->meth->point_set_affine_coordinates(group, point, x, y, ctx);
881 int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,
885 if (group->meth->point_get_affine_coordinates == 0) {
890 if (group->meth != point->meth) {
895 return group->meth->point_get_affine_coordinates(group, point, x, y, ctx);
899 int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group,
903 if (group->meth->point_get_affine_coordinates == 0) {
908 if (group->meth != point->meth) {
913 return group->meth->point_get_affine_coordinates(group, point, x, y, ctx);
917 int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
920 if (group->meth->add == 0) {
924 if ((group->meth != r->meth) || (r->meth != a->meth)
929 return group->meth->add(group, r, a, b, ctx);
932 int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
935 if (group->meth->dbl == 0) {
939 if ((group->meth != r->meth) || (r->meth != a->meth)) {
943 return group->meth->dbl(group, r, a, ctx);
946 int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx)
948 if (group->meth->invert == 0) {
952 if (group->meth != a->meth) {
956 return group->meth->invert(group, a, ctx);
959 int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point)
961 if (group->meth->is_at_infinity == 0) {
966 if (group->meth != point->meth) {
970 return group->meth->is_at_infinity(group, point);
980 int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point,
983 if (group->meth->is_on_curve == 0) {
987 if (group->meth != point->meth) {
991 return group->meth->is_on_curve(group, point, ctx);
994 int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b,
997 if (group->meth->point_cmp == 0) {
1001 if ((group->meth != a->meth) || (a->meth != b->meth)) {
1005 return group->meth->point_cmp(group, a, b, ctx);
1008 int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx)
1010 if (group->meth->make_affine == 0) {
1014 if (group->meth != point->meth) {
1018 return group->meth->make_affine(group, point, ctx);
1021 int EC_POINTs_make_affine(const EC_GROUP *group, size_t num,
1026 if (group->meth->points_make_affine == 0) {
1031 if (group->meth != points[i]->meth) {
1036 return group->meth->points_make_affine(group, num, points, ctx);
1040 * Functions for point multiplication. If group->meth->mul is 0, we use the
1045 int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
1049 if (group->meth->mul == 0)
1051 return ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx);
1053 return group->meth->mul(group, r, scalar, num, points, scalars, ctx);
1056 int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar,
1067 return EC_POINTs_mul(group, r, g_scalar,
1072 int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
1074 if (group->meth->mul == 0)
1076 return ec_wNAF_precompute_mult(group, ctx);
1078 if (group->meth->precompute_mult != 0)
1079 return group->meth->precompute_mult(group, ctx);
1084 int EC_GROUP_have_precompute_mult(const EC_GROUP *group)
1086 if (group->meth->mul == 0)
1088 return ec_wNAF_have_precompute_mult(group);
1090 if (group->meth->have_precompute_mult != 0)
1091 return group->meth->have_precompute_mult(group);
1098 * ec_precompute_mont_data sets |group->mont_data| from |group->order| and
1101 int ec_precompute_mont_data(EC_GROUP *group)
1106 if (!EC_GROUP_VERSION(group))
1109 if (group->mont_data) {
1110 BN_MONT_CTX_free(group->mont_data);
1111 group->mont_data = NULL;
1117 group->mont_data = BN_MONT_CTX_new();
1118 if (!group->mont_data)
1121 if (!BN_MONT_CTX_set(group->mont_data, &group->order, ctx)) {
1122 BN_MONT_CTX_free(group->mont_data);
1123 group->mont_data = NULL;