Lines Matching refs:group

63 	ECGroup *group;
65 group = (ECGroup *) kmem_alloc(sizeof(ECGroup), kmflag);
67 group = (ECGroup *) malloc(sizeof(ECGroup));
69 if (group == NULL)
71 group->constructed = MP_YES;
72 group->meth = NULL;
73 group->text = NULL;
74 MP_DIGITS(&group->curvea) = 0;
75 MP_DIGITS(&group->curveb) = 0;
76 MP_DIGITS(&group->genx) = 0;
77 MP_DIGITS(&group->geny) = 0;
78 MP_DIGITS(&group->order) = 0;
79 group->base_point_mul = NULL;
80 group->points_mul = NULL;
81 group->validate_point = NULL;
82 group->extra1 = NULL;
83 group->extra2 = NULL;
84 group->extra_free = NULL;
85 MP_CHECKOK(mp_init(&group->curvea, kmflag));
86 MP_CHECKOK(mp_init(&group->curveb, kmflag));
87 MP_CHECKOK(mp_init(&group->genx, kmflag));
88 MP_CHECKOK(mp_init(&group->geny, kmflag));
89 MP_CHECKOK(mp_init(&group->order, kmflag));
93 ECGroup_free(group);
96 return group;
106 ECGroup *group = NULL;
108 group = ECGroup_new(FLAG(irr));
109 if (group == NULL)
112 group->meth = GFMethod_consGFp(irr);
113 if (group->meth == NULL) {
117 MP_CHECKOK(mp_copy(curvea, &group->curvea));
118 MP_CHECKOK(mp_copy(curveb, &group->curveb));
119 MP_CHECKOK(mp_copy(genx, &group->genx));
120 MP_CHECKOK(mp_copy(geny, &group->geny));
121 MP_CHECKOK(mp_copy(order, &group->order));
122 group->cofactor = cofactor;
123 group->point_add = &ec_GFp_pt_add_aff;
124 group->point_sub = &ec_GFp_pt_sub_aff;
125 group->point_dbl = &ec_GFp_pt_dbl_aff;
126 group->point_mul = &ec_GFp_pt_mul_jm_wNAF;
127 group->base_point_mul = NULL;
128 group->points_mul = &ec_GFp_pts_mul_jac;
129 group->validate_point = &ec_GFp_validate_point;
133 ECGroup_free(group);
136 return group;
147 ECGroup *group = NULL;
149 group = ECGroup_new(FLAG(irr));
150 if (group == NULL)
153 group->meth = GFMethod_consGFp_mont(irr);
154 if (group->meth == NULL) {
158 MP_CHECKOK(group->meth->
159 field_enc(curvea, &group->curvea, group->meth));
160 MP_CHECKOK(group->meth->
161 field_enc(curveb, &group->curveb, group->meth));
162 MP_CHECKOK(group->meth->field_enc(genx, &group->genx, group->meth));
163 MP_CHECKOK(group->meth->field_enc(geny, &group->geny, group->meth));
164 MP_CHECKOK(mp_copy(order, &group->order));
165 group->cofactor = cofactor;
166 group->point_add = &ec_GFp_pt_add_aff;
167 group->point_sub = &ec_GFp_pt_sub_aff;
168 group->point_dbl = &ec_GFp_pt_dbl_aff;
169 group->point_mul = &ec_GFp_pt_mul_jm_wNAF;
170 group->base_point_mul = NULL;
171 group->points_mul = &ec_GFp_pts_mul_jac;
172 group->validate_point = &ec_GFp_validate_point;
176 ECGroup_free(group);
179 return group;
192 ECGroup *group = NULL;
194 group = ECGroup_new(FLAG(irr));
195 if (group == NULL)
198 group->meth = GFMethod_consGF2m(irr, irr_arr);
199 if (group->meth == NULL) {
203 MP_CHECKOK(mp_copy(curvea, &group->curvea));
204 MP_CHECKOK(mp_copy(curveb, &group->curveb));
205 MP_CHECKOK(mp_copy(genx, &group->genx));
206 MP_CHECKOK(mp_copy(geny, &group->geny));
207 MP_CHECKOK(mp_copy(order, &group->order));
208 group->cofactor = cofactor;
209 group->point_add = &ec_GF2m_pt_add_aff;
210 group->point_sub = &ec_GF2m_pt_sub_aff;
211 group->point_dbl = &ec_GF2m_pt_dbl_aff;
212 group->point_mul = &ec_GF2m_pt_mul_mont;
213 group->base_point_mul = NULL;
214 group->points_mul = &ec_pts_mul_basic;
215 group->validate_point = &ec_GF2m_validate_point;
219 ECGroup_free(group);
222 return group;
234 ECGroup *group = NULL;
270 group =
273 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; }
274 MP_CHECKOK(ec_group_set_secp160r1_fp(group));
279 group =
282 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; }
283 MP_CHECKOK(ec_group_set_nistp192_fp(group));
285 group =
288 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; }
289 MP_CHECKOK(ec_group_set_gfp192(group, name));
294 group =
297 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; }
298 MP_CHECKOK(ec_group_set_nistp224_fp(group));
300 group =
303 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; }
304 MP_CHECKOK(ec_group_set_gfp224(group, name));
308 group =
311 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; }
312 MP_CHECKOK(ec_group_set_gfp256(group, name));
315 group =
318 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; }
319 MP_CHECKOK(ec_group_set_gfp521(group, name));
324 group =
327 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; }
331 group = ECGroup_consGF2m(&irr, NULL, &curvea, &curveb, &genx, &geny, &order, params->cofactor);
332 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; }
336 MP_CHECKOK(ec_group_set_gf2m163(group, name));
339 MP_CHECKOK(ec_group_set_gf2m193(group, name));
342 MP_CHECKOK(ec_group_set_gf2m233(group, name));
351 if ((group != NULL) && (params->text != NULL)) {
355 group->text = kmem_alloc(n, kmflag);
356 if (group->text == NULL) {
360 bcopy(params->text, group->text, n);
361 group->text_len = n;
363 group->text = strdup(params->text);
364 if (group->text == NULL) {
378 ECGroup_free(group);
381 return group;
395 ECGroup *group = NULL;
405 /* construct actual group */
406 group = ecgroup_fromNameAndHex(name, params, kmflag);
407 if (group == NULL) {
415 ECGroup_free(group);
418 return group;
422 mp_err ECPoint_validate(const ECGroup *group, const mp_int *px, const
433 return group->validate_point(px, py, group);
438 ECGroup_free(ECGroup *group)
440 if (group == NULL)
442 GFMethod_free(group->meth);
443 if (group->constructed == MP_NO)
445 mp_clear(&group->curvea);
446 mp_clear(&group->curveb);
447 mp_clear(&group->genx);
448 mp_clear(&group->geny);
449 mp_clear(&group->order);
450 if (group->text != NULL)
452 kmem_free(group->text, group->text_len);
454 free(group->text);
456 if (group->extra_free != NULL)
457 group->extra_free(group);
459 kmem_free(group, sizeof (ECGroup));
461 free(group);