Skip to content

Commit 4e95c38

Browse files
committed
Execute move.sh - Rename files from bn_* to match the function names.
* git blame <renamed-file> is not affected * git log --follow <renamed-file> can be used to show log across renames
1 parent 2fb76ba commit 4e95c38

File tree

175 files changed

+1652
-1772
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+1652
-1772
lines changed

demo/test.c

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -62,25 +62,25 @@ void does_not_exist(void);
6262

6363
static int test_feature_detection(void)
6464
{
65-
#define BN_TEST_FEATURE1_C
65+
#define TEST_FEATURE1_C
6666
if (!MP_HAS(TEST_FEATURE1)) {
6767
does_not_exist();
6868
return EXIT_FAILURE;
6969
}
7070

71-
#define BN_TEST_FEATURE2_C 1
71+
#define TEST_FEATURE2_C 1
7272
if (MP_HAS(TEST_FEATURE2)) {
7373
does_not_exist();
7474
return EXIT_FAILURE;
7575
}
7676

77-
#define BN_TEST_FEATURE3_C 0
77+
#define TEST_FEATURE3_C 0
7878
if (MP_HAS(TEST_FEATURE3)) {
7979
does_not_exist();
8080
return EXIT_FAILURE;
8181
}
8282

83-
#define BN_TEST_FEATURE4_C something
83+
#define TEST_FEATURE4_C something
8484
if (MP_HAS(TEST_FEATURE4)) {
8585
does_not_exist();
8686
return EXIT_FAILURE;
@@ -1676,61 +1676,61 @@ static int test_mp_incr(void)
16761676
mp_err e = MP_OKAY;
16771677

16781678
if ((e = mp_init_multi(&a, &b, NULL)) != MP_OKAY) {
1679-
goto LTM_ERR;
1679+
goto LBL_ERR;
16801680
}
16811681

16821682
/* Does it increment inside the limits of a MP_xBIT limb? */
16831683
mp_set(&a, MP_MASK/2);
16841684
if ((e = mp_incr(&a)) != MP_OKAY) {
1685-
goto LTM_ERR;
1685+
goto LBL_ERR;
16861686
}
16871687
if (mp_cmp_d(&a, (MP_MASK/2uL) + 1uL) != MP_EQ) {
1688-
goto LTM_ERR;
1688+
goto LBL_ERR;
16891689
}
16901690

16911691
/* Does it increment outside of the limits of a MP_xBIT limb? */
16921692
mp_set(&a, MP_MASK);
16931693
mp_set(&b, MP_MASK);
16941694
if ((e = mp_incr(&a)) != MP_OKAY) {
1695-
goto LTM_ERR;
1695+
goto LBL_ERR;
16961696
}
16971697
if ((e = mp_add_d(&b, 1uL, &b)) != MP_OKAY) {
1698-
goto LTM_ERR;
1698+
goto LBL_ERR;
16991699
}
17001700
if (mp_cmp(&a, &b) != MP_EQ) {
1701-
goto LTM_ERR;
1701+
goto LBL_ERR;
17021702
}
17031703

17041704
/* Does it increment from -1 to 0? */
17051705
mp_set(&a, 1uL);
17061706
a.sign = MP_NEG;
17071707
if ((e = mp_incr(&a)) != MP_OKAY) {
1708-
goto LTM_ERR;
1708+
goto LBL_ERR;
17091709
}
17101710
if (mp_cmp_d(&a, 0uL) != MP_EQ) {
1711-
goto LTM_ERR;
1711+
goto LBL_ERR;
17121712
}
17131713

17141714
/* Does it increment from -(MP_MASK + 1) to -MP_MASK? */
17151715
mp_set(&a, MP_MASK);
17161716
if ((e = mp_add_d(&a, 1uL, &a)) != MP_OKAY) {
1717-
goto LTM_ERR;
1717+
goto LBL_ERR;
17181718
}
17191719
a.sign = MP_NEG;
17201720
if ((e = mp_incr(&a)) != MP_OKAY) {
1721-
goto LTM_ERR;
1721+
goto LBL_ERR;
17221722
}
17231723
if (a.sign != MP_NEG) {
1724-
goto LTM_ERR;
1724+
goto LBL_ERR;
17251725
}
17261726
a.sign = MP_ZPOS;
17271727
if (mp_cmp_d(&a, MP_MASK) != MP_EQ) {
1728-
goto LTM_ERR;
1728+
goto LBL_ERR;
17291729
}
17301730

17311731
mp_clear_multi(&a, &b, NULL);
17321732
return EXIT_SUCCESS;
1733-
LTM_ERR:
1733+
LBL_ERR:
17341734
mp_clear_multi(&a, &b, NULL);
17351735
return EXIT_FAILURE;
17361736
}
@@ -1741,42 +1741,42 @@ static int test_mp_decr(void)
17411741
mp_err e = MP_OKAY;
17421742

17431743
if ((e = mp_init_multi(&a, &b, NULL)) != MP_OKAY) {
1744-
goto LTM_ERR;
1744+
goto LBL_ERR;
17451745
}
17461746

17471747
/* Does it decrement inside the limits of a MP_xBIT limb? */
17481748
mp_set(&a, MP_MASK/2);
17491749
if ((e = mp_decr(&a)) != MP_OKAY) {
1750-
goto LTM_ERR;
1750+
goto LBL_ERR;
17511751
}
17521752
if (mp_cmp_d(&a, (MP_MASK/2uL) - 1uL) != MP_EQ) {
1753-
goto LTM_ERR;
1753+
goto LBL_ERR;
17541754
}
17551755

17561756
/* Does it decrement outside of the limits of a MP_xBIT limb? */
17571757
mp_set(&a, MP_MASK);
17581758
if ((e = mp_add_d(&a, 1uL, &a)) != MP_OKAY) {
1759-
goto LTM_ERR;
1759+
goto LBL_ERR;
17601760
}
17611761
if ((e = mp_decr(&a)) != MP_OKAY) {
1762-
goto LTM_ERR;
1762+
goto LBL_ERR;
17631763
}
17641764
if (mp_cmp_d(&a, MP_MASK) != MP_EQ) {
1765-
goto LTM_ERR;
1765+
goto LBL_ERR;
17661766
}
17671767

17681768
/* Does it decrement from 0 to -1? */
17691769
mp_zero(&a);
17701770
if ((e = mp_decr(&a)) != MP_OKAY) {
1771-
goto LTM_ERR;
1771+
goto LBL_ERR;
17721772
}
17731773
if (a.sign == MP_NEG) {
17741774
a.sign = MP_ZPOS;
17751775
if (mp_cmp_d(&a, 1uL) != MP_EQ) {
1776-
goto LTM_ERR;
1776+
goto LBL_ERR;
17771777
}
17781778
} else {
1779-
goto LTM_ERR;
1779+
goto LBL_ERR;
17801780
}
17811781

17821782

@@ -1786,18 +1786,18 @@ static int test_mp_decr(void)
17861786
mp_set(&b, MP_MASK);
17871787
b.sign = MP_NEG;
17881788
if ((e = mp_sub_d(&b, 1uL, &b)) != MP_OKAY) {
1789-
goto LTM_ERR;
1789+
goto LBL_ERR;
17901790
}
17911791
if ((e = mp_decr(&a)) != MP_OKAY) {
1792-
goto LTM_ERR;
1792+
goto LBL_ERR;
17931793
}
17941794
if (mp_cmp(&a, &b) != MP_EQ) {
1795-
goto LTM_ERR;
1795+
goto LBL_ERR;
17961796
}
17971797

17981798
mp_clear_multi(&a, &b, NULL);
17991799
return EXIT_SUCCESS;
1800-
LTM_ERR:
1800+
LBL_ERR:
18011801
mp_clear_multi(&a, &b, NULL);
18021802
return EXIT_FAILURE;
18031803
}
@@ -2031,13 +2031,13 @@ static int test_mp_root_u32(void)
20312031
mp_read_radix(&r, root[i][j-3], 10);
20322032
if (mp_cmp(&r, &c) != MP_EQ) {
20332033
fprintf(stderr, "mp_root_u32 failed at input #%d, root #%d\n", i, j);
2034-
goto LTM_ERR;
2034+
goto LBL_ERR;
20352035
}
20362036
}
20372037
}
20382038
mp_clear_multi(&a, &c, &r, NULL);
20392039
return EXIT_SUCCESS;
2040-
LTM_ERR:
2040+
LBL_ERR:
20412041
mp_clear_multi(&a, &c, &r, NULL);
20422042
return EXIT_FAILURE;
20432043
}
@@ -2054,31 +2054,31 @@ static int test_s_mp_balance_mul(void)
20542054
"HzrSq9WVt1jDTVlwUxSKqxctu2GVD+N8+SVGaPFRqdxyld6IxDBbj27BPJzYUdR96k3sWpkO8XnDBvupGPnehpQe4KlO/KmN1PjFov/UTZYM+LYzkFcBPyV6hkkL8ePC1rlFLAHzgJMBCXVp4mRqtkQrDsZXXlcqlbTFu69wF6zDEysiX2cAtn/kP9ldblJiwYPCD8hG";
20552055

