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