Lines Matching refs:group

61 	ECGroup *group;
63 group = (ECGroup *) kmem_alloc(sizeof(ECGroup), kmflag);
65 group = (ECGroup *) malloc(sizeof(ECGroup));
67 if (group == NULL)
69 group->constructed = MP_YES;
70 group->meth = NULL;
71 group->text = NULL;
72 MP_DIGITS(&group->curvea) = 0;
73 MP_DIGITS(&group->curveb) = 0;
74 MP_DIGITS(&group->genx) = 0;
75 MP_DIGITS(&group->geny) = 0;
76 MP_DIGITS(&group->order) = 0;
77 group->base_point_mul = NULL;
78 group->points_mul = NULL;
79 group->validate_point = NULL;
80 group->extra1 = NULL;
81 group->extra2 = NULL;
82 group->extra_free = NULL;
83 MP_CHECKOK(mp_init(&group->curvea, kmflag));
84 MP_CHECKOK(mp_init(&group->curveb, kmflag));
85 MP_CHECKOK(mp_init(&group->genx, kmflag));
86 MP_CHECKOK(mp_init(&group->geny, kmflag));
87 MP_CHECKOK(mp_init(&group->order, kmflag));
91 ECGroup_free(group);
94 return group;
104 ECGroup *group = NULL;
106 group = ECGroup_new(FLAG(irr));
107 if (group == NULL)
110 group->meth = GFMethod_consGFp(irr);
111 if (group->meth == NULL) {
115 MP_CHECKOK(mp_copy(curvea, &group->curvea));
116 MP_CHECKOK(mp_copy(curveb, &group->curveb));
117 MP_CHECKOK(mp_copy(genx, &group->genx));
118 MP_CHECKOK(mp_copy(geny, &group->geny));
119 MP_CHECKOK(mp_copy(order, &group->order));
120 group->cofactor = cofactor;
121 group->point_add = &ec_GFp_pt_add_aff;
122 group->point_sub = &ec_GFp_pt_sub_aff;
123 group->point_dbl = &ec_GFp_pt_dbl_aff;
124 group->point_mul = &ec_GFp_pt_mul_jm_wNAF;
125 group->base_point_mul = NULL;
126 group->points_mul = &ec_GFp_pts_mul_jac;
127 group->validate_point = &ec_GFp_validate_point;
131 ECGroup_free(group);
134 return group;
145 ECGroup *group = NULL;
147 group = ECGroup_new(FLAG(irr));
148 if (group == NULL)
151 group->meth = GFMethod_consGFp_mont(irr);
152 if (group->meth == NULL) {
156 MP_CHECKOK(group->meth->
157 field_enc(curvea, &group->curvea, group->meth));
158 MP_CHECKOK(group->meth->
159 field_enc(curveb, &group->curveb, group->meth));
160 MP_CHECKOK(group->meth->field_enc(genx, &group->genx, group->meth));
161 MP_CHECKOK(group->meth->field_enc(geny, &group->geny, group->meth));
162 MP_CHECKOK(mp_copy(order, &group->order));
163 group->cofactor = cofactor;
164 group->point_add = &ec_GFp_pt_add_aff;
165 group->point_sub = &ec_GFp_pt_sub_aff;
166 group->point_dbl = &ec_GFp_pt_dbl_aff;
167 group->point_mul = &ec_GFp_pt_mul_jm_wNAF;
168 group->base_point_mul = NULL;
169 group->points_mul = &ec_GFp_pts_mul_jac;
170 group->validate_point = &ec_GFp_validate_point;
174 ECGroup_free(group);
177 return group;
190 ECGroup *group = NULL;
192 group = ECGroup_new(FLAG(irr));
193 if (group == NULL)
196 group->meth = GFMethod_consGF2m(irr, irr_arr);
197 if (group->meth == NULL) {
201 MP_CHECKOK(mp_copy(curvea, &group->curvea));
202 MP_CHECKOK(mp_copy(curveb, &group->curveb));
203 MP_CHECKOK(mp_copy(genx, &group->genx));
204 MP_CHECKOK(mp_copy(geny, &group->geny));
205 MP_CHECKOK(mp_copy(order, &group->order));
206 group->cofactor = cofactor;
207 group->point_add = &ec_GF2m_pt_add_aff;
208 group->point_sub = &ec_GF2m_pt_sub_aff;
209 group->point_dbl = &ec_GF2m_pt_dbl_aff;
210 group->point_mul = &ec_GF2m_pt_mul_mont;
211 group->base_point_mul = NULL;
212 group->points_mul = &ec_pts_mul_basic;
213 group->validate_point = &ec_GF2m_validate_point;
217 ECGroup_free(group);
220 return group;
232 ECGroup *group = NULL;
269 group =
272 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; }
273 MP_CHECKOK(ec_group_set_secp160r1_fp(group));
278 group =
281 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; }
282 MP_CHECKOK(ec_group_set_nistp192_fp(group));
284 group =
287 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; }
288 MP_CHECKOK(ec_group_set_gfp192(group, name));
293 group =
296 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; }
297 MP_CHECKOK(ec_group_set_nistp224_fp(group));
299 group =
302 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; }
303 MP_CHECKOK(ec_group_set_gfp224(group, name));
307 group =
310 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; }
311 MP_CHECKOK(ec_group_set_gfp256(group, name));
314 group =
317 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; }
318 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);