Lines Matching refs:group

123 int ec_GFp_mont_group_init(EC_GROUP *group)
127 ok = ec_GFp_simple_group_init(group);
128 group->field_data1 = NULL;
129 group->field_data2 = NULL;
134 void ec_GFp_mont_group_finish(EC_GROUP *group)
136 if (group->field_data1 != NULL)
138 BN_MONT_CTX_free(group->field_data1);
139 group->field_data1 = NULL;
141 if (group->field_data2 != NULL)
143 BN_free(group->field_data2);
144 group->field_data2 = NULL;
146 ec_GFp_simple_group_finish(group);
150 void ec_GFp_mont_group_clear_finish(EC_GROUP *group)
152 if (group->field_data1 != NULL)
154 BN_MONT_CTX_free(group->field_data1);
155 group->field_data1 = NULL;
157 if (group->field_data2 != NULL)
159 BN_clear_free(group->field_data2);
160 group->field_data2 = NULL;
162 ec_GFp_simple_group_clear_finish(group);
205 int ec_GFp_mont_group_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
212 if (group->field_data1 != NULL)
214 BN_MONT_CTX_free(group->field_data1);
215 group->field_data1 = NULL;
217 if (group->field_data2 != NULL)
219 BN_free(group->field_data2);
220 group->field_data2 = NULL;
241 group->field_data1 = mont;
243 group->field_data2 = one;
246 ret = ec_GFp_simple_group_set_curve(group, p, a, b, ctx);
250 BN_MONT_CTX_free(group->field_data1);
251 group->field_data1 = NULL;
252 BN_free(group->field_data2);
253 group->field_data2 = NULL;
265 int ec_GFp_mont_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
267 if (group->field_data1 == NULL)
273 return BN_mod_mul_montgomery(r, a, b, group->field_data1, ctx);
277 int ec_GFp_mont_field_sqr(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
279 if (group->field_data1 == NULL)
285 return BN_mod_mul_montgomery(r, a, a, group->field_data1, ctx);
289 int ec_GFp_mont_field_encode(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
291 if (group->field_data1 == NULL)
297 return BN_to_montgomery(r, a, (BN_MONT_CTX *)group->field_data1, ctx);
301 int ec_GFp_mont_field_decode(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
303 if (group->field_data1 == NULL)
309 return BN_from_montgomery(r, a, group->field_data1, ctx);
313 int ec_GFp_mont_field_set_to_one(const EC_GROUP *group, BIGNUM *r, BN_CTX *ctx)
315 if (group->field_data2 == NULL)
321 if (!BN_copy(r, group->field_data2)) return 0;