From d958a2f3d6b0278ed649113e2723e5d08fdba188 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Thu, 18 Dec 2014 15:40:09 -0700 Subject: [PATCH] close to build test with --disable-examples option --- configure.ac | 2 +- cyassl/ctaocrypt/ripemd.h | 35 +--------------- cyassl/ssl.h | 5 ++- examples/client/client.c | 1 + examples/echoserver/echoserver.c | 1 + examples/server/server.c | 1 + src/include.am | 4 ++ wolfcrypt/src/des3.c | 15 +------ wolfcrypt/src/md5.c | 2 +- wolfssl/test.h | 1 + wolfssl/wolfcrypt/md5.h | 70 ++++++++++++++++---------------- wolfssl/wolfcrypt/types.h | 6 +-- wolfssl/wolfcrypt/wc_port.h | 2 +- 13 files changed, 56 insertions(+), 89 deletions(-) diff --git a/configure.ac b/configure.ac index 4a1d6f442..192b26adb 100644 --- a/configure.ac +++ b/configure.ac @@ -472,7 +472,7 @@ AC_ARG_ENABLE([ripemd], if test "$ENABLED_RIPEMD" = "yes" then - AM_CFLAGS="$AM_CFLAGS -DCYASSL_RIPEMD" + AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RIPEMD" fi AM_CONDITIONAL([BUILD_RIPEMD], [test "x$ENABLED_RIPEMD" = "xyes"]) diff --git a/cyassl/ctaocrypt/ripemd.h b/cyassl/ctaocrypt/ripemd.h index de062698c..9df135c17 100644 --- a/cyassl/ctaocrypt/ripemd.h +++ b/cyassl/ctaocrypt/ripemd.h @@ -25,40 +25,7 @@ #ifndef CTAO_CRYPT_RIPEMD_H #define CTAO_CRYPT_RIPEME_H -#include - -#ifdef __cplusplus - extern "C" { -#endif - - -/* in bytes */ -enum { - RIPEMD = 3, /* hash type unique */ - RIPEMD_BLOCK_SIZE = 64, - RIPEMD_DIGEST_SIZE = 20, - RIPEMD_PAD_SIZE = 56 -}; - - -/* RipeMd 160 digest */ -typedef struct RipeMd { - word32 buffLen; /* in bytes */ - word32 loLen; /* length in bytes */ - word32 hiLen; /* length in bytes */ - word32 digest[RIPEMD_DIGEST_SIZE / sizeof(word32)]; - word32 buffer[RIPEMD_BLOCK_SIZE / sizeof(word32)]; -} RipeMd; - - -CYASSL_API void InitRipeMd(RipeMd*); -CYASSL_API void RipeMdUpdate(RipeMd*, const byte*, word32); -CYASSL_API void RipeMdFinal(RipeMd*, byte*); - - -#ifdef __cplusplus - } /* extern "C" */ -#endif +#include #endif /* CTAO_CRYPT_RIPEMD_H */ #endif /* CYASSL_RIPEMD */ diff --git a/cyassl/ssl.h b/cyassl/ssl.h index 044a1aed8..3eb128441 100644 --- a/cyassl/ssl.h +++ b/cyassl/ssl.h @@ -81,6 +81,9 @@ #define CYASSL_X509_OBJECT WOLFSSL_X509_OBJECT #define CYASSL_X509_STORE_CTX WOLFSSL_X509_STORE_CTX +/* cyassl/test.h */ +#define CYASSL_THREAD WOLFSSL_THREAD + /* src/ssl.c */ #define CYASSL_CLIENT_END WOLFSSL_CLIENT_END #define CYASSL_CERT_MANAGER WOLFSSL_CERT_MANAGER @@ -453,8 +456,8 @@ /* for ripemd reverse compatibility */ -#define CYASSL_RIPEMD WOLFSSL_RIPEMD /* @TODO */ #ifdef WOLFSSL_RIPEMD + #define CYASSL_RIPEMD /* @TODO */ #define InitRipeMd wc_InitRipeMd #define RipeMdUpdate wc_RipeMdUpdate #define RipeMdFinal wc_RipeMdFinal diff --git a/examples/client/client.c b/examples/client/client.c index 7705b138b..895fea870 100644 --- a/examples/client/client.c +++ b/examples/client/client.c @@ -23,6 +23,7 @@ #include #endif +#include /* name change portability layer */ #if defined(CYASSL_MDK_ARM) #include #include diff --git a/examples/echoserver/echoserver.c b/examples/echoserver/echoserver.c index e942233e3..17f1bd2c4 100644 --- a/examples/echoserver/echoserver.c +++ b/examples/echoserver/echoserver.c @@ -23,6 +23,7 @@ #include #endif +#include /* name change portability layer */ #include #ifdef HAVE_ECC #include /* ecc_fp_free */ diff --git a/examples/server/server.c b/examples/server/server.c index 2c7c4134d..d03606e26 100644 --- a/examples/server/server.c +++ b/examples/server/server.c @@ -22,6 +22,7 @@ #ifdef HAVE_CONFIG_H #include #endif +#include /* name change portability layer */ #include #ifdef HAVE_ECC diff --git a/src/include.am b/src/include.am index bc5678fc8..21550588c 100644 --- a/src/include.am +++ b/src/include.am @@ -31,6 +31,7 @@ endif if BUILD_DES3 src_libcyassl_la_SOURCES += ctaocrypt/src/des3.c +src_libcyassl_la_SOURCES += wolfcrypt/src/des3.c endif if BUILD_SHA @@ -58,6 +59,7 @@ src_libcyassl_la_SOURCES += \ if BUILD_MEMORY src_libcyassl_la_SOURCES += ctaocrypt/src/memory.c +src_libcyassl_la_SOURCES += wolfcrypt/src/memory.c endif if BUILD_DH @@ -82,10 +84,12 @@ endif if BUILD_MD4 src_libcyassl_la_SOURCES += ctaocrypt/src/md4.c +src_libcyassl_la_SOURCES += wolfcrypt/src/md4.c endif if BUILD_MD5 src_libcyassl_la_SOURCES += ctaocrypt/src/md5.c +src_libcyassl_la_SOURCES += wolfcrypt/src/md5.c endif if BUILD_PWDBASED diff --git a/wolfcrypt/src/des3.c b/wolfcrypt/src/des3.c index fa21fd8cd..aa211c406 100644 --- a/wolfcrypt/src/des3.c +++ b/wolfcrypt/src/des3.c @@ -32,7 +32,7 @@ #define FIPS_NO_WRAPPERS #endif -#include +#include #include #include @@ -71,19 +71,6 @@ int wc_Des_CbcEncrypt(Des* des, byte* out, const byte* in, word32 sz) } -void wc_DesCrypt(word32 *key, word32 *iv, byte* out, const byte* in, word32 sz, - int dir, int algo, int cryptoalgo) -{ - DesCrypt(key, iv, out, in, sz, dir, algo, cryptoalgo); -} - - -int wc_Des_CbcEncrypt(Des* des, byte* out, const byte* in, word32 sz) -{ - return Des_CbcEncrypt(des, out, in, sz); -} - - int wc_Des_CbcDecrypt(Des* des, byte* out, const byte* in, word32 sz) { return Des_CbcDecrypt(des, out, in, sz); diff --git a/wolfcrypt/src/md5.c b/wolfcrypt/src/md5.c index 9aa5077b7..c59840d7d 100644 --- a/wolfcrypt/src/md5.c +++ b/wolfcrypt/src/md5.c @@ -34,7 +34,7 @@ #define wc_Md5Final Md5Final_sw #endif -#include +#include #include #ifdef NO_INLINE diff --git a/wolfssl/test.h b/wolfssl/test.h index 3b323ae3b..6e4e6afac 100644 --- a/wolfssl/test.h +++ b/wolfssl/test.h @@ -7,6 +7,7 @@ #include #include #include +#include /* portability layer */ #include #include #include diff --git a/wolfssl/wolfcrypt/md5.h b/wolfssl/wolfcrypt/md5.h index f62ede96c..e09187769 100644 --- a/wolfssl/wolfcrypt/md5.h +++ b/wolfssl/wolfcrypt/md5.h @@ -21,49 +21,51 @@ #ifndef NO_MD5 -#ifndef CTAO_CRYPT_MD5_H -#define CTAO_CRYPT_MD5_H +#ifndef WOLF_CRYPT_MD5_H +#define WOLF_CRYPT_MD5_H #include +#include + #ifdef __cplusplus extern "C" { #endif -/* in bytes */ -enum { -#ifdef STM32F2_HASH - MD5_REG_SIZE = 4, /* STM32 register size, bytes */ -#endif - MD5 = 0, /* hash type unique */ - MD5_BLOCK_SIZE = 64, - MD5_DIGEST_SIZE = 16, - MD5_PAD_SIZE = 56 -}; +///* in bytes */ +//enum { +//#ifdef STM32F2_HASH +// MD5_REG_SIZE = 4, /* STM32 register size, bytes */ +//#endif +// MD5 = 0, /* hash type unique */ +// MD5_BLOCK_SIZE = 64, +// MD5_DIGEST_SIZE = 16, +// MD5_PAD_SIZE = 56 +//}; +// +//#ifdef CYASSL_PIC32MZ_HASH +//#include "port/pic32/pic32mz-crypt.h" +//#endif +// +///* MD5 digest */ +//typedef struct Md5 { +// word32 buffLen; /* in bytes */ +// word32 loLen; /* length in bytes */ +// word32 hiLen; /* length in bytes */ +// word32 buffer[MD5_BLOCK_SIZE / sizeof(word32)]; +// #ifndef CYASSL_PIC32MZ_HASH +// word32 digest[MD5_DIGEST_SIZE / sizeof(word32)]; +// #else +// word32 digest[PIC32_HASH_SIZE / sizeof(word32)]; +// pic32mz_desc desc ; /* Crypt Engine descripter */ +// #endif +//} Md5; -#ifdef CYASSL_PIC32MZ_HASH -#include "port/pic32/pic32mz-crypt.h" -#endif - -/* MD5 digest */ -typedef struct Md5 { - word32 buffLen; /* in bytes */ - word32 loLen; /* length in bytes */ - word32 hiLen; /* length in bytes */ - word32 buffer[MD5_BLOCK_SIZE / sizeof(word32)]; - #ifndef CYASSL_PIC32MZ_HASH - word32 digest[MD5_DIGEST_SIZE / sizeof(word32)]; - #else - word32 digest[PIC32_HASH_SIZE / sizeof(word32)]; - pic32mz_desc desc ; /* Crypt Engine descripter */ - #endif -} Md5; - -CYASSL_API void InitMd5(Md5*); -CYASSL_API void Md5Update(Md5*, const byte*, word32); -CYASSL_API void Md5Final(Md5*, byte*); -CYASSL_API int Md5Hash(const byte*, word32, byte*); +WOLFSSL_API void wc_InitMd5(Md5*); +WOLFSSL_API void wc_Md5Update(Md5*, const byte*, word32); +WOLFSSL_API void wc_Md5Final(Md5*, byte*); +WOLFSSL_API int wc_Md5Hash(const byte*, word32, byte*); #ifdef __cplusplus diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index 5d40673d4..ae2adbb8e 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -24,8 +24,8 @@ // #if !defined(WOLF_CRYPT_TYPES_H) && !defined(CTAO_CRYPT_TYPES_H) // #define WOLF_CRYPT_TYPES_H -// #include -// #include + #include + #include // #ifdef __cplusplus // extern "C" { @@ -325,4 +325,4 @@ // #endif -// #endif /* WOLF_CRYPT_TYPES_H */ \ No newline at end of file +// #endif /* WOLF_CRYPT_TYPES_H */ diff --git a/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfcrypt/wc_port.h index 69a503a87..e64a161a2 100644 --- a/wolfssl/wolfcrypt/wc_port.h +++ b/wolfssl/wolfcrypt/wc_port.h @@ -20,7 +20,7 @@ */ -#if !defined(WOLF_CRYPT_PORT_H && CTAO_CRYPT_PORT_H) +#if !defined(WOLF_CRYPT_PORT_H) //&& CTAO_CRYPT_PORT_H) #define WOLF_CRYPT_PORT_H