diff options
author | tb <> | 2022-11-19 07:00:57 +0000 |
---|---|---|
committer | tb <> | 2022-11-19 07:00:57 +0000 |
commit | b197546e7fd8128aedea248a6196a0d25734b937 (patch) | |
tree | ea2ed349b4963d6f17652f4f5e962ee6d7cb2183 /src | |
parent | c85d7e98a77173fe38f0421c7cf06dc09bc9a746 (diff) | |
download | openbsd-b197546e7fd8128aedea248a6196a0d25734b937.tar.gz openbsd-b197546e7fd8128aedea248a6196a0d25734b937.tar.bz2 openbsd-b197546e7fd8128aedea248a6196a0d25734b937.zip |
whitespace
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/ec/ec2_oct.c | 6 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec2_smpl.c | 54 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec_ameth.c | 44 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec_asn1.c | 28 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec_check.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec_curve.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec_err.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec_key.c | 34 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec_mult.c | 14 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec_pmeth.c | 22 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/eck_prn.c | 18 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ecp_nistputil.c | 6 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ecp_nistz256.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ecp_oct.c | 8 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ecp_smpl.c | 14 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ecx_methods.c | 4 |
16 files changed, 134 insertions, 134 deletions
diff --git a/src/lib/libcrypto/ec/ec2_oct.c b/src/lib/libcrypto/ec/ec2_oct.c index 832083c628..b25084ef58 100644 --- a/src/lib/libcrypto/ec/ec2_oct.c +++ b/src/lib/libcrypto/ec/ec2_oct.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec2_oct.c,v 1.16 2021/05/03 14:42:45 tb Exp $ */ | 1 | /* $OpenBSD: ec2_oct.c,v 1.17 2022/11/19 07:00:57 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
4 | * | 4 | * |
@@ -90,7 +90,7 @@ | |||
90 | * the same method, but claim no priority date earlier than July 29, 1994 | 90 | * the same method, but claim no priority date earlier than July 29, 1994 |
91 | * (and additionally fail to cite the EUROCRYPT '92 publication as prior art). | 91 | * (and additionally fail to cite the EUROCRYPT '92 publication as prior art). |
92 | */ | 92 | */ |
93 | int | 93 | int |
94 | ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *point, | 94 | ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *point, |
95 | const BIGNUM *x_, int y_bit, BN_CTX *ctx) | 95 | const BIGNUM *x_, int y_bit, BN_CTX *ctx) |
96 | { | 96 | { |
@@ -172,7 +172,7 @@ ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *point | |||
172 | * If buf is NULL, the encoded length will be returned. | 172 | * If buf is NULL, the encoded length will be returned. |
173 | * If the length len of buf is smaller than required an error will be returned. | 173 | * If the length len of buf is smaller than required an error will be returned. |
174 | */ | 174 | */ |
175 | size_t | 175 | size_t |
176 | ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, | 176 | ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, |
177 | point_conversion_form_t form, | 177 | point_conversion_form_t form, |
178 | unsigned char *buf, size_t len, BN_CTX * ctx) | 178 | unsigned char *buf, size_t len, BN_CTX * ctx) |
diff --git a/src/lib/libcrypto/ec/ec2_smpl.c b/src/lib/libcrypto/ec/ec2_smpl.c index 9f3b380bfe..17664d0426 100644 --- a/src/lib/libcrypto/ec/ec2_smpl.c +++ b/src/lib/libcrypto/ec/ec2_smpl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec2_smpl.c,v 1.23 2021/09/08 17:29:21 tb Exp $ */ | 1 | /* $OpenBSD: ec2_smpl.c,v 1.24 2022/11/19 07:00:57 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
4 | * | 4 | * |
@@ -126,7 +126,7 @@ EC_GF2m_simple_method(void) | |||
126 | /* Initialize a GF(2^m)-based EC_GROUP structure. | 126 | /* Initialize a GF(2^m)-based EC_GROUP structure. |
127 | * Note that all other members are handled by EC_GROUP_new. | 127 | * Note that all other members are handled by EC_GROUP_new. |
128 | */ | 128 | */ |
129 | int | 129 | int |
130 | ec_GF2m_simple_group_init(EC_GROUP * group) | 130 | ec_GF2m_simple_group_init(EC_GROUP * group) |
131 | { | 131 | { |
132 | BN_init(&group->field); | 132 | BN_init(&group->field); |
@@ -139,7 +139,7 @@ ec_GF2m_simple_group_init(EC_GROUP * group) | |||
139 | /* Free a GF(2^m)-based EC_GROUP structure. | 139 | /* Free a GF(2^m)-based EC_GROUP structure. |
140 | * Note that all other members are handled by EC_GROUP_free. | 140 | * Note that all other members are handled by EC_GROUP_free. |
141 | */ | 141 | */ |
142 | void | 142 | void |
143 | ec_GF2m_simple_group_finish(EC_GROUP * group) | 143 | ec_GF2m_simple_group_finish(EC_GROUP * group) |
144 | { | 144 | { |
145 | BN_free(&group->field); | 145 | BN_free(&group->field); |
@@ -151,7 +151,7 @@ ec_GF2m_simple_group_finish(EC_GROUP * group) | |||
151 | /* Clear and free a GF(2^m)-based EC_GROUP structure. | 151 | /* Clear and free a GF(2^m)-based EC_GROUP structure. |
152 | * Note that all other members are handled by EC_GROUP_clear_free. | 152 | * Note that all other members are handled by EC_GROUP_clear_free. |
153 | */ | 153 | */ |
154 | void | 154 | void |
155 | ec_GF2m_simple_group_clear_finish(EC_GROUP * group) | 155 | ec_GF2m_simple_group_clear_finish(EC_GROUP * group) |
156 | { | 156 | { |
157 | BN_clear_free(&group->field); | 157 | BN_clear_free(&group->field); |
@@ -169,7 +169,7 @@ ec_GF2m_simple_group_clear_finish(EC_GROUP * group) | |||
169 | /* Copy a GF(2^m)-based EC_GROUP structure. | 169 | /* Copy a GF(2^m)-based EC_GROUP structure. |
170 | * Note that all other members are handled by EC_GROUP_copy. | 170 | * Note that all other members are handled by EC_GROUP_copy. |
171 | */ | 171 | */ |
172 | int | 172 | int |
173 | ec_GF2m_simple_group_copy(EC_GROUP * dest, const EC_GROUP * src) | 173 | ec_GF2m_simple_group_copy(EC_GROUP * dest, const EC_GROUP * src) |
174 | { | 174 | { |
175 | int i; | 175 | int i; |
@@ -199,7 +199,7 @@ ec_GF2m_simple_group_copy(EC_GROUP * dest, const EC_GROUP * src) | |||
199 | 199 | ||
200 | 200 | ||
201 | /* Set the curve parameters of an EC_GROUP structure. */ | 201 | /* Set the curve parameters of an EC_GROUP structure. */ |
202 | int | 202 | int |
203 | ec_GF2m_simple_group_set_curve(EC_GROUP * group, | 203 | ec_GF2m_simple_group_set_curve(EC_GROUP * group, |
204 | const BIGNUM * p, const BIGNUM * a, const BIGNUM * b, BN_CTX * ctx) | 204 | const BIGNUM * p, const BIGNUM * a, const BIGNUM * b, BN_CTX * ctx) |
205 | { | 205 | { |
@@ -238,7 +238,7 @@ ec_GF2m_simple_group_set_curve(EC_GROUP * group, | |||
238 | /* Get the curve parameters of an EC_GROUP structure. | 238 | /* Get the curve parameters of an EC_GROUP structure. |
239 | * If p, a, or b are NULL then there values will not be set but the method will return with success. | 239 | * If p, a, or b are NULL then there values will not be set but the method will return with success. |
240 | */ | 240 | */ |
241 | int | 241 | int |
242 | ec_GF2m_simple_group_get_curve(const EC_GROUP *group, | 242 | ec_GF2m_simple_group_get_curve(const EC_GROUP *group, |
243 | BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx) | 243 | BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx) |
244 | { | 244 | { |
@@ -264,7 +264,7 @@ ec_GF2m_simple_group_get_curve(const EC_GROUP *group, | |||
264 | 264 | ||
265 | 265 | ||
266 | /* Gets the degree of the field. For a curve over GF(2^m) this is the value m. */ | 266 | /* Gets the degree of the field. For a curve over GF(2^m) this is the value m. */ |
267 | int | 267 | int |
268 | ec_GF2m_simple_group_get_degree(const EC_GROUP * group) | 268 | ec_GF2m_simple_group_get_degree(const EC_GROUP * group) |
269 | { | 269 | { |
270 | return BN_num_bits(&group->field) - 1; | 270 | return BN_num_bits(&group->field) - 1; |
@@ -274,7 +274,7 @@ ec_GF2m_simple_group_get_degree(const EC_GROUP * group) | |||
274 | /* Checks the discriminant of the curve. | 274 | /* Checks the discriminant of the curve. |
275 | * y^2 + x*y = x^3 + a*x^2 + b is an elliptic curve <=> b != 0 (mod p) | 275 | * y^2 + x*y = x^3 + a*x^2 + b is an elliptic curve <=> b != 0 (mod p) |
276 | */ | 276 | */ |
277 | int | 277 | int |
278 | ec_GF2m_simple_group_check_discriminant(const EC_GROUP * group, BN_CTX * ctx) | 278 | ec_GF2m_simple_group_check_discriminant(const EC_GROUP * group, BN_CTX * ctx) |
279 | { | 279 | { |
280 | int ret = 0; | 280 | int ret = 0; |
@@ -313,7 +313,7 @@ ec_GF2m_simple_group_check_discriminant(const EC_GROUP * group, BN_CTX * ctx) | |||
313 | 313 | ||
314 | 314 | ||
315 | /* Initializes an EC_POINT. */ | 315 | /* Initializes an EC_POINT. */ |
316 | int | 316 | int |
317 | ec_GF2m_simple_point_init(EC_POINT * point) | 317 | ec_GF2m_simple_point_init(EC_POINT * point) |
318 | { | 318 | { |
319 | BN_init(&point->X); | 319 | BN_init(&point->X); |
@@ -324,7 +324,7 @@ ec_GF2m_simple_point_init(EC_POINT * point) | |||
324 | 324 | ||
325 | 325 | ||
326 | /* Frees an EC_POINT. */ | 326 | /* Frees an EC_POINT. */ |
327 | void | 327 | void |
328 | ec_GF2m_simple_point_finish(EC_POINT * point) | 328 | ec_GF2m_simple_point_finish(EC_POINT * point) |
329 | { | 329 | { |
330 | BN_free(&point->X); | 330 | BN_free(&point->X); |
@@ -334,7 +334,7 @@ ec_GF2m_simple_point_finish(EC_POINT * point) | |||
334 | 334 | ||
335 | 335 | ||
336 | /* Clears and frees an EC_POINT. */ | 336 | /* Clears and frees an EC_POINT. */ |
337 | void | 337 | void |
338 | ec_GF2m_simple_point_clear_finish(EC_POINT * point) | 338 | ec_GF2m_simple_point_clear_finish(EC_POINT * point) |
339 | { | 339 | { |
340 | BN_clear_free(&point->X); | 340 | BN_clear_free(&point->X); |
@@ -345,7 +345,7 @@ ec_GF2m_simple_point_clear_finish(EC_POINT * point) | |||
345 | 345 | ||
346 | 346 | ||
347 | /* Copy the contents of one EC_POINT into another. Assumes dest is initialized. */ | 347 | /* Copy the contents of one EC_POINT into another. Assumes dest is initialized. */ |
348 | int | 348 | int |
349 | ec_GF2m_simple_point_copy(EC_POINT * dest, const EC_POINT * src) | 349 | ec_GF2m_simple_point_copy(EC_POINT * dest, const EC_POINT * src) |
350 | { | 350 | { |
351 | if (!BN_copy(&dest->X, &src->X)) | 351 | if (!BN_copy(&dest->X, &src->X)) |
@@ -363,7 +363,7 @@ ec_GF2m_simple_point_copy(EC_POINT * dest, const EC_POINT * src) | |||
363 | /* Set an EC_POINT to the point at infinity. | 363 | /* Set an EC_POINT to the point at infinity. |
364 | * A point at infinity is represented by having Z=0. | 364 | * A point at infinity is represented by having Z=0. |
365 | */ | 365 | */ |
366 | int | 366 | int |
367 | ec_GF2m_simple_point_set_to_infinity(const EC_GROUP * group, EC_POINT * point) | 367 | ec_GF2m_simple_point_set_to_infinity(const EC_GROUP * group, EC_POINT * point) |
368 | { | 368 | { |
369 | point->Z_is_one = 0; | 369 | point->Z_is_one = 0; |
@@ -375,7 +375,7 @@ ec_GF2m_simple_point_set_to_infinity(const EC_GROUP * group, EC_POINT * point) | |||
375 | /* Set the coordinates of an EC_POINT using affine coordinates. | 375 | /* Set the coordinates of an EC_POINT using affine coordinates. |
376 | * Note that the simple implementation only uses affine coordinates. | 376 | * Note that the simple implementation only uses affine coordinates. |
377 | */ | 377 | */ |
378 | int | 378 | int |
379 | ec_GF2m_simple_point_set_affine_coordinates(const EC_GROUP * group, EC_POINT * point, | 379 | ec_GF2m_simple_point_set_affine_coordinates(const EC_GROUP * group, EC_POINT * point, |
380 | const BIGNUM * x, const BIGNUM * y, BN_CTX * ctx) | 380 | const BIGNUM * x, const BIGNUM * y, BN_CTX * ctx) |
381 | { | 381 | { |
@@ -404,7 +404,7 @@ ec_GF2m_simple_point_set_affine_coordinates(const EC_GROUP * group, EC_POINT * p | |||
404 | /* Gets the affine coordinates of an EC_POINT. | 404 | /* Gets the affine coordinates of an EC_POINT. |
405 | * Note that the simple implementation only uses affine coordinates. | 405 | * Note that the simple implementation only uses affine coordinates. |
406 | */ | 406 | */ |
407 | int | 407 | int |
408 | ec_GF2m_simple_point_get_affine_coordinates(const EC_GROUP *group, | 408 | ec_GF2m_simple_point_get_affine_coordinates(const EC_GROUP *group, |
409 | const EC_POINT *point, BIGNUM *x, BIGNUM *y, BN_CTX *ctx) | 409 | const EC_POINT *point, BIGNUM *x, BIGNUM *y, BN_CTX *ctx) |
410 | { | 410 | { |
@@ -437,7 +437,7 @@ ec_GF2m_simple_point_get_affine_coordinates(const EC_GROUP *group, | |||
437 | /* Computes a + b and stores the result in r. r could be a or b, a could be b. | 437 | /* Computes a + b and stores the result in r. r could be a or b, a could be b. |
438 | * Uses algorithm A.10.2 of IEEE P1363. | 438 | * Uses algorithm A.10.2 of IEEE P1363. |
439 | */ | 439 | */ |
440 | int | 440 | int |
441 | ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, | 441 | ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, |
442 | const EC_POINT *b, BN_CTX *ctx) | 442 | const EC_POINT *b, BN_CTX *ctx) |
443 | { | 443 | { |
@@ -557,14 +557,14 @@ ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, | |||
557 | /* Computes 2 * a and stores the result in r. r could be a. | 557 | /* Computes 2 * a and stores the result in r. r could be a. |
558 | * Uses algorithm A.10.2 of IEEE P1363. | 558 | * Uses algorithm A.10.2 of IEEE P1363. |
559 | */ | 559 | */ |
560 | int | 560 | int |
561 | ec_GF2m_simple_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, | 561 | ec_GF2m_simple_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, |
562 | BN_CTX *ctx) | 562 | BN_CTX *ctx) |
563 | { | 563 | { |
564 | return ec_GF2m_simple_add(group, r, a, a, ctx); | 564 | return ec_GF2m_simple_add(group, r, a, a, ctx); |
565 | } | 565 | } |
566 | 566 | ||
567 | int | 567 | int |
568 | ec_GF2m_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) | 568 | ec_GF2m_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) |
569 | { | 569 | { |
570 | if (EC_POINT_is_at_infinity(group, point) > 0 || BN_is_zero(&point->Y)) | 570 | if (EC_POINT_is_at_infinity(group, point) > 0 || BN_is_zero(&point->Y)) |
@@ -578,7 +578,7 @@ ec_GF2m_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) | |||
578 | 578 | ||
579 | 579 | ||
580 | /* Indicates whether the given point is the point at infinity. */ | 580 | /* Indicates whether the given point is the point at infinity. */ |
581 | int | 581 | int |
582 | ec_GF2m_simple_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) | 582 | ec_GF2m_simple_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) |
583 | { | 583 | { |
584 | return BN_is_zero(&point->Z); | 584 | return BN_is_zero(&point->Z); |
@@ -589,7 +589,7 @@ ec_GF2m_simple_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) | |||
589 | * in the EC_GROUP. A point is valid if it satisfies the Weierstrass equation: | 589 | * in the EC_GROUP. A point is valid if it satisfies the Weierstrass equation: |
590 | * y^2 + x*y = x^3 + a*x^2 + b. | 590 | * y^2 + x*y = x^3 + a*x^2 + b. |
591 | */ | 591 | */ |
592 | int | 592 | int |
593 | ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx) | 593 | ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx) |
594 | { | 594 | { |
595 | int ret = -1; | 595 | int ret = -1; |
@@ -653,7 +653,7 @@ ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX | |||
653 | * 0 equal (in affine coordinates) | 653 | * 0 equal (in affine coordinates) |
654 | * 1 not equal | 654 | * 1 not equal |
655 | */ | 655 | */ |
656 | int | 656 | int |
657 | ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a, | 657 | ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a, |
658 | const EC_POINT *b, BN_CTX *ctx) | 658 | const EC_POINT *b, BN_CTX *ctx) |
659 | { | 659 | { |
@@ -700,7 +700,7 @@ ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a, | |||
700 | 700 | ||
701 | 701 | ||
702 | /* Forces the given EC_POINT to internally use affine coordinates. */ | 702 | /* Forces the given EC_POINT to internally use affine coordinates. */ |
703 | int | 703 | int |
704 | ec_GF2m_simple_make_affine(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx) | 704 | ec_GF2m_simple_make_affine(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx) |
705 | { | 705 | { |
706 | BN_CTX *new_ctx = NULL; | 706 | BN_CTX *new_ctx = NULL; |
@@ -741,7 +741,7 @@ ec_GF2m_simple_make_affine(const EC_GROUP * group, EC_POINT * point, BN_CTX * ct | |||
741 | 741 | ||
742 | 742 | ||
743 | /* Forces each of the EC_POINTs in the given array to use affine coordinates. */ | 743 | /* Forces each of the EC_POINTs in the given array to use affine coordinates. */ |
744 | int | 744 | int |
745 | ec_GF2m_simple_points_make_affine(const EC_GROUP *group, size_t num, | 745 | ec_GF2m_simple_points_make_affine(const EC_GROUP *group, size_t num, |
746 | EC_POINT *points[], BN_CTX *ctx) | 746 | EC_POINT *points[], BN_CTX *ctx) |
747 | { | 747 | { |
@@ -757,7 +757,7 @@ ec_GF2m_simple_points_make_affine(const EC_GROUP *group, size_t num, | |||
757 | 757 | ||
758 | 758 | ||
759 | /* Wrapper to simple binary polynomial field multiplication implementation. */ | 759 | /* Wrapper to simple binary polynomial field multiplication implementation. */ |
760 | int | 760 | int |
761 | ec_GF2m_simple_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, | 761 | ec_GF2m_simple_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, |
762 | const BIGNUM *b, BN_CTX *ctx) | 762 | const BIGNUM *b, BN_CTX *ctx) |
763 | { | 763 | { |
@@ -766,7 +766,7 @@ ec_GF2m_simple_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, | |||
766 | 766 | ||
767 | 767 | ||
768 | /* Wrapper to simple binary polynomial field squaring implementation. */ | 768 | /* Wrapper to simple binary polynomial field squaring implementation. */ |
769 | int | 769 | int |
770 | ec_GF2m_simple_field_sqr(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, | 770 | ec_GF2m_simple_field_sqr(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, |
771 | BN_CTX *ctx) | 771 | BN_CTX *ctx) |
772 | { | 772 | { |
@@ -775,7 +775,7 @@ ec_GF2m_simple_field_sqr(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, | |||
775 | 775 | ||
776 | 776 | ||
777 | /* Wrapper to simple binary polynomial field division implementation. */ | 777 | /* Wrapper to simple binary polynomial field division implementation. */ |
778 | int | 778 | int |
779 | ec_GF2m_simple_field_div(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, | 779 | ec_GF2m_simple_field_div(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, |
780 | const BIGNUM *b, BN_CTX *ctx) | 780 | const BIGNUM *b, BN_CTX *ctx) |
781 | { | 781 | { |
diff --git a/src/lib/libcrypto/ec/ec_ameth.c b/src/lib/libcrypto/ec/ec_ameth.c index 5c9a76c8be..ee931a93c6 100644 --- a/src/lib/libcrypto/ec/ec_ameth.c +++ b/src/lib/libcrypto/ec/ec_ameth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_ameth.c,v 1.33 2022/06/27 12:36:05 tb Exp $ */ | 1 | /* $OpenBSD: ec_ameth.c,v 1.34 2022/11/19 07:00:57 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -75,7 +75,7 @@ static int ecdh_cms_decrypt(CMS_RecipientInfo *ri); | |||
75 | static int ecdh_cms_encrypt(CMS_RecipientInfo *ri); | 75 | static int ecdh_cms_encrypt(CMS_RecipientInfo *ri); |
76 | #endif | 76 | #endif |
77 | 77 | ||
78 | static int | 78 | static int |
79 | eckey_param2type(int *pptype, void **ppval, EC_KEY * ec_key) | 79 | eckey_param2type(int *pptype, void **ppval, EC_KEY * ec_key) |
80 | { | 80 | { |
81 | const EC_GROUP *group; | 81 | const EC_GROUP *group; |
@@ -107,7 +107,7 @@ eckey_param2type(int *pptype, void **ppval, EC_KEY * ec_key) | |||
107 | return 1; | 107 | return 1; |
108 | } | 108 | } |
109 | 109 | ||
110 | static int | 110 | static int |
111 | eckey_pub_encode(X509_PUBKEY * pk, const EVP_PKEY * pkey) | 111 | eckey_pub_encode(X509_PUBKEY * pk, const EVP_PKEY * pkey) |
112 | { | 112 | { |
113 | EC_KEY *ec_key = pkey->pkey.ec; | 113 | EC_KEY *ec_key = pkey->pkey.ec; |
@@ -190,7 +190,7 @@ eckey_type2param(int ptype, const void *pval) | |||
190 | return NULL; | 190 | return NULL; |
191 | } | 191 | } |
192 | 192 | ||
193 | static int | 193 | static int |
194 | eckey_pub_decode(EVP_PKEY * pkey, X509_PUBKEY * pubkey) | 194 | eckey_pub_decode(EVP_PKEY * pkey, X509_PUBKEY * pubkey) |
195 | { | 195 | { |
196 | const unsigned char *p = NULL; | 196 | const unsigned char *p = NULL; |
@@ -223,7 +223,7 @@ eckey_pub_decode(EVP_PKEY * pkey, X509_PUBKEY * pubkey) | |||
223 | return 0; | 223 | return 0; |
224 | } | 224 | } |
225 | 225 | ||
226 | static int | 226 | static int |
227 | eckey_pub_cmp(const EVP_PKEY * a, const EVP_PKEY * b) | 227 | eckey_pub_cmp(const EVP_PKEY * a, const EVP_PKEY * b) |
228 | { | 228 | { |
229 | int r; | 229 | int r; |
@@ -238,7 +238,7 @@ eckey_pub_cmp(const EVP_PKEY * a, const EVP_PKEY * b) | |||
238 | return -2; | 238 | return -2; |
239 | } | 239 | } |
240 | 240 | ||
241 | static int | 241 | static int |
242 | eckey_priv_decode(EVP_PKEY * pkey, const PKCS8_PRIV_KEY_INFO * p8) | 242 | eckey_priv_decode(EVP_PKEY * pkey, const PKCS8_PRIV_KEY_INFO * p8) |
243 | { | 243 | { |
244 | const unsigned char *p = NULL; | 244 | const unsigned char *p = NULL; |
@@ -305,7 +305,7 @@ eckey_priv_decode(EVP_PKEY * pkey, const PKCS8_PRIV_KEY_INFO * p8) | |||
305 | return 0; | 305 | return 0; |
306 | } | 306 | } |
307 | 307 | ||
308 | static int | 308 | static int |
309 | eckey_priv_encode(PKCS8_PRIV_KEY_INFO * p8, const EVP_PKEY * pkey) | 309 | eckey_priv_encode(PKCS8_PRIV_KEY_INFO * p8, const EVP_PKEY * pkey) |
310 | { | 310 | { |
311 | EC_KEY *ec_key; | 311 | EC_KEY *ec_key; |
@@ -358,13 +358,13 @@ eckey_priv_encode(PKCS8_PRIV_KEY_INFO * p8, const EVP_PKEY * pkey) | |||
358 | return 1; | 358 | return 1; |
359 | } | 359 | } |
360 | 360 | ||
361 | static int | 361 | static int |
362 | int_ec_size(const EVP_PKEY * pkey) | 362 | int_ec_size(const EVP_PKEY * pkey) |
363 | { | 363 | { |
364 | return ECDSA_size(pkey->pkey.ec); | 364 | return ECDSA_size(pkey->pkey.ec); |
365 | } | 365 | } |
366 | 366 | ||
367 | static int | 367 | static int |
368 | ec_bits(const EVP_PKEY * pkey) | 368 | ec_bits(const EVP_PKEY * pkey) |
369 | { | 369 | { |
370 | BIGNUM *order = BN_new(); | 370 | BIGNUM *order = BN_new(); |
@@ -405,7 +405,7 @@ ec_security_bits(const EVP_PKEY *pkey) | |||
405 | return ecbits / 2; | 405 | return ecbits / 2; |
406 | } | 406 | } |
407 | 407 | ||
408 | static int | 408 | static int |
409 | ec_missing_parameters(const EVP_PKEY * pkey) | 409 | ec_missing_parameters(const EVP_PKEY * pkey) |
410 | { | 410 | { |
411 | if (EC_KEY_get0_group(pkey->pkey.ec) == NULL) | 411 | if (EC_KEY_get0_group(pkey->pkey.ec) == NULL) |
@@ -413,13 +413,13 @@ ec_missing_parameters(const EVP_PKEY * pkey) | |||
413 | return 0; | 413 | return 0; |
414 | } | 414 | } |
415 | 415 | ||
416 | static int | 416 | static int |
417 | ec_copy_parameters(EVP_PKEY * to, const EVP_PKEY * from) | 417 | ec_copy_parameters(EVP_PKEY * to, const EVP_PKEY * from) |
418 | { | 418 | { |
419 | return EC_KEY_set_group(to->pkey.ec, EC_KEY_get0_group(from->pkey.ec)); | 419 | return EC_KEY_set_group(to->pkey.ec, EC_KEY_get0_group(from->pkey.ec)); |
420 | } | 420 | } |
421 | 421 | ||
422 | static int | 422 | static int |
423 | ec_cmp_parameters(const EVP_PKEY * a, const EVP_PKEY * b) | 423 | ec_cmp_parameters(const EVP_PKEY * a, const EVP_PKEY * b) |
424 | { | 424 | { |
425 | const EC_GROUP *group_a = EC_KEY_get0_group(a->pkey.ec), *group_b = EC_KEY_get0_group(b->pkey.ec); | 425 | const EC_GROUP *group_a = EC_KEY_get0_group(a->pkey.ec), *group_b = EC_KEY_get0_group(b->pkey.ec); |
@@ -429,13 +429,13 @@ ec_cmp_parameters(const EVP_PKEY * a, const EVP_PKEY * b) | |||
429 | return 1; | 429 | return 1; |
430 | } | 430 | } |
431 | 431 | ||
432 | static void | 432 | static void |
433 | int_ec_free(EVP_PKEY * pkey) | 433 | int_ec_free(EVP_PKEY * pkey) |
434 | { | 434 | { |
435 | EC_KEY_free(pkey->pkey.ec); | 435 | EC_KEY_free(pkey->pkey.ec); |
436 | } | 436 | } |
437 | 437 | ||
438 | static int | 438 | static int |
439 | do_EC_KEY_print(BIO * bp, const EC_KEY * x, int off, int ktype) | 439 | do_EC_KEY_print(BIO * bp, const EC_KEY * x, int off, int ktype) |
440 | { | 440 | { |
441 | unsigned char *buffer = NULL; | 441 | unsigned char *buffer = NULL; |
@@ -519,7 +519,7 @@ do_EC_KEY_print(BIO * bp, const EC_KEY * x, int off, int ktype) | |||
519 | return (ret); | 519 | return (ret); |
520 | } | 520 | } |
521 | 521 | ||
522 | static int | 522 | static int |
523 | eckey_param_decode(EVP_PKEY * pkey, | 523 | eckey_param_decode(EVP_PKEY * pkey, |
524 | const unsigned char **pder, int derlen) | 524 | const unsigned char **pder, int derlen) |
525 | { | 525 | { |
@@ -532,20 +532,20 @@ eckey_param_decode(EVP_PKEY * pkey, | |||
532 | return 1; | 532 | return 1; |
533 | } | 533 | } |
534 | 534 | ||
535 | static int | 535 | static int |
536 | eckey_param_encode(const EVP_PKEY * pkey, unsigned char **pder) | 536 | eckey_param_encode(const EVP_PKEY * pkey, unsigned char **pder) |
537 | { | 537 | { |
538 | return i2d_ECParameters(pkey->pkey.ec, pder); | 538 | return i2d_ECParameters(pkey->pkey.ec, pder); |
539 | } | 539 | } |
540 | 540 | ||
541 | static int | 541 | static int |
542 | eckey_param_print(BIO * bp, const EVP_PKEY * pkey, int indent, | 542 | eckey_param_print(BIO * bp, const EVP_PKEY * pkey, int indent, |
543 | ASN1_PCTX * ctx) | 543 | ASN1_PCTX * ctx) |
544 | { | 544 | { |
545 | return do_EC_KEY_print(bp, pkey->pkey.ec, indent, 0); | 545 | return do_EC_KEY_print(bp, pkey->pkey.ec, indent, 0); |
546 | } | 546 | } |
547 | 547 | ||
548 | static int | 548 | static int |
549 | eckey_pub_print(BIO * bp, const EVP_PKEY * pkey, int indent, | 549 | eckey_pub_print(BIO * bp, const EVP_PKEY * pkey, int indent, |
550 | ASN1_PCTX * ctx) | 550 | ASN1_PCTX * ctx) |
551 | { | 551 | { |
@@ -553,14 +553,14 @@ eckey_pub_print(BIO * bp, const EVP_PKEY * pkey, int indent, | |||
553 | } | 553 | } |
554 | 554 | ||
555 | 555 | ||
556 | static int | 556 | static int |
557 | eckey_priv_print(BIO * bp, const EVP_PKEY * pkey, int indent, | 557 | eckey_priv_print(BIO * bp, const EVP_PKEY * pkey, int indent, |
558 | ASN1_PCTX * ctx) | 558 | ASN1_PCTX * ctx) |
559 | { | 559 | { |
560 | return do_EC_KEY_print(bp, pkey->pkey.ec, indent, 2); | 560 | return do_EC_KEY_print(bp, pkey->pkey.ec, indent, 2); |
561 | } | 561 | } |
562 | 562 | ||
563 | static int | 563 | static int |
564 | old_ec_priv_decode(EVP_PKEY * pkey, | 564 | old_ec_priv_decode(EVP_PKEY * pkey, |
565 | const unsigned char **pder, int derlen) | 565 | const unsigned char **pder, int derlen) |
566 | { | 566 | { |
@@ -573,13 +573,13 @@ old_ec_priv_decode(EVP_PKEY * pkey, | |||
573 | return 1; | 573 | return 1; |
574 | } | 574 | } |
575 | 575 | ||
576 | static int | 576 | static int |
577 | old_ec_priv_encode(const EVP_PKEY * pkey, unsigned char **pder) | 577 | old_ec_priv_encode(const EVP_PKEY * pkey, unsigned char **pder) |
578 | { | 578 | { |
579 | return i2d_ECPrivateKey(pkey->pkey.ec, pder); | 579 | return i2d_ECPrivateKey(pkey->pkey.ec, pder); |
580 | } | 580 | } |
581 | 581 | ||
582 | static int | 582 | static int |
583 | ec_pkey_ctrl(EVP_PKEY * pkey, int op, long arg1, void *arg2) | 583 | ec_pkey_ctrl(EVP_PKEY * pkey, int op, long arg1, void *arg2) |
584 | { | 584 | { |
585 | switch (op) { | 585 | switch (op) { |
diff --git a/src/lib/libcrypto/ec/ec_asn1.c b/src/lib/libcrypto/ec/ec_asn1.c index 6bf7e47d7d..baa58b5183 100644 --- a/src/lib/libcrypto/ec/ec_asn1.c +++ b/src/lib/libcrypto/ec/ec_asn1.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_asn1.c,v 1.37 2022/05/24 20:06:32 tb Exp $ */ | 1 | /* $OpenBSD: ec_asn1.c,v 1.38 2022/11/19 07:00:57 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -67,7 +67,7 @@ | |||
67 | #include "asn1_locl.h" | 67 | #include "asn1_locl.h" |
68 | #include "ec_lcl.h" | 68 | #include "ec_lcl.h" |
69 | 69 | ||
70 | int | 70 | int |
71 | EC_GROUP_get_basis_type(const EC_GROUP * group) | 71 | EC_GROUP_get_basis_type(const EC_GROUP * group) |
72 | { | 72 | { |
73 | int i = 0; | 73 | int i = 0; |
@@ -90,7 +90,7 @@ EC_GROUP_get_basis_type(const EC_GROUP * group) | |||
90 | } | 90 | } |
91 | 91 | ||
92 | #ifndef OPENSSL_NO_EC2M | 92 | #ifndef OPENSSL_NO_EC2M |
93 | int | 93 | int |
94 | EC_GROUP_get_trinomial_basis(const EC_GROUP * group, unsigned int *k) | 94 | EC_GROUP_get_trinomial_basis(const EC_GROUP * group, unsigned int *k) |
95 | { | 95 | { |
96 | if (group == NULL) | 96 | if (group == NULL) |
@@ -108,7 +108,7 @@ EC_GROUP_get_trinomial_basis(const EC_GROUP * group, unsigned int *k) | |||
108 | return 1; | 108 | return 1; |
109 | } | 109 | } |
110 | 110 | ||
111 | int | 111 | int |
112 | EC_GROUP_get_pentanomial_basis(const EC_GROUP * group, unsigned int *k1, | 112 | EC_GROUP_get_pentanomial_basis(const EC_GROUP * group, unsigned int *k1, |
113 | unsigned int *k2, unsigned int *k3) | 113 | unsigned int *k2, unsigned int *k3) |
114 | { | 114 | { |
@@ -268,7 +268,7 @@ static const ASN1_ADB_TABLE X9_62_CHARACTERISTIC_TWO_adbtbl[] = { | |||
268 | .field_name = "p.onBasis", | 268 | .field_name = "p.onBasis", |
269 | .item = &ASN1_NULL_it, | 269 | .item = &ASN1_NULL_it, |
270 | }, | 270 | }, |
271 | 271 | ||
272 | }, | 272 | }, |
273 | { | 273 | { |
274 | .value = NID_X9_62_tpBasis, | 274 | .value = NID_X9_62_tpBasis, |
@@ -279,7 +279,7 @@ static const ASN1_ADB_TABLE X9_62_CHARACTERISTIC_TWO_adbtbl[] = { | |||
279 | .field_name = "p.tpBasis", | 279 | .field_name = "p.tpBasis", |
280 | .item = &ASN1_INTEGER_it, | 280 | .item = &ASN1_INTEGER_it, |
281 | }, | 281 | }, |
282 | 282 | ||
283 | }, | 283 | }, |
284 | { | 284 | { |
285 | .value = NID_X9_62_ppBasis, | 285 | .value = NID_X9_62_ppBasis, |
@@ -290,7 +290,7 @@ static const ASN1_ADB_TABLE X9_62_CHARACTERISTIC_TWO_adbtbl[] = { | |||
290 | .field_name = "p.ppBasis", | 290 | .field_name = "p.ppBasis", |
291 | .item = &X9_62_PENTANOMIAL_it, | 291 | .item = &X9_62_PENTANOMIAL_it, |
292 | }, | 292 | }, |
293 | 293 | ||
294 | }, | 294 | }, |
295 | }; | 295 | }; |
296 | 296 | ||
@@ -370,7 +370,7 @@ static const ASN1_ADB_TABLE X9_62_FIELDID_adbtbl[] = { | |||
370 | .field_name = "p.prime", | 370 | .field_name = "p.prime", |
371 | .item = &ASN1_INTEGER_it, | 371 | .item = &ASN1_INTEGER_it, |
372 | }, | 372 | }, |
373 | 373 | ||
374 | }, | 374 | }, |
375 | { | 375 | { |
376 | .value = NID_X9_62_characteristic_two_field, | 376 | .value = NID_X9_62_characteristic_two_field, |
@@ -381,7 +381,7 @@ static const ASN1_ADB_TABLE X9_62_FIELDID_adbtbl[] = { | |||
381 | .field_name = "p.char_two", | 381 | .field_name = "p.char_two", |
382 | .item = &X9_62_CHARACTERISTIC_TWO_it, | 382 | .item = &X9_62_CHARACTERISTIC_TWO_it, |
383 | }, | 383 | }, |
384 | 384 | ||
385 | }, | 385 | }, |
386 | }; | 386 | }; |
387 | 387 | ||
@@ -798,7 +798,7 @@ ec_asn1_group2fieldid(const EC_GROUP * group, X9_62_FIELDID * field) | |||
798 | return (ok); | 798 | return (ok); |
799 | } | 799 | } |
800 | 800 | ||
801 | static int | 801 | static int |
802 | ec_asn1_group2curve(const EC_GROUP * group, X9_62_CURVE * curve) | 802 | ec_asn1_group2curve(const EC_GROUP * group, X9_62_CURVE * curve) |
803 | { | 803 | { |
804 | BIGNUM *tmp_1 = NULL, *tmp_2 = NULL; | 804 | BIGNUM *tmp_1 = NULL, *tmp_2 = NULL; |
@@ -1308,7 +1308,7 @@ d2i_ECPKParameters(EC_GROUP ** a, const unsigned char **in, long len) | |||
1308 | return (group); | 1308 | return (group); |
1309 | } | 1309 | } |
1310 | 1310 | ||
1311 | int | 1311 | int |
1312 | i2d_ECPKParameters(const EC_GROUP * a, unsigned char **out) | 1312 | i2d_ECPKParameters(const EC_GROUP * a, unsigned char **out) |
1313 | { | 1313 | { |
1314 | int ret = 0; | 1314 | int ret = 0; |
@@ -1420,7 +1420,7 @@ d2i_ECPrivateKey(EC_KEY ** a, const unsigned char **in, long len) | |||
1420 | return (NULL); | 1420 | return (NULL); |
1421 | } | 1421 | } |
1422 | 1422 | ||
1423 | int | 1423 | int |
1424 | i2d_ECPrivateKey(EC_KEY * a, unsigned char **out) | 1424 | i2d_ECPrivateKey(EC_KEY * a, unsigned char **out) |
1425 | { | 1425 | { |
1426 | int ret = 0, ok = 0; | 1426 | int ret = 0, ok = 0; |
@@ -1504,7 +1504,7 @@ i2d_ECPrivateKey(EC_KEY * a, unsigned char **out) | |||
1504 | return (ok ? ret : 0); | 1504 | return (ok ? ret : 0); |
1505 | } | 1505 | } |
1506 | 1506 | ||
1507 | int | 1507 | int |
1508 | i2d_ECParameters(EC_KEY * a, unsigned char **out) | 1508 | i2d_ECParameters(EC_KEY * a, unsigned char **out) |
1509 | { | 1509 | { |
1510 | if (a == NULL) { | 1510 | if (a == NULL) { |
@@ -1569,7 +1569,7 @@ o2i_ECPublicKey(EC_KEY ** a, const unsigned char **in, long len) | |||
1569 | return ret; | 1569 | return ret; |
1570 | } | 1570 | } |
1571 | 1571 | ||
1572 | int | 1572 | int |
1573 | i2o_ECPublicKey(const EC_KEY * a, unsigned char **out) | 1573 | i2o_ECPublicKey(const EC_KEY * a, unsigned char **out) |
1574 | { | 1574 | { |
1575 | size_t buf_len = 0; | 1575 | size_t buf_len = 0; |
diff --git a/src/lib/libcrypto/ec/ec_check.c b/src/lib/libcrypto/ec/ec_check.c index dcca661674..3f6a802374 100644 --- a/src/lib/libcrypto/ec/ec_check.c +++ b/src/lib/libcrypto/ec/ec_check.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_check.c,v 1.9 2018/07/15 16:27:39 tb Exp $ */ | 1 | /* $OpenBSD: ec_check.c,v 1.10 2022/11/19 07:00:57 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -56,7 +56,7 @@ | |||
56 | #include "ec_lcl.h" | 56 | #include "ec_lcl.h" |
57 | #include <openssl/err.h> | 57 | #include <openssl/err.h> |
58 | 58 | ||
59 | int | 59 | int |
60 | EC_GROUP_check(const EC_GROUP * group, BN_CTX * ctx) | 60 | EC_GROUP_check(const EC_GROUP * group, BN_CTX * ctx) |
61 | { | 61 | { |
62 | int ret = 0; | 62 | int ret = 0; |
diff --git a/src/lib/libcrypto/ec/ec_curve.c b/src/lib/libcrypto/ec/ec_curve.c index 09f8cfe9d8..1f69d4f1dc 100644 --- a/src/lib/libcrypto/ec/ec_curve.c +++ b/src/lib/libcrypto/ec/ec_curve.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_curve.c,v 1.22 2022/06/30 11:14:47 tb Exp $ */ | 1 | /* $OpenBSD: ec_curve.c,v 1.23 2022/11/19 07:00:57 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -3433,7 +3433,7 @@ EC_GROUP_new_by_curve_name(int nid) | |||
3433 | return ret; | 3433 | return ret; |
3434 | } | 3434 | } |
3435 | 3435 | ||
3436 | size_t | 3436 | size_t |
3437 | EC_get_builtin_curves(EC_builtin_curve * r, size_t nitems) | 3437 | EC_get_builtin_curves(EC_builtin_curve * r, size_t nitems) |
3438 | { | 3438 | { |
3439 | size_t i, min; | 3439 | size_t i, min; |
diff --git a/src/lib/libcrypto/ec/ec_err.c b/src/lib/libcrypto/ec/ec_err.c index 2ff8e9974e..be6a284599 100644 --- a/src/lib/libcrypto/ec/ec_err.c +++ b/src/lib/libcrypto/ec/ec_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_err.c,v 1.14 2022/11/10 16:37:52 jsing Exp $ */ | 1 | /* $OpenBSD: ec_err.c,v 1.15 2022/11/19 07:00:57 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -131,7 +131,7 @@ static ERR_STRING_DATA EC_str_reasons[] = | |||
131 | 131 | ||
132 | #endif | 132 | #endif |
133 | 133 | ||
134 | void | 134 | void |
135 | ERR_load_EC_strings(void) | 135 | ERR_load_EC_strings(void) |
136 | { | 136 | { |
137 | #ifndef OPENSSL_NO_ERR | 137 | #ifndef OPENSSL_NO_ERR |
diff --git a/src/lib/libcrypto/ec/ec_key.c b/src/lib/libcrypto/ec/ec_key.c index 27b8f26608..3aa6a96eb8 100644 --- a/src/lib/libcrypto/ec/ec_key.c +++ b/src/lib/libcrypto/ec/ec_key.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_key.c,v 1.26 2021/04/20 17:23:37 tb Exp $ */ | 1 | /* $OpenBSD: ec_key.c,v 1.27 2022/11/19 07:00:57 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -98,7 +98,7 @@ EC_KEY_new_by_curve_name(int nid) | |||
98 | return ret; | 98 | return ret; |
99 | } | 99 | } |
100 | 100 | ||
101 | void | 101 | void |
102 | EC_KEY_free(EC_KEY * r) | 102 | EC_KEY_free(EC_KEY * r) |
103 | { | 103 | { |
104 | int i; | 104 | int i; |
@@ -228,7 +228,7 @@ EC_KEY_dup(const EC_KEY * ec_key) | |||
228 | return ret; | 228 | return ret; |
229 | } | 229 | } |
230 | 230 | ||
231 | int | 231 | int |
232 | EC_KEY_up_ref(EC_KEY * r) | 232 | EC_KEY_up_ref(EC_KEY * r) |
233 | { | 233 | { |
234 | int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_EC); | 234 | int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_EC); |
@@ -308,7 +308,7 @@ ossl_ec_key_gen(EC_KEY *eckey) | |||
308 | return (ok); | 308 | return (ok); |
309 | } | 309 | } |
310 | 310 | ||
311 | int | 311 | int |
312 | EC_KEY_check_key(const EC_KEY * eckey) | 312 | EC_KEY_check_key(const EC_KEY * eckey) |
313 | { | 313 | { |
314 | int ok = 0; | 314 | int ok = 0; |
@@ -375,7 +375,7 @@ EC_KEY_check_key(const EC_KEY * eckey) | |||
375 | return (ok); | 375 | return (ok); |
376 | } | 376 | } |
377 | 377 | ||
378 | int | 378 | int |
379 | EC_KEY_set_public_key_affine_coordinates(EC_KEY * key, BIGNUM * x, BIGNUM * y) | 379 | EC_KEY_set_public_key_affine_coordinates(EC_KEY * key, BIGNUM * x, BIGNUM * y) |
380 | { | 380 | { |
381 | BN_CTX *ctx = NULL; | 381 | BN_CTX *ctx = NULL; |
@@ -434,7 +434,7 @@ EC_KEY_get0_group(const EC_KEY * key) | |||
434 | return key->group; | 434 | return key->group; |
435 | } | 435 | } |
436 | 436 | ||
437 | int | 437 | int |
438 | EC_KEY_set_group(EC_KEY * key, const EC_GROUP * group) | 438 | EC_KEY_set_group(EC_KEY * key, const EC_GROUP * group) |
439 | { | 439 | { |
440 | if (key->meth->set_group != NULL && | 440 | if (key->meth->set_group != NULL && |
@@ -451,7 +451,7 @@ EC_KEY_get0_private_key(const EC_KEY * key) | |||
451 | return key->priv_key; | 451 | return key->priv_key; |
452 | } | 452 | } |
453 | 453 | ||
454 | int | 454 | int |
455 | EC_KEY_set_private_key(EC_KEY * key, const BIGNUM * priv_key) | 455 | EC_KEY_set_private_key(EC_KEY * key, const BIGNUM * priv_key) |
456 | { | 456 | { |
457 | if (key->meth->set_private != NULL && | 457 | if (key->meth->set_private != NULL && |
@@ -468,7 +468,7 @@ EC_KEY_get0_public_key(const EC_KEY * key) | |||
468 | return key->pub_key; | 468 | return key->pub_key; |
469 | } | 469 | } |
470 | 470 | ||
471 | int | 471 | int |
472 | EC_KEY_set_public_key(EC_KEY * key, const EC_POINT * pub_key) | 472 | EC_KEY_set_public_key(EC_KEY * key, const EC_POINT * pub_key) |
473 | { | 473 | { |
474 | if (key->meth->set_public != NULL && | 474 | if (key->meth->set_public != NULL && |
@@ -479,25 +479,25 @@ EC_KEY_set_public_key(EC_KEY * key, const EC_POINT * pub_key) | |||
479 | return (key->pub_key == NULL) ? 0 : 1; | 479 | return (key->pub_key == NULL) ? 0 : 1; |
480 | } | 480 | } |
481 | 481 | ||
482 | unsigned int | 482 | unsigned int |
483 | EC_KEY_get_enc_flags(const EC_KEY * key) | 483 | EC_KEY_get_enc_flags(const EC_KEY * key) |
484 | { | 484 | { |
485 | return key->enc_flag; | 485 | return key->enc_flag; |
486 | } | 486 | } |
487 | 487 | ||
488 | void | 488 | void |
489 | EC_KEY_set_enc_flags(EC_KEY * key, unsigned int flags) | 489 | EC_KEY_set_enc_flags(EC_KEY * key, unsigned int flags) |
490 | { | 490 | { |
491 | key->enc_flag = flags; | 491 | key->enc_flag = flags; |
492 | } | 492 | } |
493 | 493 | ||
494 | point_conversion_form_t | 494 | point_conversion_form_t |
495 | EC_KEY_get_conv_form(const EC_KEY * key) | 495 | EC_KEY_get_conv_form(const EC_KEY * key) |
496 | { | 496 | { |
497 | return key->conv_form; | 497 | return key->conv_form; |
498 | } | 498 | } |
499 | 499 | ||
500 | void | 500 | void |
501 | EC_KEY_set_conv_form(EC_KEY * key, point_conversion_form_t cform) | 501 | EC_KEY_set_conv_form(EC_KEY * key, point_conversion_form_t cform) |
502 | { | 502 | { |
503 | key->conv_form = cform; | 503 | key->conv_form = cform; |
@@ -537,14 +537,14 @@ EC_KEY_insert_key_method_data(EC_KEY * key, void *data, | |||
537 | return ex_data; | 537 | return ex_data; |
538 | } | 538 | } |
539 | 539 | ||
540 | void | 540 | void |
541 | EC_KEY_set_asn1_flag(EC_KEY * key, int flag) | 541 | EC_KEY_set_asn1_flag(EC_KEY * key, int flag) |
542 | { | 542 | { |
543 | if (key->group != NULL) | 543 | if (key->group != NULL) |
544 | EC_GROUP_set_asn1_flag(key->group, flag); | 544 | EC_GROUP_set_asn1_flag(key->group, flag); |
545 | } | 545 | } |
546 | 546 | ||
547 | int | 547 | int |
548 | EC_KEY_precompute_mult(EC_KEY * key, BN_CTX * ctx) | 548 | EC_KEY_precompute_mult(EC_KEY * key, BN_CTX * ctx) |
549 | { | 549 | { |
550 | if (key->group == NULL) | 550 | if (key->group == NULL) |
@@ -552,19 +552,19 @@ EC_KEY_precompute_mult(EC_KEY * key, BN_CTX * ctx) | |||
552 | return EC_GROUP_precompute_mult(key->group, ctx); | 552 | return EC_GROUP_precompute_mult(key->group, ctx); |
553 | } | 553 | } |
554 | 554 | ||
555 | int | 555 | int |
556 | EC_KEY_get_flags(const EC_KEY * key) | 556 | EC_KEY_get_flags(const EC_KEY * key) |
557 | { | 557 | { |
558 | return key->flags; | 558 | return key->flags; |
559 | } | 559 | } |
560 | 560 | ||
561 | void | 561 | void |
562 | EC_KEY_set_flags(EC_KEY * key, int flags) | 562 | EC_KEY_set_flags(EC_KEY * key, int flags) |
563 | { | 563 | { |
564 | key->flags |= flags; | 564 | key->flags |= flags; |
565 | } | 565 | } |
566 | 566 | ||
567 | void | 567 | void |
568 | EC_KEY_clear_flags(EC_KEY * key, int flags) | 568 | EC_KEY_clear_flags(EC_KEY * key, int flags) |
569 | { | 569 | { |
570 | key->flags &= ~flags; | 570 | key->flags &= ~flags; |
diff --git a/src/lib/libcrypto/ec/ec_mult.c b/src/lib/libcrypto/ec/ec_mult.c index 05f89a5787..1198a6f6b1 100644 --- a/src/lib/libcrypto/ec/ec_mult.c +++ b/src/lib/libcrypto/ec/ec_mult.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_mult.c,v 1.24 2018/07/15 16:27:39 tb Exp $ */ | 1 | /* $OpenBSD: ec_mult.c,v 1.25 2022/11/19 07:00:57 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Originally written by Bodo Moeller and Nils Larsch for the OpenSSL project. | 3 | * Originally written by Bodo Moeller and Nils Larsch for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -132,7 +132,7 @@ ec_pre_comp_dup(void *src_) | |||
132 | return src_; | 132 | return src_; |
133 | } | 133 | } |
134 | 134 | ||
135 | static void | 135 | static void |
136 | ec_pre_comp_free(void *pre_) | 136 | ec_pre_comp_free(void *pre_) |
137 | { | 137 | { |
138 | int i; | 138 | int i; |
@@ -155,7 +155,7 @@ ec_pre_comp_free(void *pre_) | |||
155 | free(pre); | 155 | free(pre); |
156 | } | 156 | } |
157 | 157 | ||
158 | static void | 158 | static void |
159 | ec_pre_comp_clear_free(void *pre_) | 159 | ec_pre_comp_clear_free(void *pre_) |
160 | { | 160 | { |
161 | int i; | 161 | int i; |
@@ -331,7 +331,7 @@ compute_wNAF(const BIGNUM * scalar, int w, size_t * ret_len) | |||
331 | * scalar*generator | 331 | * scalar*generator |
332 | * in the addition if scalar != NULL | 332 | * in the addition if scalar != NULL |
333 | */ | 333 | */ |
334 | int | 334 | int |
335 | ec_wNAF_mul(const EC_GROUP * group, EC_POINT * r, const BIGNUM * scalar, | 335 | ec_wNAF_mul(const EC_GROUP * group, EC_POINT * r, const BIGNUM * scalar, |
336 | size_t num, const EC_POINT * points[], const BIGNUM * scalars[], BN_CTX * ctx) | 336 | size_t num, const EC_POINT * points[], const BIGNUM * scalars[], BN_CTX * ctx) |
337 | { | 337 | { |
@@ -721,7 +721,7 @@ ec_wNAF_mul(const EC_GROUP * group, EC_POINT * r, const BIGNUM * scalar, | |||
721 | * points[2^(w-1)*numblocks-1] = (2^(w-1)) * 2^(blocksize*(numblocks-1)) * generator | 721 | * points[2^(w-1)*numblocks-1] = (2^(w-1)) * 2^(blocksize*(numblocks-1)) * generator |
722 | * points[2^(w-1)*numblocks] = NULL | 722 | * points[2^(w-1)*numblocks] = NULL |
723 | */ | 723 | */ |
724 | int | 724 | int |
725 | ec_wNAF_precompute_mult(EC_GROUP * group, BN_CTX * ctx) | 725 | ec_wNAF_precompute_mult(EC_GROUP * group, BN_CTX * ctx) |
726 | { | 726 | { |
727 | const EC_POINT *generator; | 727 | const EC_POINT *generator; |
@@ -764,7 +764,7 @@ ec_wNAF_precompute_mult(EC_GROUP * group, BN_CTX * ctx) | |||
764 | /* | 764 | /* |
765 | * The following parameters mean we precompute (approximately) one | 765 | * The following parameters mean we precompute (approximately) one |
766 | * point per bit. | 766 | * point per bit. |
767 | * | 767 | * |
768 | * TBD: The combination 8, 4 is perfect for 160 bits; for other bit | 768 | * TBD: The combination 8, 4 is perfect for 160 bits; for other bit |
769 | * lengths, other parameter combinations might provide better | 769 | * lengths, other parameter combinations might provide better |
770 | * efficiency. | 770 | * efficiency. |
@@ -875,7 +875,7 @@ ec_wNAF_precompute_mult(EC_GROUP * group, BN_CTX * ctx) | |||
875 | } | 875 | } |
876 | 876 | ||
877 | 877 | ||
878 | int | 878 | int |
879 | ec_wNAF_have_precompute_mult(const EC_GROUP * group) | 879 | ec_wNAF_have_precompute_mult(const EC_GROUP * group) |
880 | { | 880 | { |
881 | if (EC_EX_DATA_get_data(group->extra_data, ec_pre_comp_dup, ec_pre_comp_free, ec_pre_comp_clear_free) != NULL) | 881 | if (EC_EX_DATA_get_data(group->extra_data, ec_pre_comp_dup, ec_pre_comp_free, ec_pre_comp_clear_free) != NULL) |
diff --git a/src/lib/libcrypto/ec/ec_pmeth.c b/src/lib/libcrypto/ec/ec_pmeth.c index 63e6359251..3637d6bba6 100644 --- a/src/lib/libcrypto/ec/ec_pmeth.c +++ b/src/lib/libcrypto/ec/ec_pmeth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_pmeth.c,v 1.13 2021/12/04 16:08:32 tb Exp $ */ | 1 | /* $OpenBSD: ec_pmeth.c,v 1.14 2022/11/19 07:00:57 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -93,7 +93,7 @@ typedef struct { | |||
93 | size_t kdf_outlen; | 93 | size_t kdf_outlen; |
94 | } EC_PKEY_CTX; | 94 | } EC_PKEY_CTX; |
95 | 95 | ||
96 | static int | 96 | static int |
97 | pkey_ec_init(EVP_PKEY_CTX * ctx) | 97 | pkey_ec_init(EVP_PKEY_CTX * ctx) |
98 | { | 98 | { |
99 | EC_PKEY_CTX *dctx; | 99 | EC_PKEY_CTX *dctx; |
@@ -111,7 +111,7 @@ pkey_ec_init(EVP_PKEY_CTX * ctx) | |||
111 | return 1; | 111 | return 1; |
112 | } | 112 | } |
113 | 113 | ||
114 | static int | 114 | static int |
115 | pkey_ec_copy(EVP_PKEY_CTX * dst, EVP_PKEY_CTX * src) | 115 | pkey_ec_copy(EVP_PKEY_CTX * dst, EVP_PKEY_CTX * src) |
116 | { | 116 | { |
117 | EC_PKEY_CTX *dctx, *sctx; | 117 | EC_PKEY_CTX *dctx, *sctx; |
@@ -146,7 +146,7 @@ pkey_ec_copy(EVP_PKEY_CTX * dst, EVP_PKEY_CTX * src) | |||
146 | return 1; | 146 | return 1; |
147 | } | 147 | } |
148 | 148 | ||
149 | static void | 149 | static void |
150 | pkey_ec_cleanup(EVP_PKEY_CTX * ctx) | 150 | pkey_ec_cleanup(EVP_PKEY_CTX * ctx) |
151 | { | 151 | { |
152 | EC_PKEY_CTX *dctx = ctx->data; | 152 | EC_PKEY_CTX *dctx = ctx->data; |
@@ -160,7 +160,7 @@ pkey_ec_cleanup(EVP_PKEY_CTX * ctx) | |||
160 | } | 160 | } |
161 | } | 161 | } |
162 | 162 | ||
163 | static int | 163 | static int |
164 | pkey_ec_sign(EVP_PKEY_CTX * ctx, unsigned char *sig, size_t * siglen, | 164 | pkey_ec_sign(EVP_PKEY_CTX * ctx, unsigned char *sig, size_t * siglen, |
165 | const unsigned char *tbs, size_t tbslen) | 165 | const unsigned char *tbs, size_t tbslen) |
166 | { | 166 | { |
@@ -188,7 +188,7 @@ pkey_ec_sign(EVP_PKEY_CTX * ctx, unsigned char *sig, size_t * siglen, | |||
188 | return 1; | 188 | return 1; |
189 | } | 189 | } |
190 | 190 | ||
191 | static int | 191 | static int |
192 | pkey_ec_verify(EVP_PKEY_CTX * ctx, | 192 | pkey_ec_verify(EVP_PKEY_CTX * ctx, |
193 | const unsigned char *sig, size_t siglen, | 193 | const unsigned char *sig, size_t siglen, |
194 | const unsigned char *tbs, size_t tbslen) | 194 | const unsigned char *tbs, size_t tbslen) |
@@ -207,7 +207,7 @@ pkey_ec_verify(EVP_PKEY_CTX * ctx, | |||
207 | return ret; | 207 | return ret; |
208 | } | 208 | } |
209 | 209 | ||
210 | static int | 210 | static int |
211 | pkey_ec_derive(EVP_PKEY_CTX * ctx, unsigned char *key, size_t * keylen) | 211 | pkey_ec_derive(EVP_PKEY_CTX * ctx, unsigned char *key, size_t * keylen) |
212 | { | 212 | { |
213 | int ret; | 213 | int ret; |
@@ -283,7 +283,7 @@ pkey_ec_kdf_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen) | |||
283 | return rv; | 283 | return rv; |
284 | } | 284 | } |
285 | 285 | ||
286 | static int | 286 | static int |
287 | pkey_ec_ctrl(EVP_PKEY_CTX * ctx, int type, int p1, void *p2) | 287 | pkey_ec_ctrl(EVP_PKEY_CTX * ctx, int type, int p1, void *p2) |
288 | { | 288 | { |
289 | EC_PKEY_CTX *dctx = ctx->data; | 289 | EC_PKEY_CTX *dctx = ctx->data; |
@@ -410,7 +410,7 @@ pkey_ec_ctrl(EVP_PKEY_CTX * ctx, int type, int p1, void *p2) | |||
410 | } | 410 | } |
411 | } | 411 | } |
412 | 412 | ||
413 | static int | 413 | static int |
414 | pkey_ec_ctrl_str(EVP_PKEY_CTX * ctx, const char *type, const char *value) | 414 | pkey_ec_ctrl_str(EVP_PKEY_CTX * ctx, const char *type, const char *value) |
415 | { | 415 | { |
416 | if (!strcmp(type, "ec_paramgen_curve")) { | 416 | if (!strcmp(type, "ec_paramgen_curve")) { |
@@ -449,7 +449,7 @@ pkey_ec_ctrl_str(EVP_PKEY_CTX * ctx, const char *type, const char *value) | |||
449 | return -2; | 449 | return -2; |
450 | } | 450 | } |
451 | 451 | ||
452 | static int | 452 | static int |
453 | pkey_ec_paramgen(EVP_PKEY_CTX * ctx, EVP_PKEY * pkey) | 453 | pkey_ec_paramgen(EVP_PKEY_CTX * ctx, EVP_PKEY * pkey) |
454 | { | 454 | { |
455 | EC_KEY *ec = NULL; | 455 | EC_KEY *ec = NULL; |
@@ -470,7 +470,7 @@ pkey_ec_paramgen(EVP_PKEY_CTX * ctx, EVP_PKEY * pkey) | |||
470 | return ret; | 470 | return ret; |
471 | } | 471 | } |
472 | 472 | ||
473 | static int | 473 | static int |
474 | pkey_ec_keygen(EVP_PKEY_CTX * ctx, EVP_PKEY * pkey) | 474 | pkey_ec_keygen(EVP_PKEY_CTX * ctx, EVP_PKEY * pkey) |
475 | { | 475 | { |
476 | EC_KEY *ec = NULL; | 476 | EC_KEY *ec = NULL; |
diff --git a/src/lib/libcrypto/ec/eck_prn.c b/src/lib/libcrypto/ec/eck_prn.c index 058ae57de5..14185c7605 100644 --- a/src/lib/libcrypto/ec/eck_prn.c +++ b/src/lib/libcrypto/ec/eck_prn.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: eck_prn.c,v 1.18 2022/11/10 12:37:00 tobhe Exp $ */ | 1 | /* $OpenBSD: eck_prn.c,v 1.19 2022/11/19 07:00:57 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -69,7 +69,7 @@ | |||
69 | #include <openssl/err.h> | 69 | #include <openssl/err.h> |
70 | #include <openssl/evp.h> | 70 | #include <openssl/evp.h> |
71 | 71 | ||
72 | int | 72 | int |
73 | ECPKParameters_print_fp(FILE * fp, const EC_GROUP * x, int off) | 73 | ECPKParameters_print_fp(FILE * fp, const EC_GROUP * x, int off) |
74 | { | 74 | { |
75 | BIO *b; | 75 | BIO *b; |
@@ -85,7 +85,7 @@ ECPKParameters_print_fp(FILE * fp, const EC_GROUP * x, int off) | |||
85 | return (ret); | 85 | return (ret); |
86 | } | 86 | } |
87 | 87 | ||
88 | int | 88 | int |
89 | EC_KEY_print_fp(FILE * fp, const EC_KEY * x, int off) | 89 | EC_KEY_print_fp(FILE * fp, const EC_KEY * x, int off) |
90 | { | 90 | { |
91 | BIO *b; | 91 | BIO *b; |
@@ -101,7 +101,7 @@ EC_KEY_print_fp(FILE * fp, const EC_KEY * x, int off) | |||
101 | return (ret); | 101 | return (ret); |
102 | } | 102 | } |
103 | 103 | ||
104 | int | 104 | int |
105 | ECParameters_print_fp(FILE * fp, const EC_KEY * x) | 105 | ECParameters_print_fp(FILE * fp, const EC_KEY * x) |
106 | { | 106 | { |
107 | BIO *b; | 107 | BIO *b; |
@@ -117,7 +117,7 @@ ECParameters_print_fp(FILE * fp, const EC_KEY * x) | |||
117 | return (ret); | 117 | return (ret); |
118 | } | 118 | } |
119 | 119 | ||
120 | int | 120 | int |
121 | EC_KEY_print(BIO * bp, const EC_KEY * x, int off) | 121 | EC_KEY_print(BIO * bp, const EC_KEY * x, int off) |
122 | { | 122 | { |
123 | EVP_PKEY *pk; | 123 | EVP_PKEY *pk; |
@@ -135,7 +135,7 @@ EC_KEY_print(BIO * bp, const EC_KEY * x, int off) | |||
135 | return ret; | 135 | return ret; |
136 | } | 136 | } |
137 | 137 | ||
138 | int | 138 | int |
139 | ECParameters_print(BIO * bp, const EC_KEY * x) | 139 | ECParameters_print(BIO * bp, const EC_KEY * x) |
140 | { | 140 | { |
141 | EVP_PKEY *pk; | 141 | EVP_PKEY *pk; |
@@ -153,11 +153,11 @@ ECParameters_print(BIO * bp, const EC_KEY * x) | |||
153 | return ret; | 153 | return ret; |
154 | } | 154 | } |
155 | 155 | ||
156 | static int | 156 | static int |
157 | print_bin(BIO * fp, const char *str, const unsigned char *num, | 157 | print_bin(BIO * fp, const char *str, const unsigned char *num, |
158 | size_t len, int off); | 158 | size_t len, int off); |
159 | 159 | ||
160 | int | 160 | int |
161 | ECPKParameters_print(BIO * bp, const EC_GROUP * x, int off) | 161 | ECPKParameters_print(BIO * bp, const EC_GROUP * x, int off) |
162 | { | 162 | { |
163 | unsigned char *buffer = NULL; | 163 | unsigned char *buffer = NULL; |
@@ -333,7 +333,7 @@ ECPKParameters_print(BIO * bp, const EC_GROUP * x, int off) | |||
333 | return (ret); | 333 | return (ret); |
334 | } | 334 | } |
335 | 335 | ||
336 | static int | 336 | static int |
337 | print_bin(BIO * fp, const char *name, const unsigned char *buf, | 337 | print_bin(BIO * fp, const char *name, const unsigned char *buf, |
338 | size_t len, int off) | 338 | size_t len, int off) |
339 | { | 339 | { |
diff --git a/src/lib/libcrypto/ec/ecp_nistputil.c b/src/lib/libcrypto/ec/ecp_nistputil.c index ca55b49ba2..fc4f9f5c26 100644 --- a/src/lib/libcrypto/ec/ecp_nistputil.c +++ b/src/lib/libcrypto/ec/ecp_nistputil.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_nistputil.c,v 1.6 2014/07/10 22:45:57 jsing Exp $ */ | 1 | /* $OpenBSD: ecp_nistputil.c,v 1.7 2022/11/19 07:00:57 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Bodo Moeller for the OpenSSL project. | 3 | * Written by Bodo Moeller for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -43,7 +43,7 @@ | |||
43 | * tmp_felems needs to point to a temporary array of 'num'+1 field elements | 43 | * tmp_felems needs to point to a temporary array of 'num'+1 field elements |
44 | * for storage of intermediate values. | 44 | * for storage of intermediate values. |
45 | */ | 45 | */ |
46 | void | 46 | void |
47 | ec_GFp_nistp_points_make_affine_internal(size_t num, void *point_array, | 47 | ec_GFp_nistp_points_make_affine_internal(size_t num, void *point_array, |
48 | size_t felem_size, void *tmp_felems, | 48 | size_t felem_size, void *tmp_felems, |
49 | void (*felem_one) (void *out), | 49 | void (*felem_one) (void *out), |
@@ -192,7 +192,7 @@ ec_GFp_nistp_points_make_affine_internal(size_t num, void *point_array, | |||
192 | * has to be b_4 b_3 b_2 b_1 b_0 0. | 192 | * has to be b_4 b_3 b_2 b_1 b_0 0. |
193 | * | 193 | * |
194 | */ | 194 | */ |
195 | void | 195 | void |
196 | ec_GFp_nistp_recode_scalar_bits(unsigned char *sign, unsigned char *digit, unsigned char in) | 196 | ec_GFp_nistp_recode_scalar_bits(unsigned char *sign, unsigned char *digit, unsigned char in) |
197 | { | 197 | { |
198 | unsigned char s, d; | 198 | unsigned char s, d; |
diff --git a/src/lib/libcrypto/ec/ecp_nistz256.c b/src/lib/libcrypto/ec/ecp_nistz256.c index dec7d31256..e4929b92bb 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.11 2022/08/29 06:08:03 jsg Exp $ */ | 1 | /* $OpenBSD: ecp_nistz256.c,v 1.12 2022/11/19 07:00:57 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 |
@@ -897,7 +897,7 @@ ecp_nistz256_points_mul(const EC_GROUP *group, EC_POINT *r, | |||
897 | */ | 897 | */ |
898 | BN_ULONG infty; | 898 | BN_ULONG infty; |
899 | infty = (p.p.X[0] | p.p.X[1] | p.p.X[2] | p.p.X[3] | | 899 | infty = (p.p.X[0] | p.p.X[1] | p.p.X[2] | p.p.X[3] | |
900 | p.p.Y[0] | p.p.Y[1] | p.p.Y[2] | p.p.Y[3]); | 900 | p.p.Y[0] | p.p.Y[1] | p.p.Y[2] | p.p.Y[3]); |
901 | if (P256_LIMBS == 8) | 901 | if (P256_LIMBS == 8) |
902 | infty |= | 902 | infty |= |
903 | (p.p.X[4] | p.p.X[5] | p.p.X[6] | p.p.X[7] | | 903 | (p.p.X[4] | p.p.X[5] | p.p.X[6] | p.p.X[7] | |
diff --git a/src/lib/libcrypto/ec/ecp_oct.c b/src/lib/libcrypto/ec/ecp_oct.c index 177bbe152e..1536b3ee90 100644 --- a/src/lib/libcrypto/ec/ecp_oct.c +++ b/src/lib/libcrypto/ec/ecp_oct.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_oct.c,v 1.14 2021/04/20 17:32:57 tb Exp $ */ | 1 | /* $OpenBSD: ecp_oct.c,v 1.15 2022/11/19 07:00:57 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. |
@@ -66,7 +66,7 @@ | |||
66 | 66 | ||
67 | #include "ec_lcl.h" | 67 | #include "ec_lcl.h" |
68 | 68 | ||
69 | int | 69 | int |
70 | ec_GFp_simple_set_compressed_coordinates(const EC_GROUP * group, | 70 | ec_GFp_simple_set_compressed_coordinates(const EC_GROUP * group, |
71 | EC_POINT * point, const BIGNUM * x_, int y_bit, BN_CTX * ctx) | 71 | EC_POINT * point, const BIGNUM * x_, int y_bit, BN_CTX * ctx) |
72 | { | 72 | { |
@@ -197,7 +197,7 @@ ec_GFp_simple_set_compressed_coordinates(const EC_GROUP * group, | |||
197 | } | 197 | } |
198 | 198 | ||
199 | 199 | ||
200 | size_t | 200 | size_t |
201 | ec_GFp_simple_point2oct(const EC_GROUP * group, const EC_POINT * point, point_conversion_form_t form, | 201 | ec_GFp_simple_point2oct(const EC_GROUP * group, const EC_POINT * point, point_conversion_form_t form, |
202 | unsigned char *buf, size_t len, BN_CTX * ctx) | 202 | unsigned char *buf, size_t len, BN_CTX * ctx) |
203 | { | 203 | { |
@@ -302,7 +302,7 @@ ec_GFp_simple_point2oct(const EC_GROUP * group, const EC_POINT * point, point_co | |||
302 | } | 302 | } |
303 | 303 | ||
304 | 304 | ||
305 | int | 305 | int |
306 | ec_GFp_simple_oct2point(const EC_GROUP * group, EC_POINT * point, | 306 | ec_GFp_simple_oct2point(const EC_GROUP * group, EC_POINT * point, |
307 | const unsigned char *buf, size_t len, BN_CTX * ctx) | 307 | const unsigned char *buf, size_t len, BN_CTX * ctx) |
308 | { | 308 | { |
diff --git a/src/lib/libcrypto/ec/ecp_smpl.c b/src/lib/libcrypto/ec/ecp_smpl.c index 6f5280bbc9..c9d73bd629 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.34 2022/01/20 11:02:44 inoguchi Exp $ */ | 1 | /* $OpenBSD: ecp_smpl.c,v 1.35 2022/11/19 07:00:57 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. |
@@ -1416,7 +1416,7 @@ ec_GFp_simple_field_sqr(const EC_GROUP * group, BIGNUM * r, const BIGNUM * a, BN | |||
1416 | /* | 1416 | /* |
1417 | * Apply randomization of EC point projective coordinates: | 1417 | * Apply randomization of EC point projective coordinates: |
1418 | * | 1418 | * |
1419 | * (X, Y, Z) = (lambda^2 * X, lambda^3 * Y, lambda * Z) | 1419 | * (X, Y, Z) = (lambda^2 * X, lambda^3 * Y, lambda * Z) |
1420 | * | 1420 | * |
1421 | * where lambda is in the interval [1, group->field). | 1421 | * where lambda is in the interval [1, group->field). |
1422 | */ | 1422 | */ |
@@ -1473,14 +1473,14 @@ ec_GFp_simple_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx) | |||
1473 | 1473 | ||
1474 | 1474 | ||
1475 | #define EC_POINT_BN_set_flags(P, flags) do { \ | 1475 | #define EC_POINT_BN_set_flags(P, flags) do { \ |
1476 | BN_set_flags(&(P)->X, (flags)); \ | 1476 | BN_set_flags(&(P)->X, (flags)); \ |
1477 | BN_set_flags(&(P)->Y, (flags)); \ | 1477 | BN_set_flags(&(P)->Y, (flags)); \ |
1478 | BN_set_flags(&(P)->Z, (flags)); \ | 1478 | BN_set_flags(&(P)->Z, (flags)); \ |
1479 | } while(0) | 1479 | } while(0) |
1480 | 1480 | ||
1481 | #define EC_POINT_CSWAP(c, a, b, w, t) do { \ | 1481 | #define EC_POINT_CSWAP(c, a, b, w, t) do { \ |
1482 | if (!BN_swap_ct(c, &(a)->X, &(b)->X, w) || \ | 1482 | if (!BN_swap_ct(c, &(a)->X, &(b)->X, w) || \ |
1483 | !BN_swap_ct(c, &(a)->Y, &(b)->Y, w) || \ | 1483 | !BN_swap_ct(c, &(a)->Y, &(b)->Y, w) || \ |
1484 | !BN_swap_ct(c, &(a)->Z, &(b)->Z, w)) \ | 1484 | !BN_swap_ct(c, &(a)->Z, &(b)->Z, w)) \ |
1485 | goto err; \ | 1485 | goto err; \ |
1486 | t = ((a)->Z_is_one ^ (b)->Z_is_one) & (c); \ | 1486 | t = ((a)->Z_is_one ^ (b)->Z_is_one) & (c); \ |
diff --git a/src/lib/libcrypto/ec/ecx_methods.c b/src/lib/libcrypto/ec/ecx_methods.c index 741cb2de6b..8829d8fdbc 100644 --- a/src/lib/libcrypto/ec/ecx_methods.c +++ b/src/lib/libcrypto/ec/ecx_methods.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecx_methods.c,v 1.1 2022/11/10 16:37:52 jsing Exp $ */ | 1 | /* $OpenBSD: ecx_methods.c,v 1.2 2022/11/19 07:00:57 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2022 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2022 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -676,7 +676,7 @@ ecx_item_verify(EVP_MD_CTX *md_ctx, const ASN1_ITEM *it, void *asn, | |||
676 | { | 676 | { |
677 | const ASN1_OBJECT *aobj; | 677 | const ASN1_OBJECT *aobj; |
678 | int nid, param_type; | 678 | int nid, param_type; |
679 | 679 | ||
680 | X509_ALGOR_get0(&aobj, ¶m_type, NULL, algor); | 680 | X509_ALGOR_get0(&aobj, ¶m_type, NULL, algor); |
681 | 681 | ||
682 | nid = OBJ_obj2nid(aobj); | 682 | nid = OBJ_obj2nid(aobj); |