Lines Matching refs:group

39 static int group_order_tests(EC_GROUP *group)  in group_order_tests()  argument
51 || !TEST_ptr(G = EC_GROUP_get0_generator(group)) in group_order_tests()
52 || !TEST_ptr(P = EC_POINT_new(group)) in group_order_tests()
53 || !TEST_ptr(Q = EC_POINT_new(group)) in group_order_tests()
54 || !TEST_ptr(R = EC_POINT_new(group)) in group_order_tests()
55 || !TEST_ptr(S = EC_POINT_new(group))) in group_order_tests()
58 if (!TEST_true(EC_GROUP_get_order(group, order, ctx)) in group_order_tests()
59 || !TEST_true(EC_POINT_mul(group, Q, order, NULL, NULL, ctx)) in group_order_tests()
60 || !TEST_true(EC_POINT_is_at_infinity(group, Q)) in group_order_tests()
62 || !TEST_true(EC_GROUP_precompute_mult(group, ctx)) in group_order_tests()
64 || !TEST_true(EC_POINT_mul(group, Q, order, NULL, NULL, ctx)) in group_order_tests()
65 || !TEST_true(EC_POINT_is_at_infinity(group, Q)) in group_order_tests()
68 || !TEST_true(EC_POINT_mul(group, Q, n1, NULL, NULL, ctx)) in group_order_tests()
69 || !TEST_int_eq(0, EC_POINT_cmp(group, Q, P, ctx)) in group_order_tests()
71 || !TEST_true(EC_POINT_mul(group, Q, n1, NULL, NULL, ctx)) in group_order_tests()
72 || !TEST_true(EC_POINT_invert(group, Q, ctx)) in group_order_tests()
73 || !TEST_int_eq(0, EC_POINT_cmp(group, Q, P, ctx))) in group_order_tests()
87 || !TEST_true(EC_POINT_mul(group, P, n1, NULL, NULL, ctx)) in group_order_tests()
88 || (i == 1 && !TEST_int_eq(0, EC_POINT_cmp(group, P, G, ctx))) in group_order_tests()
92 || !TEST_true(EC_POINT_mul(group, Q, NULL, P, n1, ctx)) in group_order_tests()
93 || !TEST_int_eq(0, EC_POINT_cmp(group, Q, P, ctx)) in group_order_tests()
97 || !TEST_true(EC_POINT_mul(group, Q, NULL, P, n2, ctx)) in group_order_tests()
98 || !TEST_int_eq(0, EC_POINT_cmp(group, Q, P, ctx)) in group_order_tests()
102 || !TEST_true(EC_POINT_mul(group, Q, NULL, P, n2, ctx)) in group_order_tests()
103 || !TEST_int_eq(0, EC_POINT_cmp(group, Q, P, ctx))) in group_order_tests()
108 if (!TEST_true(EC_POINT_mul(group, Q, NULL, P, n2, ctx)) in group_order_tests()
110 || !TEST_true(EC_POINT_add(group, Q, Q, P, ctx)) in group_order_tests()
111 || !TEST_true(EC_POINT_is_at_infinity(group, Q)) in group_order_tests()
112 || !TEST_false(EC_POINT_is_at_infinity(group, P))) in group_order_tests()
120 if (!TEST_true(EC_POINTs_mul(group, R, NULL, 2, points, scalars, ctx)) in group_order_tests()
121 || !TEST_true(EC_POINT_dbl(group, S, points[0], ctx)) in group_order_tests()
122 || !TEST_int_eq(0, EC_POINT_cmp(group, R, S, ctx))) in group_order_tests()
137 if (!TEST_true(EC_POINTs_mul(group, P, NULL, 6, points, scalars, ctx)) in group_order_tests()
138 || !TEST_true(EC_POINT_is_at_infinity(group, P))) in group_order_tests()
163 EC_GROUP *group = NULL; in prime_field_tests() local
181 || !TEST_ptr(group = EC_GROUP_new_curve_GFp(p, a, b, ctx)) in prime_field_tests()
182 || !TEST_true(EC_GROUP_get_curve(group, p, a, b, ctx))) in prime_field_tests()
192 if (!TEST_ptr(P = EC_POINT_new(group)) in prime_field_tests()
193 || !TEST_ptr(Q = EC_POINT_new(group)) in prime_field_tests()
194 || !TEST_ptr(R = EC_POINT_new(group)) in prime_field_tests()
195 || !TEST_true(EC_POINT_set_to_infinity(group, P)) in prime_field_tests()
196 || !TEST_true(EC_POINT_is_at_infinity(group, P)) in prime_field_tests()
197 || !TEST_true(EC_POINT_oct2point(group, Q, buf, 1, ctx)) in prime_field_tests()
198 || !TEST_true(EC_POINT_add(group, P, P, Q, ctx)) in prime_field_tests()
199 || !TEST_true(EC_POINT_is_at_infinity(group, P)) in prime_field_tests()
205 || !TEST_true(EC_POINT_set_compressed_coordinates(group, Q, x, 1, ctx))) in prime_field_tests()
208 if (!TEST_int_gt(EC_POINT_is_on_curve(group, Q, ctx), 0)) { in prime_field_tests()
209 if (!TEST_true(EC_POINT_get_affine_coordinates(group, Q, x, y, ctx))) in prime_field_tests()
223 if (EC_POINT_is_at_infinity(group, P)) { in prime_field_tests()
226 if (!TEST_true(EC_POINT_get_affine_coordinates(group, P, x, y, in prime_field_tests()
235 || !TEST_true(EC_POINT_add(group, P, P, Q, ctx))) in prime_field_tests()
238 } while (!EC_POINT_is_at_infinity(group, P)); in prime_field_tests()
240 if (!TEST_true(EC_POINT_add(group, P, Q, R, ctx)) in prime_field_tests()
241 || !TEST_true(EC_POINT_is_at_infinity(group, P))) in prime_field_tests()
245 EC_POINT_point2oct(group, Q, POINT_CONVERSION_COMPRESSED, buf, in prime_field_tests()
248 || !TEST_true(EC_POINT_oct2point(group, P, buf, len, ctx)) in prime_field_tests()
249 || !TEST_int_eq(0, EC_POINT_cmp(group, P, Q, ctx))) in prime_field_tests()
254 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_UNCOMPRESSED, in prime_field_tests()
257 || !TEST_true(EC_POINT_oct2point(group, P, buf, len, ctx)) in prime_field_tests()
258 || !TEST_int_eq(0, EC_POINT_cmp(group, P, Q, ctx))) in prime_field_tests()
263 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_HYBRID, in prime_field_tests()
266 || !TEST_true(EC_POINT_oct2point(group, P, buf, len, ctx)) in prime_field_tests()
267 || !TEST_int_eq(0, EC_POINT_cmp(group, P, Q, ctx))) in prime_field_tests()
272 if (!TEST_true(EC_POINT_invert(group, P, ctx)) in prime_field_tests()
273 || !TEST_int_eq(0, EC_POINT_cmp(group, P, R, ctx)) in prime_field_tests()
287 || !TEST_true(EC_GROUP_set_curve(group, p, a, b, ctx)) in prime_field_tests()
297 || !TEST_false(EC_POINT_set_affine_coordinates(group, P, x, yplusone, in prime_field_tests()
299 || !TEST_true(EC_POINT_set_affine_coordinates(group, P, x, y, ctx)) in prime_field_tests()
300 || !TEST_int_gt(EC_POINT_is_on_curve(group, P, ctx), 0) in prime_field_tests()
303 || !TEST_true(EC_GROUP_set_generator(group, P, z, BN_value_one())) in prime_field_tests()
304 || !TEST_true(EC_POINT_get_affine_coordinates(group, P, x, y, ctx))) in prime_field_tests()
313 || !TEST_int_eq(EC_GROUP_get_degree(group), 160) in prime_field_tests()
314 || !group_order_tests(group) in prime_field_tests()
325 || !TEST_true(EC_GROUP_set_curve(group, p, a, b, ctx)) in prime_field_tests()
328 || !TEST_true(EC_POINT_set_compressed_coordinates(group, P, x, 1, ctx)) in prime_field_tests()
329 || !TEST_int_gt(EC_POINT_is_on_curve(group, P, ctx), 0) in prime_field_tests()
332 || !TEST_true(EC_GROUP_set_generator(group, P, z, BN_value_one())) in prime_field_tests()
333 || !TEST_true(EC_POINT_get_affine_coordinates(group, P, x, y, ctx))) in prime_field_tests()
348 || !TEST_false(EC_POINT_set_affine_coordinates(group, P, x, yplusone, in prime_field_tests()
350 || !TEST_int_eq(EC_GROUP_get_degree(group), 192) in prime_field_tests()
351 || !group_order_tests(group) in prime_field_tests()
362 || !TEST_true(EC_GROUP_set_curve(group, p, a, b, ctx)) in prime_field_tests()
365 || !TEST_true(EC_POINT_set_compressed_coordinates(group, P, x, 0, ctx)) in prime_field_tests()
366 || !TEST_int_gt(EC_POINT_is_on_curve(group, P, ctx), 0) in prime_field_tests()
369 || !TEST_true(EC_GROUP_set_generator(group, P, z, BN_value_one())) in prime_field_tests()
370 || !TEST_true(EC_POINT_get_affine_coordinates(group, P, x, y, ctx))) in prime_field_tests()
385 || !TEST_false(EC_POINT_set_affine_coordinates(group, P, x, yplusone, in prime_field_tests()
387 || !TEST_int_eq(EC_GROUP_get_degree(group), 224) in prime_field_tests()
388 || !group_order_tests(group) in prime_field_tests()
399 || !TEST_true(EC_GROUP_set_curve(group, p, a, b, ctx)) in prime_field_tests()
403 || !TEST_true(EC_POINT_set_compressed_coordinates(group, P, x, 1, ctx)) in prime_field_tests()
404 || !TEST_int_gt(EC_POINT_is_on_curve(group, P, ctx), 0) in prime_field_tests()
407 || !TEST_true(EC_GROUP_set_generator(group, P, z, BN_value_one())) in prime_field_tests()
408 || !TEST_true(EC_POINT_get_affine_coordinates(group, P, x, y, ctx))) in prime_field_tests()
423 || !TEST_false(EC_POINT_set_affine_coordinates(group, P, x, yplusone, in prime_field_tests()
425 || !TEST_int_eq(EC_GROUP_get_degree(group), 256) in prime_field_tests()
426 || !group_order_tests(group) in prime_field_tests()
440 || !TEST_true(EC_GROUP_set_curve(group, p, a, b, ctx)) in prime_field_tests()
445 || !TEST_true(EC_POINT_set_compressed_coordinates(group, P, x, 1, ctx)) in prime_field_tests()
446 || !TEST_int_gt(EC_POINT_is_on_curve(group, P, ctx), 0) in prime_field_tests()
450 || !TEST_true(EC_GROUP_set_generator(group, P, z, BN_value_one())) in prime_field_tests()
451 || !TEST_true(EC_POINT_get_affine_coordinates(group, P, x, y, ctx))) in prime_field_tests()
467 || !TEST_false(EC_POINT_set_affine_coordinates(group, P, x, yplusone, in prime_field_tests()
469 || !TEST_int_eq(EC_GROUP_get_degree(group), 384) in prime_field_tests()
470 || !group_order_tests(group) in prime_field_tests()
489 || !TEST_true(EC_GROUP_set_curve(group, p, a, b, ctx)) in prime_field_tests()
495 || !TEST_true(EC_POINT_set_compressed_coordinates(group, P, x, 0, ctx)) in prime_field_tests()
496 || !TEST_int_gt(EC_POINT_is_on_curve(group, P, ctx), 0) in prime_field_tests()
502 || !TEST_true(EC_GROUP_set_generator(group, P, z, BN_value_one())) in prime_field_tests()
503 || !TEST_true(EC_POINT_get_affine_coordinates(group, P, x, y, ctx))) in prime_field_tests()
521 || !TEST_false(EC_POINT_set_affine_coordinates(group, P, x, yplusone, in prime_field_tests()
523 || !TEST_int_eq(EC_GROUP_get_degree(group), 521) in prime_field_tests()
524 || !group_order_tests(group) in prime_field_tests()
529 || !TEST_true(EC_POINT_set_affine_coordinates(group, P, x, y, ctx)) in prime_field_tests()
531 || !TEST_false(EC_POINT_is_at_infinity(group, Q)) in prime_field_tests()
532 || !TEST_true(EC_POINT_dbl(group, P, P, ctx)) in prime_field_tests()
533 || !TEST_int_gt(EC_POINT_is_on_curve(group, P, ctx), 0) in prime_field_tests()
534 || !TEST_true(EC_POINT_invert(group, Q, ctx)) /* P = -2Q */ in prime_field_tests()
535 || !TEST_true(EC_POINT_add(group, R, P, Q, ctx)) in prime_field_tests()
536 || !TEST_true(EC_POINT_add(group, R, R, Q, ctx)) in prime_field_tests()
537 || !TEST_true(EC_POINT_is_at_infinity(group, R)) /* R = P + 2Q */ in prime_field_tests()
538 || !TEST_false(EC_POINT_is_at_infinity(group, Q))) in prime_field_tests()
548 if (!TEST_true(EC_GROUP_get_order(group, z, ctx)) in prime_field_tests()
558 if (!TEST_true(EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) in prime_field_tests()
559 || !TEST_true(EC_POINTs_mul(group, R, z, 2, points, scalars, ctx)) in prime_field_tests()
560 || !TEST_int_eq(0, EC_POINT_cmp(group, P, R, ctx)) in prime_field_tests()
561 || !TEST_int_eq(0, EC_POINT_cmp(group, R, Q, ctx)) in prime_field_tests()
569 if (!TEST_true(EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) in prime_field_tests()
570 || !TEST_true(EC_POINT_is_at_infinity(group, P)) in prime_field_tests()
584 if (!TEST_true(EC_POINTs_mul(group, P, NULL, 4, points, scalars, ctx)) in prime_field_tests()
585 || !TEST_true(EC_POINT_is_at_infinity(group, P))) in prime_field_tests()
595 EC_GROUP_free(group); in prime_field_tests()
785 EC_GROUP *group = NULL; in char2_curve_test() local
804 || !TEST_true(group = EC_GROUP_new_curve_GF2m(p, a, b, ctx)) in char2_curve_test()
805 || !TEST_ptr(P = EC_POINT_new(group)) in char2_curve_test()
806 || !TEST_ptr(Q = EC_POINT_new(group)) in char2_curve_test()
807 || !TEST_ptr(R = EC_POINT_new(group)) in char2_curve_test()
819 if (!TEST_false(EC_POINT_set_affine_coordinates(group, P, x, yplusone, ctx)) in char2_curve_test()
820 || !TEST_true(EC_POINT_set_compressed_coordinates(group, P, x, in char2_curve_test()
823 || !TEST_int_gt(EC_POINT_is_on_curve(group, P, ctx), 0) in char2_curve_test()
826 || !TEST_true(EC_GROUP_set_generator(group, P, z, cof)) in char2_curve_test()
827 || !TEST_true(EC_POINT_get_affine_coordinates(group, P, x, y, ctx))) in char2_curve_test()
841 if (!TEST_false(EC_POINT_set_affine_coordinates(group, P, x, yplusone, ctx)) in char2_curve_test()
842 || !TEST_true(EC_POINT_set_affine_coordinates(group, P, x, y, ctx)) in char2_curve_test()
843 || !TEST_int_gt(EC_POINT_is_on_curve(group, P, ctx), 0) in char2_curve_test()
846 || !TEST_true(EC_GROUP_set_generator(group, P, z, cof))) in char2_curve_test()
853 if (!TEST_int_eq(EC_GROUP_get_degree(group), test->degree) in char2_curve_test()
854 || !group_order_tests(group)) in char2_curve_test()
859 if (!TEST_true(EC_POINT_set_affine_coordinates(group, P, x, y, ctx)) in char2_curve_test()
861 || !TEST_false(EC_POINT_is_at_infinity(group, Q)) in char2_curve_test()
862 || !TEST_true(EC_POINT_dbl(group, P, P, ctx)) in char2_curve_test()
863 || !TEST_int_gt(EC_POINT_is_on_curve(group, P, ctx), 0) in char2_curve_test()
864 || !TEST_true(EC_POINT_invert(group, Q, ctx)) /* P = -2Q */ in char2_curve_test()
865 || !TEST_true(EC_POINT_add(group, R, P, Q, ctx)) in char2_curve_test()
866 || !TEST_true(EC_POINT_add(group, R, R, Q, ctx)) in char2_curve_test()
867 || !TEST_true(EC_POINT_is_at_infinity(group, R)) /* R = P + 2Q */ in char2_curve_test()
868 || !TEST_false(EC_POINT_is_at_infinity(group, Q))) in char2_curve_test()
885 if (!TEST_true(EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) in char2_curve_test()
886 || !TEST_true(EC_POINTs_mul(group, R, z, 2, points, scalars, ctx)) in char2_curve_test()
887 || !TEST_int_eq(0, EC_POINT_cmp(group, P, R, ctx)) in char2_curve_test()
888 || !TEST_int_eq(0, EC_POINT_cmp(group, R, Q, ctx))) in char2_curve_test()
898 if (!TEST_true(EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) in char2_curve_test()
899 || !TEST_true(EC_POINT_is_at_infinity(group, P))) in char2_curve_test()
910 if (!TEST_true(EC_POINTs_mul(group, P, NULL, 3, points, scalars, ctx)) in char2_curve_test()
911 || !TEST_true(EC_POINT_is_at_infinity(group, P))) in char2_curve_test()
930 EC_GROUP_free(group); in char2_curve_test()
938 EC_GROUP *group = NULL; in char2_field_tests() local
954 if (!TEST_ptr(group = EC_GROUP_new_curve_GF2m(p, a, b, ctx)) in char2_field_tests()
955 || !TEST_true(EC_GROUP_get_curve(group, p, a, b, ctx))) in char2_field_tests()
964 if (!TEST_ptr(P = EC_POINT_new(group)) in char2_field_tests()
965 || !TEST_ptr(Q = EC_POINT_new(group)) in char2_field_tests()
966 || !TEST_ptr(R = EC_POINT_new(group)) in char2_field_tests()
967 || !TEST_true(EC_POINT_set_to_infinity(group, P)) in char2_field_tests()
968 || !TEST_true(EC_POINT_is_at_infinity(group, P))) in char2_field_tests()
972 if (!TEST_true(EC_POINT_oct2point(group, Q, buf, 1, ctx)) in char2_field_tests()
973 || !TEST_true(EC_POINT_add(group, P, P, Q, ctx)) in char2_field_tests()
974 || !TEST_true(EC_POINT_is_at_infinity(group, P)) in char2_field_tests()
983 || !TEST_true(EC_POINT_set_compressed_coordinates(group, Q, x, 1, ctx)) in char2_field_tests()
986 || !TEST_true(EC_POINT_set_affine_coordinates(group, Q, x, y, ctx)) in char2_field_tests()
990 if (!TEST_int_gt(EC_POINT_is_on_curve(group, Q, ctx), 0)) { in char2_field_tests()
993 if (!TEST_true(EC_POINT_get_affine_coordinates(group, Q, x, y, ctx))) in char2_field_tests()
1008 if (EC_POINT_is_at_infinity(group, P)) in char2_field_tests()
1011 if (!TEST_true(EC_POINT_get_affine_coordinates(group, P, x, y, in char2_field_tests()
1020 || !TEST_true(EC_POINT_add(group, P, P, Q, ctx))) in char2_field_tests()
1023 while (!EC_POINT_is_at_infinity(group, P)); in char2_field_tests()
1025 if (!TEST_true(EC_POINT_add(group, P, Q, R, ctx)) in char2_field_tests()
1026 || !TEST_true(EC_POINT_is_at_infinity(group, P))) in char2_field_tests()
1031 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_COMPRESSED, in char2_field_tests()
1034 || !TEST_true(EC_POINT_oct2point(group, P, buf, len, ctx)) in char2_field_tests()
1035 || !TEST_int_eq(0, EC_POINT_cmp(group, P, Q, ctx))) in char2_field_tests()
1041 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_UNCOMPRESSED, in char2_field_tests()
1044 || !TEST_true(EC_POINT_oct2point(group, P, buf, len, ctx)) in char2_field_tests()
1045 || !TEST_int_eq(0, EC_POINT_cmp(group, P, Q, ctx))) in char2_field_tests()
1053 EC_POINT_point2oct(group, Q, POINT_CONVERSION_HYBRID, buf, sizeof(buf), in char2_field_tests()
1056 || !TEST_true(EC_POINT_oct2point(group, P, buf, len, ctx)) in char2_field_tests()
1057 || !TEST_int_eq(0, EC_POINT_cmp(group, P, Q, ctx))) in char2_field_tests()
1063 if (!TEST_true(EC_POINT_invert(group, P, ctx)) in char2_field_tests()
1064 || !TEST_int_eq(0, EC_POINT_cmp(group, P, R, ctx))) in char2_field_tests()
1075 EC_GROUP_free(group); in char2_field_tests()
1090 EC_GROUP *group = NULL; in hybrid_point_encoding_test() local
1098 || !TEST_ptr(group = EC_GROUP_new_by_curve_name(NID_sect571k1)) in hybrid_point_encoding_test()
1099 || !TEST_ptr(point = EC_POINT_new(group)) in hybrid_point_encoding_test()
1100 || !TEST_true(EC_POINT_set_affine_coordinates(group, point, x, y, NULL)) in hybrid_point_encoding_test()
1101 || !TEST_size_t_ne(0, (len = EC_POINT_point2oct(group, in hybrid_point_encoding_test()
1108 || !TEST_size_t_eq(len, EC_POINT_point2oct(group, in hybrid_point_encoding_test()
1119 if (!TEST_true(EC_POINT_oct2point(group, point, buf, len, NULL))) in hybrid_point_encoding_test()
1124 if (!TEST_false(EC_POINT_oct2point(group, point, buf, len, NULL))) in hybrid_point_encoding_test()
1130 EC_GROUP_free(group); in hybrid_point_encoding_test()
1139 EC_GROUP *group = NULL; in internal_curve_test() local
1142 if (!TEST_ptr(group = EC_GROUP_new_by_curve_name(nid))) { in internal_curve_test()
1147 if (!TEST_true(EC_GROUP_check(group, NULL))) { in internal_curve_test()
1149 EC_GROUP_free(group); in internal_curve_test()
1152 EC_GROUP_free(group); in internal_curve_test()
1159 EC_GROUP *group; in internal_curve_test_method() local
1161 if (!TEST_ptr(group = EC_GROUP_new_by_curve_name(nid))) { in internal_curve_test_method()
1165 r = group_order_tests(group); in internal_curve_test_method()
1166 EC_GROUP_free(group); in internal_curve_test_method()
1501 EC_GROUP *group = NULL, *gtest = NULL; in check_named_curve_test() local
1516 || !TEST_ptr(group = EC_GROUP_new_by_curve_name(nid)) in check_named_curve_test()
1517 || !TEST_ptr(gtest = EC_GROUP_dup(group)) in check_named_curve_test()
1522 || !TEST_ptr(group_gen = EC_GROUP_get0_generator(group)) in check_named_curve_test()
1523 || !TEST_ptr(group_order = EC_GROUP_get0_order(group)) in check_named_curve_test()
1524 || !TEST_true(EC_GROUP_get_cofactor(group, group_cofactor, NULL)) in check_named_curve_test()
1525 || !TEST_true(EC_GROUP_get_curve(group, group_p, group_a, group_b, NULL)) in check_named_curve_test()
1526 || !TEST_ptr(other_gen = EC_POINT_dup(group_gen, group)) in check_named_curve_test()
1527 || !TEST_true(EC_POINT_add(group, other_gen, group_gen, group_gen, NULL)) in check_named_curve_test()
1539 has_seed = (EC_GROUP_get_seed_len(group) > 0); in check_named_curve_test()
1540 field_nid = EC_GROUP_get_field_type(group); in check_named_curve_test()
1561 if (!TEST_int_eq(EC_GROUP_check_named_curve(group, 0, NULL), nid) in check_named_curve_test()
1563 || !TEST_int_eq(EC_GROUP_check_named_curve(group, 1, NULL), in check_named_curve_test()
1568 EC_GROUP_set_curve_name(group, nid + 1); in check_named_curve_test()
1570 if (!TEST_int_le(EC_GROUP_check_named_curve(group, 0, NULL), 0)) in check_named_curve_test()
1575 EC_GROUP_set_curve_name(group, nid); in check_named_curve_test()
1576 if (!TEST_int_eq(EC_GROUP_check_named_curve(group, 0, NULL), nid)) in check_named_curve_test()
1579 if (!TEST_int_eq(EC_GROUP_set_seed(group, invalid_seed, invalid_seed_len), in check_named_curve_test()
1588 if (!TEST_int_eq(EC_GROUP_check_named_curve(group, 0, NULL), 0)) in check_named_curve_test()
1595 if (!TEST_int_eq(EC_GROUP_check_named_curve(group, 0, NULL), nid)) in check_named_curve_test()
1599 if (!TEST_int_eq(EC_GROUP_set_seed(group, NULL, 0), 1) in check_named_curve_test()
1600 || !TEST_int_eq(EC_GROUP_check_named_curve(group, 0, NULL), nid)) in check_named_curve_test()
1682 EC_GROUP_free(group); in check_named_curve_test()
1824 EC_GROUP *group = NULL, *tgroup = NULL, *tmpg = NULL; in check_named_curve_from_ecparameters() local
1854 || !TEST_ptr(group = EC_GROUP_new_by_curve_name(nid)) in check_named_curve_from_ecparameters()
1855 || !TEST_ptr(params = EC_GROUP_get_ecparameters(group, NULL)) in check_named_curve_from_ecparameters()
1856 || !TEST_ptr(group_gen = EC_GROUP_get0_generator(group)) in check_named_curve_from_ecparameters()
1857 || !TEST_ptr(group_order = EC_GROUP_get0_order(group)) in check_named_curve_from_ecparameters()
1858 || !TEST_true(EC_GROUP_get_cofactor(group, group_cofactor, NULL)) in check_named_curve_from_ecparameters()
1860 || !TEST_ptr(tmpg = EC_GROUP_dup(group)) in check_named_curve_from_ecparameters()
1861 || !TEST_ptr(other_gen = EC_POINT_dup(group_gen, group)) in check_named_curve_from_ecparameters()
1862 || !TEST_true(EC_POINT_add(group, other_gen, group_gen, group_gen, NULL)) in check_named_curve_from_ecparameters()
1863 || !TEST_true(EC_POINT_get_affine_coordinates(group, other_gen, in check_named_curve_from_ecparameters()
2007 EC_GROUP_free(group); in check_named_curve_from_ecparameters()
2016 EC_GROUP *group = NULL, *group2 = NULL; in parameter_test() local
2021 if (!TEST_ptr(group = EC_GROUP_new_by_curve_name(NID_secp384r1)) in parameter_test()
2022 || !TEST_ptr(ecparameters = EC_GROUP_get_ecparameters(group, NULL)) in parameter_test()
2024 || !TEST_int_eq(EC_GROUP_cmp(group, group2, NULL), 0)) in parameter_test()
2027 EC_GROUP_free(group); in parameter_test()
2028 group = NULL; in parameter_test()
2031 if (!TEST_ptr(group = EC_GROUP_new_by_curve_name(NID_secp521r1)) in parameter_test()
2032 || !TEST_true((len = i2d_ECPKParameters(group, &buf)) >= 0) in parameter_test()
2043 EC_GROUP_set_asn1_flag(group, OPENSSL_EC_EXPLICIT_CURVE); in parameter_test()
2044 if (!TEST_true((len = i2d_ECPKParameters(group, &buf)) >= 0) in parameter_test()
2050 EC_GROUP_free(group); in parameter_test()
2239 EC_GROUP *group = NULL; in cofactor_range_test() local
2245 if (!TEST_ptr(group = d2i_ECPKParameters(NULL, &b1, sizeof(params_cf_fail))) in cofactor_range_test()
2246 || !TEST_BN_eq_zero(EC_GROUP_get0_cofactor(group)) in cofactor_range_test()
2247 || !TEST_ptr(group = d2i_ECPKParameters(&group, &b2, in cofactor_range_test()
2250 || !TEST_BN_eq(cf, EC_GROUP_get0_cofactor(group))) in cofactor_range_test()
2255 EC_GROUP_free(group); in cofactor_range_test()
2352 const EC_GROUP *group = NULL; in check_ec_key_field_public_range_test() local
2360 || !TEST_ptr(group = EC_KEY_get0_group(key)) in check_ec_key_field_public_range_test()
2361 || !TEST_ptr(field = EC_GROUP_get0_field(group)) in check_ec_key_field_public_range_test()
2365 || !TEST_int_gt(EC_POINT_get_affine_coordinates(group, pub, x, y, in check_ec_key_field_public_range_test()
2373 type = EC_GROUP_get_field_type(group); in check_ec_key_field_public_range_test()
2410 int ec_point_hex2point_test_helper(const EC_GROUP *group, const EC_POINT *P, in ec_point_hex2point_test_helper() argument
2420 if (!TEST_ptr(Pinf = EC_POINT_new(group)) in ec_point_hex2point_test_helper()
2421 || !TEST_true(EC_POINT_set_to_infinity(group, Pinf))) in ec_point_hex2point_test_helper()
2426 if (!TEST_ptr(hex = EC_POINT_point2hex(group, P, form, bnctx)) in ec_point_hex2point_test_helper()
2427 || !TEST_ptr(Q = EC_POINT_hex2point(group, hex, NULL, bnctx)) in ec_point_hex2point_test_helper()
2428 || !TEST_int_eq(0, EC_POINT_cmp(group, Q, P, bnctx))) in ec_point_hex2point_test_helper()
2438 && !TEST_true(EC_POINT_is_at_infinity(group, Q))) in ec_point_hex2point_test_helper()
2457 EC_GROUP *group = NULL; in ec_point_hex2point_test() local
2465 || !TEST_ptr(group = EC_GROUP_new_by_curve_name(nid)) in ec_point_hex2point_test()
2466 || !TEST_ptr(G = EC_GROUP_get0_generator(group)) in ec_point_hex2point_test()
2467 || !TEST_ptr(P = EC_POINT_dup(G, group))) in ec_point_hex2point_test()
2470 if (!TEST_true(ec_point_hex2point_test_helper(group, P, in ec_point_hex2point_test()
2473 || !TEST_true(ec_point_hex2point_test_helper(group, NULL, in ec_point_hex2point_test()
2476 || !TEST_true(ec_point_hex2point_test_helper(group, P, in ec_point_hex2point_test()
2479 || !TEST_true(ec_point_hex2point_test_helper(group, NULL, in ec_point_hex2point_test()
2482 || !TEST_true(ec_point_hex2point_test_helper(group, P, in ec_point_hex2point_test()
2485 || !TEST_true(ec_point_hex2point_test_helper(group, NULL, in ec_point_hex2point_test()
2494 EC_GROUP_free(group); in ec_point_hex2point_test()
2500 static int do_test_custom_explicit_fromdata(EC_GROUP *group, BN_CTX *ctx, in do_test_custom_explicit_fromdata() argument
2529 if (EC_GROUP_get_field_type(group) == NID_X9_62_prime_field) { in do_test_custom_explicit_fromdata()
2534 if (EC_GROUP_get_basis_type(group) == NID_X9_62_tpBasis) { in do_test_custom_explicit_fromdata()
2536 if (!TEST_true(EC_GROUP_get_trinomial_basis(group, &k1))) in do_test_custom_explicit_fromdata()
2540 if (!TEST_true(EC_GROUP_get_pentanomial_basis(group, &k1, &k2, &k3))) in do_test_custom_explicit_fromdata()
2545 if (!TEST_true(EC_GROUP_get_curve(group, p, a, b, ctx)) in do_test_custom_explicit_fromdata()
2553 if (EC_GROUP_get0_seed(group) != NULL) { in do_test_custom_explicit_fromdata()
2555 OSSL_PKEY_PARAM_EC_SEED, EC_GROUP_get0_seed(group), in do_test_custom_explicit_fromdata()
2556 EC_GROUP_get_seed_len(group)))) in do_test_custom_explicit_fromdata()
2559 if (EC_GROUP_get0_cofactor(group) != NULL) { in do_test_custom_explicit_fromdata()
2561 EC_GROUP_get0_cofactor(group)))) in do_test_custom_explicit_fromdata()
2568 EC_GROUP_get0_order(group)))) in do_test_custom_explicit_fromdata()
2614 || !TEST_BN_eq(order_out, EC_GROUP_get0_order(group))) in do_test_custom_explicit_fromdata()
2617 if (EC_GROUP_get0_cofactor(group) != NULL) { in do_test_custom_explicit_fromdata()
2620 || !TEST_BN_eq(cofactor_out, EC_GROUP_get0_cofactor(group))) in do_test_custom_explicit_fromdata()
2623 if (EC_GROUP_get0_seed(group) != NULL) { in do_test_custom_explicit_fromdata()
2626 || !TEST_mem_eq(buf, buf_len, EC_GROUP_get0_seed(group), in do_test_custom_explicit_fromdata()
2627 EC_GROUP_get_seed_len(group))) in do_test_custom_explicit_fromdata()
2631 if (EC_GROUP_get_field_type(group) == NID_X9_62_prime_field) { in do_test_custom_explicit_fromdata()
2651 || !TEST_int_eq(EC_GROUP_get_degree(group), i_out) in do_test_custom_explicit_fromdata()
2658 if (EC_GROUP_get_basis_type(group) == NID_X9_62_tpBasis) { in do_test_custom_explicit_fromdata()
2726 EC_GROUP *group = NULL; in custom_generator_test() local
2740 if (!TEST_ptr(group = EC_GROUP_new_by_curve_name(nid))) in custom_generator_test()
2744 bsize = (EC_GROUP_get_degree(group) + 7) / 8; in custom_generator_test()
2749 || !TEST_true(BN_rand(k, EC_GROUP_order_bits(group) - 1, in custom_generator_test()
2753 || !TEST_ptr(G2 = EC_POINT_new(group)) in custom_generator_test()
2754 || !TEST_ptr(Q1 = EC_POINT_new(group)) in custom_generator_test()
2756 || !TEST_true(EC_POINT_mul(group, Q1, k, NULL, NULL, ctx)) in custom_generator_test()
2758 || !TEST_int_eq(EC_POINT_point2oct(group, Q1, in custom_generator_test()
2762 || !TEST_int_eq(EC_POINT_point2oct(group, Q1, in custom_generator_test()
2766 || !TEST_true(EC_POINT_dbl(group, G2, EC_GROUP_get0_generator(group), in custom_generator_test()
2768 || !TEST_true(EC_GROUP_set_generator(group, G2, in custom_generator_test()
2769 EC_GROUP_get0_order(group), in custom_generator_test()
2770 EC_GROUP_get0_cofactor(group))) in custom_generator_test()
2771 || !TEST_ptr(Q2 = EC_POINT_new(group)) in custom_generator_test()
2774 || !TEST_true(EC_POINT_mul(group, Q2, k, NULL, NULL, ctx)) in custom_generator_test()
2775 || !TEST_int_eq(EC_POINT_point2oct(group, Q2, in custom_generator_test()
2779 || !TEST_int_eq(EC_POINT_point2oct(group, Q2, in custom_generator_test()
2786 if (!do_test_custom_explicit_fromdata(group, ctx, b1, bsize)) in custom_generator_test()
2795 EC_GROUP_free(group); in custom_generator_test()
2811 EC_GROUP *group = NULL, *altgroup = NULL; in custom_params_test() local
2846 if (!TEST_ptr(group = EC_GROUP_new_by_curve_name(nid))) in custom_params_test()
2849 is_prime = EC_GROUP_get_field_type(group) == NID_X9_62_prime_field; in custom_params_test()
2858 bsize = (EC_GROUP_get_degree(group) + 7) / 8; in custom_params_test()
2862 if (!TEST_true(EC_GROUP_get_curve(group, p, a, b, ctx)) in custom_params_test()
2863 || !TEST_ptr(G2 = EC_POINT_new(group)) in custom_params_test()
2865 || !TEST_true(EC_POINT_dbl(group, G2, in custom_params_test()
2866 EC_GROUP_get0_generator(group), ctx)) in custom_params_test()
2868 || !TEST_int_eq(EC_POINT_point2oct(group, G2, in custom_params_test()
2872 || !TEST_int_eq(EC_POINT_point2oct(group, G2, in custom_params_test()
2875 || !TEST_ptr(z = EC_GROUP_get0_order(group)) in custom_params_test()
2876 || !TEST_ptr(cof = EC_GROUP_get0_cofactor(group)) in custom_params_test()
2903 !TEST_ptr(Q1 = EC_POINT_new(group)) in custom_params_test()
2906 || !TEST_true(BN_rand(k, EC_GROUP_order_bits(group) - 1, in custom_params_test()
2911 || !TEST_true(EC_POINT_mul(group, Q1, k, NULL, NULL, ctx)) in custom_params_test()
2913 || !TEST_int_eq(EC_POINT_point2oct(group, Q1, in custom_params_test()
2916 || !TEST_int_eq(EC_POINT_point2oct(group, Q1, in custom_params_test()
2954 if (!TEST_true(EC_POINT_mul(group, Q1, priv1, NULL, NULL, ctx)) in custom_params_test()
2955 || !TEST_int_eq(EC_POINT_point2oct(group, Q1, in custom_params_test()
2959 || !TEST_int_eq(EC_POINT_point2oct(group, Q1, in custom_params_test()
3065 EC_GROUP_free(group); in custom_params_test()