remove deprecated functions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997
diff --git a/bn_deprecated.c b/bn_deprecated.c
index 2056b20..8dcaa2f 100644
--- a/bn_deprecated.c
+++ b/bn_deprecated.c
@@ -2,320 +2,4 @@
#ifdef BN_DEPRECATED_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
-
-#ifdef BN_MP_GET_BIT_C
-int mp_get_bit(const mp_int *a, int b)
-{
- if (b < 0) {
- return MP_VAL;
- }
- return (s_mp_get_bit(a, (unsigned int)b) == MP_YES) ? MP_YES : MP_NO;
-}
-#endif
-#ifdef BN_MP_JACOBI_C
-mp_err mp_jacobi(const mp_int *a, const mp_int *n, int *c)
-{
- if (a->sign == MP_NEG) {
- return MP_VAL;
- }
- if (mp_cmp_d(n, 0uL) != MP_GT) {
- return MP_VAL;
- }
- return mp_kronecker(a, n, c);
-}
-#endif
-#ifdef BN_MP_PRIME_RANDOM_EX_C
-mp_err mp_prime_random_ex(mp_int *a, int t, int size, int flags, private_mp_prime_callback cb, void *dat)
-{
- return s_mp_prime_random_ex(a, t, size, flags, cb, dat);
-}
-#endif
-#ifdef BN_MP_RAND_DIGIT_C
-mp_err mp_rand_digit(mp_digit *r)
-{
- mp_err err = s_mp_rand_source(r, sizeof(mp_digit));
- *r &= MP_MASK;
- return err;
-}
-#endif
-#ifdef BN_FAST_MP_INVMOD_C
-mp_err fast_mp_invmod(const mp_int *a, const mp_int *b, mp_int *c)
-{
- return s_mp_invmod_fast(a, b, c);
-}
-#endif
-#ifdef BN_FAST_MP_MONTGOMERY_REDUCE_C
-mp_err fast_mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho)
-{
- return s_mp_montgomery_reduce_fast(x, n, rho);
-}
-#endif
-#ifdef BN_FAST_S_MP_MUL_DIGS_C
-mp_err fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs)
-{
- return s_mp_mul_digs_fast(a, b, c, digs);
-}
-#endif
-#ifdef BN_FAST_S_MP_MUL_HIGH_DIGS_C
-mp_err fast_s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs)
-{
- return s_mp_mul_high_digs_fast(a, b, c, digs);
-}
-#endif
-#ifdef BN_FAST_S_MP_SQR_C
-mp_err fast_s_mp_sqr(const mp_int *a, mp_int *b)
-{
- return s_mp_sqr_fast(a, b);
-}
-#endif
-#ifdef BN_MP_BALANCE_MUL_C
-mp_err mp_balance_mul(const mp_int *a, const mp_int *b, mp_int *c)
-{
- return s_mp_balance_mul(a, b, c);
-}
-#endif
-#ifdef BN_MP_EXPTMOD_FAST_C
-mp_err mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode)
-{
- return s_mp_exptmod_fast(G, X, P, Y, redmode);
-}
-#endif
-#ifdef BN_MP_INVMOD_SLOW_C
-mp_err mp_invmod_slow(const mp_int *a, const mp_int *b, mp_int *c)
-{
- return s_mp_invmod_slow(a, b, c);
-}
-#endif
-#ifdef BN_MP_KARATSUBA_MUL_C
-mp_err mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c)
-{
- return s_mp_karatsuba_mul(a, b, c);
-}
-#endif
-#ifdef BN_MP_KARATSUBA_SQR_C
-mp_err mp_karatsuba_sqr(const mp_int *a, mp_int *b)
-{
- return s_mp_karatsuba_sqr(a, b);
-}
-#endif
-#ifdef BN_MP_TOOM_MUL_C
-mp_err mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c)
-{
- return s_mp_toom_mul(a, b, c);
-}
-#endif
-#ifdef BN_MP_TOOM_SQR_C
-mp_err mp_toom_sqr(const mp_int *a, mp_int *b)
-{
- return s_mp_toom_sqr(a, b);
-}
-#endif
-#ifdef S_MP_REVERSE_C
-void bn_reverse(unsigned char *s, int len)
-{
- if (len > 0) {
- s_mp_reverse(s, (size_t)len);
- }
-}
-#endif
-#ifdef BN_MP_TC_AND_C
-mp_err mp_tc_and(const mp_int *a, const mp_int *b, mp_int *c)
-{
- return mp_and(a, b, c);
-}
-#endif
-#ifdef BN_MP_TC_OR_C
-mp_err mp_tc_or(const mp_int *a, const mp_int *b, mp_int *c)
-{
- return mp_or(a, b, c);
-}
-#endif
-#ifdef BN_MP_TC_XOR_C
-mp_err mp_tc_xor(const mp_int *a, const mp_int *b, mp_int *c)
-{
- return mp_xor(a, b, c);
-}
-#endif
-#ifdef BN_MP_TC_DIV_2D_C
-mp_err mp_tc_div_2d(const mp_int *a, int b, mp_int *c)
-{
- return mp_signed_rsh(a, b, c);
-}
-#endif
-#ifdef BN_MP_INIT_SET_INT_C
-mp_err mp_init_set_int(mp_int *a, unsigned long b)
-{
- return mp_init_u32(a, (uint32_t)b);
-}
-#endif
-#ifdef BN_MP_SET_INT_C
-mp_err mp_set_int(mp_int *a, unsigned long b)
-{
- mp_set_u32(a, (uint32_t)b);
- return MP_OKAY;
-}
-#endif
-#ifdef BN_MP_SET_LONG_C
-mp_err mp_set_long(mp_int *a, unsigned long b)
-{
- mp_set_u64(a, b);
- return MP_OKAY;
-}
-#endif
-#ifdef BN_MP_SET_LONG_LONG_C
-mp_err mp_set_long_long(mp_int *a, unsigned long long b)
-{
- mp_set_u64(a, b);
- return MP_OKAY;
-}
-#endif
-#ifdef BN_MP_GET_INT_C
-unsigned long mp_get_int(const mp_int *a)
-{
- return (unsigned long)mp_get_mag_u32(a);
-}
-#endif
-#ifdef BN_MP_GET_LONG_C
-unsigned long mp_get_long(const mp_int *a)
-{
- return (unsigned long)mp_get_mag_ul(a);
-}
-#endif
-#ifdef BN_MP_GET_LONG_LONG_C
-unsigned long long mp_get_long_long(const mp_int *a)
-{
- return mp_get_mag_ull(a);
-}
-#endif
-#ifdef BN_MP_PRIME_IS_DIVISIBLE_C
-mp_err mp_prime_is_divisible(const mp_int *a, mp_bool *result)
-{
- return s_mp_prime_is_divisible(a, result);
-}
-#endif
-#ifdef BN_MP_EXPT_D_EX_C
-mp_err mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast)
-{
- (void)fast;
- if (b > MP_MIN(MP_DIGIT_MAX, UINT32_MAX)) {
- return MP_VAL;
- }
- return mp_expt_u32(a, (uint32_t)b, c);
-}
-#endif
-#ifdef BN_MP_EXPT_D_C
-mp_err mp_expt_d(const mp_int *a, mp_digit b, mp_int *c)
-{
- if (b > MP_MIN(MP_DIGIT_MAX, UINT32_MAX)) {
- return MP_VAL;
- }
- return mp_expt_u32(a, (uint32_t)b, c);
-}
-#endif
-#ifdef BN_MP_N_ROOT_EX_C
-mp_err mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast)
-{
- (void)fast;
- if (b > MP_MIN(MP_DIGIT_MAX, UINT32_MAX)) {
- return MP_VAL;
- }
- return mp_root_u32(a, (uint32_t)b, c);
-}
-#endif
-#ifdef BN_MP_N_ROOT_C
-mp_err mp_n_root(const mp_int *a, mp_digit b, mp_int *c)
-{
- if (b > MP_MIN(MP_DIGIT_MAX, UINT32_MAX)) {
- return MP_VAL;
- }
- return mp_root_u32(a, (uint32_t)b, c);
-}
-#endif
-#ifdef BN_MP_UNSIGNED_BIN_SIZE_C
-int mp_unsigned_bin_size(const mp_int *a)
-{
- return (int)mp_ubin_size(a);
-}
-#endif
-#ifdef BN_MP_READ_UNSIGNED_BIN_C
-mp_err mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c)
-{
- return mp_from_ubin(a, b, (size_t) c);
-}
-#endif
-#ifdef BN_MP_TO_UNSIGNED_BIN_C
-mp_err mp_to_unsigned_bin(const mp_int *a, unsigned char *b)
-{
- return mp_to_ubin(a, b, SIZE_MAX, NULL);
-}
-#endif
-#ifdef BN_MP_TO_UNSIGNED_BIN_N_C
-mp_err mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen)
-{
- size_t n = mp_ubin_size(a);
- if (*outlen < (unsigned long)n) {
- return MP_VAL;
- }
- *outlen = (unsigned long)n;
- return mp_to_ubin(a, b, n, NULL);
-}
-#endif
-#ifdef BN_MP_SIGNED_BIN_SIZE_C
-int mp_signed_bin_size(const mp_int *a)
-{
- return (int)mp_sbin_size(a);
-}
-#endif
-#ifdef BN_MP_READ_SIGNED_BIN_C
-mp_err mp_read_signed_bin(mp_int *a, const unsigned char *b, int c)
-{
- return mp_from_sbin(a, b, (size_t) c);
-}
-#endif
-#ifdef BN_MP_TO_SIGNED_BIN_C
-mp_err mp_to_signed_bin(const mp_int *a, unsigned char *b)
-{
- return mp_to_sbin(a, b, SIZE_MAX, NULL);
-}
-#endif
-#ifdef BN_MP_TO_SIGNED_BIN_N_C
-mp_err mp_to_signed_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen)
-{
- size_t n = mp_sbin_size(a);
- if (*outlen < (unsigned long)n) {
- return MP_VAL;
- }
- *outlen = (unsigned long)n;
- return mp_to_sbin(a, b, n, NULL);
-}
-#endif
-#ifdef BN_MP_TORADIX_N_C
-mp_err mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen)
-{
- if (maxlen < 0) {
- return MP_VAL;
- }
- return mp_to_radix(a, str, (size_t)maxlen, NULL, radix);
-}
-#endif
-#ifdef BN_MP_TORADIX_C
-mp_err mp_toradix(const mp_int *a, char *str, int radix)
-{
- return mp_to_radix(a, str, SIZE_MAX, NULL, radix);
-}
-#endif
-#ifdef BN_MP_IMPORT_C
-mp_err mp_import(mp_int *rop, size_t count, int order, size_t size, int endian, size_t nails,
- const void *op)
-{
- return mp_unpack(rop, count, order, size, endian, nails, op);
-}
-#endif
-#ifdef BN_MP_EXPORT_C
-mp_err mp_export(void *rop, size_t *countp, int order, size_t size,
- int endian, size_t nails, const mp_int *op)
-{
- return mp_pack(rop, SIZE_MAX, countp, order, size, endian, nails, op);
-}
-#endif
#endif
diff --git a/bn_mp_prime_is_prime.c b/bn_mp_prime_is_prime.c
index 7f9fc0b..49fde93 100644
--- a/bn_mp_prime_is_prime.c
+++ b/bn_mp_prime_is_prime.c
@@ -51,7 +51,7 @@ mp_err mp_prime_is_prime(const mp_int *a, int t, mp_bool *result)
}
/* is the input equal to one of the primes in the table? */
- for (ix = 0; ix < PRIVATE_MP_PRIME_TAB_SIZE; ix++) {
+ for (ix = 0; ix < MP_PRIME_TAB_SIZE; ix++) {
if (mp_cmp_d(a, s_mp_prime_tab[ix]) == MP_EQ) {
*result = MP_YES;
return MP_OKAY;
@@ -59,7 +59,7 @@ mp_err mp_prime_is_prime(const mp_int *a, int t, mp_bool *result)
}
#ifdef MP_8BIT
/* The search in the loop above was exhaustive in this case */
- if ((a->used == 1) && (PRIVATE_MP_PRIME_TAB_SIZE >= 31)) {
+ if ((a->used == 1) && (MP_PRIME_TAB_SIZE >= 31)) {
return MP_OKAY;
}
#endif
diff --git a/bn_mp_prime_next_prime.c b/bn_mp_prime_next_prime.c
index 1e971fa..de27eab 100644
--- a/bn_mp_prime_next_prime.c
+++ b/bn_mp_prime_next_prime.c
@@ -13,16 +13,16 @@ mp_err mp_prime_next_prime(mp_int *a, int t, int bbs_style)
int x, y, cmp;
mp_err err;
mp_bool res = MP_NO;
- mp_digit res_tab[PRIVATE_MP_PRIME_TAB_SIZE], step, kstep;
+ mp_digit res_tab[MP_PRIME_TAB_SIZE], step, kstep;
mp_int b;
/* force positive */
a->sign = MP_ZPOS;
/* simple algo if a is less than the largest prime in the table */
- if (mp_cmp_d(a, s_mp_prime_tab[PRIVATE_MP_PRIME_TAB_SIZE-1]) == MP_LT) {
+ if (mp_cmp_d(a, s_mp_prime_tab[MP_PRIME_TAB_SIZE-1]) == MP_LT) {
/* find which prime it is bigger than "a" */
- for (x = 0; x < PRIVATE_MP_PRIME_TAB_SIZE; x++) {
+ for (x = 0; x < MP_PRIME_TAB_SIZE; x++) {
cmp = mp_cmp_d(a, s_mp_prime_tab[x]);
if (cmp == MP_EQ) {
continue;
@@ -66,7 +66,7 @@ mp_err mp_prime_next_prime(mp_int *a, int t, int bbs_style)
}
/* generate the restable */
- for (x = 1; x < PRIVATE_MP_PRIME_TAB_SIZE; x++) {
+ for (x = 1; x < MP_PRIME_TAB_SIZE; x++) {
if ((err = mp_mod_d(a, s_mp_prime_tab[x], res_tab + x)) != MP_OKAY) {
return err;
}
@@ -88,7 +88,7 @@ mp_err mp_prime_next_prime(mp_int *a, int t, int bbs_style)
step += kstep;
/* compute the new residue without using division */
- for (x = 1; x < PRIVATE_MP_PRIME_TAB_SIZE; x++) {
+ for (x = 1; x < MP_PRIME_TAB_SIZE; x++) {
/* add the step to each residue */
res_tab[x] += kstep;
diff --git a/bn_mp_prime_rand.c b/bn_mp_prime_rand.c
index 4530e9a..af19d76 100644
--- a/bn_mp_prime_rand.c
+++ b/bn_mp_prime_rand.c
@@ -18,7 +18,7 @@
*/
/* This is possibly the mother of all prime generation functions, muahahahahaha! */
-mp_err s_mp_prime_random_ex(mp_int *a, int t, int size, int flags, private_mp_prime_callback cb, void *dat)
+mp_err s_mp_prime_random_ex(mp_int *a, int t, int size, int flags, mp_prime_callback cb, void *dat)
{
unsigned char *tmp, maskAND, maskOR_msb, maskOR_lsb;
int bsize, maskOR_msb_offset;
diff --git a/bn_prime_tab.c b/bn_prime_tab.c
index a6c07f8..6bd53fe 100644
--- a/bn_prime_tab.c
+++ b/bn_prime_tab.c
@@ -3,7 +3,7 @@
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
-const mp_digit ltm_prime_tab[] = {
+const mp_digit s_mp_prime_tab[] = {
0x0002, 0x0003, 0x0005, 0x0007, 0x000B, 0x000D, 0x0011, 0x0013,
0x0017, 0x001D, 0x001F, 0x0025, 0x0029, 0x002B, 0x002F, 0x0035,
0x003B, 0x003D, 0x0043, 0x0047, 0x0049, 0x004F, 0x0053, 0x0059,
@@ -44,18 +44,4 @@ const mp_digit ltm_prime_tab[] = {
#endif
};
-#if defined(__GNUC__) && __GNUC__ >= 4
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-const mp_digit *s_mp_prime_tab = ltm_prime_tab;
-#pragma GCC diagnostic pop
-#elif defined(_MSC_VER) && _MSC_VER >= 1500
-#pragma warning(push)
-#pragma warning(disable: 4996)
-const mp_digit *s_mp_prime_tab = ltm_prime_tab;
-#pragma warning(pop)
-#else
-const mp_digit *s_mp_prime_tab = ltm_prime_tab;
-#endif
-
#endif
diff --git a/bn_s_mp_prime_is_divisible.c b/bn_s_mp_prime_is_divisible.c
index ffd5093..ca303a5 100644
--- a/bn_s_mp_prime_is_divisible.c
+++ b/bn_s_mp_prime_is_divisible.c
@@ -17,7 +17,7 @@ mp_err s_mp_prime_is_divisible(const mp_int *a, mp_bool *result)
/* default to not */
*result = MP_NO;
- for (ix = 0; ix < PRIVATE_MP_PRIME_TAB_SIZE; ix++) {
+ for (ix = 0; ix < MP_PRIME_TAB_SIZE; ix++) {
/* what is a mod LBL_prime_tab[ix] */
if ((err = mp_mod_d(a, s_mp_prime_tab[ix], &res)) != MP_OKAY) {
return err;
diff --git a/demo/test.c b/demo/test.c
index 7b29a4c..c1fc878 100644
--- a/demo/test.c
+++ b/demo/test.c
@@ -1283,21 +1283,6 @@ static int test_mp_read_radix(void)
if ((err = mp_to_radix(&a, buf, SIZE_MAX, &written, 10)) != MP_OKAY) goto LTM_ERR;
printf(" '0' a == %s, length = %zu\n", buf, written);
-
-
- /* Although deprecated it needs to function as long as it isn't dropped */
- /*
- printf("Testing deprecated mp_toradix_n\n");
- if( (err = mp_read_radix(&a, "-123456", 10) ) != MP_OKAY) goto LTM_ERR;
- if( (err = mp_toradix_n(&a, buf, 10, 3) ) != MP_OKAY) goto LTM_ERR;
- printf("a == %s\n", buf);
- if( (err = mp_toradix_n(&a, buf, 10, 4) ) != MP_OKAY) goto LTM_ERR;
- printf("a == %s\n", buf);
- if( (err = mp_toradix_n(&a, buf, 10, 30) ) != MP_OKAY) goto LTM_ERR;
- printf("a == %s\n", buf);
- */
-
-
while (0) {
char *s = fgets(buf, sizeof(buf), stdin);
if (s != buf) break;
diff --git a/makefile b/makefile
index de65c9c..56eeaba 100644
--- a/makefile
+++ b/makefile
@@ -95,9 +95,6 @@ uninstall:
rm $(DESTDIR)$(LIBPATH)/$(LIBNAME)
rm $(HEADERS_PUB:%=$(DESTDIR)$(INCPATH)/%)
-test_standalone: test
- @echo "test_standalone is deprecated, please use make-target 'test'"
-
DEMOS=test mtest_opponent
define DEMO_template
diff --git a/makefile.mingw b/makefile.mingw
index 7eee57d..b11edb7 100644
--- a/makefile.mingw
+++ b/makefile.mingw
@@ -86,9 +86,6 @@ test.exe: demo/shared.o demo/test.o $(LIBMAIN_S)
$(CC) $(LTM_CFLAGS) $(LTM_LDFLAGS) $^ -o $@
@echo NOTICE: start the tests by launching test.exe
-test_standalone: test.exe
- @echo test_standalone is deprecated, please use make-target 'test.exe'
-
all: $(LIBMAIN_S) test.exe
tune: $(LIBNAME_S)
diff --git a/makefile.msvc b/makefile.msvc
index d282e93..5b2f850 100644
--- a/makefile.msvc
+++ b/makefile.msvc
@@ -72,9 +72,6 @@ test.exe: $(LIBMAIN_S) demo/shared.obj demo/test.obj
cl $(LTM_CFLAGS) $(TOBJECTS) $(LIBMAIN_S) $(LTM_LDFLAGS) demo/shared.c demo/test.c /Fe$@
@echo NOTICE: start the tests by launching test.exe
-test_standalone: test.exe
- @echo test_standalone is deprecated, please use make-target 'test.exe'
-
all: $(LIBMAIN_S) test.exe
tune: $(LIBMAIN_S)
diff --git a/makefile.shared b/makefile.shared
index 6802107..5e0f4f2 100644
--- a/makefile.shared
+++ b/makefile.shared
@@ -79,9 +79,6 @@ uninstall:
rm $(HEADERS_PUB:%=$(DESTDIR)$(INCPATH)/%)
rm $(DESTDIR)$(LIBPATH)/pkgconfig/libtommath.pc
-test_standalone: test
- @echo "test_standalone is deprecated, please use make-target 'test'"
-
test mtest_opponent: demo/shared.o $(LIBNAME) | demo/test.o demo/mtest_opponent.o
$(LTLINK) $(LTM_LDFLAGS) demo/$@.o $^ -o $@
diff --git a/makefile.unix b/makefile.unix
index 750be56..e7a6f25 100644
--- a/makefile.unix
+++ b/makefile.unix
@@ -84,9 +84,6 @@ test: demo/shared.o demo/test.o $(LIBMAIN_S)
$(CC) $(LTM_CFLAGS) $(LTM_LDFLAGS) $^ -o $@
@echo "NOTICE: start the tests by: ./test"
-test_standalone: test
- @echo "test_standalone is deprecated, please use make-target 'test'"
-
all: $(LIBMAIN_S) test
tune: $(LIBMAIN_S)
diff --git a/tommath.h b/tommath.h
index 1303509..6c4e957 100644
--- a/tommath.h
+++ b/tommath.h
@@ -7,11 +7,6 @@
#include <stdint.h>
#include <stddef.h>
-#ifdef LTM_NO_FILE
-# warning LTM_NO_FILE has been deprecated, use MP_NO_FILE.
-# define MP_NO_FILE
-#endif
-
#ifndef MP_NO_FILE
# include <stdio.h>
#endif
@@ -97,11 +92,6 @@ typedef uint64_t private_mp_word;
# endif
#endif
-/* mp_word is a private type */
-#define mp_word MP_DEPRECATED_PRAGMA("mp_word has been made private") private_mp_word
-
-#define MP_SIZEOF_MP_DIGIT (MP_DEPRECATED_PRAGMA("MP_SIZEOF_MP_DIGIT has been deprecated, use sizeof (mp_digit)") sizeof (mp_digit))
-
#define MP_MASK ((((mp_digit)1)<<((mp_digit)MP_DIGIT_BIT))-((mp_digit)1))
#define MP_DIGIT_MAX MP_MASK
@@ -110,10 +100,6 @@ typedef uint64_t private_mp_word;
#define MP_PRIME_SAFE 0x0002 /* Safe prime (p-1)/2 == prime */
#define MP_PRIME_2MSB_ON 0x0008 /* force 2nd MSB to 1 */
-#define LTM_PRIME_BBS (MP_DEPRECATED_PRAGMA("LTM_PRIME_BBS has been deprecated, use MP_PRIME_BBS") MP_PRIME_BBS)
-#define LTM_PRIME_SAFE (MP_DEPRECATED_PRAGMA("LTM_PRIME_SAFE has been deprecated, use MP_PRIME_SAFE") MP_PRIME_SAFE)
-#define LTM_PRIME_2MSB_ON (MP_DEPRECATED_PRAGMA("LTM_PRIME_2MSB_ON has been deprecated, use MP_PRIME_2MSB_ON") MP_PRIME_2MSB_ON)
-
typedef enum {
MP_ZPOS = 0, /* positive */
MP_NEG = 1 /* negative */
@@ -163,18 +149,6 @@ TOOM_SQR_CUTOFF;
/* define this to use lower memory usage routines (exptmods mostly) */
/* #define MP_LOW_MEM */
-/* default precision */
-#ifndef MP_PREC
-# ifndef MP_LOW_MEM
-# define PRIVATE_MP_PREC 32 /* default digits of precision */
-# elif defined(MP_8BIT)
-# define PRIVATE_MP_PREC 16 /* default digits of precision */
-# else
-# define PRIVATE_MP_PREC 8 /* default digits of precision */
-# endif
-# define MP_PREC (MP_DEPRECATED_PRAGMA("MP_PREC is an internal macro") PRIVATE_MP_PREC)
-#endif
-
#if defined(__GNUC__) && __GNUC__ >= 4
# define MP_NULL_TERMINATED __attribute__((sentinel))
#else
@@ -216,11 +190,6 @@ TOOM_SQR_CUTOFF;
# define MP_DEPRECATED_PRAGMA(s)
#endif
-#define DIGIT_BIT (MP_DEPRECATED_PRAGMA("DIGIT_BIT macro is deprecated, MP_DIGIT_BIT instead") MP_DIGIT_BIT)
-#define USED(m) (MP_DEPRECATED_PRAGMA("USED macro is deprecated, use z->used instead") (m)->used)
-#define DIGIT(m, k) (MP_DEPRECATED_PRAGMA("DIGIT macro is deprecated, use z->dp instead") (m)->dp[(k)])
-#define SIGN(m) (MP_DEPRECATED_PRAGMA("SIGN macro is deprecated, use z->sign instead") (m)->sign)
-
/* the infamous mp_int structure */
typedef struct {
int used, alloc;
@@ -228,10 +197,6 @@ typedef struct {
mp_digit *dp;
} mp_int;
-/* callback for mp_prime_random, should fill dst with random bytes and return how many read [upto len] */
-typedef int private_mp_prime_callback(unsigned char *dst, int len, void *dat);
-typedef private_mp_prime_callback MP_DEPRECATED(mp_rand_source) ltm_prime_callback;
-
/* error code to char* string */
const char *mp_error_to_string(mp_err code) MP_WUR;
@@ -323,15 +288,6 @@ mp_err mp_init_ull(mp_int *a, unsigned long long b) MP_WUR;
void mp_set(mp_int *a, mp_digit b);
mp_err mp_init_set(mp_int *a, mp_digit b) MP_WUR;
-/* get integer, set integer and init with integer (deprecated) */
-MP_DEPRECATED(mp_get_mag_u32/mp_get_u32) unsigned long mp_get_int(const mp_int *a) MP_WUR;
-MP_DEPRECATED(mp_get_mag_ul/mp_get_ul) unsigned long mp_get_long(const mp_int *a) MP_WUR;
-MP_DEPRECATED(mp_get_mag_ull/mp_get_ull) unsigned long long mp_get_long_long(const mp_int *a) MP_WUR;
-MP_DEPRECATED(mp_set_ul) mp_err mp_set_int(mp_int *a, unsigned long b);
-MP_DEPRECATED(mp_set_ul) mp_err mp_set_long(mp_int *a, unsigned long b);
-MP_DEPRECATED(mp_set_ull) mp_err mp_set_long_long(mp_int *a, unsigned long long b);
-MP_DEPRECATED(mp_init_ul) mp_err mp_init_set_int(mp_int *a, unsigned long b) MP_WUR;
-
/* copy, b = a */
mp_err mp_copy(const mp_int *a, mp_int *b) MP_WUR;
@@ -341,16 +297,6 @@ mp_err mp_init_copy(mp_int *a, const mp_int *b) MP_WUR;
/* trim unused digits */
void mp_clamp(mp_int *a);
-
-/* export binary data */
-MP_DEPRECATED(mp_pack) mp_err mp_export(void *rop, size_t *countp, int order, size_t size,
- int endian, size_t nails, const mp_int *op) MP_WUR;
-
-/* import binary data */
-MP_DEPRECATED(mp_unpack) mp_err mp_import(mp_int *rop, size_t count, int order,
- size_t size, int endian, size_t nails,
- const void *op) MP_WUR;
-
/* unpack binary data */
mp_err mp_unpack(mp_int *rop, size_t count, mp_order order, size_t size, mp_endian endian,
size_t nails, const void *op) MP_WUR;
@@ -396,46 +342,24 @@ int mp_cnt_lsb(const mp_int *a) MP_WUR;
/* makes a pseudo-random mp_int of a given size */
mp_err mp_rand(mp_int *a, int digits) MP_WUR;
-/* makes a pseudo-random small int of a given size */
-MP_DEPRECATED(mp_rand) mp_err mp_rand_digit(mp_digit *r) MP_WUR;
/* use custom random data source instead of source provided the platform */
void mp_rand_source(mp_err(*source)(void *out, size_t size));
-#ifdef MP_PRNG_ENABLE_LTM_RNG
-# warning MP_PRNG_ENABLE_LTM_RNG has been deprecated, use mp_rand_source instead.
-/* A last resort to provide random data on systems without any of the other
- * implemented ways to gather entropy.
- * It is compatible with `rng_get_bytes()` from libtomcrypt so you could
- * provide that one and then set `ltm_rng = rng_get_bytes;` */
-extern unsigned long (*ltm_rng)(unsigned char *out, unsigned long outlen, void (*callback)(void));
-extern void (*ltm_rng_callback)(void);
-#endif
-
/* ---> binary operations <--- */
-/* Checks the bit at position b and returns MP_YES
- * if the bit is 1, MP_NO if it is 0 and MP_VAL
- * in case of error
- */
-MP_DEPRECATED(s_mp_get_bit) int mp_get_bit(const mp_int *a, int b) MP_WUR;
-
/* c = a XOR b (two complement) */
-MP_DEPRECATED(mp_xor) mp_err mp_tc_xor(const mp_int *a, const mp_int *b, mp_int *c) MP_WUR;
mp_err mp_xor(const mp_int *a, const mp_int *b, mp_int *c) MP_WUR;
/* c = a OR b (two complement) */
-MP_DEPRECATED(mp_or) mp_err mp_tc_or(const mp_int *a, const mp_int *b, mp_int *c) MP_WUR;
mp_err mp_or(const mp_int *a, const mp_int *b, mp_int *c) MP_WUR;
/* c = a AND b (two complement) */
-MP_DEPRECATED(mp_and) mp_err mp_tc_and(const mp_int *a, const mp_int *b, mp_int *c) MP_WUR;
mp_err mp_and(const mp_int *a, const mp_int *b, mp_int *c) MP_WUR;
/* b = ~a (bitwise not, two complement) */
mp_err mp_complement(const mp_int *a, mp_int *b) MP_WUR;
/* right shift with sign extension */
-MP_DEPRECATED(mp_signed_rsh) mp_err mp_tc_div_2d(const mp_int *a, int b, mp_int *c) MP_WUR;
mp_err mp_signed_rsh(const mp_int *a, int b, mp_int *c) MP_WUR;
/* ---> Basic arithmetic <--- */
@@ -527,8 +451,6 @@ mp_err mp_lcm(const mp_int *a, const mp_int *b, mp_int *c) MP_WUR;
* returns error if a < 0 and b is even
*/
mp_err mp_root_u32(const mp_int *a, uint32_t b, mp_int *c) MP_WUR;
-MP_DEPRECATED(mp_root_u32) mp_err mp_n_root(const mp_int *a, mp_digit b, mp_int *c) MP_WUR;
-MP_DEPRECATED(mp_root_u32) mp_err mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) MP_WUR;
/* special sqrt algo */
mp_err mp_sqrt(const mp_int *arg, mp_int *ret) MP_WUR;
@@ -539,9 +461,6 @@ mp_err mp_sqrtmod_prime(const mp_int *n, const mp_int *prime, mp_int *ret) MP_WU
/* is number a square? */
mp_err mp_is_square(const mp_int *arg, mp_bool *ret) MP_WUR;
-/* computes the jacobi c = (a | n) (or Legendre if b is prime) */
-MP_DEPRECATED(mp_kronecker) mp_err mp_jacobi(const mp_int *a, const mp_int *n, int *c) MP_WUR;
-
/* computes the Kronecker symbol c = (a | p) (like jacobi() but with {a,p} in Z */
mp_err mp_kronecker(const mp_int *a, const mp_int *p, int *c) MP_WUR;
@@ -598,20 +517,6 @@ mp_err mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y)
/* ---> Primes <--- */
-/* number of primes */
-#ifdef MP_8BIT
-# define PRIVATE_MP_PRIME_TAB_SIZE 31
-#else
-# define PRIVATE_MP_PRIME_TAB_SIZE 256
-#endif
-#define PRIME_SIZE (MP_DEPRECATED_PRAGMA("PRIME_SIZE has been made internal") PRIVATE_MP_PRIME_TAB_SIZE)
-
-/* table of first PRIME_SIZE primes */
-MP_DEPRECATED(internal) extern const mp_digit ltm_prime_tab[PRIVATE_MP_PRIME_TAB_SIZE];
-
-/* result=1 if a is divisible by one of the first PRIME_SIZE primes */
-MP_DEPRECATED(mp_prime_is_prime) mp_err mp_prime_is_divisible(const mp_int *a, mp_bool *result) MP_WUR;
-
/* performs one Fermat test of "a" using base "b".
* Sets result to 0 if composite or 1 if probable prime
*/
@@ -660,17 +565,6 @@ mp_err mp_prime_is_prime(const mp_int *a, int t, mp_bool *result) MP_WUR;
*/
mp_err mp_prime_next_prime(mp_int *a, int t, int bbs_style) MP_WUR;
-/* makes a truly random prime of a given size (bytes),
- * call with bbs = 1 if you want it to be congruent to 3 mod 4
- *
- * You have to supply a callback which fills in a buffer with random bytes. "dat" is a parameter you can
- * have passed to the callback (e.g. a state or something). This function doesn't use "dat" itself
- * so it can be NULL
- *
- * The prime generated will be larger than 2^(8*size).
- */
-#define mp_prime_random(a, t, size, bbs, cb, dat) (MP_DEPRECATED_PRAGMA("mp_prime_random has been deprecated, use mp_prime_rand instead") mp_prime_random_ex(a, t, ((size) * 8) + 1, (bbs==1)?MP_PRIME_BBS:0, cb, dat))
-
/* makes a truly random prime of a given size (bits),
*
* Flags are as follows:
@@ -684,8 +578,6 @@ mp_err mp_prime_next_prime(mp_int *a, int t, int bbs_style) MP_WUR;
* so it can be NULL
*
*/
-MP_DEPRECATED(mp_prime_rand) mp_err mp_prime_random_ex(mp_int *a, int t, int size, int flags,
- private_mp_prime_callback cb, void *dat) MP_WUR;
mp_err mp_prime_rand(mp_int *a, int t, int size, int flags) MP_WUR;
/* Integer logarithm to integer base */
@@ -693,23 +585,10 @@ mp_err mp_log_u32(const mp_int *a, uint32_t base, uint32_t *c) MP_WUR;
/* c = a**b */
mp_err mp_expt_u32(const mp_int *a, uint32_t b, mp_int *c) MP_WUR;
-MP_DEPRECATED(mp_expt_u32) mp_err mp_expt_d(const mp_int *a, mp_digit b, mp_int *c) MP_WUR;
-MP_DEPRECATED(mp_expt_u32) mp_err mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) MP_WUR;
/* ---> radix conversion <--- */
int mp_count_bits(const mp_int *a) MP_WUR;
-
-MP_DEPRECATED(mp_ubin_size) int mp_unsigned_bin_size(const mp_int *a) MP_WUR;
-MP_DEPRECATED(mp_from_ubin) mp_err mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c) MP_WUR;
-MP_DEPRECATED(mp_to_ubin) mp_err mp_to_unsigned_bin(const mp_int *a, unsigned char *b) MP_WUR;
-MP_DEPRECATED(mp_to_ubin) mp_err mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen) MP_WUR;
-
-MP_DEPRECATED(mp_sbin_size) int mp_signed_bin_size(const mp_int *a) MP_WUR;
-MP_DEPRECATED(mp_from_sbin) mp_err mp_read_signed_bin(mp_int *a, const unsigned char *b, int c) MP_WUR;
-MP_DEPRECATED(mp_to_sbin) mp_err mp_to_signed_bin(const mp_int *a, unsigned char *b) MP_WUR;
-MP_DEPRECATED(mp_to_sbin) mp_err mp_to_signed_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen) MP_WUR;
-
size_t mp_ubin_size(const mp_int *a) MP_WUR;
mp_err mp_from_ubin(mp_int *a, const unsigned char *buf, size_t size) MP_WUR;
mp_err mp_to_ubin(const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written) MP_WUR;
@@ -719,8 +598,6 @@ mp_err mp_from_sbin(mp_int *a, const unsigned char *buf, size_t size) MP_WUR;
mp_err mp_to_sbin(const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written) MP_WUR;
mp_err mp_read_radix(mp_int *a, const char *str, int radix) MP_WUR;
-MP_DEPRECATED(mp_to_radix) mp_err mp_toradix(const mp_int *a, char *str, int radix) MP_WUR;
-MP_DEPRECATED(mp_to_radix) mp_err mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen) MP_WUR;
mp_err mp_to_radix(const mp_int *a, char *str, size_t maxlen, size_t *written, int radix) MP_WUR;
mp_err mp_radix_size(const mp_int *a, int radix, int *size) MP_WUR;
@@ -729,18 +606,6 @@ mp_err mp_fread(mp_int *a, int radix, FILE *stream) MP_WUR;
mp_err mp_fwrite(const mp_int *a, int radix, FILE *stream) MP_WUR;
#endif
-#define mp_read_raw(mp, str, len) (MP_DEPRECATED_PRAGMA("replaced by mp_read_signed_bin") mp_read_signed_bin((mp), (str), (len)))
-#define mp_raw_size(mp) (MP_DEPRECATED_PRAGMA("replaced by mp_signed_bin_size") mp_signed_bin_size(mp))
-#define mp_toraw(mp, str) (MP_DEPRECATED_PRAGMA("replaced by mp_to_signed_bin") mp_to_signed_bin((mp), (str)))
-#define mp_read_mag(mp, str, len) (MP_DEPRECATED_PRAGMA("replaced by mp_read_unsigned_bin") mp_read_unsigned_bin((mp), (str), (len))
-#define mp_mag_size(mp) (MP_DEPRECATED_PRAGMA("replaced by mp_unsigned_bin_size") mp_unsigned_bin_size(mp))
-#define mp_tomag(mp, str) (MP_DEPRECATED_PRAGMA("replaced by mp_to_unsigned_bin") mp_to_unsigned_bin((mp), (str)))
-
-#define mp_tobinary(M, S) (MP_DEPRECATED_PRAGMA("replaced by mp_to_binary") mp_toradix((M), (S), 2))
-#define mp_tooctal(M, S) (MP_DEPRECATED_PRAGMA("replaced by mp_to_octal") mp_toradix((M), (S), 8))
-#define mp_todecimal(M, S) (MP_DEPRECATED_PRAGMA("replaced by mp_to_decimal") mp_toradix((M), (S), 10))
-#define mp_tohex(M, S) (MP_DEPRECATED_PRAGMA("replaced by mp_to_hex") mp_toradix((M), (S), 16))
-
#define mp_to_binary(M, S, N) mp_to_radix((M), (S), (N), NULL, 2)
#define mp_to_octal(M, S, N) mp_to_radix((M), (S), (N), NULL, 8)
#define mp_to_decimal(M, S, N) mp_to_radix((M), (S), (N), NULL, 10)
diff --git a/tommath_class.h b/tommath_class.h
index 52ba585..b0a82f0 100644
--- a/tommath_class.h
+++ b/tommath_class.h
@@ -174,90 +174,6 @@
#endif
#if defined(BN_DEPRECATED_C)
-# define BN_FAST_MP_INVMOD_C
-# define BN_FAST_MP_MONTGOMERY_REDUCE_C
-# define BN_FAST_S_MP_MUL_DIGS_C
-# define BN_FAST_S_MP_MUL_HIGH_DIGS_C
-# define BN_FAST_S_MP_SQR_C
-# define BN_MP_AND_C
-# define BN_MP_BALANCE_MUL_C
-# define BN_MP_CMP_D_C
-# define BN_MP_EXPORT_C
-# define BN_MP_EXPTMOD_FAST_C
-# define BN_MP_EXPT_D_C
-# define BN_MP_EXPT_D_EX_C
-# define BN_MP_EXPT_U32_C
-# define BN_MP_FROM_SBIN_C
-# define BN_MP_FROM_UBIN_C
-# define BN_MP_GET_BIT_C
-# define BN_MP_GET_INT_C
-# define BN_MP_GET_LONG_C
-# define BN_MP_GET_LONG_LONG_C
-# define BN_MP_GET_MAG_U32_C
-# define BN_MP_GET_MAG_ULL_C
-# define BN_MP_GET_MAG_UL_C
-# define BN_MP_IMPORT_C
-# define BN_MP_INIT_SET_INT_C
-# define BN_MP_INIT_U32_C
-# define BN_MP_INVMOD_SLOW_C
-# define BN_MP_JACOBI_C
-# define BN_MP_KARATSUBA_MUL_C
-# define BN_MP_KARATSUBA_SQR_C
-# define BN_MP_KRONECKER_C
-# define BN_MP_N_ROOT_C
-# define BN_MP_N_ROOT_EX_C
-# define BN_MP_OR_C
-# define BN_MP_PACK_C
-# define BN_MP_PRIME_IS_DIVISIBLE_C
-# define BN_MP_PRIME_RANDOM_EX_C
-# define BN_MP_RAND_DIGIT_C
-# define BN_MP_READ_SIGNED_BIN_C
-# define BN_MP_READ_UNSIGNED_BIN_C
-# define BN_MP_ROOT_U32_C
-# define BN_MP_SBIN_SIZE_C
-# define BN_MP_SET_INT_C
-# define BN_MP_SET_LONG_C
-# define BN_MP_SET_LONG_LONG_C
-# define BN_MP_SET_U32_C
-# define BN_MP_SET_U64_C
-# define BN_MP_SIGNED_BIN_SIZE_C
-# define BN_MP_SIGNED_RSH_C
-# define BN_MP_TC_AND_C
-# define BN_MP_TC_DIV_2D_C
-# define BN_MP_TC_OR_C
-# define BN_MP_TC_XOR_C
-# define BN_MP_TOOM_MUL_C
-# define BN_MP_TOOM_SQR_C
-# define BN_MP_TORADIX_C
-# define BN_MP_TORADIX_N_C
-# define BN_MP_TO_RADIX_C
-# define BN_MP_TO_SBIN_C
-# define BN_MP_TO_SIGNED_BIN_C
-# define BN_MP_TO_SIGNED_BIN_N_C
-# define BN_MP_TO_UBIN_C
-# define BN_MP_TO_UNSIGNED_BIN_C
-# define BN_MP_TO_UNSIGNED_BIN_N_C
-# define BN_MP_UBIN_SIZE_C
-# define BN_MP_UNPACK_C
-# define BN_MP_UNSIGNED_BIN_SIZE_C
-# define BN_MP_XOR_C
-# define BN_S_MP_BALANCE_MUL_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_FAST_C
-# define BN_S_MP_MUL_HIGH_DIGS_FAST_C
-# define BN_S_MP_PRIME_IS_DIVISIBLE_C
-# define BN_S_MP_PRIME_RANDOM_EX_C
-# define BN_S_MP_RAND_SOURCE_C
-# define BN_S_MP_REVERSE_C
-# define BN_S_MP_SQR_FAST_C
-# define BN_S_MP_TOOM_MUL_C
-# define BN_S_MP_TOOM_SQR_C
#endif
#if defined(BN_MP_2EXPT_C)
diff --git a/tommath_private.h b/tommath_private.h
index 5ccb4e2..0909fa5 100644
--- a/tommath_private.h
+++ b/tommath_private.h
@@ -147,7 +147,6 @@ extern void MP_FREE(void *mem, size_t size);
#define MP_HAS(x) (sizeof(MP_STRINGIZE(BN_##x##_C)) == 1u)
/* TODO: Remove private_mp_word as soon as deprecated mp_word is removed from tommath. */
-#undef mp_word
typedef private_mp_word mp_word;
#define MP_MIN(x, y) (((x) < (y)) ? (x) : (y))
@@ -166,10 +165,16 @@ typedef private_mp_word mp_word;
#define MP_WARRAY (1 << ((MP_SIZEOF_BITS(mp_word) - (2 * MP_DIGIT_BIT)) + 1))
-/* TODO: Remove PRIVATE_MP_PREC as soon as deprecated MP_PREC is removed from tommath.h */
-#ifdef PRIVATE_MP_PREC
-# undef MP_PREC
-# define MP_PREC PRIVATE_MP_PREC
+
+/* default precision */
+#ifndef MP_PREC
+# ifndef MP_LOW_MEM
+# define MP_PREC 32 /* default digits of precision */
+# elif defined(MP_8BIT)
+# define MP_PREC 16 /* default digits of precision */
+# else
+# define MP_PREC 8 /* default digits of precision */
+# endif
#endif
/* Minimum number of available digits in mp_int, MP_PREC >= MP_MIN_PREC */
@@ -201,7 +206,8 @@ MP_PRIVATE mp_err s_mp_montgomery_reduce_fast(mp_int *x, const mp_int *n, mp_dig
MP_PRIVATE mp_err s_mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode) MP_WUR;
MP_PRIVATE mp_err s_mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode) MP_WUR;
MP_PRIVATE mp_err s_mp_rand_platform(void *p, size_t n) MP_WUR;
-MP_PRIVATE mp_err s_mp_prime_random_ex(mp_int *a, int t, int size, int flags, private_mp_prime_callback cb, void *dat);
+typedef int mp_prime_callback(unsigned char *dst, int len, void *dat);
+MP_PRIVATE mp_err s_mp_prime_random_ex(mp_int *a, int t, int size, int flags, mp_prime_callback cb, void *dat);
MP_PRIVATE void s_mp_reverse(unsigned char *s, size_t len);
MP_PRIVATE mp_err s_mp_prime_is_divisible(const mp_int *a, mp_bool *result);
@@ -212,28 +218,14 @@ MP_PRIVATE void s_mp_rand_jenkins_init(uint64_t seed);
extern MP_PRIVATE const char *const mp_s_rmap;
extern MP_PRIVATE const uint8_t mp_s_rmap_reverse[];
extern MP_PRIVATE const size_t mp_s_rmap_reverse_sz;
-extern MP_PRIVATE const mp_digit *s_mp_prime_tab;
+extern MP_PRIVATE const mp_digit s_mp_prime_tab[];
-/* deprecated functions */
-MP_DEPRECATED(s_mp_invmod_fast) mp_err fast_mp_invmod(const mp_int *a, const mp_int *b, mp_int *c);
-MP_DEPRECATED(s_mp_montgomery_reduce_fast) mp_err fast_mp_montgomery_reduce(mp_int *x, const mp_int *n,
- mp_digit rho);
-MP_DEPRECATED(s_mp_mul_digs_fast) mp_err fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c,
- int digs);
-MP_DEPRECATED(s_mp_mul_high_digs_fast) mp_err fast_s_mp_mul_high_digs(const mp_int *a, const mp_int *b,
- mp_int *c,
- int digs);
-MP_DEPRECATED(s_mp_sqr_fast) mp_err fast_s_mp_sqr(const mp_int *a, mp_int *b);
-MP_DEPRECATED(s_mp_balance_mul) mp_err mp_balance_mul(const mp_int *a, const mp_int *b, mp_int *c);
-MP_DEPRECATED(s_mp_exptmod_fast) mp_err mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P,
- mp_int *Y,
- int redmode);
-MP_DEPRECATED(s_mp_invmod_slow) mp_err mp_invmod_slow(const mp_int *a, const mp_int *b, mp_int *c);
-MP_DEPRECATED(s_mp_karatsuba_mul) mp_err mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c);
-MP_DEPRECATED(s_mp_karatsuba_sqr) mp_err mp_karatsuba_sqr(const mp_int *a, mp_int *b);
-MP_DEPRECATED(s_mp_toom_mul) mp_err mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c);
-MP_DEPRECATED(s_mp_toom_sqr) mp_err mp_toom_sqr(const mp_int *a, mp_int *b);
-MP_DEPRECATED(s_mp_reverse) void bn_reverse(unsigned char *s, int len);
+/* number of primes */
+#ifdef MP_8BIT
+# define MP_PRIME_TAB_SIZE 31
+#else
+# define MP_PRIME_TAB_SIZE 256
+#endif
#define MP_GET_ENDIANNESS(x) \
do{\