Lines Matching full:group
119 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)) ABORT;
135 P = EC_POINT_new(group);
137 EC_POINT_copy(P, EC_GROUP_get0_generator(group));
155 if (!EC_POINT_mul(group, P, (type != TIMING_RAND_PT) ? r[i] : NULL,
202 EC_GROUP *group;
224 group = EC_GROUP_new(EC_GFp_mont_method()); /* applications should use EC_GROUP_new_curve_GFp
226 if (!group) ABORT;
228 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
232 tmp = EC_GROUP_new(EC_GROUP_method_of(group));
234 if (!EC_GROUP_copy(tmp, group)) ABORT;
235 EC_GROUP_free(group);
236 group = tmp;
239 if (!EC_GROUP_get_curve_GFp(group, p, a, b, ctx)) ABORT;
249 P = EC_POINT_new(group);
250 Q = EC_POINT_new(group);
251 R = EC_POINT_new(group);
254 if (!EC_POINT_set_to_infinity(group, P)) ABORT;
255 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
258 if (!EC_POINT_oct2point(group, Q, buf, 1, ctx)) ABORT;
260 if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT;
261 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
269 if (!EC_POINT_set_compressed_coordinates_GFp(group, Q, x, 1, ctx)) ABORT;
270 if (!EC_POINT_is_on_curve(group, Q, ctx))
272 if (!EC_POINT_get_affine_coordinates_GFp(group, Q, x, y, ctx)) ABORT;
287 if (EC_POINT_is_at_infinity(group, P))
291 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
301 if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT;
310 if (!EC_POINTs_make_affine(group, 2, points, ctx)) ABORT;
315 while (!EC_POINT_is_at_infinity(group, P));
317 if (!EC_POINT_add(group, P, Q, R, ctx)) ABORT;
318 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
320 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_COMPRESSED, buf, sizeof buf, ctx);
322 if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
323 if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT;
327 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_UNCOMPRESSED, buf, sizeof buf, ctx);
329 if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
330 if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT;
334 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_HYBRID, buf, sizeof buf, ctx);
336 if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
337 if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT;
341 if (!EC_POINT_get_Jprojective_coordinates_GFp(group, R, x, y, z, ctx)) ABORT;
350 if (!EC_POINT_invert(group, P, ctx)) ABORT;
351 if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT;
361 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
365 if (!EC_POINT_set_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
366 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
368 if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT;
370 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
381 if (EC_GROUP_get_degree(group) != 160) ABORT;
384 fprintf(stdout, "verify group order ...");
386 if (!EC_GROUP_get_order(group, z, ctx)) ABORT;
387 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
388 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
391 if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
392 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
393 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
396 if (!(P_160 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
397 if (!EC_GROUP_copy(P_160, group)) ABORT;
406 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
409 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx)) ABORT;
410 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
412 if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT;
414 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
425 if (EC_GROUP_get_degree(group) != 192) ABORT;
428 fprintf(stdout, "verify group order ...");
430 if (!EC_GROUP_get_order(group, z, ctx)) ABORT;
431 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
432 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
436 if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
438 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
439 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
442 if (!(P_192 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
443 if (!EC_GROUP_copy(P_192, group)) ABORT;
452 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
455 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0, ctx)) ABORT;
456 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
458 if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT;
460 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
471 if (EC_GROUP_get_degree(group) != 224) ABORT;
474 fprintf(stdout, "verify group order ...");
476 if (!EC_GROUP_get_order(group, z, ctx)) ABORT;
477 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
478 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
482 if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
484 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
485 if (!EC_POINT_is_at_infinity(group
488 if (!(P_224 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
489 if (!EC_GROUP_copy(P_224, group)) ABORT;
498 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
501 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx)) ABORT;
502 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
505 if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT;
507 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
518 if (EC_GROUP_get_degree(group) != 256) ABORT;
521 fprintf(stdout, "verify group order ...");
523 if (!EC_GROUP_get_order(group, z, ctx)) ABORT;
524 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
525 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
529 if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
531 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
532 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
535 if (!(P_256 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
536 if (!EC_GROUP_copy(P_256, group)) ABORT;
548 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
552 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx)) ABORT;
553 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
556 if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT;
558 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
570 if (EC_GROUP_get_degree(group) != 384) ABORT;
573 fprintf(stdout, "verify group order ...");
575 if (!EC_GROUP_get_order(group, z, ctx)) ABORT;
576 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
577 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
581 if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
583 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
584 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
587 if (!(P_384 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
588 if (!EC_GROUP_copy(P_384, group)) ABORT;
603 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
608 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0, ctx)) ABORT;
609 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
613 if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT;
615 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
628 if (EC_GROUP_get_degree(group) != 521) ABORT;
631 fprintf(stdout, "verify group order ...");
633 if (!EC_GROUP_get_order(group, z, ctx)) ABORT;
634 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
635 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
639 if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
641 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
642 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
645 if (!(P_521 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
646 if (!EC_GROUP_copy(P_521, group)) ABORT;
652 if (EC_POINT_is_at_infinity(group, Q)) ABORT;
653 if (!EC_POINT_dbl(group, P, P, ctx)) ABORT;
654 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
655 if (!EC_POINT_invert(group, Q, ctx)) ABORT; /* P = -2Q */
657 if (!EC_POINT_add(group, R, P, Q, ctx)) ABORT;
658 if (!EC_POINT_add(group, R, R, Q, ctx)) ABORT;
659 if (!EC_POINT_is_at_infinity(group, R)) ABORT; /* R = P + 2Q */
666 if (EC_POINT_is_at_infinity(group, Q)) ABORT;
675 scalars[0] = y; /* (group order + 1)/2, so y*Q + y*Q = Q */
681 /* z is still the group order */
682 if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT;
683 if (!EC_POINTs_mul(group, R, z, 2, points, scalars, ctx)) ABORT;
684 if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT;
685 if (0 != EC_POINT_cmp(group, R, Q, ctx)) ABORT;
696 if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT;
697 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
713 if (!EC_POINTs_mul(group, P, NULL, 4, points, scalars, ctx)) ABORT;
714 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
747 EC_GROUP_free(group);
766 if (!EC_POINT_set_compressed_coordinates_GF2m(group, P, x, _y_bit, ctx)) ABORT; \
767 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT; \
770 if (!EC_GROUP_set_generator(group, P, z, cof)) ABORT; \
771 if (!EC_POINT_get_affine_coordinates_GF2m(group, P, x, y, ctx)) ABORT; \
784 if (!EC_POINT_set_affine_coordinates_GF2m(group, P, x, y, ctx)) ABORT; \
785 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT; \
788 if (!EC_GROUP_set_generator(group, P, z, cof)) ABORT; \
800 if (!EC_GROUP_set_curve_GF2m(group, p, a, b, ctx)) ABORT; \
803 if (EC_GROUP_get_degree(group) != _degree) ABORT; \
805 fprintf(stdout, "verify group order ..."); \
807 if (!EC_GROUP_get_order(group, z, ctx)) ABORT; \
808 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; \
809 if (!EC_POINT_is_at_infinity(group, Q)) ABORT; \
812 /* if (!EC_GROUP_precompute_mult(group, ctx)) ABORT; */ \
813 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; \
814 if (!EC_POINT_is_at_infinity(group, Q)) ABORT; \
816 if (!(_variable = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT; \
817 if (!EC_GROUP_copy(_variable, group)) ABORT;
823 EC_GROUP *group;
846 group = EC_GROUP_new(EC_GF2m_simple_method()); /* applications should use EC_GROUP_new_curve_GF2m
848 if (!group) ABORT;
849 if (!EC_GROUP_set_curve_GF2m(group, p, a, b, ctx)) ABORT;
853 tmp = EC_GROUP_new(EC_GROUP_method_of(group));
855 if (!EC_GROUP_copy(tmp, group)) ABORT;
856 EC_GROUP_free(group);
857 group = tmp;
860 if (!EC_GROUP_get_curve_GF2m(group, p, a, b, ctx)) ABORT;
870 P = EC_POINT_new(group);
871 Q = EC_POINT_new(group);
872 R = EC_POINT_new(group);
875 if (!EC_POINT_set_to_infinity(group, P)) ABORT;
876 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
879 if (!EC_POINT_oct2point(group, Q, buf, 1, ctx)) ABORT;
881 if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT;
882 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
893 if (!EC_POINT_set_compressed_coordinates_GF2m(group, Q, x, 1, ctx)) ABORT;
896 if (!EC_POINT_set_affine_coordinates_GF2m(group, Q, x, y, ctx)) ABORT;
898 if (!EC_POINT_is_on_curve(group, Q, ctx))
902 if (!EC_POINT_get_affine_coordinates_GF2m(group, Q, x, y, ctx)) ABORT;
918 if (EC_POINT_is_at_infinity(group, P))
922 if (!EC_POINT_get_affine_coordinates_GF2m(group, P, x, y, ctx)) ABORT;
932 if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT;
934 while (!EC_POINT_is_at_infinity(group, P));
936 if (!EC_POINT_add(group, P, Q, R, ctx)) ABORT;
937 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
941 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_COMPRESSED, buf, sizeof buf, ctx);
943 if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
944 if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT;
949 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_UNCOMPRESSED, buf, sizeof buf, ctx);
951 if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
952 if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT;
958 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_HYBRID, buf, sizeof buf, ctx);
960 if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
961 if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT;
968 if (!EC_POINT_invert(group, P, ctx)) ABORT;
969 if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT;
1135 if (EC_POINT_is_at_infinity(group, Q)) ABORT;
1136 if (!EC_POINT_dbl(group, P, P, ctx)) ABORT;
1137 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
1138 if (!EC_POINT_invert(group, Q, ctx)) ABORT; /* P = -2Q */
1140 if (!EC_POINT_add(group, R, P, Q, ctx)) ABORT;
1141 if (!EC_POINT_add(group, R, R, Q, ctx)) ABORT;
1142 if (!EC_POINT_is_at_infinity(group, R)) ABORT; /* R = P + 2Q */
1148 if (EC_POINT_is_at_infinity(group, Q)) ABORT;
1156 scalars[0] = y; /* (group order + 1)/2, so y*Q + y*Q = Q */
1162 /* z is still the group order */
1163 if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT;
1164 if (!EC_POINTs_mul(group, R, z, 2, points, scalars, ctx)) ABORT;
1165 if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT;
1166 if (0 != EC_POINT_cmp(group, R, Q, ctx)) ABORT;
1177 if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT;
1178 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
1190 if (!EC_POINTs_mul(group, P, NULL, 3, points, scalars, ctx)) ABORT;
1191 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
1234 EC_GROUP_free(group);
1276 EC_GROUP *group = NULL;
1278 if ((group = EC_GROUP_new_by_curve_name(nid)) == NULL)
1286 if (!EC_GROUP_check(group, NULL))
1291 EC_GROUP_free(group);
1297 EC_GROUP_free(group);