Merge branch 'master' of github.com:cyassl/cyassl

This commit is contained in:
toddouska
2014-03-25 16:02:12 -07:00
44 changed files with 109 additions and 70 deletions

17
.gitignore vendored
View File

@@ -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

View File

@@ -25,7 +25,7 @@
#include <cyassl/ssl.h>
#include <cyassl/internal.h>
#include <cyassl/error.h>
#include <cyassl/error-ssl.h>
#include <cyassl/ctaocrypt/coding.h>
Signer* GetCA(void* vp, byte* hash)

View File

@@ -177,7 +177,7 @@
>
</File>
<File
RelativePath=".\include\error.h"
RelativePath=".\include\error-crypt.h"
>
</File>
<File

View File

@@ -33,7 +33,7 @@
#endif
#include <cyassl/ctaocrypt/aes.h>
#include <cyassl/ctaocrypt/error.h>
#include <cyassl/ctaocrypt/error-crypt.h>
#include <cyassl/ctaocrypt/logging.h>
#ifdef NO_INLINE
#include <cyassl/ctaocrypt/misc.h>
@@ -3493,3 +3493,4 @@ static int AesCaviumCbcDecrypt(Aes* aes, byte* out, const byte* in,
#endif /* NO_AES */

View File

@@ -38,7 +38,7 @@
#include <cyassl/ctaocrypt/sha.h>
#include <cyassl/ctaocrypt/md5.h>
#include <cyassl/ctaocrypt/md2.h>
#include <cyassl/ctaocrypt/error.h>
#include <cyassl/ctaocrypt/error-crypt.h>
#include <cyassl/ctaocrypt/pwdbased.h>
#include <cyassl/ctaocrypt/des3.h>
#include <cyassl/ctaocrypt/sha256.h>

View File

@@ -61,7 +61,7 @@
#ifdef HAVE_CAMELLIA
#include <cyassl/ctaocrypt/camellia.h>
#include <cyassl/ctaocrypt/error.h>
#include <cyassl/ctaocrypt/error-crypt.h>
#include <cyassl/ctaocrypt/logging.h>
#ifdef NO_INLINE
#include <cyassl/ctaocrypt/misc.h>

View File

@@ -28,7 +28,7 @@
#ifndef NO_CODING
#include <cyassl/ctaocrypt/coding.h>
#include <cyassl/ctaocrypt/error.h>
#include <cyassl/ctaocrypt/error-crypt.h>
#include <cyassl/ctaocrypt/logging.h>

View File

@@ -30,7 +30,7 @@
#include <cyassl/ctaocrypt/compress.h>
#include <cyassl/ctaocrypt/error.h>
#include <cyassl/ctaocrypt/error-crypt.h>
#include <cyassl/ctaocrypt/logging.h>
#ifdef NO_INLINE
#include <cyassl/ctaocrypt/misc.h>

View File

@@ -28,7 +28,7 @@
#ifndef NO_DH
#include <cyassl/ctaocrypt/dh.h>
#include <cyassl/ctaocrypt/error.h>
#include <cyassl/ctaocrypt/error-crypt.h>
#ifndef USER_MATH_LIB
#include <math.h>

View File

@@ -30,7 +30,7 @@
#include <cyassl/ctaocrypt/dsa.h>
#include <cyassl/ctaocrypt/sha.h>
#include <cyassl/ctaocrypt/random.h>
#include <cyassl/ctaocrypt/error.h>
#include <cyassl/ctaocrypt/error-crypt.h>
enum {

View File

@@ -31,7 +31,7 @@
#include <cyassl/ctaocrypt/ecc.h>
#include <cyassl/ctaocrypt/asn.h>
#include <cyassl/ctaocrypt/error.h>
#include <cyassl/ctaocrypt/error-crypt.h>
#ifdef HAVE_ECC_ENCRYPT
#include <cyassl/ctaocrypt/hmac.h>
@@ -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;

View File

@@ -25,7 +25,7 @@
#include <cyassl/ctaocrypt/settings.h>
#include <cyassl/ctaocrypt/error.h>
#include <cyassl/ctaocrypt/error-crypt.h>
#ifdef _MSC_VER
/* 4996 warning to use MS extensions e.g., strcpy_s instead of XSTRNCPY */

View File

@@ -28,7 +28,7 @@
#ifdef HAVE_HC128
#include <cyassl/ctaocrypt/hc128.h>
#include <cyassl/ctaocrypt/error.h>
#include <cyassl/ctaocrypt/error-crypt.h>
#include <cyassl/ctaocrypt/logging.h>
#ifdef NO_INLINE
#include <cyassl/ctaocrypt/hc128.h>

View File

@@ -44,7 +44,7 @@
#endif
#include <cyassl/ctaocrypt/hmac.h>
#include <cyassl/ctaocrypt/error.h>
#include <cyassl/ctaocrypt/error-crypt.h>
#ifdef HAVE_CAVIUM

View File

@@ -28,7 +28,7 @@
/* submitted by eof */
#include <cyassl/ctaocrypt/logging.h>
#include <cyassl/ctaocrypt/error.h>
#include <cyassl/ctaocrypt/error-crypt.h>
#ifdef __cplusplus

View File

@@ -28,7 +28,7 @@
#ifdef USE_CYASSL_MEMORY
#include <cyassl/ctaocrypt/memory.h>
#include <cyassl/ctaocrypt/error.h>
#include <cyassl/ctaocrypt/error-crypt.h>
#ifdef CYASSL_MALLOC_CHECK
#include <stdio.h>

View File

@@ -28,7 +28,7 @@
#ifdef HAVE_PKCS7
#include <cyassl/ctaocrypt/pkcs7.h>
#include <cyassl/ctaocrypt/error.h>
#include <cyassl/ctaocrypt/error-crypt.h>
#include <cyassl/ctaocrypt/logging.h>
#ifndef min

View File

@@ -25,7 +25,7 @@
#include <cyassl/ctaocrypt/settings.h>
#include <cyassl/ctaocrypt/types.h>
#include <cyassl/ctaocrypt/error.h>
#include <cyassl/ctaocrypt/error-crypt.h>
#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"

View File

@@ -46,7 +46,7 @@
#include <cyassl/ctaocrypt/pwdbased.h>
#include <cyassl/ctaocrypt/hmac.h>
#include <cyassl/ctaocrypt/integer.h>
#include <cyassl/ctaocrypt/error.h>
#include <cyassl/ctaocrypt/error-crypt.h>
#if defined(CYASSL_SHA512) || defined(CYASSL_SHA384)
#include <cyassl/ctaocrypt/sha512.h>
#endif

View File

@@ -28,7 +28,7 @@
#ifndef NO_RABBIT
#include <cyassl/ctaocrypt/rabbit.h>
#include <cyassl/ctaocrypt/error.h>
#include <cyassl/ctaocrypt/error-crypt.h>
#include <cyassl/ctaocrypt/logging.h>
#ifdef NO_INLINE
#include <cyassl/ctaocrypt/misc.h>

View File

@@ -31,7 +31,7 @@
*/
#include <cyassl/ctaocrypt/random.h>
#include <cyassl/ctaocrypt/error.h>
#include <cyassl/ctaocrypt/error-crypt.h>
#ifdef NO_RC4
#include <cyassl/ctaocrypt/sha256.h>

View File

@@ -30,7 +30,7 @@
#include <cyassl/ctaocrypt/rsa.h>
#include <cyassl/ctaocrypt/random.h>
#include <cyassl/ctaocrypt/error.h>
#include <cyassl/ctaocrypt/error-crypt.h>
#include <cyassl/ctaocrypt/logging.h>
#ifdef SHOW_GEN

View File

@@ -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*);

View File

@@ -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 */

View File

@@ -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 \

View File

@@ -60,6 +60,8 @@
#else
#include <rtl.h>
#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 */

View File

@@ -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

View File

@@ -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 <cyassl/ctaocrypt/error.h> /* pull in CTaoCrypt errors */
#include <cyassl/ctaocrypt/error-crypt.h> /* pull in CTaoCrypt errors */
#ifdef __cplusplus
extern "C" {
@@ -143,3 +143,4 @@ void SetErrorString(int err, char* buff);
#endif /* CyaSSL_ERROR_H */

View File

@@ -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 \

View File

@@ -95,6 +95,8 @@
#else
#include <rtl.h>
#endif
#elif defined(MBED)
#else
#ifndef SINGLE_THREADED
#define CYASSL_PTHREADS

View File

@@ -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:
<cyassl_root>/zlib-1.2.7
<cyassl_root>/zlib-1.2.8
PIC32MX/PIC32MZ
---------------

View File

@@ -39,7 +39,7 @@
#include <cyassl/ctaocrypt/aes.h>
#include <cyassl/ctaocrypt/rsa.h>
#include <cyassl/ctaocrypt/ecc.h>
#include <cyassl/ctaocrypt/error.h>
#include <cyassl/ctaocrypt/error-crypt.h>
/* Initialize MD5 */

View File

@@ -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 */

View File

@@ -12,21 +12,21 @@
<logicalFolder name="SourceFiles"
displayName="Source Files"
projectFiles="true">
<itemPath>../../zlib-1.2.7/adler32.c</itemPath>
<itemPath>../../zlib-1.2.7/compress.c</itemPath>
<itemPath>../../zlib-1.2.7/crc32.c</itemPath>
<itemPath>../../zlib-1.2.7/deflate.c</itemPath>
<itemPath>../../zlib-1.2.7/gzclose.c</itemPath>
<itemPath>../../zlib-1.2.7/gzlib.c</itemPath>
<itemPath>../../zlib-1.2.7/gzread.c</itemPath>
<itemPath>../../zlib-1.2.7/gzwrite.c</itemPath>
<itemPath>../../zlib-1.2.7/infback.c</itemPath>
<itemPath>../../zlib-1.2.7/inffast.c</itemPath>
<itemPath>../../zlib-1.2.7/inflate.c</itemPath>
<itemPath>../../zlib-1.2.7/inftrees.c</itemPath>
<itemPath>../../zlib-1.2.7/trees.c</itemPath>
<itemPath>../../zlib-1.2.7/uncompr.c</itemPath>
<itemPath>../../zlib-1.2.7/zutil.c</itemPath>
<itemPath>../../zlib-1.2.8/adler32.c</itemPath>
<itemPath>../../zlib-1.2.8/compress.c</itemPath>
<itemPath>../../zlib-1.2.8/crc32.c</itemPath>
<itemPath>../../zlib-1.2.8/deflate.c</itemPath>
<itemPath>../../zlib-1.2.8/gzclose.c</itemPath>
<itemPath>../../zlib-1.2.8/gzlib.c</itemPath>
<itemPath>../../zlib-1.2.8/gzread.c</itemPath>
<itemPath>../../zlib-1.2.8/gzwrite.c</itemPath>
<itemPath>../../zlib-1.2.8/infback.c</itemPath>
<itemPath>../../zlib-1.2.8/inffast.c</itemPath>
<itemPath>../../zlib-1.2.8/inflate.c</itemPath>
<itemPath>../../zlib-1.2.8/inftrees.c</itemPath>
<itemPath>../../zlib-1.2.8/trees.c</itemPath>
<itemPath>../../zlib-1.2.8/uncompr.c</itemPath>
<itemPath>../../zlib-1.2.8/zutil.c</itemPath>
</logicalFolder>
<logicalFolder name="ExternalFiles"
displayName="Important Files"
@@ -44,8 +44,8 @@
<targetPluginBoard></targetPluginBoard>
<platformTool>SKDEPIC32PlatformTool</platformTool>
<languageToolchain>XC32</languageToolchain>
<languageToolchainVersion>1.30</languageToolchainVersion>
<platform>3</platform>
<languageToolchainVersion>1.10</languageToolchainVersion>
<platform>4</platform>
</toolsSet>
<compileType>
<archiverTool>
@@ -67,7 +67,7 @@
<property key="enable-symbols" value="true"/>
<property key="enable-unroll-loops" value="false"/>
<property key="exclude-floating-point" value="false"/>
<property key="extra-include-directories" value="../../zlib-1.2.7"/>
<property key="extra-include-directories" value="../../zlib-1.2.8"/>
<property key="generate-16-bit-code" value="false"/>
<property key="isolate-each-function" value="false"/>
<property key="make-warnings-into-errors" value="false"/>
@@ -80,7 +80,6 @@
<property key="strict-ansi" value="false"/>
<property key="support-ansi" value="false"/>
<property key="use-cci" value="false"/>
<property key="use-iar" value="false"/>
<property key="use-indirect-calls" value="false"/>
</C32>
<C32-AS>
@@ -114,7 +113,6 @@
<property key="linker-symbols" value=""/>
<property key="map-file" value=""/>
<property key="no-startup-files" value="false"/>
<property key="oXC32ld-extra-opts" value=""/>
<property key="optimization-level" value=""/>
<property key="preprocessor-macros" value=""/>
<property key="remove-unused-sections" value="false"/>
@@ -150,8 +148,6 @@
</C32CPP>
<C32Global>
<property key="legacy-libc" value="false"/>
<property key="save-temps" value="false"/>
<property key="wpo-lto" value="false"/>
</C32Global>
<SKDEPIC32PlatformTool>
<property key="whatToProgram" value="all"/>

View File

@@ -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 <config.h>
#endif

View File

@@ -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

View File

@@ -28,7 +28,7 @@
#ifdef HAVE_CRL
#include <cyassl/internal.h>
#include <cyassl/error.h>
#include <cyassl/error-ssl.h>
#include <dirent.h>
#include <sys/stat.h>

View File

@@ -27,7 +27,7 @@
#include <cyassl/ctaocrypt/settings.h>
#include <cyassl/internal.h>
#include <cyassl/error.h>
#include <cyassl/error-ssl.h>
#include <cyassl/ctaocrypt/asn.h>
#ifdef HAVE_LIBZ

View File

@@ -31,7 +31,7 @@
#endif
#include <cyassl/internal.h>
#include <cyassl/error.h>
#include <cyassl/error-ssl.h>
/* 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()

View File

@@ -27,7 +27,7 @@
#include <cyassl/ctaocrypt/settings.h>
#include <cyassl/internal.h>
#include <cyassl/error.h>
#include <cyassl/error-ssl.h>
#ifdef SHOW_SECRETS
#ifdef FREESCALE_MQX
#include <fio.h>

View File

@@ -27,7 +27,7 @@
#ifdef HAVE_OCSP
#include <cyassl/error.h>
#include <cyassl/error-ssl.h>
#include <cyassl/ocsp.h>
#include <cyassl/internal.h>

View File

@@ -44,7 +44,7 @@
#include <cyassl/openssl/ssl.h>
#include <cyassl/internal.h>
#include <cyassl/error.h>
#include <cyassl/error-ssl.h>
#include <cyassl/sniffer.h>
#include <cyassl/sniffer_error.h>

View File

@@ -32,7 +32,7 @@
#include <cyassl/ssl.h>
#include <cyassl/internal.h>
#include <cyassl/error.h>
#include <cyassl/error-ssl.h>
#include <cyassl/ctaocrypt/coding.h>
#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER)

View File

@@ -27,7 +27,7 @@
#include <cyassl/ssl.h>
#include <cyassl/internal.h>
#include <cyassl/error.h>
#include <cyassl/error-ssl.h>
#include <cyassl/ctaocrypt/hmac.h>