[openssl-commits] [openssl] master update
Matt Caswell
matt at openssl.org
Tue Jul 31 08:12:54 UTC 2018
The branch master has been updated
via 50db81633ece00593b245afed0ed9480d7ffb334 (commit)
via 9cc570d4c419e2ca97e2173dc14c484195502dd4 (commit)
via de34e45a64f0865264b826255adbe7aee7470780 (commit)
via 8e3cced75fb5fee5da59ebef9605d403a999391b (commit)
from 3d3cbce550ff5d6172cf28dbbf80bda93f6577a9 (commit)
- Log -----------------------------------------------------------------
commit 50db81633ece00593b245afed0ed9480d7ffb334
Author: Matt Caswell <matt at openssl.org>
Date: Mon Jul 30 16:56:41 2018 +0100
Deprecate the EC curve type specific functions in 1.2.0
Reviewed-by: Rich Salz <rsalz at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6815)
commit 9cc570d4c419e2ca97e2173dc14c484195502dd4
Author: Matt Caswell <matt at openssl.org>
Date: Mon Jul 30 16:40:18 2018 +0100
Use the new non-curve type specific EC functions internally
Fixes #6646
Reviewed-by: Rich Salz <rsalz at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6815)
commit de34e45a64f0865264b826255adbe7aee7470780
Author: Matt Caswell <matt at openssl.org>
Date: Mon Jul 30 16:06:12 2018 +0100
Add documentation for the new non-curve type specific EC functions
Reviewed-by: Rich Salz <rsalz at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6815)
commit 8e3cced75fb5fee5da59ebef9605d403a999391b
Author: Matt Caswell <matt at openssl.org>
Date: Mon Jul 30 15:39:41 2018 +0100
Provide EC functions that are not curve type specific
Some EC functions exist in *_GFp and *_GF2m forms, in spite of the
implementations between the two curve types being identical. This
commit provides equivalent generic functions with the *_GFp and *_GF2m
forms just calling the generic functions.
Reviewed-by: Rich Salz <rsalz at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6815)
-----------------------------------------------------------------------
Summary of changes:
apps/ecparam.c | 2 +-
crypto/ec/ec2_oct.c | 11 ++-
crypto/ec/ec2_smpl.c | 12 ++--
crypto/ec/ec_asn1.c | 22 ++----
crypto/ec/ec_curve.c | 2 +-
crypto/ec/ec_cvt.c | 4 +-
crypto/ec/ec_err.c | 8 +++
crypto/ec/ec_key.c | 29 ++------
crypto/ec/ec_lcl.h | 9 ++-
crypto/ec/ec_lib.c | 125 ++++++++++++++++------------------
crypto/ec/ec_oct.c | 46 +++++--------
crypto/ec/ecdh_ossl.c | 17 +----
crypto/ec/ecdsa_ossl.c | 39 +++--------
crypto/ec/eck_prn.c | 17 ++---
crypto/ec/ecp_nistp224.c | 2 +-
crypto/ec/ecp_nistp256.c | 2 +-
crypto/ec/ecp_nistp521.c | 2 +-
crypto/ec/ecp_oct.c | 11 ++-
crypto/ec/ecp_smpl.c | 4 +-
crypto/err/openssl.txt | 5 ++
crypto/sm2/sm2_crypt.c | 12 ++--
crypto/sm2/sm2_sign.c | 4 +-
crypto/sm2/sm2_za.c | 10 +--
doc/man3/EC_GROUP_new.pod | 48 ++++++++-----
doc/man3/EC_POINT_new.pod | 64 +++++++++++++-----
include/openssl/ec.h | 167 +++++++++++++++++++++++++++++++++++-----------
include/openssl/ecerr.h | 5 ++
test/ecstresstest.c | 11 ++-
test/ectest.c | 131 ++++++++++++++++--------------------
test/sm2_internal_test.c | 4 +-
util/libcrypto.num | 25 ++++---
31 files changed, 450 insertions(+), 400 deletions(-)
diff --git a/apps/ecparam.c b/apps/ecparam.c
index 2290242..917f1a8 100644
--- a/apps/ecparam.c
+++ b/apps/ecparam.c
@@ -299,7 +299,7 @@ int ecparam_main(int argc, char **argv)
goto end;
}
- if (!EC_GROUP_get_curve_GFp(group, ec_p, ec_a, ec_b, NULL))
+ if (!EC_GROUP_get_curve(group, ec_p, ec_a, ec_b, NULL))
goto end;
if ((point = EC_GROUP_get0_generator(group)) == NULL)
diff --git a/crypto/ec/ec2_oct.c b/crypto/ec/ec2_oct.c
index 24c32ae..d515dab 100644
--- a/crypto/ec/ec2_oct.c
+++ b/crypto/ec/ec2_oct.c
@@ -94,7 +94,7 @@ int ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group,
}
}
- if (!EC_POINT_set_affine_coordinates_GF2m(group, point, x, y, ctx))
+ if (!EC_POINT_set_affine_coordinates(group, point, x, y, ctx))
goto err;
ret = 1;
@@ -166,7 +166,7 @@ size_t ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point,
if (yxi == NULL)
goto err;
- if (!EC_POINT_get_affine_coordinates_GF2m(group, point, x, y, ctx))
+ if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx))
goto err;
buf[0] = form;
@@ -301,8 +301,7 @@ int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
}
if (form == POINT_CONVERSION_COMPRESSED) {
- if (!EC_POINT_set_compressed_coordinates_GF2m
- (group, point, x, y_bit, ctx))
+ if (!EC_POINT_set_compressed_coordinates(group, point, x, y_bit, ctx))
goto err;
} else {
if (!BN_bin2bn(buf + 1 + field_len, field_len, y))
@@ -321,10 +320,10 @@ int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
}
/*
- * EC_POINT_set_affine_coordinates_GF2m is responsible for checking that
+ * EC_POINT_set_affine_coordinates is responsible for checking that
* the point is on the curve.
*/
- if (!EC_POINT_set_affine_coordinates_GF2m(group, point, x, y, ctx))
+ if (!EC_POINT_set_affine_coordinates(group, point, x, y, ctx))
goto err;
}
diff --git a/crypto/ec/ec2_smpl.c b/crypto/ec/ec2_smpl.c
index 9ce332b..87f7ce5 100644
--- a/crypto/ec/ec2_smpl.c
+++ b/crypto/ec/ec2_smpl.c
@@ -390,7 +390,7 @@ int ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
if (!BN_copy(y0, a->Y))
goto err;
} else {
- if (!EC_POINT_get_affine_coordinates_GF2m(group, a, x0, y0, ctx))
+ if (!EC_POINT_get_affine_coordinates(group, a, x0, y0, ctx))
goto err;
}
if (b->Z_is_one) {
@@ -399,7 +399,7 @@ int ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
if (!BN_copy(y1, b->Y))
goto err;
} else {
- if (!EC_POINT_get_affine_coordinates_GF2m(group, b, x1, y1, ctx))
+ if (!EC_POINT_get_affine_coordinates(group, b, x1, y1, ctx))
goto err;
}
@@ -447,7 +447,7 @@ int ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
if (!BN_GF2m_add(y2, y2, y1))
goto err;
- if (!EC_POINT_set_affine_coordinates_GF2m(group, r, x2, y2, ctx))
+ if (!EC_POINT_set_affine_coordinates(group, r, x2, y2, ctx))
goto err;
ret = 1;
@@ -590,9 +590,9 @@ int ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a,
if (bY == NULL)
goto err;
- if (!EC_POINT_get_affine_coordinates_GF2m(group, a, aX, aY, ctx))
+ if (!EC_POINT_get_affine_coordinates(group, a, aX, aY, ctx))
goto err;
- if (!EC_POINT_get_affine_coordinates_GF2m(group, b, bX, bY, ctx))
+ if (!EC_POINT_get_affine_coordinates(group, b, bX, bY, ctx))
goto err;
ret = ((BN_cmp(aX, bX) == 0) && BN_cmp(aY, bY) == 0) ? 0 : 1;
@@ -625,7 +625,7 @@ int ec_GF2m_simple_make_affine(const EC_GROUP *group, EC_POINT *point,
if (y == NULL)
goto err;
- if (!EC_POINT_get_affine_coordinates_GF2m(group, point, x, y, ctx))
+ if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx))
goto err;
if (!BN_copy(point->X, x))
goto err;
diff --git a/crypto/ec/ec_asn1.c b/crypto/ec/ec_asn1.c
index cdc5d38..13c56a6 100644
--- a/crypto/ec/ec_asn1.c
+++ b/crypto/ec/ec_asn1.c
@@ -266,7 +266,7 @@ static int ec_asn1_group2fieldid(const EC_GROUP *group, X9_62_FIELDID *field)
goto err;
}
/* the parameters are specified by the prime number p */
- if (!EC_GROUP_get_curve_GFp(group, tmp, NULL, NULL, NULL)) {
+ if (!EC_GROUP_get_curve(group, tmp, NULL, NULL, NULL)) {
ECerr(EC_F_EC_ASN1_GROUP2FIELDID, ERR_R_EC_LIB);
goto err;
}
@@ -365,7 +365,7 @@ static int ec_asn1_group2fieldid(const EC_GROUP *group, X9_62_FIELDID *field)
static int ec_asn1_group2curve(const EC_GROUP *group, X9_62_CURVE *curve)
{
- int ok = 0, nid;
+ int ok = 0;
BIGNUM *tmp_1 = NULL, *tmp_2 = NULL;
unsigned char *a_buf = NULL, *b_buf = NULL;
size_t len;
@@ -378,24 +378,12 @@ static int ec_asn1_group2curve(const EC_GROUP *group, X9_62_CURVE *curve)
goto err;
}
- nid = EC_METHOD_get_field_type(EC_GROUP_method_of(group));
-
/* get a and b */
- if (nid == NID_X9_62_prime_field) {
- if (!EC_GROUP_get_curve_GFp(group, NULL, tmp_1, tmp_2, NULL)) {
- ECerr(EC_F_EC_ASN1_GROUP2CURVE, ERR_R_EC_LIB);
- goto err;
- }
+ if (!EC_GROUP_get_curve(group, NULL, tmp_1, tmp_2, NULL)) {
+ ECerr(EC_F_EC_ASN1_GROUP2CURVE, ERR_R_EC_LIB);
+ goto err;
}
-#ifndef OPENSSL_NO_EC2M
- else { /* nid == NID_X9_62_characteristic_two_field */
- if (!EC_GROUP_get_curve_GF2m(group, NULL, tmp_1, tmp_2, NULL)) {
- ECerr(EC_F_EC_ASN1_GROUP2CURVE, ERR_R_EC_LIB);
- goto err;
- }
- }
-#endif
/*
* Per SEC 1, the curve coefficients must be padded up to size. See C.2's
* definition of Curve, C.1's definition of FieldElement, and 2.3.5's
diff --git a/crypto/ec/ec_curve.c b/crypto/ec/ec_curve.c
index 618ec04..bb1ce19 100644
--- a/crypto/ec/ec_curve.c
+++ b/crypto/ec/ec_curve.c
@@ -3078,7 +3078,7 @@ static EC_GROUP *ec_group_new_from_data(const ec_list_element curve)
ECerr(EC_F_EC_GROUP_NEW_FROM_DATA, ERR_R_BN_LIB);
goto err;
}
- if (!EC_POINT_set_affine_coordinates_GFp(group, P, x, y, ctx)) {
+ if (!EC_POINT_set_affine_coordinates(group, P, x, y, ctx)) {
ECerr(EC_F_EC_GROUP_NEW_FROM_DATA, ERR_R_EC_LIB);
goto err;
}
diff --git a/crypto/ec/ec_cvt.c b/crypto/ec/ec_cvt.c
index 1321823..7f8bc1c 100644
--- a/crypto/ec/ec_cvt.c
+++ b/crypto/ec/ec_cvt.c
@@ -51,7 +51,7 @@ EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a,
if (ret == NULL)
return NULL;
- if (!EC_GROUP_set_curve_GFp(ret, p, a, b, ctx)) {
+ if (!EC_GROUP_set_curve(ret, p, a, b, ctx)) {
EC_GROUP_clear_free(ret);
return NULL;
}
@@ -72,7 +72,7 @@ EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a,
if (ret == NULL)
return NULL;
- if (!EC_GROUP_set_curve_GF2m(ret, p, a, b, ctx)) {
+ if (!EC_GROUP_set_curve(ret, p, a, b, ctx)) {
EC_GROUP_clear_free(ret);
return NULL;
}
diff --git a/crypto/ec/ec_err.c b/crypto/ec/ec_err.c
index cbe204f..8f4911a 100644
--- a/crypto/ec/ec_err.c
+++ b/crypto/ec/ec_err.c
@@ -146,6 +146,7 @@ static const ERR_STRING_DATA EC_str_functs[] = {
{ERR_PACK(ERR_LIB_EC, EC_F_EC_GROUP_CHECK_DISCRIMINANT, 0),
"EC_GROUP_check_discriminant"},
{ERR_PACK(ERR_LIB_EC, EC_F_EC_GROUP_COPY, 0), "EC_GROUP_copy"},
+ {ERR_PACK(ERR_LIB_EC, EC_F_EC_GROUP_GET_CURVE, 0), "EC_GROUP_get_curve"},
{ERR_PACK(ERR_LIB_EC, EC_F_EC_GROUP_GET_CURVE_GF2M, 0),
"EC_GROUP_get_curve_GF2m"},
{ERR_PACK(ERR_LIB_EC, EC_F_EC_GROUP_GET_CURVE_GFP, 0),
@@ -168,6 +169,7 @@ static const ERR_STRING_DATA EC_str_functs[] = {
"EC_GROUP_new_from_ecparameters"},
{ERR_PACK(ERR_LIB_EC, EC_F_EC_GROUP_NEW_FROM_ECPKPARAMETERS, 0),
"EC_GROUP_new_from_ecpkparameters"},
+ {ERR_PACK(ERR_LIB_EC, EC_F_EC_GROUP_SET_CURVE, 0), "EC_GROUP_set_curve"},
{ERR_PACK(ERR_LIB_EC, EC_F_EC_GROUP_SET_CURVE_GF2M, 0),
"EC_GROUP_set_curve_GF2m"},
{ERR_PACK(ERR_LIB_EC, EC_F_EC_GROUP_SET_CURVE_GFP, 0),
@@ -203,6 +205,8 @@ static const ERR_STRING_DATA EC_str_functs[] = {
{ERR_PACK(ERR_LIB_EC, EC_F_EC_POINT_CMP, 0), "EC_POINT_cmp"},
{ERR_PACK(ERR_LIB_EC, EC_F_EC_POINT_COPY, 0), "EC_POINT_copy"},
{ERR_PACK(ERR_LIB_EC, EC_F_EC_POINT_DBL, 0), "EC_POINT_dbl"},
+ {ERR_PACK(ERR_LIB_EC, EC_F_EC_POINT_GET_AFFINE_COORDINATES, 0),
+ "EC_POINT_get_affine_coordinates"},
{ERR_PACK(ERR_LIB_EC, EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M, 0),
"EC_POINT_get_affine_coordinates_GF2m"},
{ERR_PACK(ERR_LIB_EC, EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP, 0),
@@ -220,10 +224,14 @@ static const ERR_STRING_DATA EC_str_functs[] = {
{ERR_PACK(ERR_LIB_EC, EC_F_EC_POINT_OCT2POINT, 0), "EC_POINT_oct2point"},
{ERR_PACK(ERR_LIB_EC, EC_F_EC_POINT_POINT2BUF, 0), "EC_POINT_point2buf"},
{ERR_PACK(ERR_LIB_EC, EC_F_EC_POINT_POINT2OCT, 0), "EC_POINT_point2oct"},
+ {ERR_PACK(ERR_LIB_EC, EC_F_EC_POINT_SET_AFFINE_COORDINATES, 0),
+ "EC_POINT_set_affine_coordinates"},
{ERR_PACK(ERR_LIB_EC, EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M, 0),
"EC_POINT_set_affine_coordinates_GF2m"},
{ERR_PACK(ERR_LIB_EC, EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP, 0),
"EC_POINT_set_affine_coordinates_GFp"},
+ {ERR_PACK(ERR_LIB_EC, EC_F_EC_POINT_SET_COMPRESSED_COORDINATES, 0),
+ "EC_POINT_set_compressed_coordinates"},
{ERR_PACK(ERR_LIB_EC, EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M, 0),
"EC_POINT_set_compressed_coordinates_GF2m"},
{ERR_PACK(ERR_LIB_EC, EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP, 0),
diff --git a/crypto/ec/ec_key.c b/crypto/ec/ec_key.c
index c841236..ec10b7e 100644
--- a/crypto/ec/ec_key.c
+++ b/crypto/ec/ec_key.c
@@ -341,9 +341,6 @@ int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x,
BIGNUM *tx, *ty;
EC_POINT *point = NULL;
int ok = 0;
-#ifndef OPENSSL_NO_EC2M
- int tmp_nid, is_char_two = 0;
-#endif
if (key == NULL || key->group == NULL || x == NULL || y == NULL) {
ECerr(EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES,
@@ -365,29 +362,11 @@ int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x,
if (ty == NULL)
goto err;
-#ifndef OPENSSL_NO_EC2M
- tmp_nid = EC_METHOD_get_field_type(EC_GROUP_method_of(key->group));
-
- if (tmp_nid == NID_X9_62_characteristic_two_field)
- is_char_two = 1;
+ if (!EC_POINT_set_affine_coordinates(key->group, point, x, y, ctx))
+ goto err;
+ if (!EC_POINT_get_affine_coordinates(key->group, point, tx, ty, ctx))
+ goto err;
- if (is_char_two) {
- if (!EC_POINT_set_affine_coordinates_GF2m(key->group, point,
- x, y, ctx))
- goto err;
- if (!EC_POINT_get_affine_coordinates_GF2m(key->group, point,
- tx, ty, ctx))
- goto err;
- } else
-#endif
- {
- if (!EC_POINT_set_affine_coordinates_GFp(key->group, point,
- x, y, ctx))
- goto err;
- if (!EC_POINT_get_affine_coordinates_GFp(key->group, point,
- tx, ty, ctx))
- goto err;
- }
/*
* Check if retrieved coordinates match originals and are less than field
* order: if not values are out of range.
diff --git a/crypto/ec/ec_lcl.h b/crypto/ec/ec_lcl.h
index c706a84..e055dda 100644
--- a/crypto/ec/ec_lcl.h
+++ b/crypto/ec/ec_lcl.h
@@ -50,8 +50,7 @@ struct ec_method_st {
void (*group_finish) (EC_GROUP *);
void (*group_clear_finish) (EC_GROUP *);
int (*group_copy) (EC_GROUP *, const EC_GROUP *);
- /* used by EC_GROUP_set_curve_GFp, EC_GROUP_get_curve_GFp, */
- /* EC_GROUP_set_curve_GF2m, and EC_GROUP_get_curve_GF2m: */
+ /* used by EC_GROUP_set_curve, EC_GROUP_get_curve: */
int (*group_set_curve) (EC_GROUP *, const BIGNUM *p, const BIGNUM *a,
const BIGNUM *b, BN_CTX *);
int (*group_get_curve) (const EC_GROUP *, BIGNUM *p, BIGNUM *a, BIGNUM *b,
@@ -73,9 +72,9 @@ struct ec_method_st {
* used by EC_POINT_set_to_infinity,
* EC_POINT_set_Jprojective_coordinates_GFp,
* EC_POINT_get_Jprojective_coordinates_GFp,
- * EC_POINT_set_affine_coordinates_GFp, ..._GF2m,
- * EC_POINT_get_affine_coordinates_GFp, ..._GF2m,
- * EC_POINT_set_compressed_coordinates_GFp, ..._GF2m:
+ * EC_POINT_set_affine_coordinates,
+ * EC_POINT_get_affine_coordinates,
+ * EC_POINT_set_compressed_coordinates:
*/
int (*point_set_to_infinity) (const EC_GROUP *, EC_POINT *);
int (*point_set_Jprojective_coordinates_GFp) (const EC_GROUP *,
diff --git a/crypto/ec/ec_lib.c b/crypto/ec/ec_lib.c
index 457cd35..2204152 100644
--- a/crypto/ec/ec_lib.c
+++ b/crypto/ec/ec_lib.c
@@ -415,48 +415,52 @@ size_t EC_GROUP_get_seed_len(const EC_GROUP *group)
return group->seed_len;
}
-int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a,
- const BIGNUM *b, BN_CTX *ctx)
+int EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a,
+ const BIGNUM *b, BN_CTX *ctx)
{
if (group->meth->group_set_curve == 0) {
- ECerr(EC_F_EC_GROUP_SET_CURVE_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
+ ECerr(EC_F_EC_GROUP_SET_CURVE, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
return 0;
}
return group->meth->group_set_curve(group, p, a, b, ctx);
}
-int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a,
- BIGNUM *b, BN_CTX *ctx)
+int EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b,
+ BN_CTX *ctx)
{
- if (group->meth->group_get_curve == 0) {
- ECerr(EC_F_EC_GROUP_GET_CURVE_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
+ if (group->meth->group_get_curve == NULL) {
+ ECerr(EC_F_EC_GROUP_GET_CURVE, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
return 0;
}
return group->meth->group_get_curve(group, p, a, b, ctx);
}
-#ifndef OPENSSL_NO_EC2M
+#if OPENSSL_API_COMPAT < 0x10200000L
+int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a,
+ const BIGNUM *b, BN_CTX *ctx)
+{
+ return EC_GROUP_set_curve(group, p, a, b, ctx);
+}
+
+int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a,
+ BIGNUM *b, BN_CTX *ctx)
+{
+ return EC_GROUP_get_curve(group, p, a, b, ctx);
+}
+
+# ifndef OPENSSL_NO_EC2M
int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a,
const BIGNUM *b, BN_CTX *ctx)
{
- if (group->meth->group_set_curve == 0) {
- ECerr(EC_F_EC_GROUP_SET_CURVE_GF2M,
- ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
- return 0;
- }
- return group->meth->group_set_curve(group, p, a, b, ctx);
+ return EC_GROUP_set_curve(group, p, a, b, ctx);
}
int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a,
BIGNUM *b, BN_CTX *ctx)
{
- if (group->meth->group_get_curve == 0) {
- ECerr(EC_F_EC_GROUP_GET_CURVE_GF2M,
- ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
- return 0;
- }
- return group->meth->group_get_curve(group, p, a, b, ctx);
+ return EC_GROUP_get_curve(group, p, a, b, ctx);
}
+# endif
#endif
int EC_GROUP_get_degree(const EC_GROUP *group)
@@ -699,92 +703,79 @@ int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,
y, z, ctx);
}
-int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group,
- EC_POINT *point, const BIGNUM *x,
- const BIGNUM *y, BN_CTX *ctx)
+int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *point,
+ const BIGNUM *x, const BIGNUM *y,
+ BN_CTX *ctx)
{
- if (group->meth->point_set_affine_coordinates == 0) {
- ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP,
+ if (group->meth->point_set_affine_coordinates == NULL) {
+ ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES,
ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
return 0;
}
if (!ec_point_is_compat(point, group)) {
- ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP,
- EC_R_INCOMPATIBLE_OBJECTS);
+ ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES, EC_R_INCOMPATIBLE_OBJECTS);
return 0;
}
if (!group->meth->point_set_affine_coordinates(group, point, x, y, ctx))
return 0;
if (EC_POINT_is_on_curve(group, point, ctx) <= 0) {
- ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP,
- EC_R_POINT_IS_NOT_ON_CURVE);
+ ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES, EC_R_POINT_IS_NOT_ON_CURVE);
return 0;
}
return 1;
}
-#ifndef OPENSSL_NO_EC2M
+#if OPENSSL_API_COMPAT < 0x10200000L
+int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group,
+ EC_POINT *point, const BIGNUM *x,
+ const BIGNUM *y, BN_CTX *ctx)
+{
+ return EC_POINT_set_affine_coordinates(group, point, x, y, ctx);
+}
+
+# ifndef OPENSSL_NO_EC2M
int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group,
EC_POINT *point, const BIGNUM *x,
const BIGNUM *y, BN_CTX *ctx)
{
- if (group->meth->point_set_affine_coordinates == 0) {
- ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M,
+ return EC_POINT_set_affine_coordinates(group, point, x, y, ctx);
+}
+# endif
+#endif
+
+int EC_POINT_get_affine_coordinates(const EC_GROUP *group,
+ const EC_POINT *point, BIGNUM *x, BIGNUM *y,
+ BN_CTX *ctx)
+{
+ if (group->meth->point_get_affine_coordinates == NULL) {
+ ECerr(EC_F_EC_POINT_GET_AFFINE_COORDINATES,
ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
return 0;
}
if (!ec_point_is_compat(point, group)) {
- ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M,
- EC_R_INCOMPATIBLE_OBJECTS);
- return 0;
- }
- if (!group->meth->point_set_affine_coordinates(group, point, x, y, ctx))
- return 0;
-
- if (EC_POINT_is_on_curve(group, point, ctx) <= 0) {
- ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M,
- EC_R_POINT_IS_NOT_ON_CURVE);
+ ECerr(EC_F_EC_POINT_GET_AFFINE_COORDINATES, EC_R_INCOMPATIBLE_OBJECTS);
return 0;
}
- return 1;
+ return group->meth->point_get_affine_coordinates(group, point, x, y, ctx);
}
-#endif
+#if OPENSSL_API_COMPAT < 0x10200000L
int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,
const EC_POINT *point, BIGNUM *x,
BIGNUM *y, BN_CTX *ctx)
{
- if (group->meth->point_get_affine_coordinates == 0) {
- ECerr(EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP,
- ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
- return 0;
- }
- if (!ec_point_is_compat(point, group)) {
- ECerr(EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP,
- EC_R_INCOMPATIBLE_OBJECTS);
- return 0;
- }
- return group->meth->point_get_affine_coordinates(group, point, x, y, ctx);
+ return EC_POINT_get_affine_coordinates(group, point, x, y, ctx);
}
-#ifndef OPENSSL_NO_EC2M
+# ifndef OPENSSL_NO_EC2M
int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group,
const EC_POINT *point, BIGNUM *x,
BIGNUM *y, BN_CTX *ctx)
{
- if (group->meth->point_get_affine_coordinates == 0) {
- ECerr(EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M,
- ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
- return 0;
- }
- if (!ec_point_is_compat(point, group)) {
- ECerr(EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M,
- EC_R_INCOMPATIBLE_OBJECTS);
- return 0;
- }
- return group->meth->point_get_affine_coordinates(group, point, x, y, ctx);
+ return EC_POINT_get_affine_coordinates(group, point, x, y, ctx);
}
+# endif
#endif
int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
diff --git a/crypto/ec/ec_oct.c b/crypto/ec/ec_oct.c
index c87d495..522f79e 100644
--- a/crypto/ec/ec_oct.c
+++ b/crypto/ec/ec_oct.c
@@ -15,18 +15,17 @@
#include "ec_lcl.h"
-int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group,
- EC_POINT *point, const BIGNUM *x,
- int y_bit, BN_CTX *ctx)
+int EC_POINT_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *point,
+ const BIGNUM *x, int y_bit, BN_CTX *ctx)
{
- if (group->meth->point_set_compressed_coordinates == 0
+ if (group->meth->point_set_compressed_coordinates == NULL
&& !(group->meth->flags & EC_FLAGS_DEFAULT_OCT)) {
- ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP,
+ ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES,
ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
return 0;
}
if (!ec_point_is_compat(point, group)) {
- ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP,
+ ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES,
EC_R_INCOMPATIBLE_OBJECTS);
return 0;
}
@@ -37,7 +36,7 @@ int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group,
else
#ifdef OPENSSL_NO_EC2M
{
- ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP,
+ ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES,
EC_R_GF2M_NOT_SUPPORTED);
return 0;
}
@@ -50,33 +49,22 @@ int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group,
y_bit, ctx);
}
-#ifndef OPENSSL_NO_EC2M
+#if OPENSSL_API_COMPAT < 0x10200000L
+int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group,
+ EC_POINT *point, const BIGNUM *x,
+ int y_bit, BN_CTX *ctx)
+{
+ return EC_POINT_set_compressed_coordinates(group, point, x, y_bit, ctx);
+}
+
+# ifndef OPENSSL_NO_EC2M
int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group,
EC_POINT *point, const BIGNUM *x,
int y_bit, BN_CTX *ctx)
{
- if (group->meth->point_set_compressed_coordinates == 0
- && !(group->meth->flags & EC_FLAGS_DEFAULT_OCT)) {
- ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M,
- ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
- return 0;
- }
- if (!ec_point_is_compat(point, group)) {
- ECerr(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M,
- EC_R_INCOMPATIBLE_OBJECTS);
- return 0;
- }
- if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) {
- if (group->meth->field_type == NID_X9_62_prime_field)
- return ec_GFp_simple_set_compressed_coordinates(group, point, x,
- y_bit, ctx);
- else
- return ec_GF2m_simple_set_compressed_coordinates(group, point, x,
- y_bit, ctx);
- }
- return group->meth->point_set_compressed_coordinates(group, point, x,
- y_bit, ctx);
+ return EC_POINT_set_compressed_coordinates(group, point, x, y_bit, ctx);
}
+# endif
#endif
size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *point,
diff --git a/crypto/ec/ecdh_ossl.c b/crypto/ec/ecdh_ossl.c
index 1c5db22..bd93793 100644
--- a/crypto/ec/ecdh_ossl.c
+++ b/crypto/ec/ecdh_ossl.c
@@ -83,21 +83,10 @@ int ecdh_simple_compute_key(unsigned char **pout, size_t *poutlen,
goto err;
}
- if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) ==
- NID_X9_62_prime_field) {
- if (!EC_POINT_get_affine_coordinates_GFp(group, tmp, x, NULL, ctx)) {
- ECerr(EC_F_ECDH_SIMPLE_COMPUTE_KEY, EC_R_POINT_ARITHMETIC_FAILURE);
- goto err;
- }
- }
-#ifndef OPENSSL_NO_EC2M
- else {
- if (!EC_POINT_get_affine_coordinates_GF2m(group, tmp, x, NULL, ctx)) {
- ECerr(EC_F_ECDH_SIMPLE_COMPUTE_KEY, EC_R_POINT_ARITHMETIC_FAILURE);
- goto err;
- }
+ if (!EC_POINT_get_affine_coordinates(group, tmp, x, NULL, ctx)) {
+ ECerr(EC_F_ECDH_SIMPLE_COMPUTE_KEY, EC_R_POINT_ARITHMETIC_FAILURE);
+ goto err;
}
-#endif
buflen = (EC_GROUP_get_degree(group) + 7) / 8;
len = BN_num_bytes(x);
diff --git a/crypto/ec/ecdsa_ossl.c b/crypto/ec/ecdsa_ossl.c
index ad7a6f7..e35c760 100644
--- a/crypto/ec/ecdsa_ossl.c
+++ b/crypto/ec/ecdsa_ossl.c
@@ -104,23 +104,12 @@ static int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in,
ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_EC_LIB);
goto err;
}
- if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) ==
- NID_X9_62_prime_field) {
- if (!EC_POINT_get_affine_coordinates_GFp(group, tmp_point, X,
- NULL, ctx)) {
- ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_EC_LIB);
- goto err;
- }
- }
-#ifndef OPENSSL_NO_EC2M
- else { /* NID_X9_62_characteristic_two_field */
- if (!EC_POINT_get_affine_coordinates_GF2m(group, tmp_point, X,
- NULL, ctx)) {
- ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_EC_LIB);
- goto err;
- }
+
+ if (!EC_POINT_get_affine_coordinates(group, tmp_point, X, NULL, ctx)) {
+ ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_EC_LIB);
+ goto err;
}
-#endif
+
if (!BN_nnmod(r, X, order, ctx)) {
ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_BN_LIB);
goto err;
@@ -408,22 +397,12 @@ int ossl_ecdsa_verify_sig(const unsigned char *dgst, int dgst_len,
ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_EC_LIB);
goto err;
}
- if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) ==
- NID_X9_62_prime_field) {
- if (!EC_POINT_get_affine_coordinates_GFp(group, point, X, NULL, ctx)) {
- ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_EC_LIB);
- goto err;
- }
- }
-#ifndef OPENSSL_NO_EC2M
- else { /* NID_X9_62_characteristic_two_field */
- if (!EC_POINT_get_affine_coordinates_GF2m(group, point, X, NULL, ctx)) {
- ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_EC_LIB);
- goto err;
- }
+ if (!EC_POINT_get_affine_coordinates(group, point, X, NULL, ctx)) {
+ ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_EC_LIB);
+ goto err;
}
-#endif
+
if (!BN_nnmod(u1, X, order, ctx)) {
ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_BN_LIB);
goto err;
diff --git a/crypto/ec/eck_prn.c b/crypto/ec/eck_prn.c
index 2e501b2..cde3090 100644
--- a/crypto/ec/eck_prn.c
+++ b/crypto/ec/eck_prn.c
@@ -125,19 +125,10 @@ int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off)
reason = ERR_R_MALLOC_FAILURE;
goto err;
}
-#ifndef OPENSSL_NO_EC2M
- if (is_char_two) {
- if (!EC_GROUP_get_curve_GF2m(x, p, a, b, ctx)) {
- reason = ERR_R_EC_LIB;
- goto err;
- }
- } else /* prime field */
-#endif
- {
- if (!EC_GROUP_get_curve_GFp(x, p, a, b, ctx)) {
- reason = ERR_R_EC_LIB;
- goto err;
- }
+
+ if (!EC_GROUP_get_curve(x, p, a, b, ctx)) {
+ reason = ERR_R_EC_LIB;
+ goto err;
}
if ((point = EC_GROUP_get0_generator(x)) == NULL) {
diff --git a/crypto/ec/ecp_nistp224.c b/crypto/ec/ecp_nistp224.c
index ecae568..555bf30 100644
--- a/crypto/ec/ecp_nistp224.c
+++ b/crypto/ec/ecp_nistp224.c
@@ -1608,7 +1608,7 @@ int ec_GFp_nistp224_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
goto err;
BN_bin2bn(nistp224_curve_params[3], sizeof(felem_bytearray), x);
BN_bin2bn(nistp224_curve_params[4], sizeof(felem_bytearray), y);
- if (!EC_POINT_set_affine_coordinates_GFp(group, generator, x, y, ctx))
+ if (!EC_POINT_set_affine_coordinates(group, generator, x, y, ctx))
goto err;
if ((pre = nistp224_pre_comp_new()) == NULL)
goto err;
diff --git a/crypto/ec/ecp_nistp256.c b/crypto/ec/ecp_nistp256.c
index 22f172b..c87a5e5 100644
--- a/crypto/ec/ecp_nistp256.c
+++ b/crypto/ec/ecp_nistp256.c
@@ -2238,7 +2238,7 @@ int ec_GFp_nistp256_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
goto err;
BN_bin2bn(nistp256_curve_params[3], sizeof(felem_bytearray), x);
BN_bin2bn(nistp256_curve_params[4], sizeof(felem_bytearray), y);
- if (!EC_POINT_set_affine_coordinates_GFp(group, generator, x, y, ctx))
+ if (!EC_POINT_set_affine_coordinates(group, generator, x, y, ctx))
goto err;
if ((pre = nistp256_pre_comp_new()) == NULL)
goto err;
diff --git a/crypto/ec/ecp_nistp521.c b/crypto/ec/ecp_nistp521.c
index 06945b5..14f2fee 100644
--- a/crypto/ec/ecp_nistp521.c
+++ b/crypto/ec/ecp_nistp521.c
@@ -2071,7 +2071,7 @@ int ec_GFp_nistp521_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
goto err;
BN_bin2bn(nistp521_curve_params[3], sizeof(felem_bytearray), x);
BN_bin2bn(nistp521_curve_params[4], sizeof(felem_bytearray), y);
- if (!EC_POINT_set_affine_coordinates_GFp(group, generator, x, y, ctx))
+ if (!EC_POINT_set_affine_coordinates(group, generator, x, y, ctx))
goto err;
if ((pre = nistp521_pre_comp_new()) == NULL)
goto err;
diff --git a/crypto/ec/ecp_oct.c b/crypto/ec/ecp_oct.c
index a5010bc..2be3c86 100644
--- a/crypto/ec/ecp_oct.c
+++ b/crypto/ec/ecp_oct.c
@@ -140,7 +140,7 @@ int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group,
goto err;
}
- if (!EC_POINT_set_affine_coordinates_GFp(group, point, x, y, ctx))
+ if (!EC_POINT_set_affine_coordinates(group, point, x, y, ctx))
goto err;
ret = 1;
@@ -206,7 +206,7 @@ size_t ec_GFp_simple_point2oct(const EC_GROUP *group, const EC_POINT *point,
if (y == NULL)
goto err;
- if (!EC_POINT_get_affine_coordinates_GFp(group, point, x, y, ctx))
+ if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx))
goto err;
if ((form == POINT_CONVERSION_COMPRESSED
@@ -333,8 +333,7 @@ int ec_GFp_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
}
if (form == POINT_CONVERSION_COMPRESSED) {
- if (!EC_POINT_set_compressed_coordinates_GFp
- (group, point, x, y_bit, ctx))
+ if (!EC_POINT_set_compressed_coordinates(group, point, x, y_bit, ctx))
goto err;
} else {
if (!BN_bin2bn(buf + 1 + field_len, field_len, y))
@@ -351,10 +350,10 @@ int ec_GFp_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
}
/*
- * EC_POINT_set_affine_coordinates_GFp is responsible for checking that
+ * EC_POINT_set_affine_coordinates is responsible for checking that
* the point is on the curve.
*/
- if (!EC_POINT_set_affine_coordinates_GFp(group, point, x, y, ctx))
+ if (!EC_POINT_set_affine_coordinates(group, point, x, y, ctx))
goto err;
}
diff --git a/crypto/ec/ecp_smpl.c b/crypto/ec/ecp_smpl.c
index 18d16dd..7ac519c 100644
--- a/crypto/ec/ecp_smpl.c
+++ b/crypto/ec/ecp_smpl.c
@@ -1181,9 +1181,9 @@ int ec_GFp_simple_make_affine(const EC_GROUP *group, EC_POINT *point,
if (y == NULL)
goto err;
- if (!EC_POINT_get_affine_coordinates_GFp(group, point, x, y, ctx))
+ if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx))
goto err;
- if (!EC_POINT_set_affine_coordinates_GFp(group, point, x, y, ctx))
+ if (!EC_POINT_set_affine_coordinates(group, point, x, y, ctx))
goto err;
if (!point->Z_is_one) {
ECerr(EC_F_EC_GFP_SIMPLE_MAKE_AFFINE, ERR_R_INTERNAL_ERROR);
diff --git a/crypto/err/openssl.txt b/crypto/err/openssl.txt
index a0dc3c5..90b5c4e 100644
--- a/crypto/err/openssl.txt
+++ b/crypto/err/openssl.txt
@@ -570,6 +570,7 @@ EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES:169:\
EC_F_EC_GROUP_CHECK:170:EC_GROUP_check
EC_F_EC_GROUP_CHECK_DISCRIMINANT:171:EC_GROUP_check_discriminant
EC_F_EC_GROUP_COPY:106:EC_GROUP_copy
+EC_F_EC_GROUP_GET_CURVE:291:EC_GROUP_get_curve
EC_F_EC_GROUP_GET_CURVE_GF2M:172:EC_GROUP_get_curve_GF2m
EC_F_EC_GROUP_GET_CURVE_GFP:130:EC_GROUP_get_curve_GFp
EC_F_EC_GROUP_GET_DEGREE:173:EC_GROUP_get_degree
@@ -582,6 +583,7 @@ EC_F_EC_GROUP_NEW_BY_CURVE_NAME:174:EC_GROUP_new_by_curve_name
EC_F_EC_GROUP_NEW_FROM_DATA:175:ec_group_new_from_data
EC_F_EC_GROUP_NEW_FROM_ECPARAMETERS:263:EC_GROUP_new_from_ecparameters
EC_F_EC_GROUP_NEW_FROM_ECPKPARAMETERS:264:EC_GROUP_new_from_ecpkparameters
+EC_F_EC_GROUP_SET_CURVE:292:EC_GROUP_set_curve
EC_F_EC_GROUP_SET_CURVE_GF2M:176:EC_GROUP_set_curve_GF2m
EC_F_EC_GROUP_SET_CURVE_GFP:109:EC_GROUP_set_curve_GFp
EC_F_EC_GROUP_SET_GENERATOR:111:EC_GROUP_set_generator
@@ -610,6 +612,7 @@ EC_F_EC_POINT_BN2POINT:280:EC_POINT_bn2point
EC_F_EC_POINT_CMP:113:EC_POINT_cmp
EC_F_EC_POINT_COPY:114:EC_POINT_copy
EC_F_EC_POINT_DBL:115:EC_POINT_dbl
+EC_F_EC_POINT_GET_AFFINE_COORDINATES:293:EC_POINT_get_affine_coordinates
EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M:183:\
EC_POINT_get_affine_coordinates_GF2m
EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP:116:EC_POINT_get_affine_coordinates_GFp
@@ -623,9 +626,11 @@ EC_F_EC_POINT_NEW:121:EC_POINT_new
EC_F_EC_POINT_OCT2POINT:122:EC_POINT_oct2point
EC_F_EC_POINT_POINT2BUF:281:EC_POINT_point2buf
EC_F_EC_POINT_POINT2OCT:123:EC_POINT_point2oct
+EC_F_EC_POINT_SET_AFFINE_COORDINATES:294:EC_POINT_set_affine_coordinates
EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M:185:\
EC_POINT_set_affine_coordinates_GF2m
EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP:124:EC_POINT_set_affine_coordinates_GFp
+EC_F_EC_POINT_SET_COMPRESSED_COORDINATES:295:EC_POINT_set_compressed_coordinates
EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M:186:\
EC_POINT_set_compressed_coordinates_GF2m
EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP:125:\
diff --git a/crypto/sm2/sm2_crypt.c b/crypto/sm2/sm2_crypt.c
index d6f9c81..9e78873 100644
--- a/crypto/sm2/sm2_crypt.c
+++ b/crypto/sm2/sm2_crypt.c
@@ -48,7 +48,7 @@ static size_t ec_field_size(const EC_GROUP *group)
if (p == NULL || a == NULL || b == NULL)
goto done;
- if (!EC_GROUP_get_curve_GFp(group, p, a, b, NULL))
+ if (!EC_GROUP_get_curve(group, p, a, b, NULL))
goto done;
field_size = (BN_num_bits(p) + 7) / 8;
@@ -176,9 +176,9 @@ int sm2_encrypt(const EC_KEY *key,
}
if (!EC_POINT_mul(group, kG, k, NULL, NULL, ctx)
- || !EC_POINT_get_affine_coordinates_GFp(group, kG, x1, y1, ctx)
+ || !EC_POINT_get_affine_coordinates(group, kG, x1, y1, ctx)
|| !EC_POINT_mul(group, kP, NULL, P, k, ctx)
- || !EC_POINT_get_affine_coordinates_GFp(group, kP, x2, y2, ctx)) {
+ || !EC_POINT_get_affine_coordinates(group, kP, x2, y2, ctx)) {
SM2err(SM2_F_SM2_ENCRYPT, ERR_R_EC_LIB);
goto done;
}
@@ -326,11 +326,11 @@ int sm2_decrypt(const EC_KEY *key,
goto done;
}
- if (!EC_POINT_set_affine_coordinates_GFp(group, C1, sm2_ctext->C1x,
- sm2_ctext->C1y, ctx)
+ if (!EC_POINT_set_affine_coordinates(group, C1, sm2_ctext->C1x,
+ sm2_ctext->C1y, ctx)
|| !EC_POINT_mul(group, C1, NULL, C1, EC_KEY_get0_private_key(key),
ctx)
- || !EC_POINT_get_affine_coordinates_GFp(group, C1, x2, y2, ctx)) {
+ || !EC_POINT_get_affine_coordinates(group, C1, x2, y2, ctx)) {
SM2err(SM2_F_SM2_DECRYPT, ERR_R_EC_LIB);
goto done;
}
diff --git a/crypto/sm2/sm2_sign.c b/crypto/sm2/sm2_sign.c
index 1244c05..f1185c1 100644
--- a/crypto/sm2/sm2_sign.c
+++ b/crypto/sm2/sm2_sign.c
@@ -115,7 +115,7 @@ static ECDSA_SIG *sm2_sig_gen(const EC_KEY *key, const BIGNUM *e)
}
if (!EC_POINT_mul(group, kG, k, NULL, NULL, ctx)
- || !EC_POINT_get_affine_coordinates_GFp(group, kG, x1, NULL,
+ || !EC_POINT_get_affine_coordinates(group, kG, x1, NULL,
ctx)
|| !BN_mod_add(r, e, x1, order, ctx)) {
SM2err(SM2_F_SM2_SIG_GEN, ERR_R_INTERNAL_ERROR);
@@ -224,7 +224,7 @@ static int sm2_sig_verify(const EC_KEY *key, const ECDSA_SIG *sig,
}
if (!EC_POINT_mul(group, pt, s, EC_KEY_get0_public_key(key), t, ctx)
- || !EC_POINT_get_affine_coordinates_GFp(group, pt, x1, NULL, ctx)) {
+ || !EC_POINT_get_affine_coordinates(group, pt, x1, NULL, ctx)) {
SM2err(SM2_F_SM2_SIG_VERIFY, ERR_R_EC_LIB);
goto done;
}
diff --git a/crypto/sm2/sm2_za.c b/crypto/sm2/sm2_za.c
index 8f45082..320bee1 100644
--- a/crypto/sm2/sm2_za.c
+++ b/crypto/sm2/sm2_za.c
@@ -87,7 +87,7 @@ int sm2_compute_userid_digest(uint8_t *out,
goto done;
}
- if (!EC_GROUP_get_curve_GFp(group, p, a, b, ctx)) {
+ if (!EC_GROUP_get_curve(group, p, a, b, ctx)) {
SM2err(SM2_F_SM2_COMPUTE_USERID_DIGEST, ERR_R_EC_LIB);
goto done;
}
@@ -103,16 +103,16 @@ int sm2_compute_userid_digest(uint8_t *out,
|| !EVP_DigestUpdate(hash, buf, p_bytes)
|| BN_bn2binpad(b, buf, p_bytes) < 0
|| !EVP_DigestUpdate(hash, buf, p_bytes)
- || !EC_POINT_get_affine_coordinates_GFp(group,
+ || !EC_POINT_get_affine_coordinates(group,
EC_GROUP_get0_generator(group),
xG, yG, ctx)
|| BN_bn2binpad(xG, buf, p_bytes) < 0
|| !EVP_DigestUpdate(hash, buf, p_bytes)
|| BN_bn2binpad(yG, buf, p_bytes) < 0
|| !EVP_DigestUpdate(hash, buf, p_bytes)
- || !EC_POINT_get_affine_coordinates_GFp(group,
- EC_KEY_get0_public_key(key),
- xA, yA, ctx)
+ || !EC_POINT_get_affine_coordinates(group,
+ EC_KEY_get0_public_key(key),
+ xA, yA, ctx)
|| BN_bn2binpad(xA, buf, p_bytes) < 0
|| !EVP_DigestUpdate(hash, buf, p_bytes)
|| BN_bn2binpad(yA, buf, p_bytes) < 0
diff --git a/doc/man3/EC_GROUP_new.pod b/doc/man3/EC_GROUP_new.pod
index e36c3cb..2a722ce 100644
--- a/doc/man3/EC_GROUP_new.pod
+++ b/doc/man3/EC_GROUP_new.pod
@@ -2,12 +2,22 @@
=head1 NAME
-EC_GROUP_get_ecparameters, EC_GROUP_get_ecpkparameters,
-EC_GROUP_new, EC_GROUP_new_from_ecparameters,
+EC_GROUP_get_ecparameters,
+EC_GROUP_get_ecpkparameters,
+EC_GROUP_new,
+EC_GROUP_new_from_ecparameters,
EC_GROUP_new_from_ecpkparameters,
-EC_GROUP_free, EC_GROUP_clear_free, EC_GROUP_new_curve_GFp,
-EC_GROUP_new_curve_GF2m, EC_GROUP_new_by_curve_name, EC_GROUP_set_curve_GFp,
-EC_GROUP_get_curve_GFp, EC_GROUP_set_curve_GF2m, EC_GROUP_get_curve_GF2m,
+EC_GROUP_free,
+EC_GROUP_clear_free,
+EC_GROUP_new_curve_GFp,
+EC_GROUP_new_curve_GF2m,
+EC_GROUP_new_by_curve_name,
+EC_GROUP_set_curve,
+EC_GROUP_get_curve,
+EC_GROUP_set_curve_GFp,
+EC_GROUP_get_curve_GFp,
+EC_GROUP_set_curve_GF2m,
+EC_GROUP_get_curve_GF2m,
EC_get_builtin_curves - Functions for creating and destroying EC_GROUP
objects
@@ -27,6 +37,10 @@ objects
const BIGNUM *b, BN_CTX *ctx);
EC_GROUP *EC_GROUP_new_by_curve_name(int nid);
+ int EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a,
+ const BIGNUM *b, BN_CTX *ctx);
+ int EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b,
+ BN_CTX *ctx);
int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p,
const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p,
@@ -58,22 +72,26 @@ Operations in a binary field are performed relative to an B<irreducible polynomi
use a trinomial or a pentanomial for this parameter.
A new curve can be constructed by calling EC_GROUP_new, using the implementation provided by B<meth> (see
-L<EC_GFp_simple_method(3)>). It is then necessary to call either EC_GROUP_set_curve_GFp or
-EC_GROUP_set_curve_GF2m as appropriate to create a curve defined over Fp or over F2^m respectively.
+L<EC_GFp_simple_method(3)>). It is then necessary to call EC_GROUP_set_curve() to set the curve parameters.
EC_GROUP_new_from_ecparameters() will create a group from the
specified B<params> and
EC_GROUP_new_from_ecpkparameters() will create a group from the specific PK B<params>.
-EC_GROUP_set_curve_GFp sets the curve parameters B<p>, B<a> and B<b> for a curve over Fp stored in B<group>.
-EC_group_get_curve_GFp obtains the previously set curve parameters.
+EC_GROUP_set_curve() sets the curve parameters B<p>, B<a> and B<b>. For a curve over Fp B<b>
+is the prime for the field. For a curve over F2^m B<p> represents the irreducible polynomial - each bit
+represents a term in the polynomial. Therefore there will either be three or five bits set dependent on whether
+the polynomial is a trinomial or a pentanomial.
-EC_GROUP_set_curve_GF2m sets the equivalent curve parameters for a curve over F2^m. In this case B<p> represents
-the irreducible polynomial - each bit represents a term in the polynomial. Therefore there will either be three
-or five bits set dependent on whether the polynomial is a trinomial or a pentanomial.
-EC_group_get_curve_GF2m obtains the previously set curve parameters.
+EC_group_get_curve() obtains the previously set curve parameters.
-The functions EC_GROUP_new_curve_GFp and EC_GROUP_new_curve_GF2m are shortcuts for calling EC_GROUP_new and the
-appropriate EC_group_set_curve function. An appropriate default implementation method will be used.
+EC_GROUP_set_curve_GFp() and EC_GROUP_set_curve_GF2m() are synonyms for EC_GROUP_set_curve(). They are defined for
+backwards compatibility only and should not be used.
+
+EC_GROUP_get_curve_GFp() and EC_GROUP_get_curve_GF2m() are synonyms for EC_GROUP_get_curve(). They are defined for
+backwards compatibility only and should not be used.
+
+The functions EC_GROUP_new_curve_GFp and EC_GROUP_new_curve_GF2m are shortcuts for calling EC_GROUP_new and then the
+EC_GROUP_set_curve function. An appropriate default implementation method will be used.
Whilst the library can be used to create any curve using the functions described above, there are also a number of
predefined curves that are available. In order to obtain a list of all of the predefined curves, call the function
diff --git a/doc/man3/EC_POINT_new.pod b/doc/man3/EC_POINT_new.pod
index 2d86777..796f666 100644
--- a/doc/man3/EC_POINT_new.pod
+++ b/doc/man3/EC_POINT_new.pod
@@ -2,16 +2,30 @@
=head1 NAME
-EC_POINT_set_Jprojective_coordinates_GFp, EC_POINT_point2buf,
-EC_POINT_new, EC_POINT_free, EC_POINT_clear_free,
-EC_POINT_copy, EC_POINT_dup, EC_POINT_method_of,
+EC_POINT_set_Jprojective_coordinates_GFp,
+EC_POINT_point2buf,
+EC_POINT_new,
+EC_POINT_free,
+EC_POINT_clear_free,
+EC_POINT_copy,
+EC_POINT_dup,
+EC_POINT_method_of,
EC_POINT_set_to_infinity,
EC_POINT_get_Jprojective_coordinates_GFp,
+EC_POINT_set_affine_coordinates,
+EC_POINT_get_affine_coordinates,
+EC_POINT_set_compressed_coordinates,
EC_POINT_set_affine_coordinates_GFp,
-EC_POINT_get_affine_coordinates_GFp, EC_POINT_set_compressed_coordinates_GFp,
-EC_POINT_set_affine_coordinates_GF2m, EC_POINT_get_affine_coordinates_GF2m,
-EC_POINT_set_compressed_coordinates_GF2m, EC_POINT_point2oct,
-EC_POINT_oct2point, EC_POINT_point2bn, EC_POINT_bn2point, EC_POINT_point2hex,
+EC_POINT_get_affine_coordinates_GFp,
+EC_POINT_set_compressed_coordinates_GFp,
+EC_POINT_set_affine_coordinates_GF2m,
+EC_POINT_get_affine_coordinates_GF2m,
+EC_POINT_set_compressed_coordinates_GF2m,
+EC_POINT_point2oct,
+EC_POINT_oct2point,
+EC_POINT_point2bn,
+EC_POINT_bn2point,
+EC_POINT_point2hex,
EC_POINT_hex2point
- Functions for creating, destroying and manipulating EC_POINT objects
@@ -34,6 +48,14 @@ EC_POINT_hex2point
const EC_POINT *p,
BIGNUM *x, BIGNUM *y, BIGNUM *z,
BN_CTX *ctx);
+ int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *p,
+ const BIGNUM *x, const BIGNUM *y,
+ BN_CTX *ctx);
+ int EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *p,
+ BIGNUM *x, BIGNUM *y, BN_CTX *ctx);
+ int EC_POINT_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *p,
+ const BIGNUM *x, int y_bit,
+ BN_CTX *ctx);
int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
const BIGNUM *x, const BIGNUM *y,
BN_CTX *ctx);
@@ -97,12 +119,20 @@ A valid point on a curve is the special point at infinity. A point is set to
be at infinity by calling EC_POINT_set_to_infinity().
The affine co-ordinates for a point describe a point in terms of its x and y
-position. The functions EC_POINT_set_affine_coordinates_GFp() and
-EC_POINT_set_affine_coordinates_GF2m() set the B<x> and B<y> co-ordinates for
-the point B<p> defined over the curve given in B<group>. The functions
-EC_POINT_get_affine_coordinates_GFp() and
-EC_POINT_get_affine_coordinates_GF2m() set B<x> and B<y>, either of which may
-be NULL, to the corresponding coordinates of B<p>.
+position. The function EC_POINT_set_affine_coordinates() sets the B<x> and B<y>
+co-ordinates for the point B<p> defined over the curve given in B<group>. The
+function EC_POINT_get_affine_coordinates() sets B<x> and B<y>, either of which
+may be NULL, to the corresponding coordinates of B<p>.
+
+The functions EC_POINT_set_affine_coordinates_GFp() and
+EC_POINT_set_affine_coordinates_GF2m() are synonyms for
+EC_POINT_set_affine_coordinates(). They are defined for backwards compatibility
+only and should not be used.
+
+The functions EC_POINT_get_affine_coordinates_GFp() and
+EC_POINT_get_affine_coordinates_GF2m() are synonyms for
+EC_POINT_get_affine_coordinates(). They are defined for backwards compatibility
+only and should not be used.
As well as the affine co-ordinates, a point can alternatively be described in
terms of its Jacobian projective co-ordinates (for Fp curves only). Jacobian
@@ -119,11 +149,15 @@ EC_POINT_get_Jprojective_coordinates_GFp() respectively.
Points can also be described in terms of their compressed co-ordinates. For a
point (x, y), for any given value for x such that the point is on the curve
there will only ever be two possible values for y. Therefore a point can be set
-using the EC_POINT_set_compressed_coordinates_GFp() and
-EC_POINT_set_compressed_coordinates_GF2m() functions where B<x> is the x
+using the EC_POINT_set_compressed_coordinates() function where B<x> is the x
co-ordinate and B<y_bit> is a value 0 or 1 to identify which of the two
possible values for y should be used.
+The functions EC_POINT_set_compressed_coordinates_GFp() and
+EC_POINT_set_compressed_coordinates_GF2m() are synonyms for
+EC_POINT_set_compressed_coordinates(). They are defined for backwards
+compatibility only and should not be used.
+
In addition B<EC_POINT> can be converted to and from various external
representations. The octet form is the binary encoding of the B<ECPoint>
structure (as defined in RFC5480 and used in certificates and TLS records):
diff --git a/include/openssl/ec.h b/include/openssl/ec.h
index ed2161d..9cbb8b8 100644
--- a/include/openssl/ec.h
+++ b/include/openssl/ec.h
@@ -223,50 +223,84 @@ unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x);
size_t EC_GROUP_get_seed_len(const EC_GROUP *);
size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len);
-/** Sets the parameter of a ec over GFp defined by y^2 = x^3 + a*x + b
+/** Sets the parameters of a ec curve defined by y^2 = x^3 + a*x + b (for GFp)
+ * or y^2 + x*y = x^3 + a*x^2 + b (for GF2m)
* \param group EC_GROUP object
- * \param p BIGNUM with the prime number
+ * \param p BIGNUM with the prime number (GFp) or the polynomial
+ * defining the underlying field (GF2m)
* \param a BIGNUM with parameter a of the equation
* \param b BIGNUM with parameter b of the equation
* \param ctx BN_CTX object (optional)
* \return 1 on success and 0 if an error occurred
*/
-int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a,
- const BIGNUM *b, BN_CTX *ctx);
+int EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a,
+ const BIGNUM *b, BN_CTX *ctx);
-/** Gets the parameter of the ec over GFp defined by y^2 = x^3 + a*x + b
+/** Gets the parameters of the ec curve defined by y^2 = x^3 + a*x + b (for GFp)
+ * or y^2 + x*y = x^3 + a*x^2 + b (for GF2m)
* \param group EC_GROUP object
- * \param p BIGNUM for the prime number
+ * \param p BIGNUM with the prime number (GFp) or the polynomial
+ * defining the underlying field (GF2m)
* \param a BIGNUM for parameter a of the equation
* \param b BIGNUM for parameter b of the equation
* \param ctx BN_CTX object (optional)
* \return 1 on success and 0 if an error occurred
*/
-int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a,
- BIGNUM *b, BN_CTX *ctx);
+int EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b,
+ BN_CTX *ctx);
+
+/** Sets the parameters of an ec curve. Synonym for EC_GROUP_set_curve
+ * \param group EC_GROUP object
+ * \param p BIGNUM with the prime number (GFp) or the polynomial
+ * defining the underlying field (GF2m)
+ * \param a BIGNUM with parameter a of the equation
+ * \param b BIGNUM with parameter b of the equation
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occurred
+ */
+DEPRECATEDIN_1_2_0(int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p,
+ const BIGNUM *a, const BIGNUM *b,
+ BN_CTX *ctx))
+
+/** Gets the parameters of an ec curve. Synonym for EC_GROUP_get_curve
+ * \param group EC_GROUP object
+ * \param p BIGNUM with the prime number (GFp) or the polynomial
+ * defining the underlying field (GF2m)
+ * \param a BIGNUM for parameter a of the equation
+ * \param b BIGNUM for parameter b of the equation
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occurred
+ */
+DEPRECATEDIN_1_2_0(int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p,
+ BIGNUM *a, BIGNUM *b,
+ BN_CTX *ctx))
# ifndef OPENSSL_NO_EC2M
-/** Sets the parameter of a ec over GF2m defined by y^2 + x*y = x^3 + a*x^2 + b
+/** Sets the parameter of an ec curve. Synonym for EC_GROUP_set_curve
* \param group EC_GROUP object
- * \param p BIGNUM with the polynomial defining the underlying field
+ * \param p BIGNUM with the prime number (GFp) or the polynomial
+ * defining the underlying field (GF2m)
* \param a BIGNUM with parameter a of the equation
* \param b BIGNUM with parameter b of the equation
* \param ctx BN_CTX object (optional)
* \return 1 on success and 0 if an error occurred
*/
-int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a,
- const BIGNUM *b, BN_CTX *ctx);
+DEPRECATEDIN_1_2_0(int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p,
+ const BIGNUM *a, const BIGNUM *b,
+ BN_CTX *ctx))
-/** Gets the parameter of the ec over GF2m defined by y^2 + x*y = x^3 + a*x^2 + b
+/** Gets the parameters of an ec curve. Synonym for EC_GROUP_get_curve
* \param group EC_GROUP object
- * \param p BIGNUM for the polynomial defining the underlying field
+ * \param p BIGNUM with the prime number (GFp) or the polynomial
+ * defining the underlying field (GF2m)
* \param a BIGNUM for parameter a of the equation
* \param b BIGNUM for parameter b of the equation
* \param ctx BN_CTX object (optional)
* \return 1 on success and 0 if an error occurred
*/
-int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a,
- BIGNUM *b, BN_CTX *ctx);
+DEPRECATEDIN_1_2_0(int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p,
+ BIGNUM *a, BIGNUM *b,
+ BN_CTX *ctx))
# endif
/** Returns the number of bits needed to represent a field element
* \param group EC_GROUP object
@@ -459,7 +493,7 @@ int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,
BIGNUM *y, BIGNUM *z,
BN_CTX *ctx);
-/** Sets the affine coordinates of a EC_POINT over GFp
+/** Sets the affine coordinates of an EC_POINT
* \param group underlying EC_GROUP object
* \param p EC_POINT object
* \param x BIGNUM with the x-coordinate
@@ -467,11 +501,11 @@ int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,
* \param ctx BN_CTX object (optional)
* \return 1 on success and 0 if an error occurred
*/
-int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
- const BIGNUM *x, const BIGNUM *y,
- BN_CTX *ctx);
+int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *p,
+ const BIGNUM *x, const BIGNUM *y,
+ BN_CTX *ctx);
-/** Gets the affine coordinates of a EC_POINT over GFp
+/** Gets the affine coordinates of an EC_POINT.
* \param group underlying EC_GROUP object
* \param p EC_POINT object
* \param x BIGNUM for the x-coordinate
@@ -479,11 +513,40 @@ int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
* \param ctx BN_CTX object (optional)
* \return 1 on success and 0 if an error occurred
*/
-int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,
- const EC_POINT *p, BIGNUM *x,
- BIGNUM *y, BN_CTX *ctx);
+int EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *p,
+ BIGNUM *x, BIGNUM *y, BN_CTX *ctx);
-/** Sets the x9.62 compressed coordinates of a EC_POINT over GFp
+/** Sets the affine coordinates of an EC_POINT. A synonym of
+ * EC_POINT_set_affine_coordinates
+ * \param group underlying EC_GROUP object
+ * \param p EC_POINT object
+ * \param x BIGNUM with the x-coordinate
+ * \param y BIGNUM with the y-coordinate
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occurred
+ */
+DEPRECATEDIN_1_2_0(int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group,
+ EC_POINT *p,
+ const BIGNUM *x,
+ const BIGNUM *y,
+ BN_CTX *ctx))
+
+/** Gets the affine coordinates of an EC_POINT. A synonym of
+ * EC_POINT_get_affine_coordinates
+ * \param group underlying EC_GROUP object
+ * \param p EC_POINT object
+ * \param x BIGNUM for the x-coordinate
+ * \param y BIGNUM for the y-coordinate
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occurred
+ */
+DEPRECATEDIN_1_2_0(int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,
+ const EC_POINT *p,
+ BIGNUM *x,
+ BIGNUM *y,
+ BN_CTX *ctx))
+
+/** Sets the x9.62 compressed coordinates of a EC_POINT
* \param group underlying EC_GROUP object
* \param p EC_POINT object
* \param x BIGNUM with x-coordinate
@@ -491,11 +554,27 @@ int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,
* \param ctx BN_CTX object (optional)
* \return 1 on success and 0 if an error occurred
*/
-int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group,
- EC_POINT *p, const BIGNUM *x,
- int y_bit, BN_CTX *ctx);
+int EC_POINT_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *p,
+ const BIGNUM *x, int y_bit,
+ BN_CTX *ctx);
+
+/** Sets the x9.62 compressed coordinates of a EC_POINT. A synonym of
+ * EC_POINT_set_compressed_coordinates
+ * \param group underlying EC_GROUP object
+ * \param p EC_POINT object
+ * \param x BIGNUM with x-coordinate
+ * \param y_bit integer with the y-Bit (either 0 or 1)
+ * \param ctx BN_CTX object (optional)
+ * \return 1 on success and 0 if an error occurred
+ */
+DEPRECATEDIN_1_2_0(int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group,
+ EC_POINT *p,
+ const BIGNUM *x,
+ int y_bit,
+ BN_CTX *ctx))
# ifndef OPENSSL_NO_EC2M
-/** Sets the affine coordinates of a EC_POINT over GF2m
+/** Sets the affine coordinates of an EC_POINT. A synonym of
+ * EC_POINT_set_affine_coordinates
* \param group underlying EC_GROUP object
* \param p EC_POINT object
* \param x BIGNUM with the x-coordinate
@@ -503,11 +582,14 @@ int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group,
* \param ctx BN_CTX object (optional)
* \return 1 on success and 0 if an error occurred
*/
-int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p,
- const BIGNUM *x, const BIGNUM *y,
- BN_CTX *ctx);
+DEPRECATEDIN_1_2_0(int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group,
+ EC_POINT *p,
+ const BIGNUM *x,
+ const BIGNUM *y,
+ BN_CTX *ctx))
-/** Gets the affine coordinates of a EC_POINT over GF2m
+/** Gets the affine coordinates of an EC_POINT. A synonym of
+ * EC_POINT_get_affine_coordinates
* \param group underlying EC_GROUP object
* \param p EC_POINT object
* \param x BIGNUM for the x-coordinate
@@ -515,11 +597,14 @@ int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p,
* \param ctx BN_CTX object (optional)
* \return 1 on success and 0 if an error occurred
*/
-int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group,
- const EC_POINT *p, BIGNUM *x,
- BIGNUM *y, BN_CTX *ctx);
+DEPRECATEDIN_1_2_0(int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group,
+ const EC_POINT *p,
+ BIGNUM *x,
+ BIGNUM *y,
+ BN_CTX *ctx))
-/** Sets the x9.62 compressed coordinates of a EC_POINT over GF2m
+/** Sets the x9.62 compressed coordinates of a EC_POINT. A synonym of
+ * EC_POINT_set_compressed_coordinates
* \param group underlying EC_GROUP object
* \param p EC_POINT object
* \param x BIGNUM with x-coordinate
@@ -527,9 +612,11 @@ int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group,
* \param ctx BN_CTX object (optional)
* \return 1 on success and 0 if an error occurred
*/
-int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group,
- EC_POINT *p, const BIGNUM *x,
- int y_bit, BN_CTX *ctx);
+DEPRECATEDIN_1_2_0(int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group,
+ EC_POINT *p,
+ const BIGNUM *x,
+ int y_bit,
+ BN_CTX *ctx))
# endif
/** Encodes a EC_POINT object to a octet string
* \param group underlying EC_GROUP object
diff --git a/include/openssl/ecerr.h b/include/openssl/ecerr.h
index 967d6e0..8d42938 100644
--- a/include/openssl/ecerr.h
+++ b/include/openssl/ecerr.h
@@ -103,6 +103,7 @@ int ERR_load_EC_strings(void);
# define EC_F_EC_GROUP_CHECK 170
# define EC_F_EC_GROUP_CHECK_DISCRIMINANT 171
# define EC_F_EC_GROUP_COPY 106
+# define EC_F_EC_GROUP_GET_CURVE 291
# define EC_F_EC_GROUP_GET_CURVE_GF2M 172
# define EC_F_EC_GROUP_GET_CURVE_GFP 130
# define EC_F_EC_GROUP_GET_DEGREE 173
@@ -115,6 +116,7 @@ int ERR_load_EC_strings(void);
# define EC_F_EC_GROUP_NEW_FROM_DATA 175
# define EC_F_EC_GROUP_NEW_FROM_ECPARAMETERS 263
# define EC_F_EC_GROUP_NEW_FROM_ECPKPARAMETERS 264
+# define EC_F_EC_GROUP_SET_CURVE 292
# define EC_F_EC_GROUP_SET_CURVE_GF2M 176
# define EC_F_EC_GROUP_SET_CURVE_GFP 109
# define EC_F_EC_GROUP_SET_GENERATOR 111
@@ -142,6 +144,7 @@ int ERR_load_EC_strings(void);
# define EC_F_EC_POINT_CMP 113
# define EC_F_EC_POINT_COPY 114
# define EC_F_EC_POINT_DBL 115
+# define EC_F_EC_POINT_GET_AFFINE_COORDINATES 293
# define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M 183
# define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP 116
# define EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP 117
@@ -153,8 +156,10 @@ int ERR_load_EC_strings(void);
# define EC_F_EC_POINT_OCT2POINT 122
# define EC_F_EC_POINT_POINT2BUF 281
# define EC_F_EC_POINT_POINT2OCT 123
+# define EC_F_EC_POINT_SET_AFFINE_COORDINATES 294
# define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M 185
# define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP 124
+# define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES 295
# define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M 186
# define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP 125
# define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP 126
diff --git a/test/ecstresstest.c b/test/ecstresstest.c
index 3c6d2d5..fce64e6 100644
--- a/test/ecstresstest.c
+++ b/test/ecstresstest.c
@@ -45,16 +45,15 @@ static BIGNUM *walk_curve(const EC_GROUP *group, EC_POINT *point, int64_t num)
int64_t i;
if (!TEST_ptr(scalar = BN_new())
- || !TEST_true(EC_POINT_get_affine_coordinates_GFp(group, point,
- scalar,
- NULL, NULL)))
+ || !TEST_true(EC_POINT_get_affine_coordinates(group, point, scalar,
+ NULL, NULL)))
goto err;
for (i = 0; i < num; i++) {
if (!TEST_true(EC_POINT_mul(group, point, NULL, point, scalar, NULL))
- || !TEST_true(EC_POINT_get_affine_coordinates_GFp(group, point,
- scalar,
- NULL, NULL)))
+ || !TEST_true(EC_POINT_get_affine_coordinates(group, point,
+ scalar,
+ NULL, NULL)))
goto err;
}
return scalar;
diff --git a/test/ectest.c b/test/ectest.c
index 2945cd7..2703cb4 100644
--- a/test/ectest.c
+++ b/test/ectest.c
@@ -169,7 +169,7 @@ static int prime_field_tests(void)
* that the library gets to choose the EC_METHOD
*/
|| !TEST_ptr(group = EC_GROUP_new(EC_GFp_mont_method()))
- || !TEST_true(EC_GROUP_set_curve_GFp(group, p, a, b, ctx))
+ || !TEST_true(EC_GROUP_set_curve(group, p, a, b, ctx))
|| !TEST_ptr(tmp = EC_GROUP_new(EC_GROUP_method_of(group)))
|| !TEST_true(EC_GROUP_copy(tmp, group)))
goto err;
@@ -177,7 +177,7 @@ static int prime_field_tests(void)
group = tmp;
tmp = NULL;
- if (!TEST_true(EC_GROUP_get_curve_GFp(group, p, a, b, ctx)))
+ if (!TEST_true(EC_GROUP_get_curve(group, p, a, b, ctx)))
goto err;
TEST_info("Curve defined by Weierstrass equation");
@@ -200,13 +200,11 @@ static int prime_field_tests(void)
|| !TEST_ptr(z = BN_new())
|| !TEST_ptr(yplusone = BN_new())
|| !TEST_true(BN_hex2bn(&x, "D"))
- || !TEST_true(EC_POINT_set_compressed_coordinates_GFp(group, Q, x, 1,
- ctx)))
+ || !TEST_true(EC_POINT_set_compressed_coordinates(group, Q, x, 1, ctx)))
goto err;
if (!TEST_int_gt(EC_POINT_is_on_curve(group, Q, ctx), 0)) {
- if (!TEST_true(EC_POINT_get_affine_coordinates_GFp(group, Q, x, y,
- ctx)))
+ if (!TEST_true(EC_POINT_get_affine_coordinates(group, Q, x, y, ctx)))
goto err;
TEST_info("Point is not on curve");
test_output_bignum("x", x);
@@ -223,8 +221,8 @@ static int prime_field_tests(void)
if (EC_POINT_is_at_infinity(group, P)) {
TEST_note(" point at infinity");
} else {
- if (!TEST_true(EC_POINT_get_affine_coordinates_GFp(group, P, x, y,
- ctx)))
+ if (!TEST_true(EC_POINT_get_affine_coordinates(group, P, x, y,
+ ctx)))
goto err;
test_output_bignum("x", x);
@@ -293,7 +291,7 @@ static int prime_field_tests(void)
"FFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC"))
|| !TEST_true(BN_hex2bn(&b, "1C97BEFC"
"54BD7A8B65ACF89F81D4D4ADC565FA45"))
- || !TEST_true(EC_GROUP_set_curve_GFp(group, p, a, b, ctx))
+ || !TEST_true(EC_GROUP_set_curve(group, p, a, b, ctx))
|| !TEST_true(BN_hex2bn(&x, "4A96B568"
"8EF573284664698968C38BB913CBFC82"))
|| !TEST_true(BN_hex2bn(&y, "23a62855"
@@ -303,14 +301,14 @@ static int prime_field_tests(void)
* When (x, y) is on the curve, (x, y + 1) is, as it happens, not,
* and therefore setting the coordinates should fail.
*/
- || !TEST_false(EC_POINT_set_affine_coordinates_GFp(group, P, x,
- yplusone, ctx))
- || !TEST_true(EC_POINT_set_affine_coordinates_GFp(group, P, x, y, ctx))
+ || !TEST_false(EC_POINT_set_affine_coordinates(group, P, x, yplusone,
+ ctx))
+ || !TEST_true(EC_POINT_set_affine_coordinates(group, P, x, y, ctx))
|| !TEST_int_gt(EC_POINT_is_on_curve(group, P, ctx), 0)
|| !TEST_true(BN_hex2bn(&z, "0100000000"
"000000000001F4C8F927AED3CA752257"))
|| !TEST_true(EC_GROUP_set_generator(group, P, z, BN_value_one()))
- || !TEST_true(EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)))
+ || !TEST_true(EC_POINT_get_affine_coordinates(group, P, x, y, ctx)))
goto err;
TEST_info("SEC2 curve secp160r1 -- Generator");
test_output_bignum("x", x);
@@ -333,16 +331,15 @@ static int prime_field_tests(void)
"FFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC"))
|| !TEST_true(BN_hex2bn(&b, "64210519E59C80E7"
"0FA7E9AB72243049FEB8DEECC146B9B1"))
- || !TEST_true(EC_GROUP_set_curve_GFp(group, p, a, b, ctx))
+ || !TEST_true(EC_GROUP_set_curve(group, p, a, b, ctx))
|| !TEST_true(BN_hex2bn(&x, "188DA80EB03090F6"
"7CBF20EB43A18800F4FF0AFD82FF1012"))
- || !TEST_true(EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1,
- ctx))
+ || !TEST_true(EC_POINT_set_compressed_coordinates(group, P, x, 1, ctx))
|| !TEST_int_gt(EC_POINT_is_on_curve(group, P, ctx), 0)
|| !TEST_true(BN_hex2bn(&z, "FFFFFFFFFFFFFFFF"
"FFFFFFFF99DEF836146BC9B1B4D22831"))
|| !TEST_true(EC_GROUP_set_generator(group, P, z, BN_value_one()))
- || !TEST_true(EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)))
+ || !TEST_true(EC_POINT_get_affine_coordinates(group, P, x, y, ctx)))
goto err;
TEST_info("NIST curve P-192 -- Generator");
@@ -357,8 +354,8 @@ static int prime_field_tests(void)
* When (x, y) is on the curve, (x, y + 1) is, as it happens, not,
* and therefore setting the coordinates should fail.
*/
- || !TEST_false(EC_POINT_set_affine_coordinates_GFp(group, P, x,
- yplusone, ctx))
+ || !TEST_false(EC_POINT_set_affine_coordinates(group, P, x, yplusone,
+ ctx))
|| !TEST_int_eq(EC_GROUP_get_degree(group), 192)
|| !group_order_tests(group)
|| !TEST_ptr(P_192 = EC_GROUP_new(EC_GROUP_method_of(group)))
@@ -373,16 +370,15 @@ static int prime_field_tests(void)
"FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE"))
|| !TEST_true(BN_hex2bn(&b, "B4050A850C04B3ABF5413256"
"5044B0B7D7BFD8BA270B39432355FFB4"))
- || !TEST_true(EC_GROUP_set_curve_GFp(group, p, a, b, ctx))
+ || !TEST_true(EC_GROUP_set_curve(group, p, a, b, ctx))
|| !TEST_true(BN_hex2bn(&x, "B70E0CBD6BB4BF7F321390B9"
"4A03C1D356C21122343280D6115C1D21"))
- || !TEST_true(EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0,
- ctx))
+ || !TEST_true(EC_POINT_set_compressed_coordinates(group, P, x, 0, ctx))
|| !TEST_int_gt(EC_POINT_is_on_curve(group, P, ctx), 0)
|| !TEST_true(BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFF"
"FFFF16A2E0B8F03E13DD29455C5C2A3D"))
|| !TEST_true(EC_GROUP_set_generator(group, P, z, BN_value_one()))
- || !TEST_true(EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)))
+ || !TEST_true(EC_POINT_get_affine_coordinates(group, P, x, y, ctx)))
goto err;
TEST_info("NIST curve P-224 -- Generator");
@@ -397,8 +393,8 @@ static int prime_field_tests(void)
* When (x, y) is on the curve, (x, y + 1) is, as it happens, not,
* and therefore setting the coordinates should fail.
*/
- || !TEST_false(EC_POINT_set_affine_coordinates_GFp(group, P, x,
- yplusone, ctx))
+ || !TEST_false(EC_POINT_set_affine_coordinates(group, P, x, yplusone,
+ ctx))
|| !TEST_int_eq(EC_GROUP_get_degree(group), 224)
|| !group_order_tests(group)
|| !TEST_ptr(P_224 = EC_GROUP_new(EC_GROUP_method_of(group)))
@@ -413,17 +409,16 @@ static int prime_field_tests(void)
"00000000FFFFFFFFFFFFFFFFFFFFFFFC"))
|| !TEST_true(BN_hex2bn(&b, "5AC635D8AA3A93E7B3EBBD55769886BC"
"651D06B0CC53B0F63BCE3C3E27D2604B"))
- || !TEST_true(EC_GROUP_set_curve_GFp(group, p, a, b, ctx))
+ || !TEST_true(EC_GROUP_set_curve(group, p, a, b, ctx))
|| !TEST_true(BN_hex2bn(&x, "6B17D1F2E12C4247F8BCE6E563A440F2"
"77037D812DEB33A0F4A13945D898C296"))
- || !TEST_true(EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1,
- ctx))
+ || !TEST_true(EC_POINT_set_compressed_coordinates(group, P, x, 1, ctx))
|| !TEST_int_gt(EC_POINT_is_on_curve(group, P, ctx), 0)
|| !TEST_true(BN_hex2bn(&z, "FFFFFFFF00000000FFFFFFFFFFFFFFFF"
"BCE6FAADA7179E84F3B9CAC2FC632551"))
|| !TEST_true(EC_GROUP_set_generator(group, P, z, BN_value_one()))
- || !TEST_true(EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)))
+ || !TEST_true(EC_POINT_get_affine_coordinates(group, P, x, y, ctx)))
goto err;
TEST_info("NIST curve P-256 -- Generator");
@@ -438,8 +433,8 @@ static int prime_field_tests(void)
* When (x, y) is on the curve, (x, y + 1) is, as it happens, not,
* and therefore setting the coordinates should fail.
*/
- || !TEST_false(EC_POINT_set_affine_coordinates_GFp(group, P, x,
- yplusone, ctx))
+ || !TEST_false(EC_POINT_set_affine_coordinates(group, P, x, yplusone,
+ ctx))
|| !TEST_int_eq(EC_GROUP_get_degree(group), 256)
|| !group_order_tests(group)
|| !TEST_ptr(P_256 = EC_GROUP_new(EC_GROUP_method_of(group)))
@@ -457,19 +452,18 @@ static int prime_field_tests(void)
|| !TEST_true(BN_hex2bn(&b, "B3312FA7E23EE7E4988E056BE3F82D19"
"181D9C6EFE8141120314088F5013875A"
"C656398D8A2ED19D2A85C8EDD3EC2AEF"))
- || !TEST_true(EC_GROUP_set_curve_GFp(group, p, a, b, ctx))
+ || !TEST_true(EC_GROUP_set_curve(group, p, a, b, ctx))
|| !TEST_true(BN_hex2bn(&x, "AA87CA22BE8B05378EB1C71EF320AD74"
"6E1D3B628BA79B9859F741E082542A38"
"5502F25DBF55296C3A545E3872760AB7"))
- || !TEST_true(EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1,
- ctx))
+ || !TEST_true(EC_POINT_set_compressed_coordinates(group, P, x, 1, ctx))
|| !TEST_int_gt(EC_POINT_is_on_curve(group, P, ctx), 0)
|| !TEST_true(BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
"FFFFFFFFFFFFFFFFC7634D81F4372DDF"
"581A0DB248B0A77AECEC196ACCC52973"))
|| !TEST_true(EC_GROUP_set_generator(group, P, z, BN_value_one()))
- || !TEST_true(EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)))
+ || !TEST_true(EC_POINT_get_affine_coordinates(group, P, x, y, ctx)))
goto err;
TEST_info("NIST curve P-384 -- Generator");
@@ -485,8 +479,8 @@ static int prime_field_tests(void)
* When (x, y) is on the curve, (x, y + 1) is, as it happens, not,
* and therefore setting the coordinates should fail.
*/
- || !TEST_false(EC_POINT_set_affine_coordinates_GFp(group, P, x,
- yplusone, ctx))
+ || !TEST_false(EC_POINT_set_affine_coordinates(group, P, x, yplusone,
+ ctx))
|| !TEST_int_eq(EC_GROUP_get_degree(group), 384)
|| !group_order_tests(group)
|| !TEST_ptr(P_384 = EC_GROUP_new(EC_GROUP_method_of(group)))
@@ -509,14 +503,13 @@ static int prime_field_tests(void)
"A2DA725B99B315F3B8B489918EF109E1"
"56193951EC7E937B1652C0BD3BB1BF07"
"3573DF883D2C34F1EF451FD46B503F00"))
- || !TEST_true(EC_GROUP_set_curve_GFp(group, p, a, b, ctx))
+ || !TEST_true(EC_GROUP_set_curve(group, p, a, b, ctx))
|| !TEST_true(BN_hex2bn(&x, "C6"
"858E06B70404E9CD9E3ECB662395B442"
"9C648139053FB521F828AF606B4D3DBA"
"A14B5E77EFE75928FE1DC127A2FFA8DE"
"3348B3C1856A429BF97E7E31C2E5BD66"))
- || !TEST_true(EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0,
- ctx))
+ || !TEST_true(EC_POINT_set_compressed_coordinates(group, P, x, 0, ctx))
|| !TEST_int_gt(EC_POINT_is_on_curve(group, P, ctx), 0)
|| !TEST_true(BN_hex2bn(&z, "1FF"
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
@@ -524,7 +517,7 @@ static int prime_field_tests(void)
"51868783BF2F966B7FCC0148F709A5D0"
"3BB5C9B8899C47AEBB6FB71E91386409"))
|| !TEST_true(EC_GROUP_set_generator(group, P, z, BN_value_one()))
- || !TEST_true(EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)))
+ || !TEST_true(EC_POINT_get_affine_coordinates(group, P, x, y, ctx)))
goto err;
TEST_info("NIST curve P-521 -- Generator");
@@ -542,8 +535,8 @@ static int prime_field_tests(void)
* When (x, y) is on the curve, (x, y + 1) is, as it happens, not,
* and therefore setting the coordinates should fail.
*/
- || !TEST_false(EC_POINT_set_affine_coordinates_GFp(group, P, x,
- yplusone, ctx))
+ || !TEST_false(EC_POINT_set_affine_coordinates(group, P, x, yplusone,
+ ctx))
|| !TEST_int_eq(EC_GROUP_get_degree(group), 521)
|| !group_order_tests(group)
|| !TEST_ptr(P_521 = EC_GROUP_new(EC_GROUP_method_of(group)))
@@ -552,7 +545,7 @@ static int prime_field_tests(void)
/* more tests using the last curve */
/* Restore the point that got mangled in the (x, y + 1) test. */
- || !TEST_true(EC_POINT_set_affine_coordinates_GFp(group, P, x, y, ctx))
+ || !TEST_true(EC_POINT_set_affine_coordinates(group, P, x, y, ctx))
|| !TEST_true(EC_POINT_copy(Q, P))
|| !TEST_false(EC_POINT_is_at_infinity(group, Q))
|| !TEST_true(EC_POINT_dbl(group, P, P, ctx))
@@ -834,7 +827,7 @@ static int char2_curve_test(int n)
|| !TEST_true(BN_hex2bn(&a, test->a))
|| !TEST_true(BN_hex2bn(&b, test->b))
|| !TEST_true(group = EC_GROUP_new(EC_GF2m_simple_method()))
- || !TEST_true(EC_GROUP_set_curve_GF2m(group, p, a, b, ctx))
+ || !TEST_true(EC_GROUP_set_curve(group, p, a, b, ctx))
|| !TEST_ptr(P = EC_POINT_new(group))
|| !TEST_ptr(Q = EC_POINT_new(group))
|| !TEST_ptr(R = EC_POINT_new(group))
@@ -849,17 +842,15 @@ static int char2_curve_test(int n)
* When (x, y) is on the curve, (x, y + 1) is, as it happens, not,
* and therefore setting the coordinates should fail.
*/
- if (!TEST_false(EC_POINT_set_affine_coordinates_GF2m(group, P, x, yplusone,
- ctx))
- || !TEST_true(EC_POINT_set_compressed_coordinates_GF2m(group, P, x,
- test->y_bit,
- ctx))
+ if (!TEST_false(EC_POINT_set_affine_coordinates(group, P, x, yplusone, ctx))
+ || !TEST_true(EC_POINT_set_compressed_coordinates(group, P, x,
+ test->y_bit,
+ ctx))
|| !TEST_int_gt(EC_POINT_is_on_curve(group, P, ctx), 0)
|| !TEST_true(BN_hex2bn(&z, test->order))
|| !TEST_true(BN_hex2bn(&cof, test->cof))
|| !TEST_true(EC_GROUP_set_generator(group, P, z, cof))
- || !TEST_true(EC_POINT_get_affine_coordinates_GF2m(group, P, x, y,
- ctx)))
+ || !TEST_true(EC_POINT_get_affine_coordinates(group, P, x, y, ctx)))
goto err;
TEST_info("%s -- Generator", test->name);
test_output_bignum("x", x);
@@ -873,9 +864,8 @@ static int char2_curve_test(int n)
* When (x, y) is on the curve, (x, y + 1) is, as it happens, not,
* and therefore setting the coordinates should fail.
*/
- if (!TEST_false(EC_POINT_set_affine_coordinates_GF2m(group, P, x, yplusone,
- ctx))
- || !TEST_true(EC_POINT_set_affine_coordinates_GF2m(group, P, x, y, ctx))
+ if (!TEST_false(EC_POINT_set_affine_coordinates(group, P, x, yplusone, ctx))
+ || !TEST_true(EC_POINT_set_affine_coordinates(group, P, x, y, ctx))
|| !TEST_int_gt(EC_POINT_is_on_curve(group, P, ctx), 0)
|| !TEST_true(BN_hex2bn(&z, test->order))
|| !TEST_true(BN_hex2bn(&cof, test->cof))
@@ -894,8 +884,7 @@ static int char2_curve_test(int n)
/* more tests using the last curve */
if (n == OSSL_NELEM(char2_curve_tests) - 1) {
- if (!TEST_true(EC_POINT_set_affine_coordinates_GF2m(group, P, x, y,
- ctx))
+ if (!TEST_true(EC_POINT_set_affine_coordinates(group, P, x, y, ctx))
|| !TEST_true(EC_POINT_copy(Q, P))
|| !TEST_false(EC_POINT_is_at_infinity(group, Q))
|| !TEST_true(EC_POINT_dbl(group, P, P, ctx))
@@ -995,7 +984,7 @@ static int char2_field_tests(void)
* so that the library gets
* to choose the EC_METHOD */
if (!TEST_ptr(group)
- || !TEST_true(EC_GROUP_set_curve_GF2m(group, p, a, b, ctx))
+ || !TEST_true(EC_GROUP_set_curve(group, p, a, b, ctx))
|| !TEST_ptr(tmp = EC_GROUP_new(EC_GROUP_method_of(group)))
|| !TEST_true(EC_GROUP_copy(tmp, group)))
goto err;
@@ -1003,7 +992,7 @@ static int char2_field_tests(void)
group = tmp;
tmp = NULL;
- if (!TEST_true(EC_GROUP_get_curve_GF2m(group, p, a, b, ctx)))
+ if (!TEST_true(EC_GROUP_get_curve(group, p, a, b, ctx)))
goto err;
TEST_info("Curve defined by Weierstrass equation");
@@ -1031,19 +1020,17 @@ static int char2_field_tests(void)
|| !TEST_true(BN_hex2bn(&x, "6"))
/* Change test based on whether binary point compression is enabled or not. */
# ifdef OPENSSL_EC_BIN_PT_COMP
- || !TEST_true(EC_POINT_set_compressed_coordinates_GF2m(group, Q, x, 1,
- ctx))
+ || !TEST_true(EC_POINT_set_compressed_coordinates(group, Q, x, 1, ctx))
# else
|| !TEST_true(BN_hex2bn(&y, "8"))
- || !TEST_true(EC_POINT_set_affine_coordinates_GF2m(group, Q, x, y, ctx))
+ || !TEST_true(EC_POINT_set_affine_coordinates(group, Q, x, y, ctx))
# endif
)
goto err;
if (!TEST_int_gt(EC_POINT_is_on_curve(group, Q, ctx), 0)) {
/* Change test based on whether binary point compression is enabled or not. */
# ifdef OPENSSL_EC_BIN_PT_COMP
- if (!TEST_true(EC_POINT_get_affine_coordinates_GF2m(group, Q, x, y,
- ctx)))
+ if (!TEST_true(EC_POINT_get_affine_coordinates(group, Q, x, y, ctx)))
goto err;
# endif
TEST_info("Point is not on curve");
@@ -1061,8 +1048,8 @@ static int char2_field_tests(void)
if (EC_POINT_is_at_infinity(group, P))
TEST_note(" point at infinity");
else {
- if (!TEST_true(EC_POINT_get_affine_coordinates_GF2m(group, P, x, y,
- ctx)))
+ if (!TEST_true(EC_POINT_get_affine_coordinates(group, P, x, y,
+ ctx)))
goto err;
test_output_bignum("x", x);
@@ -1306,7 +1293,7 @@ static int nistp_single_test(int idx)
|| !TEST_int_eq(1, BN_is_prime_ex(p, BN_prime_checks, ctx, NULL))
|| !TEST_true(BN_hex2bn(&a, test->a))
|| !TEST_true(BN_hex2bn(&b, test->b))
- || !TEST_true(EC_GROUP_set_curve_GFp(NISTP, p, a, b, ctx))
+ || !TEST_true(EC_GROUP_set_curve(NISTP, p, a, b, ctx))
|| !TEST_ptr(G = EC_POINT_new(NISTP))
|| !TEST_ptr(P = EC_POINT_new(NISTP))
|| !TEST_ptr(Q = EC_POINT_new(NISTP))
@@ -1318,13 +1305,13 @@ static int nistp_single_test(int idx)
* When (x, y) is on the curve, (x, y + 1) is, as it happens, not,
* and therefore setting the coordinates should fail.
*/
- || !TEST_false(EC_POINT_set_affine_coordinates_GFp(NISTP, Q_CHECK, x,
- yplusone, ctx))
- || !TEST_true(EC_POINT_set_affine_coordinates_GFp(NISTP, Q_CHECK, x, y,
- ctx))
+ || !TEST_false(EC_POINT_set_affine_coordinates(NISTP, Q_CHECK, x,
+ yplusone, ctx))
+ || !TEST_true(EC_POINT_set_affine_coordinates(NISTP, Q_CHECK, x, y,
+ ctx))
|| !TEST_true(BN_hex2bn(&x, test->Gx))
|| !TEST_true(BN_hex2bn(&y, test->Gy))
- || !TEST_true(EC_POINT_set_affine_coordinates_GFp(NISTP, G, x, y, ctx))
+ || !TEST_true(EC_POINT_set_affine_coordinates(NISTP, G, x, y, ctx))
|| !TEST_true(BN_hex2bn(&order, test->order))
|| !TEST_true(EC_GROUP_set_generator(NISTP, G, order, BN_value_one()))
|| !TEST_int_eq(EC_GROUP_get_degree(NISTP), test->degree))
diff --git a/test/sm2_internal_test.c b/test/sm2_internal_test.c
index ea8ac7d..0d145e8 100644
--- a/test/sm2_internal_test.c
+++ b/test/sm2_internal_test.c
@@ -107,8 +107,8 @@ static EC_GROUP *create_EC_group(const char *p_hex, const char *a_hex,
if (!TEST_true(BN_hex2bn(&g_x, x_hex))
|| !TEST_true(BN_hex2bn(&g_y, y_hex))
- || !TEST_true(EC_POINT_set_affine_coordinates_GFp(group, generator,
- g_x, g_y, NULL)))
+ || !TEST_true(EC_POINT_set_affine_coordinates(group, generator, g_x,
+ g_y, NULL)))
goto done;
if (!TEST_true(BN_hex2bn(&order, order_hex))
diff --git a/util/libcrypto.num b/util/libcrypto.num
index f193729..ed8a8f0 100644
--- a/util/libcrypto.num
+++ b/util/libcrypto.num
@@ -261,7 +261,7 @@ ASN1_NULL_free 262 1_1_0 EXIST::FUNCTION:
EC_KEY_copy 263 1_1_0 EXIST::FUNCTION:EC
EVP_des_ede3 264 1_1_0 EXIST::FUNCTION:DES
PKCS7_add1_attrib_digest 265 1_1_0 EXIST::FUNCTION:
-EC_POINT_get_affine_coordinates_GFp 266 1_1_0 EXIST::FUNCTION:EC
+EC_POINT_get_affine_coordinates_GFp 266 1_1_0 EXIST::FUNCTION:DEPRECATEDIN_1_2_0,EC
EVP_seed_ecb 267 1_1_0 EXIST::FUNCTION:SEED
BIO_dgram_sctp_wait_for_dry 268 1_1_0 EXIST::FUNCTION:DGRAM,SCTP
ASN1_OCTET_STRING_NDEF_it 269 1_1_0 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
@@ -544,7 +544,7 @@ CONF_get_number 544 1_1_0 EXIST::FUNCTION:
X509_EXTENSION_get_object 545 1_1_0 EXIST::FUNCTION:
X509_EXTENSIONS_it 546 1_1_0 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
X509_EXTENSIONS_it 546 1_1_0 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
-EC_POINT_set_compressed_coordinates_GF2m 547 1_1_0 EXIST::FUNCTION:EC,EC2M
+EC_POINT_set_compressed_coordinates_GF2m 547 1_1_0 EXIST::FUNCTION:DEPRECATEDIN_1_2_0,EC,EC2M
RSA_sign_ASN1_OCTET_STRING 548 1_1_0 EXIST::FUNCTION:RSA
d2i_X509_CRL_fp 549 1_1_0 EXIST::FUNCTION:STDIO
i2d_RSA_PUBKEY 550 1_1_0 EXIST::FUNCTION:RSA
@@ -638,7 +638,7 @@ X509_REVOKED_it 638 1_1_0 EXIST:!EXPORT_VAR_AS_FUNCTION:
X509_REVOKED_it 638 1_1_0 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
CRYPTO_THREAD_write_lock 639 1_1_0 EXIST::FUNCTION:
X509V3_NAME_from_section 640 1_1_0 EXIST::FUNCTION:
-EC_POINT_set_compressed_coordinates_GFp 641 1_1_0 EXIST::FUNCTION:EC
+EC_POINT_set_compressed_coordinates_GFp 641 1_1_0 EXIST::FUNCTION:DEPRECATEDIN_1_2_0,EC
OCSP_SINGLERESP_get0_id 642 1_1_0 EXIST::FUNCTION:OCSP
UI_add_info_string 643 1_1_0 EXIST::FUNCTION:
OBJ_NAME_remove 644 1_1_0 EXIST::FUNCTION:
@@ -1874,7 +1874,7 @@ i2b_PrivateKey_bio 1858 1_1_0 EXIST::FUNCTION:DSA
ASN1_STRING_length_set 1859 1_1_0 EXIST::FUNCTION:
PEM_write_PKCS8 1860 1_1_0 EXIST::FUNCTION:STDIO
PKCS7_digest_from_attributes 1861 1_1_0 EXIST::FUNCTION:
-EC_GROUP_set_curve_GFp 1862 1_1_0 EXIST::FUNCTION:EC
+EC_GROUP_set_curve_GFp 1862 1_1_0 EXIST::FUNCTION:DEPRECATEDIN_1_2_0,EC
X509_PURPOSE_get0 1863 1_1_0 EXIST::FUNCTION:
EVP_PKEY_set1_DSA 1864 1_1_0 EXIST::FUNCTION:DSA
X509_NAME_it 1865 1_1_0 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
@@ -1982,7 +1982,7 @@ X509_CRL_it 1966 1_1_0 EXIST:EXPORT_VAR_AS_FUNCTION:
d2i_X509_ALGOR 1967 1_1_0 EXIST::FUNCTION:
PKCS12_PBE_keyivgen 1968 1_1_0 EXIST::FUNCTION:
BIO_test_flags 1969 1_1_0 EXIST::FUNCTION:
-EC_POINT_get_affine_coordinates_GF2m 1970 1_1_0 EXIST::FUNCTION:EC,EC2M
+EC_POINT_get_affine_coordinates_GF2m 1970 1_1_0 EXIST::FUNCTION:DEPRECATEDIN_1_2_0,EC,EC2M
EVP_ENCODE_CTX_num 1971 1_1_0 EXIST::FUNCTION:
Camellia_cfb1_encrypt 1972 1_1_0 EXIST::FUNCTION:CAMELLIA
NCONF_load_fp 1973 1_1_0 EXIST::FUNCTION:STDIO
@@ -2183,7 +2183,7 @@ i2d_ASN1_T61STRING 2156 1_1_0 EXIST::FUNCTION:
X509_add1_trust_object 2157 1_1_0 EXIST::FUNCTION:
PEM_write_X509 2158 1_1_0 EXIST::FUNCTION:STDIO
BN_CTX_free 2159 1_1_0 EXIST::FUNCTION:
-EC_GROUP_get_curve_GF2m 2160 1_1_0 EXIST::FUNCTION:EC,EC2M
+EC_GROUP_get_curve_GF2m 2160 1_1_0 EXIST::FUNCTION:DEPRECATEDIN_1_2_0,EC,EC2M
EVP_MD_flags 2161 1_1_0 EXIST::FUNCTION:
OPENSSL_sk_set 2162 1_1_0 EXIST::FUNCTION:
OCSP_request_sign 2163 1_1_0 EXIST::FUNCTION:OCSP
@@ -2263,7 +2263,7 @@ ENGINE_set_name 2235 1_1_0 EXIST::FUNCTION:ENGINE
TS_TST_INFO_get_policy_id 2236 1_1_0 EXIST::FUNCTION:TS
PKCS7_SIGNER_INFO_set 2237 1_1_0 EXIST::FUNCTION:
PEM_write_bio_PKCS8_PRIV_KEY_INFO 2238 1_1_0 EXIST::FUNCTION:
-EC_GROUP_set_curve_GF2m 2239 1_1_0 EXIST::FUNCTION:EC,EC2M
+EC_GROUP_set_curve_GF2m 2239 1_1_0 EXIST::FUNCTION:DEPRECATEDIN_1_2_0,EC,EC2M
ENGINE_load_builtin_engines 2240 1_1_0 EXIST::FUNCTION:ENGINE
SRP_VBASE_init 2241 1_1_0 EXIST::FUNCTION:SRP
SHA224_Final 2242 1_1_0 EXIST::FUNCTION:
@@ -2983,7 +2983,7 @@ EVP_aes_192_cbc 2936 1_1_0 EXIST::FUNCTION:
PKCS8_pkey_set0 2937 1_1_0 EXIST::FUNCTION:
X509_get1_email 2938 1_1_0 EXIST::FUNCTION:
EC_POINT_point2oct 2939 1_1_0 EXIST::FUNCTION:EC
-EC_GROUP_get_curve_GFp 2940 1_1_0 EXIST::FUNCTION:EC
+EC_GROUP_get_curve_GFp 2940 1_1_0 EXIST::FUNCTION:DEPRECATEDIN_1_2_0,EC
ASYNC_block_pause 2941 1_1_0 EXIST::FUNCTION:
OCSP_SINGLERESP_get_ext 2942 1_1_0 EXIST::FUNCTION:OCSP
CRYPTO_strdup 2943 1_1_0 EXIST::FUNCTION:
@@ -3234,7 +3234,7 @@ X509_NAME_oneline 3186 1_1_0 EXIST::FUNCTION:
X509V3_set_nconf 3187 1_1_0 EXIST::FUNCTION:
RSAPrivateKey_dup 3188 1_1_0 EXIST::FUNCTION:RSA
BN_mod_add 3189 1_1_0 EXIST::FUNCTION:
-EC_POINT_set_affine_coordinates_GFp 3190 1_1_0 EXIST::FUNCTION:EC
+EC_POINT_set_affine_coordinates_GFp 3190 1_1_0 EXIST::FUNCTION:DEPRECATEDIN_1_2_0,EC
X509_get_default_cert_file 3191 1_1_0 EXIST::FUNCTION:
UI_method_set_flusher 3192 1_1_0 EXIST::FUNCTION:
RSA_new_method 3193 1_1_0 EXIST::FUNCTION:RSA
@@ -3572,7 +3572,7 @@ PROXY_CERT_INFO_EXTENSION_new 3523 1_1_0 EXIST::FUNCTION:
EVP_bf_cbc 3524 1_1_0 EXIST::FUNCTION:BF
DSA_do_verify 3525 1_1_0 EXIST::FUNCTION:DSA
EC_GROUP_get_seed_len 3526 1_1_0 EXIST::FUNCTION:EC
-EC_POINT_set_affine_coordinates_GF2m 3527 1_1_0 EXIST::FUNCTION:EC,EC2M
+EC_POINT_set_affine_coordinates_GF2m 3527 1_1_0 EXIST::FUNCTION:DEPRECATEDIN_1_2_0,EC,EC2M
TS_REQ_set_policy_id 3528 1_1_0 EXIST::FUNCTION:TS
BIO_callback_ctrl 3529 1_1_0 EXIST::FUNCTION:
v2i_GENERAL_NAME 3530 1_1_0 EXIST::FUNCTION:
@@ -4569,3 +4569,8 @@ EVP_PKEY_asn1_set_get_priv_key 4520 1_1_1 EXIST::FUNCTION:
EVP_PKEY_asn1_set_get_pub_key 4521 1_1_1 EXIST::FUNCTION:
EVP_PKEY_set_alias_type 4522 1_1_1 EXIST::FUNCTION:
RAND_keep_random_devices_open 4523 1_1_1 EXIST::FUNCTION:
+EC_POINT_set_compressed_coordinates 4524 1_1_1 EXIST::FUNCTION:EC
+EC_POINT_set_affine_coordinates 4525 1_1_1 EXIST::FUNCTION:EC
+EC_POINT_get_affine_coordinates 4526 1_1_1 EXIST::FUNCTION:EC
+EC_GROUP_set_curve 4527 1_1_1 EXIST::FUNCTION:EC
+EC_GROUP_get_curve 4528 1_1_1 EXIST::FUNCTION:EC
More information about the openssl-commits
mailing list