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

This commit is contained in:
toddouska 2014-02-13 08:54:56 -08:00
commit 02858ab40b
10 changed files with 131 additions and 29 deletions

View File

@ -1427,7 +1427,6 @@ AC_ARG_ENABLE([examples],
[ ENABLED_EXAMPLES=yes ]
)
AS_IF([test "x$ENABLED_SINGLETHREADED" = "xyes"], [ENABLED_EXAMPLES="no"])
AS_IF([test "x$ENABLED_FILESYSTEM" = "xno"], [ENABLED_EXAMPLES="no"])
AS_IF([test "x$ENABLED_INLINE" = "xno"], [ENABLED_EXAMPLES="no"])
# certs still have sha signatures for now

View File

@ -629,6 +629,18 @@ int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
return 0;
}
#elif defined(CYASSL_TYTO)
int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
{
int i;
for (i = 0; i < sz; i++ )
output[i] = rand_gen();
return 0;
}
#elif defined(NO_DEV_RANDOM)
#error "you need to write an os specific GenerateSeed() here"

View File

@ -121,7 +121,9 @@
#define printf dc_log_printf
#endif
#include "ctaocrypt/test/test.h"
#ifndef CYASSL_TYTO
#include "ctaocrypt/test/test.h"
#endif
typedef struct testVector {

View File

@ -157,13 +157,21 @@
#define NO_FILESYSTEM
#define CYASSL_USER_IO
#define NO_DEV_RANDOM
#define HAVE_HKDF
/* ECC and optimizations */
#define HAVE_ECC
#define HAVE_ECC_ENCRYPT
#define ECC_SHAMIR
#define HAVE_HKDF
#define USE_FAST_MATH
#define TFM_TIMING_RESISTANT
#define TFM_ECC256
#define ECC_SHAMIR
#define FP_ECC
#define FP_ENTRIES 2
#define FP_LUT 4
#define FP_MAX_BITS 512
/* remove features */
#define NO_OLD_TLS
#define NO_MD4
#define NO_RABBIT

View File

@ -211,7 +211,9 @@ enum {
#endif
#ifndef CTYPE_USER
#include <ctype.h>
#ifndef CYASSL_TYTO
#include <ctype.h>
#endif
#if defined(HAVE_ECC) || defined(HAVE_OCSP)
#define XTOUPPER(c) toupper((c))
#define XISALPHA(c) isalpha((c))

View File

@ -52,8 +52,8 @@ AC_DEFUN([AX_DEBUG],
[Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])],
[ax_enable_debug=yes
AC_DEFINE([DEBUG],[1],[Define to 1 to enable debugging code.])
AX_ADD_AM_MACRO([--debug],[AM_YFLAGS])
AX_ADD_AM_MACRO([-D_GLIBCXX_DEBUG],[AM_CPPFLAGS])],
AX_ADD_AM_MACRO([AM_YFLAGS += --debug])
AX_ADD_AM_MACRO([AM_CPPFLAGS += -D_GLIBCXX_DEBUG])],
[ax_enable_debug=no
AC_SUBST([MCHECK])
AC_DEFINE([DEBUG],[0],[Define to 1 to enable debugging code.])])

View File

@ -4,7 +4,15 @@ Version: @VERSION@
Release: 1
License: GPLv2
Group: System Environment/Libraries
BuildRequires: bison
BuildRequires: gcc
BuildRequires: glibc
BuildRequires: glibc-common
BuildRequires: glibc-devel
BuildRequires: glibc-headers
BuildRequires: make
BuildRequires: pkgconfig
BuildRequires: sed
BuildRequires: tar
URL: http://www.yassl.com/yaSSL/Home.html
Packager: Brian Aker <brian@tangent.org>
@ -61,7 +69,7 @@ mkdir -p $RPM_BUILD_ROOT/
%{_libdir}/libcyassl.la
%{_libdir}/libcyassl.so
%{_libdir}/libcyassl.so.5
%{_libdir}/libcyassl.so.5.0.2
%{_libdir}/libcyassl.so.5.0.3
%files devel
%defattr(-,root,root,-)
@ -96,6 +104,8 @@ mkdir -p $RPM_BUILD_ROOT/
%{_includedir}/cyassl/ctaocrypt/misc.h
%{_includedir}/cyassl/ctaocrypt/mpi_class.h
%{_includedir}/cyassl/ctaocrypt/mpi_superclass.h
%{_includedir}/cyassl/ctaocrypt/pkcs7.h
%{_includedir}/cyassl/ctaocrypt/port.h
%{_includedir}/cyassl/ctaocrypt/pwdbased.h
%{_includedir}/cyassl/ctaocrypt/rabbit.h
%{_includedir}/cyassl/ctaocrypt/random.h
@ -109,7 +119,6 @@ mkdir -p $RPM_BUILD_ROOT/
%{_includedir}/cyassl/ctaocrypt/types.h
%{_includedir}/cyassl/ctaocrypt/visibility.h
%{_includedir}/cyassl/error.h
%{_includedir}/cyassl/internal.h
%{_includedir}/cyassl/ocsp.h
%{_includedir}/cyassl/openssl/asn1.h
%{_includedir}/cyassl/openssl/bio.h
@ -152,5 +161,5 @@ mkdir -p $RPM_BUILD_ROOT/
%{_libdir}/pkgconfig/cyassl.pc
%changelog
* Fri Oct 20 2012 Brian Aker <brian@tangent.org> - 0.1-1
* Fri Oct 20 2012 Brian Aker <brian@tangent.org>
- Initial package

