From 07caec83b81859ea9aa2d5075a394aa48c4e5fae Mon Sep 17 00:00:00 2001 From: Billy Brumley Date: Sun, 12 Apr 2020 18:17:19 +0300 Subject: [crypto/ec] deprecate Jprojective_coordinates_GFp functions Reviewed-by: Nicola Tuveri Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/11527) --- crypto/ec/ec2_smpl.c | 2 -- crypto/ec/ec_lib.c | 12 ++++++------ crypto/ec/ec_local.h | 8 -------- crypto/ec/ecp_mont.c | 2 -- crypto/ec/ecp_nist.c | 2 -- crypto/ec/ecp_nistp224.c | 9 +++------ crypto/ec/ecp_nistp256.c | 9 +++------ crypto/ec/ecp_nistp521.c | 9 +++------ crypto/ec/ecp_nistz256.c | 2 -- crypto/ec/ecp_s390x_nistp.c | 2 -- crypto/ec/ecp_smpl.c | 2 -- 11 files changed, 15 insertions(+), 44 deletions(-) (limited to 'crypto/ec') diff --git a/crypto/ec/ec2_smpl.c b/crypto/ec/ec2_smpl.c index 593f543e1a..ebb9878fb6 100644 --- a/crypto/ec/ec2_smpl.c +++ b/crypto/ec/ec2_smpl.c @@ -956,8 +956,6 @@ const EC_METHOD *EC_GF2m_simple_method(void) ec_GF2m_simple_point_clear_finish, ec_GF2m_simple_point_copy, ec_GF2m_simple_point_set_to_infinity, - 0, /* set_Jprojective_coordinates_GFp */ - 0, /* get_Jprojective_coordinates_GFp */ ec_GF2m_simple_point_set_affine_coordinates, ec_GF2m_simple_point_get_affine_coordinates, 0, /* point_set_compressed_coordinates */ diff --git a/crypto/ec/ec_lib.c b/crypto/ec/ec_lib.c index f90d833914..178fcfb0e2 100644 --- a/crypto/ec/ec_lib.c +++ b/crypto/ec/ec_lib.c @@ -796,12 +796,13 @@ int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point) return group->meth->point_set_to_infinity(group, point); } +#ifndef OPENSSL_NO_DEPRECATED_3_0 int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *point, const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx) { - if (group->meth->point_set_Jprojective_coordinates_GFp == 0) { + if (group->meth->field_type != NID_X9_62_prime_field) { ECerr(EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; @@ -811,8 +812,7 @@ int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_R_INCOMPATIBLE_OBJECTS); return 0; } - return group->meth->point_set_Jprojective_coordinates_GFp(group, point, x, - y, z, ctx); + return ec_GFp_simple_set_Jprojective_coordinates_GFp(group, point, x, y, z, ctx); } int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, @@ -820,7 +820,7 @@ int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, BIGNUM *y, BIGNUM *z, BN_CTX *ctx) { - if (group->meth->point_get_Jprojective_coordinates_GFp == 0) { + if (group->meth->field_type != NID_X9_62_prime_field) { ECerr(EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; @@ -830,9 +830,9 @@ int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_R_INCOMPATIBLE_OBJECTS); return 0; } - return group->meth->point_get_Jprojective_coordinates_GFp(group, point, x, - y, z, ctx); + return ec_GFp_simple_get_Jprojective_coordinates_GFp(group, point, x, y, z, ctx); } +#endif int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *point, const BIGNUM *x, const BIGNUM *y, diff --git a/crypto/ec/ec_local.h b/crypto/ec/ec_local.h index d10de2fc98..fac86e431b 100644 --- a/crypto/ec/ec_local.h +++ b/crypto/ec/ec_local.h @@ -76,14 +76,6 @@ struct ec_method_st { * EC_POINT_set_compressed_coordinates: */ int (*point_set_to_infinity) (const EC_GROUP *, EC_POINT *); - int (*point_set_Jprojective_coordinates_GFp) (const EC_GROUP *, - EC_POINT *, const BIGNUM *x, - const BIGNUM *y, - const BIGNUM *z, BN_CTX *); - int (*point_get_Jprojective_coordinates_GFp) (const EC_GROUP *, - const EC_POINT *, BIGNUM *x, - BIGNUM *y, BIGNUM *z, - BN_CTX *); int (*point_set_affine_coordinates) (const EC_GROUP *, EC_POINT *, const BIGNUM *x, const BIGNUM *y, BN_CTX *); diff --git a/crypto/ec/ecp_mont.c b/crypto/ec/ecp_mont.c index a81f79029c..07350d2ba9 100644 --- a/crypto/ec/ecp_mont.c +++ b/crypto/ec/ecp_mont.c @@ -37,8 +37,6 @@ const EC_METHOD *EC_GFp_mont_method(void) ec_GFp_simple_point_clear_finish, ec_GFp_simple_point_copy, ec_GFp_simple_point_set_to_infinity, - ec_GFp_simple_set_Jprojective_coordinates_GFp, - ec_GFp_simple_get_Jprojective_coordinates_GFp, ec_GFp_simple_point_set_affine_coordinates, ec_GFp_simple_point_get_affine_coordinates, 0, 0, 0, diff --git a/crypto/ec/ecp_nist.c b/crypto/ec/ecp_nist.c index e5aad5890e..5c710dd9c0 100644 --- a/crypto/ec/ecp_nist.c +++ b/crypto/ec/ecp_nist.c @@ -39,8 +39,6 @@ const EC_METHOD *EC_GFp_nist_method(void) ec_GFp_simple_point_clear_finish, ec_GFp_simple_point_copy, ec_GFp_simple_point_set_to_infinity, - ec_GFp_simple_set_Jprojective_coordinates_GFp, - ec_GFp_simple_get_Jprojective_coordinates_GFp, ec_GFp_simple_point_set_affine_coordinates, ec_GFp_simple_point_get_affine_coordinates, 0, 0, 0, diff --git a/crypto/ec/ecp_nistp224.c b/crypto/ec/ecp_nistp224.c index bf8e5db614..d1ea904f76 100644 --- a/crypto/ec/ecp_nistp224.c +++ b/crypto/ec/ecp_nistp224.c @@ -261,8 +261,6 @@ const EC_METHOD *EC_GFp_nistp224_method(void) ec_GFp_simple_point_clear_finish, ec_GFp_simple_point_copy, ec_GFp_simple_point_set_to_infinity, - ec_GFp_simple_set_Jprojective_coordinates_GFp, - ec_GFp_simple_get_Jprojective_coordinates_GFp, ec_GFp_simple_point_set_affine_coordinates, ec_GFp_nistp224_point_get_affine_coordinates, 0 /* point_set_compressed_coordinates */ , @@ -1465,9 +1463,8 @@ int ec_GFp_nistp224_points_mul(const EC_GROUP *group, EC_POINT *r, ECerr(EC_F_EC_GFP_NISTP224_POINTS_MUL, ERR_R_BN_LIB); goto err; } - if (!EC_POINT_set_Jprojective_coordinates_GFp(group, - generator, x, y, z, - ctx)) + if (!ec_GFp_simple_set_Jprojective_coordinates_GFp(group, generator, x, + y, z, ctx)) goto err; if (0 == EC_POINT_cmp(group, generator, group->generator, ctx)) /* precomputation matches generator */ @@ -1601,7 +1598,7 @@ int ec_GFp_nistp224_points_mul(const EC_GROUP *group, EC_POINT *r, ECerr(EC_F_EC_GFP_NISTP224_POINTS_MUL, ERR_R_BN_LIB); goto err; } - ret = EC_POINT_set_Jprojective_coordinates_GFp(group, r, x, y, z, ctx); + ret = ec_GFp_simple_set_Jprojective_coordinates_GFp(group, r, x, y, z, ctx); err: BN_CTX_end(ctx); diff --git a/crypto/ec/ecp_nistp256.c b/crypto/ec/ecp_nistp256.c index dd3c5d5878..12fc1d4f0e 100644 --- a/crypto/ec/ecp_nistp256.c +++ b/crypto/ec/ecp_nistp256.c @@ -1798,8 +1798,6 @@ const EC_METHOD *EC_GFp_nistp256_method(void) ec_GFp_simple_point_clear_finish, ec_GFp_simple_point_copy, ec_GFp_simple_point_set_to_infinity, - ec_GFp_simple_set_Jprojective_coordinates_GFp, - ec_GFp_simple_get_Jprojective_coordinates_GFp, ec_GFp_simple_point_set_affine_coordinates, ec_GFp_nistp256_point_get_affine_coordinates, 0 /* point_set_compressed_coordinates */ , @@ -2080,9 +2078,8 @@ int ec_GFp_nistp256_points_mul(const EC_GROUP *group, EC_POINT *r, ECerr(EC_F_EC_GFP_NISTP256_POINTS_MUL, ERR_R_BN_LIB); goto err; } - if (!EC_POINT_set_Jprojective_coordinates_GFp(group, - generator, x, y, z, - ctx)) + if (!ec_GFp_simple_set_Jprojective_coordinates_GFp(group, generator, x, + y, z, ctx)) goto err; if (0 == EC_POINT_cmp(group, generator, group->generator, ctx)) /* precomputation matches generator */ @@ -2222,7 +2219,7 @@ int ec_GFp_nistp256_points_mul(const EC_GROUP *group, EC_POINT *r, ECerr(EC_F_EC_GFP_NISTP256_POINTS_MUL, ERR_R_BN_LIB); goto err; } - ret = EC_POINT_set_Jprojective_coordinates_GFp(group, r, x, y, z, ctx); + ret = ec_GFp_simple_set_Jprojective_coordinates_GFp(group, r, x, y, z, ctx); err: BN_CTX_end(ctx); diff --git a/crypto/ec/ecp_nistp521.c b/crypto/ec/ecp_nistp521.c index 9d22da6572..22515e9c6c 100644 --- a/crypto/ec/ecp_nistp521.c +++ b/crypto/ec/ecp_nistp521.c @@ -1638,8 +1638,6 @@ const EC_METHOD *EC_GFp_nistp521_method(void) ec_GFp_simple_point_clear_finish, ec_GFp_simple_point_copy, ec_GFp_simple_point_set_to_infinity, - ec_GFp_simple_set_Jprojective_coordinates_GFp, - ec_GFp_simple_get_Jprojective_coordinates_GFp, ec_GFp_simple_point_set_affine_coordinates, ec_GFp_nistp521_point_get_affine_coordinates, 0 /* point_set_compressed_coordinates */ , @@ -1919,9 +1917,8 @@ int ec_GFp_nistp521_points_mul(const EC_GROUP *group, EC_POINT *r, ECerr(EC_F_EC_GFP_NISTP521_POINTS_MUL, ERR_R_BN_LIB); goto err; } - if (!EC_POINT_set_Jprojective_coordinates_GFp(group, - generator, x, y, z, - ctx)) + if (!ec_GFp_simple_set_Jprojective_coordinates_GFp(group, generator, x, + y, z, ctx)) goto err; if (0 == EC_POINT_cmp(group, generator, group->generator, ctx)) /* precomputation matches generator */ @@ -2059,7 +2056,7 @@ int ec_GFp_nistp521_points_mul(const EC_GROUP *group, EC_POINT *r, ECerr(EC_F_EC_GFP_NISTP521_POINTS_MUL, ERR_R_BN_LIB); goto err; } - ret = EC_POINT_set_Jprojective_coordinates_GFp(group, r, x, y, z, ctx); + ret = ec_GFp_simple_set_Jprojective_coordinates_GFp(group, r, x, y, z, ctx); err: BN_CTX_end(ctx); diff --git a/crypto/ec/ecp_nistz256.c b/crypto/ec/ecp_nistz256.c index d9709da4f4..48bf51fd32 100644 --- a/crypto/ec/ecp_nistz256.c +++ b/crypto/ec/ecp_nistz256.c @@ -1694,8 +1694,6 @@ const EC_METHOD *EC_GFp_nistz256_method(void) ec_GFp_simple_point_clear_finish, ec_GFp_simple_point_copy, ec_GFp_simple_point_set_to_infinity, - ec_GFp_simple_set_Jprojective_coordinates_GFp, - ec_GFp_simple_get_Jprojective_coordinates_GFp, ec_GFp_simple_point_set_affine_coordinates, ecp_nistz256_get_affine, 0, 0, 0, diff --git a/crypto/ec/ecp_s390x_nistp.c b/crypto/ec/ecp_s390x_nistp.c index 92b199d96a..75c1e079a1 100644 --- a/crypto/ec/ecp_s390x_nistp.c +++ b/crypto/ec/ecp_s390x_nistp.c @@ -332,8 +332,6 @@ const EC_METHOD *EC_GFp_s390x_nistp##bits##_method(void) \ ec_GFp_simple_point_clear_finish, \ ec_GFp_simple_point_copy, \ ec_GFp_simple_point_set_to_infinity, \ - ec_GFp_simple_set_Jprojective_coordinates_GFp, \ - ec_GFp_simple_get_Jprojective_coordinates_GFp, \ ec_GFp_simple_point_set_affine_coordinates, \ ec_GFp_simple_point_get_affine_coordinates, \ NULL, /* point_set_compressed_coordinates */ \ diff --git a/crypto/ec/ecp_smpl.c b/crypto/ec/ecp_smpl.c index 0c25816c72..ea8d89654c 100644 --- a/crypto/ec/ecp_smpl.c +++ b/crypto/ec/ecp_smpl.c @@ -38,8 +38,6 @@ const EC_METHOD *EC_GFp_simple_method(void) ec_GFp_simple_point_clear_finish, ec_GFp_simple_point_copy, ec_GFp_simple_point_set_to_infinity, - ec_GFp_simple_set_Jprojective_coordinates_GFp, - ec_GFp_simple_get_Jprojective_coordinates_GFp, ec_GFp_simple_point_set_affine_coordinates, ec_GFp_simple_point_get_affine_coordinates, 0, 0, 0, -- cgit v1.2.3