Skip to content

Commit 6cc5295

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 5127ecc commit 6cc5295

File tree

176 files changed

+1638
-1759
lines changed

Some content is hidden

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

176 files changed

+1638
-1759
lines changed

demo/test.c

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,61 +1501,61 @@ static int test_mp_incr(void)
15011501
mp_err e = MP_OKAY;
15021502

15031503
if ((e = mp_init_multi(&a, &b, NULL)) != MP_OKAY) {
1504-
goto LTM_ERR;
1504+
goto LBL_ERR;
15051505
}
15061506

15071507
/* Does it increment inside the limits of a MP_xBIT limb? */
15081508
mp_set(&a, MP_MASK/2);
15091509
if ((e = mp_incr(&a)) != MP_OKAY) {
1510-
goto LTM_ERR;
1510+
goto LBL_ERR;
15111511
}
15121512
if (mp_cmp_d(&a, (MP_MASK/2uL) + 1uL) != MP_EQ) {
1513-
goto LTM_ERR;
1513+
goto LBL_ERR;
15141514
}
15151515

15161516
/* Does it increment outside of the limits of a MP_xBIT limb? */
15171517
mp_set(&a, MP_MASK);
15181518
mp_set(&b, MP_MASK);
15191519
if ((e = mp_incr(&a)) != MP_OKAY) {
1520-
goto LTM_ERR;
1520+
goto LBL_ERR;
15211521
}
15221522
if ((e = mp_add_d(&b, 1uL, &b)) != MP_OKAY) {
1523-
goto LTM_ERR;
1523+
goto LBL_ERR;
15241524
}
15251525
if (mp_cmp(&a, &b) != MP_EQ) {
1526-
goto LTM_ERR;
1526+
goto LBL_ERR;
15271527
}
15281528

15291529
/* Does it increment from -1 to 0? */
15301530
mp_set(&a, 1uL);
15311531
a.sign = MP_NEG;
15321532
if ((e = mp_incr(&a)) != MP_OKAY) {
1533-
goto LTM_ERR;
1533+
goto LBL_ERR;
15341534
}
15351535
if (mp_cmp_d(&a, 0uL) != MP_EQ) {
1536-
goto LTM_ERR;
1536+
goto LBL_ERR;
15371537
}
15381538

15391539
/* Does it increment from -(MP_MASK + 1) to -MP_MASK? */
15401540
mp_set(&a, MP_MASK);
15411541
if ((e = mp_add_d(&a, 1uL, &a)) != MP_OKAY) {
1542-
goto LTM_ERR;
1542+
goto LBL_ERR;
15431543
}
15441544
a.sign = MP_NEG;
15451545
if ((e = mp_incr(&a)) != MP_OKAY) {
1546-
goto LTM_ERR;
1546+
goto LBL_ERR;
15471547
}
15481548
if (a.sign != MP_NEG) {
1549-
goto LTM_ERR;
1549+
goto LBL_ERR;
15501550
}
15511551
a.sign = MP_ZPOS;
15521552
if (mp_cmp_d(&a, MP_MASK) != MP_EQ) {
1553-
goto LTM_ERR;
1553+
goto LBL_ERR;
15541554
}
15551555

15561556
mp_clear_multi(&a, &b, NULL);
15571557
return EXIT_SUCCESS;
1558-
LTM_ERR:
1558+
LBL_ERR:
15591559
mp_clear_multi(&a, &b, NULL);
15601560
return EXIT_FAILURE;
15611561
}
@@ -1566,42 +1566,42 @@ static int test_mp_decr(void)
15661566
mp_err e = MP_OKAY;
15671567

15681568
if ((e = mp_init_multi(&a, &b, NULL)) != MP_OKAY) {
1569-
goto LTM_ERR;
1569+
goto LBL_ERR;
15701570
}
15711571

15721572
/* Does it decrement inside the limits of a MP_xBIT limb? */
15731573
mp_set(&a, MP_MASK/2);
15741574
if ((e = mp_decr(&a)) != MP_OKAY) {
1575-
goto LTM_ERR;
1575+
goto LBL_ERR;
15761576
}
15771577
if (mp_cmp_d(&a, (MP_MASK/2uL) - 1uL) != MP_EQ) {
1578-
goto LTM_ERR;
1578+
goto LBL_ERR;
15791579
}
15801580

