summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ec/ecp_nistp521.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/ec/ecp_nistp521.c')
-rw-r--r--src/lib/libcrypto/ec/ecp_nistp521.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/lib/libcrypto/ec/ecp_nistp521.c b/src/lib/libcrypto/ec/ecp_nistp521.c
index 994c1039d6..064bf85534 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.27 2021/09/08 17:29:21 tb Exp $ */ 1/* $OpenBSD: ecp_nistp521.c,v 1.28 2022/11/19 07:29:29 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 */
@@ -163,7 +163,7 @@ felem_to_bin66(u8 out[66], const felem in)
163 163
164/* To preserve endianness when using BN_bn2bin and BN_bin2bn */ 164/* To preserve endianness when using BN_bn2bin and BN_bin2bn */
165static void 165static void
166flip_endian(u8 * out, const u8 * in, unsigned len) 166flip_endian(u8 *out, const u8 *in, unsigned len)
167{ 167{
168 unsigned i; 168 unsigned i;
169 for (i = 0; i < len; ++i) 169 for (i = 0; i < len; ++i)
@@ -172,7 +172,7 @@ flip_endian(u8 * out, const u8 * in, unsigned len)
172 172
173/* BN_to_felem converts an OpenSSL BIGNUM into an felem */ 173/* BN_to_felem converts an OpenSSL BIGNUM into an felem */
174static int 174static int
175BN_to_felem(felem out, const BIGNUM * bn) 175BN_to_felem(felem out, const BIGNUM *bn)
176{ 176{
177 felem_bytearray b_in; 177 felem_bytearray b_in;
178 felem_bytearray b_out; 178 felem_bytearray b_out;
@@ -197,7 +197,7 @@ BN_to_felem(felem out, const BIGNUM * bn)
197 197
198/* felem_to_BN converts an felem into an OpenSSL BIGNUM */ 198/* felem_to_BN converts an felem into an OpenSSL BIGNUM */
199static BIGNUM * 199static BIGNUM *
200felem_to_BN(BIGNUM * out, const felem in) 200felem_to_BN(BIGNUM *out, const felem in)
201{ 201{
202 felem_bytearray b_in, b_out; 202 felem_bytearray b_in, b_out;
203 felem_to_bin66(b_in, in); 203 felem_to_bin66(b_in, in);
@@ -1487,7 +1487,7 @@ get_bit(const felem_bytearray in, int i)
1487 * Output point (X, Y, Z) is stored in x_out, y_out, z_out */ 1487 * Output point (X, Y, Z) is stored in x_out, y_out, z_out */
1488static void 1488static void
1489batch_mul(felem x_out, felem y_out, felem z_out, 1489batch_mul(felem x_out, felem y_out, felem z_out,
1490 const felem_bytearray scalars[], const unsigned num_points, const u8 * g_scalar, 1490 const felem_bytearray scalars[], const unsigned num_points, const u8 *g_scalar,
1491 const int mixed, const felem pre_comp[][17][3], const felem g_pre_comp[16][3]) 1491 const int mixed, const felem pre_comp[][17][3], const felem g_pre_comp[16][3])
1492{ 1492{
1493 int i, skip; 1493 int i, skip;
@@ -1689,7 +1689,7 @@ nistp521_pre_comp_clear_free(void *pre_)
1689 */ 1689 */
1690 1690
1691int 1691int
1692ec_GFp_nistp521_group_init(EC_GROUP * group) 1692ec_GFp_nistp521_group_init(EC_GROUP *group)
1693{ 1693{
1694 int ret; 1694 int ret;
1695 ret = ec_GFp_simple_group_init(group); 1695 ret = ec_GFp_simple_group_init(group);
@@ -1698,8 +1698,8 @@ ec_GFp_nistp521_group_init(EC_GROUP * group)
1698} 1698}
1699 1699
1700int 1700int
1701ec_GFp_nistp521_group_set_curve(EC_GROUP * group, const BIGNUM * p, 1701ec_GFp_nistp521_group_set_curve(EC_GROUP *group, const BIGNUM *p,
1702 const BIGNUM * a, const BIGNUM * b, BN_CTX * ctx) 1702 const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
1703{ 1703{
1704 int ret = 0; 1704 int ret = 0;
1705 BN_CTX *new_ctx = NULL; 1705 BN_CTX *new_ctx = NULL;
@@ -1732,8 +1732,8 @@ ec_GFp_nistp521_group_set_curve(EC_GROUP * group, const BIGNUM * p,
1732/* Takes the Jacobian coordinates (X, Y, Z) of a point and returns 1732/* Takes the Jacobian coordinates (X, Y, Z) of a point and returns
1733 * (X', Y') = (X/Z^2, Y/Z^3) */ 1733 * (X', Y') = (X/Z^2, Y/Z^3) */
1734int 1734int
1735ec_GFp_nistp521_point_get_affine_coordinates(const EC_GROUP * group, 1735ec_GFp_nistp521_point_get_affine_coordinates(const EC_GROUP *group,
1736 const EC_POINT * point, BIGNUM * x, BIGNUM * y, BN_CTX * ctx) 1736 const EC_POINT *point, BIGNUM *x, BIGNUM *y, BN_CTX *ctx)
1737{ 1737{
1738 felem z1, z2, x_in, y_in, x_out, y_out; 1738 felem z1, z2, x_in, y_in, x_out, y_out;
1739 largefelem tmp; 1739 largefelem tmp;
@@ -1795,9 +1795,9 @@ make_points_affine(size_t num, felem points[ /* num */ ][3], felem tmp_felems[ /
1795/* Computes scalar*generator + \sum scalars[i]*points[i], ignoring NULL values 1795/* Computes scalar*generator + \sum scalars[i]*points[i], ignoring NULL values
1796 * Result is stored in r (r can equal one of the inputs). */ 1796 * Result is stored in r (r can equal one of the inputs). */
1797int 1797int
1798ec_GFp_nistp521_points_mul(const EC_GROUP * group, EC_POINT * r, 1798ec_GFp_nistp521_points_mul(const EC_GROUP *group, EC_POINT *r,
1799 const BIGNUM * scalar, size_t num, const EC_POINT * points[], 1799 const BIGNUM *scalar, size_t num, const EC_POINT *points[],
1800 const BIGNUM * scalars[], BN_CTX * ctx) 1800 const BIGNUM *scalars[], BN_CTX *ctx)
1801{ 1801{
1802 int ret = 0; 1802 int ret = 0;
1803 int j; 1803 int j;
@@ -1992,7 +1992,7 @@ ec_GFp_nistp521_points_mul(const EC_GROUP * group, EC_POINT * r,
1992} 1992}
1993 1993
1994int 1994int
1995ec_GFp_nistp521_precompute_mult(EC_GROUP * group, BN_CTX * ctx) 1995ec_GFp_nistp521_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
1996{ 1996{
1997 int ret = 0; 1997 int ret = 0;
1998 NISTP521_PRE_COMP *pre = NULL; 1998 NISTP521_PRE_COMP *pre = NULL;
@@ -2099,7 +2099,7 @@ ec_GFp_nistp521_precompute_mult(EC_GROUP * group, BN_CTX * ctx)
2099} 2099}
2100 2100
2101int 2101int
2102ec_GFp_nistp521_have_precompute_mult(const EC_GROUP * group) 2102ec_GFp_nistp521_have_precompute_mult(const EC_GROUP *group)
2103{ 2103{
2104 if (EC_EX_DATA_get_data(group->extra_data, nistp521_pre_comp_dup, 2104 if (EC_EX_DATA_get_data(group->extra_data, nistp521_pre_comp_dup,
2105 nistp521_pre_comp_free, nistp521_pre_comp_clear_free) 2105 nistp521_pre_comp_free, nistp521_pre_comp_clear_free)