20562056
if ((e = mp_init_multi(&a, &b, &c, NULL)) != MP_OKAY) {
2057-
goto LTM_ERR;
2057+
goto LBL_ERR;
20582058
}
20592059

20602060
if ((e = mp_read_radix(&a, na, 64)) != MP_OKAY) {
2061-
goto LTM_ERR;
2061+
goto LBL_ERR;
20622062
}
20632063
if ((e = mp_read_radix(&b, nb, 64)) != MP_OKAY) {
2064-
goto LTM_ERR;
2064+
goto LBL_ERR;
20652065
}
20662066

20672067
if ((e = s_mp_balance_mul(&a, &b, &c)) != MP_OKAY) {
2068-
goto LTM_ERR;
2068+
goto LBL_ERR;
20692069
}
20702070

20712071
if ((e = mp_read_radix(&b, nc, 64)) != MP_OKAY) {
2072-
goto LTM_ERR;
2072+
goto LBL_ERR;
20732073
}
20742074

20752075
if (mp_cmp(&b, &c) != MP_EQ) {
2076-
goto LTM_ERR;
2076+
goto LBL_ERR;
20772077
}
20782078

20792079
mp_clear_multi(&a, &b, &c, NULL);
20802080
return EXIT_SUCCESS;
2081-
LTM_ERR:
2081+
LBL_ERR:
20822082
mp_clear_multi(&a, &b, &c, NULL);
20832083
return EXIT_FAILURE;
20842084
}
@@ -2090,30 +2090,30 @@ static int test_s_mp_karatsuba_mul(void)
20902090
int size, err;
20912091

