Lines Matching full:point
33 /* Create a new point option. NBITS gives the size in bits of one
50 /* Release the point object P. P may be NULL. */
60 /* Initialize the fields of a point object. gcry_mpi_point_free_parts
71 /* Release the parts of a point object. */
677 * POINT. Set them into X and Y. If one coordinate is not required,
679 * on success or !0 if POINT is at infinity.
681 int mpi_ec_get_affine(MPI x, MPI y, MPI_POINT point, struct mpi_ec_ctx *ctx) in mpi_ec_get_affine() argument
683 if (!mpi_cmp_ui(point->z, 0)) in mpi_ec_get_affine()
693 ec_invm(z1, point->z, ctx); /* z1 = z^(-1) mod p */ in mpi_ec_get_affine()
697 ec_mulm(x, point->x, z2, ctx); in mpi_ec_get_affine()
702 ec_mulm(y, point->y, z3, ctx); in mpi_ec_get_affine()
714 mpi_set(x, point->x); in mpi_ec_get_affine()
729 ec_invm(z, point->z, ctx); in mpi_ec_get_affine()
737 ctx->mulm(x, point->x, z, ctx); in mpi_ec_get_affine()
742 ctx->mulm(y, point->y, z, ctx); in mpi_ec_get_affine()
755 /* RESULT = 2 * POINT (Weierstrass version). */
757 MPI_POINT point, struct mpi_ec_ctx *ctx) in dup_point_weierstrass() argument
769 if (!mpi_cmp_ui(point->y, 0) || !mpi_cmp_ui(point->z, 0)) { in dup_point_weierstrass()
780 ec_pow2(t1, point->z, ctx); in dup_point_weierstrass()
781 ec_subm(l1, point->x, t1, ctx); in dup_point_weierstrass()
783 ec_addm(t2, point->x, t1, ctx); in dup_point_weierstrass()
789 ec_pow2(l1, point->x, ctx); in dup_point_weierstrass()
791 ec_powm(t1, point->z, mpi_const(MPI_C_FOUR), ctx); in dup_point_weierstrass()
796 ec_mulm(z3, point->y, point->z, ctx); in dup_point_weierstrass()
801 ec_pow2(t2, point->y, ctx); in dup_point_weierstrass()
802 ec_mulm(l2, t2, point->x, ctx); in dup_point_weierstrass()
833 /* RESULT = 2 * POINT (Montgomery version). */
835 MPI_POINT point, struct mpi_ec_ctx *ctx) in dup_point_montgomery() argument
838 (void)point; in dup_point_montgomery()
844 /* RESULT = 2 * POINT (Twisted Edwards version). */
846 MPI_POINT point, struct mpi_ec_ctx *ctx) in dup_point_edwards() argument
848 #define X1 (point->x) in dup_point_edwards()
849 #define Y1 (point->y) in dup_point_edwards()
850 #define Z1 (point->z) in dup_point_edwards()
916 /* RESULT = 2 * POINT */
918 mpi_ec_dup_point(MPI_POINT result, MPI_POINT point, struct mpi_ec_ctx *ctx) in mpi_ec_dup_point() argument
922 dup_point_weierstrass(result, point, ctx); in mpi_ec_dup_point()
925 dup_point_montgomery(result, point, ctx); in mpi_ec_dup_point()
928 dup_point_edwards(result, point, ctx); in mpi_ec_dup_point()
960 /* Same point; need to call the duplicate function. */ in add_points_weierstrass()
1162 /* Compute a step of Montgomery Ladder (only use X and Z in the point).
1209 /* Scalar point multiplication - the main function for ECC. If takes
1210 * an integer SCALAR and a POINT as well as the usual context CTX.
1211 * RESULT will be set to the resulting point.
1214 MPI scalar, MPI_POINT point, in mpi_ec_mul_point() argument
1240 point_resize(point, ctx); in mpi_ec_mul_point()
1243 point_resize(point, ctx); in mpi_ec_mul_point()
1248 mpi_ec_add_points(result, result, point, ctx); in mpi_ec_mul_point()
1259 /* Compute scalar point multiplication with Montgomery Ladder. in mpi_ec_mul_point()
1271 p2.x = mpi_copy(point->x); in mpi_ec_mul_point()
1279 mpi_resize(point->x, ctx->p->nlimbs); in mpi_ec_mul_point()
1280 point->x->nlimbs = ctx->p->nlimbs; in mpi_ec_mul_point()
1292 montgomery_ladder(prd, sum, q1, q2, point->x, ctx); in mpi_ec_mul_point()
1326 yy = mpi_copy(point->y); in mpi_ec_mul_point()
1333 if (!mpi_cmp_ui(point->z, 1)) { in mpi_ec_mul_point()
1334 mpi_set(x1, point->x); in mpi_ec_mul_point()
1341 ec_mulm(z2, point->z, point->z, ctx); in mpi_ec_mul_point()
1342 ec_mulm(z3, point->z, z2, ctx); in mpi_ec_mul_point()
1344 ec_mulm(x1, point->x, z2, ctx); in mpi_ec_mul_point()
1364 mpi_set(result->x, point->x); in mpi_ec_mul_point()
1366 mpi_set(result->z, point->z); in mpi_ec_mul_point()
1376 /* Invert point: y = p - y mod p */ in mpi_ec_mul_point()
1400 /* Return true if POINT is on the curve described by CTX. */
1401 int mpi_ec_curve_point(MPI_POINT point, struct mpi_ec_ctx *ctx) in mpi_ec_curve_point() argument
1410 /* Check that the point is in range. This needs to be done here and in mpi_ec_curve_point()
1413 if (mpi_cmpabs(point->x, ctx->p) >= 0) in mpi_ec_curve_point()
1415 if (mpi_cmpabs(point->y, ctx->p) >= 0) in mpi_ec_curve_point()
1417 if (mpi_cmpabs(point->z, ctx->p) >= 0) in mpi_ec_curve_point()
1425 if (mpi_ec_get_affine(x, y, point, ctx)) in mpi_ec_curve_point()
1449 if (mpi_ec_get_affine(x, NULL, point, ctx)) in mpi_ec_curve_point()
1479 if (mpi_ec_get_affine(x, y, point, ctx)) in mpi_ec_curve_point()