View File

@ -44,7 +44,9 @@ static int test_CyaSSL_CTX_load_verify_locations(void);
#ifndef NO_RSA
static int test_server_CyaSSL_new(void);
static int test_client_CyaSSL_new(void);
#ifndef SINGLE_THREADED
static int test_CyaSSL_read_write(void);
#endif /* SINGLE_THREADED */
#endif /* NO_RSA */
#endif /* NO_FILESYSTEM */
#ifdef HAVE_SNI
@ -107,7 +109,9 @@ int ApiTest(void)
#ifndef NO_RSA
test_server_CyaSSL_new();
test_client_CyaSSL_new();
#ifndef SINGLE_THREADED
test_CyaSSL_read_write();
#endif /* SINGLE_THREADED */
#endif /* NO_RSA */
#endif /* NO_FILESYSTEM */
#ifdef HAVE_SNI
@ -892,6 +896,8 @@ int test_client_CyaSSL_new(void)
}
#ifndef SINGLE_THREADED
static int test_CyaSSL_read_write(void)
{
/* The unit testing for read and write shall happen simutaneously, since
@ -1278,4 +1284,6 @@ void test_CyaSSL_client_server(callback_functions* client_callbacks,
FreeTcpReady(&ready);
}
#endif /* SINGLE_THREADED*/
#endif /* NO_FILESYSTEM */

View File

@ -42,10 +42,12 @@ int main(int argc, char** argv)
return ret;
}
#ifndef SINGLE_THREADED
if ( (ret = SuiteTest()) != 0){
printf("suite test failed with %d\n", ret);
return ret;
}
#endif
#ifdef HAVE_CAVIUM
CspShutdown(CAVIUM_DEV_ID);
@ -55,9 +57,12 @@ int main(int argc, char** argv)
}
void wait_tcp_ready(func_args* args)
{
#if defined(_POSIX_THREADS) && !defined(__MINGW32__)
#ifdef SINGLE_THREADED
(void)args;
#elif defined(_POSIX_THREADS) && !defined(__MINGW32__)
pthread_mutex_lock(&args->signal->mutex);
if (!args->signal->ready)
@ -73,7 +78,11 @@ void wait_tcp_ready(func_args* args)
void start_thread(THREAD_FUNC fun, func_args* args, THREAD_TYPE* thread)
{
#if defined(_POSIX_THREADS) && !defined(__MINGW32__)
#ifdef SINGLE_THREADED
(void)fun;
(void)args;
(void)thread;
#elif defined(_POSIX_THREADS) && !defined(__MINGW32__)
pthread_create(thread, 0, fun, args);
return;
#else
@ -84,7 +93,9 @@ void start_thread(THREAD_FUNC fun, func_args* args, THREAD_TYPE* thread)
void join_thread(THREAD_TYPE thread)
{
#if defined(_POSIX_THREADS) && !defined(__MINGW32__)
#ifdef SINGLE_THREADED
(void)thread;
#elif defined(_POSIX_THREADS) && !defined(__MINGW32__)
pthread_join(thread, 0);
#else
int res = WaitForSingleObject((HANDLE)thread, INFINITE);
@ -99,7 +110,8 @@ void InitTcpReady(tcp_ready* ready)
{
ready->ready = 0;
ready->port = 0;
#if defined(_POSIX_THREADS) && !defined(__MINGW32__)
#ifdef SINGLE_THREADED
#elif defined(_POSIX_THREADS) && !defined(__MINGW32__)
pthread_mutex_init(&ready->mutex, 0);
pthread_cond_init(&ready->cond, 0);
#endif
@ -108,10 +120,13 @@ void InitTcpReady(tcp_ready* ready)
void FreeTcpReady(tcp_ready* ready)
{
#if defined(_POSIX_THREADS) && !defined(__MINGW32__)
#ifdef SINGLE_THREADED
(void)ready;
#elif defined(_POSIX_THREADS) && !defined(__MINGW32__)
pthread_mutex_destroy(&ready->mutex);
pthread_cond_destroy(&ready->cond);
#else
(void)ready;
#endif
}

View File

@ -25,22 +25,18 @@
#include <cyassl/ctaocrypt/settings.h>
#include <cyassl/openssl/ssl.h>
#include <cyassl/test.h>
#include <cyassl/ctaocrypt/sha256.h>
#include "ctaocrypt/test/test.h"
#ifdef SINGLE_THREADED
#error testsuite needs threads to run, please run ctaocrypt/test, \
and the examples/ individually
#endif
#ifndef SINGLE_THREADED
#include <cyassl/openssl/ssl.h>
#include <cyassl/ctaocrypt/sha256.h>
#include "examples/echoclient/echoclient.h"
#include "examples/echoserver/echoserver.h"
#include "examples/server/server.h"
#include "examples/client/client.h"
#include "ctaocrypt/test/test.h"
void file_test(const char* file, byte* hash);
@ -117,7 +113,7 @@ int main(int argc, char** argv)
myArgv[1] = argc1;
myArgv[2] = argc2;
echo_args.argc = NUMARGS;
echo_args.argc = 3;
echo_args.argv = myArgv;
strcpy(echo_args.argv[0], "echoclient");
@ -171,10 +167,16 @@ void simple_test(func_args* args)
THREAD_TYPE serverThread;
func_args svrArgs;
char *svrArgv[NUMARGS];
char *svrArgv[9];
char argc0s[32];
char argc1s[32];
char argc2s[32];
char argc3s[32];
char argc4s[32];
char argc5s[32];
char argc6s[32];
char argc7s[32];
char argc8s[32];
func_args cliArgs;
char *cliArgv[NUMARGS];
@ -185,6 +187,12 @@ void simple_test(func_args* args)
svrArgv[0] = argc0s;
svrArgv[1] = argc1s;
svrArgv[2] = argc2s;
svrArgv[3] = argc3s;
svrArgv[4] = argc4s;
svrArgv[5] = argc5s;
svrArgv[6] = argc6s;
svrArgv[7] = argc7s;
svrArgv[8] = argc8s;
cliArgv[0] = argc0c;
cliArgv[1] = argc1c;
cliArgv[2] = argc2c;
@ -198,9 +206,16 @@ void simple_test(func_args* args)
strcpy(svrArgs.argv[0], "SimpleServer");
#if !defined(USE_WINDOWS_API) && !defined(CYASSL_SNIFFER)
svrArgs.argc = NUMARGS;
strcpy(svrArgs.argv[1], "-p");
strcpy(svrArgs.argv[2], "0");
strcpy(svrArgs.argv[svrArgs.argc++], "-p");
strcpy(svrArgs.argv[svrArgs.argc++], "0");
#endif
#ifdef HAVE_NTRU
strcpy(svrArgs.argv[svrArgs.argc++], "-d");
strcpy(svrArgs.argv[svrArgs.argc++], "-n");
strcpy(svrArgs.argv[svrArgs.argc++], "-c");
strcpy(svrArgs.argv[svrArgs.argc++], "./certs/ntru-cert.pem");
strcpy(svrArgs.argv[svrArgs.argc++], "-k");
strcpy(svrArgs.argv[svrArgs.argc++], "./certs/ntru-key.raw");
#endif
/* Set the last arg later, when it is known. */
@ -317,3 +332,35 @@ void file_test(const char* file, byte* check)
}
#else /* SINGLE_THREADED */
int myoptind = 0;
char* myoptarg = NULL;
int main(int argc, char** argv)
{
func_args server_args;
server_args.argc = argc;
server_args.argv = argv;
if (CurrentDir("testsuite") || CurrentDir("_build"))
ChangeDirBack(1);
else if (CurrentDir("Debug") || CurrentDir("Release"))
ChangeDirBack(3); /* Xcode->Preferences->Locations->Locations*/
/* Derived Data Advanced -> Custom */
/* Relative to Workspace, Build/Products */
/* Debug or Release */
ctaocrypt_test(&server_args);
if (server_args.return_code != 0) return server_args.return_code;
printf("\nAll tests passed!\n");
return EXIT_SUCCESS;
}
#endif /* SINGLE_THREADED */