Lines Matching defs:ctx
25 static int group_field_tests(const EC_GROUP *group, BN_CTX *ctx)
33 BN_CTX_start(ctx);
34 a = BN_CTX_get(ctx);
35 b = BN_CTX_get(ctx);
36 if (!TEST_ptr(c = BN_CTX_get(ctx))
38 || !TEST_true(group->meth->field_inv(group, b, BN_value_one(), ctx))
43 || !TEST_true(group->meth->field_inv(group, b, a, ctx))
45 !TEST_true(group->meth->field_encode(group, a, a, ctx)))
47 !TEST_true(group->meth->field_encode(group, b, b, ctx)))
48 || !TEST_true(group->meth->field_mul(group, c, a, b, ctx))
50 !TEST_true(group->meth->field_decode(group, c, c, ctx)))
56 if (!TEST_false(group->meth->field_inv(group, b, a, ctx))
61 || !TEST_false(group->meth->field_inv(group, b, group->field, ctx))
70 BN_CTX_end(ctx);
78 BN_CTX *ctx = NULL;
83 if (!TEST_ptr(ctx = BN_CTX_new()))
86 BN_CTX_start(ctx);
87 p = BN_CTX_get(ctx);
88 a = BN_CTX_get(ctx);
89 if (!TEST_ptr(b = BN_CTX_get(ctx))
94 || !TEST_true(EC_GROUP_set_curve(group, p, a, b, ctx))
95 || !group_field_tests(group, ctx))
100 BN_CTX_end(ctx);
101 BN_CTX_free(ctx);
162 BN_CTX *ctx = BN_CTX_new();
168 BN_CTX_start(ctx);
169 p = BN_CTX_get(ctx);
170 a = BN_CTX_get(ctx);
171 if (!TEST_ptr(b = BN_CTX_get(ctx))
179 if (!TEST_ptr_null(group1 = EC_GROUP_new_curve_GF2m(p, a, b, ctx)))
185 if (!TEST_ptr_null(group2 = EC_GROUP_new_curve_GF2m(p, a, b, ctx)))
192 if (!TEST_ptr_null(group3 = EC_GROUP_new_curve_GF2m(p, a, b, ctx)))
202 BN_CTX_end(ctx);
203 BN_CTX_free(ctx);
220 BN_CTX *ctx = NULL;
228 || !TEST_ptr(ctx = BN_CTX_new())
229 || !group_field_tests(group, ctx))
236 if (ctx != NULL)
237 BN_CTX_free(ctx);
248 BN_CTX *ctx = NULL;
261 ctx = BN_CTX_new();
262 if (!TEST_ptr(ctx))
265 BN_CTX_start(ctx);
266 x1 = BN_CTX_get(ctx);
267 y1 = BN_CTX_get(ctx);
268 z1 = BN_CTX_get(ctx);
269 x2 = BN_CTX_get(ctx);
270 y2 = BN_CTX_get(ctx);
271 k = BN_CTX_get(ctx);
287 y1, z1, ctx))
288 || !TEST_true(EC_POINT_mul(grp, Q, NULL, P, k, ctx))
289 || !TEST_true(EC_POINT_get_affine_coordinates(grp, Q, x1, y1, ctx))
290 || !TEST_true(EC_POINT_dbl(grp, R, P, ctx))
291 || !TEST_true(EC_POINT_get_affine_coordinates(grp, R, x2, y2, ctx)))
301 BN_CTX_end(ctx);
306 BN_CTX_free(ctx);