diff options
Diffstat (limited to 'src/lib/libcrypto/ec/ecp_nistp256.c')
-rw-r--r-- | src/lib/libcrypto/ec/ecp_nistp256.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/lib/libcrypto/ec/ecp_nistp256.c b/src/lib/libcrypto/ec/ecp_nistp256.c index e13621c7b6..8371ee4827 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.26 2021/09/08 17:29:21 tb Exp $ */ | 1 | /* $OpenBSD: ecp_nistp256.c,v 1.27 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 | */ |
@@ -137,7 +137,7 @@ smallfelem_to_bin32(u8 out[32], const smallfelem in) | |||
137 | 137 | ||
138 | /* To preserve endianness when using BN_bn2bin and BN_bin2bn */ | 138 | /* To preserve endianness when using BN_bn2bin and BN_bin2bn */ |
139 | static void | 139 | static void |
140 | flip_endian(u8 * out, const u8 * in, unsigned len) | 140 | flip_endian(u8 *out, const u8 *in, unsigned len) |
141 | { | 141 | { |
142 | unsigned i; | 142 | unsigned i; |
143 | for (i = 0; i < len; ++i) | 143 | for (i = 0; i < len; ++i) |
@@ -146,7 +146,7 @@ flip_endian(u8 * out, const u8 * in, unsigned len) | |||
146 | 146 | ||
147 | /* BN_to_felem converts an OpenSSL BIGNUM into an felem */ | 147 | /* BN_to_felem converts an OpenSSL BIGNUM into an felem */ |
148 | static int | 148 | static int |
149 | BN_to_felem(felem out, const BIGNUM * bn) | 149 | BN_to_felem(felem out, const BIGNUM *bn) |
150 | { | 150 | { |
151 | felem_bytearray b_in; | 151 | felem_bytearray b_in; |
152 | felem_bytearray b_out; | 152 | felem_bytearray b_out; |
@@ -171,7 +171,7 @@ BN_to_felem(felem out, const BIGNUM * bn) | |||
171 | 171 | ||
172 | /* felem_to_BN converts an felem into an OpenSSL BIGNUM */ | 172 | /* felem_to_BN converts an felem into an OpenSSL BIGNUM */ |
173 | static BIGNUM * | 173 | static BIGNUM * |
174 | smallfelem_to_BN(BIGNUM * out, const smallfelem in) | 174 | smallfelem_to_BN(BIGNUM *out, const smallfelem in) |
175 | { | 175 | { |
176 | felem_bytearray b_in, b_out; | 176 | felem_bytearray b_in, b_out; |
177 | smallfelem_to_bin32(b_in, in); | 177 | smallfelem_to_bin32(b_in, in); |
@@ -833,7 +833,7 @@ felem_reduce_zero105(felem out, const longfelem in) | |||
833 | /* subtract_u64 sets *result = *result - v and *carry to one if the subtraction | 833 | /* subtract_u64 sets *result = *result - v and *carry to one if the subtraction |
834 | * underflowed. */ | 834 | * underflowed. */ |
835 | static void | 835 | static void |
836 | subtract_u64(u64 * result, u64 * carry, u64 v) | 836 | subtract_u64(u64 *result, u64 *carry, u64 v) |
837 | { | 837 | { |
838 | uint128_t r = *result; | 838 | uint128_t r = *result; |
839 | r -= v; | 839 | r -= v; |
@@ -1581,7 +1581,7 @@ get_bit(const felem_bytearray in, int i) | |||
1581 | * Output point (X, Y, Z) is stored in x_out, y_out, z_out */ | 1581 | * Output point (X, Y, Z) is stored in x_out, y_out, z_out */ |
1582 | static void | 1582 | static void |
1583 | batch_mul(felem x_out, felem y_out, felem z_out, | 1583 | batch_mul(felem x_out, felem y_out, felem z_out, |
1584 | const felem_bytearray scalars[], const unsigned num_points, const u8 * g_scalar, | 1584 | const felem_bytearray scalars[], const unsigned num_points, const u8 *g_scalar, |
1585 | const int mixed, const smallfelem pre_comp[][17][3], const smallfelem g_pre_comp[2][16][3]) | 1585 | const int mixed, const smallfelem pre_comp[][17][3], const smallfelem g_pre_comp[2][16][3]) |
1586 | { | 1586 | { |
1587 | int i, skip; | 1587 | int i, skip; |
@@ -1798,7 +1798,7 @@ nistp256_pre_comp_clear_free(void *pre_) | |||
1798 | */ | 1798 | */ |
1799 | 1799 | ||
1800 | int | 1800 | int |
1801 | ec_GFp_nistp256_group_init(EC_GROUP * group) | 1801 | ec_GFp_nistp256_group_init(EC_GROUP *group) |
1802 | { | 1802 | { |
1803 | int ret; | 1803 | int ret; |
1804 | ret = ec_GFp_simple_group_init(group); | 1804 | ret = ec_GFp_simple_group_init(group); |
@@ -1807,8 +1807,8 @@ ec_GFp_nistp256_group_init(EC_GROUP * group) | |||
1807 | } | 1807 | } |
1808 | 1808 | ||
1809 | int | 1809 | int |
1810 | ec_GFp_nistp256_group_set_curve(EC_GROUP * group, const BIGNUM * p, | 1810 | ec_GFp_nistp256_group_set_curve(EC_GROUP *group, const BIGNUM *p, |
1811 | const BIGNUM * a, const BIGNUM * b, BN_CTX * ctx) | 1811 | const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) |
1812 | { | 1812 | { |
1813 | int ret = 0; | 1813 | int ret = 0; |
1814 | BN_CTX *new_ctx = NULL; | 1814 | BN_CTX *new_ctx = NULL; |
@@ -1841,8 +1841,8 @@ ec_GFp_nistp256_group_set_curve(EC_GROUP * group, const BIGNUM * p, | |||
1841 | /* Takes the Jacobian coordinates (X, Y, Z) of a point and returns | 1841 | /* Takes the Jacobian coordinates (X, Y, Z) of a point and returns |
1842 | * (X', Y') = (X/Z^2, Y/Z^3) */ | 1842 | * (X', Y') = (X/Z^2, Y/Z^3) */ |
1843 | int | 1843 | int |
1844 | ec_GFp_nistp256_point_get_affine_coordinates(const EC_GROUP * group, | 1844 | ec_GFp_nistp256_point_get_affine_coordinates(const EC_GROUP *group, |
1845 | const EC_POINT * point, BIGNUM * x, BIGNUM * y, BN_CTX * ctx) | 1845 | const EC_POINT *point, BIGNUM *x, BIGNUM *y, BN_CTX *ctx) |
1846 | { | 1846 | { |
1847 | felem z1, z2, x_in, y_in; | 1847 | felem z1, z2, x_in, y_in; |
1848 | smallfelem x_out, y_out; | 1848 | smallfelem x_out, y_out; |
@@ -1905,9 +1905,9 @@ make_points_affine(size_t num, smallfelem points[ /* num */ ][3], smallfelem tmp | |||
1905 | /* Computes scalar*generator + \sum scalars[i]*points[i], ignoring NULL values | 1905 | /* Computes scalar*generator + \sum scalars[i]*points[i], ignoring NULL values |
1906 | * Result is stored in r (r can equal one of the inputs). */ | 1906 | * Result is stored in r (r can equal one of the inputs). */ |
1907 | int | 1907 | int |
1908 | ec_GFp_nistp256_points_mul(const EC_GROUP * group, EC_POINT * r, | 1908 | ec_GFp_nistp256_points_mul(const EC_GROUP *group, EC_POINT *r, |
1909 | const BIGNUM * scalar, size_t num, const EC_POINT * points[], | 1909 | const BIGNUM *scalar, size_t num, const EC_POINT *points[], |
1910 | const BIGNUM * scalars[], BN_CTX * ctx) | 1910 | const BIGNUM *scalars[], BN_CTX *ctx) |
1911 | { | 1911 | { |
1912 | int ret = 0; | 1912 | int ret = 0; |
1913 | int j; | 1913 | int j; |
@@ -2103,7 +2103,7 @@ ec_GFp_nistp256_points_mul(const EC_GROUP * group, EC_POINT * r, | |||
2103 | } | 2103 | } |
2104 | 2104 | ||
2105 | int | 2105 | int |
2106 | ec_GFp_nistp256_precompute_mult(EC_GROUP * group, BN_CTX * ctx) | 2106 | ec_GFp_nistp256_precompute_mult(EC_GROUP *group, BN_CTX *ctx) |
2107 | { | 2107 | { |
2108 | int ret = 0; | 2108 | int ret = 0; |
2109 | NISTP256_PRE_COMP *pre = NULL; | 2109 | NISTP256_PRE_COMP *pre = NULL; |
@@ -2224,7 +2224,7 @@ ec_GFp_nistp256_precompute_mult(EC_GROUP * group, BN_CTX * ctx) | |||
2224 | } | 2224 | } |
2225 | 2225 | ||
2226 | int | 2226 | int |
2227 | ec_GFp_nistp256_have_precompute_mult(const EC_GROUP * group) | 2227 | ec_GFp_nistp256_have_precompute_mult(const EC_GROUP *group) |
2228 | { | 2228 | { |
2229 | if (EC_EX_DATA_get_data(group->extra_data, nistp256_pre_comp_dup, | 2229 | if (EC_EX_DATA_get_data(group->extra_data, nistp256_pre_comp_dup, |
2230 | nistp256_pre_comp_free, nistp256_pre_comp_clear_free) | 2230 | nistp256_pre_comp_free, nistp256_pre_comp_clear_free) |