Lines Matching defs:point

295 int ec_GF2m_simple_point_init(EC_POINT *point)
297 BN_init(&point->X);
298 BN_init(&point->Y);
299 BN_init(&point->Z);
305 void ec_GF2m_simple_point_finish(EC_POINT *point)
307 BN_free(&point->X);
308 BN_free(&point->Y);
309 BN_free(&point->Z);
314 void ec_GF2m_simple_point_clear_finish(EC_POINT *point)
316 BN_clear_free(&point->X);
317 BN_clear_free(&point->Y);
318 BN_clear_free(&point->Z);
319 point->Z_is_one = 0;
335 /* Set an EC_POINT to the point at infinity.
336 * A point at infinity is represented by having Z=0.
338 int ec_GF2m_simple_point_set_to_infinity(const EC_GROUP *group, EC_POINT *point)
340 point->Z_is_one = 0;
341 BN_zero(&point->Z);
349 int ec_GF2m_simple_point_set_affine_coordinates(const EC_GROUP *group, EC_POINT *point,
359 if (!BN_copy(&point->X, x)) goto err;
360 BN_set_negative(&point->X, 0);
361 if (!BN_copy(&point->Y, y)) goto err;
362 BN_set_negative(&point->Y, 0);
363 if (!BN_copy(&point->Z, BN_value_one())) goto err;
364 BN_set_negative(&point->Z, 0);
365 point->Z_is_one = 1;
376 int ec_GF2m_simple_point_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *point,
381 if (EC_POINT_is_at_infinity(group, point))
387 if (BN_cmp(&point->Z, BN_value_one()))
394 if (!BN_copy(x, &point->X)) goto err;
399 if (!BN_copy(y, &point->Y)) goto err;
424 int ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *point,
482 if (!EC_POINT_set_affine_coordinates_GF2m(group, point, x, y, ctx)) goto err;
498 size_t ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, point_conversion_form_t form,
515 if (EC_POINT_is_at_infinity(group, point))
558 if (!EC_POINT_get_affine_coordinates_GF2m(group, point, x, y, ctx)) goto err;
630 int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
669 return EC_POINT_set_to_infinity(group, point);
703 if (!EC_POINT_set_compressed_coordinates_GF2m(group, point, x, y_bit, ctx)) goto err;
723 if (!EC_POINT_set_affine_coordinates_GF2m(group, point, x, y, ctx)) goto err;
726 if (!EC_POINT_is_on_curve(group, point, ctx)) /* test required by X9.62 */
853 int ec_GF2m_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx)
855 if (EC_POINT_is_at_infinity(group, point) || BN_is_zero(&point->Y))
856 /* point is its own inverse */
859 if (!EC_POINT_make_affine(group, point, ctx)) return 0;
860 return BN_GF2m_add(&point->Y, &point->X, &point->Y);
864 /* Indicates whether the given point is the point at infinity. */
865 int ec_GF2m_simple_is_at_infinity(const EC_GROUP *group, const EC_POINT *point)
867 return BN_is_zero(&point->Z);
871 /* Determines whether the given EC_POINT is an actual point on the curve defined
872 * in the EC_GROUP. A point is valid if it satisfies the Weierstrass equation:
875 int ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx)
883 if (EC_POINT_is_at_infinity(group, point))
890 if (!point->Z_is_one) goto err;
909 if (!BN_GF2m_add(lh, &point->X, &group->a)) goto err;
910 if (!field_mul(group, lh, lh, &point->X, ctx)) goto err;
911 if (!BN_GF2m_add(lh, lh, &point->Y)) goto err;
912 if (!field_mul(group, lh, lh, &point->X, ctx)) goto err;
914 if (!field_sqr(group, y2, &point->Y, ctx)) goto err;
975 int ec_GF2m_simple_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx)
981 if (point->Z_is_one || EC_POINT_is_at_infinity(group, point))
996 if (!EC_POINT_get_affine_coordinates_GF2m(group, point, x, y, ctx)) goto err;
997 if (!BN_copy(&point->X, x)) goto err;
998 if (!BN_copy(&point->Y, y)) goto err;
999 if (!BN_one(&point->Z)) goto err;