summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ec/ec_lib.c
diff options
context:
space:
mode:
authortb <>2022-11-19 07:29:29 +0000
committertb <>2022-11-19 07:29:29 +0000
commit97ff0b8011f923270c9adb50e24c2b4c4a533238 (patch)
tree744c8fadca050ecfeaa626562148788777b42d2f /src/lib/libcrypto/ec/ec_lib.c
parentb197546e7fd8128aedea248a6196a0d25734b937 (diff)
downloadopenbsd-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.c60
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
76EC_GROUP * 76EC_GROUP *
77EC_GROUP_new(const EC_METHOD * meth) 77EC_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
117void 117void
118EC_GROUP_free(EC_GROUP * group) 118EC_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
138void 138void
139EC_GROUP_clear_free(EC_GROUP * group) 139EC_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
160int 160int
161EC_GROUP_copy(EC_GROUP * dest, const EC_GROUP * src) 161EC_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
229EC_GROUP * 229EC_GROUP *
230EC_GROUP_dup(const EC_GROUP * a) 230EC_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
430void 430void
431EC_GROUP_set_curve_name(EC_GROUP * group, int nid) 431EC_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
437int 437int
438EC_GROUP_get_curve_name(const EC_GROUP * group) 438EC_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
444void 444void
445EC_GROUP_set_asn1_flag(EC_GROUP * group, int flag) 445EC_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
451int 451int
452EC_GROUP_get_asn1_flag(const EC_GROUP * group) 452EC_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
458void 458void
459EC_GROUP_set_point_conversion_form(EC_GROUP * group, 459EC_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
466point_conversion_form_t 466point_conversion_form_t
467EC_GROUP_get_point_conversion_form(const EC_GROUP * group) 467EC_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
473size_t 473size_t
474EC_GROUP_set_seed(EC_GROUP * group, const unsigned char *p, size_t len) 474EC_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
493unsigned char * 493unsigned char *
494EC_GROUP_get0_seed(const EC_GROUP * group) 494EC_GROUP_get0_seed(const EC_GROUP *group)
495{ 495{
496 return group->seed; 496 return group->seed;
497} 497}
498 498
499 499
500size_t 500size_t
501EC_GROUP_get_seed_len(const EC_GROUP * group) 501EC_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
558int 558int
559EC_GROUP_get_degree(const EC_GROUP * group) 559EC_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
569int 569int
570EC_GROUP_check_discriminant(const EC_GROUP * group, BN_CTX * ctx) 570EC_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
580int 580int
581EC_GROUP_cmp(const EC_GROUP * a, const EC_GROUP * b, BN_CTX * ctx) 581EC_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 */
712void * 712void *
713EC_EX_DATA_get_data(const EC_EXTRA_DATA * ex_data, 713EC_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
827EC_POINT * 827EC_POINT *
828EC_POINT_new(const EC_GROUP * group) 828EC_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
855void 855void
856EC_POINT_free(EC_POINT * point) 856EC_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
867void 867void
868EC_POINT_clear_free(EC_POINT * point) 868EC_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
881int 881int
882EC_POINT_copy(EC_POINT * dest, const EC_POINT * src) 882EC_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
898EC_POINT * 898EC_POINT *
899EC_POINT_dup(const EC_POINT * a, const EC_GROUP * group) 899EC_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
919const EC_METHOD * 919const EC_METHOD *
920EC_POINT_method_of(const EC_POINT * point) 920EC_POINT_method_of(const EC_POINT *point)
921{ 921{
922 return point->meth; 922 return point->meth;
923} 923}
924 924
925 925
926int 926int
927EC_POINT_set_to_infinity(const EC_GROUP * group, EC_POINT * point) 927EC_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
1115int 1115int
1116EC_POINT_is_on_curve(const EC_GROUP * group, const EC_POINT * point, BN_CTX * ctx) 1116EC_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
1130int 1130int
1131EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, 1131EC_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
1260int 1260int
1261EC_GROUP_precompute_mult(EC_GROUP * group, BN_CTX * ctx) 1261EC_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
1269int 1269int
1270EC_GROUP_have_precompute_mult(const EC_GROUP * group) 1270EC_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);