diff options
author | tb <> | 2022-11-19 07:29:29 +0000 |
---|---|---|
committer | tb <> | 2022-11-19 07:29:29 +0000 |
commit | 97ff0b8011f923270c9adb50e24c2b4c4a533238 (patch) | |
tree | 744c8fadca050ecfeaa626562148788777b42d2f /src/lib/libcrypto/ec/ec_lib.c | |
parent | b197546e7fd8128aedea248a6196a0d25734b937 (diff) | |
download | openbsd-97ff0b8011f923270c9adb50e24c2b4c4a533238.tar.gz openbsd-97ff0b8011f923270c9adb50e24c2b4c4a533238.tar.bz2 openbsd-97ff0b8011f923270c9adb50e24c2b4c4a533238.zip |
Fix an annoying quirk in the EC code
Dealing with elliptic curves makes some people think that it would be kind
of neat to multiply types with variable names. Sometimes. Only in function
definitions.
Diffstat (limited to 'src/lib/libcrypto/ec/ec_lib.c')
-rw-r--r-- | src/lib/libcrypto/ec/ec_lib.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index 4ec17d5d5d..151e91b36c 100644 --- a/src/lib/libcrypto/ec/ec_lib.c +++ b/src/lib/libcrypto/ec/ec_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_lib.c,v 1.45 2022/04/07 17:37:25 tb Exp $ */ | 1 | /* $OpenBSD: ec_lib.c,v 1.46 2022/11/19 07:29:29 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -74,7 +74,7 @@ | |||
74 | /* functions for EC_GROUP objects */ | 74 | /* functions for EC_GROUP objects */ |
75 | 75 | ||
76 | EC_GROUP * | 76 | EC_GROUP * |
77 | EC_GROUP_new(const EC_METHOD * meth) | 77 | EC_GROUP_new(const EC_METHOD *meth) |
78 | { | 78 | { |
79 | EC_GROUP *ret; | 79 | EC_GROUP *ret; |
80 | 80 | ||
@@ -115,7 +115,7 @@ EC_GROUP_new(const EC_METHOD * meth) | |||
115 | 115 | ||
116 | 116 | ||
117 | void | 117 | void |
118 | EC_GROUP_free(EC_GROUP * group) | 118 | EC_GROUP_free(EC_GROUP *group) |
119 | { | 119 | { |
120 | if (!group) | 120 | if (!group) |
121 | return; | 121 | return; |
@@ -136,7 +136,7 @@ EC_GROUP_free(EC_GROUP * group) | |||
136 | 136 | ||
137 | 137 | ||
138 | void | 138 | void |
139 | EC_GROUP_clear_free(EC_GROUP * group) | 139 | EC_GROUP_clear_free(EC_GROUP *group) |
140 | { | 140 | { |
141 | if (!group) | 141 | if (!group) |
142 | return; | 142 | return; |
@@ -158,7 +158,7 @@ EC_GROUP_clear_free(EC_GROUP * group) | |||
158 | 158 | ||
159 | 159 | ||
160 | int | 160 | int |
161 | EC_GROUP_copy(EC_GROUP * dest, const EC_GROUP * src) | 161 | EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src) |
162 | { | 162 | { |
163 | EC_EXTRA_DATA *d; | 163 | EC_EXTRA_DATA *d; |
164 | 164 | ||
@@ -227,7 +227,7 @@ EC_GROUP_copy(EC_GROUP * dest, const EC_GROUP * src) | |||
227 | 227 | ||
228 | 228 | ||
229 | EC_GROUP * | 229 | EC_GROUP * |
230 | EC_GROUP_dup(const EC_GROUP * a) | 230 | EC_GROUP_dup(const EC_GROUP *a) |
231 | { | 231 | { |
232 | EC_GROUP *t = NULL; | 232 | EC_GROUP *t = NULL; |
233 | 233 | ||
@@ -428,35 +428,35 @@ EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX *ctx) | |||
428 | 428 | ||
429 | 429 | ||
430 | void | 430 | void |
431 | EC_GROUP_set_curve_name(EC_GROUP * group, int nid) | 431 | EC_GROUP_set_curve_name(EC_GROUP *group, int nid) |
432 | { | 432 | { |
433 | group->curve_name = nid; | 433 | group->curve_name = nid; |
434 | } | 434 | } |
435 | 435 | ||
436 | 436 | ||
437 | int | 437 | int |
438 | EC_GROUP_get_curve_name(const EC_GROUP * group) | 438 | EC_GROUP_get_curve_name(const EC_GROUP *group) |
439 | { | 439 | { |
440 | return group->curve_name; | 440 | return group->curve_name; |
441 | } | 441 | } |
442 | 442 | ||
443 | 443 | ||
444 | void | 444 | void |
445 | EC_GROUP_set_asn1_flag(EC_GROUP * group, int flag) | 445 | EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag) |
446 | { | 446 | { |
447 | group->asn1_flag = flag; | 447 | group->asn1_flag = flag; |
448 | } | 448 | } |
449 | 449 | ||
450 | 450 | ||
451 | int | 451 | int |
452 | EC_GROUP_get_asn1_flag(const EC_GROUP * group) | 452 | EC_GROUP_get_asn1_flag(const EC_GROUP *group) |
453 | { | 453 | { |
454 | return group->asn1_flag; | 454 | return group->asn1_flag; |
455 | } | 455 | } |
456 | 456 | ||
457 | 457 | ||
458 | void | 458 | void |
459 | EC_GROUP_set_point_conversion_form(EC_GROUP * group, | 459 | EC_GROUP_set_point_conversion_form(EC_GROUP *group, |
460 | point_conversion_form_t form) | 460 | point_conversion_form_t form) |
461 | { | 461 | { |
462 | group->asn1_form = form; | 462 | group->asn1_form = form; |
@@ -464,14 +464,14 @@ EC_GROUP_set_point_conversion_form(EC_GROUP * group, | |||
464 | 464 | ||
465 | 465 | ||
466 | point_conversion_form_t | 466 | point_conversion_form_t |
467 | EC_GROUP_get_point_conversion_form(const EC_GROUP * group) | 467 | EC_GROUP_get_point_conversion_form(const EC_GROUP *group) |
468 | { | 468 | { |
469 | return group->asn1_form; | 469 | return group->asn1_form; |
470 | } | 470 | } |
471 | 471 | ||
472 | 472 | ||
473 | size_t | 473 | size_t |
474 | EC_GROUP_set_seed(EC_GROUP * group, const unsigned char *p, size_t len) | 474 | EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *p, size_t len) |
475 | { | 475 | { |
476 | if (group->seed) { | 476 | if (group->seed) { |
477 | free(group->seed); | 477 | free(group->seed); |
@@ -491,14 +491,14 @@ EC_GROUP_set_seed(EC_GROUP * group, const unsigned char *p, size_t len) | |||
491 | 491 | ||
492 | 492 | ||
493 | unsigned char * | 493 | unsigned char * |
494 | EC_GROUP_get0_seed(const EC_GROUP * group) | 494 | EC_GROUP_get0_seed(const EC_GROUP *group) |
495 | { | 495 | { |
496 | return group->seed; | 496 | return group->seed; |
497 | } | 497 | } |
498 | 498 | ||
499 | 499 | ||
500 | size_t | 500 | size_t |
501 | EC_GROUP_get_seed_len(const EC_GROUP * group) | 501 | EC_GROUP_get_seed_len(const EC_GROUP *group) |
502 | { | 502 | { |
503 | return group->seed_len; | 503 | return group->seed_len; |
504 | } | 504 | } |
@@ -556,7 +556,7 @@ EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, | |||
556 | #endif | 556 | #endif |
557 | 557 | ||
558 | int | 558 | int |
559 | EC_GROUP_get_degree(const EC_GROUP * group) | 559 | EC_GROUP_get_degree(const EC_GROUP *group) |
560 | { | 560 | { |
561 | if (group->meth->group_get_degree == 0) { | 561 | if (group->meth->group_get_degree == 0) { |
562 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 562 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
@@ -567,7 +567,7 @@ EC_GROUP_get_degree(const EC_GROUP * group) | |||
567 | 567 | ||
568 | 568 | ||
569 | int | 569 | int |
570 | EC_GROUP_check_discriminant(const EC_GROUP * group, BN_CTX * ctx) | 570 | EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx) |
571 | { | 571 | { |
572 | if (group->meth->group_check_discriminant == 0) { | 572 | if (group->meth->group_check_discriminant == 0) { |
573 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 573 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
@@ -578,7 +578,7 @@ EC_GROUP_check_discriminant(const EC_GROUP * group, BN_CTX * ctx) | |||
578 | 578 | ||
579 | 579 | ||
580 | int | 580 | int |
581 | EC_GROUP_cmp(const EC_GROUP * a, const EC_GROUP * b, BN_CTX * ctx) | 581 | EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx) |
582 | { | 582 | { |
583 | int r = 0; | 583 | int r = 0; |
584 | BIGNUM *a1, *a2, *a3, *b1, *b2, *b3; | 584 | BIGNUM *a1, *a2, *a3, *b1, *b2, *b3; |
@@ -710,7 +710,7 @@ EC_EX_DATA_set_data(EC_EXTRA_DATA ** ex_data, void *data, | |||
710 | 710 | ||
711 | /* this has 'package' visibility */ | 711 | /* this has 'package' visibility */ |
712 | void * | 712 | void * |
713 | EC_EX_DATA_get_data(const EC_EXTRA_DATA * ex_data, | 713 | EC_EX_DATA_get_data(const EC_EXTRA_DATA *ex_data, |
714 | void *(*dup_func) (void *), | 714 | void *(*dup_func) (void *), |
715 | void (*free_func) (void *), | 715 | void (*free_func) (void *), |
716 | void (*clear_free_func) (void *)) | 716 | void (*clear_free_func) (void *)) |
@@ -825,7 +825,7 @@ EC_EX_DATA_clear_free_all_data(EC_EXTRA_DATA ** ex_data) | |||
825 | /* functions for EC_POINT objects */ | 825 | /* functions for EC_POINT objects */ |
826 | 826 | ||
827 | EC_POINT * | 827 | EC_POINT * |
828 | EC_POINT_new(const EC_GROUP * group) | 828 | EC_POINT_new(const EC_GROUP *group) |
829 | { | 829 | { |
830 | EC_POINT *ret; | 830 | EC_POINT *ret; |
831 | 831 | ||
@@ -853,7 +853,7 @@ EC_POINT_new(const EC_GROUP * group) | |||
853 | 853 | ||
854 | 854 | ||
855 | void | 855 | void |
856 | EC_POINT_free(EC_POINT * point) | 856 | EC_POINT_free(EC_POINT *point) |
857 | { | 857 | { |
858 | if (!point) | 858 | if (!point) |
859 | return; | 859 | return; |
@@ -865,7 +865,7 @@ EC_POINT_free(EC_POINT * point) | |||
865 | 865 | ||
866 | 866 | ||
867 | void | 867 | void |
868 | EC_POINT_clear_free(EC_POINT * point) | 868 | EC_POINT_clear_free(EC_POINT *point) |
869 | { | 869 | { |
870 | if (!point) | 870 | if (!point) |
871 | return; | 871 | return; |
@@ -879,7 +879,7 @@ EC_POINT_clear_free(EC_POINT * point) | |||
879 | 879 | ||
880 | 880 | ||
881 | int | 881 | int |
882 | EC_POINT_copy(EC_POINT * dest, const EC_POINT * src) | 882 | EC_POINT_copy(EC_POINT *dest, const EC_POINT *src) |
883 | { | 883 | { |
884 | if (dest->meth->point_copy == 0) { | 884 | if (dest->meth->point_copy == 0) { |
885 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 885 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
@@ -896,7 +896,7 @@ EC_POINT_copy(EC_POINT * dest, const EC_POINT * src) | |||
896 | 896 | ||
897 | 897 | ||
898 | EC_POINT * | 898 | EC_POINT * |
899 | EC_POINT_dup(const EC_POINT * a, const EC_GROUP * group) | 899 | EC_POINT_dup(const EC_POINT *a, const EC_GROUP *group) |
900 | { | 900 | { |
901 | EC_POINT *t; | 901 | EC_POINT *t; |
902 | int r; | 902 | int r; |
@@ -917,14 +917,14 @@ EC_POINT_dup(const EC_POINT * a, const EC_GROUP * group) | |||
917 | 917 | ||
918 | 918 | ||
919 | const EC_METHOD * | 919 | const EC_METHOD * |
920 | EC_POINT_method_of(const EC_POINT * point) | 920 | EC_POINT_method_of(const EC_POINT *point) |
921 | { | 921 | { |
922 | return point->meth; | 922 | return point->meth; |
923 | } | 923 | } |
924 | 924 | ||
925 | 925 | ||
926 | int | 926 | int |
927 | EC_POINT_set_to_infinity(const EC_GROUP * group, EC_POINT * point) | 927 | EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point) |
928 | { | 928 | { |
929 | if (group->meth->point_set_to_infinity == 0) { | 929 | if (group->meth->point_set_to_infinity == 0) { |
930 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 930 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
@@ -1113,7 +1113,7 @@ EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) | |||
1113 | 1113 | ||
1114 | 1114 | ||
1115 | int | 1115 | int |
1116 | EC_POINT_is_on_curve(const EC_GROUP * group, const EC_POINT * point, BN_CTX * ctx) | 1116 | EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx) |
1117 | { | 1117 | { |
1118 | if (group->meth->is_on_curve == 0) { | 1118 | if (group->meth->is_on_curve == 0) { |
1119 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 1119 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
@@ -1129,7 +1129,7 @@ EC_POINT_is_on_curve(const EC_GROUP * group, const EC_POINT * point, BN_CTX * ct | |||
1129 | 1129 | ||
1130 | int | 1130 | int |
1131 | EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, | 1131 | EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, |
1132 | BN_CTX * ctx) | 1132 | BN_CTX *ctx) |
1133 | { | 1133 | { |
1134 | if (group->meth->point_cmp == 0) { | 1134 | if (group->meth->point_cmp == 0) { |
1135 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 1135 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
@@ -1258,7 +1258,7 @@ EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, | |||
1258 | } | 1258 | } |
1259 | 1259 | ||
1260 | int | 1260 | int |
1261 | EC_GROUP_precompute_mult(EC_GROUP * group, BN_CTX * ctx) | 1261 | EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx) |
1262 | { | 1262 | { |
1263 | if (group->meth->precompute_mult != 0) | 1263 | if (group->meth->precompute_mult != 0) |
1264 | return group->meth->precompute_mult(group, ctx); | 1264 | return group->meth->precompute_mult(group, ctx); |
@@ -1267,7 +1267,7 @@ EC_GROUP_precompute_mult(EC_GROUP * group, BN_CTX * ctx) | |||
1267 | } | 1267 | } |
1268 | 1268 | ||
1269 | int | 1269 | int |
1270 | EC_GROUP_have_precompute_mult(const EC_GROUP * group) | 1270 | EC_GROUP_have_precompute_mult(const EC_GROUP *group) |
1271 | { | 1271 | { |
1272 | if (group->meth->have_precompute_mult != 0) | 1272 | if (group->meth->have_precompute_mult != 0) |
1273 | return group->meth->have_precompute_mult(group); | 1273 | return group->meth->have_precompute_mult(group); |