cya_u
Fork of CyaSSL-forEncrypt by
mpi_superclass.h@2:d0516dc143b1, 2017-05-10 (annotated)
- Committer:
- vbahl2
- Date:
- Wed May 10 18:20:47 2017 +0000
- Revision:
- 2:d0516dc143b1
- Parent:
- 0:5045d2638c29
updated
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
toddouska | 0:5045d2638c29 | 1 | /* super class file for PK algos */ |
toddouska | 0:5045d2638c29 | 2 | |
toddouska | 0:5045d2638c29 | 3 | /* default ... include all MPI */ |
toddouska | 0:5045d2638c29 | 4 | #define LTM_ALL |
toddouska | 0:5045d2638c29 | 5 | |
toddouska | 0:5045d2638c29 | 6 | /* RSA only (does not support DH/DSA/ECC) */ |
toddouska | 0:5045d2638c29 | 7 | /* #define SC_RSA_1 */ |
toddouska | 0:5045d2638c29 | 8 | |
toddouska | 0:5045d2638c29 | 9 | /* For reference.... On an Athlon64 optimizing for speed... |
toddouska | 0:5045d2638c29 | 10 | |
toddouska | 0:5045d2638c29 | 11 | LTM's mpi.o with all functions [striped] is 142KiB in size. |
toddouska | 0:5045d2638c29 | 12 | |
toddouska | 0:5045d2638c29 | 13 | */ |
toddouska | 0:5045d2638c29 | 14 | |
toddouska | 0:5045d2638c29 | 15 | /* Works for RSA only, mpi.o is 68KiB */ |
toddouska | 0:5045d2638c29 | 16 | #ifdef SC_RSA_1 |
toddouska | 0:5045d2638c29 | 17 | #define BN_MP_SHRINK_C |
toddouska | 0:5045d2638c29 | 18 | #define BN_MP_LCM_C |
toddouska | 0:5045d2638c29 | 19 | #define BN_MP_PRIME_RANDOM_EX_C |
toddouska | 0:5045d2638c29 | 20 | #define BN_MP_INVMOD_C |
toddouska | 0:5045d2638c29 | 21 | #define BN_MP_GCD_C |
toddouska | 0:5045d2638c29 | 22 | #define BN_MP_MOD_C |
toddouska | 0:5045d2638c29 | 23 | #define BN_MP_MULMOD_C |
toddouska | 0:5045d2638c29 | 24 | #define BN_MP_ADDMOD_C |
toddouska | 0:5045d2638c29 | 25 | #define BN_MP_EXPTMOD_C |
toddouska | 0:5045d2638c29 | 26 | #define BN_MP_SET_INT_C |
toddouska | 0:5045d2638c29 | 27 | #define BN_MP_INIT_MULTI_C |
toddouska | 0:5045d2638c29 | 28 | #define BN_MP_CLEAR_MULTI_C |
toddouska | 0:5045d2638c29 | 29 | #define BN_MP_UNSIGNED_BIN_SIZE_C |
toddouska | 0:5045d2638c29 | 30 | #define BN_MP_TO_UNSIGNED_BIN_C |
toddouska | 0:5045d2638c29 | 31 | #define BN_MP_MOD_D_C |
toddouska | 0:5045d2638c29 | 32 | #define BN_MP_PRIME_RABIN_MILLER_TRIALS_C |
toddouska | 0:5045d2638c29 | 33 | #define BN_REVERSE_C |
toddouska | 0:5045d2638c29 | 34 | #define BN_PRIME_TAB_C |
toddouska | 0:5045d2638c29 | 35 | |
toddouska | 0:5045d2638c29 | 36 | /* other modifiers */ |
toddouska | 0:5045d2638c29 | 37 | #define BN_MP_DIV_SMALL /* Slower division, not critical */ |
toddouska | 0:5045d2638c29 | 38 | |
toddouska | 0:5045d2638c29 | 39 | /* here we are on the last pass so we turn things off. The functions classes are still there |
toddouska | 0:5045d2638c29 | 40 | * but we remove them specifically from the build. This also invokes tweaks in functions |
toddouska | 0:5045d2638c29 | 41 | * like removing support for even moduli, etc... |
toddouska | 0:5045d2638c29 | 42 | */ |
toddouska | 0:5045d2638c29 | 43 | #ifdef LTM_LAST |
toddouska | 0:5045d2638c29 | 44 | #undef BN_MP_TOOM_MUL_C |
toddouska | 0:5045d2638c29 | 45 | #undef BN_MP_TOOM_SQR_C |
toddouska | 0:5045d2638c29 | 46 | #undef BN_MP_KARATSUBA_MUL_C |
toddouska | 0:5045d2638c29 | 47 | #undef BN_MP_KARATSUBA_SQR_C |
toddouska | 0:5045d2638c29 | 48 | #undef BN_MP_REDUCE_C |
toddouska | 0:5045d2638c29 | 49 | #undef BN_MP_REDUCE_SETUP_C |
toddouska | 0:5045d2638c29 | 50 | #undef BN_MP_DR_IS_MODULUS_C |
toddouska | 0:5045d2638c29 | 51 | #undef BN_MP_DR_SETUP_C |
toddouska | 0:5045d2638c29 | 52 | #undef BN_MP_DR_REDUCE_C |
toddouska | 0:5045d2638c29 | 53 | #undef BN_MP_REDUCE_IS_2K_C |
toddouska | 0:5045d2638c29 | 54 | #undef BN_MP_REDUCE_2K_SETUP_C |
toddouska | 0:5045d2638c29 | 55 | #undef BN_MP_REDUCE_2K_C |
toddouska | 0:5045d2638c29 | 56 | #undef BN_S_MP_EXPTMOD_C |
toddouska | 0:5045d2638c29 | 57 | #undef BN_MP_DIV_3_C |
toddouska | 0:5045d2638c29 | 58 | #undef BN_S_MP_MUL_HIGH_DIGS_C |
toddouska | 0:5045d2638c29 | 59 | #undef BN_FAST_S_MP_MUL_HIGH_DIGS_C |
toddouska | 0:5045d2638c29 | 60 | #undef BN_FAST_MP_INVMOD_C |
toddouska | 0:5045d2638c29 | 61 | |
toddouska | 0:5045d2638c29 | 62 | /* To safely undefine these you have to make sure your RSA key won't exceed the Comba threshold |
toddouska | 0:5045d2638c29 | 63 | * which is roughly 255 digits [7140 bits for 32-bit machines, 15300 bits for 64-bit machines] |
toddouska | 0:5045d2638c29 | 64 | * which means roughly speaking you can handle upto 2536-bit RSA keys with these defined without |
toddouska | 0:5045d2638c29 | 65 | * trouble. |
toddouska | 0:5045d2638c29 | 66 | */ |
toddouska | 0:5045d2638c29 | 67 | #undef BN_S_MP_MUL_DIGS_C |
toddouska | 0:5045d2638c29 | 68 | #undef BN_S_MP_SQR_C |
toddouska | 0:5045d2638c29 | 69 | #undef BN_MP_MONTGOMERY_REDUCE_C |
toddouska | 0:5045d2638c29 | 70 | #endif |
toddouska | 0:5045d2638c29 | 71 | |
toddouska | 0:5045d2638c29 | 72 | #endif |
toddouska | 0:5045d2638c29 | 73 |