diff options
author | tb <> | 2024-11-12 11:01:14 +0000 |
---|---|---|
committer | tb <> | 2024-11-12 11:01:14 +0000 |
commit | f58688e26f10be483b9b48f638d2b31e63880995 (patch) | |
tree | 10ef49c2cf51083141d8781a8009a0a2d9002014 /src/lib | |
parent | f2acee9bbaa4365f6537e353faeeb7ae3aeeed5a (diff) | |
download | openbsd-f58688e26f10be483b9b48f638d2b31e63880995.tar.gz openbsd-f58688e26f10be483b9b48f638d2b31e63880995.tar.bz2 openbsd-f58688e26f10be483b9b48f638d2b31e63880995.zip |
ecp_methods.c: rewrap some lines
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/ec/ecp_methods.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/lib/libcrypto/ec/ecp_methods.c b/src/lib/libcrypto/ec/ecp_methods.c index 6431551c8c..3deee06b50 100644 --- a/src/lib/libcrypto/ec/ecp_methods.c +++ b/src/lib/libcrypto/ec/ecp_methods.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_methods.c,v 1.5 2024/11/12 10:57:56 tb Exp $ */ | 1 | /* $OpenBSD: ecp_methods.c,v 1.6 2024/11/12 11:01:14 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. |
@@ -80,9 +80,8 @@ | |||
80 | * multiplication, and field_encode and field_decode (if defined) | 80 | * multiplication, and field_encode and field_decode (if defined) |
81 | * will be used for converting between representations. | 81 | * will be used for converting between representations. |
82 | * | 82 | * |
83 | * Functions ec_points_make_affine() and | 83 | * Functions ec_points_make_affine() and ec_point_get_affine_coordinates() |
84 | * ec_point_get_affine_coordinates() specifically assume | 84 | * assume that if a non-trivial representation is used, it is a Montgomery |
85 | * that if a non-trivial representation is used, it is a Montgomery | ||
86 | * representation (i.e. 'encoding' means multiplying by some factor R). | 85 | * representation (i.e. 'encoding' means multiplying by some factor R). |
87 | */ | 86 | */ |
88 | 87 | ||
@@ -203,8 +202,8 @@ ec_group_set_curve(EC_GROUP *group, | |||
203 | } | 202 | } |
204 | 203 | ||
205 | static int | 204 | static int |
206 | ec_group_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, | 205 | ec_group_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, |
207 | BIGNUM *b, BN_CTX *ctx) | 206 | BN_CTX *ctx) |
208 | { | 207 | { |
209 | if (p != NULL) { | 208 | if (p != NULL) { |
210 | if (!bn_copy(p, &group->field)) | 209 | if (!bn_copy(p, &group->field)) |
@@ -324,9 +323,8 @@ ec_point_set_to_infinity(const EC_GROUP *group, EC_POINT *point) | |||
324 | } | 323 | } |
325 | 324 | ||
326 | static int | 325 | static int |
327 | ec_set_Jprojective_coordinates(const EC_GROUP *group, | 326 | ec_set_Jprojective_coordinates(const EC_GROUP *group, EC_POINT *point, |
328 | EC_POINT *point, const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, | 327 | const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx) |
329 | BN_CTX *ctx) | ||
330 | { | 328 | { |
331 | int ret = 0; | 329 | int ret = 0; |
332 | 330 | ||
@@ -356,8 +354,8 @@ ec_set_Jprojective_coordinates(const EC_GROUP *group, | |||
356 | } | 354 | } |
357 | 355 | ||
358 | static int | 356 | static int |
359 | ec_get_Jprojective_coordinates(const EC_GROUP *group, | 357 | ec_get_Jprojective_coordinates(const EC_GROUP *group, const EC_POINT *point, |
360 | const EC_POINT *point, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx) | 358 | BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx) |
361 | { | 359 | { |
362 | int ret = 0; | 360 | int ret = 0; |
363 | 361 | ||
@@ -388,8 +386,8 @@ ec_point_set_affine_coordinates(const EC_GROUP *group, EC_POINT *point, | |||
388 | } | 386 | } |
389 | 387 | ||
390 | static int | 388 | static int |
391 | ec_point_get_affine_coordinates(const EC_GROUP *group, | 389 | ec_point_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *point, |
392 | const EC_POINT *point, BIGNUM *x, BIGNUM *y, BN_CTX *ctx) | 390 | BIGNUM *x, BIGNUM *y, BN_CTX *ctx) |
393 | { | 391 | { |
394 | BIGNUM *z, *Z, *Z_1, *Z_2, *Z_3; | 392 | BIGNUM *z, *Z, *Z_1, *Z_2, *Z_3; |
395 | int ret = 0; | 393 | int ret = 0; |
@@ -469,8 +467,8 @@ ec_point_get_affine_coordinates(const EC_GROUP *group, | |||
469 | } | 467 | } |
470 | 468 | ||
471 | static int | 469 | static int |
472 | ec_set_compressed_coordinates(const EC_GROUP *group, | 470 | ec_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *point, |
473 | EC_POINT *point, const BIGNUM *in_x, int y_bit, BN_CTX *ctx) | 471 | const BIGNUM *in_x, int y_bit, BN_CTX *ctx) |
474 | { | 472 | { |
475 | const BIGNUM *p = &group->field, *a = &group->a, *b = &group->b; | 473 | const BIGNUM *p = &group->field, *a = &group->a, *b = &group->b; |
476 | BIGNUM *w, *x, *y; | 474 | BIGNUM *w, *x, *y; |
@@ -567,7 +565,8 @@ ec_set_compressed_coordinates(const EC_GROUP *group, | |||
567 | } | 565 | } |
568 | 566 | ||
569 | static int | 567 | static int |
570 | ec_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx) | 568 | ec_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, |
569 | BN_CTX *ctx) | ||
571 | { | 570 | { |
572 | int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *); | 571 | int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *); |
573 | int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *); | 572 | int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *); |
@@ -1124,7 +1123,8 @@ ec_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) | |||
1124 | } | 1123 | } |
1125 | 1124 | ||
1126 | static int | 1125 | static int |
1127 | ec_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx) | 1126 | ec_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], |
1127 | BN_CTX *ctx) | ||
1128 | { | 1128 | { |
1129 | BIGNUM *tmp0, *tmp1; | 1129 | BIGNUM *tmp0, *tmp1; |
1130 | size_t pow2 = 0; | 1130 | size_t pow2 = 0; |
@@ -1293,7 +1293,8 @@ ec_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_ | |||
1293 | } | 1293 | } |
1294 | 1294 | ||
1295 | static int | 1295 | static int |
1296 | ec_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) | 1296 | ec_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, const BIGNUM *b, |
1297 | BN_CTX *ctx) | ||
1297 | { | 1298 | { |
1298 | return BN_mod_mul(r, a, b, &group->field, ctx); | 1299 | return BN_mod_mul(r, a, b, &group->field, ctx); |
1299 | } | 1300 | } |
@@ -1587,23 +1588,22 @@ ec_mul_ct(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
1587 | #undef EC_POINT_CSWAP | 1588 | #undef EC_POINT_CSWAP |
1588 | 1589 | ||
1589 | static int | 1590 | static int |
1590 | ec_mul_generator_ct(const EC_GROUP *group, EC_POINT *r, | 1591 | ec_mul_generator_ct(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, |
1591 | const BIGNUM *scalar, BN_CTX *ctx) | 1592 | BN_CTX *ctx) |
1592 | { | 1593 | { |
1593 | return ec_mul_ct(group, r, scalar, NULL, ctx); | 1594 | return ec_mul_ct(group, r, scalar, NULL, ctx); |
1594 | } | 1595 | } |
1595 | 1596 | ||
1596 | static int | 1597 | static int |
1597 | ec_mul_single_ct(const EC_GROUP *group, EC_POINT *r, | 1598 | ec_mul_single_ct(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, |
1598 | const BIGNUM *scalar, const EC_POINT *point, BN_CTX *ctx) | 1599 | const EC_POINT *point, BN_CTX *ctx) |
1599 | { | 1600 | { |
1600 | return ec_mul_ct(group, r, scalar, point, ctx); | 1601 | return ec_mul_ct(group, r, scalar, point, ctx); |
1601 | } | 1602 | } |
1602 | 1603 | ||
1603 | static int | 1604 | static int |
1604 | ec_mul_double_nonct(const EC_GROUP *group, EC_POINT *r, | 1605 | ec_mul_double_nonct(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, |
1605 | const BIGNUM *g_scalar, const BIGNUM *p_scalar, const EC_POINT *point, | 1606 | const BIGNUM *p_scalar, const EC_POINT *point, BN_CTX *ctx) |
1606 | BN_CTX *ctx) | ||
1607 | { | 1607 | { |
1608 | return ec_wNAF_mul(group, r, g_scalar, 1, &point, &p_scalar, ctx); | 1608 | return ec_wNAF_mul(group, r, g_scalar, 1, &point, &p_scalar, ctx); |
1609 | } | 1609 | } |