This commit is contained in:
Jacob Barthelmeh
2014-12-17 15:48:37 -07:00
17 changed files with 7640 additions and 231 deletions

View File

@@ -59,8 +59,10 @@ EXTRA_DIST+= IDE
EXTRA_DIST+= README.md
EXTRA_DIST+= LICENSING
#-------------------------------------#
include cyassl/include.am
include wolfssl/include.am
#-------------------------------------#
include certs/include.am
include certs/1024/include.am
include certs/crl/include.am
@@ -69,9 +71,16 @@ include swig/include.am
include src/include.am
include support/include.am
#-------------------------------------#
include ctaocrypt/benchmark/include.am
include wolfcrypt/benchmark/include.am
#-------------------------------------#
include ctaocrypt/src/include.am
include wolfcrypt/src/include.am
#-------------------------------------#
include ctaocrypt/test/include.am
include wolfcrypt/test/include.am
#-------------------------------------#
include examples/client/include.am
include examples/server/include.am
include examples/echoclient/include.am

View File

@@ -26,6 +26,7 @@
#define CYASSL_MEMORY_H
#include <stdlib.h>
#include <wolfssl/wolfcrypt/memory.h>
#ifdef __cplusplus
extern "C" {

View File

@@ -54,7 +54,7 @@
/* redeclare guard */
#define CYASSL_TYPES_DEFINED WOLFSSL_TYPES_DEFINED
/* structs */
#define CYASSL_EVP_PKEY WOLFSSL_EVP_PKEY
#define CYASSL_RSA WOLFSSL_RSA
#define CYASSL_DSA WOLFSSL_DSA
@@ -81,25 +81,26 @@
#define CYASSL_X509_STORE_CTX WOLFSSL_X509_STORE_CTX
/* src/ssl.c */
#define CYASSL_CLIENT_END WOLFSSL_CLIENT_END
#define CYASSL_CERT_MANAGER WOLFSSL_CERT_MANAGER
#define CYASSL_USER_CA WOLFSSL_USER_CA
#define CYASSL_TLSV1 WOLFSSL_TLSV1
#define CYASSL_TLSV1_1 WOLFSSL_TLSV1_1
#define CYASSL_TLSV1_2 WOLFSSL_TLSV1_2
#define CYASSL_SSLV3 WOLFSSL_SSLV3
#define CyaSSL_session_reused wolfSSL_session_reused
#define CyaSSL_get_version wolfSSL_get_version
#define CyaSSL_get_shutdown wolfSSL_get_shutdown
#define CyaSSL_is_init_finished wolfSSL_is_init_finished
#define CyaSSL_CTX_UnloadCAs wolfSSL_CTX_UnloadCAs
#define CyaSSL_UnloadCertsKeys wolfSSL_UnloadCertsKeys
#define CyaSSL_SetServerID wolfSSL_SetServerID
#define CyaSSL_SetCertCbCtx wolfSSL_SetCertCbCtx
#define CyaSSL_CTX_check_private_key wolfSSL_CTX_check_private_key
#define CYASSL_CLIENT_END WOLFSSL_CLIENT_END
#define CYASSL_CERT_MANAGER WOLFSSL_CERT_MANAGER
#define CYASSL_USER_CA WOLFSSL_USER_CA
#define CYASSL_TLSV1 WOLFSSL_TLSV1
#define CYASSL_TLSV1_1 WOLFSSL_TLSV1_1
#define CYASSL_TLSV1_2 WOLFSSL_TLSV1_2
#define CYASSL_SSLV3 WOLFSSL_SSLV3
#define CyaSSL_session_reused wolfSSL_session_reused
#define CyaSSL_get_version wolfSSL_get_version
#define CyaSSL_get_shutdown wolfSSL_get_shutdown
#define CyaSSL_is_init_finished wolfSSL_is_init_finished
#define CyaSSL_CTX_UnloadCAs wolfSSL_CTX_UnloadCAs
#define CyaSSL_UnloadCertsKeys wolfSSL_UnloadCertsKeys
#define CyaSSL_SetServerID wolfSSL_SetServerID
#define CyaSSL_SetCertCbCtx wolfSSL_SetCertCbCtx
#define CyaSSL_CTX_check_private_key wolfSSL_CTX_check_private_key
#define CyaSSL_get_current_cipher_suite wolfSSL_get_current_cipher_suite
#define CyaSSL_get_cipher wolfSSL_get_cipher
#define CyaSSL_CIPHER_get_name wolfSSL_CIPHER_get_name
#define CyaSSL_get_cipher wolfSSL_get_cipher
#define CyaSSL_CIPHER_get_name wolfSSL_CIPHER_get_name
#define CyaSSL_get_current_cipher wolfSSL_get_current_cipher
/* io.c */
#define CYASSL_CBIO_ERR_CONN_CLOSE WOLFSSL_CBIO_ERR_CONN_CLOSE
@@ -112,11 +113,11 @@
#define CYASSL_CBIO_ERR_TIMEOUT WOLFSSL_CBIO_ERR_TIMEOUT
/* src/tls.c */
#define CYASSL_SERVER_END WOLFSSL_SERVER_END
#define CYASSL_TLS_HMAC_INNER_SZ WOLFSSL_TLS_HMAC_INNER_SZ
#define CyaSSL_make_eap_keys wolfSSL_make_eap_keys
#define CYASSL_SERVER_END WOLFSSL_SERVER_END
#define CYASSL_TLS_HMAC_INNER_SZ WOLFSSL_TLS_HMAC_INNER_SZ
#define CyaSSL_make_eap_keys wolfSSL_make_eap_keys
#define CyaSSL_MakeTlsMasterSecret wolfSSL_MakeTlsMasterSecret
#define CyaSSL_DeriveTlsKeys wolfSSL_DeriveTlsKeys
#define CyaSSL_DeriveTlsKeys wolfSSL_DeriveTlsKeys
/* internal.c */
#define CyaSSL_ERR_reason_error_string wolfSSL_ERR_reason_error_string
@@ -124,6 +125,9 @@
#define CYASSL_CBIO_ERR_CONN_RST WOLFSSL_CBIO_ERR_CONN_RST
#define CYASSL_ALERT_HISTORY WOLFSSL_ALERT_HISTORY
/* Initialization and Shutdown */
#define CyaSSL_Init wolfSSL_Init
#define CyaSSL_library_init wolfSSL_library_init

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "benchmark", "benchmark.vcproj", "{615AEC46-5595-4DEA-9490-DBD5DE0F8772}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{615AEC46-5595-4DEA-9490-DBD5DE0F8772}.Debug|Win32.ActiveCfg = Debug|Win32
{615AEC46-5595-4DEA-9490-DBD5DE0F8772}.Debug|Win32.Build.0 = Debug|Win32
{615AEC46-5595-4DEA-9490-DBD5DE0F8772}.Release|Win32.ActiveCfg = Release|Win32
{615AEC46-5595-4DEA-9490-DBD5DE0F8772}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,195 @@
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="benchmark"
ProjectGUID="{615AEC46-5595-4DEA-9490-DBD5DE0F8772}"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\benchmark.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,10 @@
# vim:ft=automake
# All paths should be given relative to the root
noinst_PROGRAMS += wolfcrypt/benchmark/benchmark
wolfcrypt_benchmark_benchmark_SOURCES = wolfcrypt/benchmark/benchmark.c
wolfcrypt_benchmark_benchmark_LDADD = src/libcyassl.la
wolfcrypt_benchmark_benchmark_DEPENDENCIES = src/libcyassl.la
EXTRA_DIST += wolfcrypt/benchmark/benchmark.sln
EXTRA_DIST += wolfcrypt/benchmark/benchmark.vcproj
DISTCLEANFILES+= wolfcrypt/benchmark/.libs/benchmark

View File

@@ -0,0 +1,10 @@
# vim:ft=automake
# All paths should be given relative to the root
noinst_PROGRAMS += wolfcrypt/benchmark/benchmark
wolfcrypt_benchmark_benchmark_SOURCES = wolfcrypt/benchmark/benchmark.c
wolfcrypt_benchmark_benchmark_LDADD = src/libcyassl.la
wolfcrypt_benchmark_benchmark_DEPENDENCIES = src/libcyassl.la
EXTRA_DIST += wolfcrypt/benchmark/benchmark.sln
EXTRA_DIST += wolfcrypt/benchmark/benchmark.vcproj
DISTCLEANFILES+= wolfcrypt/benchmark/.libs/benchmark

11
wolfcrypt/test/include.am Normal file
View File

@@ -0,0 +1,11 @@
# vim:ft=automake
# All paths should be given relative to the root
noinst_PROGRAMS+= wolfcrypt/test/testwolfcrypt
wolfcrypt_test_testwolfcrypt_SOURCES = wolfcrypt/test/test.c
wolfcrypt_test_testwolfcrypt_LDADD = src/libcyassl.la
wolfcrypt_test_testwolfcrypt_DEPENDENCIES = src/libcyassl.la
noinst_HEADERS += wolfcrypt/test/test.h
EXTRA_DIST += wolfcrypt/test/test.sln
EXTRA_DIST += wolfcrypt/test/test.vcproj
DISTCLEANFILES+= wolfcrypt/test/.libs/testwolfcrypt

View File

@@ -0,0 +1,11 @@
# vim:ft=automake
# All paths should be given relative to the root
noinst_PROGRAMS+= wolfcrypt/test/testwolfcrypt
wolfcrypt_test_testwolfcrypt_SOURCES = wolfcrypt/test/test.c
wolfcrypt_test_testwolfcrypt_LDADD = src/libcyassl.la
wolfcrypt_test_testwolfcrypt_DEPENDENCIES = src/libcyassl.la
noinst_HEADERS += wolfcrypt/test/test.h
EXTRA_DIST += wolfcrypt/test/test.sln
EXTRA_DIST += wolfcrypt/test/test.vcproj
DISTCLEANFILES+= wolfcrypt/test/.libs/testwolfcrypt

5293
wolfcrypt/test/test.c Normal file

File diff suppressed because it is too large Load Diff

33
wolfcrypt/test/test.h Normal file
View File

@@ -0,0 +1,33 @@
/* ctaocrypt/test/test.h
*
* Copyright (C) 2006-2014 wolfSSL Inc.
*
* This file is part of CyaSSL.
*
* CyaSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* CyaSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
int ctaocrypt_test(void* args);
#ifdef __cplusplus
} /* extern "C" */
#endif

20
wolfcrypt/test/test.sln Executable file
View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test.vcproj", "{D04BDF66-664A-4D59-BEAC-8AB2D5809C21}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D04BDF66-664A-4D59-BEAC-8AB2D5809C21}.Debug|Win32.ActiveCfg = Debug|Win32
{D04BDF66-664A-4D59-BEAC-8AB2D5809C21}.Debug|Win32.Build.0 = Debug|Win32
{D04BDF66-664A-4D59-BEAC-8AB2D5809C21}.Release|Win32.ActiveCfg = Release|Win32
{D04BDF66-664A-4D59-BEAC-8AB2D5809C21}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