15811581
/* Does it decrement outside of the limits of a MP_xBIT limb? */
15821582
mp_set(&a, MP_MASK);
15831583
if ((e = mp_add_d(&a, 1uL, &a)) != MP_OKAY) {
1584-
goto LTM_ERR;
1584+
goto LBL_ERR;
15851585
}
15861586
if ((e = mp_decr(&a)) != MP_OKAY) {
1587-
goto LTM_ERR;
1587+
goto LBL_ERR;
15881588
}
15891589
if (mp_cmp_d(&a, MP_MASK) != MP_EQ) {
1590-
goto LTM_ERR;
1590+
goto LBL_ERR;
15911591
}
15921592

15931593
/* Does it decrement from 0 to -1? */
15941594
mp_zero(&a);
15951595
if ((e = mp_decr(&a)) != MP_OKAY) {
1596-
goto LTM_ERR;
1596+
goto LBL_ERR;
15971597
}
15981598
if (a.sign == MP_NEG) {
15991599
a.sign = MP_ZPOS;
16001600
if (mp_cmp_d(&a, 1uL) != MP_EQ) {
1601-
goto LTM_ERR;
1601+
goto LBL_ERR;
16021602
}
16031603
} else {
1604-
goto LTM_ERR;
1604+
goto LBL_ERR;
16051605
}
16061606

16071607

@@ -1611,18 +1611,18 @@ static int test_mp_decr(void)
16111611
mp_set(&b, MP_MASK);
16121612
b.sign = MP_NEG;
16131613
if ((e = mp_sub_d(&b, 1uL, &b)) != MP_OKAY) {
1614-
goto LTM_ERR;
1614+
goto LBL_ERR;
16151615
}
16161616
if ((e = mp_decr(&a)) != MP_OKAY) {
1617-
goto LTM_ERR;
1617+
goto LBL_ERR;
16181618
}
16191619
if (mp_cmp(&a, &b) != MP_EQ) {
1620-
goto LTM_ERR;
1620+
goto LBL_ERR;
16211621
}
16221622

16231623
mp_clear_multi(&a, &b, NULL);
16241624
return EXIT_SUCCESS;
1625-
LTM_ERR:
1625+
LBL_ERR:
16261626
mp_clear_multi(&a, &b, NULL);
16271627
return EXIT_FAILURE;
16281628
}
@@ -1856,13 +1856,13 @@ static int test_mp_root_u32(void)
18561856
mp_read_radix(&r, root[i][j-3], 10);
18571857
if (mp_cmp(&r, &c) != MP_EQ) {
18581858
fprintf(stderr, "mp_root_u32 failed at input #%d, root #%d\n", i, j);
1859-
goto LTM_ERR;
1859+
goto LBL_ERR;
18601860
}
18611861
}
18621862
}
18631863
mp_clear_multi(&a, &c, &r, NULL);
18641864
return EXIT_SUCCESS;
1865-
LTM_ERR:
1865+
LBL_ERR:
18661866
mp_clear_multi(&a, &c, &r, NULL);
18671867
return EXIT_FAILURE;
18681868
}
@@ -1879,31 +1879,31 @@ static int test_s_mp_balance_mul(void)
18791879
"HzrSq9WVt1jDTVlwUxSKqxctu2GVD+N8+SVGaPFRqdxyld6IxDBbj27BPJzYUdR96k3sWpkO8XnDBvupGPnehpQe4KlO/KmN1PjFov/UTZYM+LYzkFcBPyV6hkkL8ePC1rlFLAHzgJMBCXVp4mRqtkQrDsZXXlcqlbTFu69wF6zDEysiX2cAtn/kP9ldblJiwYPCD8hG";
18801880

18811881
if ((e = mp_init_multi(&a, &b, &c, NULL)) != MP_OKAY) {
1882-
goto LTM_ERR;
1882+
goto LBL_ERR;
18831883
}
18841884

