summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2021-04-20 17:28:18 +0000
committertb <>2021-04-20 17:28:18 +0000
commitd4cd97c94eead199a5ddfade40166ffd21d00609 (patch)
tree84821870dcd67fd9178210e1adcc84248265dab1 /src/lib
parentb567b8b60d2a8021e06cc33d2fee8b1cf180eac5 (diff)
downloadopenbsd-d4cd97c94eead199a5ddfade40166ffd21d00609.tar.gz
openbsd-d4cd97c94eead199a5ddfade40166ffd21d00609.tar.bz2
openbsd-d4cd97c94eead199a5ddfade40166ffd21d00609.zip
Provide EC_POINT_{g,s}et_Jprojective_coordinates for internal use
ok jsing
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/ec/ec.h9
-rw-r--r--src/lib/libcrypto/ec/ec_lcl.h18
-rw-r--r--src/lib/libcrypto/ec/ec_lib.c36
-rw-r--r--src/lib/libcrypto/ec/ecp_mont.c10
-rw-r--r--src/lib/libcrypto/ec/ecp_nist.c10
-rw-r--r--src/lib/libcrypto/ec/ecp_nistp224.c16
-rw-r--r--src/lib/libcrypto/ec/ecp_nistp256.c16
-rw-r--r--src/lib/libcrypto/ec/ecp_nistp521.c16
-rw-r--r--src/lib/libcrypto/ec/ecp_nistz256.c10
-rw-r--r--src/lib/libcrypto/ec/ecp_smpl.c33
10 files changed, 97 insertions, 77 deletions
diff --git a/src/lib/libcrypto/ec/ec.h b/src/lib/libcrypto/ec/ec.h
index ebd80b91fd..ff60e80952 100644
--- a/src/lib/libcrypto/ec/ec.h
+++ b/src/lib/libcrypto/ec/ec.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec.h,v 1.20 2021/04/20 17:16:37 tb Exp $ */ 1/* $OpenBSD: ec.h,v 1.21 2021/04/20 17:28:18 tb Exp $ */
2/* 2/*
3 * Originally written by Bodo Moeller for the OpenSSL project. 3 * Originally written by Bodo Moeller for the OpenSSL project.
4 */ 4 */
@@ -454,6 +454,12 @@ const EC_METHOD *EC_POINT_method_of(const EC_POINT *point);
454 */ 454 */
455int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point); 455int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point);
456 456
457#if defined(LIBRESSL_INTERNAL)
458int EC_POINT_set_Jprojective_coordinates(const EC_GROUP *group, EC_POINT *p,
459 const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx);
460int EC_POINT_get_Jprojective_coordinates(const EC_GROUP *group,
461 const EC_POINT *p, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx);
462#else
457/** Sets the jacobian projective coordinates of a EC_POINT over GFp 463/** Sets the jacobian projective coordinates of a EC_POINT over GFp
458 * \param group underlying EC_GROUP object 464 * \param group underlying EC_GROUP object
459 * \param p EC_POINT object 465 * \param p EC_POINT object
@@ -477,6 +483,7 @@ int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
477 */ 483 */
478int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, 484int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,
479 const EC_POINT *p, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx); 485 const EC_POINT *p, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx);
486#endif
480 487
481#if defined(LIBRESSL_INTERNAL) 488#if defined(LIBRESSL_INTERNAL)
482int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *p, 489int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *p,
diff --git a/src/lib/libcrypto/ec/ec_lcl.h b/src/lib/libcrypto/ec/ec_lcl.h
index 4addc860ed..7570cdc7f2 100644
--- a/src/lib/libcrypto/ec/ec_lcl.h
+++ b/src/lib/libcrypto/ec/ec_lcl.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_lcl.h,v 1.15 2021/04/20 17:16:37 tb Exp $ */ 1/* $OpenBSD: ec_lcl.h,v 1.16 2021/04/20 17:28:18 tb Exp $ */
2/* 2/*
3 * Originally written by Bodo Moeller for the OpenSSL project. 3 * Originally written by Bodo Moeller for the OpenSSL project.
4 */ 4 */
@@ -122,16 +122,16 @@ struct ec_method_st {
122 int (*point_copy)(EC_POINT *, const EC_POINT *); 122 int (*point_copy)(EC_POINT *, const EC_POINT *);
123 123
124 /* used by EC_POINT_set_to_infinity, 124 /* used by EC_POINT_set_to_infinity,
125 * EC_POINT_set_Jprojective_coordinates_GFp, 125 * EC_POINT_set_Jprojective_coordinates,
126 * EC_POINT_get_Jprojective_coordinates_GFp, 126 * EC_POINT_get_Jprojective_coordinates,
127 * EC_POINT_set_affine_coordinates, 127 * EC_POINT_set_affine_coordinates,
128 * EC_POINT_get_affine_coordinates, 128 * EC_POINT_get_affine_coordinates,
129 * EC_POINT_set_compressed_coordinates_GFp, ..._GF2m: 129 * EC_POINT_set_compressed_coordinates_GFp, ..._GF2m:
130 */ 130 */
131 int (*point_set_to_infinity)(const EC_GROUP *, EC_POINT *); 131 int (*point_set_to_infinity)(const EC_GROUP *, EC_POINT *);
132 int (*point_set_Jprojective_coordinates_GFp)(const EC_GROUP *, EC_POINT *, 132 int (*point_set_Jprojective_coordinates)(const EC_GROUP *, EC_POINT *,
133 const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *); 133 const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *);
134 int (*point_get_Jprojective_coordinates_GFp)(const EC_GROUP *, const EC_POINT *, 134 int (*point_get_Jprojective_coordinates)(const EC_GROUP *, const EC_POINT *,
135 BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *); 135 BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *);
136 int (*point_set_affine_coordinates)(const EC_GROUP *, EC_POINT *, 136 int (*point_set_affine_coordinates)(const EC_GROUP *, EC_POINT *,
137 const BIGNUM *x, const BIGNUM *y, BN_CTX *); 137 const BIGNUM *x, const BIGNUM *y, BN_CTX *);
@@ -320,10 +320,10 @@ void ec_GFp_simple_point_finish(EC_POINT *);
320void ec_GFp_simple_point_clear_finish(EC_POINT *); 320void ec_GFp_simple_point_clear_finish(EC_POINT *);
321int ec_GFp_simple_point_copy(EC_POINT *, const EC_POINT *); 321int ec_GFp_simple_point_copy(EC_POINT *, const EC_POINT *);
322int ec_GFp_simple_point_set_to_infinity(const EC_GROUP *, EC_POINT *); 322int ec_GFp_simple_point_set_to_infinity(const EC_GROUP *, EC_POINT *);
323int ec_GFp_simple_set_Jprojective_coordinates_GFp(const EC_GROUP *, EC_POINT *, 323int ec_GFp_simple_set_Jprojective_coordinates(const EC_GROUP *, EC_POINT *,
324 const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *); 324 const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *);
325int ec_GFp_simple_get_Jprojective_coordinates_GFp(const EC_GROUP *, const EC_POINT *, 325int ec_GFp_simple_get_Jprojective_coordinates(const EC_GROUP *,
326 BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *); 326 const EC_POINT *, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *);
327int ec_GFp_simple_point_set_affine_coordinates(const EC_GROUP *, EC_POINT *, 327int ec_GFp_simple_point_set_affine_coordinates(const EC_GROUP *, EC_POINT *,
328 const BIGNUM *x, const BIGNUM *y, BN_CTX *); 328 const BIGNUM *x, const BIGNUM *y, BN_CTX *);
329int ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *, const EC_POINT *, 329int ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *, const EC_POINT *,
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c
index 1be688824d..a5cf84b78c 100644
--- a/src/lib/libcrypto/ec/ec_lib.c
+++ b/src/lib/libcrypto/ec/ec_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_lib.c,v 1.37 2021/04/20 17:17:47 tb Exp $ */ 1/* $OpenBSD: ec_lib.c,v 1.38 2021/04/20 17:28:18 tb Exp $ */
2/* 2/*
3 * Originally written by Bodo Moeller for the OpenSSL project. 3 * Originally written by Bodo Moeller for the OpenSSL project.
4 */ 4 */
@@ -922,12 +922,11 @@ EC_POINT_set_to_infinity(const EC_GROUP * group, EC_POINT * point)
922 return group->meth->point_set_to_infinity(group, point); 922 return group->meth->point_set_to_infinity(group, point);
923} 923}
924 924
925 925int
926int 926EC_POINT_set_Jprojective_coordinates(const EC_GROUP *group, EC_POINT *point,
927EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *point,
928 const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx) 927 const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx)
929{ 928{
930 if (group->meth->point_set_Jprojective_coordinates_GFp == 0) { 929 if (group->meth->point_set_Jprojective_coordinates == 0) {
931 ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); 930 ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
932 return 0; 931 return 0;
933 } 932 }
@@ -935,15 +934,15 @@ EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *point,
935 ECerror(EC_R_INCOMPATIBLE_OBJECTS); 934 ECerror(EC_R_INCOMPATIBLE_OBJECTS);
936 return 0; 935 return 0;
937 } 936 }
938 return group->meth->point_set_Jprojective_coordinates_GFp(group, point, x, y, z, ctx); 937 return group->meth->point_set_Jprojective_coordinates(group, point,
938 x, y, z, ctx);
939} 939}
940 940
941 941int
942int 942EC_POINT_get_Jprojective_coordinates(const EC_GROUP *group,
943EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,
944 const EC_POINT *point, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx) 943 const EC_POINT *point, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx)
945{ 944{
946 if (group->meth->point_get_Jprojective_coordinates_GFp == 0) { 945 if (group->meth->point_get_Jprojective_coordinates == 0) {
947 ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); 946 ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
948 return 0; 947 return 0;
949 } 948 }
@@ -951,7 +950,22 @@ EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,
951 ECerror(EC_R_INCOMPATIBLE_OBJECTS); 950 ECerror(EC_R_INCOMPATIBLE_OBJECTS);
952 return 0; 951 return 0;
953 } 952 }
954 return group->meth->point_get_Jprojective_coordinates_GFp(group, point, x, y, z, ctx); 953 return group->meth->point_get_Jprojective_coordinates(group, point,
954 x, y, z, ctx);
955}
956
957int
958EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *point,
959 const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx)
960{
961 return EC_POINT_set_Jprojective_coordinates(group, point, x, y, z, ctx);
962}
963
964int
965EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,
966 const EC_POINT *point, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx)
967{
968 return EC_POINT_get_Jprojective_coordinates(group, point, x, y, z, ctx);
955} 969}
956 970
957int 971int
diff --git a/src/lib/libcrypto/ec/ecp_mont.c b/src/lib/libcrypto/ec/ecp_mont.c
index f4dff9aa46..7160692e9e 100644
--- a/src/lib/libcrypto/ec/ecp_mont.c
+++ b/src/lib/libcrypto/ec/ecp_mont.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecp_mont.c,v 1.17 2018/11/05 20:18:21 tb Exp $ */ 1/* $OpenBSD: ecp_mont.c,v 1.18 2021/04/20 17:28:18 tb Exp $ */
2/* 2/*
3 * Originally written by Bodo Moeller for the OpenSSL project. 3 * Originally written by Bodo Moeller for the OpenSSL project.
4 */ 4 */
@@ -86,10 +86,10 @@ EC_GFp_mont_method(void)
86 .point_clear_finish = ec_GFp_simple_point_clear_finish, 86 .point_clear_finish = ec_GFp_simple_point_clear_finish,
87 .point_copy = ec_GFp_simple_point_copy, 87 .point_copy = ec_GFp_simple_point_copy,
88 .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity, 88 .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity,
89 .point_set_Jprojective_coordinates_GFp = 89 .point_set_Jprojective_coordinates =
90 ec_GFp_simple_set_Jprojective_coordinates_GFp, 90 ec_GFp_simple_set_Jprojective_coordinates,
91 .point_get_Jprojective_coordinates_GFp = 91 .point_get_Jprojective_coordinates =
92 ec_GFp_simple_get_Jprojective_coordinates_GFp, 92 ec_GFp_simple_get_Jprojective_coordinates,
93 .point_set_affine_coordinates = 93 .point_set_affine_coordinates =
94 ec_GFp_simple_point_set_affine_coordinates, 94 ec_GFp_simple_point_set_affine_coordinates,
95 .point_get_affine_coordinates = 95 .point_get_affine_coordinates =
diff --git a/src/lib/libcrypto/ec/ecp_nist.c b/src/lib/libcrypto/ec/ecp_nist.c
index 073c0419cf..c34c708025 100644
--- a/src/lib/libcrypto/ec/ecp_nist.c
+++ b/src/lib/libcrypto/ec/ecp_nist.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecp_nist.c,v 1.15 2018/11/05 20:18:21 tb Exp $ */ 1/* $OpenBSD: ecp_nist.c,v 1.16 2021/04/20 17:28:18 tb Exp $ */
2/* 2/*
3 * Written by Nils Larsch for the OpenSSL project. 3 * Written by Nils Larsch for the OpenSSL project.
4 */ 4 */
@@ -87,10 +87,10 @@ EC_GFp_nist_method(void)
87 .point_clear_finish = ec_GFp_simple_point_clear_finish, 87 .point_clear_finish = ec_GFp_simple_point_clear_finish,
88 .point_copy = ec_GFp_simple_point_copy, 88 .point_copy = ec_GFp_simple_point_copy,
89 .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity, 89 .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity,
90 .point_set_Jprojective_coordinates_GFp = 90 .point_set_Jprojective_coordinates =
91 ec_GFp_simple_set_Jprojective_coordinates_GFp, 91 ec_GFp_simple_set_Jprojective_coordinates,
92 .point_get_Jprojective_coordinates_GFp = 92 .point_get_Jprojective_coordinates =
93 ec_GFp_simple_get_Jprojective_coordinates_GFp, 93 ec_GFp_simple_get_Jprojective_coordinates,
94 .point_set_affine_coordinates = 94 .point_set_affine_coordinates =
95 ec_GFp_simple_point_set_affine_coordinates, 95 ec_GFp_simple_point_set_affine_coordinates,
96 .point_get_affine_coordinates = 96 .point_get_affine_coordinates =
diff --git a/src/lib/libcrypto/ec/ecp_nistp224.c b/src/lib/libcrypto/ec/ecp_nistp224.c
index c5fc738a02..10ade9dbb5 100644
--- a/src/lib/libcrypto/ec/ecp_nistp224.c
+++ b/src/lib/libcrypto/ec/ecp_nistp224.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecp_nistp224.c,v 1.24 2021/04/20 17:16:37 tb Exp $ */ 1/* $OpenBSD: ecp_nistp224.c,v 1.25 2021/04/20 17:28:18 tb Exp $ */
2/* 2/*
3 * Written by Emilia Kasper (Google) for the OpenSSL project. 3 * Written by Emilia Kasper (Google) for the OpenSSL project.
4 */ 4 */
@@ -250,10 +250,10 @@ EC_GFp_nistp224_method(void)
250 .point_clear_finish = ec_GFp_simple_point_clear_finish, 250 .point_clear_finish = ec_GFp_simple_point_clear_finish,
251 .point_copy = ec_GFp_simple_point_copy, 251 .point_copy = ec_GFp_simple_point_copy,
252 .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity, 252 .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity,
253 .point_set_Jprojective_coordinates_GFp = 253 .point_set_Jprojective_coordinates =
254 ec_GFp_simple_set_Jprojective_coordinates_GFp, 254 ec_GFp_simple_set_Jprojective_coordinates,
255 .point_get_Jprojective_coordinates_GFp = 255 .point_get_Jprojective_coordinates =
256 ec_GFp_simple_get_Jprojective_coordinates_GFp, 256 ec_GFp_simple_get_Jprojective_coordinates,
257 .point_set_affine_coordinates = 257 .point_set_affine_coordinates =
258 ec_GFp_simple_point_set_affine_coordinates, 258 ec_GFp_simple_point_set_affine_coordinates,
259 .point_get_affine_coordinates = 259 .point_get_affine_coordinates =
@@ -1409,8 +1409,8 @@ ec_GFp_nistp224_points_mul(const EC_GROUP * group, EC_POINT * r,
1409 ECerror(ERR_R_BN_LIB); 1409 ECerror(ERR_R_BN_LIB);
1410 goto err; 1410 goto err;
1411 } 1411 }
1412 if (!EC_POINT_set_Jprojective_coordinates_GFp(group, 1412 if (!EC_POINT_set_Jprojective_coordinates(group, generator,
1413 generator, x, y, z, ctx)) 1413 x, y, z, ctx))
1414 goto err; 1414 goto err;
1415 if (0 == EC_POINT_cmp(group, generator, group->generator, ctx)) 1415 if (0 == EC_POINT_cmp(group, generator, group->generator, ctx))
1416 /* precomputation matches generator */ 1416 /* precomputation matches generator */
@@ -1536,7 +1536,7 @@ ec_GFp_nistp224_points_mul(const EC_GROUP * group, EC_POINT * r,
1536 ECerror(ERR_R_BN_LIB); 1536 ECerror(ERR_R_BN_LIB);
1537 goto err; 1537 goto err;
1538 } 1538 }
1539 ret = EC_POINT_set_Jprojective_coordinates_GFp(group, r, x, y, z, ctx); 1539 ret = EC_POINT_set_Jprojective_coordinates(group, r, x, y, z, ctx);
1540 1540
1541 err: 1541 err:
1542 BN_CTX_end(ctx); 1542 BN_CTX_end(ctx);
diff --git a/src/lib/libcrypto/ec/ecp_nistp256.c b/src/lib/libcrypto/ec/ecp_nistp256.c
index 38e87ecd03..674143cc3e 100644
--- a/src/lib/libcrypto/ec/ecp_nistp256.c
+++ b/src/lib/libcrypto/ec/ecp_nistp256.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecp_nistp256.c,v 1.23 2021/04/20 17:16:37 tb Exp $ */ 1/* $OpenBSD: ecp_nistp256.c,v 1.24 2021/04/20 17:28:18 tb Exp $ */
2/* 2/*
3 * Written by Adam Langley (Google) for the OpenSSL project 3 * Written by Adam Langley (Google) for the OpenSSL project
4 */ 4 */
@@ -1704,10 +1704,10 @@ EC_GFp_nistp256_method(void)
1704 .point_clear_finish = ec_GFp_simple_point_clear_finish, 1704 .point_clear_finish = ec_GFp_simple_point_clear_finish,
1705 .point_copy = ec_GFp_simple_point_copy, 1705 .point_copy = ec_GFp_simple_point_copy,
1706 .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity, 1706 .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity,
1707 .point_set_Jprojective_coordinates_GFp = 1707 .point_set_Jprojective_coordinates =
1708 ec_GFp_simple_set_Jprojective_coordinates_GFp, 1708 ec_GFp_simple_set_Jprojective_coordinates,
1709 .point_get_Jprojective_coordinates_GFp = 1709 .point_get_Jprojective_coordinates =
1710 ec_GFp_simple_get_Jprojective_coordinates_GFp, 1710 ec_GFp_simple_get_Jprojective_coordinates,
1711 .point_set_affine_coordinates = 1711 .point_set_affine_coordinates =
1712 ec_GFp_simple_point_set_affine_coordinates, 1712 ec_GFp_simple_point_set_affine_coordinates,
1713 .point_get_affine_coordinates = 1713 .point_get_affine_coordinates =
@@ -1959,8 +1959,8 @@ ec_GFp_nistp256_points_mul(const EC_GROUP * group, EC_POINT * r,
1959 ECerror(ERR_R_BN_LIB); 1959 ECerror(ERR_R_BN_LIB);
1960 goto err; 1960 goto err;
1961 } 1961 }
1962 if (!EC_POINT_set_Jprojective_coordinates_GFp(group, 1962 if (!EC_POINT_set_Jprojective_coordinates(group, generator,
1963 generator, x, y, z, ctx)) 1963 x, y, z, ctx))
1964 goto err; 1964 goto err;
1965 if (0 == EC_POINT_cmp(group, generator, group->generator, ctx)) 1965 if (0 == EC_POINT_cmp(group, generator, group->generator, ctx))
1966 /* precomputation matches generator */ 1966 /* precomputation matches generator */
@@ -2089,7 +2089,7 @@ ec_GFp_nistp256_points_mul(const EC_GROUP * group, EC_POINT * r,
2089 ECerror(ERR_R_BN_LIB); 2089 ECerror(ERR_R_BN_LIB);
2090 goto err; 2090 goto err;
2091 } 2091 }
2092 ret = EC_POINT_set_Jprojective_coordinates_GFp(group, r, x, y, z, ctx); 2092 ret = EC_POINT_set_Jprojective_coordinates(group, r, x, y, z, ctx);
2093 2093
2094 err: 2094 err:
2095 BN_CTX_end(ctx); 2095 BN_CTX_end(ctx);
diff --git a/src/lib/libcrypto/ec/ecp_nistp521.c b/src/lib/libcrypto/ec/ecp_nistp521.c
index e5ccbb1b21..3d38c72396 100644
--- a/src/lib/libcrypto/ec/ecp_nistp521.c
+++ b/src/lib/libcrypto/ec/ecp_nistp521.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecp_nistp521.c,v 1.24 2021/04/20 17:16:38 tb Exp $ */ 1/* $OpenBSD: ecp_nistp521.c,v 1.25 2021/04/20 17:28:18 tb Exp $ */
2/* 2/*
3 * Written by Adam Langley (Google) for the OpenSSL project 3 * Written by Adam Langley (Google) for the OpenSSL project
4 */ 4 */
@@ -1594,10 +1594,10 @@ EC_GFp_nistp521_method(void)
1594 .point_clear_finish = ec_GFp_simple_point_clear_finish, 1594 .point_clear_finish = ec_GFp_simple_point_clear_finish,
1595 .point_copy = ec_GFp_simple_point_copy, 1595 .point_copy = ec_GFp_simple_point_copy,
1596 .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity, 1596 .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity,
1597 .point_set_Jprojective_coordinates_GFp = 1597 .point_set_Jprojective_coordinates =
1598 ec_GFp_simple_set_Jprojective_coordinates_GFp, 1598 ec_GFp_simple_set_Jprojective_coordinates,
1599 .point_get_Jprojective_coordinates_GFp = 1599 .point_get_Jprojective_coordinates =
1600 ec_GFp_simple_get_Jprojective_coordinates_GFp, 1600 ec_GFp_simple_get_Jprojective_coordinates,
1601 .point_set_affine_coordinates = 1601 .point_set_affine_coordinates =
1602 ec_GFp_simple_point_set_affine_coordinates, 1602 ec_GFp_simple_point_set_affine_coordinates,
1603 .point_get_affine_coordinates = 1603 .point_get_affine_coordinates =
@@ -1848,8 +1848,8 @@ ec_GFp_nistp521_points_mul(const EC_GROUP * group, EC_POINT * r,
1848 ECerror(ERR_R_BN_LIB); 1848 ECerror(ERR_R_BN_LIB);
1849 goto err; 1849 goto err;
1850 } 1850 }
1851 if (!EC_POINT_set_Jprojective_coordinates_GFp(group, 1851 if (!EC_POINT_set_Jprojective_coordinates(group, generator,
1852 generator, x, y, z, ctx)) 1852 x, y, z, ctx))
1853 goto err; 1853 goto err;
1854 if (0 == EC_POINT_cmp(group, generator, group->generator, ctx)) 1854 if (0 == EC_POINT_cmp(group, generator, group->generator, ctx))
1855 /* precomputation matches generator */ 1855 /* precomputation matches generator */
@@ -1978,7 +1978,7 @@ ec_GFp_nistp521_points_mul(const EC_GROUP * group, EC_POINT * r,
1978 ECerror(ERR_R_BN_LIB); 1978 ECerror(ERR_R_BN_LIB);
1979 goto err; 1979 goto err;
1980 } 1980 }
1981 ret = EC_POINT_set_Jprojective_coordinates_GFp(group, r, x, y, z, ctx); 1981 ret = EC_POINT_set_Jprojective_coordinates(group, r, x, y, z, ctx);
1982 1982
1983 err: 1983 err:
1984 BN_CTX_end(ctx); 1984 BN_CTX_end(ctx);
diff --git a/src/lib/libcrypto/ec/ecp_nistz256.c b/src/lib/libcrypto/ec/ecp_nistz256.c
index 13c4cd2f34..619249964b 100644
--- a/src/lib/libcrypto/ec/ecp_nistz256.c
+++ b/src/lib/libcrypto/ec/ecp_nistz256.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecp_nistz256.c,v 1.8 2021/04/20 17:16:38 tb Exp $ */ 1/* $OpenBSD: ecp_nistz256.c,v 1.9 2021/04/20 17:28:18 tb Exp $ */
2/* Copyright (c) 2014, Intel Corporation. 2/* Copyright (c) 2014, Intel Corporation.
3 * 3 *
4 * Permission to use, copy, modify, and/or distribute this software for any 4 * Permission to use, copy, modify, and/or distribute this software for any
@@ -1159,10 +1159,10 @@ EC_GFp_nistz256_method(void)
1159 .point_clear_finish = ec_GFp_simple_point_clear_finish, 1159 .point_clear_finish = ec_GFp_simple_point_clear_finish,
1160 .point_copy = ec_GFp_simple_point_copy, 1160 .point_copy = ec_GFp_simple_point_copy,
1161 .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity, 1161 .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity,
1162 .point_set_Jprojective_coordinates_GFp = 1162 .point_set_Jprojective_coordinates =
1163 ec_GFp_simple_set_Jprojective_coordinates_GFp, 1163 ec_GFp_simple_set_Jprojective_coordinates,
1164 .point_get_Jprojective_coordinates_GFp = 1164 .point_get_Jprojective_coordinates =
1165 ec_GFp_simple_get_Jprojective_coordinates_GFp, 1165 ec_GFp_simple_get_Jprojective_coordinates,
1166 .point_set_affine_coordinates = 1166 .point_set_affine_coordinates =
1167 ec_GFp_simple_point_set_affine_coordinates, 1167 ec_GFp_simple_point_set_affine_coordinates,
1168 .point_get_affine_coordinates = ecp_nistz256_get_affine, 1168 .point_get_affine_coordinates = ecp_nistz256_get_affine,
diff --git a/src/lib/libcrypto/ec/ecp_smpl.c b/src/lib/libcrypto/ec/ecp_smpl.c
index e1fd9007c7..9223427459 100644
--- a/src/lib/libcrypto/ec/ecp_smpl.c
+++ b/src/lib/libcrypto/ec/ecp_smpl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecp_smpl.c,v 1.30 2021/04/20 17:16:38 tb Exp $ */ 1/* $OpenBSD: ecp_smpl.c,v 1.31 2021/04/20 17:28:18 tb Exp $ */
2/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> 2/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de>
3 * for the OpenSSL project. 3 * for the OpenSSL project.
4 * Includes code written by Bodo Moeller for the OpenSSL project. 4 * Includes code written by Bodo Moeller for the OpenSSL project.
@@ -87,10 +87,10 @@ EC_GFp_simple_method(void)
87 .point_clear_finish = ec_GFp_simple_point_clear_finish, 87 .point_clear_finish = ec_GFp_simple_point_clear_finish,
88 .point_copy = ec_GFp_simple_point_copy, 88 .point_copy = ec_GFp_simple_point_copy,
89 .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity, 89 .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity,
90 .point_set_Jprojective_coordinates_GFp = 90 .point_set_Jprojective_coordinates =
91 ec_GFp_simple_set_Jprojective_coordinates_GFp, 91 ec_GFp_simple_set_Jprojective_coordinates,
92 .point_get_Jprojective_coordinates_GFp = 92 .point_get_Jprojective_coordinates =
93 ec_GFp_simple_get_Jprojective_coordinates_GFp, 93 ec_GFp_simple_get_Jprojective_coordinates,
94 .point_set_affine_coordinates = 94 .point_set_affine_coordinates =
95 ec_GFp_simple_point_set_affine_coordinates, 95 ec_GFp_simple_point_set_affine_coordinates,
96 .point_get_affine_coordinates = 96 .point_get_affine_coordinates =
@@ -413,9 +413,10 @@ ec_GFp_simple_point_set_to_infinity(const EC_GROUP * group, EC_POINT * point)
413} 413}
414 414
415 415
416int 416int
417ec_GFp_simple_set_Jprojective_coordinates_GFp(const EC_GROUP * group, EC_POINT * point, 417ec_GFp_simple_set_Jprojective_coordinates(const EC_GROUP *group,
418 const BIGNUM * x, const BIGNUM * y, const BIGNUM * z, BN_CTX * ctx) 418 EC_POINT *point, const BIGNUM *x, const BIGNUM *y, const BIGNUM *z,
419 BN_CTX *ctx)
419{ 420{
420 BN_CTX *new_ctx = NULL; 421 BN_CTX *new_ctx = NULL;
421 int ret = 0; 422 int ret = 0;
@@ -465,10 +466,9 @@ ec_GFp_simple_set_Jprojective_coordinates_GFp(const EC_GROUP * group, EC_POINT *
465 return ret; 466 return ret;
466} 467}
467 468
468 469int
469int 470ec_GFp_simple_get_Jprojective_coordinates(const EC_GROUP *group,
470ec_GFp_simple_get_Jprojective_coordinates_GFp(const EC_GROUP * group, const EC_POINT * point, 471 const EC_POINT *point, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx)
471 BIGNUM * x, BIGNUM * y, BIGNUM * z, BN_CTX * ctx)
472{ 472{
473 BN_CTX *new_ctx = NULL; 473 BN_CTX *new_ctx = NULL;
474 int ret = 0; 474 int ret = 0;
@@ -513,8 +513,7 @@ ec_GFp_simple_get_Jprojective_coordinates_GFp(const EC_GROUP * group, const EC_P
513 return ret; 513 return ret;
514} 514}
515 515
516 516int
517int
518ec_GFp_simple_point_set_affine_coordinates(const EC_GROUP * group, EC_POINT * point, 517ec_GFp_simple_point_set_affine_coordinates(const EC_GROUP * group, EC_POINT * point,
519 const BIGNUM * x, const BIGNUM * y, BN_CTX * ctx) 518 const BIGNUM * x, const BIGNUM * y, BN_CTX * ctx)
520{ 519{
@@ -523,11 +522,11 @@ ec_GFp_simple_point_set_affine_coordinates(const EC_GROUP * group, EC_POINT * po
523 ECerror(ERR_R_PASSED_NULL_PARAMETER); 522 ECerror(ERR_R_PASSED_NULL_PARAMETER);
524 return 0; 523 return 0;
525 } 524 }
526 return EC_POINT_set_Jprojective_coordinates_GFp(group, point, x, y, BN_value_one(), ctx); 525 return EC_POINT_set_Jprojective_coordinates(group, point, x, y,
526 BN_value_one(), ctx);
527} 527}
528 528
529 529int
530int
531ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP * group, const EC_POINT * point, 530ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP * group, const EC_POINT * point,
532 BIGNUM * x, BIGNUM * y, BN_CTX * ctx) 531 BIGNUM * x, BIGNUM * y, BN_CTX * ctx)
533{ 532{