Lines Matching refs:group
83 int ossl_ec_GFp_mont_group_init(EC_GROUP *group) in ossl_ec_GFp_mont_group_init() argument
87 ok = ossl_ec_GFp_simple_group_init(group); in ossl_ec_GFp_mont_group_init()
88 group->field_data1 = NULL; in ossl_ec_GFp_mont_group_init()
89 group->field_data2 = NULL; in ossl_ec_GFp_mont_group_init()
93 void ossl_ec_GFp_mont_group_finish(EC_GROUP *group) in ossl_ec_GFp_mont_group_finish() argument
95 BN_MONT_CTX_free(group->field_data1); in ossl_ec_GFp_mont_group_finish()
96 group->field_data1 = NULL; in ossl_ec_GFp_mont_group_finish()
97 BN_free(group->field_data2); in ossl_ec_GFp_mont_group_finish()
98 group->field_data2 = NULL; in ossl_ec_GFp_mont_group_finish()
99 ossl_ec_GFp_simple_group_finish(group); in ossl_ec_GFp_mont_group_finish()
102 void ossl_ec_GFp_mont_group_clear_finish(EC_GROUP *group) in ossl_ec_GFp_mont_group_clear_finish() argument
104 BN_MONT_CTX_free(group->field_data1); in ossl_ec_GFp_mont_group_clear_finish()
105 group->field_data1 = NULL; in ossl_ec_GFp_mont_group_clear_finish()
106 BN_clear_free(group->field_data2); in ossl_ec_GFp_mont_group_clear_finish()
107 group->field_data2 = NULL; in ossl_ec_GFp_mont_group_clear_finish()
108 ossl_ec_GFp_simple_group_clear_finish(group); in ossl_ec_GFp_mont_group_clear_finish()
142 int ossl_ec_GFp_mont_group_set_curve(EC_GROUP *group, const BIGNUM *p, in ossl_ec_GFp_mont_group_set_curve() argument
151 BN_MONT_CTX_free(group->field_data1); in ossl_ec_GFp_mont_group_set_curve()
152 group->field_data1 = NULL; in ossl_ec_GFp_mont_group_set_curve()
153 BN_free(group->field_data2); in ossl_ec_GFp_mont_group_set_curve()
154 group->field_data2 = NULL; in ossl_ec_GFp_mont_group_set_curve()
157 ctx = new_ctx = BN_CTX_new_ex(group->libctx); in ossl_ec_GFp_mont_group_set_curve()
175 group->field_data1 = mont; in ossl_ec_GFp_mont_group_set_curve()
177 group->field_data2 = one; in ossl_ec_GFp_mont_group_set_curve()
180 ret = ossl_ec_GFp_simple_group_set_curve(group, p, a, b, ctx); in ossl_ec_GFp_mont_group_set_curve()
183 BN_MONT_CTX_free(group->field_data1); in ossl_ec_GFp_mont_group_set_curve()
184 group->field_data1 = NULL; in ossl_ec_GFp_mont_group_set_curve()
185 BN_free(group->field_data2); in ossl_ec_GFp_mont_group_set_curve()
186 group->field_data2 = NULL; in ossl_ec_GFp_mont_group_set_curve()
196 int ossl_ec_GFp_mont_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, in ossl_ec_GFp_mont_field_mul() argument
199 if (group->field_data1 == NULL) { in ossl_ec_GFp_mont_field_mul()
204 return BN_mod_mul_montgomery(r, a, b, group->field_data1, ctx); in ossl_ec_GFp_mont_field_mul()
207 int ossl_ec_GFp_mont_field_sqr(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, in ossl_ec_GFp_mont_field_sqr() argument
210 if (group->field_data1 == NULL) { in ossl_ec_GFp_mont_field_sqr()
215 return BN_mod_mul_montgomery(r, a, a, group->field_data1, ctx); in ossl_ec_GFp_mont_field_sqr()
223 int ossl_ec_GFp_mont_field_inv(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, in ossl_ec_GFp_mont_field_inv() argument
230 if (group->field_data1 == NULL) in ossl_ec_GFp_mont_field_inv()
234 && (ctx = new_ctx = BN_CTX_secure_new_ex(group->libctx)) == NULL) in ossl_ec_GFp_mont_field_inv()
244 if (!BN_sub(e, group->field, e)) in ossl_ec_GFp_mont_field_inv()
250 if (!BN_mod_exp_mont(r, a, e, group->field, ctx, group->field_data1)) in ossl_ec_GFp_mont_field_inv()
267 int ossl_ec_GFp_mont_field_encode(const EC_GROUP *group, BIGNUM *r, in ossl_ec_GFp_mont_field_encode() argument
270 if (group->field_data1 == NULL) { in ossl_ec_GFp_mont_field_encode()
275 return BN_to_montgomery(r, a, (BN_MONT_CTX *)group->field_data1, ctx); in ossl_ec_GFp_mont_field_encode()
278 int ossl_ec_GFp_mont_field_decode(const EC_GROUP *group, BIGNUM *r, in ossl_ec_GFp_mont_field_decode() argument
281 if (group->field_data1 == NULL) { in ossl_ec_GFp_mont_field_decode()
286 return BN_from_montgomery(r, a, group->field_data1, ctx); in ossl_ec_GFp_mont_field_decode()
289 int ossl_ec_GFp_mont_field_set_to_one(const EC_GROUP *group, BIGNUM *r, in ossl_ec_GFp_mont_field_set_to_one() argument
292 if (group->field_data2 == NULL) { in ossl_ec_GFp_mont_field_set_to_one()
297 if (!BN_copy(r, group->field_data2)) in ossl_ec_GFp_mont_field_set_to_one()