18851885
if ((e = mp_read_radix(&a, na, 64)) != MP_OKAY) {
1886-
goto LTM_ERR;
1886+
goto LBL_ERR;
18871887
}
18881888
if ((e = mp_read_radix(&b, nb, 64)) != MP_OKAY) {
1889-
goto LTM_ERR;
1889+
goto LBL_ERR;
18901890
}
18911891

18921892
if ((e = s_mp_balance_mul(&a, &b, &c)) != MP_OKAY) {
1893-
goto LTM_ERR;
1893+
goto LBL_ERR;
18941894
}
18951895

18961896
if ((e = mp_read_radix(&b, nc, 64)) != MP_OKAY) {
1897-
goto LTM_ERR;
1897+
goto LBL_ERR;
18981898
}
18991899

19001900
if (mp_cmp(&b, &c) != MP_EQ) {
1901-
goto LTM_ERR;
1901+
goto LBL_ERR;
19021902
}
19031903

19041904
mp_clear_multi(&a, &b, &c, NULL);
19051905
return EXIT_SUCCESS;
1906-
LTM_ERR:
1906+
LBL_ERR:
19071907
mp_clear_multi(&a, &b, &c, NULL);
19081908
return EXIT_FAILURE;
19091909
}
@@ -1915,30 +1915,30 @@ static int test_s_mp_karatsuba_mul(void)
19151915
int size, err;
19161916

19171917
if ((err = mp_init_multi(&a, &b, &c, &d, NULL)) != MP_OKAY) {
1918-
goto LTM_ERR;
1918+
goto LBL_ERR;
19191919
}
19201920
for (size = MP_KARATSUBA_MUL_CUTOFF; size < MP_KARATSUBA_MUL_CUTOFF + 20; size++) {
19211921
if ((err = mp_rand(&a, size)) != MP_OKAY) {
1922-
goto LTM_ERR;
1922+
goto LBL_ERR;
19231923
}
19241924
if ((err = mp_rand(&b, size)) != MP_OKAY) {
1925-
goto LTM_ERR;
1925+
goto LBL_ERR;
19261926
}
19271927
if ((err = s_mp_karatsuba_mul(&a, &b, &c)) != MP_OKAY) {
1928-
goto LTM_ERR;
1928+
goto LBL_ERR;
19291929
}
19301930
if ((err = s_mp_mul(&a,&b,&d)) != MP_OKAY) {
1931-
goto LTM_ERR;
1931+
goto LBL_ERR;
19321932
}
19331933
if (mp_cmp(&c, &d) != MP_EQ) {
19341934
fprintf(stderr, "Karatsuba multiplication failed at size %d\n", size);
1935-
goto LTM_ERR;
1935+
goto LBL_ERR;
19361936
}
19371937
}
19381938

19391939
mp_clear_multi(&a, &b, &c, &d, NULL);
19401940
return EXIT_SUCCESS;
1941-
LTM_ERR:
1941+
LBL_ERR:
19421942
mp_clear_multi(&a, &b, &c, &d, NULL);
19431943
return EXIT_FAILURE;
19441944
}
@@ -1949,27 +1949,27 @@ static int test_s_mp_karatsuba_sqr(void)
19491949
int size, err;
19501950

19511951
if ((err = mp_init_multi(&a, &b, &c, NULL)) != MP_OKAY) {
1952-
goto LTM_ERR;
1952+
goto LBL_ERR;
19531953
}
19541954
for (size = MP_KARATSUBA_SQR_CUTOFF; size < MP_KARATSUBA_SQR_CUTOFF + 20; size++) {
19551955
if ((err = mp_rand(&a, size)) != MP_OKAY) {
1956-
goto LTM_ERR;
1956+
goto LBL_ERR;
19571957
}
19581958
if ((err = s_mp_karatsuba_sqr(&a, &b)) != MP_OKAY) {
1959-
goto LTM_ERR;
1959+
goto LBL_ERR;
19601960
}
19611961
if ((err = s_mp_sqr(&a, &c)) != MP_OKAY) {
1962-
goto LTM_ERR;
1962+
goto LBL_ERR;
19631963
}
19641964
if (mp_cmp(&b, &c) != MP_EQ) {
19651965
fprintf(stderr, "Karatsuba squaring failed at size %d\n", size);
1966-
goto LTM_ERR;
1966+
goto LBL_ERR;
19671967
}
19681968
}
19691969

