Combined internal LibTomMath configuration into one option
authorJouni Malinen <j@w1.fi>
Fri, 6 Jun 2008 07:21:28 +0000 (10:21 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 6 Jun 2008 07:21:28 +0000 (10:21 +0300)
CONFIG_INTERNAL_LIBTOMMATH_FAST=y in .config can now be used to enable all
optimized routines at a cost of about 4 kB. This is small enough increase
in size to justify simplified configuration.

src/tls/libtommath.c
wpa_supplicant/ChangeLog
wpa_supplicant/Makefile
wpa_supplicant/defconfig

index 30c0fc3..7960105 100644 (file)
 #define BN_S_MP_SQR_C
 #define BN_S_MP_MUL_HIGH_DIGS_C /* Note: #undef in tommath_superclass.h; this
                                 * would require other than mp_reduce */
-#ifdef LTM_FAST_DIV
+
+#ifdef LTM_FAST
+
 /* Use faster div at the cost of about 1 kB */
 #define BN_MP_MUL_D_C
-#else /* LTM_FAST_DIV */
-#define BN_MP_DIV_SMALL
-#define BN_MP_INIT_MULTI_C
-#define BN_MP_CLEAR_MULTI_C
-#define BN_MP_ABS_C
-#endif /* LTM_FAST_DIV */
 
-#ifdef LTM_FAST_EXPTMOD
 /* Include faster exptmod (Montgomery) at the cost of about 2.5 kB in code */
 #define BN_MP_EXPTMOD_FAST_C
 #define BN_MP_MONTGOMERY_SETUP_C
 #define BN_FAST_MP_MONTGOMERY_REDUCE_C
 #define BN_MP_MONTGOMERY_CALC_NORMALIZATION_C
 #define BN_MP_MUL_2_C
-#endif /* LTM_FAST_EXPTMOD */
 
-#ifdef LTM_FAST_SQR
 /* Include faster sqr at the cost of about 0.5 kB in code */
 #define BN_FAST_S_MP_SQR_C
-#endif /* LTM_FAST_SQR */
+
+#else /* LTM_FAST */
+
+#define BN_MP_DIV_SMALL
+#define BN_MP_INIT_MULTI_C
+#define BN_MP_CLEAR_MULTI_C
+#define BN_MP_ABS_C
+#endif /* LTM_FAST */
 
 /* Current uses do not require support for negative exponent in exptmod, so we
  * can save about 1.5 kB in leaving out invmod. */
index 531a1be..15bf6c0 100644 (file)
@@ -11,6 +11,9 @@ ChangeLog for wpa_supplicant
        * added support for parsing PKCS #8 formatted private keys into the
          internal TLS implementation (both PKCS #1 RSA key and PKCS #8
          encapsulated RSA key can now be used)
+       * added option of using faster, but larger, routines in the internal
+         LibTomMath (for internal TLS implementation) to speed up DH and RSA
+         calculations (CONFIG_INTERNAL_LIBTOMMATH_FAST=y)
 
 2008-02-22 - v0.6.3
        * removed 'nai' and 'eappsk' network configuration variables that were
index 30318a9..7708bea 100644 (file)
@@ -621,14 +621,8 @@ CFLAGS += -DCONFIG_TLS_INTERNAL_CLIENT
 ifeq ($(CONFIG_CRYPTO), internal)
 ifdef CONFIG_INTERNAL_LIBTOMMATH
 CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH
-ifdef CONFIG_INTERNAL_LIBTOMMATH_FAST_EXPTMOD
-CFLAGS += -DLTM_FAST_EXPTMOD
-endif
-ifdef CONFIG_INTERNAL_LIBTOMMATH_FAST_SQR
-CFLAGS += -DLTM_FAST_SQR
-endif
-ifdef CONFIG_INTERNAL_LIBTOMMATH_FAST_DIV
-CFLAGS += -DLTM_FAST_DIV
+ifdef CONFIG_INTERNAL_LIBTOMMATH_FAST
+CFLAGS += -DLTM_FAST
 endif
 else
 LIBS += -ltommath
index 3989686..c2ca8a9 100644 (file)
@@ -307,17 +307,11 @@ CONFIG_PEERKEY=y
 #LIBS += -L$(LTM_PATH)
 #LIBS_p += -L$(LTM_PATH)
 #endif
-# At the cost of about 2.5 kB of additional binarysize, the internal LibTomMath
-# can be configured to include fast exptmod routine to speed up DH and RSA.
-#CONFIG_INTERNAL_LIBTOMMATH_FAST_EXPTMOD=y
-# At the cost of about 0.5 kB of additional binary size, the internal
-# LibTomMath can be configured to include faster sqr routine to speed up DH and
-# RSA.
-#CONFIG_INTERNAL_LIBTOMMATH_FAST_SQR=y
-# At the cost of about 1 kB of additional binary size, the internal
-# LibTomMath can be configured to include faster div routine to speed up DH and
-# RSA.
-#CONFIG_INTERNAL_LIBTOMMATH_FAST_DIV=y
+# At the cost of about 4 kB of additional binary size, the internal LibTomMath
+# can be configured to include faster routines for exptmod, sqr, and div to
+# speed up DH and RSA calculation considerably (around 20% time removed on
+# Pentium 4)
+#CONFIG_INTERNAL_LIBTOMMATH_FAST=y
 
 # Include NDIS event processing through WMI into wpa_supplicant/wpasvc.
 # This is only for Windows builds and requires WMI-related header files and