Mercurial > dropbear
comparison libtommath/tommath_superclass.h @ 1692:1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
* update C files
* update other files
* update headers
* update makefiles
* remove mp_set/get_double()
* use ltm 1.2.0 API
* update ltm_desc
* use bundled tommath if system-tommath is too old
* XMALLOC etc. were changed to MP_MALLOC etc.
author | Steffen Jaeckel <s@jaeckel.eu> |
---|---|
date | Tue, 26 May 2020 17:36:47 +0200 |
parents | f52919ffd3b1 |
children |
comparison
equal
deleted
inserted
replaced
1691:2d3745d58843 | 1692:1051e4eea25a |
---|---|
1 /* LibTomMath, multiple-precision integer library -- Tom St Denis | 1 /* LibTomMath, multiple-precision integer library -- Tom St Denis */ |
2 * | 2 /* SPDX-License-Identifier: Unlicense */ |
3 * LibTomMath is a library that provides multiple-precision | |
4 * integer arithmetic as well as number theoretic functionality. | |
5 * | |
6 * The library was designed directly after the MPI library by | |
7 * Michael Fromberger but has been written from scratch with | |
8 * additional optimizations in place. | |
9 * | |
10 * SPDX-License-Identifier: Unlicense | |
11 */ | |
12 | 3 |
13 /* super class file for PK algos */ | 4 /* super class file for PK algos */ |
14 | 5 |
15 /* default ... include all MPI */ | 6 /* default ... include all MPI */ |
7 #ifndef LTM_NOTHING | |
16 #define LTM_ALL | 8 #define LTM_ALL |
9 #endif | |
17 | 10 |
18 /* RSA only (does not support DH/DSA/ECC) */ | 11 /* RSA only (does not support DH/DSA/ECC) */ |
19 /* #define SC_RSA_1 */ | 12 /* #define SC_RSA_1 */ |
13 /* #define SC_RSA_1_WITH_TESTS */ | |
20 | 14 |
21 /* For reference.... On an Athlon64 optimizing for speed... | 15 /* For reference.... On an Athlon64 optimizing for speed... |
22 | 16 |
23 LTM's mpi.o with all functions [striped] is 142KiB in size. | 17 LTM's mpi.o with all functions [striped] is 142KiB in size. |
24 | 18 |
25 */ | 19 */ |
26 | 20 |
21 #ifdef SC_RSA_1_WITH_TESTS | |
22 # define BN_MP_ERROR_TO_STRING_C | |
23 # define BN_MP_FREAD_C | |
24 # define BN_MP_FWRITE_C | |
25 # define BN_MP_INCR_C | |
26 # define BN_MP_ISEVEN_C | |
27 # define BN_MP_ISODD_C | |
28 # define BN_MP_NEG_C | |
29 # define BN_MP_PRIME_FROBENIUS_UNDERWOOD_C | |
30 # define BN_MP_RADIX_SIZE_C | |
31 # define BN_MP_RAND_C | |
32 # define BN_MP_REDUCE_C | |
33 # define BN_MP_REDUCE_2K_L_C | |
34 # define BN_MP_FROM_SBIN_C | |
35 # define BN_MP_ROOT_U32_C | |
36 # define BN_MP_SET_L_C | |
37 # define BN_MP_SET_UL_C | |
38 # define BN_MP_SBIN_SIZE_C | |
39 # define BN_MP_TO_RADIX_C | |
40 # define BN_MP_TO_SBIN_C | |
41 # define BN_S_MP_RAND_JENKINS_C | |
42 # define BN_S_MP_RAND_PLATFORM_C | |
43 #endif | |
44 | |
27 /* Works for RSA only, mpi.o is 68KiB */ | 45 /* Works for RSA only, mpi.o is 68KiB */ |
28 #ifdef SC_RSA_1 | 46 #if defined(SC_RSA_1) || defined (SC_RSA_1_WITH_TESTS) |
47 # define BN_CUTOFFS_C | |
48 # define BN_MP_ADDMOD_C | |
49 # define BN_MP_CLEAR_MULTI_C | |
50 # define BN_MP_EXPTMOD_C | |
51 # define BN_MP_GCD_C | |
52 # define BN_MP_INIT_MULTI_C | |
53 # define BN_MP_INVMOD_C | |
54 # define BN_MP_LCM_C | |
55 # define BN_MP_MOD_C | |
56 # define BN_MP_MOD_D_C | |
57 # define BN_MP_MULMOD_C | |
58 # define BN_MP_PRIME_IS_PRIME_C | |
59 # define BN_MP_PRIME_RABIN_MILLER_TRIALS_C | |
60 # define BN_MP_PRIME_RAND_C | |
61 # define BN_MP_RADIX_SMAP_C | |
62 # define BN_MP_SET_INT_C | |
29 # define BN_MP_SHRINK_C | 63 # define BN_MP_SHRINK_C |
30 # define BN_MP_LCM_C | 64 # define BN_MP_TO_UNSIGNED_BIN_C |
31 # define BN_MP_PRIME_RANDOM_EX_C | |
32 # define BN_MP_INVMOD_C | |
33 # define BN_MP_GCD_C | |
34 # define BN_MP_MOD_C | |
35 # define BN_MP_MULMOD_C | |
36 # define BN_MP_ADDMOD_C | |
37 # define BN_MP_EXPTMOD_C | |
38 # define BN_MP_SET_INT_C | |
39 # define BN_MP_INIT_MULTI_C | |
40 # define BN_MP_CLEAR_MULTI_C | |
41 # define BN_MP_UNSIGNED_BIN_SIZE_C | 65 # define BN_MP_UNSIGNED_BIN_SIZE_C |
42 # define BN_MP_TO_UNSIGNED_BIN_C | |
43 # define BN_MP_MOD_D_C | |
44 # define BN_MP_PRIME_RABIN_MILLER_TRIALS_C | |
45 # define BN_REVERSE_C | |
46 # define BN_PRIME_TAB_C | 66 # define BN_PRIME_TAB_C |
67 # define BN_S_MP_REVERSE_C | |
47 | 68 |
48 /* other modifiers */ | 69 /* other modifiers */ |
49 # define BN_MP_DIV_SMALL /* Slower division, not critical */ | 70 # define BN_MP_DIV_SMALL /* Slower division, not critical */ |
71 | |
50 | 72 |
51 /* here we are on the last pass so we turn things off. The functions classes are still there | 73 /* here we are on the last pass so we turn things off. The functions classes are still there |
52 * but we remove them specifically from the build. This also invokes tweaks in functions | 74 * but we remove them specifically from the build. This also invokes tweaks in functions |
53 * like removing support for even moduli, etc... | 75 * like removing support for even moduli, etc... |
54 */ | 76 */ |
55 # ifdef LTM_LAST | 77 # ifdef LTM_LAST |
56 # undef BN_MP_TOOM_MUL_C | |
57 # undef BN_MP_TOOM_SQR_C | |
58 # undef BN_MP_KARATSUBA_MUL_C | |
59 # undef BN_MP_KARATSUBA_SQR_C | |
60 # undef BN_MP_REDUCE_C | |
61 # undef BN_MP_REDUCE_SETUP_C | |
62 # undef BN_MP_DR_IS_MODULUS_C | 78 # undef BN_MP_DR_IS_MODULUS_C |
63 # undef BN_MP_DR_SETUP_C | 79 # undef BN_MP_DR_SETUP_C |
64 # undef BN_MP_DR_REDUCE_C | 80 # undef BN_MP_DR_REDUCE_C |
65 # undef BN_MP_REDUCE_IS_2K_C | 81 # undef BN_MP_DIV_3_C |
66 # undef BN_MP_REDUCE_2K_SETUP_C | 82 # undef BN_MP_REDUCE_2K_SETUP_C |
67 # undef BN_MP_REDUCE_2K_C | 83 # undef BN_MP_REDUCE_2K_C |
84 # undef BN_MP_REDUCE_IS_2K_C | |
85 # undef BN_MP_REDUCE_SETUP_C | |
86 # undef BN_S_MP_BALANCE_MUL_C | |
68 # undef BN_S_MP_EXPTMOD_C | 87 # undef BN_S_MP_EXPTMOD_C |
69 # undef BN_MP_DIV_3_C | 88 # undef BN_S_MP_INVMOD_FAST_C |
89 # undef BN_S_MP_KARATSUBA_MUL_C | |
90 # undef BN_S_MP_KARATSUBA_SQR_C | |
70 # undef BN_S_MP_MUL_HIGH_DIGS_C | 91 # undef BN_S_MP_MUL_HIGH_DIGS_C |
71 # undef BN_FAST_S_MP_MUL_HIGH_DIGS_C | 92 # undef BN_S_MP_MUL_HIGH_DIGS_FAST_C |
72 # undef BN_FAST_MP_INVMOD_C | 93 # undef BN_S_MP_TOOM_MUL_C |
94 # undef BN_S_MP_TOOM_SQR_C | |
95 | |
96 # ifndef SC_RSA_1_WITH_TESTS | |
97 # undef BN_MP_REDUCE_C | |
98 # endif | |
73 | 99 |
74 /* To safely undefine these you have to make sure your RSA key won't exceed the Comba threshold | 100 /* To safely undefine these you have to make sure your RSA key won't exceed the Comba threshold |
75 * which is roughly 255 digits [7140 bits for 32-bit machines, 15300 bits for 64-bit machines] | 101 * which is roughly 255 digits [7140 bits for 32-bit machines, 15300 bits for 64-bit machines] |
76 * which means roughly speaking you can handle upto 2536-bit RSA keys with these defined without | 102 * which means roughly speaking you can handle upto 2536-bit RSA keys with these defined without |
77 * trouble. | 103 * trouble. |
78 */ | 104 */ |
105 # undef BN_MP_MONTGOMERY_REDUCE_C | |
79 # undef BN_S_MP_MUL_DIGS_C | 106 # undef BN_S_MP_MUL_DIGS_C |
80 # undef BN_S_MP_SQR_C | 107 # undef BN_S_MP_SQR_C |
81 # undef BN_MP_MONTGOMERY_REDUCE_C | |
82 # endif | 108 # endif |
83 | 109 |
84 #endif | 110 #endif |
85 | |
86 /* ref: HEAD -> master, tag: v1.1.0 */ | |
87 /* git commit: 08549ad6bc8b0cede0b357a9c341c5c6473a9c55 */ | |
88 /* commit time: 2019-01-28 20:32:32 +0100 */ |