~ubuntu-branches/ubuntu/utopic/dropbear/utopic-proposed

« back to all changes in this revision

Viewing changes to libtomcrypt/src/headers/tommath_superclass.h

  • Committer: Bazaar Package Importer
  • Author(s): Matt Johnston
  • Date: 2005-12-08 19:20:21 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051208192021-nyp9rwnt77nsg6ty
Tags: 0.47-1
* New upstream release.
* SECURITY: Fix incorrect buffer sizing.

Show diffs side-by-side

added added

removed removed

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