Skip to content

Commit 59db007

Browse files
committed
tests: refactor: rename random_group_element_... -> random_ge_...
The rename was done with the following command: $ sed -i 's/random_group_element_/random_ge_/g' $(git grep -l random_group_element_)
1 parent 06bff6d commit 59db007

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

src/modules/ellswift/tests_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ void run_ellswift_tests(void) {
229229
secp256k1_ge g, g2;
230230
secp256k1_pubkey pubkey, pubkey2;
231231
/* Generate random public key and random randomizer. */
232-
random_group_element_test(&g);
232+
random_ge_test(&g);
233233
secp256k1_pubkey_save(&pubkey, &g);
234234
secp256k1_testrand256(rnd32);
235235
/* Convert the public key to ElligatorSwift and back. */

src/tests.c

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ static void random_gej_z_magnitude(secp256k1_gej *gej) {
152152
random_field_element_magnitude(&gej->z, SECP256K1_GEJ_Z_MAGNITUDE_MAX);
153153
}
154154

155-
static void random_group_element_test(secp256k1_ge *ge) {
155+
static void random_ge_test(secp256k1_ge *ge) {
156156
secp256k1_fe fe;
157157
do {
158158
random_fe_test(&fe);
@@ -164,7 +164,7 @@ static void random_group_element_test(secp256k1_ge *ge) {
164164
ge->infinity = 0;
165165
}
166166

167-
static void random_group_element_jacobian_test(secp256k1_gej *gej, const secp256k1_ge *ge) {
167+
static void random_ge_jacobian_test(secp256k1_gej *gej, const secp256k1_ge *ge) {
168168
secp256k1_fe z2, z3;
169169
random_fe_non_zero_test(&gej->z);
170170
secp256k1_fe_sqr(&z2, &gej->z);
@@ -176,8 +176,8 @@ static void random_group_element_jacobian_test(secp256k1_gej *gej, const secp256
176176

177177
static void random_gej_test(secp256k1_gej *gej) {
178178
secp256k1_ge ge;
179-
random_group_element_test(&ge);
180-
random_group_element_jacobian_test(gej, &ge);
179+
random_ge_test(&ge);
180+
random_ge_jacobian_test(gej, &ge);
181181
}
182182

183183
static void random_scalar_order_test(secp256k1_scalar *num) {
@@ -3792,7 +3792,7 @@ static void test_ge(void) {
37923792
for (i = 0; i < runs; i++) {
37933793
int j, k;
37943794
secp256k1_ge g;
3795-
random_group_element_test(&g);
3795+
random_ge_test(&g);
37963796
if (i >= runs - 2) {
37973797
secp256k1_ge_mul_lambda(&g, &ge[1]);
37983798
CHECK(!secp256k1_ge_eq_var(&g, &ge[1]));
@@ -3805,9 +3805,9 @@ static void test_ge(void) {
38053805
secp256k1_ge_neg(&ge[3 + 4 * i], &g);
38063806
secp256k1_ge_neg(&ge[4 + 4 * i], &g);
38073807
secp256k1_gej_set_ge(&gej[1 + 4 * i], &ge[1 + 4 * i]);
3808-
random_group_element_jacobian_test(&gej[2 + 4 * i], &ge[2 + 4 * i]);
3808+
random_ge_jacobian_test(&gej[2 + 4 * i], &ge[2 + 4 * i]);
38093809
secp256k1_gej_set_ge(&gej[3 + 4 * i], &ge[3 + 4 * i]);
3810-
random_group_element_jacobian_test(&gej[4 + 4 * i], &ge[4 + 4 * i]);
3810+
random_ge_jacobian_test(&gej[4 + 4 * i], &ge[4 + 4 * i]);
38113811
for (j = 0; j < 4; j++) {
38123812
random_ge_x_magnitude(&ge[1 + j + 4 * i]);
38133813
random_ge_y_magnitude(&ge[1 + j + 4 * i]);
@@ -3975,7 +3975,7 @@ static void test_ge(void) {
39753975
/* Test batch gej -> ge conversion with many infinities. */
39763976
for (i = 0; i < 4 * runs + 1; i++) {
39773977
int odd;
3978-
random_group_element_test(&ge[i]);
3978+
random_ge_test(&ge[i]);
39793979
odd = secp256k1_fe_is_odd(&ge[i].x);
39803980
CHECK(odd == 0 || odd == 1);
39813981
/* randomly set half the points to infinity */
@@ -4012,7 +4012,7 @@ static void test_intialized_inf(void) {
40124012
secp256k1_fe zinv;
40134013

40144014
/* Test that adding P+(-P) results in a fully initialized infinity*/
4015-
random_group_element_test(&p);
4015+
random_ge_test(&p);
40164016
secp256k1_gej_set_ge(&pj, &p);
40174017
secp256k1_gej_neg(&npj, &pj);
40184018

@@ -4437,7 +4437,7 @@ static void test_ecmult_target(const secp256k1_scalar* target, int mode) {
44374437

44384438
/* Generate a random input point. */
44394439
if (mode != 0) {
4440-
random_group_element_test(&p);
4440+
random_ge_test(&p);
44414441
secp256k1_gej_set_ge(&pj, &p);
44424442
}
44434443

@@ -4553,7 +4553,7 @@ static void ecmult_const_mult_zero_one(void) {
45534553

45544554
random_scalar_order_test(&s);
45554555
secp256k1_scalar_negate(&negone, &secp256k1_scalar_one);
4556-
random_group_element_test(&point);
4556+
random_ge_test(&point);
45574557
secp256k1_ge_set_infinity(&inf);
45584558

45594559
/* 0*point */
@@ -4606,7 +4606,7 @@ static void ecmult_const_edges(void) {
46064606
secp256k1_scalar_add(&q, &q, &scalars_near_split_bounds[i - 1]);
46074607
secp256k1_scalar_add(&q, &q, &scalars_near_split_bounds[i - 1]);
46084608
}
4609-
random_group_element_test(&point);
4609+
random_ge_test(&point);
46104610
secp256k1_ecmult_const(&res, &point, &q);
46114611
ecmult_const_check_result(&point, &q, &res);
46124612
}
@@ -4623,7 +4623,7 @@ static void ecmult_const_mult_xonly(void) {
46234623
secp256k1_scalar q;
46244624
int res;
46254625
/* Random base point. */
4626-
random_group_element_test(&base);
4626+
random_ge_test(&base);
46274627
/* Random scalar to multiply it with. */
46284628
random_scalar_order_test(&q);
46294629
/* If i is odd, n=d*base.x for random non-zero d */
@@ -4743,7 +4743,7 @@ static void test_ecmult_multi(secp256k1_scratch *scratch, secp256k1_ecmult_multi
47434743
random_scalar_order(&sc[0]);
47444744
random_scalar_order(&sc[1]);
47454745

4746-
random_group_element_test(&ptg);
4746+
random_ge_test(&ptg);
47474747
secp256k1_gej_set_ge(&ptgj, &ptg);
47484748
pt[0] = ptg;
47494749
pt[1] = secp256k1_ge_const_g;
@@ -4789,7 +4789,7 @@ static void test_ecmult_multi(secp256k1_scratch *scratch, secp256k1_ecmult_multi
47894789

47904790
for (j = 0; j < 3; j++) {
47914791
for (i = 0; i < 32; i++) {
4792-
random_group_element_test(&ptg);
4792+
random_ge_test(&ptg);
47934793
pt[i] = ptg;
47944794
secp256k1_scalar_set_int(&sc[i], 0);
47954795
}
@@ -4798,7 +4798,7 @@ static void test_ecmult_multi(secp256k1_scratch *scratch, secp256k1_ecmult_multi
47984798
}
47994799

48004800
for (j = 0; j < 3; j++) {
4801-
random_group_element_test(&ptg);
4801+
random_ge_test(&ptg);
48024802
for (i = 0; i < 16; i++) {
48034803
random_scalar_order(&sc[2*i]);
48044804
secp256k1_scalar_negate(&sc[2*i + 1], &sc[2*i]);
@@ -4811,7 +4811,7 @@ static void test_ecmult_multi(secp256k1_scratch *scratch, secp256k1_ecmult_multi
48114811

48124812
random_scalar_order(&sc[0]);
48134813
for (i = 0; i < 16; i++) {
4814-
random_group_element_test(&ptg);
4814+
random_ge_test(&ptg);
48154815

48164816
sc[2*i] = sc[0];
48174817
sc[2*i+1] = sc[0];
@@ -4823,7 +4823,7 @@ static void test_ecmult_multi(secp256k1_scratch *scratch, secp256k1_ecmult_multi
48234823
CHECK(secp256k1_gej_is_infinity(&r));
48244824
}
48254825

4826-
random_group_element_test(&ptg);
4826+
random_ge_test(&ptg);
48274827
secp256k1_scalar_set_int(&sc[0], 0);
48284828
pt[0] = ptg;
48294829
for (i = 1; i < 32; i++) {
@@ -4847,7 +4847,7 @@ static void test_ecmult_multi(secp256k1_scratch *scratch, secp256k1_ecmult_multi
48474847
for (i = 0; i < 20; i++) {
48484848
secp256k1_ge ptg;
48494849
sc[i] = sc[0];
4850-
random_group_element_test(&ptg);
4850+
random_ge_test(&ptg);
48514851
pt[i] = ptg;
48524852
secp256k1_gej_add_ge_var(&r, &r, &pt[i], NULL);
48534853
}
@@ -4865,7 +4865,7 @@ static void test_ecmult_multi(secp256k1_scratch *scratch, secp256k1_ecmult_multi
48654865
secp256k1_scalar rs;
48664866
secp256k1_scalar_set_int(&rs, 0);
48674867

4868-
random_group_element_test(&ptg);
4868+
random_ge_test(&ptg);
48694869
for (i = 0; i < 20; i++) {
48704870
random_scalar_order(&sc[i]);
48714871
pt[i] = ptg;
@@ -4881,7 +4881,7 @@ static void test_ecmult_multi(secp256k1_scratch *scratch, secp256k1_ecmult_multi
48814881
/* Sanity check that zero scalars don't cause problems */
48824882
for (ncount = 0; ncount < 20; ncount++) {
48834883
random_scalar_order(&sc[ncount]);
4884-
random_group_element_test(&pt[ncount]);
4884+
random_ge_test(&pt[ncount]);
48854885
}
48864886

48874887
secp256k1_scalar_clear(&sc[0]);
@@ -4902,7 +4902,7 @@ static void test_ecmult_multi(secp256k1_scratch *scratch, secp256k1_ecmult_multi
49024902
secp256k1_ge ptg;
49034903
secp256k1_gej ptgj;
49044904

4905-
random_group_element_test(&ptg);
4905+
random_ge_test(&ptg);
49064906
secp256k1_gej_set_ge(&ptgj, &ptg);
49074907

49084908
for(t0i = 0; t0i < TOP; t0i++) {
@@ -5021,7 +5021,7 @@ static int test_ecmult_multi_random(secp256k1_scratch *scratch) {
50215021
if (nonzero_result && filled < num_nonzero) {
50225022
/* If a nonzero result is desired, and there is space, add a random nonzero term. */
50235023
random_scalar_order_test(&scalars[filled]);
5024-
random_group_element_test(&ge_tmp);
5024+
random_ge_test(&ge_tmp);
50255025
secp256k1_gej_set_ge(&gejs[filled], &ge_tmp);
50265026
++filled;
50275027
}
@@ -5045,7 +5045,7 @@ static int test_ecmult_multi_random(secp256k1_scratch *scratch) {
50455045
random_scalar_order_test(&scalars[filled]);
50465046
} else {
50475047
secp256k1_scalar_set_int(&scalars[filled], 0);
5048-
random_group_element_test(&ge_tmp);
5048+
random_ge_test(&ge_tmp);
50495049
secp256k1_gej_set_ge(&gejs[filled], &ge_tmp);
50505050
}
50515051
++filled;
@@ -5118,7 +5118,7 @@ static void test_ecmult_multi_batch_single(secp256k1_ecmult_multi_func ecmult_mu
51185118
ecmult_multi_data data;
51195119
secp256k1_scratch *scratch_empty;
51205120

5121-
random_group_element_test(&pt);
5121+
random_ge_test(&pt);
51225122
random_scalar_order(&sc);
51235123
data.sc = &sc;
51245124
data.pt = &pt;
@@ -5249,7 +5249,7 @@ static void test_ecmult_multi_batching(void) {
52495249
for(i = 0; i < n_points; i++) {
52505250
secp256k1_ge ptg;
52515251
secp256k1_gej ptgj;
5252-
random_group_element_test(&ptg);
5252+
random_ge_test(&ptg);
52535253
secp256k1_gej_set_ge(&ptgj, &ptg);
52545254
pt[i] = ptg;
52555255
random_scalar_order(&sc[i]);

0 commit comments

Comments
 (0)