20922092
if ((err = mp_init_multi(&a, &b, &c, &d, NULL)) != MP_OKAY) {
2093-
goto LTM_ERR;
2093+
goto LBL_ERR;
20942094
}
20952095
for (size = MP_KARATSUBA_MUL_CUTOFF; size < MP_KARATSUBA_MUL_CUTOFF + 20; size++) {
20962096
if ((err = mp_rand(&a, size)) != MP_OKAY) {
2097-
goto LTM_ERR;
2097+
goto LBL_ERR;
20982098
}
20992099
if ((err = mp_rand(&b, size)) != MP_OKAY) {
2100-
goto LTM_ERR;
2100+
goto LBL_ERR;
21012101
}
21022102
if ((err = s_mp_karatsuba_mul(&a, &b, &c)) != MP_OKAY) {
2103-
goto LTM_ERR;
2103+
goto LBL_ERR;
21042104
}
21052105
if ((err = s_mp_mul(&a,&b,&d)) != MP_OKAY) {
2106-
goto LTM_ERR;
2106+
goto LBL_ERR;
21072107
}
21082108
if (mp_cmp(&c, &d) != MP_EQ) {
21092109
fprintf(stderr, "Karatsuba multiplication failed at size %d\n", size);
2110-
goto LTM_ERR;
2110+
goto LBL_ERR;
21112111
}
21122112
}
21132113

21142114
mp_clear_multi(&a, &b, &c, &d, NULL);
21152115
return EXIT_SUCCESS;
2116-
LTM_ERR:
2116+
LBL_ERR:
21172117
mp_clear_multi(&a, &b, &c, &d, NULL);
21182118
return EXIT_FAILURE;
21192119
}
@@ -2124,27 +2124,27 @@ static int test_s_mp_karatsuba_sqr(void)
21242124
int size, err;
21252125