195
wolfcrypt/test/test.vcproj Executable file
View File

@@ -0,0 +1,195 @@
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="test"
ProjectGUID="{D04BDF66-664A-4D59-BEAC-8AB2D5809C21}"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include;../../include/openssl"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../include;../../include/openssl"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\test.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -1,7 +1,7 @@
/* test.h */
#ifndef CyaSSL_TEST_H
#define CyaSSL_TEST_H
#ifndef wolfSSL_TEST_H
#define wolfSSL_TEST_H
#include <stdio.h>
#include <stdlib.h>
@@ -33,9 +33,9 @@
#endif
#define SOCKET_T SOCKET
#define SNPRINTF _snprintf
#elif defined(CYASSL_MDK_ARM)
#elif defined(WOLFSSL_MDK_ARM)
#include <string.h>
#elif defined(CYASSL_TIRTOS)
#elif defined(WOLFSSL_TIRTOS)
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
@@ -46,7 +46,7 @@
#else
#include <string.h>
#include <sys/types.h>
#ifndef CYASSL_LEANPSK
#ifndef WOLFSSL_LEANPSK
#include <unistd.h>
#include <netdb.h>
#include <netinet/in.h>
@@ -90,7 +90,7 @@
/* HPUX doesn't use socklent_t for third parameter to accept, unless
_XOPEN_SOURCE_EXTENDED is defined */
#if !defined(__hpux__) && !defined(CYASSL_MDK_ARM) && !defined(CYASSL_IAR_ARM)
#if !defined(__hpux__) && !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_IAR_ARM)
typedef socklen_t* ACCEPT_THIRD_T;
#else
#if defined _XOPEN_SOURCE_EXTENDED
@@ -104,7 +104,7 @@
#ifdef USE_WINDOWS_API
#define CloseSocket(s) closesocket(s)
#define StartTCP() { WSADATA wsd; WSAStartup(0x0002, &wsd); }
#elif defined(CYASSL_MDK_ARM)
#elif defined(WOLFSSL_MDK_ARM)
#define CloseSocket(s) closesocket(s)
#define StartTCP()
#else
@@ -116,26 +116,26 @@
#ifdef SINGLE_THREADED
typedef unsigned int THREAD_RETURN;
typedef void* THREAD_TYPE;
#define CYASSL_THREAD
#define WOLFSSL_THREAD
#else
#if defined(_POSIX_THREADS) && !defined(__MINGW32__)
typedef void* THREAD_RETURN;
typedef pthread_t THREAD_TYPE;
#define CYASSL_THREAD
#define WOLFSSL_THREAD
#define INFINITE -1
#define WAIT_OBJECT_0 0L
#elif defined(CYASSL_MDK_ARM)
#elif defined(WOLFSSL_MDK_ARM)
typedef unsigned int THREAD_RETURN;
typedef int THREAD_TYPE;
#define CYASSL_THREAD
#elif defined(CYASSL_TIRTOS)
#define WOLFSSL_THREAD
#elif defined(WOLFSSL_TIRTOS)
typedef void THREAD_RETURN;
typedef Task_Handle THREAD_TYPE;
#define CYASSL_THREAD
#define WOLFSSL_THREAD
#else
typedef unsigned int THREAD_RETURN;
typedef intptr_t THREAD_TYPE;
#define CYASSL_THREAD __stdcall
#define WOLFSSL_THREAD __stdcall
#endif
#endif
@@ -156,7 +156,7 @@
#define CLIENT_DTLS_DEFAULT_VERSION (-2)
#define CLIENT_INVALID_VERSION (-99)
/* all certs relative to CyaSSL home directory now */
/* all certs relative to wolfSSL home directory now */
#define caCert "./certs/ca-cert.pem"
#define eccCert "./certs/server-ecc.pem"
#define eccKey "./certs/ecc-key.pem"
@@ -184,9 +184,9 @@ typedef struct tcp_ready {
void InitTcpReady(tcp_ready*);
void FreeTcpReady(tcp_ready*);
typedef CYASSL_METHOD* (*method_provider)(void);
typedef void (*ctx_callback)(CYASSL_CTX* ctx);
typedef void (*ssl_callback)(CYASSL* ssl);
typedef WOLFSSL_METHOD* (*method_provider)(void);
typedef void (*ctx_callback)(WOLFSSL_CTX* ctx);
typedef void (*ssl_callback)(WOLFSSL* ssl);
typedef struct callback_functions {
method_provider method;
@@ -205,7 +205,7 @@ typedef struct func_args {
void wait_tcp_ready(func_args*);
typedef THREAD_RETURN CYASSL_THREAD THREAD_FUNC(void*);
typedef THREAD_RETURN WOLFSSL_THREAD THREAD_FUNC(void*);
void start_thread(THREAD_FUNC, func_args*, THREAD_TYPE*);
void join_thread(THREAD_TYPE);
@@ -310,23 +310,23 @@ static INLINE int PasswordCallBack(char* passwd, int sz, int rw, void* userdata)
#if defined(KEEP_PEER_CERT) || defined(SESSION_CERTS)
static INLINE void ShowX509(CYASSL_X509* x509, const char* hdr)
static INLINE void ShowX509(WOLFSSL_X509* x509, const char* hdr)
{
char* altName;
char* issuer = CyaSSL_X509_NAME_oneline(
CyaSSL_X509_get_issuer_name(x509), 0, 0);
char* subject = CyaSSL_X509_NAME_oneline(
CyaSSL_X509_get_subject_name(x509), 0, 0);
char* issuer = wolfSSL_X509_NAME_oneline(
wolfSSL_X509_get_issuer_name(x509), 0, 0);
char* subject = wolfSSL_X509_NAME_oneline(
wolfSSL_X509_get_subject_name(x509), 0, 0);
byte serial[32];
int ret;
int sz = sizeof(serial);
printf("%s\n issuer : %s\n subject: %s\n", hdr, issuer, subject);
while ( (altName = CyaSSL_X509_get_next_altname(x509)) != NULL)
while ( (altName = wolfSSL_X509_get_next_altname(x509)) != NULL)
printf(" altname = %s\n", altName);
ret = CyaSSL_X509_get_serial_number(x509, serial, &sz);
ret = wolfSSL_X509_get_serial_number(x509, serial, &sz);
if (ret == SSL_SUCCESS) {
int i;
int strLen;
@@ -347,43 +347,43 @@ static INLINE void ShowX509(CYASSL_X509* x509, const char* hdr)
#endif /* KEEP_PEER_CERT || SESSION_CERTS */
static INLINE void showPeer(CYASSL* ssl)
static INLINE void showPeer(WOLFSSL* ssl)
{
CYASSL_CIPHER* cipher;
WOLFSSL_CIPHER* cipher;
#ifdef KEEP_PEER_CERT
CYASSL_X509* peer = CyaSSL_get_peer_certificate(ssl);
WOLFSSL_X509* peer = wolfSSL_get_peer_certificate(ssl);
if (peer)
ShowX509(peer, "peer's cert info:");
else
printf("peer has no cert!\n");
#endif
printf("SSL version is %s\n", CyaSSL_get_version(ssl));
printf("SSL version is %s\n", wolfSSL_get_version(ssl));
cipher = CyaSSL_get_current_cipher(ssl);
printf("SSL cipher suite is %s\n", CyaSSL_CIPHER_get_name(cipher));
cipher = wolfSSL_get_current_cipher(ssl);
printf("SSL cipher suite is %s\n", wolfSSL_CIPHER_get_name(cipher));
#if defined(SESSION_CERTS) && defined(SHOW_CERTS)
{
CYASSL_X509_CHAIN* chain = CyaSSL_get_peer_chain(ssl);
int count = CyaSSL_get_chain_count(chain);
WOLFSSL_X509_CHAIN* chain = wolfSSL_get_peer_chain(ssl);
int count = wolfSSL_get_chain_count(chain);
int i;
for (i = 0; i < count; i++) {
int length;
unsigned char buffer[3072];
CYASSL_X509* chainX509;
WOLFSSL_X509* chainX509;
CyaSSL_get_chain_cert_pem(chain,i,buffer, sizeof(buffer), &length);
wolfSSL_get_chain_cert_pem(chain,i,buffer, sizeof(buffer), &length);
buffer[length] = 0;
printf("cert %d has length %d data = \n%s\n", i, length, buffer);
chainX509 = CyaSSL_get_chain_X509(chain, i);
chainX509 = wolfSSL_get_chain_X509(chain, i);
if (chainX509)
ShowX509(chainX509, "session cert info:");
else
printf("get_chain_X509 failed\n");
CyaSSL_FreeX509(chainX509);
wolfSSL_FreeX509(chainX509);
}
}
#endif
@@ -403,7 +403,7 @@ static INLINE void build_addr(SOCKADDR_IN_T* addr, const char* peer,
#ifndef TEST_IPV6
/* peer could be in human readable form */
if ( (peer != INADDR_ANY) && isalpha((int)peer[0])) {
#ifdef CYASSL_MDK_ARM
#ifdef WOLFSSL_MDK_ARM
int err;
struct hostent* entry = gethostbyname(peer, &err);
#else
@@ -422,7 +422,7 @@ static INLINE void build_addr(SOCKADDR_IN_T* addr, const char* peer,
#ifndef TEST_IPV6
#if defined(CYASSL_MDK_ARM)
#if defined(WOLFSSL_MDK_ARM)
addr->sin_family = PF_INET;
#else
addr->sin_family = AF_INET_V;
@@ -480,7 +480,7 @@ static INLINE void tcp_socket(SOCKET_T* sockfd, int udp)
#ifdef USE_WINDOWS_API
if (*sockfd == INVALID_SOCKET)
err_sys("socket failed\n");
#elif defined(CYASSL_TIRTOS)
#elif defined(WOLFSSL_TIRTOS)
if (*sockfd == -1)
err_sys("socket failed\n");
#else
@@ -497,7 +497,7 @@ static INLINE void tcp_socket(SOCKET_T* sockfd, int udp)
if (res < 0)
err_sys("setsockopt SO_NOSIGPIPE failed\n");
}
#elif defined(CYASSL_MDK_ARM) || defined (CYASSL_TIRTOS)
#elif defined(WOLFSSL_MDK_ARM) || defined (WOLFSSL_TIRTOS)
/* nothing to define */
#else /* no S_NOSIGPIPE */
signal(SIGPIPE, SIG_IGN);
@@ -545,7 +545,7 @@ enum {
};
#if !defined(CYASSL_MDK_ARM) && !defined(CYASSL_TIRTOS)
#if !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_TIRTOS)
static INLINE int tcp_select(SOCKET_T socketfd, int to_sec)
{
fd_set recvfds, errfds;
@@ -571,12 +571,12 @@ static INLINE int tcp_select(SOCKET_T socketfd, int to_sec)
return TEST_SELECT_FAIL;
}
#elif defined(CYASSL_TIRTOS)
#elif defined(WOLFSSL_TIRTOS)
static INLINE int tcp_select(SOCKET_T socketfd, int to_sec)
{
return TEST_RECV_READY;
}
#endif /* !CYASSL_MDK_ARM */
#endif /* !WOLFSSL_MDK_ARM */
static INLINE void tcp_listen(SOCKET_T* sockfd, word16* port, int useAnyAddr,
@@ -589,7 +589,7 @@ static INLINE void tcp_listen(SOCKET_T* sockfd, word16* port, int useAnyAddr,
build_addr(&addr, (useAnyAddr ? INADDR_ANY : yasslIP), *port, udp);
tcp_socket(sockfd, udp);
#if !defined(USE_WINDOWS_API) && !defined(CYASSL_MDK_ARM)
#if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_MDK_ARM)
{
int res, on = 1;
socklen_t len = sizeof(on);
@@ -650,7 +650,7 @@ static INLINE void udp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd,
tcp_socket(sockfd, 1);
#if !defined(USE_WINDOWS_API) && !defined(CYASSL_MDK_ARM)
#if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_MDK_ARM)
{
int res, on = 1;
socklen_t len = sizeof(on);
@@ -686,7 +686,7 @@ static INLINE void udp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd,
pthread_cond_signal(&ready->cond);
pthread_mutex_unlock(&ready->mutex);
}
#elif defined (CYASSL_TIRTOS)
#elif defined (WOLFSSL_TIRTOS)
/* Need mutex? */
tcp_ready* ready = args->signal;
ready->ready = 1;
@@ -720,7 +720,7 @@ static INLINE void tcp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd,
pthread_cond_signal(&ready->cond);
pthread_mutex_unlock(&ready->mutex);
}
#elif defined (CYASSL_TIRTOS)
#elif defined (WOLFSSL_TIRTOS)
/* Need mutex? */
tcp_ready* ready = args->signal;
ready->ready = 1;
@@ -757,7 +757,7 @@ static INLINE void tcp_set_nonblocking(SOCKET_T* sockfd)
int ret = ioctlsocket(*sockfd, FIONBIO, &blocking);
if (ret == SOCKET_ERROR)
err_sys("ioctlsocket failed");
#elif defined(CYASSL_MDK_ARM) || defined (CYASSL_TIRTOS)
#elif defined(WOLFSSL_MDK_ARM) || defined (WOLFSSL_TIRTOS)
/* non blocking not suppported, for now */
#else
int flags = fcntl(*sockfd, F_GETFL, 0);
@@ -772,7 +772,7 @@ static INLINE void tcp_set_nonblocking(SOCKET_T* sockfd)
#ifndef NO_PSK
static INLINE unsigned int my_psk_client_cb(CYASSL* ssl, const char* hint,
static INLINE unsigned int my_psk_client_cb(WOLFSSL* ssl, const char* hint,
char* identity, unsigned int id_max_len, unsigned char* key,
unsigned int key_max_len)
{
@@ -795,7 +795,7 @@ static INLINE unsigned int my_psk_client_cb(CYASSL* ssl, const char* hint,
}
static INLINE unsigned int my_psk_server_cb(CYASSL* ssl, const char* identity,
static INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity,
unsigned char* key, unsigned int key_max_len)
{
(void)ssl;
@@ -840,11 +840,11 @@ static INLINE unsigned int my_psk_server_cb(CYASSL* ssl, const char* identity,
return (double)count.QuadPart / freq.QuadPart;
}
#elif defined(CYASSL_TIRTOS)
#elif defined(WOLFSSL_TIRTOS)
extern double current_time();
#else
#if !defined(CYASSL_MDK_ARM)
#if !defined(WOLFSSL_MDK_ARM)
#include <sys/time.h>
static INLINE double current_time(void)
@@ -862,12 +862,12 @@ static INLINE unsigned int my_psk_server_cb(CYASSL* ssl, const char* identity,
#if defined(NO_FILESYSTEM) && !defined(NO_CERTS)
enum {
CYASSL_CA = 1,
CYASSL_CERT = 2,
CYASSL_KEY = 3
WOLFSSL_CA = 1,
WOLFSSL_CERT = 2,
WOLFSSL_KEY = 3
};
static INLINE void load_buffer(CYASSL_CTX* ctx, const char* fname, int type)
static INLINE void load_buffer(WOLFSSL_CTX* ctx, const char* fname, int type)
{
/* test buffer load */
long sz = 0;
@@ -876,24 +876,24 @@ static INLINE unsigned int my_psk_server_cb(CYASSL* ssl, const char* identity,
if (!file)
err_sys("can't open file for buffer load "
"Please run from CyaSSL home directory if not");
"Please run from wolfSSL home directory if not");
fseek(file, 0, SEEK_END);
sz = ftell(file);
rewind(file);
fread(buff, sizeof(buff), 1, file);
if (type == CYASSL_CA) {
if (CyaSSL_CTX_load_verify_buffer(ctx, buff, sz, SSL_FILETYPE_PEM)
if (type == WOLFSSL_CA) {
if (wolfSSL_CTX_load_verify_buffer(ctx, buff, sz, SSL_FILETYPE_PEM)
!= SSL_SUCCESS)
err_sys("can't load buffer ca file");
}
else if (type == CYASSL_CERT) {
if (CyaSSL_CTX_use_certificate_buffer(ctx, buff, sz,
else if (type == WOLFSSL_CERT) {
if (wolfSSL_CTX_use_certificate_buffer(ctx, buff, sz,
SSL_FILETYPE_PEM) != SSL_SUCCESS)
err_sys("can't load buffer cert file");
}
else if (type == CYASSL_KEY) {
if (CyaSSL_CTX_use_PrivateKey_buffer(ctx, buff, sz,
else if (type == WOLFSSL_KEY) {
if (wolfSSL_CTX_use_PrivateKey_buffer(ctx, buff, sz,
SSL_FILETYPE_PEM) != SSL_SUCCESS)
err_sys("can't load buffer key file");
}
@@ -903,24 +903,24 @@ static INLINE unsigned int my_psk_server_cb(CYASSL* ssl, const char* identity,
#ifdef VERIFY_CALLBACK
static INLINE int myVerify(int preverify, CYASSL_X509_STORE_CTX* store)
static INLINE int myVerify(int preverify, WOLFSSL_X509_STORE_CTX* store)
{
(void)preverify;
char buffer[CYASSL_MAX_ERROR_SZ];
char buffer[WOLFSSL_MAX_ERROR_SZ];
#ifdef OPENSSL_EXTRA
CYASSL_X509* peer;
WOLFSSL_X509* peer;
#endif
printf("In verification callback, error = %d, %s\n", store->error,
CyaSSL_ERR_error_string(store->error, buffer));
wolfSSL_ERR_error_string(store->error, buffer));
#ifdef OPENSSL_EXTRA
peer = store->current_cert;
if (peer) {
char* issuer = CyaSSL_X509_NAME_oneline(
CyaSSL_X509_get_issuer_name(peer), 0, 0);
char* subject = CyaSSL_X509_NAME_oneline(
CyaSSL_X509_get_subject_name(peer), 0, 0);
char* issuer = wolfSSL_X509_NAME_oneline(
wolfSSL_X509_get_issuer_name(peer), 0, 0);
char* subject = wolfSSL_X509_NAME_oneline(
wolfSSL_X509_get_subject_name(peer), 0, 0);
printf("peer's cert info:\n issuer : %s\n subject: %s\n", issuer,
subject);
XFREE(subject, 0, DYNAMIC_TYPE_OPENSSL);
@@ -938,13 +938,13 @@ static INLINE int myVerify(int preverify, CYASSL_X509_STORE_CTX* store)
#endif /* VERIFY_CALLBACK */
static INLINE int myDateCb(int preverify, CYASSL_X509_STORE_CTX* store)
static INLINE int myDateCb(int preverify, WOLFSSL_X509_STORE_CTX* store)
{
char buffer[CYASSL_MAX_ERROR_SZ];
char buffer[WOLFSSL_MAX_ERROR_SZ];
(void)preverify;
printf("In verification callback, error = %d, %s\n", store->error,
CyaSSL_ERR_error_string(store->error, buffer));
wolfSSL_ERR_error_string(store->error, buffer));
printf("Subject's domain name is %s\n", store->domain);
if (store->error == ASN_BEFORE_DATE_E || store->error == ASN_AFTER_DATE_E) {
@@ -976,7 +976,7 @@ static INLINE void CaCb(unsigned char* der, int sz, int type)
#ifndef NO_DH
static INLINE void SetDH(CYASSL* ssl)
static INLINE void SetDH(WOLFSSL* ssl)
{
/* dh1024 p */
static unsigned char p[] =
@@ -1000,10 +1000,10 @@ static INLINE void SetDH(CYASSL* ssl)
0x02,
};
CyaSSL_SetTmpDH(ssl, p, sizeof(p), g, sizeof(g));
wolfSSL_SetTmpDH(ssl, p, sizeof(p), g, sizeof(g));
}
static INLINE void SetDHCtx(CYASSL_CTX* ctx)
static INLINE void SetDHCtx(WOLFSSL_CTX* ctx)
{
/* dh1024 p */
static unsigned char p[] =
@@ -1027,7 +1027,7 @@ static INLINE void SetDHCtx(CYASSL_CTX* ctx)
0x02,
};
CyaSSL_CTX_SetTmpDH(ctx, p, sizeof(p), g, sizeof(g));
wolfSSL_CTX_SetTmpDH(ctx, p, sizeof(p), g, sizeof(g));
}
#endif /* NO_DH */
#endif /* !NO_CERTS */
@@ -1097,9 +1097,9 @@ static INLINE int CurrentDir(const char* str)
return 0;
}
#elif defined(CYASSL_MDK_ARM)
#elif defined(WOLFSSL_MDK_ARM)
/* KEIL-RL File System does not support relative directry */
#elif defined(CYASSL_TIRTOS)
#elif defined(WOLFSSL_TIRTOS)
#else
#ifndef MAX_PATH
@@ -1152,7 +1152,7 @@ static INLINE int CurrentDir(const char* str)
#endif /* USE_WINDOWS_API */
#ifdef USE_CYASSL_MEMORY
#ifdef USE_WOLFSSL_MEMORY
typedef struct memoryStats {
size_t totalAllocs; /* number of allocations */
@@ -1173,7 +1173,7 @@ static INLINE int CurrentDir(const char* str)
} u;
} memoryTrack;
#if defined(CYASSL_TRACK_MEMORY)
#if defined(WOLFSSL_TRACK_MEMORY)
#define DO_MEM_STATS
static memoryStats ourMemStats;
#endif
@@ -1246,8 +1246,8 @@ static INLINE int CurrentDir(const char* str)
static INLINE void InitMemoryTracker(void)
{
if (CyaSSL_SetAllocators(TrackMalloc, TrackFree, TrackRealloc) != 0)
err_sys("CyaSSL SetAllocators failed for track memory");
if (wolfSSL_SetAllocators(TrackMalloc, TrackFree, TrackRealloc) != 0)
err_sys("wolfSSL SetAllocators failed for track memory");
#ifdef DO_MEM_STATS
ourMemStats.totalAllocs = 0;
@@ -1271,12 +1271,12 @@ static INLINE int CurrentDir(const char* str)
#endif
}
#endif /* USE_CYASSL_MEMORY */
#endif /* USE_WOLFSSL_MEMORY */
#ifdef HAVE_STACK_SIZE
typedef THREAD_RETURN CYASSL_THREAD (*thread_func)(void* args);
typedef THREAD_RETURN WOLFSSL_THREAD (*thread_func)(void* args);
static INLINE void StackSizeCheck(func_args* args, thread_func tf)
@@ -1381,33 +1381,33 @@ typedef struct AtomicDecCtx {
} AtomicDecCtx;
static INLINE int myMacEncryptCb(CYASSL* ssl, unsigned char* macOut,
static INLINE int myMacEncryptCb(WOLFSSL* ssl, unsigned char* macOut,
const unsigned char* macIn, unsigned int macInSz, int macContent,
int macVerify, unsigned char* encOut, const unsigned char* encIn,
unsigned int encSz, void* ctx)
{
int ret;
Hmac hmac;
byte myInner[CYASSL_TLS_HMAC_INNER_SZ];
byte myInner[WOLFSSL_TLS_HMAC_INNER_SZ];
AtomicEncCtx* encCtx = (AtomicEncCtx*)ctx;
const char* tlsStr = "TLS";
/* example supports (d)tls aes */
if (CyaSSL_GetBulkCipher(ssl) != cyassl_aes) {
if (wolfSSL_GetBulkCipher(ssl) != cyassl_aes) {
printf("myMacEncryptCb not using AES\n");
return -1;
}
if (strstr(CyaSSL_get_version(ssl), tlsStr) == NULL) {
if (strstr(wolfSSL_get_version(ssl), tlsStr) == NULL) {
printf("myMacEncryptCb not using (D)TLS\n");
return -1;
}
/* hmac, not needed if aead mode */
CyaSSL_SetTlsHmacInner(ssl, myInner, macInSz, macContent, macVerify);
wolfSSL_SetTlsHmacInner(ssl, myInner, macInSz, macContent, macVerify);
ret = HmacSetKey(&hmac, CyaSSL_GetHmacType(ssl),
CyaSSL_GetMacSecret(ssl, macVerify), CyaSSL_GetHmacSize(ssl));
ret = HmacSetKey(&hmac, wolfSSL_GetHmacType(ssl),
wolfSSL_GetMacSecret(ssl, macVerify), wolfSSL_GetHmacSize(ssl));
if (ret != 0)
return ret;
ret = HmacUpdate(&hmac, myInner, sizeof(myInner));
@@ -1423,17 +1423,17 @@ static INLINE int myMacEncryptCb(CYASSL* ssl, unsigned char* macOut,
/* encrypt setup on first time */
if (encCtx->keySetup == 0) {
int keyLen = CyaSSL_GetKeySize(ssl);
int keyLen = wolfSSL_GetKeySize(ssl);
const byte* key;
const byte* iv;
if (CyaSSL_GetSide(ssl) == CYASSL_CLIENT_END) {
key = CyaSSL_GetClientWriteKey(ssl);
iv = CyaSSL_GetClientWriteIV(ssl);
if (wolfSSL_GetSide(ssl) == WOLFSSL_CLIENT_END) {
key = wolfSSL_GetClientWriteKey(ssl);
iv = wolfSSL_GetClientWriteIV(ssl);
}
else {
key = CyaSSL_GetServerWriteKey(ssl);
iv = CyaSSL_GetServerWriteIV(ssl);
key = wolfSSL_GetServerWriteKey(ssl);
iv = wolfSSL_GetServerWriteIV(ssl);
}
ret = AesSetKey(&encCtx->aes, key, keyLen, iv, AES_ENCRYPTION);
@@ -1449,7 +1449,7 @@ static INLINE int myMacEncryptCb(CYASSL* ssl, unsigned char* macOut,
}
static INLINE int myDecryptVerifyCb(CYASSL* ssl,
static INLINE int myDecryptVerifyCb(WOLFSSL* ssl,
unsigned char* decOut, const unsigned char* decIn,
unsigned int decSz, int macContent, int macVerify,
unsigned int* padSz, void* ctx)
@@ -1458,39 +1458,39 @@ static INLINE int myDecryptVerifyCb(CYASSL* ssl,
int ret = 0;
int macInSz = 0;
int ivExtra = 0;
int digestSz = CyaSSL_GetHmacSize(ssl);
int digestSz = wolfSSL_GetHmacSize(ssl);
unsigned int pad = 0;
unsigned int padByte = 0;
Hmac hmac;
byte myInner[CYASSL_TLS_HMAC_INNER_SZ];
byte myInner[WOLFSSL_TLS_HMAC_INNER_SZ];
byte verify[MAX_DIGEST_SIZE];
const char* tlsStr = "TLS";
/* example supports (d)tls aes */
if (CyaSSL_GetBulkCipher(ssl) != cyassl_aes) {
if (wolfSSL_GetBulkCipher(ssl) != cyassl_aes) {
printf("myMacEncryptCb not using AES\n");
return -1;
}
if (strstr(CyaSSL_get_version(ssl), tlsStr) == NULL) {
if (strstr(wolfSSL_get_version(ssl), tlsStr) == NULL) {
printf("myMacEncryptCb not using (D)TLS\n");
return -1;
}
/*decrypt */
if (decCtx->keySetup == 0) {
int keyLen = CyaSSL_GetKeySize(ssl);
int keyLen = wolfSSL_GetKeySize(ssl);
const byte* key;
const byte* iv;
/* decrypt is from other side (peer) */
if (CyaSSL_GetSide(ssl) == CYASSL_SERVER_END) {
key = CyaSSL_GetClientWriteKey(ssl);
iv = CyaSSL_GetClientWriteIV(ssl);
if (wolfSSL_GetSide(ssl) == WOLFSSL_SERVER_END) {
key = wolfSSL_GetClientWriteKey(ssl);
iv = wolfSSL_GetClientWriteIV(ssl);
}
else {
key = CyaSSL_GetServerWriteKey(ssl);
iv = CyaSSL_GetServerWriteIV(ssl);
key = wolfSSL_GetServerWriteKey(ssl);
iv = wolfSSL_GetServerWriteIV(ssl);
}
ret = AesSetKey(&decCtx->aes, key, keyLen, iv, AES_DECRYPTION);
@@ -1504,25 +1504,25 @@ static INLINE int myDecryptVerifyCb(CYASSL* ssl,
/* decrypt */
ret = AesCbcDecrypt(&decCtx->aes, decOut, decIn, decSz);
if (CyaSSL_GetCipherType(ssl) == CYASSL_AEAD_TYPE) {
*padSz = CyaSSL_GetAeadMacSize(ssl);
if (wolfSSL_GetCipherType(ssl) == WOLFSSL_AEAD_TYPE) {
*padSz = wolfSSL_GetAeadMacSize(ssl);
return 0; /* hmac, not needed if aead mode */
}
if (CyaSSL_GetCipherType(ssl) == CYASSL_BLOCK_TYPE) {
if (wolfSSL_GetCipherType(ssl) == WOLFSSL_BLOCK_TYPE) {
pad = *(decOut + decSz - 1);
padByte = 1;
if (CyaSSL_IsTLSv1_1(ssl))
ivExtra = CyaSSL_GetCipherBlockSize(ssl);
if (wolfSSL_IsTLSv1_1(ssl))
ivExtra = wolfSSL_GetCipherBlockSize(ssl);
}
*padSz = CyaSSL_GetHmacSize(ssl) + pad + padByte;
*padSz = wolfSSL_GetHmacSize(ssl) + pad + padByte;
macInSz = decSz - ivExtra - digestSz - pad - padByte;
CyaSSL_SetTlsHmacInner(ssl, myInner, macInSz, macContent, macVerify);
wolfSSL_SetTlsHmacInner(ssl, myInner, macInSz, macContent, macVerify);
ret = HmacSetKey(&hmac, CyaSSL_GetHmacType(ssl),
CyaSSL_GetMacSecret(ssl, macVerify), digestSz);
ret = HmacSetKey(&hmac, wolfSSL_GetHmacType(ssl),
wolfSSL_GetMacSecret(ssl, macVerify), digestSz);
if (ret != 0)
return ret;
ret = HmacUpdate(&hmac, myInner, sizeof(myInner));
@@ -1545,7 +1545,7 @@ static INLINE int myDecryptVerifyCb(CYASSL* ssl,
}
static INLINE void SetupAtomicUser(CYASSL_CTX* ctx, CYASSL* ssl)
static INLINE void SetupAtomicUser(WOLFSSL_CTX* ctx, WOLFSSL* ssl)
{
AtomicEncCtx* encCtx;
AtomicDecCtx* decCtx;
@@ -1562,18 +1562,18 @@ static INLINE void SetupAtomicUser(CYASSL_CTX* ctx, CYASSL* ssl)
}
memset(decCtx, 0, sizeof(AtomicDecCtx));
CyaSSL_CTX_SetMacEncryptCb(ctx, myMacEncryptCb);
CyaSSL_SetMacEncryptCtx(ssl, encCtx);
wolfSSL_CTX_SetMacEncryptCb(ctx, myMacEncryptCb);
wolfSSL_SetMacEncryptCtx(ssl, encCtx);
CyaSSL_CTX_SetDecryptVerifyCb(ctx, myDecryptVerifyCb);
CyaSSL_SetDecryptVerifyCtx(ssl, decCtx);
wolfSSL_CTX_SetDecryptVerifyCb(ctx, myDecryptVerifyCb);
wolfSSL_SetDecryptVerifyCtx(ssl, decCtx);
}
static INLINE void FreeAtomicUser(CYASSL* ssl)
static INLINE void FreeAtomicUser(WOLFSSL* ssl)
{
AtomicEncCtx* encCtx = (AtomicEncCtx*)CyaSSL_GetMacEncryptCtx(ssl);
AtomicDecCtx* decCtx = (AtomicDecCtx*)CyaSSL_GetDecryptVerifyCtx(ssl);
AtomicEncCtx* encCtx = (AtomicEncCtx*)wolfSSL_GetMacEncryptCtx(ssl);
AtomicDecCtx* decCtx = (AtomicDecCtx*)wolfSSL_GetDecryptVerifyCtx(ssl);
free(decCtx);
free(encCtx);
@@ -1586,7 +1586,7 @@ static INLINE void FreeAtomicUser(CYASSL* ssl)
#ifdef HAVE_ECC
static INLINE int myEccSign(CYASSL* ssl, const byte* in, word32 inSz,
static INLINE int myEccSign(WOLFSSL* ssl, const byte* in, word32 inSz,
byte* out, word32* outSz, const byte* key, word32 keySz, void* ctx)
{
RNG rng;
@@ -1612,7 +1612,7 @@ static INLINE int myEccSign(CYASSL* ssl, const byte* in, word32 inSz,
}
static INLINE int myEccVerify(CYASSL* ssl, const byte* sig, word32 sigSz,
static INLINE int myEccVerify(WOLFSSL* ssl, const byte* sig, word32 sigSz,
const byte* hash, word32 hashSz, const byte* key, word32 keySz,
int* result, void* ctx)
{
@@ -1636,7 +1636,7 @@ static INLINE int myEccVerify(CYASSL* ssl, const byte* sig, word32 sigSz,
#ifndef NO_RSA
static INLINE int myRsaSign(CYASSL* ssl, const byte* in, word32 inSz,
static INLINE int myRsaSign(WOLFSSL* ssl, const byte* in, word32 inSz,
byte* out, word32* outSz, const byte* key, word32 keySz, void* ctx)
{
RNG rng;
@@ -1666,7 +1666,7 @@ static INLINE int myRsaSign(CYASSL* ssl, const byte* in, word32 inSz,
}
static INLINE int myRsaVerify(CYASSL* ssl, byte* sig, word32 sigSz,
static INLINE int myRsaVerify(WOLFSSL* ssl, byte* sig, word32 sigSz,
byte** out,
const byte* key, word32 keySz,
void* ctx)
@@ -1689,7 +1689,7 @@ static INLINE int myRsaVerify(CYASSL* ssl, byte* sig, word32 sigSz,
}
static INLINE int myRsaEnc(CYASSL* ssl, const byte* in, word32 inSz,
static INLINE int myRsaEnc(WOLFSSL* ssl, const byte* in, word32 inSz,
byte* out, word32* outSz, const byte* key,
word32 keySz, void* ctx)
{
@@ -1720,7 +1720,7 @@ static INLINE int myRsaEnc(CYASSL* ssl, const byte* in, word32 inSz,
return ret;
}
static INLINE int myRsaDec(CYASSL* ssl, byte* in, word32 inSz,
static INLINE int myRsaDec(WOLFSSL* ssl, byte* in, word32 inSz,
byte** out,
const byte* key, word32 keySz, void* ctx)
{
@@ -1744,20 +1744,20 @@ static INLINE int myRsaDec(CYASSL* ssl, byte* in, word32 inSz,
#endif /* NO_RSA */
static INLINE void SetupPkCallbacks(CYASSL_CTX* ctx, CYASSL* ssl)
static INLINE void SetupPkCallbacks(WOLFSSL_CTX* ctx, WOLFSSL* ssl)
{
(void)ctx;
(void)ssl;
#ifdef HAVE_ECC
CyaSSL_CTX_SetEccSignCb(ctx, myEccSign);
CyaSSL_CTX_SetEccVerifyCb(ctx, myEccVerify);
wolfSSL_CTX_SetEccSignCb(ctx, myEccSign);
wolfSSL_CTX_SetEccVerifyCb(ctx, myEccVerify);
#endif /* HAVE_ECC */
#ifndef NO_RSA
CyaSSL_CTX_SetRsaSignCb(ctx, myRsaSign);
CyaSSL_CTX_SetRsaVerifyCb(ctx, myRsaVerify);
CyaSSL_CTX_SetRsaEncCb(ctx, myRsaEnc);
CyaSSL_CTX_SetRsaDecCb(ctx, myRsaDec);
wolfSSL_CTX_SetRsaSignCb(ctx, myRsaSign);
wolfSSL_CTX_SetRsaVerifyCb(ctx, myRsaVerify);
wolfSSL_CTX_SetRsaEncCb(ctx, myRsaEnc);
wolfSSL_CTX_SetRsaDecCb(ctx, myRsaDec);
#endif /* NO_RSA */
}
@@ -1767,7 +1767,7 @@ static INLINE void SetupPkCallbacks(CYASSL_CTX* ctx, CYASSL* ssl)
#if defined(__hpux__) || defined(__MINGW32__) || defined (CYASSL_TIRTOS)
#if defined(__hpux__) || defined(__MINGW32__) || defined (WOLFSSL_TIRTOS)
/* HP/UX doesn't have strsep, needed by test/suites.c */
static INLINE char* strsep(char **stringp, const char *delim)
@@ -1791,5 +1791,5 @@ static INLINE char* strsep(char **stringp, const char *delim)
#endif /* __hpux__ */
#endif /* CyaSSL_TEST_H */
#endif /* wolfSSL_TEST_H */

View File

@@ -4,44 +4,44 @@
nobase_include_HEADERS+= \
wolfssl/wolfcrypt/aes.h \
wolfssl/wolfcrypt/arc4.h \
#wolfssl/wolfcrypt/asn.h \
#wolfssl/wolfcrypt/asn_public.h \
#wolfssl/wolfcrypt/poly1305.h \
wolfssl/wolfcrypt/camellia.h
#wolfssl/wolfcrypt/coding.h \
#wolfssl/wolfcrypt/compress.h \
#wolfssl/wolfcrypt/des3.h \
#wolfssl/wolfcrypt/dh.h \
#wolfssl/wolfcrypt/dsa.h \
#wolfssl/wolfcrypt/ecc.h \
#wolfssl/wolfcrypt/error-crypt.h \
#wolfssl/wolfcrypt/fips_test.h \
#wolfssl/wolfcrypt/hc128.h \
#wolfssl/wolfcrypt/hmac.h \
#wolfssl/wolfcrypt/integer.h \
#wolfssl/wolfcrypt/md2.h \
#wolfssl/wolfcrypt/md4.h \
#wolfssl/wolfcrypt/md5.h \
#wolfssl/wolfcrypt/misc.h \
#wolfssl/wolfcrypt/pkcs7.h \
#wolfssl/wolfcrypt/wc_port.h \
#wolfssl/wolfcrypt/pwdbased.h \
#wolfssl/wolfcrypt/rabbit.h \
#wolfssl/wolfcrypt/chacha.h \
#wolfssl/wolfcrypt/random.h \
#wolfssl/wolfcrypt/ripemd.h \
#wolfssl/wolfcrypt/rsa.h \
#wolfssl/wolfcrypt/settings.h \
#wolfssl/wolfcrypt/sha256.h \
#wolfssl/wolfcrypt/sha512.h \
#wolfssl/wolfcrypt/sha.h \
#wolfssl/wolfcrypt/blake2.h \
#wolfssl/wolfcrypt/blake2-int.h \
#wolfssl/wolfcrypt/blake2-impl.h \
#wolfssl/wolfcrypt/tfm.h \
#wolfssl/wolfcrypt/types.h \
#wolfssl/wolfcrypt/visibility.h \
#wolfssl/wolfcrypt/logging.h \
#wolfssl/wolfcrypt/memory.h \
#wolfssl/wolfcrypt/mpi_class.h \
#wolfssl/wolfcrypt/mpi_superclass.h
wolfssl/wolfcrypt/asn.h \
wolfssl/wolfcrypt/asn_public.h \
wolfssl/wolfcrypt/poly1305.h \
wolfssl/wolfcrypt/camellia.h \
wolfssl/wolfcrypt/coding.h \
wolfssl/wolfcrypt/compress.h \
wolfssl/wolfcrypt/des3.h \
wolfssl/wolfcrypt/dh.h \
wolfssl/wolfcrypt/dsa.h \
wolfssl/wolfcrypt/ecc.h \
wolfssl/wolfcrypt/error-crypt.h \
wolfssl/wolfcrypt/fips_test.h \
wolfssl/wolfcrypt/hc128.h \
wolfssl/wolfcrypt/hmac.h \
wolfssl/wolfcrypt/integer.h \
wolfssl/wolfcrypt/md2.h \
wolfssl/wolfcrypt/md4.h \
wolfssl/wolfcrypt/md5.h \
wolfssl/wolfcrypt/misc.h \
wolfssl/wolfcrypt/pkcs7.h \
wolfssl/wolfcrypt/wc_port.h \
wolfssl/wolfcrypt/pwdbased.h \
wolfssl/wolfcrypt/rabbit.h \
wolfssl/wolfcrypt/chacha.h \
wolfssl/wolfcrypt/random.h \
wolfssl/wolfcrypt/ripemd.h \
wolfssl/wolfcrypt/rsa.h \
wolfssl/wolfcrypt/settings.h \
wolfssl/wolfcrypt/sha256.h \
wolfssl/wolfcrypt/sha512.h \
wolfssl/wolfcrypt/sha.h \
wolfssl/wolfcrypt/blake2.h \
wolfssl/wolfcrypt/blake2-int.h \
wolfssl/wolfcrypt/blake2-impl.h \
wolfssl/wolfcrypt/tfm.h \
wolfssl/wolfcrypt/types.h \
wolfssl/wolfcrypt/visibility.h \
wolfssl/wolfcrypt/logging.h \
wolfssl/wolfcrypt/memory.h \
wolfssl/wolfcrypt/mpi_class.h \
wolfssl/wolfcrypt/mpi_superclass.h

View File

@@ -2,14 +2,14 @@
*
* Copyright (C) 2006-2014 wolfSSL Inc.
*
* This file is part of CyaSSL.
* This file is part of wolfSSL.
*
* CyaSSL is free software; you can redistribute it and/or modify
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* CyaSSL is distributed in the hope that it will be useful,
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
@@ -20,11 +20,14 @@
*/
#ifndef CTAO_CRYPT_TYPES_H
#define CTAO_CRYPT_TYPES_H
#ifndef WOLF_CRYPT_TYPES_H
#define WOLF_CRYPT_TYPES_H
#include <cyassl/ctaocrypt/settings.h>
#include <cyassl/ctaocrypt/wc_port.h>
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/wolfcrypt/wc_port.h>
/* wolfssl_cyassl compatibility layer */
#include <cyassl/ssl.h>
#ifdef __cplusplus
extern "C" {
@@ -92,18 +95,18 @@
#else
typedef word32 cyassl_word;
#ifdef WORD64_AVAILABLE
#define CTAOCRYPT_SLOW_WORD64
#define WOLFCRYPT_SLOW_WORD64
#endif
#endif
enum {
CYASSL_WORD_SIZE = sizeof(cyassl_word),
CYASSL_BIT_SIZE = 8,
CYASSL_WORD_BITS = CYASSL_WORD_SIZE * CYASSL_BIT_SIZE
WOLFSSL_WORD_SIZE = sizeof(cyassl_word),
WOLFSSL_BIT_SIZE = 8,
WOLFSSL_WORD_BITS = WOLFSSL_WORD_SIZE * WOLFSSL_BIT_SIZE
};
#define CYASSL_MAX_16BIT 0xffffU
#define WOLFSSL_MAX_16BIT 0xffffU
/* use inlining if compiler allows */
#ifndef INLINE
@@ -168,20 +171,20 @@ enum {
extern void *XMALLOC(size_t n, void* heap, int type);
extern void *XREALLOC(void *p, size_t n, void* heap, int type);
extern void XFREE(void *p, void* heap, int type);
#elif defined(NO_CYASSL_MEMORY)
#elif defined(NO_WOLFSSL_MEMORY)
/* just use plain C stdlib stuff if desired */
#include <stdlib.h>
#define XMALLOC(s, h, t) ((void)h, (void)t, malloc((s)))
#define XFREE(p, h, t) {void* xp = (p); if((xp)) free((xp));}
#define XREALLOC(p, n, h, t) realloc((p), (n))
#elif !defined(MICRIUM_MALLOC) && !defined(EBSNET) \
&& !defined(CYASSL_SAFERTOS) && !defined(FREESCALE_MQX) \
&& !defined(CYASSL_LEANPSK)
&& !defined(WOLFSSL_SAFERTOS) && !defined(FREESCALE_MQX) \
&& !defined(WOLFSSL_LEANPSK)
/* default C runtime, can install different routines at runtime via cbs */
#include <cyassl/ctaocrypt/memory.h>
#define XMALLOC(s, h, t) ((void)h, (void)t, CyaSSL_Malloc((s)))
#define XFREE(p, h, t) {void* xp = (p); if((xp)) CyaSSL_Free((xp));}
#define XREALLOC(p, n, h, t) CyaSSL_Realloc((p), (n))
#define XMALLOC(s, h, t) ((void)h, (void)t, wolfSSL_Malloc((s)))
#define XFREE(p, h, t) {void* xp = (p); if((xp)) wolfSSL_Free((xp));}
#define XREALLOC(p, n, h, t) wolfSSL_Realloc((p), (n))
#endif
#ifndef STRING_USER
@@ -195,7 +198,7 @@ enum {
#define XSTRLEN(s1) strlen((s1))
#define XSTRNCPY(s1,s2,n) strncpy((s1),(s2),(n))
/* strstr, strncmp, and strncat only used by CyaSSL proper, not required for
/* strstr, strncmp, and strncat only used by wolfSSL proper, not required for
CTaoCrypt only */
#define XSTRSTR(s1,s2) strstr((s1),(s2))
#define XSTRNSTR(s1,s2,n) mystrnstr((s1),(s2),(n))
@@ -216,7 +219,7 @@ enum {
#define XTOUPPER(c) toupper((c))
#define XISALPHA(c) isalpha((c))
#endif
/* needed by CyaSSL_check_domain_name() */
/* needed by wolfSSL_check_domain_name() */
#ifdef __CYGWIN__
/* Cygwin uses a macro version of tolower() by default, use the
* function version. */
@@ -277,7 +280,7 @@ enum {
/* max error buffer string size */
enum {
CYASSL_MAX_ERROR_SZ = 80
WOLFSSL_MAX_ERROR_SZ = 80
};
/* stack protection */
@@ -311,7 +314,7 @@ enum {
};
CYASSL_API word32 CheckRunTimeSettings(void);
WOLFSSL_API word32 CheckRunTimeSettings(void);
/* If user uses RSA, DH, DSA, or ECC math lib directly then fast math and long
types need to match at compile time and run time, CheckCtcSettings will
@@ -324,5 +327,5 @@ CYASSL_API word32 CheckRunTimeSettings(void);
#endif
#endif /* CTAO_CRYPT_TYPES_H */
#endif /* WOLF_CRYPT_TYPES_H */