mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 04:04:39 +02:00
Merge branch 'master' of https://github.com/kaleb-himes/cyassl
This commit is contained in:
@@ -59,8 +59,10 @@ EXTRA_DIST+= IDE
|
|||||||
EXTRA_DIST+= README.md
|
EXTRA_DIST+= README.md
|
||||||
EXTRA_DIST+= LICENSING
|
EXTRA_DIST+= LICENSING
|
||||||
|
|
||||||
|
#-------------------------------------#
|
||||||
include cyassl/include.am
|
include cyassl/include.am
|
||||||
include wolfssl/include.am
|
include wolfssl/include.am
|
||||||
|
#-------------------------------------#
|
||||||
include certs/include.am
|
include certs/include.am
|
||||||
include certs/1024/include.am
|
include certs/1024/include.am
|
||||||
include certs/crl/include.am
|
include certs/crl/include.am
|
||||||
@@ -69,9 +71,16 @@ include swig/include.am
|
|||||||
|
|
||||||
include src/include.am
|
include src/include.am
|
||||||
include support/include.am
|
include support/include.am
|
||||||
|
#-------------------------------------#
|
||||||
include ctaocrypt/benchmark/include.am
|
include ctaocrypt/benchmark/include.am
|
||||||
|
include wolfcrypt/benchmark/include.am
|
||||||
|
#-------------------------------------#
|
||||||
include ctaocrypt/src/include.am
|
include ctaocrypt/src/include.am
|
||||||
|
include wolfcrypt/src/include.am
|
||||||
|
#-------------------------------------#
|
||||||
include ctaocrypt/test/include.am
|
include ctaocrypt/test/include.am
|
||||||
|
include wolfcrypt/test/include.am
|
||||||
|
#-------------------------------------#
|
||||||
include examples/client/include.am
|
include examples/client/include.am
|
||||||
include examples/server/include.am
|
include examples/server/include.am
|
||||||
include examples/echoclient/include.am
|
include examples/echoclient/include.am
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#define CYASSL_MEMORY_H
|
#define CYASSL_MEMORY_H
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <wolfssl/wolfcrypt/memory.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
50
cyassl/ssl.h
50
cyassl/ssl.h
@@ -54,7 +54,7 @@
|
|||||||
/* redeclare guard */
|
/* redeclare guard */
|
||||||
#define CYASSL_TYPES_DEFINED WOLFSSL_TYPES_DEFINED
|
#define CYASSL_TYPES_DEFINED WOLFSSL_TYPES_DEFINED
|
||||||
|
|
||||||
|
/* structs */
|
||||||
#define CYASSL_EVP_PKEY WOLFSSL_EVP_PKEY
|
#define CYASSL_EVP_PKEY WOLFSSL_EVP_PKEY
|
||||||
#define CYASSL_RSA WOLFSSL_RSA
|
#define CYASSL_RSA WOLFSSL_RSA
|
||||||
#define CYASSL_DSA WOLFSSL_DSA
|
#define CYASSL_DSA WOLFSSL_DSA
|
||||||
@@ -81,25 +81,26 @@
|
|||||||
#define CYASSL_X509_STORE_CTX WOLFSSL_X509_STORE_CTX
|
#define CYASSL_X509_STORE_CTX WOLFSSL_X509_STORE_CTX
|
||||||
|
|
||||||
/* src/ssl.c */
|
/* src/ssl.c */
|
||||||
#define CYASSL_CLIENT_END WOLFSSL_CLIENT_END
|
#define CYASSL_CLIENT_END WOLFSSL_CLIENT_END
|
||||||
#define CYASSL_CERT_MANAGER WOLFSSL_CERT_MANAGER
|
#define CYASSL_CERT_MANAGER WOLFSSL_CERT_MANAGER
|
||||||
#define CYASSL_USER_CA WOLFSSL_USER_CA
|
#define CYASSL_USER_CA WOLFSSL_USER_CA
|
||||||
#define CYASSL_TLSV1 WOLFSSL_TLSV1
|
#define CYASSL_TLSV1 WOLFSSL_TLSV1
|
||||||
#define CYASSL_TLSV1_1 WOLFSSL_TLSV1_1
|
#define CYASSL_TLSV1_1 WOLFSSL_TLSV1_1
|
||||||
#define CYASSL_TLSV1_2 WOLFSSL_TLSV1_2
|
#define CYASSL_TLSV1_2 WOLFSSL_TLSV1_2
|
||||||
#define CYASSL_SSLV3 WOLFSSL_SSLV3
|
#define CYASSL_SSLV3 WOLFSSL_SSLV3
|
||||||
#define CyaSSL_session_reused wolfSSL_session_reused
|
#define CyaSSL_session_reused wolfSSL_session_reused
|
||||||
#define CyaSSL_get_version wolfSSL_get_version
|
#define CyaSSL_get_version wolfSSL_get_version
|
||||||
#define CyaSSL_get_shutdown wolfSSL_get_shutdown
|
#define CyaSSL_get_shutdown wolfSSL_get_shutdown
|
||||||
#define CyaSSL_is_init_finished wolfSSL_is_init_finished
|
#define CyaSSL_is_init_finished wolfSSL_is_init_finished
|
||||||
#define CyaSSL_CTX_UnloadCAs wolfSSL_CTX_UnloadCAs
|
#define CyaSSL_CTX_UnloadCAs wolfSSL_CTX_UnloadCAs
|
||||||
#define CyaSSL_UnloadCertsKeys wolfSSL_UnloadCertsKeys
|
#define CyaSSL_UnloadCertsKeys wolfSSL_UnloadCertsKeys
|
||||||
#define CyaSSL_SetServerID wolfSSL_SetServerID
|
#define CyaSSL_SetServerID wolfSSL_SetServerID
|
||||||
#define CyaSSL_SetCertCbCtx wolfSSL_SetCertCbCtx
|
#define CyaSSL_SetCertCbCtx wolfSSL_SetCertCbCtx
|
||||||
#define CyaSSL_CTX_check_private_key wolfSSL_CTX_check_private_key
|
#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_current_cipher_suite wolfSSL_get_current_cipher_suite
|
||||||
#define CyaSSL_get_cipher wolfSSL_get_cipher
|
#define CyaSSL_get_cipher wolfSSL_get_cipher
|
||||||
#define CyaSSL_CIPHER_get_name wolfSSL_CIPHER_get_name
|
#define CyaSSL_CIPHER_get_name wolfSSL_CIPHER_get_name
|
||||||
|
#define CyaSSL_get_current_cipher wolfSSL_get_current_cipher
|
||||||
|
|
||||||
/* io.c */
|
/* io.c */
|
||||||
#define CYASSL_CBIO_ERR_CONN_CLOSE WOLFSSL_CBIO_ERR_CONN_CLOSE
|
#define CYASSL_CBIO_ERR_CONN_CLOSE WOLFSSL_CBIO_ERR_CONN_CLOSE
|
||||||
@@ -112,11 +113,11 @@
|
|||||||
#define CYASSL_CBIO_ERR_TIMEOUT WOLFSSL_CBIO_ERR_TIMEOUT
|
#define CYASSL_CBIO_ERR_TIMEOUT WOLFSSL_CBIO_ERR_TIMEOUT
|
||||||
|
|
||||||
/* src/tls.c */
|
/* src/tls.c */
|
||||||
#define CYASSL_SERVER_END WOLFSSL_SERVER_END
|
#define CYASSL_SERVER_END WOLFSSL_SERVER_END
|
||||||
#define CYASSL_TLS_HMAC_INNER_SZ WOLFSSL_TLS_HMAC_INNER_SZ
|
#define CYASSL_TLS_HMAC_INNER_SZ WOLFSSL_TLS_HMAC_INNER_SZ
|
||||||
#define CyaSSL_make_eap_keys wolfSSL_make_eap_keys
|
#define CyaSSL_make_eap_keys wolfSSL_make_eap_keys
|
||||||
#define CyaSSL_MakeTlsMasterSecret wolfSSL_MakeTlsMasterSecret
|
#define CyaSSL_MakeTlsMasterSecret wolfSSL_MakeTlsMasterSecret
|
||||||
#define CyaSSL_DeriveTlsKeys wolfSSL_DeriveTlsKeys
|
#define CyaSSL_DeriveTlsKeys wolfSSL_DeriveTlsKeys
|
||||||
|
|
||||||
/* internal.c */
|
/* internal.c */
|
||||||
#define CyaSSL_ERR_reason_error_string wolfSSL_ERR_reason_error_string
|
#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_CBIO_ERR_CONN_RST WOLFSSL_CBIO_ERR_CONN_RST
|
||||||
#define CYASSL_ALERT_HISTORY WOLFSSL_ALERT_HISTORY
|
#define CYASSL_ALERT_HISTORY WOLFSSL_ALERT_HISTORY
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Initialization and Shutdown */
|
/* Initialization and Shutdown */
|
||||||
#define CyaSSL_Init wolfSSL_Init
|
#define CyaSSL_Init wolfSSL_Init
|
||||||
#define CyaSSL_library_init wolfSSL_library_init
|
#define CyaSSL_library_init wolfSSL_library_init
|
||||||
|
1594
wolfcrypt/benchmark/benchmark.c
Normal file
1594
wolfcrypt/benchmark/benchmark.c
Normal file
File diff suppressed because it is too large
Load Diff
20
wolfcrypt/benchmark/benchmark.sln
Executable file
20
wolfcrypt/benchmark/benchmark.sln
Executable 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
|
195
wolfcrypt/benchmark/benchmark.vcproj
Executable file
195
wolfcrypt/benchmark/benchmark.vcproj
Executable 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>
|
10
wolfcrypt/benchmark/include.am
Normal file
10
wolfcrypt/benchmark/include.am
Normal 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
|
10
wolfcrypt/benchmark/include.am~
Normal file
10
wolfcrypt/benchmark/include.am~
Normal 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
11
wolfcrypt/test/include.am
Normal 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
|
11
wolfcrypt/test/include.am~
Normal file
11
wolfcrypt/test/include.am~
Normal 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
5293
wolfcrypt/test/test.c
Normal file
File diff suppressed because it is too large
Load Diff
33
wolfcrypt/test/test.h
Normal file
33
wolfcrypt/test/test.h
Normal 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
20
wolfcrypt/test/test.sln
Executable 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
195
wolfcrypt/test/test.vcproj
Executable 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>
|
288
wolfssl/test.h
288
wolfssl/test.h
@@ -1,7 +1,7 @@
|
|||||||
/* test.h */
|
/* test.h */
|
||||||
|
|
||||||
#ifndef CyaSSL_TEST_H
|
#ifndef wolfSSL_TEST_H
|
||||||
#define CyaSSL_TEST_H
|
#define wolfSSL_TEST_H
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -33,9 +33,9 @@
|
|||||||
#endif
|
#endif
|
||||||
#define SOCKET_T SOCKET
|
#define SOCKET_T SOCKET
|
||||||
#define SNPRINTF _snprintf
|
#define SNPRINTF _snprintf
|
||||||
#elif defined(CYASSL_MDK_ARM)
|
#elif defined(WOLFSSL_MDK_ARM)
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#elif defined(CYASSL_TIRTOS)
|
#elif defined(WOLFSSL_TIRTOS)
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
#else
|
#else
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifndef CYASSL_LEANPSK
|
#ifndef WOLFSSL_LEANPSK
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
@@ -90,7 +90,7 @@
|
|||||||
|
|
||||||
/* HPUX doesn't use socklent_t for third parameter to accept, unless
|
/* HPUX doesn't use socklent_t for third parameter to accept, unless
|
||||||
_XOPEN_SOURCE_EXTENDED is defined */
|
_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;
|
typedef socklen_t* ACCEPT_THIRD_T;
|
||||||
#else
|
#else
|
||||||
#if defined _XOPEN_SOURCE_EXTENDED
|
#if defined _XOPEN_SOURCE_EXTENDED
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
#ifdef USE_WINDOWS_API
|
#ifdef USE_WINDOWS_API
|
||||||
#define CloseSocket(s) closesocket(s)
|
#define CloseSocket(s) closesocket(s)
|
||||||
#define StartTCP() { WSADATA wsd; WSAStartup(0x0002, &wsd); }
|
#define StartTCP() { WSADATA wsd; WSAStartup(0x0002, &wsd); }
|
||||||
#elif defined(CYASSL_MDK_ARM)
|
#elif defined(WOLFSSL_MDK_ARM)
|
||||||
#define CloseSocket(s) closesocket(s)
|
#define CloseSocket(s) closesocket(s)
|
||||||
#define StartTCP()
|
#define StartTCP()
|
||||||
#else
|
#else
|
||||||
@@ -116,26 +116,26 @@
|
|||||||
#ifdef SINGLE_THREADED
|
#ifdef SINGLE_THREADED
|
||||||
typedef unsigned int THREAD_RETURN;
|
typedef unsigned int THREAD_RETURN;
|
||||||
typedef void* THREAD_TYPE;
|
typedef void* THREAD_TYPE;
|
||||||
#define CYASSL_THREAD
|
#define WOLFSSL_THREAD
|
||||||
#else
|
#else
|
||||||
#if defined(_POSIX_THREADS) && !defined(__MINGW32__)
|
#if defined(_POSIX_THREADS) && !defined(__MINGW32__)
|
||||||
typedef void* THREAD_RETURN;
|
typedef void* THREAD_RETURN;
|
||||||
typedef pthread_t THREAD_TYPE;
|
typedef pthread_t THREAD_TYPE;
|
||||||
#define CYASSL_THREAD
|
#define WOLFSSL_THREAD
|
||||||
#define INFINITE -1
|
#define INFINITE -1
|
||||||
#define WAIT_OBJECT_0 0L
|
#define WAIT_OBJECT_0 0L
|
||||||
#elif defined(CYASSL_MDK_ARM)
|
#elif defined(WOLFSSL_MDK_ARM)
|
||||||
typedef unsigned int THREAD_RETURN;
|
typedef unsigned int THREAD_RETURN;
|
||||||
typedef int THREAD_TYPE;
|
typedef int THREAD_TYPE;
|
||||||
#define CYASSL_THREAD
|
#define WOLFSSL_THREAD
|
||||||
#elif defined(CYASSL_TIRTOS)
|
#elif defined(WOLFSSL_TIRTOS)
|
||||||
typedef void THREAD_RETURN;
|
typedef void THREAD_RETURN;
|
||||||
typedef Task_Handle THREAD_TYPE;
|
typedef Task_Handle THREAD_TYPE;
|
||||||
#define CYASSL_THREAD
|
#define WOLFSSL_THREAD
|
||||||
#else
|
#else
|
||||||
typedef unsigned int THREAD_RETURN;
|
typedef unsigned int THREAD_RETURN;
|
||||||
typedef intptr_t THREAD_TYPE;
|
typedef intptr_t THREAD_TYPE;
|
||||||
#define CYASSL_THREAD __stdcall
|
#define WOLFSSL_THREAD __stdcall
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -156,7 +156,7 @@
|
|||||||
#define CLIENT_DTLS_DEFAULT_VERSION (-2)
|
#define CLIENT_DTLS_DEFAULT_VERSION (-2)
|
||||||
#define CLIENT_INVALID_VERSION (-99)
|
#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 caCert "./certs/ca-cert.pem"
|
||||||
#define eccCert "./certs/server-ecc.pem"
|
#define eccCert "./certs/server-ecc.pem"
|
||||||
#define eccKey "./certs/ecc-key.pem"
|
#define eccKey "./certs/ecc-key.pem"
|
||||||
@@ -184,9 +184,9 @@ typedef struct tcp_ready {
|
|||||||
void InitTcpReady(tcp_ready*);
|
void InitTcpReady(tcp_ready*);
|
||||||
void FreeTcpReady(tcp_ready*);
|
void FreeTcpReady(tcp_ready*);
|
||||||
|
|
||||||
typedef CYASSL_METHOD* (*method_provider)(void);
|
typedef WOLFSSL_METHOD* (*method_provider)(void);
|
||||||
typedef void (*ctx_callback)(CYASSL_CTX* ctx);
|
typedef void (*ctx_callback)(WOLFSSL_CTX* ctx);
|
||||||
typedef void (*ssl_callback)(CYASSL* ssl);
|
typedef void (*ssl_callback)(WOLFSSL* ssl);
|
||||||
|
|
||||||
typedef struct callback_functions {
|
typedef struct callback_functions {
|
||||||
method_provider method;
|
method_provider method;
|
||||||
@@ -205,7 +205,7 @@ typedef struct func_args {
|
|||||||
|
|
||||||
void wait_tcp_ready(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 start_thread(THREAD_FUNC, func_args*, THREAD_TYPE*);
|
||||||
void join_thread(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)
|
#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* altName;
|
||||||
char* issuer = CyaSSL_X509_NAME_oneline(
|
char* issuer = wolfSSL_X509_NAME_oneline(
|
||||||
CyaSSL_X509_get_issuer_name(x509), 0, 0);
|
wolfSSL_X509_get_issuer_name(x509), 0, 0);
|
||||||
char* subject = CyaSSL_X509_NAME_oneline(
|
char* subject = wolfSSL_X509_NAME_oneline(
|
||||||
CyaSSL_X509_get_subject_name(x509), 0, 0);
|
wolfSSL_X509_get_subject_name(x509), 0, 0);
|
||||||
byte serial[32];
|
byte serial[32];
|
||||||
int ret;
|
int ret;
|
||||||
int sz = sizeof(serial);
|
int sz = sizeof(serial);
|
||||||
|
|
||||||
printf("%s\n issuer : %s\n subject: %s\n", hdr, issuer, subject);
|
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);
|
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) {
|
if (ret == SSL_SUCCESS) {
|
||||||
int i;
|
int i;
|
||||||
int strLen;
|
int strLen;
|
||||||
@@ -347,43 +347,43 @@ static INLINE void ShowX509(CYASSL_X509* x509, const char* hdr)
|
|||||||
#endif /* KEEP_PEER_CERT || SESSION_CERTS */
|
#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
|
#ifdef KEEP_PEER_CERT
|
||||||
CYASSL_X509* peer = CyaSSL_get_peer_certificate(ssl);
|
WOLFSSL_X509* peer = wolfSSL_get_peer_certificate(ssl);
|
||||||
if (peer)
|
if (peer)
|
||||||
ShowX509(peer, "peer's cert info:");
|
ShowX509(peer, "peer's cert info:");
|
||||||
else
|
else
|
||||||
printf("peer has no cert!\n");
|
printf("peer has no cert!\n");
|
||||||
#endif
|
#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);
|
cipher = wolfSSL_get_current_cipher(ssl);
|
||||||
printf("SSL cipher suite is %s\n", CyaSSL_CIPHER_get_name(cipher));
|
printf("SSL cipher suite is %s\n", wolfSSL_CIPHER_get_name(cipher));
|
||||||
|
|
||||||
#if defined(SESSION_CERTS) && defined(SHOW_CERTS)
|
#if defined(SESSION_CERTS) && defined(SHOW_CERTS)
|
||||||
{
|
{
|
||||||
CYASSL_X509_CHAIN* chain = CyaSSL_get_peer_chain(ssl);
|
WOLFSSL_X509_CHAIN* chain = wolfSSL_get_peer_chain(ssl);
|
||||||
int count = CyaSSL_get_chain_count(chain);
|
int count = wolfSSL_get_chain_count(chain);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
int length;
|
int length;
|
||||||
unsigned char buffer[3072];
|
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;
|
buffer[length] = 0;
|
||||||
printf("cert %d has length %d data = \n%s\n", i, length, buffer);
|
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)
|
if (chainX509)
|
||||||
ShowX509(chainX509, "session cert info:");
|
ShowX509(chainX509, "session cert info:");
|
||||||
else
|
else
|
||||||
printf("get_chain_X509 failed\n");
|
printf("get_chain_X509 failed\n");
|
||||||
CyaSSL_FreeX509(chainX509);
|
wolfSSL_FreeX509(chainX509);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -403,7 +403,7 @@ static INLINE void build_addr(SOCKADDR_IN_T* addr, const char* peer,
|
|||||||
#ifndef TEST_IPV6
|
#ifndef TEST_IPV6
|
||||||
/* peer could be in human readable form */
|
/* peer could be in human readable form */
|
||||||
if ( (peer != INADDR_ANY) && isalpha((int)peer[0])) {
|
if ( (peer != INADDR_ANY) && isalpha((int)peer[0])) {
|
||||||
#ifdef CYASSL_MDK_ARM
|
#ifdef WOLFSSL_MDK_ARM
|
||||||
int err;
|
int err;
|
||||||
struct hostent* entry = gethostbyname(peer, &err);
|
struct hostent* entry = gethostbyname(peer, &err);
|
||||||
#else
|
#else
|
||||||
@@ -422,7 +422,7 @@ static INLINE void build_addr(SOCKADDR_IN_T* addr, const char* peer,
|
|||||||
|
|
||||||
|
|
||||||
#ifndef TEST_IPV6
|
#ifndef TEST_IPV6
|
||||||
#if defined(CYASSL_MDK_ARM)
|
#if defined(WOLFSSL_MDK_ARM)
|
||||||
addr->sin_family = PF_INET;
|
addr->sin_family = PF_INET;
|
||||||
#else
|
#else
|
||||||
addr->sin_family = AF_INET_V;
|
addr->sin_family = AF_INET_V;
|
||||||
@@ -480,7 +480,7 @@ static INLINE void tcp_socket(SOCKET_T* sockfd, int udp)
|
|||||||
#ifdef USE_WINDOWS_API
|
#ifdef USE_WINDOWS_API
|
||||||
if (*sockfd == INVALID_SOCKET)
|
if (*sockfd == INVALID_SOCKET)
|
||||||
err_sys("socket failed\n");
|
err_sys("socket failed\n");
|
||||||
#elif defined(CYASSL_TIRTOS)
|
#elif defined(WOLFSSL_TIRTOS)
|
||||||
if (*sockfd == -1)
|
if (*sockfd == -1)
|
||||||
err_sys("socket failed\n");
|
err_sys("socket failed\n");
|
||||||
#else
|
#else
|
||||||
@@ -497,7 +497,7 @@ static INLINE void tcp_socket(SOCKET_T* sockfd, int udp)
|
|||||||
if (res < 0)
|
if (res < 0)
|
||||||
err_sys("setsockopt SO_NOSIGPIPE failed\n");
|
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 */
|
/* nothing to define */
|
||||||
#else /* no S_NOSIGPIPE */
|
#else /* no S_NOSIGPIPE */
|
||||||
signal(SIGPIPE, SIG_IGN);
|
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)
|
static INLINE int tcp_select(SOCKET_T socketfd, int to_sec)
|
||||||
{
|
{
|
||||||
fd_set recvfds, errfds;
|
fd_set recvfds, errfds;
|
||||||
@@ -571,12 +571,12 @@ static INLINE int tcp_select(SOCKET_T socketfd, int to_sec)
|
|||||||
|
|
||||||
return TEST_SELECT_FAIL;
|
return TEST_SELECT_FAIL;
|
||||||
}
|
}
|
||||||
#elif defined(CYASSL_TIRTOS)
|
#elif defined(WOLFSSL_TIRTOS)
|
||||||
static INLINE int tcp_select(SOCKET_T socketfd, int to_sec)
|
static INLINE int tcp_select(SOCKET_T socketfd, int to_sec)
|
||||||
{
|
{
|
||||||
return TEST_RECV_READY;
|
return TEST_RECV_READY;
|
||||||
}
|
}
|
||||||
#endif /* !CYASSL_MDK_ARM */
|
#endif /* !WOLFSSL_MDK_ARM */
|
||||||
|
|
||||||
|
|
||||||
static INLINE void tcp_listen(SOCKET_T* sockfd, word16* port, int useAnyAddr,
|
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);
|
build_addr(&addr, (useAnyAddr ? INADDR_ANY : yasslIP), *port, udp);
|
||||||
tcp_socket(sockfd, 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;
|
int res, on = 1;
|
||||||
socklen_t len = sizeof(on);
|
socklen_t len = sizeof(on);
|
||||||
@@ -650,7 +650,7 @@ static INLINE void udp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd,
|
|||||||
tcp_socket(sockfd, 1);
|
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;
|
int res, on = 1;
|
||||||
socklen_t len = sizeof(on);
|
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_cond_signal(&ready->cond);
|
||||||
pthread_mutex_unlock(&ready->mutex);
|
pthread_mutex_unlock(&ready->mutex);
|
||||||
}
|
}
|
||||||
#elif defined (CYASSL_TIRTOS)
|
#elif defined (WOLFSSL_TIRTOS)
|
||||||
/* Need mutex? */
|
/* Need mutex? */
|
||||||
tcp_ready* ready = args->signal;
|
tcp_ready* ready = args->signal;
|
||||||
ready->ready = 1;
|
ready->ready = 1;
|
||||||
@@ -720,7 +720,7 @@ static INLINE void tcp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd,
|
|||||||
pthread_cond_signal(&ready->cond);
|
pthread_cond_signal(&ready->cond);
|
||||||
pthread_mutex_unlock(&ready->mutex);
|
pthread_mutex_unlock(&ready->mutex);
|
||||||
}
|
}
|
||||||
#elif defined (CYASSL_TIRTOS)
|
#elif defined (WOLFSSL_TIRTOS)
|
||||||
/* Need mutex? */
|
/* Need mutex? */
|
||||||
tcp_ready* ready = args->signal;
|
tcp_ready* ready = args->signal;
|
||||||
ready->ready = 1;
|
ready->ready = 1;
|
||||||
@@ -757,7 +757,7 @@ static INLINE void tcp_set_nonblocking(SOCKET_T* sockfd)
|
|||||||
int ret = ioctlsocket(*sockfd, FIONBIO, &blocking);
|
int ret = ioctlsocket(*sockfd, FIONBIO, &blocking);
|
||||||
if (ret == SOCKET_ERROR)
|
if (ret == SOCKET_ERROR)
|
||||||
err_sys("ioctlsocket failed");
|
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 */
|
/* non blocking not suppported, for now */
|
||||||
#else
|
#else
|
||||||
int flags = fcntl(*sockfd, F_GETFL, 0);
|
int flags = fcntl(*sockfd, F_GETFL, 0);
|
||||||
@@ -772,7 +772,7 @@ static INLINE void tcp_set_nonblocking(SOCKET_T* sockfd)
|
|||||||
|
|
||||||
#ifndef NO_PSK
|
#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,
|
char* identity, unsigned int id_max_len, unsigned char* key,
|
||||||
unsigned int key_max_len)
|
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)
|
unsigned char* key, unsigned int key_max_len)
|
||||||
{
|
{
|
||||||
(void)ssl;
|
(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;
|
return (double)count.QuadPart / freq.QuadPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(CYASSL_TIRTOS)
|
#elif defined(WOLFSSL_TIRTOS)
|
||||||
extern double current_time();
|
extern double current_time();
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#if !defined(CYASSL_MDK_ARM)
|
#if !defined(WOLFSSL_MDK_ARM)
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
static INLINE double current_time(void)
|
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)
|
#if defined(NO_FILESYSTEM) && !defined(NO_CERTS)
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
CYASSL_CA = 1,
|
WOLFSSL_CA = 1,
|
||||||
CYASSL_CERT = 2,
|
WOLFSSL_CERT = 2,
|
||||||
CYASSL_KEY = 3
|
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 */
|
/* test buffer load */
|
||||||
long sz = 0;
|
long sz = 0;
|
||||||
@@ -876,24 +876,24 @@ static INLINE unsigned int my_psk_server_cb(CYASSL* ssl, const char* identity,
|
|||||||
|
|
||||||
if (!file)
|
if (!file)
|
||||||
err_sys("can't open file for buffer load "
|
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);
|
fseek(file, 0, SEEK_END);
|
||||||
sz = ftell(file);
|
sz = ftell(file);
|
||||||
rewind(file);
|
rewind(file);
|
||||||
fread(buff, sizeof(buff), 1, file);
|
fread(buff, sizeof(buff), 1, file);
|
||||||
|
|
||||||
if (type == CYASSL_CA) {
|
if (type == WOLFSSL_CA) {
|
||||||
if (CyaSSL_CTX_load_verify_buffer(ctx, buff, sz, SSL_FILETYPE_PEM)
|
if (wolfSSL_CTX_load_verify_buffer(ctx, buff, sz, SSL_FILETYPE_PEM)
|
||||||
!= SSL_SUCCESS)
|
!= SSL_SUCCESS)
|
||||||
err_sys("can't load buffer ca file");
|
err_sys("can't load buffer ca file");
|
||||||
}
|
}
|
||||||
else if (type == CYASSL_CERT) {
|
else if (type == WOLFSSL_CERT) {
|
||||||
if (CyaSSL_CTX_use_certificate_buffer(ctx, buff, sz,
|
if (wolfSSL_CTX_use_certificate_buffer(ctx, buff, sz,
|
||||||
SSL_FILETYPE_PEM) != SSL_SUCCESS)
|
SSL_FILETYPE_PEM) != SSL_SUCCESS)
|
||||||
err_sys("can't load buffer cert file");
|
err_sys("can't load buffer cert file");
|
||||||
}
|
}
|
||||||
else if (type == CYASSL_KEY) {
|
else if (type == WOLFSSL_KEY) {
|
||||||
if (CyaSSL_CTX_use_PrivateKey_buffer(ctx, buff, sz,
|
if (wolfSSL_CTX_use_PrivateKey_buffer(ctx, buff, sz,
|
||||||
SSL_FILETYPE_PEM) != SSL_SUCCESS)
|
SSL_FILETYPE_PEM) != SSL_SUCCESS)
|
||||||
err_sys("can't load buffer key file");
|
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
|
#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;
|
(void)preverify;
|
||||||
char buffer[CYASSL_MAX_ERROR_SZ];
|
char buffer[WOLFSSL_MAX_ERROR_SZ];
|
||||||
|
|
||||||
#ifdef OPENSSL_EXTRA
|
#ifdef OPENSSL_EXTRA
|
||||||
CYASSL_X509* peer;
|
WOLFSSL_X509* peer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
printf("In verification callback, error = %d, %s\n", store->error,
|
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
|
#ifdef OPENSSL_EXTRA
|
||||||
peer = store->current_cert;
|
peer = store->current_cert;
|
||||||
if (peer) {
|
if (peer) {
|
||||||
char* issuer = CyaSSL_X509_NAME_oneline(
|
char* issuer = wolfSSL_X509_NAME_oneline(
|
||||||
CyaSSL_X509_get_issuer_name(peer), 0, 0);
|
wolfSSL_X509_get_issuer_name(peer), 0, 0);
|
||||||
char* subject = CyaSSL_X509_NAME_oneline(
|
char* subject = wolfSSL_X509_NAME_oneline(
|
||||||
CyaSSL_X509_get_subject_name(peer), 0, 0);
|
wolfSSL_X509_get_subject_name(peer), 0, 0);
|
||||||
printf("peer's cert info:\n issuer : %s\n subject: %s\n", issuer,
|
printf("peer's cert info:\n issuer : %s\n subject: %s\n", issuer,
|
||||||
subject);
|
subject);
|
||||||
XFREE(subject, 0, DYNAMIC_TYPE_OPENSSL);
|
XFREE(subject, 0, DYNAMIC_TYPE_OPENSSL);
|
||||||
@@ -938,13 +938,13 @@ static INLINE int myVerify(int preverify, CYASSL_X509_STORE_CTX* store)
|
|||||||
#endif /* VERIFY_CALLBACK */
|
#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;
|
(void)preverify;
|
||||||
|
|
||||||
printf("In verification callback, error = %d, %s\n", store->error,
|
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);
|
printf("Subject's domain name is %s\n", store->domain);
|
||||||
|
|
||||||
if (store->error == ASN_BEFORE_DATE_E || store->error == ASN_AFTER_DATE_E) {
|
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
|
#ifndef NO_DH
|
||||||
static INLINE void SetDH(CYASSL* ssl)
|
static INLINE void SetDH(WOLFSSL* ssl)
|
||||||
{
|
{
|
||||||
/* dh1024 p */
|
/* dh1024 p */
|
||||||
static unsigned char p[] =
|
static unsigned char p[] =
|
||||||
@@ -1000,10 +1000,10 @@ static INLINE void SetDH(CYASSL* ssl)
|
|||||||
0x02,
|
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 */
|
/* dh1024 p */
|
||||||
static unsigned char p[] =
|
static unsigned char p[] =
|
||||||
@@ -1027,7 +1027,7 @@ static INLINE void SetDHCtx(CYASSL_CTX* ctx)
|
|||||||
0x02,
|
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_DH */
|
||||||
#endif /* !NO_CERTS */
|
#endif /* !NO_CERTS */
|
||||||
@@ -1097,9 +1097,9 @@ static INLINE int CurrentDir(const char* str)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(CYASSL_MDK_ARM)
|
#elif defined(WOLFSSL_MDK_ARM)
|
||||||
/* KEIL-RL File System does not support relative directry */
|
/* KEIL-RL File System does not support relative directry */
|
||||||
#elif defined(CYASSL_TIRTOS)
|
#elif defined(WOLFSSL_TIRTOS)
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifndef MAX_PATH
|
#ifndef MAX_PATH
|
||||||
@@ -1152,7 +1152,7 @@ static INLINE int CurrentDir(const char* str)
|
|||||||
#endif /* USE_WINDOWS_API */
|
#endif /* USE_WINDOWS_API */
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_CYASSL_MEMORY
|
#ifdef USE_WOLFSSL_MEMORY
|
||||||
|
|
||||||
typedef struct memoryStats {
|
typedef struct memoryStats {
|
||||||
size_t totalAllocs; /* number of allocations */
|
size_t totalAllocs; /* number of allocations */
|
||||||
@@ -1173,7 +1173,7 @@ static INLINE int CurrentDir(const char* str)
|
|||||||
} u;
|
} u;
|
||||||
} memoryTrack;
|
} memoryTrack;
|
||||||
|
|
||||||
#if defined(CYASSL_TRACK_MEMORY)
|
#if defined(WOLFSSL_TRACK_MEMORY)
|
||||||
#define DO_MEM_STATS
|
#define DO_MEM_STATS
|
||||||
static memoryStats ourMemStats;
|
static memoryStats ourMemStats;
|
||||||
#endif
|
#endif
|
||||||
@@ -1246,8 +1246,8 @@ static INLINE int CurrentDir(const char* str)
|
|||||||
|
|
||||||
static INLINE void InitMemoryTracker(void)
|
static INLINE void InitMemoryTracker(void)
|
||||||
{
|
{
|
||||||
if (CyaSSL_SetAllocators(TrackMalloc, TrackFree, TrackRealloc) != 0)
|
if (wolfSSL_SetAllocators(TrackMalloc, TrackFree, TrackRealloc) != 0)
|
||||||
err_sys("CyaSSL SetAllocators failed for track memory");
|
err_sys("wolfSSL SetAllocators failed for track memory");
|
||||||
|
|
||||||
#ifdef DO_MEM_STATS
|
#ifdef DO_MEM_STATS
|
||||||
ourMemStats.totalAllocs = 0;
|
ourMemStats.totalAllocs = 0;
|
||||||
@@ -1271,12 +1271,12 @@ static INLINE int CurrentDir(const char* str)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* USE_CYASSL_MEMORY */
|
#endif /* USE_WOLFSSL_MEMORY */
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_STACK_SIZE
|
#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)
|
static INLINE void StackSizeCheck(func_args* args, thread_func tf)
|
||||||
@@ -1381,33 +1381,33 @@ typedef struct AtomicDecCtx {
|
|||||||
} 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,
|
const unsigned char* macIn, unsigned int macInSz, int macContent,
|
||||||
int macVerify, unsigned char* encOut, const unsigned char* encIn,
|
int macVerify, unsigned char* encOut, const unsigned char* encIn,
|
||||||
unsigned int encSz, void* ctx)
|
unsigned int encSz, void* ctx)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
Hmac hmac;
|
Hmac hmac;
|
||||||
byte myInner[CYASSL_TLS_HMAC_INNER_SZ];
|
byte myInner[WOLFSSL_TLS_HMAC_INNER_SZ];
|
||||||
AtomicEncCtx* encCtx = (AtomicEncCtx*)ctx;
|
AtomicEncCtx* encCtx = (AtomicEncCtx*)ctx;
|
||||||
const char* tlsStr = "TLS";
|
const char* tlsStr = "TLS";
|
||||||
|
|
||||||
/* example supports (d)tls aes */
|
/* example supports (d)tls aes */
|
||||||
if (CyaSSL_GetBulkCipher(ssl) != cyassl_aes) {
|
if (wolfSSL_GetBulkCipher(ssl) != cyassl_aes) {
|
||||||
printf("myMacEncryptCb not using AES\n");
|
printf("myMacEncryptCb not using AES\n");
|
||||||
return -1;
|
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");
|
printf("myMacEncryptCb not using (D)TLS\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* hmac, not needed if aead mode */
|
/* 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),
|
ret = HmacSetKey(&hmac, wolfSSL_GetHmacType(ssl),
|
||||||
CyaSSL_GetMacSecret(ssl, macVerify), CyaSSL_GetHmacSize(ssl));
|
wolfSSL_GetMacSecret(ssl, macVerify), wolfSSL_GetHmacSize(ssl));
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
ret = HmacUpdate(&hmac, myInner, sizeof(myInner));
|
ret = HmacUpdate(&hmac, myInner, sizeof(myInner));
|
||||||
@@ -1423,17 +1423,17 @@ static INLINE int myMacEncryptCb(CYASSL* ssl, unsigned char* macOut,
|
|||||||
|
|
||||||
/* encrypt setup on first time */
|
/* encrypt setup on first time */
|
||||||
if (encCtx->keySetup == 0) {
|
if (encCtx->keySetup == 0) {
|
||||||
int keyLen = CyaSSL_GetKeySize(ssl);
|
int keyLen = wolfSSL_GetKeySize(ssl);
|
||||||
const byte* key;
|
const byte* key;
|
||||||
const byte* iv;
|
const byte* iv;
|
||||||
|
|
||||||
if (CyaSSL_GetSide(ssl) == CYASSL_CLIENT_END) {
|
if (wolfSSL_GetSide(ssl) == WOLFSSL_CLIENT_END) {
|
||||||
key = CyaSSL_GetClientWriteKey(ssl);
|
key = wolfSSL_GetClientWriteKey(ssl);
|
||||||
iv = CyaSSL_GetClientWriteIV(ssl);
|
iv = wolfSSL_GetClientWriteIV(ssl);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
key = CyaSSL_GetServerWriteKey(ssl);
|
key = wolfSSL_GetServerWriteKey(ssl);
|
||||||
iv = CyaSSL_GetServerWriteIV(ssl);
|
iv = wolfSSL_GetServerWriteIV(ssl);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = AesSetKey(&encCtx->aes, key, keyLen, iv, AES_ENCRYPTION);
|
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 char* decOut, const unsigned char* decIn,
|
||||||
unsigned int decSz, int macContent, int macVerify,
|
unsigned int decSz, int macContent, int macVerify,
|
||||||
unsigned int* padSz, void* ctx)
|
unsigned int* padSz, void* ctx)
|
||||||
@@ -1458,39 +1458,39 @@ static INLINE int myDecryptVerifyCb(CYASSL* ssl,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
int macInSz = 0;
|
int macInSz = 0;
|
||||||
int ivExtra = 0;
|
int ivExtra = 0;
|
||||||
int digestSz = CyaSSL_GetHmacSize(ssl);
|
int digestSz = wolfSSL_GetHmacSize(ssl);
|
||||||
unsigned int pad = 0;
|
unsigned int pad = 0;
|
||||||
unsigned int padByte = 0;
|
unsigned int padByte = 0;
|
||||||
Hmac hmac;
|
Hmac hmac;
|
||||||
byte myInner[CYASSL_TLS_HMAC_INNER_SZ];
|
byte myInner[WOLFSSL_TLS_HMAC_INNER_SZ];
|
||||||
byte verify[MAX_DIGEST_SIZE];
|
byte verify[MAX_DIGEST_SIZE];
|
||||||
const char* tlsStr = "TLS";
|
const char* tlsStr = "TLS";
|
||||||
|
|
||||||
/* example supports (d)tls aes */
|
/* example supports (d)tls aes */
|
||||||
if (CyaSSL_GetBulkCipher(ssl) != cyassl_aes) {
|
if (wolfSSL_GetBulkCipher(ssl) != cyassl_aes) {
|
||||||
printf("myMacEncryptCb not using AES\n");
|
printf("myMacEncryptCb not using AES\n");
|
||||||
return -1;
|
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");
|
printf("myMacEncryptCb not using (D)TLS\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*decrypt */
|
/*decrypt */
|
||||||
if (decCtx->keySetup == 0) {
|
if (decCtx->keySetup == 0) {
|
||||||
int keyLen = CyaSSL_GetKeySize(ssl);
|
int keyLen = wolfSSL_GetKeySize(ssl);
|
||||||
const byte* key;
|
const byte* key;
|
||||||
const byte* iv;
|
const byte* iv;
|
||||||
|
|
||||||
/* decrypt is from other side (peer) */
|
/* decrypt is from other side (peer) */
|
||||||
if (CyaSSL_GetSide(ssl) == CYASSL_SERVER_END) {
|
if (wolfSSL_GetSide(ssl) == WOLFSSL_SERVER_END) {
|
||||||
key = CyaSSL_GetClientWriteKey(ssl);
|
key = wolfSSL_GetClientWriteKey(ssl);
|
||||||
iv = CyaSSL_GetClientWriteIV(ssl);
|
iv = wolfSSL_GetClientWriteIV(ssl);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
key = CyaSSL_GetServerWriteKey(ssl);
|
key = wolfSSL_GetServerWriteKey(ssl);
|
||||||
iv = CyaSSL_GetServerWriteIV(ssl);
|
iv = wolfSSL_GetServerWriteIV(ssl);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = AesSetKey(&decCtx->aes, key, keyLen, iv, AES_DECRYPTION);
|
ret = AesSetKey(&decCtx->aes, key, keyLen, iv, AES_DECRYPTION);
|
||||||
@@ -1504,25 +1504,25 @@ static INLINE int myDecryptVerifyCb(CYASSL* ssl,
|
|||||||
/* decrypt */
|
/* decrypt */
|
||||||
ret = AesCbcDecrypt(&decCtx->aes, decOut, decIn, decSz);
|
ret = AesCbcDecrypt(&decCtx->aes, decOut, decIn, decSz);
|
||||||
|
|
||||||
if (CyaSSL_GetCipherType(ssl) == CYASSL_AEAD_TYPE) {
|
if (wolfSSL_GetCipherType(ssl) == WOLFSSL_AEAD_TYPE) {
|
||||||
*padSz = CyaSSL_GetAeadMacSize(ssl);
|
*padSz = wolfSSL_GetAeadMacSize(ssl);
|
||||||
return 0; /* hmac, not needed if aead mode */
|
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);
|
pad = *(decOut + decSz - 1);
|
||||||
padByte = 1;
|
padByte = 1;
|
||||||
if (CyaSSL_IsTLSv1_1(ssl))
|
if (wolfSSL_IsTLSv1_1(ssl))
|
||||||
ivExtra = CyaSSL_GetCipherBlockSize(ssl);
|
ivExtra = wolfSSL_GetCipherBlockSize(ssl);
|
||||||
}
|
}
|
||||||
|
|
||||||
*padSz = CyaSSL_GetHmacSize(ssl) + pad + padByte;
|
*padSz = wolfSSL_GetHmacSize(ssl) + pad + padByte;
|
||||||
macInSz = decSz - ivExtra - digestSz - 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),
|
ret = HmacSetKey(&hmac, wolfSSL_GetHmacType(ssl),
|
||||||
CyaSSL_GetMacSecret(ssl, macVerify), digestSz);
|
wolfSSL_GetMacSecret(ssl, macVerify), digestSz);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
ret = HmacUpdate(&hmac, myInner, sizeof(myInner));
|
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;
|
AtomicEncCtx* encCtx;
|
||||||
AtomicDecCtx* decCtx;
|
AtomicDecCtx* decCtx;
|
||||||
@@ -1562,18 +1562,18 @@ static INLINE void SetupAtomicUser(CYASSL_CTX* ctx, CYASSL* ssl)
|
|||||||
}
|
}
|
||||||
memset(decCtx, 0, sizeof(AtomicDecCtx));
|
memset(decCtx, 0, sizeof(AtomicDecCtx));
|
||||||
|
|
||||||
CyaSSL_CTX_SetMacEncryptCb(ctx, myMacEncryptCb);
|
wolfSSL_CTX_SetMacEncryptCb(ctx, myMacEncryptCb);
|
||||||
CyaSSL_SetMacEncryptCtx(ssl, encCtx);
|
wolfSSL_SetMacEncryptCtx(ssl, encCtx);
|
||||||
|
|
||||||
CyaSSL_CTX_SetDecryptVerifyCb(ctx, myDecryptVerifyCb);
|
wolfSSL_CTX_SetDecryptVerifyCb(ctx, myDecryptVerifyCb);
|
||||||
CyaSSL_SetDecryptVerifyCtx(ssl, decCtx);
|
wolfSSL_SetDecryptVerifyCtx(ssl, decCtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static INLINE void FreeAtomicUser(CYASSL* ssl)
|
static INLINE void FreeAtomicUser(WOLFSSL* ssl)
|
||||||
{
|
{
|
||||||
AtomicEncCtx* encCtx = (AtomicEncCtx*)CyaSSL_GetMacEncryptCtx(ssl);
|
AtomicEncCtx* encCtx = (AtomicEncCtx*)wolfSSL_GetMacEncryptCtx(ssl);
|
||||||
AtomicDecCtx* decCtx = (AtomicDecCtx*)CyaSSL_GetDecryptVerifyCtx(ssl);
|
AtomicDecCtx* decCtx = (AtomicDecCtx*)wolfSSL_GetDecryptVerifyCtx(ssl);
|
||||||
|
|
||||||
free(decCtx);
|
free(decCtx);
|
||||||
free(encCtx);
|
free(encCtx);
|
||||||
@@ -1586,7 +1586,7 @@ static INLINE void FreeAtomicUser(CYASSL* ssl)
|
|||||||
|
|
||||||
#ifdef HAVE_ECC
|
#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)
|
byte* out, word32* outSz, const byte* key, word32 keySz, void* ctx)
|
||||||
{
|
{
|
||||||
RNG rng;
|
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,
|
const byte* hash, word32 hashSz, const byte* key, word32 keySz,
|
||||||
int* result, void* ctx)
|
int* result, void* ctx)
|
||||||
{
|
{
|
||||||
@@ -1636,7 +1636,7 @@ static INLINE int myEccVerify(CYASSL* ssl, const byte* sig, word32 sigSz,
|
|||||||
|
|
||||||
#ifndef NO_RSA
|
#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)
|
byte* out, word32* outSz, const byte* key, word32 keySz, void* ctx)
|
||||||
{
|
{
|
||||||
RNG rng;
|
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,
|
byte** out,
|
||||||
const byte* key, word32 keySz,
|
const byte* key, word32 keySz,
|
||||||
void* ctx)
|
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,
|
byte* out, word32* outSz, const byte* key,
|
||||||
word32 keySz, void* ctx)
|
word32 keySz, void* ctx)
|
||||||
{
|
{
|
||||||
@@ -1720,7 +1720,7 @@ static INLINE int myRsaEnc(CYASSL* ssl, const byte* in, word32 inSz,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE int myRsaDec(CYASSL* ssl, byte* in, word32 inSz,
|
static INLINE int myRsaDec(WOLFSSL* ssl, byte* in, word32 inSz,
|
||||||
byte** out,
|
byte** out,
|
||||||
const byte* key, word32 keySz, void* ctx)
|
const byte* key, word32 keySz, void* ctx)
|
||||||
{
|
{
|
||||||
@@ -1744,20 +1744,20 @@ static INLINE int myRsaDec(CYASSL* ssl, byte* in, word32 inSz,
|
|||||||
|
|
||||||
#endif /* NO_RSA */
|
#endif /* NO_RSA */
|
||||||
|
|
||||||
static INLINE void SetupPkCallbacks(CYASSL_CTX* ctx, CYASSL* ssl)
|
static INLINE void SetupPkCallbacks(WOLFSSL_CTX* ctx, WOLFSSL* ssl)
|
||||||
{
|
{
|
||||||
(void)ctx;
|
(void)ctx;
|
||||||
(void)ssl;
|
(void)ssl;
|
||||||
|
|
||||||
#ifdef HAVE_ECC
|
#ifdef HAVE_ECC
|
||||||
CyaSSL_CTX_SetEccSignCb(ctx, myEccSign);
|
wolfSSL_CTX_SetEccSignCb(ctx, myEccSign);
|
||||||
CyaSSL_CTX_SetEccVerifyCb(ctx, myEccVerify);
|
wolfSSL_CTX_SetEccVerifyCb(ctx, myEccVerify);
|
||||||
#endif /* HAVE_ECC */
|
#endif /* HAVE_ECC */
|
||||||
#ifndef NO_RSA
|
#ifndef NO_RSA
|
||||||
CyaSSL_CTX_SetRsaSignCb(ctx, myRsaSign);
|
wolfSSL_CTX_SetRsaSignCb(ctx, myRsaSign);
|
||||||
CyaSSL_CTX_SetRsaVerifyCb(ctx, myRsaVerify);
|
wolfSSL_CTX_SetRsaVerifyCb(ctx, myRsaVerify);
|
||||||
CyaSSL_CTX_SetRsaEncCb(ctx, myRsaEnc);
|
wolfSSL_CTX_SetRsaEncCb(ctx, myRsaEnc);
|
||||||
CyaSSL_CTX_SetRsaDecCb(ctx, myRsaDec);
|
wolfSSL_CTX_SetRsaDecCb(ctx, myRsaDec);
|
||||||
#endif /* NO_RSA */
|
#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 */
|
/* HP/UX doesn't have strsep, needed by test/suites.c */
|
||||||
static INLINE char* strsep(char **stringp, const char *delim)
|
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 /* __hpux__ */
|
||||||
|
|
||||||
#endif /* CyaSSL_TEST_H */
|
#endif /* wolfSSL_TEST_H */
|
||||||
|
|
||||||
|
@@ -4,44 +4,44 @@
|
|||||||
nobase_include_HEADERS+= \
|
nobase_include_HEADERS+= \
|
||||||
wolfssl/wolfcrypt/aes.h \
|
wolfssl/wolfcrypt/aes.h \
|
||||||
wolfssl/wolfcrypt/arc4.h \
|
wolfssl/wolfcrypt/arc4.h \
|
||||||
#wolfssl/wolfcrypt/asn.h \
|
wolfssl/wolfcrypt/asn.h \
|
||||||
#wolfssl/wolfcrypt/asn_public.h \
|
wolfssl/wolfcrypt/asn_public.h \
|
||||||
#wolfssl/wolfcrypt/poly1305.h \
|
wolfssl/wolfcrypt/poly1305.h \
|
||||||
wolfssl/wolfcrypt/camellia.h
|
wolfssl/wolfcrypt/camellia.h \
|
||||||
#wolfssl/wolfcrypt/coding.h \
|
wolfssl/wolfcrypt/coding.h \
|
||||||
#wolfssl/wolfcrypt/compress.h \
|
wolfssl/wolfcrypt/compress.h \
|
||||||
#wolfssl/wolfcrypt/des3.h \
|
wolfssl/wolfcrypt/des3.h \
|
||||||
#wolfssl/wolfcrypt/dh.h \
|
wolfssl/wolfcrypt/dh.h \
|
||||||
#wolfssl/wolfcrypt/dsa.h \
|
wolfssl/wolfcrypt/dsa.h \
|
||||||
#wolfssl/wolfcrypt/ecc.h \
|
wolfssl/wolfcrypt/ecc.h \
|
||||||
#wolfssl/wolfcrypt/error-crypt.h \
|
wolfssl/wolfcrypt/error-crypt.h \
|
||||||
#wolfssl/wolfcrypt/fips_test.h \
|
wolfssl/wolfcrypt/fips_test.h \
|
||||||
#wolfssl/wolfcrypt/hc128.h \
|
wolfssl/wolfcrypt/hc128.h \
|
||||||
#wolfssl/wolfcrypt/hmac.h \
|
wolfssl/wolfcrypt/hmac.h \
|
||||||
#wolfssl/wolfcrypt/integer.h \
|
wolfssl/wolfcrypt/integer.h \
|
||||||
#wolfssl/wolfcrypt/md2.h \
|
wolfssl/wolfcrypt/md2.h \
|
||||||
#wolfssl/wolfcrypt/md4.h \
|
wolfssl/wolfcrypt/md4.h \
|
||||||
#wolfssl/wolfcrypt/md5.h \
|
wolfssl/wolfcrypt/md5.h \
|
||||||
#wolfssl/wolfcrypt/misc.h \
|
wolfssl/wolfcrypt/misc.h \
|
||||||
#wolfssl/wolfcrypt/pkcs7.h \
|
wolfssl/wolfcrypt/pkcs7.h \
|
||||||
#wolfssl/wolfcrypt/wc_port.h \
|
wolfssl/wolfcrypt/wc_port.h \
|
||||||
#wolfssl/wolfcrypt/pwdbased.h \
|
wolfssl/wolfcrypt/pwdbased.h \
|
||||||
#wolfssl/wolfcrypt/rabbit.h \
|
wolfssl/wolfcrypt/rabbit.h \
|
||||||
#wolfssl/wolfcrypt/chacha.h \
|
wolfssl/wolfcrypt/chacha.h \
|
||||||
#wolfssl/wolfcrypt/random.h \
|
wolfssl/wolfcrypt/random.h \
|
||||||
#wolfssl/wolfcrypt/ripemd.h \
|
wolfssl/wolfcrypt/ripemd.h \
|
||||||
#wolfssl/wolfcrypt/rsa.h \
|
wolfssl/wolfcrypt/rsa.h \
|
||||||
#wolfssl/wolfcrypt/settings.h \
|
wolfssl/wolfcrypt/settings.h \
|
||||||
#wolfssl/wolfcrypt/sha256.h \
|
wolfssl/wolfcrypt/sha256.h \
|
||||||
#wolfssl/wolfcrypt/sha512.h \
|
wolfssl/wolfcrypt/sha512.h \
|
||||||
#wolfssl/wolfcrypt/sha.h \
|
wolfssl/wolfcrypt/sha.h \
|
||||||
#wolfssl/wolfcrypt/blake2.h \
|
wolfssl/wolfcrypt/blake2.h \
|
||||||
#wolfssl/wolfcrypt/blake2-int.h \
|
wolfssl/wolfcrypt/blake2-int.h \
|
||||||
#wolfssl/wolfcrypt/blake2-impl.h \
|
wolfssl/wolfcrypt/blake2-impl.h \
|
||||||
#wolfssl/wolfcrypt/tfm.h \
|
wolfssl/wolfcrypt/tfm.h \
|
||||||
#wolfssl/wolfcrypt/types.h \
|
wolfssl/wolfcrypt/types.h \
|
||||||
#wolfssl/wolfcrypt/visibility.h \
|
wolfssl/wolfcrypt/visibility.h \
|
||||||
#wolfssl/wolfcrypt/logging.h \
|
wolfssl/wolfcrypt/logging.h \
|
||||||
#wolfssl/wolfcrypt/memory.h \
|
wolfssl/wolfcrypt/memory.h \
|
||||||
#wolfssl/wolfcrypt/mpi_class.h \
|
wolfssl/wolfcrypt/mpi_class.h \
|
||||||
#wolfssl/wolfcrypt/mpi_superclass.h
|
wolfssl/wolfcrypt/mpi_superclass.h
|
||||||
|
@@ -2,14 +2,14 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (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
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
@@ -20,11 +20,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef CTAO_CRYPT_TYPES_H
|
#ifndef WOLF_CRYPT_TYPES_H
|
||||||
#define CTAO_CRYPT_TYPES_H
|
#define WOLF_CRYPT_TYPES_H
|
||||||
|
|
||||||
#include <cyassl/ctaocrypt/settings.h>
|
#include <wolfssl/wolfcrypt/settings.h>
|
||||||
#include <cyassl/ctaocrypt/wc_port.h>
|
#include <wolfssl/wolfcrypt/wc_port.h>
|
||||||
|
|
||||||
|
/* wolfssl_cyassl compatibility layer */
|
||||||
|
#include <cyassl/ssl.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -92,18 +95,18 @@
|
|||||||
#else
|
#else
|
||||||
typedef word32 cyassl_word;
|
typedef word32 cyassl_word;
|
||||||
#ifdef WORD64_AVAILABLE
|
#ifdef WORD64_AVAILABLE
|
||||||
#define CTAOCRYPT_SLOW_WORD64
|
#define WOLFCRYPT_SLOW_WORD64
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
CYASSL_WORD_SIZE = sizeof(cyassl_word),
|
WOLFSSL_WORD_SIZE = sizeof(cyassl_word),
|
||||||
CYASSL_BIT_SIZE = 8,
|
WOLFSSL_BIT_SIZE = 8,
|
||||||
CYASSL_WORD_BITS = CYASSL_WORD_SIZE * CYASSL_BIT_SIZE
|
WOLFSSL_WORD_BITS = WOLFSSL_WORD_SIZE * WOLFSSL_BIT_SIZE
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CYASSL_MAX_16BIT 0xffffU
|
#define WOLFSSL_MAX_16BIT 0xffffU
|
||||||
|
|
||||||
/* use inlining if compiler allows */
|
/* use inlining if compiler allows */
|
||||||
#ifndef INLINE
|
#ifndef INLINE
|
||||||
@@ -168,20 +171,20 @@ enum {
|
|||||||
extern void *XMALLOC(size_t n, void* heap, int type);
|
extern void *XMALLOC(size_t n, void* heap, int type);
|
||||||
extern void *XREALLOC(void *p, 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);
|
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 */
|
/* just use plain C stdlib stuff if desired */
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#define XMALLOC(s, h, t) ((void)h, (void)t, malloc((s)))
|
#define XMALLOC(s, h, t) ((void)h, (void)t, malloc((s)))
|
||||||
#define XFREE(p, h, t) {void* xp = (p); if((xp)) free((xp));}
|
#define XFREE(p, h, t) {void* xp = (p); if((xp)) free((xp));}
|
||||||
#define XREALLOC(p, n, h, t) realloc((p), (n))
|
#define XREALLOC(p, n, h, t) realloc((p), (n))
|
||||||
#elif !defined(MICRIUM_MALLOC) && !defined(EBSNET) \
|
#elif !defined(MICRIUM_MALLOC) && !defined(EBSNET) \
|
||||||
&& !defined(CYASSL_SAFERTOS) && !defined(FREESCALE_MQX) \
|
&& !defined(WOLFSSL_SAFERTOS) && !defined(FREESCALE_MQX) \
|
||||||
&& !defined(CYASSL_LEANPSK)
|
&& !defined(WOLFSSL_LEANPSK)
|
||||||
/* default C runtime, can install different routines at runtime via cbs */
|
/* default C runtime, can install different routines at runtime via cbs */
|
||||||
#include <cyassl/ctaocrypt/memory.h>
|
#include <cyassl/ctaocrypt/memory.h>
|
||||||
#define XMALLOC(s, h, t) ((void)h, (void)t, CyaSSL_Malloc((s)))
|
#define XMALLOC(s, h, t) ((void)h, (void)t, wolfSSL_Malloc((s)))
|
||||||
#define XFREE(p, h, t) {void* xp = (p); if((xp)) CyaSSL_Free((xp));}
|
#define XFREE(p, h, t) {void* xp = (p); if((xp)) wolfSSL_Free((xp));}
|
||||||
#define XREALLOC(p, n, h, t) CyaSSL_Realloc((p), (n))
|
#define XREALLOC(p, n, h, t) wolfSSL_Realloc((p), (n))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef STRING_USER
|
#ifndef STRING_USER
|
||||||
@@ -195,7 +198,7 @@ enum {
|
|||||||
|
|
||||||
#define XSTRLEN(s1) strlen((s1))
|
#define XSTRLEN(s1) strlen((s1))
|
||||||
#define XSTRNCPY(s1,s2,n) strncpy((s1),(s2),(n))
|
#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 */
|
CTaoCrypt only */
|
||||||
#define XSTRSTR(s1,s2) strstr((s1),(s2))
|
#define XSTRSTR(s1,s2) strstr((s1),(s2))
|
||||||
#define XSTRNSTR(s1,s2,n) mystrnstr((s1),(s2),(n))
|
#define XSTRNSTR(s1,s2,n) mystrnstr((s1),(s2),(n))
|
||||||
@@ -216,7 +219,7 @@ enum {
|
|||||||
#define XTOUPPER(c) toupper((c))
|
#define XTOUPPER(c) toupper((c))
|
||||||
#define XISALPHA(c) isalpha((c))
|
#define XISALPHA(c) isalpha((c))
|
||||||
#endif
|
#endif
|
||||||
/* needed by CyaSSL_check_domain_name() */
|
/* needed by wolfSSL_check_domain_name() */
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
/* Cygwin uses a macro version of tolower() by default, use the
|
/* Cygwin uses a macro version of tolower() by default, use the
|
||||||
* function version. */
|
* function version. */
|
||||||
@@ -277,7 +280,7 @@ enum {
|
|||||||
|
|
||||||
/* max error buffer string size */
|
/* max error buffer string size */
|
||||||
enum {
|
enum {
|
||||||
CYASSL_MAX_ERROR_SZ = 80
|
WOLFSSL_MAX_ERROR_SZ = 80
|
||||||
};
|
};
|
||||||
|
|
||||||
/* stack protection */
|
/* 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
|
/* 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
|
types need to match at compile time and run time, CheckCtcSettings will
|
||||||
@@ -324,5 +327,5 @@ CYASSL_API word32 CheckRunTimeSettings(void);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* CTAO_CRYPT_TYPES_H */
|
#endif /* WOLF_CRYPT_TYPES_H */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user