Lines Matching defs:group

118 static void timings(EC_GROUP *group, int type, BN_CTX *ctx)
130 fprintf(stdout, "Timings for %d-bit field, ", EC_GROUP_get_degree(group));
131 if (!EC_GROUP_get_order(group, s, ctx))
136 P = EC_POINT_new(group);
139 EC_POINT_copy(P, EC_GROUP_get0_generator(group));
158 (group, P, (type != TIMING_RAND_PT) ? r[i] : NULL,
208 /* test multiplication with group order, long and negative scalars */
209 static void group_order_tests(EC_GROUP *group)
212 EC_POINT *P = EC_POINT_new(group);
213 EC_POINT *Q = EC_POINT_new(group);
220 fprintf(stdout, "verify group order ...");
222 if (!EC_GROUP_get_order(group, order, ctx))
224 if (!EC_POINT_mul(group, Q, order, NULL, NULL, ctx))
226 if (!EC_POINT_is_at_infinity(group, Q))
230 if (!EC_GROUP_precompute_mult(group, ctx))
232 if (!EC_POINT_mul(group, Q, order, NULL, NULL, ctx))
234 if (!EC_POINT_is_at_infinity(group, Q))
251 if (!EC_POINT_mul(group, P, n1, NULL, NULL, ctx))
259 if (!EC_POINT_mul(group, Q, NULL, P, n1, ctx))
261 if (0 != EC_POINT_cmp(group, Q, P, ctx))
267 if (!EC_POINT_mul(group, Q, NULL, P, n2, ctx))
269 if (0 != EC_POINT_cmp(group, Q, P, ctx))
275 if (!EC_POINT_mul(group, Q, NULL, P, n2, ctx))
277 if (0 != EC_POINT_cmp(group, Q, P, ctx))
282 if (!EC_POINT_mul(group, Q, NULL, P, n2, ctx))
285 if (!EC_POINT_add(group, Q, Q, P, ctx))
287 if (!EC_POINT_is_at_infinity(group, Q))
291 if (EC_POINT_is_at_infinity(group, P))
305 if (!EC_POINTs_mul(group, P, NULL, 6, points, scalars, ctx))
307 if (!EC_POINT_is_at_infinity(group, P))
324 EC_GROUP *group;
352 group = EC_GROUP_new(EC_GFp_mont_method()); /* applications should use
356 if (!group)
359 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx))
364 tmp = EC_GROUP_new(EC_GROUP_method_of(group));
367 if (!EC_GROUP_copy(tmp, group))
369 EC_GROUP_free(group);
370 group = tmp;
373 if (!EC_GROUP_get_curve_GFp(group, p, a, b, ctx))
385 P = EC_POINT_new(group);
386 Q = EC_POINT_new(group);
387 R = EC_POINT_new(group);
391 if (!EC_POINT_set_to_infinity(group, P))
393 if (!EC_POINT_is_at_infinity(group, P))
397 if (!EC_POINT_oct2point(group, Q, buf, 1, ctx))
400 if (!EC_POINT_add(group, P, P, Q, ctx))
402 if (!EC_POINT_is_at_infinity(group, P))
413 if (!EC_POINT_set_compressed_coordinates_GFp(group, Q, x, 1, ctx))
415 if (EC_POINT_is_on_curve(group, Q, ctx) <= 0) {
416 if (!EC_POINT_get_affine_coordinates_GFp(group, Q, x, y, ctx))
432 if (EC_POINT_is_at_infinity(group, P))
435 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx))
447 if (!EC_POINT_add(group, P, P, Q, ctx))
457 if (!EC_POINTs_make_affine(group, 2, points, ctx))
463 while (!EC_POINT_is_at_infinity(group, P));
465 if (!EC_POINT_add(group, P, Q, R, ctx))
467 if (!EC_POINT_is_at_infinity(group, P))
471 EC_POINT_point2oct(group, Q, POINT_CONVERSION_COMPRESSED, buf,
475 if (!EC_POINT_oct2point(group, P, buf, len, ctx))
477 if (0 != EC_POINT_cmp(group, P, Q, ctx))
484 EC_POINT_point2oct(group, Q, POINT_CONVERSION_UNCOMPRESSED, buf,
488 if (!EC_POINT_oct2point(group, P, buf, len, ctx))
490 if (0 != EC_POINT_cmp(group, P, Q, ctx))
497 EC_POINT_point2oct(group, Q, POINT_CONVERSION_HYBRID, buf, sizeof buf,
501 if (!EC_POINT_oct2point(group, P, buf, len, ctx))
503 if (0 != EC_POINT_cmp(group, P, Q, ctx))
509 if (!EC_POINT_get_Jprojective_coordinates_GFp(group, R, x, y, z, ctx))
520 if (!EC_POINT_invert(group, P, ctx))
522 if (0 != EC_POINT_cmp(group, P, R, ctx))
538 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx))
545 if (!EC_POINT_set_affine_coordinates_GFp(group, P, x, y, ctx))
547 if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
551 if (!EC_GROUP_set_generator(group, P, z, BN_value_one()))
554 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx))
568 if (EC_GROUP_get_degree(group) != 160)
572 group_order_tests(group);
574 if (!(P_160 = EC_GROUP_new(EC_GROUP_method_of(group))))
576 if (!EC_GROUP_copy(P_160, group))
589 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx))
594 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx))
596 if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
600 if (!EC_GROUP_set_generator(group, P, z, BN_value_one()))
603 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx))
617 if (EC_GROUP_get_degree(group) != 192)
621 group_order_tests(group);
623 if (!(P_192 = EC_GROUP_new(EC_GROUP_method_of(group))))
625 if (!EC_GROUP_copy(P_192, group))
641 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx))
647 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0, ctx))
649 if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
654 if (!EC_GROUP_set_generator(group, P, z, BN_value_one()))
657 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx))
672 if (EC_GROUP_get_degree(group) != 224)
676 group_order_tests(group);
678 if (!(P_224 = EC_GROUP_new(EC_GROUP_method_of(group))))
680 if (!EC_GROUP_copy(P_224, group))
699 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx))
706 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx))
708 if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
713 if (!EC_GROUP_set_generator(group, P, z, BN_value_one()))
716 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx))
732 if (EC_GROUP_get_degree(group) != 256)
736 group_order_tests(group);
738 if (!(P_256 = EC_GROUP_new(EC_GROUP_method_of(group))))
740 if (!EC_GROUP_copy(P_256, group))
756 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx))
762 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx))
764 if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
769 if (!EC_GROUP_set_generator(group, P, z, BN_value_one()))
772 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx))
787 if (EC_GROUP_get_degree(group) != 384)
791 group_order_tests(group);
793 if (!(P_384 = EC_GROUP_new(EC_GROUP_method_of(group))))
795 if (!EC_GROUP_copy(P_384, group))
814 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx))
821 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0, ctx))
823 if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
829 if (!EC_GROUP_set_generator(group, P, z, BN_value_one()))
832 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx))
848 if (EC_GROUP_get_degree(group) != 521)
852 group_order_tests(group);
854 if (!(P_521 = EC_GROUP_new(EC_GROUP_method_of(group))))
856 if (!EC_GROUP_copy(P_521, group))
863 if (EC_POINT_is_at_infinity(group, Q))
865 if (!EC_POINT_dbl(group, P, P, ctx))
867 if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
869 if (!EC_POINT_invert(group, Q, ctx))
872 if (!EC_POINT_add(group, R, P, Q, ctx))
874 if (!EC_POINT_add(group, R, R, Q, ctx))
876 if (!EC_POINT_is_at_infinity(group, R))
884 if (EC_POINT_is_at_infinity(group, Q))
891 if (!EC_GROUP_get_order(group, z, ctx))
899 scalars[0] = y; /* (group order + 1)/2, so y*Q + y*Q = Q */
905 /* z is still the group order */
906 if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx))
908 if (!EC_POINTs_mul(group, R, z, 2, points, scalars, ctx))
910 if (0 != EC_POINT_cmp(group, P, R, ctx))
912 if (0 != EC_POINT_cmp(group, R, Q, ctx))
926 if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx))
928 if (!EC_POINT_is_at_infinity(group, P))
947 if (!EC_POINTs_mul(group, P, NULL, 4, points, scalars, ctx))
949 if (!EC_POINT_is_at_infinity(group, P))
983 EC_GROUP_free(group);
1010 if (!EC_POINT_set_compressed_coordinates_GF2m(group, P, x, _y_bit, ctx)) ABORT; \
1011 if (EC_POINT_is_on_curve(group, P, ctx) <= 0) ABORT; \
1014 if (!EC_GROUP_set_generator(group, P, z, cof)) ABORT; \
1015 if (!EC_POINT_get_affine_coordinates_GF2m(group, P, x, y, ctx)) ABORT; \
1028 if (!EC_POINT_set_affine_coordinates_GF2m(group, P, x, y, ctx)) ABORT; \
1029 if (EC_POINT_is_on_curve(group, P, ctx) <= 0) ABORT; \
1032 if (!EC_GROUP_set_generator(group, P, z, cof)) ABORT; \
1044 if (!EC_GROUP_set_curve_GF2m(group, p, a, b, ctx)) ABORT; \
1047 if (EC_GROUP_get_degree(group) != _degree) ABORT; \
1049 group_order_tests(group); \
1050 if (!(_variable = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT; \
1051 if (!EC_GROUP_copy(_variable, group)) ABORT; \
1059 EC_GROUP *group;
1089 group = EC_GROUP_new(EC_GF2m_simple_method()); /* applications should use
1093 if (!group)
1095 if (!EC_GROUP_set_curve_GF2m(group, p, a, b, ctx))
1100 tmp = EC_GROUP_new(EC_GROUP_method_of(group));
1103 if (!EC_GROUP_copy(tmp, group))
1105 EC_GROUP_free(group);
1106 group = tmp;
1109 if (!EC_GROUP_get_curve_GF2m(group, p, a, b, ctx))
1121 P = EC_POINT_new(group);
1122 Q = EC_POINT_new(group);
1123 R = EC_POINT_new(group);
1127 if (!EC_POINT_set_to_infinity(group, P))
1129 if (!EC_POINT_is_at_infinity(group, P))
1133 if (!EC_POINT_oct2point(group, Q, buf, 1, ctx))
1136 if (!EC_POINT_add(group, P, P, Q, ctx))
1138 if (!EC_POINT_is_at_infinity(group, P))
1152 if (!EC_POINT_set_compressed_coordinates_GF2m(group, Q, x, 1, ctx))
1157 if (!EC_POINT_set_affine_coordinates_GF2m(group, Q, x, y, ctx))
1160 if (EC_POINT_is_on_curve(group, Q, ctx) <= 0) {
1163 if (!EC_POINT_get_affine_coordinates_GF2m(group, Q, x, y, ctx))
1180 if (EC_POINT_is_at_infinity(group, P))
1183 if (!EC_POINT_get_affine_coordinates_GF2m(group, P, x, y, ctx))
1195 if (!EC_POINT_add(group, P, P, Q, ctx))
1198 while (!EC_POINT_is_at_infinity(group, P));
1200 if (!EC_POINT_add(group, P, Q, R, ctx))
1202 if (!EC_POINT_is_at_infinity(group, P))
1208 EC_POINT_point2oct(group, Q, POINT_CONVERSION_COMPRESSED, buf,
1212 if (!EC_POINT_oct2point(group, P, buf, len, ctx))
1214 if (0 != EC_POINT_cmp(group, P, Q, ctx))
1222 EC_POINT_point2oct(group, Q, POINT_CONVERSION_UNCOMPRESSED, buf,
1226 if (!EC_POINT_oct2point(group, P, buf, len, ctx))
1228 if (0 != EC_POINT_cmp(group, P, Q, ctx))
1237 EC_POINT_point2oct(group, Q, POINT_CONVERSION_HYBRID, buf, sizeof buf,
1241 if (!EC_POINT_oct2point(group, P, buf, len, ctx))
1243 if (0 != EC_POINT_cmp(group, P, Q, ctx))
1252 if (!EC_POINT_invert(group, P, ctx))
1254 if (0 != EC_POINT_cmp(group, P, R, ctx))
1377 if (EC_POINT_is_at_infinity(group, Q))
1379 if (!EC_POINT_dbl(group, P, P, ctx))
1381 if (EC_POINT_is_on_curve(group, P, ctx) <= 0)
1383 if (!EC_POINT_invert(group, Q, ctx))
1386 if (!EC_POINT_add(group, R, P, Q, ctx))
1388 if (!EC_POINT_add(group, R, R, Q, ctx))
1390 if (!EC_POINT_is_at_infinity(group, R))
1397 if (EC_POINT_is_at_infinity(group, Q))
1409 scalars[0] = y; /* (group order + 1)/2, so y*Q + y*Q = Q */
1415 /* z is still the group order */
1416 if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx))
1418 if (!EC_POINTs_mul(group, R, z, 2, points, scalars, ctx))
1420 if (0 != EC_POINT_cmp(group, P, R, ctx))
1422 if (0 != EC_POINT_cmp(group, R, Q, ctx))
1436 if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx))
1438 if (!EC_POINT_is_at_infinity(group, P))
1453 if (!EC_POINTs_mul(group, P, NULL, 3, points, scalars, ctx))
1455 if (!EC_POINT_is_at_infinity(group, P))
1499 EC_GROUP_free(group);
1553 EC_GROUP *group = NULL;
1555 if ((group = EC_GROUP_new_by_curve_name(nid)) == NULL) {
1562 if (!EC_GROUP_check(group, NULL)) {
1566 EC_GROUP_free(group);
1572 EC_GROUP_free(group);