diff --git a/.gitignore b/.gitignore index e97abd057..adf7926eb 100644 --- a/.gitignore +++ b/.gitignore @@ -100,3 +100,20 @@ IDE\MDK-ARM\LPC43xx\LPC43xx/ *.gcno *.gcda *.gcov + +# MPLAB Generated Files (OS X) +mcapi/ctaocrypt_mcapi.X/nbproject/Makefile-* +mcapi/ctaocrypt_mcapi.X/nbproject/Package-default.bash +mcapi/ctaocrypt_test.X/nbproject/Makefile-* +mcapi/ctaocrypt_test.X/nbproject/Package-default.bash +mcapi/cyassl.X/nbproject/Makefile-* +mcapi/cyassl.X/nbproject/Package-default.bash +mcapi/zlib.X/nbproject/Makefile-* +mcapi/zlib.X/nbproject/Package-default.bash +mplabx/ctaocrypt_benchmark.X/nbproject/Makefile-* +mplabx/ctaocrypt_benchmark.X/nbproject/Package-default.bash +mplabx/ctaocrypt_test.X/nbproject/Makefile-* +mplabx/ctaocrypt_test.X/nbproject/Package-default.bash +mplabx/cyassl.X/nbproject/Makefile-* +mplabx/cyassl.X/nbproject/Package-default.bash + diff --git a/IDE/MDK-ARM/MDK-ARM/CyaSSL/ssl-dummy.c b/IDE/MDK-ARM/MDK-ARM/CyaSSL/ssl-dummy.c index 261fa2edc..c712a33ec 100644 --- a/IDE/MDK-ARM/MDK-ARM/CyaSSL/ssl-dummy.c +++ b/IDE/MDK-ARM/MDK-ARM/CyaSSL/ssl-dummy.c @@ -25,7 +25,7 @@ #include #include -#include +#include #include Signer* GetCA(void* vp, byte* hash) diff --git a/ctaocrypt/ctaocrypt.vcproj b/ctaocrypt/ctaocrypt.vcproj index fd6856498..2ae9046d5 100755 --- a/ctaocrypt/ctaocrypt.vcproj +++ b/ctaocrypt/ctaocrypt.vcproj @@ -177,7 +177,7 @@ > -#include +#include #include #ifdef NO_INLINE #include @@ -3493,3 +3493,4 @@ static int AesCaviumCbcDecrypt(Aes* aes, byte* out, const byte* in, #endif /* NO_AES */ + diff --git a/ctaocrypt/src/asn.c b/ctaocrypt/src/asn.c index 43817ce73..ccb5e4864 100644 --- a/ctaocrypt/src/asn.c +++ b/ctaocrypt/src/asn.c @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/ctaocrypt/src/camellia.c b/ctaocrypt/src/camellia.c index ecc2c937f..2315b63b7 100644 --- a/ctaocrypt/src/camellia.c +++ b/ctaocrypt/src/camellia.c @@ -61,7 +61,7 @@ #ifdef HAVE_CAMELLIA #include -#include +#include #include #ifdef NO_INLINE #include diff --git a/ctaocrypt/src/coding.c b/ctaocrypt/src/coding.c index 6ccff9e9f..4aebe20dc 100644 --- a/ctaocrypt/src/coding.c +++ b/ctaocrypt/src/coding.c @@ -28,7 +28,7 @@ #ifndef NO_CODING #include -#include +#include #include diff --git a/ctaocrypt/src/compress.c b/ctaocrypt/src/compress.c index 80b612d1a..0c3834f5d 100644 --- a/ctaocrypt/src/compress.c +++ b/ctaocrypt/src/compress.c @@ -30,7 +30,7 @@ #include -#include +#include #include #ifdef NO_INLINE #include diff --git a/ctaocrypt/src/dh.c b/ctaocrypt/src/dh.c index f1d156fd2..ff23ffd74 100644 --- a/ctaocrypt/src/dh.c +++ b/ctaocrypt/src/dh.c @@ -28,7 +28,7 @@ #ifndef NO_DH #include -#include +#include #ifndef USER_MATH_LIB #include diff --git a/ctaocrypt/src/dsa.c b/ctaocrypt/src/dsa.c index 9bf031a66..4dcba291e 100644 --- a/ctaocrypt/src/dsa.c +++ b/ctaocrypt/src/dsa.c @@ -30,7 +30,7 @@ #include #include #include -#include +#include enum { diff --git a/ctaocrypt/src/ecc.c b/ctaocrypt/src/ecc.c index bf21125f3..3fec64215 100644 --- a/ctaocrypt/src/ecc.c +++ b/ctaocrypt/src/ecc.c @@ -31,7 +31,7 @@ #include #include -#include +#include #ifdef HAVE_ECC_ENCRYPT #include @@ -3658,17 +3658,27 @@ static void ecc_ctx_init(ecEncCtx* ctx, int flags) } +/* allow ecc context reset so user doesn't have to init/free for resue */ +int ecc_ctx_reset(ecEncCtx* ctx, RNG* rng) +{ + if (ctx == NULL || rng == NULL) + return BAD_FUNC_ARG; + + ecc_ctx_init(ctx, ctx->protocol); + return ecc_ctx_set_salt(ctx, ctx->protocol, rng); +} + + /* alloc/init and set defaults, return new Context */ ecEncCtx* ecc_ctx_new(int flags, RNG* rng) { int ret = 0; ecEncCtx* ctx = (ecEncCtx*)XMALLOC(sizeof(ecEncCtx), 0, DYNAMIC_TYPE_ECC); - ecc_ctx_init(ctx, flags); - - if (ctx && flags) - ret = ecc_ctx_set_salt(ctx, flags, rng); + if (ctx) + ctx->protocol = (byte)flags; + ret = ecc_ctx_reset(ctx, rng); if (ret != 0) { ecc_ctx_free(ctx); ctx = NULL; diff --git a/ctaocrypt/src/error.c b/ctaocrypt/src/error.c index 67b49e42d..16cb6beba 100644 --- a/ctaocrypt/src/error.c +++ b/ctaocrypt/src/error.c @@ -25,7 +25,7 @@ #include -#include +#include #ifdef _MSC_VER /* 4996 warning to use MS extensions e.g., strcpy_s instead of XSTRNCPY */ diff --git a/ctaocrypt/src/hc128.c b/ctaocrypt/src/hc128.c index a28453247..b76288236 100644 --- a/ctaocrypt/src/hc128.c +++ b/ctaocrypt/src/hc128.c @@ -28,7 +28,7 @@ #ifdef HAVE_HC128 #include -#include +#include #include #ifdef NO_INLINE #include diff --git a/ctaocrypt/src/hmac.c b/ctaocrypt/src/hmac.c index 43cf18e6d..0c2104ff4 100644 --- a/ctaocrypt/src/hmac.c +++ b/ctaocrypt/src/hmac.c @@ -44,7 +44,7 @@ #endif #include -#include +#include #ifdef HAVE_CAVIUM diff --git a/ctaocrypt/src/logging.c b/ctaocrypt/src/logging.c index 061fe6273..8f450ab0a 100644 --- a/ctaocrypt/src/logging.c +++ b/ctaocrypt/src/logging.c @@ -28,7 +28,7 @@ /* submitted by eof */ #include -#include +#include #ifdef __cplusplus diff --git a/ctaocrypt/src/memory.c b/ctaocrypt/src/memory.c index 5e8f193d9..a0a993921 100644 --- a/ctaocrypt/src/memory.c +++ b/ctaocrypt/src/memory.c @@ -28,7 +28,7 @@ #ifdef USE_CYASSL_MEMORY #include -#include +#include #ifdef CYASSL_MALLOC_CHECK #include diff --git a/ctaocrypt/src/pkcs7.c b/ctaocrypt/src/pkcs7.c index 1f7cc010a..66c64d4f8 100644 --- a/ctaocrypt/src/pkcs7.c +++ b/ctaocrypt/src/pkcs7.c @@ -28,7 +28,7 @@ #ifdef HAVE_PKCS7 #include -#include +#include #include #ifndef min diff --git a/ctaocrypt/src/port.c b/ctaocrypt/src/port.c index ea9b78d4b..87efc5bdc 100644 --- a/ctaocrypt/src/port.c +++ b/ctaocrypt/src/port.c @@ -25,7 +25,7 @@ #include #include -#include +#include #ifdef _MSC_VER @@ -352,7 +352,7 @@ int UnLockMutex(CyaSSL_Mutex *m) return BAD_MUTEX_E; } - #elif defined(CYASSL_MDK_ARM) + #elif defined(CYASSL_MDK_ARM)|| defined(CYASSL_CMSIS_RTOS) #if defined(CYASSL_CMSIS_RTOS) #include "cmsis_os.h" diff --git a/ctaocrypt/src/pwdbased.c b/ctaocrypt/src/pwdbased.c index 3244ea7a7..57c5eddb5 100644 --- a/ctaocrypt/src/pwdbased.c +++ b/ctaocrypt/src/pwdbased.c @@ -46,7 +46,7 @@ #include #include #include -#include +#include #if defined(CYASSL_SHA512) || defined(CYASSL_SHA384) #include #endif diff --git a/ctaocrypt/src/rabbit.c b/ctaocrypt/src/rabbit.c index 947ac201a..061bc05ff 100644 --- a/ctaocrypt/src/rabbit.c +++ b/ctaocrypt/src/rabbit.c @@ -28,7 +28,7 @@ #ifndef NO_RABBIT #include -#include +#include #include #ifdef NO_INLINE #include diff --git a/ctaocrypt/src/random.c b/ctaocrypt/src/random.c index 74cf2d6ce..4406d6713 100644 --- a/ctaocrypt/src/random.c +++ b/ctaocrypt/src/random.c @@ -31,7 +31,7 @@ */ #include -#include +#include #ifdef NO_RC4 #include diff --git a/ctaocrypt/src/rsa.c b/ctaocrypt/src/rsa.c index 22b9094a2..1765018f1 100644 --- a/ctaocrypt/src/rsa.c +++ b/ctaocrypt/src/rsa.c @@ -30,7 +30,7 @@ #include #include -#include +#include #include #ifdef SHOW_GEN diff --git a/cyassl/ctaocrypt/ecc.h b/cyassl/ctaocrypt/ecc.h index 2434a6844..5cd5b2cf3 100644 --- a/cyassl/ctaocrypt/ecc.h +++ b/cyassl/ctaocrypt/ecc.h @@ -157,6 +157,8 @@ CYASSL_API ecEncCtx* ecc_ctx_new(int flags, RNG* rng); CYASSL_API void ecc_ctx_free(ecEncCtx*); +CYASSL_API +int ecc_ctx_reset(ecEncCtx*, RNG*); /* reset for use again w/o alloc/free */ CYASSL_API const byte* ecc_ctx_get_own_salt(ecEncCtx*); diff --git a/cyassl/ctaocrypt/error.h b/cyassl/ctaocrypt/error-crypt.h similarity index 99% rename from cyassl/ctaocrypt/error.h rename to cyassl/ctaocrypt/error-crypt.h index 185b4c864..2bf246e83 100644 --- a/cyassl/ctaocrypt/error.h +++ b/cyassl/ctaocrypt/error-crypt.h @@ -1,4 +1,4 @@ -/* error.h +/* error-crypt.h * * Copyright (C) 2006-2013 wolfSSL Inc. * @@ -136,3 +136,4 @@ CYASSL_API void CTaoCryptErrorString(int err, char* buff); #endif /* CTAO_CRYPT_ERROR_H */ + diff --git a/cyassl/ctaocrypt/include.am b/cyassl/ctaocrypt/include.am index 9206435a4..8165af42c 100644 --- a/cyassl/ctaocrypt/include.am +++ b/cyassl/ctaocrypt/include.am @@ -13,7 +13,7 @@ nobase_include_HEADERS+= \ cyassl/ctaocrypt/dh.h \ cyassl/ctaocrypt/dsa.h \ cyassl/ctaocrypt/ecc.h \ - cyassl/ctaocrypt/error.h \ + cyassl/ctaocrypt/error-crypt.h \ cyassl/ctaocrypt/fips_test.h \ cyassl/ctaocrypt/hc128.h \ cyassl/ctaocrypt/hmac.h \ diff --git a/cyassl/ctaocrypt/port.h b/cyassl/ctaocrypt/port.h index 5741c255e..1f06c20e6 100644 --- a/cyassl/ctaocrypt/port.h +++ b/cyassl/ctaocrypt/port.h @@ -60,6 +60,8 @@ #else #include #endif +#elif defined(CYASSL_CMSIS_RTOS) + #include "cmsis_os.h" #else #ifndef SINGLE_THREADED #define CYASSL_PTHREADS @@ -100,6 +102,8 @@ #else typedef OS_MUT CyaSSL_Mutex; #endif + #elif defined(CYASSL_CMSIS_RTOS) + typedef osMutexId CyaSSL_Mutex; #else #error Need a mutex type in multithreaded mode #endif /* USE_WINDOWS_API */ diff --git a/cyassl/ctaocrypt/settings.h b/cyassl/ctaocrypt/settings.h index 22bec0ecf..5f81c970e 100644 --- a/cyassl/ctaocrypt/settings.h +++ b/cyassl/ctaocrypt/settings.h @@ -167,20 +167,26 @@ #endif #ifdef MBED - #define SINGLE_THREADED #define CYASSL_USER_IO + #define NO_FILESYSTEM + #define NO_CERT + #define USE_CERT_BUFFERS_1024 #define NO_WRITEV #define NO_DEV_RANDOM #define NO_SHA512 #define NO_DH #define NO_DSA #define NO_HC128 -#endif /* MBED */ + #define HAVE_ECC + #define NO_SESSION_CACHE + #define CYASSL_CMSIS_RTOS +#endif #ifdef CYASSL_TYTO #include "rand.h" #define FREERTOS #define NO_FILESYSTEM + #define NO_MAIN_DRIVER #define CYASSL_USER_IO #define NO_DEV_RANDOM #define HAVE_ECC diff --git a/cyassl/error.h b/cyassl/error-ssl.h similarity index 98% rename from cyassl/error.h rename to cyassl/error-ssl.h index e32df7b6e..71f4b4ffd 100644 --- a/cyassl/error.h +++ b/cyassl/error-ssl.h @@ -1,4 +1,4 @@ -/* error.h +/* error-ssl.h * * Copyright (C) 2006-2013 wolfSSL Inc. * @@ -23,7 +23,7 @@ #ifndef CYASSL_ERROR_H #define CYASSL_ERROR_H -#include /* pull in CTaoCrypt errors */ +#include /* pull in CTaoCrypt errors */ #ifdef __cplusplus extern "C" { @@ -143,3 +143,4 @@ void SetErrorString(int err, char* buff); #endif /* CyaSSL_ERROR_H */ + diff --git a/cyassl/include.am b/cyassl/include.am index 9784ab249..db1f089ee 100644 --- a/cyassl/include.am +++ b/cyassl/include.am @@ -8,7 +8,7 @@ include cyassl/openssl/include.am EXTRA_DIST+= cyassl/sniffer_error.rc nobase_include_HEADERS+= \ - cyassl/error.h \ + cyassl/error-ssl.h \ cyassl/ssl.h \ cyassl/sniffer_error.h \ cyassl/sniffer.h \ diff --git a/cyassl/internal.h b/cyassl/internal.h index c4610e0bc..0f4aa7e20 100644 --- a/cyassl/internal.h +++ b/cyassl/internal.h @@ -95,6 +95,8 @@ #else #include #endif +#elif defined(MBED) + #else #ifndef SINGLE_THREADED #define CYASSL_PTHREADS diff --git a/mcapi/README b/mcapi/README index 154294c46..01776dc2a 100644 --- a/mcapi/README +++ b/mcapi/README @@ -55,9 +55,9 @@ Included Project Files This project builds the zlib library for use in the ctaocrypt_test.X and ctaocrypt_mcapi.X projects. This project expects the zlib sources to be located under the CyaSSL root directory. Currently it is set up - to work with zlib 1.2.7, and looks for sources under: + to work with zlib 1.2.8, and looks for sources under: - /zlib-1.2.7 + /zlib-1.2.8 PIC32MX/PIC32MZ --------------- diff --git a/mcapi/crypto.c b/mcapi/crypto.c index a23f00f6d..b29005658 100644 --- a/mcapi/crypto.c +++ b/mcapi/crypto.c @@ -39,7 +39,7 @@ #include #include #include -#include +#include /* Initialize MD5 */ diff --git a/mcapi/crypto.h b/mcapi/crypto.h index cff24bbdc..c47f78dfd 100644 --- a/mcapi/crypto.h +++ b/mcapi/crypto.h @@ -163,7 +163,7 @@ enum { /* AES */ typedef struct CRYPT_AES_CTX { - int holder[69]; /* big enough to hold internal, but check on init */ + int holder[70]; /* big enough to hold internal, but check on init */ } CRYPT_AES_CTX; /* key */ diff --git a/mcapi/zlib.X/nbproject/configurations.xml b/mcapi/zlib.X/nbproject/configurations.xml index cea50b3f1..1078d1e2b 100644 --- a/mcapi/zlib.X/nbproject/configurations.xml +++ b/mcapi/zlib.X/nbproject/configurations.xml @@ -12,21 +12,21 @@ - ../../zlib-1.2.7/adler32.c - ../../zlib-1.2.7/compress.c - ../../zlib-1.2.7/crc32.c - ../../zlib-1.2.7/deflate.c - ../../zlib-1.2.7/gzclose.c - ../../zlib-1.2.7/gzlib.c - ../../zlib-1.2.7/gzread.c - ../../zlib-1.2.7/gzwrite.c - ../../zlib-1.2.7/infback.c - ../../zlib-1.2.7/inffast.c - ../../zlib-1.2.7/inflate.c - ../../zlib-1.2.7/inftrees.c - ../../zlib-1.2.7/trees.c - ../../zlib-1.2.7/uncompr.c - ../../zlib-1.2.7/zutil.c + ../../zlib-1.2.8/adler32.c + ../../zlib-1.2.8/compress.c + ../../zlib-1.2.8/crc32.c + ../../zlib-1.2.8/deflate.c + ../../zlib-1.2.8/gzclose.c + ../../zlib-1.2.8/gzlib.c + ../../zlib-1.2.8/gzread.c + ../../zlib-1.2.8/gzwrite.c + ../../zlib-1.2.8/infback.c + ../../zlib-1.2.8/inffast.c + ../../zlib-1.2.8/inflate.c + ../../zlib-1.2.8/inftrees.c + ../../zlib-1.2.8/trees.c + ../../zlib-1.2.8/uncompr.c + ../../zlib-1.2.8/zutil.c SKDEPIC32PlatformTool XC32 - 1.30 - 3 + 1.10 + 4 @@ -67,7 +67,7 @@ - + @@ -80,7 +80,6 @@ - @@ -114,7 +113,6 @@ - @@ -150,8 +148,6 @@ - - diff --git a/mplabx/benchmark_main.c b/mplabx/benchmark_main.c index 8dc30a7b4..586b13c86 100644 --- a/mplabx/benchmark_main.c +++ b/mplabx/benchmark_main.c @@ -18,7 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#if defined(CYASSL_MICROCHIP_PIC32MZ) #ifdef HAVE_CONFIG_H #include #endif diff --git a/rpm/spec.in b/rpm/spec.in index 4ea152a32..e1ca1c99e 100644 --- a/rpm/spec.in +++ b/rpm/spec.in @@ -92,7 +92,7 @@ mkdir -p $RPM_BUILD_ROOT/ %{_includedir}/cyassl/ctaocrypt/dh.h %{_includedir}/cyassl/ctaocrypt/dsa.h %{_includedir}/cyassl/ctaocrypt/ecc.h -%{_includedir}/cyassl/ctaocrypt/error.h +%{_includedir}/cyassl/ctaocrypt/error-crypt.h %{_includedir}/cyassl/ctaocrypt/hc128.h %{_includedir}/cyassl/ctaocrypt/hmac.h %{_includedir}/cyassl/ctaocrypt/integer.h @@ -118,7 +118,7 @@ mkdir -p $RPM_BUILD_ROOT/ %{_includedir}/cyassl/ctaocrypt/tfm.h %{_includedir}/cyassl/ctaocrypt/types.h %{_includedir}/cyassl/ctaocrypt/visibility.h -%{_includedir}/cyassl/error.h +%{_includedir}/cyassl/error-ssl.h %{_includedir}/cyassl/ocsp.h %{_includedir}/cyassl/openssl/asn1.h %{_includedir}/cyassl/openssl/bio.h diff --git a/src/crl.c b/src/crl.c index 1c75ed81e..9536be18f 100644 --- a/src/crl.c +++ b/src/crl.c @@ -28,7 +28,7 @@ #ifdef HAVE_CRL #include -#include +#include #include #include diff --git a/src/internal.c b/src/internal.c index 1983957d6..e098d15bc 100644 --- a/src/internal.c +++ b/src/internal.c @@ -27,7 +27,7 @@ #include #include -#include +#include #include #ifdef HAVE_LIBZ diff --git a/src/io.c b/src/io.c index ab43b1491..1fccd9e1e 100644 --- a/src/io.c +++ b/src/io.c @@ -31,7 +31,7 @@ #endif #include -#include +#include /* if user writes own I/O callbacks they can define CYASSL_USER_IO to remove automatic setting of default I/O functions EmbedSend() and EmbedReceive() diff --git a/src/keys.c b/src/keys.c index 0d8b47c45..af0ef5b19 100644 --- a/src/keys.c +++ b/src/keys.c @@ -27,7 +27,7 @@ #include #include -#include +#include #ifdef SHOW_SECRETS #ifdef FREESCALE_MQX #include diff --git a/src/ocsp.c b/src/ocsp.c index cb55c4e04..bccb7f8cf 100644 --- a/src/ocsp.c +++ b/src/ocsp.c @@ -27,7 +27,7 @@ #ifdef HAVE_OCSP -#include +#include #include #include diff --git a/src/sniffer.c b/src/sniffer.c index da9f2c607..8333bf7a3 100644 --- a/src/sniffer.c +++ b/src/sniffer.c @@ -44,7 +44,7 @@ #include #include -#include +#include #include #include diff --git a/src/ssl.c b/src/ssl.c index bf10d6c7d..64208686e 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -32,7 +32,7 @@ #include #include -#include +#include #include #if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) diff --git a/src/tls.c b/src/tls.c index 9bc2aaa5f..a4b5c742f 100644 --- a/src/tls.c +++ b/src/tls.c @@ -27,7 +27,7 @@ #include #include -#include +#include #include