diff --git a/demo/test.c b/demo/test.c index 9002e9631..acb81c520 100644 --- a/demo/test.c +++ b/demo/test.c @@ -62,25 +62,25 @@ void does_not_exist(void); static int test_feature_detection(void) { -#define BN_TEST_FEATURE1_C +#define TEST_FEATURE1_C if (!MP_HAS(TEST_FEATURE1)) { does_not_exist(); return EXIT_FAILURE; } -#define BN_TEST_FEATURE2_C 1 +#define TEST_FEATURE2_C 1 if (MP_HAS(TEST_FEATURE2)) { does_not_exist(); return EXIT_FAILURE; } -#define BN_TEST_FEATURE3_C 0 +#define TEST_FEATURE3_C 0 if (MP_HAS(TEST_FEATURE3)) { does_not_exist(); return EXIT_FAILURE; } -#define BN_TEST_FEATURE4_C something +#define TEST_FEATURE4_C something if (MP_HAS(TEST_FEATURE4)) { does_not_exist(); return EXIT_FAILURE; @@ -1254,30 +1254,30 @@ static int test_mp_read_radix(void) mp_err err; mp_int a; - if (mp_init_multi(&a, NULL)!= MP_OKAY) goto LTM_ERR; + if (mp_init_multi(&a, NULL)!= MP_OKAY) goto LBL_ERR; - if ((err = mp_read_radix(&a, "123456", 10)) != MP_OKAY) goto LTM_ERR; + if ((err = mp_read_radix(&a, "123456", 10)) != MP_OKAY) goto LBL_ERR; - if ((err = mp_to_radix(&a, buf, SIZE_MAX, &written, 10)) != MP_OKAY) goto LTM_ERR; + if ((err = mp_to_radix(&a, buf, SIZE_MAX, &written, 10)) != MP_OKAY) goto LBL_ERR; printf(" '123456' a == %s, length = %zu\n", buf, written); - /* See comment in bn_mp_to_radix.c */ + /* See comment in mp_to_radix.c */ /* - if( (err = mp_to_radix(&a, buf, 3u, &written, 10) ) != MP_OKAY) goto LTM_ERR; + if( (err = mp_to_radix(&a, buf, 3u, &written, 10) ) != MP_OKAY) goto LBL_ERR; printf(" '56' a == %s, length = %zu\n", buf, written); - if( (err = mp_to_radix(&a, buf, 4u, &written, 10) ) != MP_OKAY) goto LTM_ERR; + if( (err = mp_to_radix(&a, buf, 4u, &written, 10) ) != MP_OKAY) goto LBL_ERR; printf(" '456' a == %s, length = %zu\n", buf, written); - if( (err = mp_to_radix(&a, buf, 30u, &written, 10) ) != MP_OKAY) goto LTM_ERR; + if( (err = mp_to_radix(&a, buf, 30u, &written, 10) ) != MP_OKAY) goto LBL_ERR; printf(" '123456' a == %s, length = %zu, error = %s\n", buf, written, mp_error_to_string(err)); */ - if ((err = mp_read_radix(&a, "-123456", 10)) != MP_OKAY) goto LTM_ERR; - if ((err = mp_to_radix(&a, buf, SIZE_MAX, &written, 10)) != MP_OKAY) goto LTM_ERR; + if ((err = mp_read_radix(&a, "-123456", 10)) != MP_OKAY) goto LBL_ERR; + if ((err = mp_to_radix(&a, buf, SIZE_MAX, &written, 10)) != MP_OKAY) goto LBL_ERR; printf(" '-123456' a == %s, length = %zu\n", buf, written); - if ((err = mp_read_radix(&a, "0", 10)) != MP_OKAY) goto LTM_ERR; - if ((err = mp_to_radix(&a, buf, SIZE_MAX, &written, 10)) != MP_OKAY) goto LTM_ERR; + if ((err = mp_read_radix(&a, "0", 10)) != MP_OKAY) goto LBL_ERR; + if ((err = mp_to_radix(&a, buf, SIZE_MAX, &written, 10)) != MP_OKAY) goto LBL_ERR; printf(" '0' a == %s, length = %zu\n", buf, written); while (0) { @@ -1291,7 +1291,7 @@ static int test_mp_read_radix(void) mp_clear(&a); return EXIT_SUCCESS; -LTM_ERR: +LBL_ERR: mp_clear(&a); return EXIT_FAILURE; } @@ -1696,61 +1696,61 @@ static int test_mp_incr(void) mp_err e = MP_OKAY; if ((e = mp_init_multi(&a, &b, NULL)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } /* Does it increment inside the limits of a MP_xBIT limb? */ mp_set(&a, MP_MASK/2); if ((e = mp_incr(&a)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if (mp_cmp_d(&a, (MP_MASK/2uL) + 1uL) != MP_EQ) { - goto LTM_ERR; + goto LBL_ERR; } /* Does it increment outside of the limits of a MP_xBIT limb? */ mp_set(&a, MP_MASK); mp_set(&b, MP_MASK); if ((e = mp_incr(&a)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((e = mp_add_d(&b, 1uL, &b)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if (mp_cmp(&a, &b) != MP_EQ) { - goto LTM_ERR; + goto LBL_ERR; } /* Does it increment from -1 to 0? */ mp_set(&a, 1uL); a.sign = MP_NEG; if ((e = mp_incr(&a)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if (mp_cmp_d(&a, 0uL) != MP_EQ) { - goto LTM_ERR; + goto LBL_ERR; } /* Does it increment from -(MP_MASK + 1) to -MP_MASK? */ mp_set(&a, MP_MASK); if ((e = mp_add_d(&a, 1uL, &a)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } a.sign = MP_NEG; if ((e = mp_incr(&a)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if (a.sign != MP_NEG) { - goto LTM_ERR; + goto LBL_ERR; } a.sign = MP_ZPOS; if (mp_cmp_d(&a, MP_MASK) != MP_EQ) { - goto LTM_ERR; + goto LBL_ERR; } mp_clear_multi(&a, &b, NULL); return EXIT_SUCCESS; -LTM_ERR: +LBL_ERR: mp_clear_multi(&a, &b, NULL); return EXIT_FAILURE; } @@ -1761,42 +1761,42 @@ static int test_mp_decr(void) mp_err e = MP_OKAY; if ((e = mp_init_multi(&a, &b, NULL)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } /* Does it decrement inside the limits of a MP_xBIT limb? */ mp_set(&a, MP_MASK/2); if ((e = mp_decr(&a)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if (mp_cmp_d(&a, (MP_MASK/2uL) - 1uL) != MP_EQ) { - goto LTM_ERR; + goto LBL_ERR; } /* Does it decrement outside of the limits of a MP_xBIT limb? */ mp_set(&a, MP_MASK); if ((e = mp_add_d(&a, 1uL, &a)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((e = mp_decr(&a)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if (mp_cmp_d(&a, MP_MASK) != MP_EQ) { - goto LTM_ERR; + goto LBL_ERR; } /* Does it decrement from 0 to -1? */ mp_zero(&a); if ((e = mp_decr(&a)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if (a.sign == MP_NEG) { a.sign = MP_ZPOS; if (mp_cmp_d(&a, 1uL) != MP_EQ) { - goto LTM_ERR; + goto LBL_ERR; } } else { - goto LTM_ERR; + goto LBL_ERR; } @@ -1806,18 +1806,18 @@ static int test_mp_decr(void) mp_set(&b, MP_MASK); b.sign = MP_NEG; if ((e = mp_sub_d(&b, 1uL, &b)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((e = mp_decr(&a)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if (mp_cmp(&a, &b) != MP_EQ) { - goto LTM_ERR; + goto LBL_ERR; } mp_clear_multi(&a, &b, NULL); return EXIT_SUCCESS; -LTM_ERR: +LBL_ERR: mp_clear_multi(&a, &b, NULL); return EXIT_FAILURE; } @@ -2044,13 +2044,13 @@ static int test_mp_root_u32(void) mp_read_radix(&r, root[i][j-3], 10); if (mp_cmp(&r, &c) != MP_EQ) { fprintf(stderr, "mp_root_u32 failed at input #%d, root #%d\n", i, j); - goto LTM_ERR; + goto LBL_ERR; } } } mp_clear_multi(&a, &c, &r, NULL); return EXIT_SUCCESS; -LTM_ERR: +LBL_ERR: mp_clear_multi(&a, &c, &r, NULL); return EXIT_FAILURE; } @@ -2067,31 +2067,31 @@ static int test_s_mp_balance_mul(void) "HzrSq9WVt1jDTVlwUxSKqxctu2GVD+N8+SVGaPFRqdxyld6IxDBbj27BPJzYUdR96k3sWpkO8XnDBvupGPnehpQe4KlO/KmN1PjFov/UTZYM+LYzkFcBPyV6hkkL8ePC1rlFLAHzgJMBCXVp4mRqtkQrDsZXXlcqlbTFu69wF6zDEysiX2cAtn/kP9ldblJiwYPCD8hG"; if ((e = mp_init_multi(&a, &b, &c, NULL)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((e = mp_read_radix(&a, na, 64)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((e = mp_read_radix(&b, nb, 64)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((e = s_mp_balance_mul(&a, &b, &c)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((e = mp_read_radix(&b, nc, 64)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if (mp_cmp(&b, &c) != MP_EQ) { - goto LTM_ERR; + goto LBL_ERR; } mp_clear_multi(&a, &b, &c, NULL); return EXIT_SUCCESS; -LTM_ERR: +LBL_ERR: mp_clear_multi(&a, &b, &c, NULL); return EXIT_FAILURE; } @@ -2103,30 +2103,30 @@ static int test_s_mp_karatsuba_mul(void) int size, err; if ((err = mp_init_multi(&a, &b, &c, &d, NULL)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } for (size = MP_KARATSUBA_MUL_CUTOFF; size < MP_KARATSUBA_MUL_CUTOFF + 20; size++) { if ((err = mp_rand(&a, size)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((err = mp_rand(&b, size)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((err = s_mp_karatsuba_mul(&a, &b, &c)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((err = s_mp_mul(&a,&b,&d)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if (mp_cmp(&c, &d) != MP_EQ) { fprintf(stderr, "Karatsuba multiplication failed at size %d\n", size); - goto LTM_ERR; + goto LBL_ERR; } } mp_clear_multi(&a, &b, &c, &d, NULL); return EXIT_SUCCESS; -LTM_ERR: +LBL_ERR: mp_clear_multi(&a, &b, &c, &d, NULL); return EXIT_FAILURE; } @@ -2137,27 +2137,27 @@ static int test_s_mp_karatsuba_sqr(void) int size, err; if ((err = mp_init_multi(&a, &b, &c, NULL)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } for (size = MP_KARATSUBA_SQR_CUTOFF; size < MP_KARATSUBA_SQR_CUTOFF + 20; size++) { if ((err = mp_rand(&a, size)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((err = s_mp_karatsuba_sqr(&a, &b)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((err = s_mp_sqr(&a, &c)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if (mp_cmp(&b, &c) != MP_EQ) { fprintf(stderr, "Karatsuba squaring failed at size %d\n", size); - goto LTM_ERR; + goto LBL_ERR; } } mp_clear_multi(&a, &b, &c, NULL); return EXIT_SUCCESS; -LTM_ERR: +LBL_ERR: mp_clear_multi(&a, &b, &c, NULL); return EXIT_FAILURE; } @@ -2172,70 +2172,70 @@ static int test_s_mp_toom_mul(void) #endif if ((err = mp_init_multi(&a, &b, &c, &d, NULL)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } /* This number construction is limb-size specific */ #if (MP_DIGIT_BIT == 60) if ((err = mp_rand(&a, 1196)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((err = mp_mul_2d(&a,71787 - mp_count_bits(&a), &a)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((err = mp_rand(&b, 1338)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((err = mp_mul_2d(&b, 80318 - mp_count_bits(&b), &b)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((err = mp_mul_2d(&b, 6310, &b)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((err = mp_2expt(&c, 99000 - 1000)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((err = mp_add(&b, &c, &b)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } tc_cutoff = TOOM_MUL_CUTOFF; TOOM_MUL_CUTOFF = INT_MAX; if ((err = mp_mul(&a, &b, &c)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } TOOM_MUL_CUTOFF = tc_cutoff; if ((err = mp_mul(&a, &b, &d)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if (mp_cmp(&c, &d) != MP_EQ) { fprintf(stderr, "Toom-Cook 3-way multiplication failed for edgecase f1 * f2\n"); - goto LTM_ERR; + goto LBL_ERR; } #endif for (size = MP_TOOM_MUL_CUTOFF; size < MP_TOOM_MUL_CUTOFF + 20; size++) { if ((err = mp_rand(&a, size)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((err = mp_rand(&b, size)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((err = s_mp_toom_mul(&a, &b, &c)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((err = s_mp_mul(&a,&b,&d)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if (mp_cmp(&c, &d) != MP_EQ) { fprintf(stderr, "Toom-Cook 3-way multiplication failed at size %d\n", size); - goto LTM_ERR; + goto LBL_ERR; } } mp_clear_multi(&a, &b, &c, &d, NULL); return EXIT_SUCCESS; -LTM_ERR: +LBL_ERR: mp_clear_multi(&a, &b, &c, &d, NULL); return EXIT_FAILURE; } @@ -2246,27 +2246,27 @@ static int test_s_mp_toom_sqr(void) int size, err; if ((err = mp_init_multi(&a, &b, &c, NULL)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } for (size = MP_TOOM_SQR_CUTOFF; size < MP_TOOM_SQR_CUTOFF + 20; size++) { if ((err = mp_rand(&a, size)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((err = s_mp_toom_sqr(&a, &b)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if ((err = s_mp_sqr(&a, &c)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if (mp_cmp(&b, &c) != MP_EQ) { fprintf(stderr, "Toom-Cook 3-way squaring failed at size %d\n", size); - goto LTM_ERR; + goto LBL_ERR; } } mp_clear_multi(&a, &b, &c, NULL); return EXIT_SUCCESS; -LTM_ERR: +LBL_ERR: mp_clear_multi(&a, &b, &c, NULL); return EXIT_FAILURE; } @@ -2294,33 +2294,33 @@ static int test_mp_radix_size(void) /* number to result in a different size for every base: 67^(4 * 67) */ mp_set(&a, 67); if ((err = mp_expt_u32(&a, 268u, &a)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } for (radix = 2; radix < 65; radix++) { if ((err = mp_radix_size(&a, radix, &size)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if (size != results[radix]) { fprintf(stderr, "mp_radix_size: result for base %d was %d instead of %d\n", radix, size, results[radix]); - goto LTM_ERR; + goto LBL_ERR; } a.sign = MP_NEG; if ((err = mp_radix_size(&a, radix, &size)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } if (size != (results[radix] + 1)) { fprintf(stderr, "mp_radix_size: result for base %d was %d instead of %d\n", radix, size, results[radix]); - goto LTM_ERR; + goto LBL_ERR; } a.sign = MP_ZPOS; } mp_clear(&a); return EXIT_SUCCESS; -LTM_ERR: +LBL_ERR: mp_clear(&a); return EXIT_FAILURE; } @@ -2335,11 +2335,11 @@ static int test_mp_read_write_ubin(void) unsigned char *buf = NULL; if ((err = mp_init_multi(&a, &b, &c, NULL)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } - if ((err = mp_rand(&a, 15)) != MP_OKAY) goto LTM_ERR; - if ((err = mp_neg(&a, &b)) != MP_OKAY) goto LTM_ERR; + if ((err = mp_rand(&a, 15)) != MP_OKAY) goto LBL_ERR; + if ((err = mp_neg(&a, &b)) != MP_OKAY) goto LBL_ERR; size = mp_ubin_size(&a); printf("mp_to_ubin_size %zu\n", size); @@ -2347,22 +2347,22 @@ static int test_mp_read_write_ubin(void) if (buf == NULL) { fprintf(stderr, "test_read_write_binaries (u) failed to allocate %zu bytes\n", sizeof(*buf) * size); - goto LTM_ERR; + goto LBL_ERR; } - if ((err = mp_to_ubin(&a, buf, size, &len)) != MP_OKAY) goto LTM_ERR; + if ((err = mp_to_ubin(&a, buf, size, &len)) != MP_OKAY) goto LBL_ERR; printf("mp_to_ubin len = %zu\n", len); - if ((err = mp_from_ubin(&c, buf, len)) != MP_OKAY) goto LTM_ERR; + if ((err = mp_from_ubin(&c, buf, len)) != MP_OKAY) goto LBL_ERR; if (mp_cmp(&a, &c) != MP_EQ) { fprintf(stderr, "to/from ubin cycle failed\n"); - goto LTM_ERR; + goto LBL_ERR; } free(buf); mp_clear_multi(&a, &b, &c, NULL); return EXIT_SUCCESS; -LTM_ERR: +LBL_ERR: free(buf); mp_clear_multi(&a, &b, &c, NULL); return EXIT_FAILURE; @@ -2376,11 +2376,11 @@ static int test_mp_read_write_sbin(void) unsigned char *buf = NULL; if ((err = mp_init_multi(&a, &b, &c, NULL)) != MP_OKAY) { - goto LTM_ERR; + goto LBL_ERR; } - if ((err = mp_rand(&a, 15)) != MP_OKAY) goto LTM_ERR; - if ((err = mp_neg(&a, &b)) != MP_OKAY) goto LTM_ERR; + if ((err = mp_rand(&a, 15)) != MP_OKAY) goto LBL_ERR; + if ((err = mp_neg(&a, &b)) != MP_OKAY) goto LBL_ERR; size = mp_sbin_size(&a); printf("mp_to_sbin_size %zu\n", size); @@ -2388,23 +2388,23 @@ static int test_mp_read_write_sbin(void) if (buf == NULL) { fprintf(stderr, "test_read_write_binaries (s) failed to allocate %zu bytes\n", sizeof(*buf) * size); - goto LTM_ERR; + goto LBL_ERR; } - if ((err = mp_to_sbin(&b, buf, size, &len)) != MP_OKAY) goto LTM_ERR; + if ((err = mp_to_sbin(&b, buf, size, &len)) != MP_OKAY) goto LBL_ERR; printf("mp_to_sbin len = %zu\n", len); - if ((err = mp_from_sbin(&c, buf, len)) != MP_OKAY) goto LTM_ERR; + if ((err = mp_from_sbin(&c, buf, len)) != MP_OKAY) goto LBL_ERR; if (mp_cmp(&b, &c) != MP_EQ) { fprintf(stderr, "to/from ubin cycle failed\n"); - goto LTM_ERR; + goto LBL_ERR; } free(buf); mp_clear_multi(&a, &b, &c, NULL); return EXIT_SUCCESS; -LTM_ERR: +LBL_ERR: free(buf); mp_clear_multi(&a, &b, &c, NULL); return EXIT_FAILURE; @@ -2420,31 +2420,31 @@ static int test_mp_pack_unpack(void) mp_order order = MP_LSB_FIRST; mp_endian endianess = MP_NATIVE_ENDIAN; - if ((err = mp_init_multi(&a, &b, NULL)) != MP_OKAY) goto LTM_ERR; - if ((err = mp_rand(&a, 15)) != MP_OKAY) goto LTM_ERR; + if ((err = mp_init_multi(&a, &b, NULL)) != MP_OKAY) goto LBL_ERR; + if ((err = mp_rand(&a, 15)) != MP_OKAY) goto LBL_ERR; count = mp_pack_count(&a, 0, 1); buf = malloc(count); if (buf == NULL) { fprintf(stderr, "test_pack_unpack failed to allocate\n"); - goto LTM_ERR; + goto LBL_ERR; } if ((err = mp_pack((void *)buf, count, &written, order, 1, - endianess, 0, &a)) != MP_OKAY) goto LTM_ERR; + endianess, 0, &a)) != MP_OKAY) goto LBL_ERR; if ((err = mp_unpack(&b, count, order, 1, - endianess, 0, (const void *)buf)) != MP_OKAY) goto LTM_ERR; + endianess, 0, (const void *)buf)) != MP_OKAY) goto LBL_ERR; if (mp_cmp(&a, &b) != MP_EQ) { fprintf(stderr, "pack/unpack cycle failed\n"); - goto LTM_ERR; + goto LBL_ERR; } free(buf); mp_clear_multi(&a, &b, NULL); return EXIT_SUCCESS; -LTM_ERR: +LBL_ERR: free(buf); mp_clear_multi(&a, &b, NULL); return EXIT_FAILURE; diff --git a/doc/bn.tex b/doc/bn.tex index 27f27e75e..fe6b5c6ee 100644 --- a/doc/bn.tex +++ b/doc/bn.tex @@ -174,11 +174,11 @@ \subsubsection{OpenBSD} cc -I./ -Wall -Wsign-compare -Wextra -Wshadow -Wsystem-headers -Wdeclaration-afo... cc -I./ -Wall -Wsign-compare -Wextra -Wshadow -Wsystem-headers -Wdeclaration-afo... cc -I./ -Wall -Wsign-compare -Wextra -Wshadow -Wsystem-headers -Wdeclaration-afo... -libtool --mode=link --tag=CC cc bn_error.lo bn_s_mp_invmod_fast.lo bn_fast_mp_mo -libtool: link: cc bn_error.lo bn_s_mp_invmod_fast.lo bn_s_mp_montgomery_reduce_fast0 -bn_error.lo: file not recognized: File format not recognized +libtool --mode=link --tag=CC cc error.lo s_mp_invmod_fast.lo fast_mp_mo +libtool: link: cc error.lo s_mp_invmod_fast.lo s_mp_montgomery_reduce_fast0 +error.lo: file not recognized: File format not recognized cc: error: linker command failed with exit code 1 (use -v to see invocation) -Error while executing cc bn_error.lo bn_s_mp_invmod_fast.lo bn_fast_mp_montgomery0 +Error while executing cc error.lo s_mp_invmod_fast.lo fast_mp_montgomery0 gmake: *** [makefile.shared:64: libtommath.la] Error 1 \end{alltt} @@ -259,7 +259,7 @@ \section{Build Configuration} \subsection{Build Depends} In the file tommath\_class.h you will see a large list of C ``defines'' followed by a series of ``ifdefs'' which further define symbols. All of the symbols (technically they're macros $\ldots$) represent a given C source -file. For instance, BN\_MP\_ADD\_C represents the file ``bn\_mp\_add.c''. When a define has been enabled the +file. For instance, MP\_ADD\_C represents the file ``bn\_mp\_add.c''. When a define has been enabled the function in the respective file will be compiled and linked into the library. Accordingly when the define is absent the file will not be compiled and not contribute any size to the library. @@ -275,7 +275,7 @@ \subsection{Build Tweaks} \begin{center} \begin{tabular}{|l|l|} \hline \textbf{Define} & \textbf{Purpose} \\ -\hline BN\_MP\_DIV\_SMALL & Enables a slower, smaller and equally \\ +\hline MP\_DIV\_SMALL & Enables a slower, smaller and equally \\ & functional mp\_div() function \\ \hline \end{tabular} @@ -293,20 +293,20 @@ \subsubsection{Moduli Related} \begin{center} \begin{tabular}{|l|l|} \hline \textbf{Restriction} & \textbf{Undefine} \\ -\hline Exponentiation with odd moduli only & BN\_S\_MP\_EXPTMOD\_C \\ - & BN\_MP\_REDUCE\_C \\ - & BN\_MP\_REDUCE\_SETUP\_C \\ - & BN\_S\_MP\_MUL\_HIGH\_DIGS\_C \\ - & BN\_FAST\_S\_MP\_MUL\_HIGH\_DIGS\_C \\ +\hline Exponentiation with odd moduli only & S\_MP\_EXPTMOD\_C \\ + & MP\_REDUCE\_C \\ + & MP\_REDUCE\_SETUP\_C \\ + & S\_MP\_MUL\_HIGH\_DIGS\_C \\ + & FAST\_S\_MP\_MUL\_HIGH\_DIGS\_C \\ \hline Exponentiation with random odd moduli & (The above plus the following) \\ - & BN\_MP\_REDUCE\_2K\_C \\ - & BN\_MP\_REDUCE\_2K\_SETUP\_C \\ - & BN\_MP\_REDUCE\_IS\_2K\_C \\ - & BN\_MP\_DR\_IS\_MODULUS\_C \\ - & BN\_MP\_DR\_REDUCE\_C \\ - & BN\_MP\_DR\_SETUP\_C \\ -\hline Modular inverse odd moduli only & BN\_MP\_INVMOD\_SLOW\_C \\ -\hline Modular inverse (both, smaller/slower) & BN\_FAST\_MP\_INVMOD\_C \\ + & MP\_REDUCE\_2K\_C \\ + & MP\_REDUCE\_2K\_SETUP\_C \\ + & MP\_REDUCE\_IS\_2K\_C \\ + & MP\_DR\_IS\_MODULUS\_C \\ + & MP\_DR\_REDUCE\_C \\ + & MP\_DR\_SETUP\_C \\ +\hline Modular inverse odd moduli only & MP\_INVMOD\_SLOW\_C \\ +\hline Modular inverse (both, smaller/slower) & FAST\_MP\_INVMOD\_C \\ \hline \end{tabular} \end{center} @@ -317,14 +317,14 @@ \subsubsection{Operand Size Related} \begin{center} \begin{tabular}{|l|l|} \hline \textbf{Restriction} & \textbf{Undefine} \\ -\hline Moduli $\le 2560$ bits & BN\_MP\_MONTGOMERY\_REDUCE\_C \\ - & BN\_S\_MP\_MUL\_DIGS\_C \\ - & BN\_S\_MP\_MUL\_HIGH\_DIGS\_C \\ - & BN\_S\_MP\_SQR\_C \\ -\hline Polynomial Schmolynomial & BN\_MP\_KARATSUBA\_MUL\_C \\ - & BN\_MP\_KARATSUBA\_SQR\_C \\ - & BN\_MP\_TOOM\_MUL\_C \\ - & BN\_MP\_TOOM\_SQR\_C \\ +\hline Moduli $\le 2560$ bits & MP\_MONTGOMERY\_REDUCE\_C \\ + & S\_MP\_MUL\_DIGS\_C \\ + & S\_MP\_MUL\_HIGH\_DIGS\_C \\ + & S\_MP\_SQR\_C \\ +\hline Polynomial Schmolynomial & MP\_KARATSUBA\_MUL\_C \\ + & MP\_KARATSUBA\_SQR\_C \\ + & MP\_TOOM\_MUL\_C \\ + & MP\_TOOM\_SQR\_C \\ \hline \end{tabular} diff --git a/etc/tune.c b/etc/tune.c index 057e372fc..389ce2f69 100644 --- a/etc/tune.c +++ b/etc/tune.c @@ -67,39 +67,39 @@ static uint64_t s_time_mul(int size) if ((e = mp_init_multi(&a, &b, &c, &d, NULL)) != MP_OKAY) { t1 = UINT64_MAX; - goto LTM_ERR; + goto LBL_ERR; } if ((e = mp_rand(&a, size * s_offset)) != MP_OKAY) { t1 = UINT64_MAX; - goto LTM_ERR; + goto LBL_ERR; } if ((e = mp_rand(&b, size)) != MP_OKAY) { t1 = UINT64_MAX; - goto LTM_ERR; + goto LBL_ERR; } s_timer_start(); for (x = 0; x < s_number_of_test_loops; x++) { if ((e = mp_mul(&a,&b,&c)) != MP_OKAY) { t1 = UINT64_MAX; - goto LTM_ERR; + goto LBL_ERR; } if (s_check_result == 1) { if ((e = s_mp_mul(&a,&b,&d)) != MP_OKAY) { t1 = UINT64_MAX; - goto LTM_ERR; + goto LBL_ERR; } if (mp_cmp(&c, &d) != MP_EQ) { /* Time of 0 cannot happen (famous last words?) */ t1 = 0uLL; - goto LTM_ERR; + goto LBL_ERR; } } } t1 = s_timer_stop(); -LTM_ERR: +LBL_ERR: mp_clear_multi(&a, &b, &c, &d, NULL); return t1; } @@ -112,34 +112,34 @@ static uint64_t s_time_sqr(int size) if ((e = mp_init_multi(&a, &b, &c, NULL)) != MP_OKAY) { t1 = UINT64_MAX; - goto LTM_ERR; + goto LBL_ERR; } if ((e = mp_rand(&a, size)) != MP_OKAY) { t1 = UINT64_MAX; - goto LTM_ERR; + goto LBL_ERR; } s_timer_start(); for (x = 0; x < s_number_of_test_loops; x++) { if ((e = mp_sqr(&a,&b)) != MP_OKAY) { t1 = UINT64_MAX; - goto LTM_ERR; + goto LBL_ERR; } if (s_check_result == 1) { if ((e = s_mp_sqr(&a,&c)) != MP_OKAY) { t1 = UINT64_MAX; - goto LTM_ERR; + goto LBL_ERR; } if (mp_cmp(&c, &b) != MP_EQ) { t1 = 0uLL; - goto LTM_ERR; + goto LBL_ERR; } } } t1 = s_timer_stop(); -LTM_ERR: +LBL_ERR: mp_clear_multi(&a, &b, &c, NULL); return t1; } diff --git a/gen.pl b/gen.pl index 332994d5c..4db24b547 100644 --- a/gen.pl +++ b/gen.pl @@ -7,7 +7,7 @@ use warnings; open(my $out, '>', 'mpi.c') or die "Couldn't open mpi.c for writing: $!"; -foreach my $filename (glob 'bn*.c') { +foreach my $filename (glob '*mp_*.c') { open(my $src, '<', $filename) or die "Couldn't open $filename for reading: $!"; print {$out} "/* Start: $filename */\n"; print {$out} $_ while <$src>; diff --git a/helper.pl b/helper.pl index 03b081ccc..a519619ff 100755 --- a/helper.pl +++ b/helper.pl @@ -270,7 +270,7 @@ sub draw_func my ($deplist, $depmap, $out, $indent, $funcslist) = @_; my @funcs = split ',', $funcslist; # try this if you want to have a look at a minimized version of the callgraph without all the trivial functions - #if ($deplist =~ /$funcs[0]/ || $funcs[0] =~ /BN_MP_(ADD|SUB|CLEAR|CLEAR_\S+|DIV|MUL|COPY|ZERO|GROW|CLAMP|INIT|INIT_\S+|SET|ABS|CMP|CMP_D|EXCH)_C/) { + #if ($deplist =~ /$funcs[0]/ || $funcs[0] =~ /MP_(ADD|SUB|CLEAR|CLEAR_\S+|DIV|MUL|COPY|ZERO|GROW|CLAMP|INIT|INIT_\S+|SET|ABS|CMP|CMP_D|EXCH)_C/) { if ($deplist =~ /$funcs[0]/) { return $deplist; } else { @@ -309,7 +309,7 @@ sub update_dep #if defined(LTM_ALL) EOS - foreach my $filename (glob 'bn*.c') { + foreach my $filename (glob '*mp_*.c') { my $define = $filename; print "Processing $filename\n"; @@ -356,7 +356,7 @@ sub update_dep # now do classes my %depmap; - foreach my $filename (glob 'bn*.c') { + foreach my $filename (glob '*mp_*.c') { my $content; my $cc = $ENV{'CC'} || 'gcc'; $content = `$cc -E -x c -DLTM_ALL $filename`; @@ -379,7 +379,7 @@ sub update_dep my $a = $&; next if $a eq "mp_err"; $a =~ tr/[a-z]/[A-Z]/; - $a = 'BN_' . $a . '_C'; + $a = $a . '_C'; push @deps, $a; } } diff --git a/libtommath_VS2008.vcproj b/libtommath_VS2008.vcproj index 7e5192994..ccbd1cc7f 100644 --- a/libtommath_VS2008.vcproj +++ b/libtommath_VS2008.vcproj @@ -313,627 +313,627 @@ used - 1; x >= b; x--) { *top-- = *bottom--; diff --git a/bn_mp_mod.c b/mp_mod.c similarity index 97% rename from bn_mp_mod.c rename to mp_mod.c index 8fbfe08dc..349fecebb 100644 --- a/bn_mp_mod.c +++ b/mp_mod.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_MOD_C +#ifdef MP_MOD_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_mod_2d.c b/mp_mod_2d.c similarity index 97% rename from bn_mp_mod_2d.c rename to mp_mod_2d.c index 5bf57a1a3..651c79a6c 100644 --- a/bn_mp_mod_2d.c +++ b/mp_mod_2d.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_MOD_2D_C +#ifdef MP_MOD_2D_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_mod_d.c b/mp_mod_d.c similarity index 92% rename from bn_mp_mod_d.c rename to mp_mod_d.c index 0b6c12a9e..3f7e1917f 100644 --- a/bn_mp_mod_d.c +++ b/mp_mod_d.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_MOD_D_C +#ifdef MP_MOD_D_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_montgomery_calc_normalization.c b/mp_montgomery_calc_normalization.c similarity index 96% rename from bn_mp_montgomery_calc_normalization.c rename to mp_montgomery_calc_normalization.c index 837978925..0d0d5c482 100644 --- a/bn_mp_montgomery_calc_normalization.c +++ b/mp_montgomery_calc_normalization.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +#ifdef MP_MONTGOMERY_CALC_NORMALIZATION_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_montgomery_reduce.c b/mp_montgomery_reduce.c similarity index 98% rename from bn_mp_montgomery_reduce.c rename to mp_montgomery_reduce.c index ffe8341ee..a872aba6b 100644 --- a/bn_mp_montgomery_reduce.c +++ b/mp_montgomery_reduce.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_MONTGOMERY_REDUCE_C +#ifdef MP_MONTGOMERY_REDUCE_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_montgomery_setup.c b/mp_montgomery_setup.c similarity index 97% rename from bn_mp_montgomery_setup.c rename to mp_montgomery_setup.c index ad245eb8c..de57dc342 100644 --- a/bn_mp_montgomery_setup.c +++ b/mp_montgomery_setup.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_MONTGOMERY_SETUP_C +#ifdef MP_MONTGOMERY_SETUP_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_mul.c b/mp_mul.c similarity index 99% rename from bn_mp_mul.c rename to mp_mul.c index 561913a5e..bb0b65215 100644 --- a/bn_mp_mul.c +++ b/mp_mul.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_MUL_C +#ifdef MP_MUL_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_mul_2.c b/mp_mul_2.c similarity index 98% rename from bn_mp_mul_2.c rename to mp_mul_2.c index bc0691a0d..cd5589dd2 100644 --- a/bn_mp_mul_2.c +++ b/mp_mul_2.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_MUL_2_C +#ifdef MP_MUL_2_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_mul_2d.c b/mp_mul_2d.c similarity index 98% rename from bn_mp_mul_2d.c rename to mp_mul_2d.c index 87354de20..1ba53a0fc 100644 --- a/bn_mp_mul_2d.c +++ b/mp_mul_2d.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_MUL_2D_C +#ifdef MP_MUL_2D_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_mul_d.c b/mp_mul_d.c similarity index 98% rename from bn_mp_mul_d.c rename to mp_mul_d.c index b56dfa3c9..399dc7b47 100644 --- a/bn_mp_mul_d.c +++ b/mp_mul_d.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_MUL_D_C +#ifdef MP_MUL_D_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_mulmod.c b/mp_mulmod.c similarity index 95% rename from bn_mp_mulmod.c rename to mp_mulmod.c index 160d1626a..55b635b79 100644 --- a/bn_mp_mulmod.c +++ b/mp_mulmod.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_MULMOD_C +#ifdef MP_MULMOD_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_neg.c b/mp_neg.c similarity index 96% rename from bn_mp_neg.c rename to mp_neg.c index 264d90097..01fb27635 100644 --- a/bn_mp_neg.c +++ b/mp_neg.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_NEG_C +#ifdef MP_NEG_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_or.c b/mp_or.c similarity index 98% rename from bn_mp_or.c rename to mp_or.c index cdacbfbe5..7fa13756e 100644 --- a/bn_mp_or.c +++ b/mp_or.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_OR_C +#ifdef MP_OR_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_pack.c b/mp_pack.c similarity index 98% rename from bn_mp_pack.c rename to mp_pack.c index 6e00b6fc6..ec0f62f69 100644 --- a/bn_mp_pack.c +++ b/mp_pack.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_PACK_C +#ifdef MP_PACK_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_pack_count.c b/mp_pack_count.c similarity index 93% rename from bn_mp_pack_count.c rename to mp_pack_count.c index dfecdf98f..aa682ba6c 100644 --- a/bn_mp_pack_count.c +++ b/mp_pack_count.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_PACK_COUNT_C +#ifdef MP_PACK_COUNT_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_prime_fermat.c b/mp_prime_fermat.c similarity index 97% rename from bn_mp_prime_fermat.c rename to mp_prime_fermat.c index af3e884bb..c6bc720f8 100644 --- a/bn_mp_prime_fermat.c +++ b/mp_prime_fermat.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_PRIME_FERMAT_C +#ifdef MP_PRIME_FERMAT_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_prime_frobenius_underwood.c b/mp_prime_frobenius_underwood.c similarity index 97% rename from bn_mp_prime_frobenius_underwood.c rename to mp_prime_frobenius_underwood.c index 618aa7c01..ced0583a2 100644 --- a/bn_mp_prime_frobenius_underwood.c +++ b/mp_prime_frobenius_underwood.c @@ -1,11 +1,11 @@ #include "tommath_private.h" -#ifdef BN_MP_PRIME_FROBENIUS_UNDERWOOD_C +#ifdef MP_PRIME_FROBENIUS_UNDERWOOD_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ /* - * See file bn_mp_prime_is_prime.c or the documentation in doc/bn.tex for the details + * See file mp_prime_is_prime.c or the documentation in doc/bn.tex for the details */ #ifndef LTM_USE_ONLY_MR diff --git a/bn_mp_prime_is_prime.c b/mp_prime_is_prime.c similarity index 99% rename from bn_mp_prime_is_prime.c rename to mp_prime_is_prime.c index 86edcb692..75d44c5f2 100644 --- a/bn_mp_prime_is_prime.c +++ b/mp_prime_is_prime.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_PRIME_IS_PRIME_C +#ifdef MP_PRIME_IS_PRIME_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_prime_miller_rabin.c b/mp_prime_miller_rabin.c similarity index 98% rename from bn_mp_prime_miller_rabin.c rename to mp_prime_miller_rabin.c index 96470dba7..f6d698b9c 100644 --- a/bn_mp_prime_miller_rabin.c +++ b/mp_prime_miller_rabin.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_PRIME_MILLER_RABIN_C +#ifdef MP_PRIME_MILLER_RABIN_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_prime_next_prime.c b/mp_prime_next_prime.c similarity index 99% rename from bn_mp_prime_next_prime.c rename to mp_prime_next_prime.c index de27eabc7..3e2571a72 100644 --- a/bn_mp_prime_next_prime.c +++ b/mp_prime_next_prime.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_PRIME_NEXT_PRIME_C +#ifdef MP_PRIME_NEXT_PRIME_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_prime_rabin_miller_trials.c b/mp_prime_rabin_miller_trials.c similarity index 97% rename from bn_mp_prime_rabin_miller_trials.c rename to mp_prime_rabin_miller_trials.c index 8bbaf6cf9..1728142c5 100644 --- a/bn_mp_prime_rabin_miller_trials.c +++ b/mp_prime_rabin_miller_trials.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_PRIME_RABIN_MILLER_TRIALS_C +#ifdef MP_PRIME_RABIN_MILLER_TRIALS_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_prime_rand.c b/mp_prime_rand.c similarity index 99% rename from bn_mp_prime_rand.c rename to mp_prime_rand.c index af19d76c3..b37089b17 100644 --- a/bn_mp_prime_rand.c +++ b/mp_prime_rand.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_PRIME_RAND_C +#ifdef MP_PRIME_RAND_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_prime_strong_lucas_selfridge.c b/mp_prime_strong_lucas_selfridge.c similarity index 98% rename from bn_mp_prime_strong_lucas_selfridge.c rename to mp_prime_strong_lucas_selfridge.c index a5ea16de6..693433627 100644 --- a/bn_mp_prime_strong_lucas_selfridge.c +++ b/mp_prime_strong_lucas_selfridge.c @@ -1,11 +1,11 @@ #include "tommath_private.h" -#ifdef BN_MP_PRIME_STRONG_LUCAS_SELFRIDGE_C +#ifdef MP_PRIME_STRONG_LUCAS_SELFRIDGE_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ /* - * See file bn_mp_prime_is_prime.c or the documentation in doc/bn.tex for the details + * See file mp_prime_is_prime.c or the documentation in doc/bn.tex for the details */ #ifndef LTM_USE_ONLY_MR diff --git a/bn_prime_tab.c b/mp_prime_tab.c similarity index 99% rename from bn_prime_tab.c rename to mp_prime_tab.c index 92a515971..24b4016f4 100644 --- a/bn_prime_tab.c +++ b/mp_prime_tab.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_PRIME_TAB_C +#ifdef MP_PRIME_TAB_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_radix_size.c b/mp_radix_size.c similarity index 96% rename from bn_mp_radix_size.c rename to mp_radix_size.c index 5ed9ab1bd..387e0ec92 100644 --- a/bn_mp_radix_size.c +++ b/mp_radix_size.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_RADIX_SIZE_C +#ifdef MP_RADIX_SIZE_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_radix_smap.c b/mp_radix_smap.c similarity index 97% rename from bn_mp_radix_smap.c rename to mp_radix_smap.c index e7d7c06b6..678e806a7 100644 --- a/bn_mp_radix_smap.c +++ b/mp_radix_smap.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_RADIX_SMAP_C +#ifdef MP_RADIX_SMAP_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_rand.c b/mp_rand.c similarity index 98% rename from bn_mp_rand.c rename to mp_rand.c index 7e9052c2b..df665b7ba 100644 --- a/bn_mp_rand.c +++ b/mp_rand.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_RAND_C +#ifdef MP_RAND_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_read_radix.c b/mp_read_radix.c similarity index 98% rename from bn_mp_read_radix.c rename to mp_read_radix.c index 456a387a3..dc5e16782 100644 --- a/bn_mp_read_radix.c +++ b/mp_read_radix.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_READ_RADIX_C +#ifdef MP_READ_RADIX_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_reduce.c b/mp_reduce.c similarity index 98% rename from bn_mp_reduce.c rename to mp_reduce.c index 3c669d491..1b4435c95 100644 --- a/bn_mp_reduce.c +++ b/mp_reduce.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_REDUCE_C +#ifdef MP_REDUCE_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_reduce_2k.c b/mp_reduce_2k.c similarity index 97% rename from bn_mp_reduce_2k.c rename to mp_reduce_2k.c index 1cea6cb21..5d3c7f90c 100644 --- a/bn_mp_reduce_2k.c +++ b/mp_reduce_2k.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_REDUCE_2K_C +#ifdef MP_REDUCE_2K_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_reduce_2k_l.c b/mp_reduce_2k_l.c similarity index 97% rename from bn_mp_reduce_2k_l.c rename to mp_reduce_2k_l.c index 6a9f3d31b..6328cbc7d 100644 --- a/bn_mp_reduce_2k_l.c +++ b/mp_reduce_2k_l.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_REDUCE_2K_L_C +#ifdef MP_REDUCE_2K_L_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_reduce_2k_setup.c b/mp_reduce_2k_setup.c similarity index 95% rename from bn_mp_reduce_2k_setup.c rename to mp_reduce_2k_setup.c index 2eaf7addf..0f3fd291e 100644 --- a/bn_mp_reduce_2k_setup.c +++ b/mp_reduce_2k_setup.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_REDUCE_2K_SETUP_C +#ifdef MP_REDUCE_2K_SETUP_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_reduce_2k_setup_l.c b/mp_reduce_2k_setup_l.c similarity index 94% rename from bn_mp_reduce_2k_setup_l.c rename to mp_reduce_2k_setup_l.c index 4f9aa14d1..b647c9d88 100644 --- a/bn_mp_reduce_2k_setup_l.c +++ b/mp_reduce_2k_setup_l.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_REDUCE_2K_SETUP_L_C +#ifdef MP_REDUCE_2K_SETUP_L_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_reduce_is_2k.c b/mp_reduce_is_2k.c similarity index 96% rename from bn_mp_reduce_is_2k.c rename to mp_reduce_is_2k.c index a9f4f9f2b..ec1233861 100644 --- a/bn_mp_reduce_is_2k.c +++ b/mp_reduce_is_2k.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_REDUCE_IS_2K_C +#ifdef MP_REDUCE_IS_2K_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_reduce_is_2k_l.c b/mp_reduce_is_2k_l.c similarity index 95% rename from bn_mp_reduce_is_2k_l.c rename to mp_reduce_is_2k_l.c index 4bc69bef8..1aa3d4e0c 100644 --- a/bn_mp_reduce_is_2k_l.c +++ b/mp_reduce_is_2k_l.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_REDUCE_IS_2K_L_C +#ifdef MP_REDUCE_IS_2K_L_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_reduce_setup.c b/mp_reduce_setup.c similarity index 94% rename from bn_mp_reduce_setup.c rename to mp_reduce_setup.c index f02160fa5..e12056e1e 100644 --- a/bn_mp_reduce_setup.c +++ b/mp_reduce_setup.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_REDUCE_SETUP_C +#ifdef MP_REDUCE_SETUP_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_root_u32.c b/mp_root_u32.c similarity index 99% rename from bn_mp_root_u32.c rename to mp_root_u32.c index ba65549c6..f6827493c 100644 --- a/bn_mp_root_u32.c +++ b/mp_root_u32.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_ROOT_U32_C +#ifdef MP_ROOT_U32_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_rshd.c b/mp_rshd.c similarity index 98% rename from bn_mp_rshd.c rename to mp_rshd.c index bb8743e3b..2eabb1234 100644 --- a/bn_mp_rshd.c +++ b/mp_rshd.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_RSHD_C +#ifdef MP_RSHD_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_sbin_size.c b/mp_sbin_size.c similarity index 91% rename from bn_mp_sbin_size.c rename to mp_sbin_size.c index e0993d690..2f40df3e1 100644 --- a/bn_mp_sbin_size.c +++ b/mp_sbin_size.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_SBIN_SIZE_C +#ifdef MP_SBIN_SIZE_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_set.c b/mp_set.c similarity index 94% rename from bn_mp_set.c rename to mp_set.c index 44ac6df57..0777f09d7 100644 --- a/bn_mp_set.c +++ b/mp_set.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_SET_C +#ifdef MP_SET_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_set_double.c b/mp_set_double.c similarity index 97% rename from bn_mp_set_double.c rename to mp_set_double.c index a42fc70d9..f7e3b8d14 100644 --- a/bn_mp_set_double.c +++ b/mp_set_double.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_SET_DOUBLE_C +#ifdef MP_SET_DOUBLE_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_set_i32.c b/mp_set_i32.c similarity index 89% rename from bn_mp_set_i32.c rename to mp_set_i32.c index df4513d37..123613ecc 100644 --- a/bn_mp_set_i32.c +++ b/mp_set_i32.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_SET_I32_C +#ifdef MP_SET_I32_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_set_i64.c b/mp_set_i64.c similarity index 89% rename from bn_mp_set_i64.c rename to mp_set_i64.c index 395103bf5..4635ca3a5 100644 --- a/bn_mp_set_i64.c +++ b/mp_set_i64.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_SET_I64_C +#ifdef MP_SET_I64_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_set_l.c b/mp_set_l.c similarity index 90% rename from bn_mp_set_l.c rename to mp_set_l.c index 1e445fb62..411f6eb08 100644 --- a/bn_mp_set_l.c +++ b/mp_set_l.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_SET_L_C +#ifdef MP_SET_L_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_set_ll.c b/mp_set_ll.c similarity index 90% rename from bn_mp_set_ll.c rename to mp_set_ll.c index 3e2324f32..343012de2 100644 --- a/bn_mp_set_ll.c +++ b/mp_set_ll.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_SET_LL_C +#ifdef MP_SET_LL_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_set_u32.c b/mp_set_u32.c similarity index 88% rename from bn_mp_set_u32.c rename to mp_set_u32.c index 18ba5e14c..8ff84dc22 100644 --- a/bn_mp_set_u32.c +++ b/mp_set_u32.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_SET_U32_C +#ifdef MP_SET_U32_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_set_u64.c b/mp_set_u64.c similarity index 88% rename from bn_mp_set_u64.c rename to mp_set_u64.c index 88fab6c54..9acb1fefe 100644 --- a/bn_mp_set_u64.c +++ b/mp_set_u64.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_SET_U64_C +#ifdef MP_SET_U64_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_set_ul.c b/mp_set_ul.c similarity index 89% rename from bn_mp_set_ul.c rename to mp_set_ul.c index adfd85c7f..baf8e186e 100644 --- a/bn_mp_set_ul.c +++ b/mp_set_ul.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_SET_UL_C +#ifdef MP_SET_UL_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_set_ull.c b/mp_set_ull.c similarity index 89% rename from bn_mp_set_ull.c rename to mp_set_ull.c index 8fbc1bd2c..cd10b1cd4 100644 --- a/bn_mp_set_ull.c +++ b/mp_set_ull.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_SET_ULL_C +#ifdef MP_SET_ULL_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_shrink.c b/mp_shrink.c similarity index 96% rename from bn_mp_shrink.c rename to mp_shrink.c index cf27ed9ec..6c3c95ba4 100644 --- a/bn_mp_shrink.c +++ b/mp_shrink.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_SHRINK_C +#ifdef MP_SHRINK_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_signed_rsh.c b/mp_signed_rsh.c similarity index 95% rename from bn_mp_signed_rsh.c rename to mp_signed_rsh.c index 8d8d8414d..c56dfba6a 100644 --- a/bn_mp_signed_rsh.c +++ b/mp_signed_rsh.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_SIGNED_RSH_C +#ifdef MP_SIGNED_RSH_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_sqr.c b/mp_sqr.c similarity index 97% rename from bn_mp_sqr.c rename to mp_sqr.c index e0d0a73e4..e38130b64 100644 --- a/bn_mp_sqr.c +++ b/mp_sqr.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_SQR_C +#ifdef MP_SQR_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_sqrmod.c b/mp_sqrmod.c similarity index 95% rename from bn_mp_sqrmod.c rename to mp_sqrmod.c index 626ea2c29..f1a92eff4 100644 --- a/bn_mp_sqrmod.c +++ b/mp_sqrmod.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_SQRMOD_C +#ifdef MP_SQRMOD_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_sqrt.c b/mp_sqrt.c similarity index 98% rename from bn_mp_sqrt.c rename to mp_sqrt.c index 82d682467..283986834 100644 --- a/bn_mp_sqrt.c +++ b/mp_sqrt.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_SQRT_C +#ifdef MP_SQRT_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_sqrtmod_prime.c b/mp_sqrtmod_prime.c similarity index 99% rename from bn_mp_sqrtmod_prime.c rename to mp_sqrtmod_prime.c index a833ed7c1..bf72005b3 100644 --- a/bn_mp_sqrtmod_prime.c +++ b/mp_sqrtmod_prime.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_SQRTMOD_PRIME_C +#ifdef MP_SQRTMOD_PRIME_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_sub.c b/mp_sub.c similarity index 98% rename from bn_mp_sub.c rename to mp_sub.c index c1ea39e11..c859026f5 100644 --- a/bn_mp_sub.c +++ b/mp_sub.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_SUB_C +#ifdef MP_SUB_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_sub_d.c b/mp_sub_d.c similarity index 98% rename from bn_mp_sub_d.c rename to mp_sub_d.c index 3ebf9b485..16c61658a 100644 --- a/bn_mp_sub_d.c +++ b/mp_sub_d.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_SUB_D_C +#ifdef MP_SUB_D_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_submod.c b/mp_submod.c similarity index 95% rename from bn_mp_submod.c rename to mp_submod.c index 5ebd37498..c5dc40155 100644 --- a/bn_mp_submod.c +++ b/mp_submod.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_SUBMOD_C +#ifdef MP_SUBMOD_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_to_radix.c b/mp_to_radix.c similarity index 98% rename from bn_mp_to_radix.c rename to mp_to_radix.c index 18cb50464..95def74d3 100644 --- a/bn_mp_to_radix.c +++ b/mp_to_radix.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_TO_RADIX_C +#ifdef MP_TO_RADIX_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_to_sbin.c b/mp_to_sbin.c similarity index 96% rename from bn_mp_to_sbin.c rename to mp_to_sbin.c index dbaf53e1f..ed21adcdb 100644 --- a/bn_mp_to_sbin.c +++ b/mp_to_sbin.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_TO_SBIN_C +#ifdef MP_TO_SBIN_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_to_ubin.c b/mp_to_ubin.c similarity index 97% rename from bn_mp_to_ubin.c rename to mp_to_ubin.c index a2c6e281b..25835037d 100644 --- a/bn_mp_to_ubin.c +++ b/mp_to_ubin.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_TO_UBIN_C +#ifdef MP_TO_UBIN_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_ubin_size.c b/mp_ubin_size.c similarity index 93% rename from bn_mp_ubin_size.c rename to mp_ubin_size.c index 21230b48c..4f16404f4 100644 --- a/bn_mp_ubin_size.c +++ b/mp_ubin_size.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_UBIN_SIZE_C +#ifdef MP_UBIN_SIZE_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_unpack.c b/mp_unpack.c similarity index 98% rename from bn_mp_unpack.c rename to mp_unpack.c index d4eb90e0c..5305b435a 100644 --- a/bn_mp_unpack.c +++ b/mp_unpack.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_UNPACK_C +#ifdef MP_UNPACK_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_xor.c b/mp_xor.c similarity index 98% rename from bn_mp_xor.c rename to mp_xor.c index 71e7ca187..ca2c2f1e8 100644 --- a/bn_mp_xor.c +++ b/mp_xor.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_XOR_C +#ifdef MP_XOR_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_mp_zero.c b/mp_zero.c similarity index 93% rename from bn_mp_zero.c rename to mp_zero.c index 72a255efc..0b79f5008 100644 --- a/bn_mp_zero.c +++ b/mp_zero.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_MP_ZERO_C +#ifdef MP_ZERO_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_add.c b/s_mp_add.c similarity index 98% rename from bn_s_mp_add.c rename to s_mp_add.c index c946aa80d..922071996 100644 --- a/bn_s_mp_add.c +++ b/s_mp_add.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_ADD_C +#ifdef S_MP_ADD_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_balance_mul.c b/s_mp_balance_mul.c similarity index 98% rename from bn_s_mp_balance_mul.c rename to s_mp_balance_mul.c index 7ece5d794..410883020 100644 --- a/bn_s_mp_balance_mul.c +++ b/s_mp_balance_mul.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_BALANCE_MUL_C +#ifdef S_MP_BALANCE_MUL_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_exptmod.c b/s_mp_exptmod.c similarity index 99% rename from bn_s_mp_exptmod.c rename to s_mp_exptmod.c index c3bfa95e8..2a89a2cbf 100644 --- a/bn_s_mp_exptmod.c +++ b/s_mp_exptmod.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_EXPTMOD_C +#ifdef S_MP_EXPTMOD_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_exptmod_fast.c b/s_mp_exptmod_fast.c similarity index 99% rename from bn_s_mp_exptmod_fast.c rename to s_mp_exptmod_fast.c index 682ded845..d58112968 100644 --- a/bn_s_mp_exptmod_fast.c +++ b/s_mp_exptmod_fast.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_EXPTMOD_FAST_C +#ifdef S_MP_EXPTMOD_FAST_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_get_bit.c b/s_mp_get_bit.c similarity index 95% rename from bn_s_mp_get_bit.c rename to s_mp_get_bit.c index 28598dfec..397499cbb 100644 --- a/bn_s_mp_get_bit.c +++ b/s_mp_get_bit.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_GET_BIT_C +#ifdef S_MP_GET_BIT_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_invmod_fast.c b/s_mp_invmod_fast.c similarity index 99% rename from bn_s_mp_invmod_fast.c rename to s_mp_invmod_fast.c index 677d7ab69..0d00ea91d 100644 --- a/bn_s_mp_invmod_fast.c +++ b/s_mp_invmod_fast.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_INVMOD_FAST_C +#ifdef S_MP_INVMOD_FAST_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_invmod_slow.c b/s_mp_invmod_slow.c similarity index 99% rename from bn_s_mp_invmod_slow.c rename to s_mp_invmod_slow.c index 4c5db3300..4fecfb895 100644 --- a/bn_s_mp_invmod_slow.c +++ b/s_mp_invmod_slow.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_INVMOD_SLOW_C +#ifdef S_MP_INVMOD_SLOW_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_karatsuba_mul.c b/s_mp_karatsuba_mul.c similarity index 99% rename from bn_s_mp_karatsuba_mul.c rename to s_mp_karatsuba_mul.c index 85899fb87..df3daa7ee 100644 --- a/bn_s_mp_karatsuba_mul.c +++ b/s_mp_karatsuba_mul.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_KARATSUBA_MUL_C +#ifdef S_MP_KARATSUBA_MUL_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_karatsuba_sqr.c b/s_mp_karatsuba_sqr.c similarity index 98% rename from bn_s_mp_karatsuba_sqr.c rename to s_mp_karatsuba_sqr.c index f132d0719..7f2284287 100644 --- a/bn_s_mp_karatsuba_sqr.c +++ b/s_mp_karatsuba_sqr.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_KARATSUBA_SQR_C +#ifdef S_MP_KARATSUBA_SQR_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_montgomery_reduce_fast.c b/s_mp_montgomery_reduce_fast.c similarity index 99% rename from bn_s_mp_montgomery_reduce_fast.c rename to s_mp_montgomery_reduce_fast.c index 3f0c672ac..083e7a4f4 100644 --- a/bn_s_mp_montgomery_reduce_fast.c +++ b/s_mp_montgomery_reduce_fast.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_MONTGOMERY_REDUCE_FAST_C +#ifdef S_MP_MONTGOMERY_REDUCE_FAST_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_mul_digs.c b/s_mp_mul_digs.c similarity index 98% rename from bn_s_mp_mul_digs.c rename to s_mp_mul_digs.c index 64509d4cb..ea0985b87 100644 --- a/bn_s_mp_mul_digs.c +++ b/s_mp_mul_digs.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_MUL_DIGS_C +#ifdef S_MP_MUL_DIGS_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_mul_digs_fast.c b/s_mp_mul_digs_fast.c similarity index 98% rename from bn_s_mp_mul_digs_fast.c rename to s_mp_mul_digs_fast.c index b2a287b02..8988838fb 100644 --- a/bn_s_mp_mul_digs_fast.c +++ b/s_mp_mul_digs_fast.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_MUL_DIGS_FAST_C +#ifdef S_MP_MUL_DIGS_FAST_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_mul_high_digs.c b/s_mp_mul_high_digs.c similarity index 98% rename from bn_s_mp_mul_high_digs.c rename to s_mp_mul_high_digs.c index 2bb2a5098..87cfbe54f 100644 --- a/bn_s_mp_mul_high_digs.c +++ b/s_mp_mul_high_digs.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_MUL_HIGH_DIGS_C +#ifdef S_MP_MUL_HIGH_DIGS_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_mul_high_digs_fast.c b/s_mp_mul_high_digs_fast.c similarity index 98% rename from bn_s_mp_mul_high_digs_fast.c rename to s_mp_mul_high_digs_fast.c index a2c4fb692..06561a9fd 100644 --- a/bn_s_mp_mul_high_digs_fast.c +++ b/s_mp_mul_high_digs_fast.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_MUL_HIGH_DIGS_FAST_C +#ifdef S_MP_MUL_HIGH_DIGS_FAST_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_prime_is_divisible.c b/s_mp_prime_is_divisible.c similarity index 95% rename from bn_s_mp_prime_is_divisible.c rename to s_mp_prime_is_divisible.c index ca303a5ba..d8bdedc76 100644 --- a/bn_s_mp_prime_is_divisible.c +++ b/s_mp_prime_is_divisible.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_PRIME_IS_DIVISIBLE_C +#ifdef S_MP_PRIME_IS_DIVISIBLE_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_rand_jenkins.c b/s_mp_rand_jenkins.c similarity index 97% rename from bn_s_mp_rand_jenkins.c rename to s_mp_rand_jenkins.c index da0771c5f..cbbe0668b 100644 --- a/bn_s_mp_rand_jenkins.c +++ b/s_mp_rand_jenkins.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_RAND_JENKINS_C +#ifdef S_MP_RAND_JENKINS_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_rand_platform.c b/s_mp_rand_platform.c similarity index 92% rename from bn_s_mp_rand_platform.c rename to s_mp_rand_platform.c index 07555db74..8f79d898d 100644 --- a/bn_s_mp_rand_platform.c +++ b/s_mp_rand_platform.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_RAND_PLATFORM_C +#ifdef S_MP_RAND_PLATFORM_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ @@ -8,7 +8,7 @@ * - Windows */ #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) -#define BN_S_READ_ARC4RANDOM_C +#define S_READ_ARC4RANDOM_C static mp_err s_read_arc4random(void *p, size_t n) { arc4random_buf(p, n); @@ -17,7 +17,7 @@ static mp_err s_read_arc4random(void *p, size_t n) #endif #if defined(_WIN32) || defined(_WIN32_WCE) -#define BN_S_READ_WINCSP_C +#define S_READ_WINCSP_C #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0400 @@ -55,9 +55,9 @@ static mp_err s_read_wincsp(void *p, size_t n) } #endif /* WIN32 */ -#if !defined(BN_S_READ_WINCSP_C) && defined(__linux__) && defined(__GLIBC_PREREQ) +#if !defined(S_READ_WINCSP_C) && defined(__linux__) && defined(__GLIBC_PREREQ) #if __GLIBC_PREREQ(2, 25) -#define BN_S_READ_GETRANDOM_C +#define S_READ_GETRANDOM_C #include #include @@ -83,8 +83,8 @@ static mp_err s_read_getrandom(void *p, size_t n) /* We assume all platforms besides windows provide "/dev/urandom". * In case yours doesn't, define MP_NO_DEV_URANDOM at compile-time. */ -#if !defined(BN_S_READ_WINCSP_C) && !defined(MP_NO_DEV_URANDOM) -#define BN_S_READ_URANDOM_C +#if !defined(S_READ_WINCSP_C) && !defined(MP_NO_DEV_URANDOM) +#define S_READ_URANDOM_C #ifndef MP_DEV_URANDOM #define MP_DEV_URANDOM "/dev/urandom" #endif diff --git a/bn_s_mp_reverse.c b/s_mp_reverse.c similarity index 94% rename from bn_s_mp_reverse.c rename to s_mp_reverse.c index c549e605e..d288dc560 100644 --- a/bn_s_mp_reverse.c +++ b/s_mp_reverse.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_REVERSE_C +#ifdef S_MP_REVERSE_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_sqr.c b/s_mp_sqr.c similarity index 98% rename from bn_s_mp_sqr.c rename to s_mp_sqr.c index 505c9f053..61106ed73 100644 --- a/bn_s_mp_sqr.c +++ b/s_mp_sqr.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_SQR_C +#ifdef S_MP_SQR_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_sqr_fast.c b/s_mp_sqr_fast.c similarity index 98% rename from bn_s_mp_sqr_fast.c rename to s_mp_sqr_fast.c index 4a8a8912f..bcb1f5e6b 100644 --- a/bn_s_mp_sqr_fast.c +++ b/s_mp_sqr_fast.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_SQR_FAST_C +#ifdef S_MP_SQR_FAST_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_sub.c b/s_mp_sub.c similarity index 98% rename from bn_s_mp_sub.c rename to s_mp_sub.c index 5672dab51..bef1fce53 100644 --- a/bn_s_mp_sub.c +++ b/s_mp_sub.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_SUB_C +#ifdef S_MP_SUB_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_toom_mul.c b/s_mp_toom_mul.c similarity index 99% rename from bn_s_mp_toom_mul.c rename to s_mp_toom_mul.c index 8efd803c4..0b2d57d72 100644 --- a/bn_s_mp_toom_mul.c +++ b/s_mp_toom_mul.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_TOOM_MUL_C +#ifdef S_MP_TOOM_MUL_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/bn_s_mp_toom_sqr.c b/s_mp_toom_sqr.c similarity index 99% rename from bn_s_mp_toom_sqr.c rename to s_mp_toom_sqr.c index 9eaa9d037..884a532a7 100644 --- a/bn_s_mp_toom_sqr.c +++ b/s_mp_toom_sqr.c @@ -1,5 +1,5 @@ #include "tommath_private.h" -#ifdef BN_S_MP_TOOM_SQR_C +#ifdef S_MP_TOOM_SQR_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ diff --git a/tommath.def b/tommath.def index 9c7f226f4..7c241bc75 100644 --- a/tommath.def +++ b/tommath.def @@ -22,6 +22,7 @@ EXPORTS mp_complement mp_copy mp_count_bits + mp_cutoffs mp_decr mp_div mp_div_2 @@ -96,6 +97,7 @@ EXPORTS mp_prime_rabin_miller_trials mp_prime_rand mp_prime_strong_lucas_selfridge + mp_prime_tab mp_radix_size mp_rand mp_read_radix diff --git a/tommath.h b/tommath.h index cca54114f..b82477e05 100644 --- a/tommath.h +++ b/tommath.h @@ -1,8 +1,8 @@ /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ -#ifndef BN_H_ -#define BN_H_ +#ifndef TOMMATH_H_ +#define TOMMATH_H_ #include #include diff --git a/tommath_class.h b/tommath_class.h index 209d80901..c6dcde1fd 100644 --- a/tommath_class.h +++ b/tommath_class.h @@ -11,1208 +11,1208 @@ #endif #define LTM1 #if defined(LTM_ALL) -# define BN_CUTOFFS_C -# define BN_MP_2EXPT_C -# define BN_MP_ABS_C -# define BN_MP_ADD_C -# define BN_MP_ADD_D_C -# define BN_MP_ADDMOD_C -# define BN_MP_AND_C -# define BN_MP_CLAMP_C -# define BN_MP_CLEAR_C -# define BN_MP_CLEAR_MULTI_C -# define BN_MP_CMP_C -# define BN_MP_CMP_D_C -# define BN_MP_CMP_MAG_C -# define BN_MP_CNT_LSB_C -# define BN_MP_COMPLEMENT_C -# define BN_MP_COPY_C -# define BN_MP_COUNT_BITS_C -# define BN_MP_DECR_C -# define BN_MP_DIV_C -# define BN_MP_DIV_2_C -# define BN_MP_DIV_2D_C -# define BN_MP_DIV_3_C -# define BN_MP_DIV_D_C -# define BN_MP_DR_IS_MODULUS_C -# define BN_MP_DR_REDUCE_C -# define BN_MP_DR_SETUP_C -# define BN_MP_ERROR_TO_STRING_C -# define BN_MP_EXCH_C -# define BN_MP_EXPT_U32_C -# define BN_MP_EXPTMOD_C -# define BN_MP_EXTEUCLID_C -# define BN_MP_FREAD_C -# define BN_MP_FROM_SBIN_C -# define BN_MP_FROM_UBIN_C -# define BN_MP_FWRITE_C -# define BN_MP_GCD_C -# define BN_MP_GET_DOUBLE_C -# define BN_MP_GET_I32_C -# define BN_MP_GET_I64_C -# define BN_MP_GET_L_C -# define BN_MP_GET_LL_C -# define BN_MP_GET_MAG_U32_C -# define BN_MP_GET_MAG_U64_C -# define BN_MP_GET_MAG_UL_C -# define BN_MP_GET_MAG_ULL_C -# define BN_MP_GROW_C -# define BN_MP_INCR_C -# define BN_MP_INIT_C -# define BN_MP_INIT_COPY_C -# define BN_MP_INIT_I32_C -# define BN_MP_INIT_I64_C -# define BN_MP_INIT_L_C -# define BN_MP_INIT_LL_C -# define BN_MP_INIT_MULTI_C -# define BN_MP_INIT_SET_C -# define BN_MP_INIT_SIZE_C -# define BN_MP_INIT_U32_C -# define BN_MP_INIT_U64_C -# define BN_MP_INIT_UL_C -# define BN_MP_INIT_ULL_C -# define BN_MP_INVMOD_C -# define BN_MP_IS_SQUARE_C -# define BN_MP_ISEVEN_C -# define BN_MP_ISODD_C -# define BN_MP_KRONECKER_C -# define BN_MP_LCM_C -# define BN_MP_LOG_U32_C -# define BN_MP_LSHD_C -# define BN_MP_MOD_C -# define BN_MP_MOD_2D_C -# define BN_MP_MOD_D_C -# define BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -# define BN_MP_MONTGOMERY_REDUCE_C -# define BN_MP_MONTGOMERY_SETUP_C -# define BN_MP_MUL_C -# define BN_MP_MUL_2_C -# define BN_MP_MUL_2D_C -# define BN_MP_MUL_D_C -# define BN_MP_MULMOD_C -# define BN_MP_NEG_C -# define BN_MP_OR_C -# define BN_MP_PACK_C -# define BN_MP_PACK_COUNT_C -# define BN_MP_PRIME_FERMAT_C -# define BN_MP_PRIME_FROBENIUS_UNDERWOOD_C -# define BN_MP_PRIME_IS_PRIME_C -# define BN_MP_PRIME_MILLER_RABIN_C -# define BN_MP_PRIME_NEXT_PRIME_C -# define BN_MP_PRIME_RABIN_MILLER_TRIALS_C -# define BN_MP_PRIME_RAND_C -# define BN_MP_PRIME_STRONG_LUCAS_SELFRIDGE_C -# define BN_MP_RADIX_SIZE_C -# define BN_MP_RADIX_SMAP_C -# define BN_MP_RAND_C -# define BN_MP_READ_RADIX_C -# define BN_MP_REDUCE_C -# define BN_MP_REDUCE_2K_C -# define BN_MP_REDUCE_2K_L_C -# define BN_MP_REDUCE_2K_SETUP_C -# define BN_MP_REDUCE_2K_SETUP_L_C -# define BN_MP_REDUCE_IS_2K_C -# define BN_MP_REDUCE_IS_2K_L_C -# define BN_MP_REDUCE_SETUP_C -# define BN_MP_ROOT_U32_C -# define BN_MP_RSHD_C -# define BN_MP_SBIN_SIZE_C -# define BN_MP_SET_C -# define BN_MP_SET_DOUBLE_C -# define BN_MP_SET_I32_C -# define BN_MP_SET_I64_C -# define BN_MP_SET_L_C -# define BN_MP_SET_LL_C -# define BN_MP_SET_U32_C -# define BN_MP_SET_U64_C -# define BN_MP_SET_UL_C -# define BN_MP_SET_ULL_C -# define BN_MP_SHRINK_C -# define BN_MP_SIGNED_RSH_C -# define BN_MP_SQR_C -# define BN_MP_SQRMOD_C -# define BN_MP_SQRT_C -# define BN_MP_SQRTMOD_PRIME_C -# define BN_MP_SUB_C -# define BN_MP_SUB_D_C -# define BN_MP_SUBMOD_C -# define BN_MP_TO_RADIX_C -# define BN_MP_TO_SBIN_C -# define BN_MP_TO_UBIN_C -# define BN_MP_UBIN_SIZE_C -# define BN_MP_UNPACK_C -# define BN_MP_XOR_C -# define BN_MP_ZERO_C -# define BN_PRIME_TAB_C -# define BN_S_MP_ADD_C -# define BN_S_MP_BALANCE_MUL_C -# define BN_S_MP_EXPTMOD_C -# define BN_S_MP_EXPTMOD_FAST_C -# define BN_S_MP_GET_BIT_C -# define BN_S_MP_INVMOD_FAST_C -# define BN_S_MP_INVMOD_SLOW_C -# define BN_S_MP_KARATSUBA_MUL_C -# define BN_S_MP_KARATSUBA_SQR_C -# define BN_S_MP_MONTGOMERY_REDUCE_FAST_C -# define BN_S_MP_MUL_DIGS_C -# define BN_S_MP_MUL_DIGS_FAST_C -# define BN_S_MP_MUL_HIGH_DIGS_C -# define BN_S_MP_MUL_HIGH_DIGS_FAST_C -# define BN_S_MP_PRIME_IS_DIVISIBLE_C -# define BN_S_MP_RAND_JENKINS_C -# define BN_S_MP_RAND_PLATFORM_C -# define BN_S_MP_REVERSE_C -# define BN_S_MP_SQR_C -# define BN_S_MP_SQR_FAST_C -# define BN_S_MP_SUB_C -# define BN_S_MP_TOOM_MUL_C -# define BN_S_MP_TOOM_SQR_C -#endif -#endif -#if defined(BN_CUTOFFS_C) -#endif - -#if defined(BN_MP_2EXPT_C) -# define BN_MP_GROW_C -# define BN_MP_ZERO_C -#endif - -#if defined(BN_MP_ABS_C) -# define BN_MP_COPY_C -#endif - -#if defined(BN_MP_ADD_C) -# define BN_MP_CMP_MAG_C -# define BN_S_MP_ADD_C -# define BN_S_MP_SUB_C -#endif - -#if defined(BN_MP_ADD_D_C) -# define BN_MP_CLAMP_C -# define BN_MP_GROW_C -# define BN_MP_SUB_D_C -#endif - -#if defined(BN_MP_ADDMOD_C) -# define BN_MP_ADD_C -# define BN_MP_CLEAR_C -# define BN_MP_INIT_C -# define BN_MP_MOD_C -#endif - -#if defined(BN_MP_AND_C) -# define BN_MP_CLAMP_C -# define BN_MP_GROW_C +# define MP_2EXPT_C +# define MP_ABS_C +# define MP_ADD_C +# define MP_ADD_D_C +# define MP_ADDMOD_C +# define MP_AND_C +# define MP_CLAMP_C +# define MP_CLEAR_C +# define MP_CLEAR_MULTI_C +# define MP_CMP_C +# define MP_CMP_D_C +# define MP_CMP_MAG_C +# define MP_CNT_LSB_C +# define MP_COMPLEMENT_C +# define MP_COPY_C +# define MP_COUNT_BITS_C +# define MP_CUTOFFS_C +# define MP_DECR_C +# define MP_DIV_C +# define MP_DIV_2_C +# define MP_DIV_2D_C +# define MP_DIV_3_C +# define MP_DIV_D_C +# define MP_DR_IS_MODULUS_C +# define MP_DR_REDUCE_C +# define MP_DR_SETUP_C +# define MP_ERROR_TO_STRING_C +# define MP_EXCH_C +# define MP_EXPT_U32_C +# define MP_EXPTMOD_C +# define MP_EXTEUCLID_C +# define MP_FREAD_C +# define MP_FROM_SBIN_C +# define MP_FROM_UBIN_C +# define MP_FWRITE_C +# define MP_GCD_C +# define MP_GET_DOUBLE_C +# define MP_GET_I32_C +# define MP_GET_I64_C +# define MP_GET_L_C +# define MP_GET_LL_C +# define MP_GET_MAG_U32_C +# define MP_GET_MAG_U64_C +# define MP_GET_MAG_UL_C +# define MP_GET_MAG_ULL_C +# define MP_GROW_C +# define MP_INCR_C +# define MP_INIT_C +# define MP_INIT_COPY_C +# define MP_INIT_I32_C +# define MP_INIT_I64_C +# define MP_INIT_L_C +# define MP_INIT_LL_C +# define MP_INIT_MULTI_C +# define MP_INIT_SET_C +# define MP_INIT_SIZE_C +# define MP_INIT_U32_C +# define MP_INIT_U64_C +# define MP_INIT_UL_C +# define MP_INIT_ULL_C +# define MP_INVMOD_C +# define MP_IS_SQUARE_C +# define MP_ISEVEN_C +# define MP_ISODD_C +# define MP_KRONECKER_C +# define MP_LCM_C +# define MP_LOG_U32_C +# define MP_LSHD_C +# define MP_MOD_C +# define MP_MOD_2D_C +# define MP_MOD_D_C +# define MP_MONTGOMERY_CALC_NORMALIZATION_C +# define MP_MONTGOMERY_REDUCE_C +# define MP_MONTGOMERY_SETUP_C +# define MP_MUL_C +# define MP_MUL_2_C +# define MP_MUL_2D_C +# define MP_MUL_D_C +# define MP_MULMOD_C +# define MP_NEG_C +# define MP_OR_C +# define MP_PACK_C +# define MP_PACK_COUNT_C +# define MP_PRIME_FERMAT_C +# define MP_PRIME_FROBENIUS_UNDERWOOD_C +# define MP_PRIME_IS_PRIME_C +# define MP_PRIME_MILLER_RABIN_C +# define MP_PRIME_NEXT_PRIME_C +# define MP_PRIME_RABIN_MILLER_TRIALS_C +# define MP_PRIME_RAND_C +# define MP_PRIME_STRONG_LUCAS_SELFRIDGE_C +# define MP_PRIME_TAB_C +# define MP_RADIX_SIZE_C +# define MP_RADIX_SMAP_C +# define MP_RAND_C +# define MP_READ_RADIX_C +# define MP_REDUCE_C +# define MP_REDUCE_2K_C +# define MP_REDUCE_2K_L_C +# define MP_REDUCE_2K_SETUP_C +# define MP_REDUCE_2K_SETUP_L_C +# define MP_REDUCE_IS_2K_C +# define MP_REDUCE_IS_2K_L_C +# define MP_REDUCE_SETUP_C +# define MP_ROOT_U32_C +# define MP_RSHD_C +# define MP_SBIN_SIZE_C +# define MP_SET_C +# define MP_SET_DOUBLE_C +# define MP_SET_I32_C +# define MP_SET_I64_C +# define MP_SET_L_C +# define MP_SET_LL_C +# define MP_SET_U32_C +# define MP_SET_U64_C +# define MP_SET_UL_C +# define MP_SET_ULL_C +# define MP_SHRINK_C +# define MP_SIGNED_RSH_C +# define MP_SQR_C +# define MP_SQRMOD_C +# define MP_SQRT_C +# define MP_SQRTMOD_PRIME_C +# define MP_SUB_C +# define MP_SUB_D_C +# define MP_SUBMOD_C +# define MP_TO_RADIX_C +# define MP_TO_SBIN_C +# define MP_TO_UBIN_C +# define MP_UBIN_SIZE_C +# define MP_UNPACK_C +# define MP_XOR_C +# define MP_ZERO_C +# define S_MP_ADD_C +# define S_MP_BALANCE_MUL_C +# define S_MP_EXPTMOD_C +# define S_MP_EXPTMOD_FAST_C +# define S_MP_GET_BIT_C +# define S_MP_INVMOD_FAST_C +# define S_MP_INVMOD_SLOW_C +# define S_MP_KARATSUBA_MUL_C +# define S_MP_KARATSUBA_SQR_C +# define S_MP_MONTGOMERY_REDUCE_FAST_C +# define S_MP_MUL_DIGS_C +# define S_MP_MUL_DIGS_FAST_C +# define S_MP_MUL_HIGH_DIGS_C +# define S_MP_MUL_HIGH_DIGS_FAST_C +# define S_MP_PRIME_IS_DIVISIBLE_C +# define S_MP_RAND_JENKINS_C +# define S_MP_RAND_PLATFORM_C +# define S_MP_REVERSE_C +# define S_MP_SQR_C +# define S_MP_SQR_FAST_C +# define S_MP_SUB_C +# define S_MP_TOOM_MUL_C +# define S_MP_TOOM_SQR_C +#endif +#endif +#if defined(MP_2EXPT_C) +# define MP_GROW_C +# define MP_ZERO_C +#endif + +#if defined(MP_ABS_C) +# define MP_COPY_C +#endif + +#if defined(MP_ADD_C) +# define MP_CMP_MAG_C +# define S_MP_ADD_C +# define S_MP_SUB_C +#endif + +#if defined(MP_ADD_D_C) +# define MP_CLAMP_C +# define MP_GROW_C +# define MP_SUB_D_C +#endif + +#if defined(MP_ADDMOD_C) +# define MP_ADD_C +# define MP_CLEAR_C +# define MP_INIT_C +# define MP_MOD_C +#endif + +#if defined(MP_AND_C) +# define MP_CLAMP_C +# define MP_GROW_C #endif -#if defined(BN_MP_CLAMP_C) +#if defined(MP_CLAMP_C) #endif -#if defined(BN_MP_CLEAR_C) +#if defined(MP_CLEAR_C) #endif -#if defined(BN_MP_CLEAR_MULTI_C) -# define BN_MP_CLEAR_C +#if defined(MP_CLEAR_MULTI_C) +# define MP_CLEAR_C #endif -#if defined(BN_MP_CMP_C) -# define BN_MP_CMP_MAG_C +#if defined(MP_CMP_C) +# define MP_CMP_MAG_C #endif -#if defined(BN_MP_CMP_D_C) +#if defined(MP_CMP_D_C) #endif -#if defined(BN_MP_CMP_MAG_C) +#if defined(MP_CMP_MAG_C) #endif -#if defined(BN_MP_CNT_LSB_C) +#if defined(MP_CNT_LSB_C) #endif -#if defined(BN_MP_COMPLEMENT_C) -# define BN_MP_NEG_C -# define BN_MP_SUB_D_C +#if defined(MP_COMPLEMENT_C) +# define MP_NEG_C +# define MP_SUB_D_C #endif -#if defined(BN_MP_COPY_C) -# define BN_MP_GROW_C +#if defined(MP_COPY_C) +# define MP_GROW_C #endif -#if defined(BN_MP_COUNT_BITS_C) +#if defined(MP_COUNT_BITS_C) #endif -#if defined(BN_MP_DECR_C) -# define BN_MP_INCR_C -# define BN_MP_SET_C -# define BN_MP_SUB_D_C -# define BN_MP_ZERO_C +#if defined(MP_CUTOFFS_C) #endif -#if defined(BN_MP_DIV_C) -# define BN_MP_ADD_C -# define BN_MP_CLAMP_C -# define BN_MP_CLEAR_C -# define BN_MP_CMP_C -# define BN_MP_CMP_MAG_C -# define BN_MP_COPY_C -# define BN_MP_COUNT_BITS_C -# define BN_MP_DIV_2D_C -# define BN_MP_EXCH_C -# define BN_MP_INIT_C -# define BN_MP_INIT_COPY_C -# define BN_MP_INIT_SIZE_C -# define BN_MP_LSHD_C -# define BN_MP_MUL_2D_C -# define BN_MP_MUL_D_C -# define BN_MP_RSHD_C -# define BN_MP_SUB_C -# define BN_MP_ZERO_C +#if defined(MP_DECR_C) +# define MP_INCR_C +# define MP_SET_C +# define MP_SUB_D_C +# define MP_ZERO_C #endif -#if defined(BN_MP_DIV_2_C) -# define BN_MP_CLAMP_C -# define BN_MP_GROW_C +#if defined(MP_DIV_C) +# define MP_ADD_C +# define MP_CLAMP_C +# define MP_CLEAR_C +# define MP_CMP_C +# define MP_CMP_MAG_C +# define MP_COPY_C +# define MP_COUNT_BITS_C +# define MP_DIV_2D_C +# define MP_EXCH_C +# define MP_INIT_C +# define MP_INIT_COPY_C +# define MP_INIT_SIZE_C +# define MP_LSHD_C +# define MP_MUL_2D_C +# define MP_MUL_D_C +# define MP_RSHD_C +# define MP_SUB_C +# define MP_ZERO_C #endif -#if defined(BN_MP_DIV_2D_C) -# define BN_MP_CLAMP_C -# define BN_MP_COPY_C -# define BN_MP_MOD_2D_C -# define BN_MP_RSHD_C -# define BN_MP_ZERO_C +#if defined(MP_DIV_2_C) +# define MP_CLAMP_C +# define MP_GROW_C #endif -#if defined(BN_MP_DIV_3_C) -# define BN_MP_CLAMP_C -# define BN_MP_CLEAR_C -# define BN_MP_EXCH_C -# define BN_MP_INIT_SIZE_C +#if defined(MP_DIV_2D_C) +# define MP_CLAMP_C +# define MP_COPY_C +# define MP_MOD_2D_C +# define MP_RSHD_C +# define MP_ZERO_C #endif -#if defined(BN_MP_DIV_D_C) -# define BN_MP_CLAMP_C -# define BN_MP_CLEAR_C -# define BN_MP_COPY_C -# define BN_MP_DIV_2D_C -# define BN_MP_DIV_3_C -# define BN_MP_EXCH_C -# define BN_MP_INIT_SIZE_C +#if defined(MP_DIV_3_C) +# define MP_CLAMP_C +# define MP_CLEAR_C +# define MP_EXCH_C +# define MP_INIT_SIZE_C #endif -#if defined(BN_MP_DR_IS_MODULUS_C) +#if defined(MP_DIV_D_C) +# define MP_CLAMP_C +# define MP_CLEAR_C +# define MP_COPY_C +# define MP_DIV_2D_C +# define MP_DIV_3_C +# define MP_EXCH_C +# define MP_INIT_SIZE_C #endif -#if defined(BN_MP_DR_REDUCE_C) -# define BN_MP_CLAMP_C -# define BN_MP_CMP_MAG_C -# define BN_MP_GROW_C -# define BN_S_MP_SUB_C +#if defined(MP_DR_IS_MODULUS_C) #endif -#if defined(BN_MP_DR_SETUP_C) +#if defined(MP_DR_REDUCE_C) +# define MP_CLAMP_C +# define MP_CMP_MAG_C +# define MP_GROW_C +# define S_MP_SUB_C #endif -#if defined(BN_MP_ERROR_TO_STRING_C) +#if defined(MP_DR_SETUP_C) #endif -#if defined(BN_MP_EXCH_C) +#if defined(MP_ERROR_TO_STRING_C) #endif -#if defined(BN_MP_EXPT_U32_C) -# define BN_MP_CLEAR_C -# define BN_MP_INIT_COPY_C -# define BN_MP_MUL_C -# define BN_MP_SET_C -# define BN_MP_SQR_C +#if defined(MP_EXCH_C) #endif -#if defined(BN_MP_EXPTMOD_C) -# define BN_MP_ABS_C -# define BN_MP_CLEAR_MULTI_C -# define BN_MP_DR_IS_MODULUS_C -# define BN_MP_INIT_MULTI_C -# define BN_MP_INVMOD_C -# define BN_MP_REDUCE_IS_2K_C -# define BN_MP_REDUCE_IS_2K_L_C -# define BN_S_MP_EXPTMOD_C -# define BN_S_MP_EXPTMOD_FAST_C +#if defined(MP_EXPT_U32_C) +# define MP_CLEAR_C +# define MP_INIT_COPY_C +# define MP_MUL_C +# define MP_SET_C +# define MP_SQR_C #endif -#if defined(BN_MP_EXTEUCLID_C) -# define BN_MP_CLEAR_MULTI_C -# define BN_MP_COPY_C -# define BN_MP_DIV_C -# define BN_MP_EXCH_C -# define BN_MP_INIT_MULTI_C -# define BN_MP_MUL_C -# define BN_MP_NEG_C -# define BN_MP_SET_C -# define BN_MP_SUB_C +#if defined(MP_EXPTMOD_C) +# define MP_ABS_C +# define MP_CLEAR_MULTI_C +# define MP_DR_IS_MODULUS_C +# define MP_INIT_MULTI_C +# define MP_INVMOD_C +# define MP_REDUCE_IS_2K_C +# define MP_REDUCE_IS_2K_L_C +# define S_MP_EXPTMOD_C +# define S_MP_EXPTMOD_FAST_C #endif -#if defined(BN_MP_FREAD_C) -# define BN_MP_ADD_D_C -# define BN_MP_MUL_D_C -# define BN_MP_ZERO_C +#if defined(MP_EXTEUCLID_C) +# define MP_CLEAR_MULTI_C +# define MP_COPY_C +# define MP_DIV_C +# define MP_EXCH_C +# define MP_INIT_MULTI_C +# define MP_MUL_C +# define MP_NEG_C +# define MP_SET_C +# define MP_SUB_C #endif -#if defined(BN_MP_FROM_SBIN_C) -# define BN_MP_FROM_UBIN_C +#if defined(MP_FREAD_C) +# define MP_ADD_D_C +# define MP_MUL_D_C +# define MP_ZERO_C #endif -#if defined(BN_MP_FROM_UBIN_C) -# define BN_MP_CLAMP_C -# define BN_MP_GROW_C -# define BN_MP_MUL_2D_C -# define BN_MP_ZERO_C +#if defined(MP_FROM_SBIN_C) +# define MP_FROM_UBIN_C #endif -#if defined(BN_MP_FWRITE_C) -# define BN_MP_RADIX_SIZE_C -# define BN_MP_TO_RADIX_C +#if defined(MP_FROM_UBIN_C) +# define MP_CLAMP_C +# define MP_GROW_C +# define MP_MUL_2D_C +# define MP_ZERO_C #endif -#if defined(BN_MP_GCD_C) -# define BN_MP_ABS_C -# define BN_MP_CLEAR_C -# define BN_MP_CMP_MAG_C -# define BN_MP_CNT_LSB_C -# define BN_MP_DIV_2D_C -# define BN_MP_EXCH_C -# define BN_MP_INIT_COPY_C -# define BN_MP_MUL_2D_C -# define BN_S_MP_SUB_C +#if defined(MP_FWRITE_C) +# define MP_RADIX_SIZE_C +# define MP_TO_RADIX_C #endif -#if defined(BN_MP_GET_DOUBLE_C) +#if defined(MP_GCD_C) +# define MP_ABS_C +# define MP_CLEAR_C +# define MP_CMP_MAG_C +# define MP_CNT_LSB_C +# define MP_DIV_2D_C +# define MP_EXCH_C +# define MP_INIT_COPY_C +# define MP_MUL_2D_C +# define S_MP_SUB_C #endif -#if defined(BN_MP_GET_I32_C) -# define BN_MP_GET_MAG_U32_C +#if defined(MP_GET_DOUBLE_C) #endif -#if defined(BN_MP_GET_I64_C) -# define BN_MP_GET_MAG_U64_C +#if defined(MP_GET_I32_C) +# define MP_GET_MAG_U32_C #endif -#if defined(BN_MP_GET_L_C) -# define BN_MP_GET_MAG_UL_C +#if defined(MP_GET_I64_C) +# define MP_GET_MAG_U64_C #endif -#if defined(BN_MP_GET_LL_C) -# define BN_MP_GET_MAG_ULL_C +#if defined(MP_GET_L_C) +# define MP_GET_MAG_UL_C #endif -#if defined(BN_MP_GET_MAG_U32_C) +#if defined(MP_GET_LL_C) +# define MP_GET_MAG_ULL_C #endif -#if defined(BN_MP_GET_MAG_U64_C) +#if defined(MP_GET_MAG_U32_C) #endif -#if defined(BN_MP_GET_MAG_UL_C) +#if defined(MP_GET_MAG_U64_C) #endif -#if defined(BN_MP_GET_MAG_ULL_C) +#if defined(MP_GET_MAG_UL_C) #endif -#if defined(BN_MP_GROW_C) +#if defined(MP_GET_MAG_ULL_C) #endif -#if defined(BN_MP_INCR_C) -# define BN_MP_ADD_D_C -# define BN_MP_DECR_C -# define BN_MP_SET_C +#if defined(MP_GROW_C) #endif -#if defined(BN_MP_INIT_C) +#if defined(MP_INCR_C) +# define MP_ADD_D_C +# define MP_DECR_C +# define MP_SET_C #endif -#if defined(BN_MP_INIT_COPY_C) -# define BN_MP_CLEAR_C -# define BN_MP_COPY_C -# define BN_MP_INIT_SIZE_C +#if defined(MP_INIT_C) #endif -#if defined(BN_MP_INIT_I32_C) -# define BN_MP_INIT_C -# define BN_MP_SET_I32_C +#if defined(MP_INIT_COPY_C) +# define MP_CLEAR_C +# define MP_COPY_C +# define MP_INIT_SIZE_C #endif -#if defined(BN_MP_INIT_I64_C) -# define BN_MP_INIT_C -# define BN_MP_SET_I64_C +#if defined(MP_INIT_I32_C) +# define MP_INIT_C +# define MP_SET_I32_C #endif -#if defined(BN_MP_INIT_L_C) -# define BN_MP_INIT_C -# define BN_MP_SET_L_C +#if defined(MP_INIT_I64_C) +# define MP_INIT_C +# define MP_SET_I64_C #endif -#if defined(BN_MP_INIT_LL_C) -# define BN_MP_INIT_C -# define BN_MP_SET_LL_C +#if defined(MP_INIT_L_C) +# define MP_INIT_C +# define MP_SET_L_C #endif -#if defined(BN_MP_INIT_MULTI_C) -# define BN_MP_CLEAR_C -# define BN_MP_INIT_C +#if defined(MP_INIT_LL_C) +# define MP_INIT_C +# define MP_SET_LL_C #endif -#if defined(BN_MP_INIT_SET_C) -# define BN_MP_INIT_C -# define BN_MP_SET_C +#if defined(MP_INIT_MULTI_C) +# define MP_CLEAR_C +# define MP_INIT_C #endif -#if defined(BN_MP_INIT_SIZE_C) +#if defined(MP_INIT_SET_C) +# define MP_INIT_C +# define MP_SET_C #endif -#if defined(BN_MP_INIT_U32_C) -# define BN_MP_INIT_C -# define BN_MP_SET_U32_C +#if defined(MP_INIT_SIZE_C) #endif -#if defined(BN_MP_INIT_U64_C) -# define BN_MP_INIT_C -# define BN_MP_SET_U64_C +#if defined(MP_INIT_U32_C) +# define MP_INIT_C +# define MP_SET_U32_C #endif -#if defined(BN_MP_INIT_UL_C) -# define BN_MP_INIT_C -# define BN_MP_SET_UL_C +#if defined(MP_INIT_U64_C) +# define MP_INIT_C +# define MP_SET_U64_C #endif -#if defined(BN_MP_INIT_ULL_C) -# define BN_MP_INIT_C -# define BN_MP_SET_ULL_C +#if defined(MP_INIT_UL_C) +# define MP_INIT_C +# define MP_SET_UL_C #endif -#if defined(BN_MP_INVMOD_C) -# define BN_MP_CMP_D_C -# define BN_S_MP_INVMOD_FAST_C -# define BN_S_MP_INVMOD_SLOW_C +#if defined(MP_INIT_ULL_C) +# define MP_INIT_C +# define MP_SET_ULL_C #endif -#if defined(BN_MP_IS_SQUARE_C) -# define BN_MP_CLEAR_C -# define BN_MP_CMP_MAG_C -# define BN_MP_GET_I32_C -# define BN_MP_INIT_U32_C -# define BN_MP_MOD_C -# define BN_MP_MOD_D_C -# define BN_MP_SQRT_C -# define BN_MP_SQR_C +#if defined(MP_INVMOD_C) +# define MP_CMP_D_C +# define S_MP_INVMOD_FAST_C +# define S_MP_INVMOD_SLOW_C #endif -#if defined(BN_MP_ISEVEN_C) +#if defined(MP_IS_SQUARE_C) +# define MP_CLEAR_C +# define MP_CMP_MAG_C +# define MP_GET_I32_C +# define MP_INIT_U32_C +# define MP_MOD_C +# define MP_MOD_D_C +# define MP_SQRT_C +# define MP_SQR_C #endif -#if defined(BN_MP_ISODD_C) +#if defined(MP_ISEVEN_C) #endif -#if defined(BN_MP_KRONECKER_C) -# define BN_MP_CLEAR_C -# define BN_MP_CMP_D_C -# define BN_MP_CNT_LSB_C -# define BN_MP_COPY_C -# define BN_MP_DIV_2D_C -# define BN_MP_INIT_C -# define BN_MP_INIT_COPY_C -# define BN_MP_MOD_C +#if defined(MP_ISODD_C) #endif -#if defined(BN_MP_LCM_C) -# define BN_MP_CLEAR_MULTI_C -# define BN_MP_CMP_MAG_C -# define BN_MP_DIV_C -# define BN_MP_GCD_C -# define BN_MP_INIT_MULTI_C -# define BN_MP_MUL_C +#if defined(MP_KRONECKER_C) +# define MP_CLEAR_C +# define MP_CMP_D_C +# define MP_CNT_LSB_C +# define MP_COPY_C +# define MP_DIV_2D_C +# define MP_INIT_C +# define MP_INIT_COPY_C +# define MP_MOD_C #endif -#if defined(BN_MP_LOG_U32_C) -# define BN_MP_CLEAR_MULTI_C -# define BN_MP_CMP_C -# define BN_MP_CMP_D_C -# define BN_MP_COPY_C -# define BN_MP_COUNT_BITS_C -# define BN_MP_EXCH_C -# define BN_MP_EXPT_U32_C -# define BN_MP_INIT_MULTI_C -# define BN_MP_MUL_C -# define BN_MP_SET_C -# define BN_MP_SQR_C +#if defined(MP_LCM_C) +# define MP_CLEAR_MULTI_C +# define MP_CMP_MAG_C +# define MP_DIV_C +# define MP_GCD_C +# define MP_INIT_MULTI_C +# define MP_MUL_C #endif -#if defined(BN_MP_LSHD_C) -# define BN_MP_GROW_C +#if defined(MP_LOG_U32_C) +# define MP_CLEAR_MULTI_C +# define MP_CMP_C +# define MP_CMP_D_C +# define MP_COPY_C +# define MP_COUNT_BITS_C +# define MP_EXCH_C +# define MP_EXPT_U32_C +# define MP_INIT_MULTI_C +# define MP_MUL_C +# define MP_SET_C +# define MP_SQR_C #endif -#if defined(BN_MP_MOD_C) -# define BN_MP_ADD_C -# define BN_MP_CLEAR_C -# define BN_MP_DIV_C -# define BN_MP_EXCH_C -# define BN_MP_INIT_SIZE_C +#if defined(MP_LSHD_C) +# define MP_GROW_C #endif -#if defined(BN_MP_MOD_2D_C) -# define BN_MP_CLAMP_C -# define BN_MP_COPY_C -# define BN_MP_ZERO_C +#if defined(MP_MOD_C) +# define MP_ADD_C +# define MP_CLEAR_C +# define MP_DIV_C +# define MP_EXCH_C +# define MP_INIT_SIZE_C #endif -#if defined(BN_MP_MOD_D_C) -# define BN_MP_DIV_D_C +#if defined(MP_MOD_2D_C) +# define MP_CLAMP_C +# define MP_COPY_C +# define MP_ZERO_C #endif -#if defined(BN_MP_MONTGOMERY_CALC_NORMALIZATION_C) -# define BN_MP_2EXPT_C -# define BN_MP_CMP_MAG_C -# define BN_MP_COUNT_BITS_C -# define BN_MP_MUL_2_C -# define BN_MP_SET_C -# define BN_S_MP_SUB_C +#if defined(MP_MOD_D_C) +# define MP_DIV_D_C #endif -#if defined(BN_MP_MONTGOMERY_REDUCE_C) -# define BN_MP_CLAMP_C -# define BN_MP_CMP_MAG_C -# define BN_MP_GROW_C -# define BN_MP_RSHD_C -# define BN_S_MP_MONTGOMERY_REDUCE_FAST_C -# define BN_S_MP_SUB_C +#if defined(MP_MONTGOMERY_CALC_NORMALIZATION_C) +# define MP_2EXPT_C +# define MP_CMP_MAG_C +# define MP_COUNT_BITS_C +# define MP_MUL_2_C +# define MP_SET_C +# define S_MP_SUB_C #endif -#if defined(BN_MP_MONTGOMERY_SETUP_C) +#if defined(MP_MONTGOMERY_REDUCE_C) +# define MP_CLAMP_C +# define MP_CMP_MAG_C +# define MP_GROW_C +# define MP_RSHD_C +# define S_MP_MONTGOMERY_REDUCE_FAST_C +# define S_MP_SUB_C #endif -#if defined(BN_MP_MUL_C) -# define BN_S_MP_BALANCE_MUL_C -# define BN_S_MP_KARATSUBA_MUL_C -# define BN_S_MP_MUL_DIGS_C -# define BN_S_MP_MUL_DIGS_FAST_C -# define BN_S_MP_TOOM_MUL_C +#if defined(MP_MONTGOMERY_SETUP_C) #endif -#if defined(BN_MP_MUL_2_C) -# define BN_MP_GROW_C +#if defined(MP_MUL_C) +# define S_MP_BALANCE_MUL_C +# define S_MP_KARATSUBA_MUL_C +# define S_MP_MUL_DIGS_C +# define S_MP_MUL_DIGS_FAST_C +# define S_MP_TOOM_MUL_C #endif -#if defined(BN_MP_MUL_2D_C) -# define BN_MP_CLAMP_C -# define BN_MP_COPY_C -# define BN_MP_GROW_C -# define BN_MP_LSHD_C +#if defined(MP_MUL_2_C) +# define MP_GROW_C #endif -#if defined(BN_MP_MUL_D_C) -# define BN_MP_CLAMP_C -# define BN_MP_GROW_C +#if defined(MP_MUL_2D_C) +# define MP_CLAMP_C +# define MP_COPY_C +# define MP_GROW_C +# define MP_LSHD_C #endif -#if defined(BN_MP_MULMOD_C) -# define BN_MP_CLEAR_C -# define BN_MP_INIT_SIZE_C -# define BN_MP_MOD_C -# define BN_MP_MUL_C +#if defined(MP_MUL_D_C) +# define MP_CLAMP_C +# define MP_GROW_C #endif -#if defined(BN_MP_NEG_C) -# define BN_MP_COPY_C -#endif - -#if defined(BN_MP_OR_C) -# define BN_MP_CLAMP_C -# define BN_MP_GROW_C +#if defined(MP_MULMOD_C) +# define MP_CLEAR_C +# define MP_INIT_SIZE_C +# define MP_MOD_C +# define MP_MUL_C #endif -#if defined(BN_MP_PACK_C) -# define BN_MP_CLEAR_C -# define BN_MP_DIV_2D_C -# define BN_MP_INIT_COPY_C -# define BN_MP_PACK_COUNT_C -#endif - -#if defined(BN_MP_PACK_COUNT_C) -# define BN_MP_COUNT_BITS_C -#endif - -#if defined(BN_MP_PRIME_FERMAT_C) -# define BN_MP_CLEAR_C -# define BN_MP_CMP_C -# define BN_MP_CMP_D_C -# define BN_MP_EXPTMOD_C -# define BN_MP_INIT_C -#endif - -#if defined(BN_MP_PRIME_FROBENIUS_UNDERWOOD_C) -# define BN_MP_ADD_C -# define BN_MP_ADD_D_C -# define BN_MP_CLEAR_MULTI_C -# define BN_MP_CMP_C -# define BN_MP_COUNT_BITS_C -# define BN_MP_EXCH_C -# define BN_MP_GCD_C -# define BN_MP_INIT_MULTI_C -# define BN_MP_KRONECKER_C -# define BN_MP_MOD_C -# define BN_MP_MUL_2_C -# define BN_MP_MUL_C -# define BN_MP_MUL_D_C -# define BN_MP_SET_C -# define BN_MP_SET_U32_C -# define BN_MP_SQR_C -# define BN_MP_SUB_C -# define BN_MP_SUB_D_C -# define BN_S_MP_GET_BIT_C -#endif - -#if defined(BN_MP_PRIME_IS_PRIME_C) -# define BN_MP_CLEAR_C -# define BN_MP_CMP_C -# define BN_MP_CMP_D_C -# define BN_MP_COUNT_BITS_C -# define BN_MP_DIV_2D_C -# define BN_MP_INIT_SET_C -# define BN_MP_IS_SQUARE_C -# define BN_MP_PRIME_MILLER_RABIN_C -# define BN_MP_PRIME_STRONG_LUCAS_SELFRIDGE_C -# define BN_MP_RAND_C -# define BN_MP_READ_RADIX_C -# define BN_MP_SET_C -# define BN_S_MP_PRIME_IS_DIVISIBLE_C -#endif - -#if defined(BN_MP_PRIME_MILLER_RABIN_C) -# define BN_MP_CLEAR_C -# define BN_MP_CMP_C -# define BN_MP_CMP_D_C -# define BN_MP_CNT_LSB_C -# define BN_MP_DIV_2D_C -# define BN_MP_EXPTMOD_C -# define BN_MP_INIT_C -# define BN_MP_INIT_COPY_C -# define BN_MP_SQRMOD_C -# define BN_MP_SUB_D_C -#endif - -#if defined(BN_MP_PRIME_NEXT_PRIME_C) -# define BN_MP_ADD_D_C -# define BN_MP_CLEAR_C -# define BN_MP_CMP_D_C -# define BN_MP_INIT_C -# define BN_MP_MOD_D_C -# define BN_MP_PRIME_IS_PRIME_C -# define BN_MP_SET_C -# define BN_MP_SUB_D_C -#endif - -#if defined(BN_MP_PRIME_RABIN_MILLER_TRIALS_C) -#endif - -#if defined(BN_MP_PRIME_RAND_C) -# define BN_MP_ADD_D_C -# define BN_MP_DIV_2_C -# define BN_MP_FROM_UBIN_C -# define BN_MP_MUL_2_C -# define BN_MP_PRIME_IS_PRIME_C -# define BN_MP_SUB_D_C -# define BN_S_MP_PRIME_RANDOM_EX_C -# define BN_S_MP_RAND_CB_C -# define BN_S_MP_RAND_SOURCE_C -#endif - -#if defined(BN_MP_PRIME_STRONG_LUCAS_SELFRIDGE_C) -# define BN_MP_ADD_C -# define BN_MP_ADD_D_C -# define BN_MP_CLEAR_C -# define BN_MP_CLEAR_MULTI_C -# define BN_MP_CMP_C -# define BN_MP_CMP_D_C -# define BN_MP_CNT_LSB_C -# define BN_MP_COUNT_BITS_C -# define BN_MP_DIV_2D_C -# define BN_MP_DIV_2_C -# define BN_MP_GCD_C -# define BN_MP_INIT_C -# define BN_MP_INIT_MULTI_C -# define BN_MP_KRONECKER_C -# define BN_MP_MOD_C -# define BN_MP_MUL_2_C -# define BN_MP_MUL_C -# define BN_MP_SET_C -# define BN_MP_SET_I32_C -# define BN_MP_SET_U32_C -# define BN_MP_SQR_C -# define BN_MP_SUB_C -# define BN_MP_SUB_D_C -# define BN_S_MP_GET_BIT_C -# define BN_S_MP_MUL_SI_C -#endif - -#if defined(BN_MP_RADIX_SIZE_C) -# define BN_MP_LOG_U32_C -#endif - -#if defined(BN_MP_RADIX_SMAP_C) -#endif - -#if defined(BN_MP_RAND_C) -# define BN_MP_GROW_C -# define BN_MP_RAND_SOURCE_C -# define BN_MP_ZERO_C -# define BN_S_MP_RAND_PLATFORM_C -# define BN_S_MP_RAND_SOURCE_C -#endif - -#if defined(BN_MP_READ_RADIX_C) -# define BN_MP_ADD_D_C -# define BN_MP_MUL_D_C -# define BN_MP_ZERO_C -#endif - -#if defined(BN_MP_REDUCE_C) -# define BN_MP_ADD_C -# define BN_MP_CLEAR_C -# define BN_MP_CMP_C -# define BN_MP_CMP_D_C -# define BN_MP_INIT_COPY_C -# define BN_MP_LSHD_C -# define BN_MP_MOD_2D_C -# define BN_MP_MUL_C -# define BN_MP_RSHD_C -# define BN_MP_SET_C -# define BN_MP_SUB_C -# define BN_S_MP_MUL_DIGS_C -# define BN_S_MP_MUL_HIGH_DIGS_C -# define BN_S_MP_MUL_HIGH_DIGS_FAST_C -# define BN_S_MP_SUB_C +#if defined(MP_NEG_C) +# define MP_COPY_C +#endif + +#if defined(MP_OR_C) +# define MP_CLAMP_C +# define MP_GROW_C #endif -#if defined(BN_MP_REDUCE_2K_C) -# define BN_MP_CLEAR_C -# define BN_MP_CMP_MAG_C -# define BN_MP_COUNT_BITS_C -# define BN_MP_DIV_2D_C -# define BN_MP_INIT_C -# define BN_MP_MUL_D_C -# define BN_S_MP_ADD_C -# define BN_S_MP_SUB_C +#if defined(MP_PACK_C) +# define MP_CLEAR_C +# define MP_DIV_2D_C +# define MP_INIT_COPY_C +# define MP_PACK_COUNT_C +#endif + +#if defined(MP_PACK_COUNT_C) +# define MP_COUNT_BITS_C +#endif + +#if defined(MP_PRIME_FERMAT_C) +# define MP_CLEAR_C +# define MP_CMP_C +# define MP_CMP_D_C +# define MP_EXPTMOD_C +# define MP_INIT_C +#endif + +#if defined(MP_PRIME_FROBENIUS_UNDERWOOD_C) +# define MP_ADD_C +# define MP_ADD_D_C +# define MP_CLEAR_MULTI_C +# define MP_CMP_C +# define MP_COUNT_BITS_C +# define MP_EXCH_C +# define MP_GCD_C +# define MP_INIT_MULTI_C +# define MP_KRONECKER_C +# define MP_MOD_C +# define MP_MUL_2_C +# define MP_MUL_C +# define MP_MUL_D_C +# define MP_SET_C +# define MP_SET_U32_C +# define MP_SQR_C +# define MP_SUB_C +# define MP_SUB_D_C +# define S_MP_GET_BIT_C +#endif + +#if defined(MP_PRIME_IS_PRIME_C) +# define MP_CLEAR_C +# define MP_CMP_C +# define MP_CMP_D_C +# define MP_COUNT_BITS_C +# define MP_DIV_2D_C +# define MP_INIT_SET_C +# define MP_IS_SQUARE_C +# define MP_PRIME_MILLER_RABIN_C +# define MP_PRIME_STRONG_LUCAS_SELFRIDGE_C +# define MP_RAND_C +# define MP_READ_RADIX_C +# define MP_SET_C +# define S_MP_PRIME_IS_DIVISIBLE_C +#endif + +#if defined(MP_PRIME_MILLER_RABIN_C) +# define MP_CLEAR_C +# define MP_CMP_C +# define MP_CMP_D_C +# define MP_CNT_LSB_C +# define MP_DIV_2D_C +# define MP_EXPTMOD_C +# define MP_INIT_C +# define MP_INIT_COPY_C +# define MP_SQRMOD_C +# define MP_SUB_D_C +#endif + +#if defined(MP_PRIME_NEXT_PRIME_C) +# define MP_ADD_D_C +# define MP_CLEAR_C +# define MP_CMP_D_C +# define MP_INIT_C +# define MP_MOD_D_C +# define MP_PRIME_IS_PRIME_C +# define MP_SET_C +# define MP_SUB_D_C +#endif + +#if defined(MP_PRIME_RABIN_MILLER_TRIALS_C) +#endif + +#if defined(MP_PRIME_RAND_C) +# define MP_ADD_D_C +# define MP_DIV_2_C +# define MP_FROM_UBIN_C +# define MP_MUL_2_C +# define MP_PRIME_IS_PRIME_C +# define MP_SUB_D_C +# define S_MP_PRIME_RANDOM_EX_C +# define S_MP_RAND_CB_C +# define S_MP_RAND_SOURCE_C +#endif + +#if defined(MP_PRIME_STRONG_LUCAS_SELFRIDGE_C) +# define MP_ADD_C +# define MP_ADD_D_C +# define MP_CLEAR_C +# define MP_CLEAR_MULTI_C +# define MP_CMP_C +# define MP_CMP_D_C +# define MP_CNT_LSB_C +# define MP_COUNT_BITS_C +# define MP_DIV_2D_C +# define MP_DIV_2_C +# define MP_GCD_C +# define MP_INIT_C +# define MP_INIT_MULTI_C +# define MP_KRONECKER_C +# define MP_MOD_C +# define MP_MUL_2_C +# define MP_MUL_C +# define MP_SET_C +# define MP_SET_I32_C +# define MP_SET_U32_C +# define MP_SQR_C +# define MP_SUB_C +# define MP_SUB_D_C +# define S_MP_GET_BIT_C +# define S_MP_MUL_SI_C +#endif + +#if defined(MP_PRIME_TAB_C) +#endif + +#if defined(MP_RADIX_SIZE_C) +# define MP_LOG_U32_C +#endif + +#if defined(MP_RADIX_SMAP_C) +#endif + +#if defined(MP_RAND_C) +# define MP_GROW_C +# define MP_RAND_SOURCE_C +# define MP_ZERO_C +# define S_MP_RAND_PLATFORM_C +# define S_MP_RAND_SOURCE_C +#endif + +#if defined(MP_READ_RADIX_C) +# define MP_ADD_D_C +# define MP_MUL_D_C +# define MP_ZERO_C +#endif + +#if defined(MP_REDUCE_C) +# define MP_ADD_C +# define MP_CLEAR_C +# define MP_CMP_C +# define MP_CMP_D_C +# define MP_INIT_COPY_C +# define MP_LSHD_C +# define MP_MOD_2D_C +# define MP_MUL_C +# define MP_RSHD_C +# define MP_SET_C +# define MP_SUB_C +# define S_MP_MUL_DIGS_C +# define S_MP_MUL_HIGH_DIGS_C +# define S_MP_MUL_HIGH_DIGS_FAST_C +# define S_MP_SUB_C #endif -#if defined(BN_MP_REDUCE_2K_L_C) -# define BN_MP_CLEAR_C -# define BN_MP_CMP_MAG_C -# define BN_MP_COUNT_BITS_C -# define BN_MP_DIV_2D_C -# define BN_MP_INIT_C -# define BN_MP_MUL_C -# define BN_S_MP_ADD_C -# define BN_S_MP_SUB_C +#if defined(MP_REDUCE_2K_C) +# define MP_CLEAR_C +# define MP_CMP_MAG_C +# define MP_COUNT_BITS_C +# define MP_DIV_2D_C +# define MP_INIT_C +# define MP_MUL_D_C +# define S_MP_ADD_C +# define S_MP_SUB_C #endif -#if defined(BN_MP_REDUCE_2K_SETUP_C) -# define BN_MP_2EXPT_C -# define BN_MP_CLEAR_C -# define BN_MP_COUNT_BITS_C -# define BN_MP_INIT_C -# define BN_S_MP_SUB_C +#if defined(MP_REDUCE_2K_L_C) +# define MP_CLEAR_C +# define MP_CMP_MAG_C +# define MP_COUNT_BITS_C +# define MP_DIV_2D_C +# define MP_INIT_C +# define MP_MUL_C +# define S_MP_ADD_C +# define S_MP_SUB_C #endif -#if defined(BN_MP_REDUCE_2K_SETUP_L_C) -# define BN_MP_2EXPT_C -# define BN_MP_CLEAR_C -# define BN_MP_COUNT_BITS_C -# define BN_MP_INIT_C -# define BN_S_MP_SUB_C +#if defined(MP_REDUCE_2K_SETUP_C) +# define MP_2EXPT_C +# define MP_CLEAR_C +# define MP_COUNT_BITS_C +# define MP_INIT_C +# define S_MP_SUB_C #endif -#if defined(BN_MP_REDUCE_IS_2K_C) -# define BN_MP_COUNT_BITS_C +#if defined(MP_REDUCE_2K_SETUP_L_C) +# define MP_2EXPT_C +# define MP_CLEAR_C +# define MP_COUNT_BITS_C +# define MP_INIT_C +# define S_MP_SUB_C #endif -#if defined(BN_MP_REDUCE_IS_2K_L_C) +#if defined(MP_REDUCE_IS_2K_C) +# define MP_COUNT_BITS_C #endif -#if defined(BN_MP_REDUCE_SETUP_C) -# define BN_MP_2EXPT_C -# define BN_MP_DIV_C +#if defined(MP_REDUCE_IS_2K_L_C) #endif -#if defined(BN_MP_ROOT_U32_C) -# define BN_MP_2EXPT_C -# define BN_MP_ADD_D_C -# define BN_MP_CLEAR_MULTI_C -# define BN_MP_CMP_C -# define BN_MP_COPY_C -# define BN_MP_COUNT_BITS_C -# define BN_MP_DIV_C -# define BN_MP_EXCH_C -# define BN_MP_EXPT_U32_C -# define BN_MP_INIT_MULTI_C -# define BN_MP_MUL_C -# define BN_MP_MUL_D_C -# define BN_MP_SET_C -# define BN_MP_SUB_C -# define BN_MP_SUB_D_C +#if defined(MP_REDUCE_SETUP_C) +# define MP_2EXPT_C +# define MP_DIV_C #endif -#if defined(BN_MP_RSHD_C) -# define BN_MP_ZERO_C +#if defined(MP_ROOT_U32_C) +# define MP_2EXPT_C +# define MP_ADD_D_C +# define MP_CLEAR_MULTI_C +# define MP_CMP_C +# define MP_COPY_C +# define MP_COUNT_BITS_C +# define MP_DIV_C +# define MP_EXCH_C +# define MP_EXPT_U32_C +# define MP_INIT_MULTI_C +# define MP_MUL_C +# define MP_MUL_D_C +# define MP_SET_C +# define MP_SUB_C +# define MP_SUB_D_C #endif -#if defined(BN_MP_SBIN_SIZE_C) -# define BN_MP_UBIN_SIZE_C +#if defined(MP_RSHD_C) +# define MP_ZERO_C #endif -#if defined(BN_MP_SET_C) +#if defined(MP_SBIN_SIZE_C) +# define MP_UBIN_SIZE_C #endif -#if defined(BN_MP_SET_DOUBLE_C) -# define BN_MP_DIV_2D_C -# define BN_MP_MUL_2D_C -# define BN_MP_SET_U64_C +#if defined(MP_SET_C) #endif -#if defined(BN_MP_SET_I32_C) -# define BN_MP_SET_U32_C +#if defined(MP_SET_DOUBLE_C) +# define MP_DIV_2D_C +# define MP_MUL_2D_C +# define MP_SET_U64_C #endif -#if defined(BN_MP_SET_I64_C) -# define BN_MP_SET_U64_C +#if defined(MP_SET_I32_C) +# define MP_SET_U32_C #endif -#if defined(BN_MP_SET_L_C) -# define BN_MP_SET_UL_C +#if defined(MP_SET_I64_C) +# define MP_SET_U64_C #endif -#if defined(BN_MP_SET_LL_C) -# define BN_MP_SET_ULL_C +#if defined(MP_SET_L_C) +# define MP_SET_UL_C #endif -#if defined(BN_MP_SET_U32_C) +#if defined(MP_SET_LL_C) +# define MP_SET_ULL_C #endif -#if defined(BN_MP_SET_U64_C) +#if defined(MP_SET_U32_C) #endif -#if defined(BN_MP_SET_UL_C) +#if defined(MP_SET_U64_C) #endif -#if defined(BN_MP_SET_ULL_C) +#if defined(MP_SET_UL_C) #endif -#if defined(BN_MP_SHRINK_C) +#if defined(MP_SET_ULL_C) #endif -#if defined(BN_MP_SIGNED_RSH_C) -# define BN_MP_ADD_D_C -# define BN_MP_DIV_2D_C -# define BN_MP_SUB_D_C +#if defined(MP_SHRINK_C) #endif -#if defined(BN_MP_SQR_C) -# define BN_S_MP_KARATSUBA_SQR_C -# define BN_S_MP_SQR_C -# define BN_S_MP_SQR_FAST_C -# define BN_S_MP_TOOM_SQR_C +#if defined(MP_SIGNED_RSH_C) +# define MP_ADD_D_C +# define MP_DIV_2D_C +# define MP_SUB_D_C #endif -#if defined(BN_MP_SQRMOD_C) -# define BN_MP_CLEAR_C -# define BN_MP_INIT_C -# define BN_MP_MOD_C -# define BN_MP_SQR_C +#if defined(MP_SQR_C) +# define S_MP_KARATSUBA_SQR_C +# define S_MP_SQR_C +# define S_MP_SQR_FAST_C +# define S_MP_TOOM_SQR_C #endif -#if defined(BN_MP_SQRT_C) -# define BN_MP_ADD_C -# define BN_MP_CLEAR_C -# define BN_MP_CMP_MAG_C -# define BN_MP_DIV_2_C -# define BN_MP_DIV_C -# define BN_MP_EXCH_C -# define BN_MP_INIT_C -# define BN_MP_INIT_COPY_C -# define BN_MP_RSHD_C -# define BN_MP_ZERO_C +#if defined(MP_SQRMOD_C) +# define MP_CLEAR_C +# define MP_INIT_C +# define MP_MOD_C +# define MP_SQR_C #endif -#if defined(BN_MP_SQRTMOD_PRIME_C) -# define BN_MP_ADD_D_C -# define BN_MP_CLEAR_MULTI_C -# define BN_MP_CMP_D_C -# define BN_MP_COPY_C -# define BN_MP_DIV_2_C -# define BN_MP_EXPTMOD_C -# define BN_MP_INIT_MULTI_C -# define BN_MP_KRONECKER_C -# define BN_MP_MOD_D_C -# define BN_MP_MULMOD_C -# define BN_MP_SET_C -# define BN_MP_SET_U32_C -# define BN_MP_SQRMOD_C -# define BN_MP_SUB_D_C -# define BN_MP_ZERO_C +#if defined(MP_SQRT_C) +# define MP_ADD_C +# define MP_CLEAR_C +# define MP_CMP_MAG_C +# define MP_DIV_2_C +# define MP_DIV_C +# define MP_EXCH_C +# define MP_INIT_C +# define MP_INIT_COPY_C +# define MP_RSHD_C +# define MP_ZERO_C #endif -#if defined(BN_MP_SUB_C) -# define BN_MP_CMP_MAG_C -# define BN_S_MP_ADD_C -# define BN_S_MP_SUB_C +#if defined(MP_SQRTMOD_PRIME_C) +# define MP_ADD_D_C +# define MP_CLEAR_MULTI_C +# define MP_CMP_D_C +# define MP_COPY_C +# define MP_DIV_2_C +# define MP_EXPTMOD_C +# define MP_INIT_MULTI_C +# define MP_KRONECKER_C +# define MP_MOD_D_C +# define MP_MULMOD_C +# define MP_SET_C +# define MP_SET_U32_C +# define MP_SQRMOD_C +# define MP_SUB_D_C +# define MP_ZERO_C #endif -#if defined(BN_MP_SUB_D_C) -# define BN_MP_ADD_D_C -# define BN_MP_CLAMP_C -# define BN_MP_GROW_C +#if defined(MP_SUB_C) +# define MP_CMP_MAG_C +# define S_MP_ADD_C +# define S_MP_SUB_C #endif -#if defined(BN_MP_SUBMOD_C) -# define BN_MP_CLEAR_C -# define BN_MP_INIT_C -# define BN_MP_MOD_C -# define BN_MP_SUB_C +#if defined(MP_SUB_D_C) +# define MP_ADD_D_C +# define MP_CLAMP_C +# define MP_GROW_C #endif -#if defined(BN_MP_TO_RADIX_C) -# define BN_MP_CLEAR_C -# define BN_MP_DIV_D_C -# define BN_MP_INIT_COPY_C -# define BN_S_MP_REVERSE_C +#if defined(MP_SUBMOD_C) +# define MP_CLEAR_C +# define MP_INIT_C +# define MP_MOD_C +# define MP_SUB_C #endif -#if defined(BN_MP_TO_SBIN_C) -# define BN_MP_TO_UBIN_C +#if defined(MP_TO_RADIX_C) +# define MP_CLEAR_C +# define MP_DIV_D_C +# define MP_INIT_COPY_C +# define S_MP_REVERSE_C #endif -#if defined(BN_MP_TO_UBIN_C) -# define BN_MP_CLEAR_C -# define BN_MP_DIV_2D_C -# define BN_MP_INIT_COPY_C -# define BN_MP_UBIN_SIZE_C +#if defined(MP_TO_SBIN_C) +# define MP_TO_UBIN_C #endif -#if defined(BN_MP_UBIN_SIZE_C) -# define BN_MP_COUNT_BITS_C +#if defined(MP_TO_UBIN_C) +# define MP_CLEAR_C +# define MP_DIV_2D_C +# define MP_INIT_COPY_C +# define MP_UBIN_SIZE_C #endif -#if defined(BN_MP_UNPACK_C) -# define BN_MP_CLAMP_C -# define BN_MP_MUL_2D_C -# define BN_MP_ZERO_C -#endif - -#if defined(BN_MP_XOR_C) -# define BN_MP_CLAMP_C -# define BN_MP_GROW_C -#endif - -#if defined(BN_MP_ZERO_C) -#endif - -#if defined(BN_PRIME_TAB_C) -#endif - -#if defined(BN_S_MP_ADD_C) -# define BN_MP_CLAMP_C -# define BN_MP_GROW_C -#endif - -#if defined(BN_S_MP_BALANCE_MUL_C) -# define BN_MP_ADD_C -# define BN_MP_CLAMP_C -# define BN_MP_CLEAR_C -# define BN_MP_CLEAR_MULTI_C -# define BN_MP_EXCH_C -# define BN_MP_INIT_MULTI_C -# define BN_MP_INIT_SIZE_C -# define BN_MP_LSHD_C -# define BN_MP_MUL_C -#endif - -#if defined(BN_S_MP_EXPTMOD_C) -# define BN_MP_CLEAR_C -# define BN_MP_COPY_C -# define BN_MP_COUNT_BITS_C -# define BN_MP_EXCH_C -# define BN_MP_INIT_C -# define BN_MP_MOD_C -# define BN_MP_MUL_C -# define BN_MP_REDUCE_2K_L_C -# define BN_MP_REDUCE_2K_SETUP_L_C -# define BN_MP_REDUCE_C -# define BN_MP_REDUCE_SETUP_C -# define BN_MP_SET_C -# define BN_MP_SQR_C -#endif - -#if defined(BN_S_MP_EXPTMOD_FAST_C) -# define BN_MP_CLEAR_C -# define BN_MP_COPY_C -# define BN_MP_COUNT_BITS_C -# define BN_MP_DR_REDUCE_C -# define BN_MP_DR_SETUP_C -# define BN_MP_EXCH_C -# define BN_MP_INIT_SIZE_C -# define BN_MP_MOD_C -# define BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -# define BN_MP_MONTGOMERY_REDUCE_C -# define BN_MP_MONTGOMERY_SETUP_C -# define BN_MP_MULMOD_C -# define BN_MP_MUL_C -# define BN_MP_REDUCE_2K_C -# define BN_MP_REDUCE_2K_SETUP_C -# define BN_MP_SET_C -# define BN_MP_SQR_C -# define BN_S_MP_MONTGOMERY_REDUCE_FAST_C +#if defined(MP_UBIN_SIZE_C) +# define MP_COUNT_BITS_C +#endif + +#if defined(MP_UNPACK_C) +# define MP_CLAMP_C +# define MP_MUL_2D_C +# define MP_ZERO_C +#endif + +#if defined(MP_XOR_C) +# define MP_CLAMP_C +# define MP_GROW_C +#endif + +#if defined(MP_ZERO_C) +#endif + +#if defined(S_MP_ADD_C) +# define MP_CLAMP_C +# define MP_GROW_C +#endif + +#if defined(S_MP_BALANCE_MUL_C) +# define MP_ADD_C +# define MP_CLAMP_C +# define MP_CLEAR_C +# define MP_CLEAR_MULTI_C +# define MP_EXCH_C +# define MP_INIT_MULTI_C +# define MP_INIT_SIZE_C +# define MP_LSHD_C +# define MP_MUL_C +#endif + +#if defined(S_MP_EXPTMOD_C) +# define MP_CLEAR_C +# define MP_COPY_C +# define MP_COUNT_BITS_C +# define MP_EXCH_C +# define MP_INIT_C +# define MP_MOD_C +# define MP_MUL_C +# define MP_REDUCE_2K_L_C +# define MP_REDUCE_2K_SETUP_L_C +# define MP_REDUCE_C +# define MP_REDUCE_SETUP_C +# define MP_SET_C +# define MP_SQR_C +#endif + +#if defined(S_MP_EXPTMOD_FAST_C) +# define MP_CLEAR_C +# define MP_COPY_C +# define MP_COUNT_BITS_C +# define MP_DR_REDUCE_C +# define MP_DR_SETUP_C +# define MP_EXCH_C +# define MP_INIT_SIZE_C +# define MP_MOD_C +# define MP_MONTGOMERY_CALC_NORMALIZATION_C +# define MP_MONTGOMERY_REDUCE_C +# define MP_MONTGOMERY_SETUP_C +# define MP_MULMOD_C +# define MP_MUL_C +# define MP_REDUCE_2K_C +# define MP_REDUCE_2K_SETUP_C +# define MP_SET_C +# define MP_SQR_C +# define S_MP_MONTGOMERY_REDUCE_FAST_C #endif -#if defined(BN_S_MP_GET_BIT_C) +#if defined(S_MP_GET_BIT_C) #endif -#if defined(BN_S_MP_INVMOD_FAST_C) -# define BN_MP_ADD_C -# define BN_MP_CLEAR_MULTI_C -# define BN_MP_CMP_C -# define BN_MP_CMP_D_C -# define BN_MP_CMP_MAG_C -# define BN_MP_COPY_C -# define BN_MP_DIV_2_C -# define BN_MP_EXCH_C -# define BN_MP_INIT_MULTI_C -# define BN_MP_MOD_C -# define BN_MP_SET_C -# define BN_MP_SUB_C +#if defined(S_MP_INVMOD_FAST_C) +# define MP_ADD_C +# define MP_CLEAR_MULTI_C +# define MP_CMP_C +# define MP_CMP_D_C +# define MP_CMP_MAG_C +# define MP_COPY_C +# define MP_DIV_2_C +# define MP_EXCH_C +# define MP_INIT_MULTI_C +# define MP_MOD_C +# define MP_SET_C +# define MP_SUB_C #endif -#if defined(BN_S_MP_INVMOD_SLOW_C) -# define BN_MP_ADD_C -# define BN_MP_CLEAR_MULTI_C -# define BN_MP_CMP_C -# define BN_MP_CMP_D_C -# define BN_MP_CMP_MAG_C -# define BN_MP_COPY_C -# define BN_MP_DIV_2_C -# define BN_MP_EXCH_C -# define BN_MP_INIT_MULTI_C -# define BN_MP_MOD_C -# define BN_MP_SET_C -# define BN_MP_SUB_C -#endif - -#if defined(BN_S_MP_KARATSUBA_MUL_C) -# define BN_MP_ADD_C -# define BN_MP_CLAMP_C -# define BN_MP_CLEAR_C -# define BN_MP_INIT_SIZE_C -# define BN_MP_LSHD_C -# define BN_MP_MUL_C -# define BN_S_MP_ADD_C -# define BN_S_MP_SUB_C -#endif - -#if defined(BN_S_MP_KARATSUBA_SQR_C) -# define BN_MP_ADD_C -# define BN_MP_CLAMP_C -# define BN_MP_CLEAR_C -# define BN_MP_INIT_SIZE_C -# define BN_MP_LSHD_C -# define BN_MP_SQR_C -# define BN_S_MP_ADD_C -# define BN_S_MP_SUB_C -#endif - -#if defined(BN_S_MP_MONTGOMERY_REDUCE_FAST_C) -# define BN_MP_CLAMP_C -# define BN_MP_CMP_MAG_C -# define BN_MP_GROW_C -# define BN_S_MP_SUB_C -#endif - -#if defined(BN_S_MP_MUL_DIGS_C) -# define BN_MP_CLAMP_C -# define BN_MP_CLEAR_C -# define BN_MP_EXCH_C -# define BN_MP_INIT_SIZE_C -# define BN_S_MP_MUL_DIGS_FAST_C -#endif - -#if defined(BN_S_MP_MUL_DIGS_FAST_C) -# define BN_MP_CLAMP_C -# define BN_MP_GROW_C -#endif - -#if defined(BN_S_MP_MUL_HIGH_DIGS_C) -# define BN_MP_CLAMP_C -# define BN_MP_CLEAR_C -# define BN_MP_EXCH_C -# define BN_MP_INIT_SIZE_C -# define BN_S_MP_MUL_HIGH_DIGS_FAST_C -#endif - -#if defined(BN_S_MP_MUL_HIGH_DIGS_FAST_C) -# define BN_MP_CLAMP_C -# define BN_MP_GROW_C -#endif - -#if defined(BN_S_MP_PRIME_IS_DIVISIBLE_C) -# define BN_MP_MOD_D_C -#endif +#if defined(S_MP_INVMOD_SLOW_C) +# define MP_ADD_C +# define MP_CLEAR_MULTI_C +# define MP_CMP_C +# define MP_CMP_D_C +# define MP_CMP_MAG_C +# define MP_COPY_C +# define MP_DIV_2_C +# define MP_EXCH_C +# define MP_INIT_MULTI_C +# define MP_MOD_C +# define MP_SET_C +# define MP_SUB_C +#endif + +#if defined(S_MP_KARATSUBA_MUL_C) +# define MP_ADD_C +# define MP_CLAMP_C +# define MP_CLEAR_C +# define MP_INIT_SIZE_C +# define MP_LSHD_C +# define MP_MUL_C +# define S_MP_ADD_C +# define S_MP_SUB_C +#endif + +#if defined(S_MP_KARATSUBA_SQR_C) +# define MP_ADD_C +# define MP_CLAMP_C +# define MP_CLEAR_C +# define MP_INIT_SIZE_C +# define MP_LSHD_C +# define MP_SQR_C +# define S_MP_ADD_C +# define S_MP_SUB_C +#endif + +#if defined(S_MP_MONTGOMERY_REDUCE_FAST_C) +# define MP_CLAMP_C +# define MP_CMP_MAG_C +# define MP_GROW_C +# define S_MP_SUB_C +#endif + +#if defined(S_MP_MUL_DIGS_C) +# define MP_CLAMP_C +# define MP_CLEAR_C +# define MP_EXCH_C +# define MP_INIT_SIZE_C +# define S_MP_MUL_DIGS_FAST_C +#endif + +#if defined(S_MP_MUL_DIGS_FAST_C) +# define MP_CLAMP_C +# define MP_GROW_C +#endif + +#if defined(S_MP_MUL_HIGH_DIGS_C) +# define MP_CLAMP_C +# define MP_CLEAR_C +# define MP_EXCH_C +# define MP_INIT_SIZE_C +# define S_MP_MUL_HIGH_DIGS_FAST_C +#endif + +#if defined(S_MP_MUL_HIGH_DIGS_FAST_C) +# define MP_CLAMP_C +# define MP_GROW_C +#endif + +#if defined(S_MP_PRIME_IS_DIVISIBLE_C) +# define MP_MOD_D_C +#endif -#if defined(BN_S_MP_RAND_JENKINS_C) -# define BN_S_MP_RAND_JENKINS_INIT_C +#if defined(S_MP_RAND_JENKINS_C) +# define S_MP_RAND_JENKINS_INIT_C #endif -#if defined(BN_S_MP_RAND_PLATFORM_C) +#if defined(S_MP_RAND_PLATFORM_C) #endif -#if defined(BN_S_MP_REVERSE_C) +#if defined(S_MP_REVERSE_C) #endif -#if defined(BN_S_MP_SQR_C) -# define BN_MP_CLAMP_C -# define BN_MP_CLEAR_C -# define BN_MP_EXCH_C -# define BN_MP_INIT_SIZE_C +#if defined(S_MP_SQR_C) +# define MP_CLAMP_C +# define MP_CLEAR_C +# define MP_EXCH_C +# define MP_INIT_SIZE_C #endif -#if defined(BN_S_MP_SQR_FAST_C) -# define BN_MP_CLAMP_C -# define BN_MP_GROW_C +#if defined(S_MP_SQR_FAST_C) +# define MP_CLAMP_C +# define MP_GROW_C #endif -#if defined(BN_S_MP_SUB_C) -# define BN_MP_CLAMP_C -# define BN_MP_GROW_C +#if defined(S_MP_SUB_C) +# define MP_CLAMP_C +# define MP_GROW_C #endif -#if defined(BN_S_MP_TOOM_MUL_C) -# define BN_MP_ADD_C -# define BN_MP_CLAMP_C -# define BN_MP_CLEAR_C -# define BN_MP_CLEAR_MULTI_C -# define BN_MP_DIV_2_C -# define BN_MP_DIV_3_C -# define BN_MP_INIT_MULTI_C -# define BN_MP_INIT_SIZE_C -# define BN_MP_LSHD_C -# define BN_MP_MUL_2_C -# define BN_MP_MUL_C -# define BN_MP_SUB_C +#if defined(S_MP_TOOM_MUL_C) +# define MP_ADD_C +# define MP_CLAMP_C +# define MP_CLEAR_C +# define MP_CLEAR_MULTI_C +# define MP_DIV_2_C +# define MP_DIV_3_C +# define MP_INIT_MULTI_C +# define MP_INIT_SIZE_C +# define MP_LSHD_C +# define MP_MUL_2_C +# define MP_MUL_C +# define MP_SUB_C #endif -#if defined(BN_S_MP_TOOM_SQR_C) -# define BN_MP_ADD_C -# define BN_MP_CLAMP_C -# define BN_MP_CLEAR_C -# define BN_MP_DIV_2_C -# define BN_MP_INIT_C -# define BN_MP_INIT_SIZE_C -# define BN_MP_LSHD_C -# define BN_MP_MUL_2_C -# define BN_MP_MUL_C -# define BN_MP_SQR_C -# define BN_MP_SUB_C +#if defined(S_MP_TOOM_SQR_C) +# define MP_ADD_C +# define MP_CLAMP_C +# define MP_CLEAR_C +# define MP_DIV_2_C +# define MP_INIT_C +# define MP_INIT_SIZE_C +# define MP_LSHD_C +# define MP_MUL_2_C +# define MP_MUL_C +# define MP_SQR_C +# define MP_SUB_C #endif #ifdef LTM_INSIDE diff --git a/tommath_private.h b/tommath_private.h index d87ee9b2f..c44c72adb 100644 --- a/tommath_private.h +++ b/tommath_private.h @@ -1,8 +1,8 @@ /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ -#ifndef TOMMATH_PRIV_H_ -#define TOMMATH_PRIV_H_ +#ifndef TOMMATH_PRIVATE_H_ +#define TOMMATH_PRIVATE_H_ #include "tommath.h" #include "tommath_class.h" @@ -142,7 +142,7 @@ extern void MP_FREE(void *mem, size_t size); /* feature detection macro */ #define MP_STRINGIZE(x) MP__STRINGIZE(x) #define MP__STRINGIZE(x) ""#x"" -#define MP_HAS(x) (sizeof(MP_STRINGIZE(BN_##x##_C)) == 1u) +#define MP_HAS(x) (sizeof(MP_STRINGIZE(x##_C)) == 1u) /* TODO: Remove private_mp_word as soon as deprecated mp_word is removed from tommath. */ typedef private_mp_word mp_word; diff --git a/tommath_superclass.h b/tommath_superclass.h index bb606b5af..7179975b9 100644 --- a/tommath_superclass.h +++ b/tommath_superclass.h @@ -19,56 +19,56 @@ */ #ifdef SC_RSA_1_WITH_TESTS -# define BN_MP_ERROR_TO_STRING_C -# define BN_MP_FREAD_C -# define BN_MP_FWRITE_C -# define BN_MP_INCR_C -# define BN_MP_ISEVEN_C -# define BN_MP_ISODD_C -# define BN_MP_NEG_C -# define BN_MP_PRIME_FROBENIUS_UNDERWOOD_C -# define BN_MP_RADIX_SIZE_C -# define BN_MP_LOG_U32_C -# define BN_MP_RAND_C -# define BN_MP_REDUCE_C -# define BN_MP_REDUCE_2K_L_C -# define BN_MP_FROM_SBIN_C -# define BN_MP_ROOT_U32_C -# define BN_MP_SET_L_C -# define BN_MP_SET_UL_C -# define BN_MP_SBIN_SIZE_C -# define BN_MP_TO_RADIX_C -# define BN_MP_TO_SBIN_C -# define BN_S_MP_RAND_JENKINS_C -# define BN_S_MP_RAND_PLATFORM_C +# define MP_ERROR_TO_STRING_C +# define MP_FREAD_C +# define MP_FWRITE_C +# define MP_INCR_C +# define MP_ISEVEN_C +# define MP_ISODD_C +# define MP_NEG_C +# define MP_PRIME_FROBENIUS_UNDERWOOD_C +# define MP_RADIX_SIZE_C +# define MP_LOG_U32_C +# define MP_RAND_C +# define MP_REDUCE_C +# define MP_REDUCE_2K_L_C +# define MP_FROM_SBIN_C +# define MP_ROOT_U32_C +# define MP_SET_L_C +# define MP_SET_UL_C +# define MP_SBIN_SIZE_C +# define MP_TO_RADIX_C +# define MP_TO_SBIN_C +# define S_MP_RAND_JENKINS_C +# define S_MP_RAND_PLATFORM_C #endif /* Works for RSA only, mpi.o is 68KiB */ #if defined(SC_RSA_1) || defined (SC_RSA_1_WITH_TESTS) -# define BN_CUTOFFS_C -# define BN_MP_ADDMOD_C -# define BN_MP_CLEAR_MULTI_C -# define BN_MP_EXPTMOD_C -# define BN_MP_GCD_C -# define BN_MP_INIT_MULTI_C -# define BN_MP_INVMOD_C -# define BN_MP_LCM_C -# define BN_MP_MOD_C -# define BN_MP_MOD_D_C -# define BN_MP_MULMOD_C -# define BN_MP_PRIME_IS_PRIME_C -# define BN_MP_PRIME_RABIN_MILLER_TRIALS_C -# define BN_MP_PRIME_RAND_C -# define BN_MP_RADIX_SMAP_C -# define BN_MP_SET_INT_C -# define BN_MP_SHRINK_C -# define BN_MP_TO_UNSIGNED_BIN_C -# define BN_MP_UNSIGNED_BIN_SIZE_C -# define BN_PRIME_TAB_C -# define BN_S_MP_REVERSE_C +# define MP_CUTOFFS_C +# define MP_ADDMOD_C +# define MP_CLEAR_MULTI_C +# define MP_EXPTMOD_C +# define MP_GCD_C +# define MP_INIT_MULTI_C +# define MP_INVMOD_C +# define MP_LCM_C +# define MP_MOD_C +# define MP_MOD_D_C +# define MP_MULMOD_C +# define MP_PRIME_IS_PRIME_C +# define MP_PRIME_RABIN_MILLER_TRIALS_C +# define MP_PRIME_RAND_C +# define MP_RADIX_SMAP_C +# define MP_SET_INT_C +# define MP_SHRINK_C +# define MP_TO_UNSIGNED_BIN_C +# define MP_UNSIGNED_BIN_SIZE_C +# define MP_PRIME_TAB_C +# define S_MP_REVERSE_C /* other modifiers */ -# define BN_MP_DIV_SMALL /* Slower division, not critical */ +# define MP_DIV_SMALL /* Slower division, not critical */ /* here we are on the last pass so we turn things off. The functions classes are still there @@ -76,26 +76,26 @@ * like removing support for even moduli, etc... */ # ifdef LTM_LAST -# undef BN_MP_DR_IS_MODULUS_C -# undef BN_MP_DR_SETUP_C -# undef BN_MP_DR_REDUCE_C -# undef BN_MP_DIV_3_C -# undef BN_MP_REDUCE_2K_SETUP_C -# undef BN_MP_REDUCE_2K_C -# undef BN_MP_REDUCE_IS_2K_C -# undef BN_MP_REDUCE_SETUP_C -# undef BN_S_MP_BALANCE_MUL_C -# undef BN_S_MP_EXPTMOD_C -# undef BN_S_MP_INVMOD_FAST_C -# undef BN_S_MP_KARATSUBA_MUL_C -# undef BN_S_MP_KARATSUBA_SQR_C -# undef BN_S_MP_MUL_HIGH_DIGS_C -# undef BN_S_MP_MUL_HIGH_DIGS_FAST_C -# undef BN_S_MP_TOOM_MUL_C -# undef BN_S_MP_TOOM_SQR_C +# undef MP_DR_IS_MODULUS_C +# undef MP_DR_SETUP_C +# undef MP_DR_REDUCE_C +# undef MP_DIV_3_C +# undef MP_REDUCE_2K_SETUP_C +# undef MP_REDUCE_2K_C +# undef MP_REDUCE_IS_2K_C +# undef MP_REDUCE_SETUP_C +# undef S_MP_BALANCE_MUL_C +# undef S_MP_EXPTMOD_C +# undef S_MP_INVMOD_FAST_C +# undef S_MP_KARATSUBA_MUL_C +# undef S_MP_KARATSUBA_SQR_C +# undef S_MP_MUL_HIGH_DIGS_C +# undef S_MP_MUL_HIGH_DIGS_FAST_C +# undef S_MP_TOOM_MUL_C +# undef S_MP_TOOM_SQR_C # ifndef SC_RSA_1_WITH_TESTS -# undef BN_MP_REDUCE_C +# undef MP_REDUCE_C # endif /* To safely undefine these you have to make sure your RSA key won't exceed the Comba threshold @@ -103,9 +103,9 @@ * which means roughly speaking you can handle upto 2536-bit RSA keys with these defined without * trouble. */ -# undef BN_MP_MONTGOMERY_REDUCE_C -# undef BN_S_MP_MUL_DIGS_C -# undef BN_S_MP_SQR_C +# undef MP_MONTGOMERY_REDUCE_C +# undef S_MP_MUL_DIGS_C +# undef S_MP_SQR_C # endif #endif