Lines Matching refs:ctx
116 static void timings(EC_GROUP *group, int type, BN_CTX *ctx)
128 if (!EC_GROUP_get_order(group, s, ctx)) ABORT;
153 (type != TIMING_BASE_PT) ? P : NULL, (type != TIMING_BASE_PT) ? r0[i] : NULL, ctx)) ABORT;
201 BN_CTX *ctx = BN_CTX_new();
206 if (!EC_GROUP_get_order(group, order, ctx)) ABORT;
207 if (!EC_POINT_mul(group, Q, order, NULL, NULL, ctx)) ABORT;
211 if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
212 if (!EC_POINT_mul(group, Q, order, NULL, NULL, ctx)) ABORT;
219 if(!EC_POINT_mul(group, Q, NULL, P, n1, ctx)) ABORT;
220 if (0 != EC_POINT_cmp(group, Q, P, ctx)) ABORT;
223 if(!EC_POINT_mul(group, Q, NULL, P, n2, ctx)) ABORT;
224 if (0 != EC_POINT_cmp(group, Q, P, ctx)) ABORT;
226 if (!BN_mul(n2, n1, n2, ctx)) ABORT;
227 if(!EC_POINT_mul(group, Q, NULL, P, n2, ctx)) ABORT;
228 if (0 != EC_POINT_cmp(group, Q, P, ctx)) ABORT;
235 BN_CTX_free(ctx);
240 BN_CTX *ctx = NULL;
251 ctx = BN_CTX_new();
252 if (!ctx) ABORT;
268 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
279 if (!EC_GROUP_get_curve_GFp(group, p, a, b, ctx)) ABORT;
298 if (!EC_POINT_oct2point(group, Q, buf, 1, ctx)) ABORT;
300 if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT;
309 if (!EC_POINT_set_compressed_coordinates_GFp(group, Q, x, 1, ctx)) ABORT;
310 if (!EC_POINT_is_on_curve(group, Q, ctx))
312 if (!EC_POINT_get_affine_coordinates_GFp(group, Q, x, y, ctx)) ABORT;
331 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
341 if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT;
350 if (!EC_POINTs_make_affine(group, 2, points, ctx)) ABORT;
357 if (!EC_POINT_add(group, P, Q, R, ctx)) ABORT;
360 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_COMPRESSED, buf, sizeof buf, ctx);
362 if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
363 if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT;
367 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_UNCOMPRESSED, buf, sizeof buf, ctx);
369 if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
370 if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT;
374 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_HYBRID, buf, sizeof buf, ctx);
376 if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
377 if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT;
381 if (!EC_POINT_get_Jprojective_coordinates_GFp(group, R, x, y, z, ctx)) ABORT;
390 if (!EC_POINT_invert(group, P, ctx)) ABORT;
391 if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT;
398 if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT;
401 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
405 if (!EC_POINT_set_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
406 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
410 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
433 if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT;
436 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
439 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx)) ABORT;
440 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
444 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
467 if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT;
470 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
473 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0, ctx)) ABORT;
474 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
478 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
501 if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT;
504 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
507 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx)) ABORT;
508 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
513 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
537 if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT;
542 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
546 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx)) ABORT;
547 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
552 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
578 if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT;
585 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
590 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0, ctx)) ABORT;
591 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
597 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
623 if (!EC_POINT_dbl(group, P, P, ctx)) ABORT;
624 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
625 if (!EC_POINT_invert(group, Q, ctx)) ABORT; /* P = -2Q */
627 if (!EC_POINT_add(group, R, P, Q, ctx)) ABORT;
628 if (!EC_POINT_add(group, R, R, Q, ctx)) ABORT;
642 if (!EC_GROUP_get_order(group, z, ctx)) ABORT;
653 if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT;
654 if (!EC_POINTs_mul(group, R, z, 2, points, scalars, ctx)) ABORT;
655 if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT;
656 if (0 != EC_POINT_cmp(group, R, Q, ctx)) ABORT;
667 if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT;
684 if (!EC_POINTs_mul(group, P, NULL, 4, points, scalars, ctx)) ABORT;
694 timings(P_160, TIMING_BASE_PT, ctx);
695 timings(P_160, TIMING_RAND_PT, ctx);
696 timings(P_160, TIMING_SIMUL, ctx);
697 timings(P_192, TIMING_BASE_PT, ctx);
698 timings(P_192, TIMING_RAND_PT, ctx);
699 timings(P_192, TIMING_SIMUL, ctx);
700 timings(P_224, TIMING_BASE_PT, ctx);
701 timings(P_224, TIMING_RAND_PT, ctx);
702 timings(P_224, TIMING_SIMUL, ctx);
703 timings(P_256, TIMING_BASE_PT, ctx);
704 timings(P_256, TIMING_RAND_PT, ctx);
705 timings(P_256, TIMING_SIMUL, ctx);
706 timings(P_384, TIMING_BASE_PT, ctx);
707 timings(P_384, TIMING_RAND_PT, ctx);
708 timings(P_384, TIMING_SIMUL, ctx);
709 timings(P_521, TIMING_BASE_PT, ctx);
710 timings(P_521, TIMING_RAND_PT, ctx);
711 timings(P_521, TIMING_SIMUL, ctx);
715 if (ctx)
716 BN_CTX_free(ctx);
737 if (!EC_POINT_set_compressed_coordinates_GF2m(group, P, x, _y_bit, ctx)) ABORT; \
738 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT; \
742 if (!EC_POINT_get_affine_coordinates_GF2m(group, P, x, y, ctx)) ABORT; \
755 if (!EC_POINT_set_affine_coordinates_GF2m(group, P, x, y, ctx)) ABORT; \
756 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT; \
771 if (!EC_GROUP_set_curve_GF2m(group, p, a, b, ctx)) ABORT; \
784 BN_CTX *ctx = NULL;
796 ctx = BN_CTX_new();
797 if (!ctx) ABORT;
812 if (!EC_GROUP_set_curve_GF2m(group, p, a, b, ctx)) ABORT;
823 if (!EC_GROUP_get_curve_GF2m(group, p, a, b, ctx)) ABORT;
842 if (!EC_POINT_oct2point(group, Q, buf, 1, ctx)) ABORT;
844 if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT;
856 if (!EC_POINT_set_compressed_coordinates_GF2m(group, Q, x, 1, ctx)) ABORT;
859 if (!EC_POINT_set_affine_coordinates_GF2m(group, Q, x, y, ctx)) ABORT;
861 if (!EC_POINT_is_on_curve(group, Q, ctx))
865 if (!EC_POINT_get_affine_coordinates_GF2m(group, Q, x, y, ctx)) ABORT;
885 if (!EC_POINT_get_affine_coordinates_GF2m(group, P, x, y, ctx)) ABORT;
895 if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT;
899 if (!EC_POINT_add(group, P, Q, R, ctx)) ABORT;
904 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_COMPRESSED, buf, sizeof buf, ctx);
906 if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
907 if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT;
912 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_UNCOMPRESSED, buf, sizeof buf, ctx);
914 if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
915 if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT;
921 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_HYBRID, buf, sizeof buf, ctx);
923 if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
924 if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT;
931 if (!EC_POINT_invert(group, P, ctx)) ABORT;
932 if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT;
1099 if (!EC_POINT_dbl(group, P, P, ctx)) ABORT;
1100 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
1101 if (!EC_POINT_invert(group, Q, ctx)) ABORT; /* P = -2Q */
1103 if (!EC_POINT_add(group, R, P, Q, ctx)) ABORT;
1104 if (!EC_POINT_add(group, R, R, Q, ctx)) ABORT;
1126 if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT;
1127 if (!EC_POINTs_mul(group, R, z, 2, points, scalars, ctx)) ABORT;
1128 if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT;
1129 if (0 != EC_POINT_cmp(group, R, Q, ctx)) ABORT;
1140 if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT;
1153 if (!EC_POINTs_mul(group, P, NULL, 3, points, scalars, ctx)) ABORT;
1161 timings(C2_K163, TIMING_BASE_PT, ctx);
1162 timings(C2_K163, TIMING_RAND_PT, ctx);
1163 timings(C2_K163, TIMING_SIMUL, ctx);
1164 timings(C2_B163, TIMING_BASE_PT, ctx);
1165 timings(C2_B163, TIMING_RAND_PT, ctx);
1166 timings(C2_B163, TIMING_SIMUL, ctx);
1167 timings(C2_K233, TIMING_BASE_PT, ctx);
1168 timings(C2_K233, TIMING_RAND_PT, ctx);
1169 timings(C2_K233, TIMING_SIMUL, ctx);
1170 timings(C2_B233, TIMING_BASE_PT, ctx);
1171 timings(C2_B233, TIMING_RAND_PT, ctx);
1172 timings(C2_B233, TIMING_SIMUL, ctx);
1173 timings(C2_K283, TIMING_BASE_PT, ctx);
1174 timings(C2_K283, TIMING_RAND_PT, ctx);
1175 timings(C2_K283, TIMING_SIMUL, ctx);
1176 timings(C2_B283, TIMING_BASE_PT, ctx);
1177 timings(C2_B283, TIMING_RAND_PT, ctx);
1178 timings(C2_B283, TIMING_SIMUL, ctx);
1179 timings(C2_K409, TIMING_BASE_PT, ctx);
1180 timings(C2_K409, TIMING_RAND_PT, ctx);
1181 timings(C2_K409, TIMING_SIMUL, ctx);
1182 timings(C2_B409, TIMING_BASE_PT, ctx);
1183 timings(C2_B409, TIMING_RAND_PT, ctx);
1184 timings(C2_B409, TIMING_SIMUL, ctx);
1185 timings(C2_K571, TIMING_BASE_PT, ctx);
1186 timings(C2_K571, TIMING_RAND_PT, ctx);
1187 timings(C2_K571, TIMING_SIMUL, ctx);
1188 timings(C2_B571, TIMING_BASE_PT, ctx);
1189 timings(C2_B571, TIMING_RAND_PT, ctx);
1190 timings(C2_B571, TIMING_SIMUL, ctx);
1194 if (ctx)
1195 BN_CTX_free(ctx);
1335 BN_CTX *ctx;
1341 ctx = BN_CTX_new();
1351 if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT;
1354 if (!EC_GROUP_set_curve_GFp(NISTP, p, a, b, ctx)) ABORT;
1361 if(!EC_POINT_set_affine_coordinates_GFp(NISTP, Q_CHECK, x, y, ctx)) ABORT;
1364 if (!EC_POINT_set_affine_coordinates_GFp(NISTP, G, x, y, ctx)) ABORT;
1375 EC_POINT_mul(NISTP, Q, n, NULL, NULL, ctx);
1376 if (0 != EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
1378 EC_POINT_mul(NISTP, Q, NULL, G, n, ctx);
1379 if (0 != EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
1382 if (!EC_POINT_dbl(NISTP, P, G, ctx)) ABORT;
1389 EC_POINT_mul(NISTP, Q, m, NULL, NULL, ctx);
1390 if (0 != EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
1392 EC_POINT_mul(NISTP, Q, NULL, P, m, ctx);
1393 if (0 != EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
1396 if (!EC_GROUP_precompute_mult(NISTP, ctx)) ABORT;
1399 EC_POINT_mul(NISTP, Q, m, NULL, NULL, ctx);
1400 if (0 != EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
1402 EC_POINT_mul(NISTP, Q, NULL, P, m, ctx);
1403 if (0 != EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
1408 EC_POINT_mul(NISTP, Q, n, NULL, NULL, ctx);
1409 if (0 != EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
1411 EC_POINT_mul(NISTP, Q, NULL, G, n, ctx);
1412 if (0 != EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
1417 timings(NISTP, TIMING_BASE_PT, ctx);
1418 timings(NISTP, TIMING_RAND_PT, ctx);
1433 BN_CTX_free(ctx);