19701970
mp_clear_multi(&a, &b, &c, NULL);
19711971
return EXIT_SUCCESS;
1972-
LTM_ERR:
1972+
LBL_ERR:
19731973
mp_clear_multi(&a, &b, &c, NULL);
19741974
return EXIT_FAILURE;
19751975
}
@@ -1980,30 +1980,30 @@ static int test_s_mp_toom_mul(void)
19801980
int size, err;
19811981

19821982
if ((err = mp_init_multi(&a, &b, &c, &d, NULL)) != MP_OKAY) {
1983-
goto LTM_ERR;
1983+
goto LBL_ERR;
19841984
}
19851985
for (size = MP_TOOM_MUL_CUTOFF; size < MP_TOOM_MUL_CUTOFF + 20; size++) {
19861986
if ((err = mp_rand(&a, size)) != MP_OKAY) {
1987-
goto LTM_ERR;
1987+
goto LBL_ERR;
19881988
}
19891989
if ((err = mp_rand(&b, size)) != MP_OKAY) {
1990-
goto LTM_ERR;
1990+
goto LBL_ERR;
19911991
}
19921992
if ((err = s_mp_toom_mul(&a, &b, &c)) != MP_OKAY) {
1993-
goto LTM_ERR;
1993+
goto LBL_ERR;
19941994
}
19951995
if ((err = s_mp_mul(&a,&b,&d)) != MP_OKAY) {
1996-
goto LTM_ERR;
1996+
goto LBL_ERR;
19971997
}
19981998
if (mp_cmp(&c, &d) != MP_EQ) {
19991999
fprintf(stderr, "Toom-Cook 3-way multiplication failed at size %d\n", size);
2000-
goto LTM_ERR;
2000+
goto LBL_ERR;
20012001
}
20022002
}
20032003

20042004
mp_clear_multi(&a, &b, &c, &d, NULL);
20052005
return EXIT_SUCCESS;
2006-
LTM_ERR:
2006+
LBL_ERR:
20072007
mp_clear_multi(&a, &b, &c, &d, NULL);
20082008
return EXIT_FAILURE;
20092009
}
@@ -2014,27 +2014,27 @@ static int test_s_mp_toom_sqr(void)
20142014
int size, err;
20152015

20162016
if ((err = mp_init_multi(&a, &b, &c, NULL)) != MP_OKAY) {
2017-
goto LTM_ERR;
2017+
goto LBL_ERR;
20182018
}
20192019
for (size = MP_TOOM_SQR_CUTOFF; size < MP_TOOM_SQR_CUTOFF + 20; size++) {
20202020
if ((err = mp_rand(&a, size)) != MP_OKAY) {
2021-
goto LTM_ERR;
2021+
goto LBL_ERR;
20222022
}
20232023
if ((err = s_mp_toom_sqr(&a, &b)) != MP_OKAY) {
2024-
goto LTM_ERR;
2024+
goto LBL_ERR;
20252025
}
20262026
if ((err = s_mp_sqr(&a, &c)) != MP_OKAY) {
2027-
goto LTM_ERR;
2027+
goto LBL_ERR;
20282028
}
20292029
if (mp_cmp(&b, &c) != MP_EQ) {
20302030
fprintf(stderr, "Toom-Cook 3-way squaring failed at size %d\n", size);
2031-
goto LTM_ERR;
2031+
goto LBL_ERR;
20322032
}
20332033
}
20342034

20352035
mp_clear_multi(&a, &b, &c, NULL);
20362036
return EXIT_SUCCESS;
2037-
LTM_ERR:
2037+
LBL_ERR:
20382038
mp_clear_multi(&a, &b, &c, NULL);
20392039
return EXIT_FAILURE;
20402040
}

0 commit comments

Comments
 (0)