wolfSSL 3.11.1 for TLS1.3 beta
Fork of wolfSSL by
wolfssl/wolfcrypt/mpi_superclass.h@4:1b0d80432c79, 2016-04-28 (annotated)
- Committer:
- wolfSSL
- Date:
- Thu Apr 28 00:57:21 2016 +0000
- Revision:
- 4:1b0d80432c79
wolfSSL 3.9.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wolfSSL | 4:1b0d80432c79 | 1 | /* mpi_superclass.h |
wolfSSL | 4:1b0d80432c79 | 2 | * |
wolfSSL | 4:1b0d80432c79 | 3 | * Copyright (C) 2006-2016 wolfSSL Inc. |
wolfSSL | 4:1b0d80432c79 | 4 | * |
wolfSSL | 4:1b0d80432c79 | 5 | * This file is part of wolfSSL. |
wolfSSL | 4:1b0d80432c79 | 6 | * |
wolfSSL | 4:1b0d80432c79 | 7 | * wolfSSL is free software; you can redistribute it and/or modify |
wolfSSL | 4:1b0d80432c79 | 8 | * it under the terms of the GNU General Public License as published by |
wolfSSL | 4:1b0d80432c79 | 9 | * the Free Software Foundation; either version 2 of the License, or |
wolfSSL | 4:1b0d80432c79 | 10 | * (at your option) any later version. |
wolfSSL | 4:1b0d80432c79 | 11 | * |
wolfSSL | 4:1b0d80432c79 | 12 | * wolfSSL is distributed in the hope that it will be useful, |
wolfSSL | 4:1b0d80432c79 | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
wolfSSL | 4:1b0d80432c79 | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
wolfSSL | 4:1b0d80432c79 | 15 | * GNU General Public License for more details. |
wolfSSL | 4:1b0d80432c79 | 16 | * |
wolfSSL | 4:1b0d80432c79 | 17 | * You should have received a copy of the GNU General Public License |
wolfSSL | 4:1b0d80432c79 | 18 | * along with this program; if not, write to the Free Software |
wolfSSL | 4:1b0d80432c79 | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA |
wolfSSL | 4:1b0d80432c79 | 20 | */ |
wolfSSL | 4:1b0d80432c79 | 21 | |
wolfSSL | 4:1b0d80432c79 | 22 | |
wolfSSL | 4:1b0d80432c79 | 23 | |
wolfSSL | 4:1b0d80432c79 | 24 | /* super class file for PK algos */ |
wolfSSL | 4:1b0d80432c79 | 25 | |
wolfSSL | 4:1b0d80432c79 | 26 | /* default ... include all MPI */ |
wolfSSL | 4:1b0d80432c79 | 27 | #define LTM_ALL |
wolfSSL | 4:1b0d80432c79 | 28 | |
wolfSSL | 4:1b0d80432c79 | 29 | /* RSA only (does not support DH/DSA/ECC) */ |
wolfSSL | 4:1b0d80432c79 | 30 | /* #define SC_RSA_1 */ |
wolfSSL | 4:1b0d80432c79 | 31 | |
wolfSSL | 4:1b0d80432c79 | 32 | /* For reference.... On an Athlon64 optimizing for speed... |
wolfSSL | 4:1b0d80432c79 | 33 | |
wolfSSL | 4:1b0d80432c79 | 34 | LTM's mpi.o with all functions [striped] is 142KiB in size. |
wolfSSL | 4:1b0d80432c79 | 35 | |
wolfSSL | 4:1b0d80432c79 | 36 | */ |
wolfSSL | 4:1b0d80432c79 | 37 | |
wolfSSL | 4:1b0d80432c79 | 38 | /* Works for RSA only, mpi.o is 68KiB */ |
wolfSSL | 4:1b0d80432c79 | 39 | #ifdef SC_RSA_1 |
wolfSSL | 4:1b0d80432c79 | 40 | #define BN_MP_SHRINK_C |
wolfSSL | 4:1b0d80432c79 | 41 | #define BN_MP_LCM_C |
wolfSSL | 4:1b0d80432c79 | 42 | #define BN_MP_PRIME_RANDOM_EX_C |
wolfSSL | 4:1b0d80432c79 | 43 | #define BN_MP_INVMOD_C |
wolfSSL | 4:1b0d80432c79 | 44 | #define BN_MP_GCD_C |
wolfSSL | 4:1b0d80432c79 | 45 | #define BN_MP_MOD_C |
wolfSSL | 4:1b0d80432c79 | 46 | #define BN_MP_MULMOD_C |
wolfSSL | 4:1b0d80432c79 | 47 | #define BN_MP_ADDMOD_C |
wolfSSL | 4:1b0d80432c79 | 48 | #define BN_MP_EXPTMOD_C |
wolfSSL | 4:1b0d80432c79 | 49 | #define BN_MP_SET_INT_C |
wolfSSL | 4:1b0d80432c79 | 50 | #define BN_MP_INIT_MULTI_C |
wolfSSL | 4:1b0d80432c79 | 51 | #define BN_MP_CLEAR_MULTI_C |
wolfSSL | 4:1b0d80432c79 | 52 | #define BN_MP_UNSIGNED_BIN_SIZE_C |
wolfSSL | 4:1b0d80432c79 | 53 | #define BN_MP_TO_UNSIGNED_BIN_C |
wolfSSL | 4:1b0d80432c79 | 54 | #define BN_MP_MOD_D_C |
wolfSSL | 4:1b0d80432c79 | 55 | #define BN_MP_PRIME_RABIN_MILLER_TRIALS_C |
wolfSSL | 4:1b0d80432c79 | 56 | #define BN_REVERSE_C |
wolfSSL | 4:1b0d80432c79 | 57 | #define BN_PRIME_TAB_C |
wolfSSL | 4:1b0d80432c79 | 58 | |
wolfSSL | 4:1b0d80432c79 | 59 | /* other modifiers */ |
wolfSSL | 4:1b0d80432c79 | 60 | #define BN_MP_DIV_SMALL /* Slower division, not critical */ |
wolfSSL | 4:1b0d80432c79 | 61 | |
wolfSSL | 4:1b0d80432c79 | 62 | /* here we are on the last pass so we turn things off. The functions classes are still there |
wolfSSL | 4:1b0d80432c79 | 63 | * but we remove them specifically from the build. This also invokes tweaks in functions |
wolfSSL | 4:1b0d80432c79 | 64 | * like removing support for even moduli, etc... |
wolfSSL | 4:1b0d80432c79 | 65 | */ |
wolfSSL | 4:1b0d80432c79 | 66 | #ifdef LTM_LAST |
wolfSSL | 4:1b0d80432c79 | 67 | #undef BN_MP_TOOM_MUL_C |
wolfSSL | 4:1b0d80432c79 | 68 | #undef BN_MP_TOOM_SQR_C |
wolfSSL | 4:1b0d80432c79 | 69 | #undef BN_MP_KARATSUBA_MUL_C |
wolfSSL | 4:1b0d80432c79 | 70 | #undef BN_MP_KARATSUBA_SQR_C |
wolfSSL | 4:1b0d80432c79 | 71 | #undef BN_MP_REDUCE_C |
wolfSSL | 4:1b0d80432c79 | 72 | #undef BN_MP_REDUCE_SETUP_C |
wolfSSL | 4:1b0d80432c79 | 73 | #undef BN_MP_DR_IS_MODULUS_C |
wolfSSL | 4:1b0d80432c79 | 74 | #undef BN_MP_DR_SETUP_C |
wolfSSL | 4:1b0d80432c79 | 75 | #undef BN_MP_DR_REDUCE_C |
wolfSSL | 4:1b0d80432c79 | 76 | #undef BN_MP_REDUCE_IS_2K_C |
wolfSSL | 4:1b0d80432c79 | 77 | #undef BN_MP_REDUCE_2K_SETUP_C |
wolfSSL | 4:1b0d80432c79 | 78 | #undef BN_MP_REDUCE_2K_C |
wolfSSL | 4:1b0d80432c79 | 79 | #undef BN_S_MP_EXPTMOD_C |
wolfSSL | 4:1b0d80432c79 | 80 | #undef BN_MP_DIV_3_C |
wolfSSL | 4:1b0d80432c79 | 81 | #undef BN_S_MP_MUL_HIGH_DIGS_C |
wolfSSL | 4:1b0d80432c79 | 82 | #undef BN_FAST_S_MP_MUL_HIGH_DIGS_C |
wolfSSL | 4:1b0d80432c79 | 83 | #undef BN_FAST_MP_INVMOD_C |
wolfSSL | 4:1b0d80432c79 | 84 | |
wolfSSL | 4:1b0d80432c79 | 85 | /* To safely undefine these you have to make sure your RSA key won't exceed the Comba threshold |
wolfSSL | 4:1b0d80432c79 | 86 | * which is roughly 255 digits [7140 bits for 32-bit machines, 15300 bits for 64-bit machines] |
wolfSSL | 4:1b0d80432c79 | 87 | * which means roughly speaking you can handle up to 2536-bit RSA keys with these defined without |
wolfSSL | 4:1b0d80432c79 | 88 | * trouble. |
wolfSSL | 4:1b0d80432c79 | 89 | */ |
wolfSSL | 4:1b0d80432c79 | 90 | #undef BN_S_MP_MUL_DIGS_C |
wolfSSL | 4:1b0d80432c79 | 91 | #undef BN_S_MP_SQR_C |
wolfSSL | 4:1b0d80432c79 | 92 | #undef BN_MP_MONTGOMERY_REDUCE_C |
wolfSSL | 4:1b0d80432c79 | 93 | #endif |
wolfSSL | 4:1b0d80432c79 | 94 | |
wolfSSL | 4:1b0d80432c79 | 95 | #endif |
wolfSSL | 4:1b0d80432c79 | 96 | |
wolfSSL | 4:1b0d80432c79 | 97 |