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