21262126
if ((err = mp_init_multi(&a, &b, &c, NULL)) != MP_OKAY) {
2127-
goto LTM_ERR;
2127+
goto LBL_ERR;
21282128
}
21292129
for (size = MP_KARATSUBA_SQR_CUTOFF; size < MP_KARATSUBA_SQR_CUTOFF + 20; size++) {
21302130
if ((err = mp_rand(&a, size)) != MP_OKAY) {
2131-
goto LTM_ERR;
2131+
goto LBL_ERR;
21322132
}
21332133
if ((err = s_mp_karatsuba_sqr(&a, &b)) != MP_OKAY) {
2134-
goto LTM_ERR;
2134+
goto LBL_ERR;
21352135
}
21362136
if ((err = s_mp_sqr(&a, &c)) != MP_OKAY) {
2137-
goto LTM_ERR;
2137+
goto LBL_ERR;
21382138
}
21392139
if (mp_cmp(&b, &c) != MP_EQ) {
21402140
fprintf(stderr, "Karatsuba squaring failed at size %d\n", size);
2141-
goto LTM_ERR;
2141+
goto LBL_ERR;
21422142
}
21432143
}
21442144

21452145
mp_clear_multi(&a, &b, &c, NULL);
21462146
return EXIT_SUCCESS;
2147-
LTM_ERR:
2147+
LBL_ERR:
21482148
mp_clear_multi(&a, &b, &c, NULL);
21492149
return EXIT_FAILURE;
21502150
}
@@ -2155,30 +2155,30 @@ static int test_s_mp_toom_mul(void)
21552155
int size, err;
21562156

21572157
if ((err = mp_init_multi(&a, &b, &c, &d, NULL)) != MP_OKAY) {
2158-
goto LTM_ERR;
2158+
goto LBL_ERR;
21592159
}
21602160
for (size = MP_TOOM_MUL_CUTOFF; size < MP_TOOM_MUL_CUTOFF + 20; size++) {
21612161
if ((err = mp_rand(&a, size)) != MP_OKAY) {
2162-
goto LTM_ERR;
2162+
goto LBL_ERR;
21632163
}
21642164
if ((err = mp_rand(&b, size)) != MP_OKAY) {
2165-
goto LTM_ERR;
2165+
goto LBL_ERR;
21662166
}
21672167
if ((err = s_mp_toom_mul(&a, &b, &c)) != MP_OKAY) {
2168-
goto LTM_ERR;
2168+
goto LBL_ERR;
21692169
}
21702170
if ((err = s_mp_mul(&a,&b,&d)) != MP_OKAY) {
2171-
goto LTM_ERR;
2171+
goto LBL_ERR;
21722172
}
21732173
if (mp_cmp(&c, &d) != MP_EQ) {
21742174
fprintf(stderr, "Toom-Cook 3-way multiplication failed at size %d\n", size);
2175-
goto LTM_ERR;
2175+
goto LBL_ERR;
21762176
}
21772177
}
21782178

21792179
mp_clear_multi(&a, &b, &c, &d, NULL);
21802180
return EXIT_SUCCESS;
2181-
LTM_ERR:
2181+
LBL_ERR:
21822182
mp_clear_multi(&a, &b, &c, &d, NULL);
21832183
return EXIT_FAILURE;
21842184
}
@@ -2189,27 +2189,27 @@ static int test_s_mp_toom_sqr(void)
21892189
int size, err;
21902190

21912191
if ((err = mp_init_multi(&a, &b, &c, NULL)) != MP_OKAY) {
2192-
goto LTM_ERR;
2192+
goto LBL_ERR;
21932193
}
21942194
for (size = MP_TOOM_SQR_CUTOFF; size < MP_TOOM_SQR_CUTOFF + 20; size++) {
21952195
if ((err = mp_rand(&a, size)) != MP_OKAY) {
2196-
goto LTM_ERR;
2196+
goto LBL_ERR;
21972197
}
21982198
if ((err = s_mp_toom_sqr(&a, &b)) != MP_OKAY) {
2199-
goto LTM_ERR;
2199+
goto LBL_ERR;
22002200
}
22012201
if ((err = s_mp_sqr(&a, &c)) != MP_OKAY) {
2202-
goto LTM_ERR;
2202+
goto LBL_ERR;
22032203
}
22042204
if (mp_cmp(&b, &c) != MP_EQ) {
22052205
fprintf(stderr, "Toom-Cook 3-way squaring failed at size %d\n", size);
2206-
goto LTM_ERR;
2206+
goto LBL_ERR;
22072207
}
22082208
}
22092209

22102210
mp_clear_multi(&a, &b, &c, NULL);
22112211
return EXIT_SUCCESS;
2212-
LTM_ERR:
2212+
LBL_ERR:
22132213
mp_clear_multi(&a, &b, &c, NULL);
22142214
return EXIT_FAILURE;
22152215
}

0 commit comments

Comments
 (0)