diff options
Diffstat (limited to 'src/lib/libcrypto/ec/ecp_nistp521.c')
-rw-r--r-- | src/lib/libcrypto/ec/ecp_nistp521.c | 30 |
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 */ |
165 | static void | 165 | static void |
166 | flip_endian(u8 * out, const u8 * in, unsigned len) | 166 | flip_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 */ |
174 | static int | 174 | static int |
175 | BN_to_felem(felem out, const BIGNUM * bn) | 175 | BN_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 */ |
199 | static BIGNUM * | 199 | static BIGNUM * |
200 | felem_to_BN(BIGNUM * out, const felem in) | 200 | felem_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 */ |
1488 | static void | 1488 | static void |
1489 | batch_mul(felem x_out, felem y_out, felem z_out, | 1489 | batch_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 | ||
1691 | int | 1691 | int |
1692 | ec_GFp_nistp521_group_init(EC_GROUP * group) | 1692 | ec_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 | ||
1700 | int | 1700 | int |
1701 | ec_GFp_nistp521_group_set_curve(EC_GROUP * group, const BIGNUM * p, | 1701 | ec_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) */ |
1734 | int | 1734 | int |
1735 | ec_GFp_nistp521_point_get_affine_coordinates(const EC_GROUP * group, | 1735 | ec_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). */ |
1797 | int | 1797 | int |
1798 | ec_GFp_nistp521_points_mul(const EC_GROUP * group, EC_POINT * r, | 1798 | ec_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 | ||
1994 | int | 1994 | int |
1995 | ec_GFp_nistp521_precompute_mult(EC_GROUP * group, BN_CTX * ctx) | 1995 | ec_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 | ||
2101 | int | 2101 | int |
2102 | ec_GFp_nistp521_have_precompute_mult(const EC_GROUP * group) | 2102 | ec_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) |