From b8c9247769685861fc10eb774cde03b9a56e02d5 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Fri, 2 Nov 2012 16:49:31 -0700 Subject: [PATCH 1/2] for lean-psk build: remove big int math, MD4, error strings --- configure.ac | 8 ++++++-- ctaocrypt/src/error.c | 1 + ctaocrypt/test/test.c | 8 ++++++-- src/include.am | 12 +++++++----- src/internal.c | 1 + 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 4a718845f..f7fbcc4ba 100644 --- a/configure.ac +++ b/configure.ac @@ -206,6 +206,7 @@ then AM_CFLAGS="$AM_CFLAGS -DLARGE_STATIC_BUFFERS -DCYASSL_CERT_GEN -DCYASSL_KEY_GEN -DHUGE_SESSION_CACHE -DOPENSSL_EXTRA -DFP_MAX_BITS=8192 -DCYASSL_DER_LOAD -DCYASSL_ALT_NAMES -DCYASSL_TEST_CERT" fi +ENABLED_SLOWMATH="yes" # lean psk build AC_ARG_ENABLE(leanpsk, @@ -216,7 +217,8 @@ AC_ARG_ENABLE(leanpsk, if test "$ENABLED_LEANPSK" = "yes" then - AM_CFLAGS="$AM_CFLAGS -DCYASSL_LEANPSK -DHAVE_NULL_CIPHER -DNO_AES -DNO_FILESYSTEM -DNO_RSA -DNO_DSA -DNO_DH -DNO_CERTS" + AM_CFLAGS="$AM_CFLAGS -DCYASSL_LEANPSK -DHAVE_NULL_CIPHER -DNO_AES -DNO_FILESYSTEM -DNO_RSA -DNO_DSA -DNO_DH -DNO_CERTS -DNO_PWDBASED -DNO_DES3 -DNO_MD4 -DNO_ERROR_STRINGS" + ENABLED_SLOWMATH="no" fi AM_CONDITIONAL([BUILD_LEANPSK], [test "x$ENABLED_LEANPSK" = "xyes"]) @@ -232,6 +234,7 @@ AC_ARG_ENABLE(fastmath, if test "x$ENABLED_FASTMATH" = "xyes" then AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH" + ENABLED_SLOWMATH="no" fi @@ -251,10 +254,11 @@ if test "$ENABLED_FASTHUGEMATH" = "yes" then ENABLED_FASTMATH="yes" AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH" + ENABLED_SLOWMATH="no" fi AM_CONDITIONAL([BUILD_FASTMATH], [test "x$ENABLED_FASTMATH" = "xyes"]) - +AM_CONDITIONAL([BUILD_SLOWMATH], [test "x$ENABLED_SLOWMATH" = "xyes"]) # big cache AC_ARG_ENABLE(bigcache, diff --git a/ctaocrypt/src/error.c b/ctaocrypt/src/error.c index 63f71b5eb..6cfe8e729 100644 --- a/ctaocrypt/src/error.c +++ b/ctaocrypt/src/error.c @@ -37,6 +37,7 @@ void CTaoCryptErrorString(int error, char* buffer) #ifdef NO_ERROR_STRINGS + (void)error; XSTRNCPY(buffer, "no support for error strings built in", max); #else diff --git a/ctaocrypt/test/test.c b/ctaocrypt/test/test.c index bcb54b677..1b2239ca0 100644 --- a/ctaocrypt/test/test.c +++ b/ctaocrypt/test/test.c @@ -150,18 +150,22 @@ void ctaocrypt_test(void* args) ((func_args*)args)->return_code = -1; /* error state */ +#if !defined(CYASSL_LEANPSK) if (CheckCtcSettings() != 1) err_sys("Build vs runtime math mismatch\n", -1234); #ifdef USE_FAST_MATH if (CheckFastMathSettings() != 1) err_sys("Build vs runtime fastmath FP_MAX_BITS mismatch\n", -1235); -#endif - +#endif /* USE_FAST_MATH */ +#endif /* !CYASSL_LEANPSK */ + +#ifdef NO_MD5 if ( (ret = md5_test()) ) err_sys("MD5 test failed!\n", ret); else printf( "MD5 test passed!\n"); +#endif #ifdef CYASSL_MD2 if ( (ret = md2_test()) ) diff --git a/src/include.am b/src/include.am index b1f4c547e..126d978e1 100644 --- a/src/include.am +++ b/src/include.am @@ -10,15 +10,12 @@ src_libcyassl_la_SOURCES = \ src/ssl.c \ src/tls.c \ ctaocrypt/src/coding.c \ - ctaocrypt/src/des3.c \ - ctaocrypt/src/hmac.c \ ctaocrypt/src/md5.c \ - ctaocrypt/src/md4.c \ + ctaocrypt/src/hmac.c \ ctaocrypt/src/random.c \ ctaocrypt/src/sha.c \ ctaocrypt/src/sha256.c \ ctaocrypt/src/arc4.c \ - ctaocrypt/src/pwdbased.c \ ctaocrypt/src/logging.c \ ctaocrypt/src/error.c \ ctaocrypt/src/memory.c @@ -29,9 +26,12 @@ src_libcyassl_la_CPPFLAGS = -DBUILDING_CYASSL $(AM_CPPFLAGS) if !BUILD_LEANPSK src_libcyassl_la_SOURCES += ctaocrypt/src/rsa.c \ + ctaocrypt/src/des3.c \ + ctaocrypt/src/md4.c \ ctaocrypt/src/asn.c \ ctaocrypt/src/dh.c \ ctaocrypt/src/dsa.c \ + ctaocrypt/src/pwdbased.c \ ctaocrypt/src/aes.c endif @@ -69,7 +69,9 @@ endif if BUILD_FASTMATH src_libcyassl_la_SOURCES += ctaocrypt/src/tfm.c -else +endif + +if BUILD_SLOWMATH src_libcyassl_la_SOURCES += ctaocrypt/src/integer.c endif diff --git a/src/internal.c b/src/internal.c index 2ad32ddc2..fe7c9fe7b 100644 --- a/src/internal.c +++ b/src/internal.c @@ -4176,6 +4176,7 @@ void SetErrorString(int error, char* str) #ifdef NO_ERROR_STRINGS + (void)error; XSTRNCPY(str, "no support for error strings built in", max); #else From d4c99ae66312730718fca9ff508bf599f297768e Mon Sep 17 00:00:00 2001 From: John Safranek Date: Tue, 6 Nov 2012 14:30:52 -0800 Subject: [PATCH 2/2] added the rabbit and null cipher test configs to the dist build --- tests/include.am | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/include.am b/tests/include.am index 94e000f82..59e1bb83b 100644 --- a/tests/include.am +++ b/tests/include.am @@ -26,4 +26,6 @@ EXTRA_DIST += tests/test.conf \ tests/test-aesgcm-ecc.conf \ tests/test-aesgcm-openssl.conf \ tests/test-dtls.conf \ + tests/test-rabbit.conf \ + tests/test-null.conf \ tests/test-psk-null.conf