Commit f6ede396 authored by tomas@poseidon.ndb.mysql.com's avatar tomas@poseidon.ndb.mysql.com

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  poseidon.ndb.mysql.com:/home/tomas/mysql-5.1-new-ndb
parents a54c8633 d98fe8b7
...@@ -291,6 +291,7 @@ client/my_decimal.h ...@@ -291,6 +291,7 @@ client/my_decimal.h
client/my_user.c client/my_user.c
client/mysql client/mysql
client/mysql.cpp client/mysql.cpp
client/mysql_upgrade
client/mysqladmin client/mysqladmin
client/mysqladmin.c client/mysqladmin.c
client/mysqladmin.cpp client/mysqladmin.cpp
...@@ -321,6 +322,7 @@ cmd-line-utils/libedit/makelist ...@@ -321,6 +322,7 @@ cmd-line-utils/libedit/makelist
comon.h comon.h
comp_err/*.ds? comp_err/*.ds?
comp_err/*.vcproj comp_err/*.vcproj
compile
config.cache config.cache
config.guess config.guess
config.h config.h
...@@ -367,6 +369,9 @@ extra/resolve_stack_dump ...@@ -367,6 +369,9 @@ extra/resolve_stack_dump
extra/resolveip extra/resolveip
extra/sql_state.h extra/sql_state.h
extra/tztime.cc extra/tztime.cc
extra/yassl/taocrypt/benchmark/benchmark
extra/yassl/taocrypt/test/test
extra/yassl/testsuite/testsuite
fcns.c fcns.c
fcns.h fcns.h
gdbinit gdbinit
...@@ -549,6 +554,7 @@ libmysqld/spatial.cc ...@@ -549,6 +554,7 @@ libmysqld/spatial.cc
libmysqld/sql_acl.cc libmysqld/sql_acl.cc
libmysqld/sql_analyse.cc libmysqld/sql_analyse.cc
libmysqld/sql_base.cc libmysqld/sql_base.cc
libmysqld/sql_builtin.cc
libmysqld/sql_cache.cc libmysqld/sql_cache.cc
libmysqld/sql_class.cc libmysqld/sql_class.cc
libmysqld/sql_command libmysqld/sql_command
...@@ -679,6 +685,7 @@ mysql-test/mysql-test-run.log ...@@ -679,6 +685,7 @@ mysql-test/mysql-test-run.log
mysql-test/mysql_test_run_new mysql-test/mysql_test_run_new
mysql-test/ndb/ndbcluster mysql-test/ndb/ndbcluster
mysql-test/r/*.err mysql-test/r/*.err
mysql-test/r/*.log
mysql-test/r/*.out mysql-test/r/*.out
mysql-test/r/*.reject mysql-test/r/*.reject
mysql-test/r/alter_table.err mysql-test/r/alter_table.err
...@@ -1174,6 +1181,7 @@ sql/share/gmon.out ...@@ -1174,6 +1181,7 @@ sql/share/gmon.out
sql/share/mysql sql/share/mysql
sql/share/norwegian-ny/errmsg.sys sql/share/norwegian-ny/errmsg.sys
sql/share/norwegian/errmsg.sys sql/share/norwegian/errmsg.sys
sql/sql_builtin.cc
sql/sql_select.cc.orig sql/sql_select.cc.orig
sql/sql_yacc.cc sql/sql_yacc.cc
sql/sql_yacc.h sql/sql_yacc.h
...@@ -1747,6 +1755,10 @@ tools/mysqlmanager ...@@ -1747,6 +1755,10 @@ tools/mysqlmanager
tools/mysqlmngd tools/mysqlmngd
tools/mysqltestmanager tools/mysqltestmanager
tools/mysys_priv.h tools/mysys_priv.h
unittest/examples/*.t
unittest/mysys/*.t
unittest/mytap/t/*.t
unittest/unit
vi.h vi.h
vio/*.ds? vio/*.ds?
vio/*.vcproj vio/*.vcproj
...@@ -1758,9 +1770,3 @@ vio/viotest-sslconnect.cpp ...@@ -1758,9 +1770,3 @@ vio/viotest-sslconnect.cpp
vio/viotest.cpp vio/viotest.cpp
zlib/*.ds? zlib/*.ds?
zlib/*.vcproj zlib/*.vcproj
mysql-test/r/*.log
client/mysql_upgrade
unittest/examples/*.t
unittest/mysys/*.t
unittest/mytap/t/*.t
unittest/unit
...@@ -147,18 +147,9 @@ static_link="$static_link --with-client-ldflags=-all-static" ...@@ -147,18 +147,9 @@ static_link="$static_link --with-client-ldflags=-all-static"
local_infile_configs="--enable-local-infile" local_infile_configs="--enable-local-infile"
max_configs="--with-innodb --with-berkeley-db" max_no_embedded_configs="$SSL_LIBRARY --with-plugins=max"
max_configs="$max_configs --with-archive-storage-engine" max_no_ndb_configs="$SSL_LIBRARY --with-plugins=max-no-ndb --with-embedded-server"
max_configs="$max_configs --with-big-tables" max_configs="$SSL_LIBRARY --with-plugins=max --with-embedded-server"
max_configs="$max_configs --with-blackhole-storage-engine"
max_configs="$max_configs --with-federated-storage-engine"
max_configs="$max_configs --with-csv-storage-engine"
max_configs="$max_configs --with-example-storage-engine"
max_configs="$max_configs --with-partition $SSL_LIBRARY"
max_no_embedded_configs="$max_configs --with-ndbcluster"
max_no_ndb_configs="$max_configs --without-ndbcluster --with-embedded-server"
max_configs="$max_configs --with-ndbcluster --with-embedded-server"
# #
# CPU and platform specific compilation flags. # CPU and platform specific compilation flags.
......
...@@ -24,12 +24,11 @@ EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \ ...@@ -24,12 +24,11 @@ EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \
SUBDIRS = . include @docs_dirs@ @zlib_dir@ \ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
@readline_topdir@ sql-common \ @readline_topdir@ sql-common \
@thread_dirs@ pstack \ @thread_dirs@ pstack \
@sql_union_dirs@ storage \ @sql_union_dirs@ storage plugin \
@sql_server@ scripts @man_dirs@ tests \ @sql_server@ scripts @man_dirs@ tests \
@mysql_se_plugins@ \
netware @libmysqld_dirs@ \ netware @libmysqld_dirs@ \
mysql-test support-files @tools_dirs@ \ mysql-test support-files @tools_dirs@ \
plugin unittest win unittest win
DIST_SUBDIRS = $(SUBDIRS) BUILD DIST_SUBDIRS = $(SUBDIRS) BUILD
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# TARGTYPE "Win32 (x86) Console Application" 0x0103 # TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=mysql_upgrade - Win32 Release CFG=mysql_upgrade - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run !MESSAGE use the Export Makefile command and run
!MESSAGE !MESSAGE
...@@ -13,59 +13,112 @@ CFG=mysql_upgrade - Win32 Release ...@@ -13,59 +13,112 @@ CFG=mysql_upgrade - Win32 Release
!MESSAGE You can specify a configuration when running NMAKE !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "mysql_upgrade.mak" CFG="mysql_upgrade - Win32 Release" !MESSAGE NMAKE /f "mysql_upgrade.mak" CFG="mysql_upgrade - Win32 Debug"
!MESSAGE !MESSAGE
!MESSAGE Possible choices for configuration are: !MESSAGE Possible choices for configuration are:
!MESSAGE !MESSAGE
!MESSAGE "mysql_upgrade - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "mysql_upgrade - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "mysql_upgrade - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE "mysql_upgrade - Win32 classic" (based on "Win32 (x86) Console Application")
!MESSAGE !MESSAGE
# Begin Project # Begin Project
# PROP AllowPerConfigDependencies 0 # PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName "" # PROP Scc_ProjName ""
# PROP Scc_LocalPath "" # PROP Scc_LocalPath ""
CPP=cl.exe CPP=xicl6.exe
RSC=rc.exe RSC=rc.exe
!IF "$(CFG)" == "mysql_upgrade - Win32 Release"
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0 # PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "mysql_upgrade___Win32_Release" # PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "mysql_upgrade___Win32_Release" # PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 0
# PROP Use_Debug_Libraries 0 # PROP Use_Debug_Libraries 0
# PROP Output_Dir "mysql_upgrade___Win32_Release" # PROP Output_Dir "release"
# PROP Intermediate_Dir "mysql_upgrade___Win32_Release" # PROP Intermediate_Dir "release"
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /Fp"Release/mysql_upgrade.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c # ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "NDEBUG" /FD /c
# ADD BASE RSC /l 0x416 /d "NDEBUG" # SUBTRACT CPP /YX
# ADD RSC /l 0x416 /d "NDEBUG" # ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib zlib.lib /nologo /subsystem:console /pdb:"release/mysql_upgrade.pdb" /machine:I386 /out:"../client_release/mysql_upgrade.exe" /libpath:"..\lib_release\\" # ADD LINK32 mysqlclient.lib mysys.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib zlib.lib ..\extra\yassl\Release\yassl.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysql_upgrade.exe" /libpath:"..\lib_release\\"
# SUBTRACT LINK32 /pdb:none # SUBTRACT LINK32 /incremental:yes
!ELSEIF "$(CFG)" == "mysql_upgrade - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "mysqlimp"
# PROP BASE Intermediate_Dir "mysqlimp"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "debug"
# PROP Intermediate_Dir "debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 mysqlclient.lib mysys.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib zlib.lib setargv.obj ..\extra\yassl\Debug\yassl.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysql_upgrade.exe" /pdbtype:sept /libpath:"..\lib_debug\\"
!ELSEIF "$(CFG)" == "mysql_upgrade - Win32 classic"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "mysql_upgrade___Win32_classic"
# PROP BASE Intermediate_Dir "mysql_upgrade___Win32_classic"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "classic"
# PROP Intermediate_Dir "classic"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "NDEBUG" /FD /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "_CONSOLE" /D "_WINDOWS" /D LICENSE=Commercial /D "DBUG_OFF" /D "_MBCS" /D "NDEBUG" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=xilink6.exe
# ADD BASE LINK32 mysqlclient.lib mysys.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysql_upgrade.exe" /libpath:"..\lib_release\\"
# SUBTRACT BASE LINK32 /incremental:yes
# ADD LINK32 mysqlclient.lib mysys.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib zlib.lib ..\extra\yassl\Release\yassl.lib /nologo /subsystem:console /machine:I386 /out:"../client_classic/mysql_upgrade.exe" /libpath:"..\lib_release\\"
# SUBTRACT LINK32 /incremental:yes
!ENDIF
# Begin Target # Begin Target
# Name "mysql_upgrade - Win32 Release" # Name "mysql_upgrade - Win32 Release"
# Begin Group "Source Files" # Name "mysql_upgrade - Win32 Debug"
# Name "mysql_upgrade - Win32 classic"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File # Begin Source File
SOURCE=.\mysql_upgrade.c SOURCE=.\mysql_upgrade.c
# End Source File # End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target # End Target
# End Project # End Project
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="mysql_upgrade"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\debug"
IntermediateDirectory=".\debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
OptimizeForProcessor="2"
AdditionalIncludeDirectories="../include,../"
PreprocessorDefinitions="_DEBUG;SAFEMALLOC;SAFE_MUTEX;_CONSOLE;_WINDOWS"
RuntimeLibrary="1"
PrecompiledHeaderFile=".\debug/mysql_upgrade.pch"
AssemblerListingLocation=".\debug/"
ObjectFile=".\debug/"
ProgramDataBaseFileName=".\debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="1"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="wsock32.lib odbc32.lib odbccp32.lib setargv.obj"
OutputFile="../client_debug/mysql_upgrade.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories=""
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\debug/mysql_upgrade.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\debug/mysql_upgrade.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\release"
IntermediateDirectory=".\release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="2"
AdditionalIncludeDirectories="../include,../"
PreprocessorDefinitions="DBUG_OFF;_CONSOLE;_WINDOWS;NDEBUG"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\release/mysql_upgrade.pch"
AssemblerListingLocation=".\release/"
ObjectFile=".\release/"
ProgramDataBaseFileName=".\release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="wsock32.lib odbc32.lib odbccp32.lib"
OutputFile="../client_release/mysql_upgrade.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories=""
ProgramDatabaseFile=".\release/mysql_upgrade.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\release/mysql_upgrade.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="classic|Win32"
OutputDirectory=".\classic"
IntermediateDirectory=".\classic"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="2"
AdditionalIncludeDirectories="../include,../"
PreprocessorDefinitions="_CONSOLE;_WINDOWS;LICENSE=Commercial;DBUG_OFF;NDEBUG"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\classic/mysql_upgrade.pch"
AssemblerListingLocation=".\classic/"
ObjectFile=".\classic/"
ProgramDataBaseFileName=".\classic/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="wsock32.lib odbc32.lib odbccp32.lib"
OutputFile="../client_classic/mysql_upgrade.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories=""
ProgramDatabaseFile=".\classic/mysql_upgrade.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\classic/mysql_upgrade.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="mysql_upgrade.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="classic|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
...@@ -4,21 +4,23 @@ ...@@ -4,21 +4,23 @@
# TARGTYPE "Win32 (x86) Console Application" 0x0103 # TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=mysql_upgrade - Win32 Release CFG=mysql_upgrade - WinIA64 classic
!MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run !MESSAGE use the Export Makefile command and run
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "mysql_upgrade.mak". !MESSAGE NMAKE /f "mysql_upgrade_ia64.mak".
!MESSAGE !MESSAGE
!MESSAGE You can specify a configuration when running NMAKE !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "mysql_upgrade.mak" CFG="mysql_upgrade - Win32 Release" !MESSAGE NMAKE /f "mysql_upgrade_ia64.mak" CFG="mysql_upgrade - WinIA64 classic"
!MESSAGE !MESSAGE
!MESSAGE Possible choices for configuration are: !MESSAGE Possible choices for configuration are:
!MESSAGE !MESSAGE
!MESSAGE "mysql_upgrade - WinIA64 Release" (based on "Win32 (x86) Console Application") !MESSAGE "mysql_upgrade - WinIA64 Release" (based on "Win32 (x86) Console Application")
!MESSAGE !MESSAGE "mysql_upgrade - WinIA64 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE "mysql_upgrade - WinIA64 classic" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project # Begin Project
# PROP AllowPerConfigDependencies 0 # PROP AllowPerConfigDependencies 0
...@@ -27,51 +29,96 @@ CFG=mysql_upgrade - Win32 Release ...@@ -27,51 +29,96 @@ CFG=mysql_upgrade - Win32 Release
CPP=cl.exe CPP=cl.exe
RSC=rc.exe RSC=rc.exe
!IF "$(CFG)" == "mysql - WinIA64 Release" !IF "$(CFG)" == "mysql_upgrade - WinIA64 Release"
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0 # PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "mysql_upgrade___WinIA64_Release" # PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "mysql_upgrade___WinIA64_Release" # PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 0
# PROP Use_Debug_Libraries 0 # PROP Use_Debug_Libraries 0
# PROP Output_Dir "mysql_upgrade___WinIA64_Release" # PROP Output_Dir "release"
# PROP Intermediate_Dir "mysql_upgrade___WinIA64_Release" # PROP Intermediate_Dir "release"
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
MTL=midl.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN64" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN64" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /I "../include" /D"NDEBUG" /D"DBUG_OFF" /D"_CONSOLE" /D"_MBCS" /D"_WINDOWS" /Fp"Release/mysql_upgrade.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c /O2 /G2 /EHsc /D"_IA64_" /Zi /D"WIN64" /D"WIN32" /D"_AFX_NO_DAO_SUPPORT" /Wp64 /Zm600 # ADD CPP /nologo /MT /W3 /Zi /O2 /I "../include" /I "../" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "NDEBUG" /D "_IA64_" /D "WIN64" /D "WIN32" /D "_AFX_NO_DAO_SUPPORT" /FD /G2 /EHsc /Wp64 /Zm600 /c
# ADD BASE RSC /l 0x416 /d "NDEBUG" # SUBTRACT CPP /YX
# ADD RSC /l 0x416 /d "NDEBUG" # ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:IA64 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:IA64
# ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib zlib.lib /nologo /subsystem:console /pdb:"release/mysql_upgrade.pdb" /machine:IA64 /out:"../client_release/mysql_upgrade.exe" /libpath:"..\lib_release\\" /incremental:no # ADD LINK32 ..\lib_release\zlib.lib mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib bufferoverflowU.lib zlib.lib /nologo /subsystem:console /out:"../client_release/mysql_upgrade.exe" /libpath:"..\lib_release\\" /machine:IA64
# SUBTRACT LINK32
!ENDIF !ELSEIF "$(CFG)" == "mysql_upgrade - WinIA64 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "mysqlimp"
# PROP BASE Intermediate_Dir "mysqlimp"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "debug"
# PROP Intermediate_Dir "debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
MTL=midl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN64" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MTd /W3 /Zi /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "_IA64_" /D "WIN64" /D "WIN32" /D "_AFX_NO_DAO_SUPPORT" /FD /G2 /EHsc /Wp64 /Zm600 /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:IA64
# ADD LINK32 setargv.obj ..\lib_debug\zlib.lib ..\lib_debug\dbug.lib mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib bufferoverflowU.lib zlib.lib /nologo /subsystem:console /incremental:no /debug /out:"../client_debug/mysql_upgrade.exe" /libpath:"..\lib_debug\\" /machine:IA64
!ELSEIF "$(CFG)" == "mysql_upgrade - WinIA64 classic"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "mysql_upgrade___WinIA64_classic"
# PROP BASE Intermediate_Dir "mysql_upgrade___WinIA64_classic"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "classic"
# PROP Intermediate_Dir "classic"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
MTL=midl.exe
# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "NDEBUG" /FD /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MT /W3 /Zi /O2 /I "../include" /I "../" /D "_CONSOLE" /D "_WINDOWS" /D LICENSE=Commercial /D "DBUG_OFF" /D "_MBCS" /D "NDEBUG" /D "_IA64_" /D "WIN64" /D "WIN32" /D "_AFX_NO_DAO_SUPPORT" /FD /G2 /EHsc /Wp64 /Zm600 /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /out:"../client_release/mysql_upgrade.exe" /libpath:"..\lib_release\\" /machine:IA64
# ADD LINK32 ..\lib_release\zlib.lib mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib bufferoverflowU.lib zlib.lib /nologo /subsystem:console /out:"../client_classic/mysql_upgrade.exe" /libpath:"..\lib_release\\" /machine:IA64
!ENDIF
# Begin Target # Begin Target
# Name "mysql_upgrade - WinIA64 Release" # Name "mysql_upgrade - WinIA64 Release"
# Begin Group "Source Files" # Name "mysql_upgrade - WinIA64 Debug"
# Name "mysql_upgrade - WinIA64 classic"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File # Begin Source File
SOURCE=.\mysql_upgrade.c SOURCE=.\mysql_upgrade.c
# End Source File # End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target # End Target
# End Project # End Project
...@@ -446,6 +446,9 @@ Package=<4> ...@@ -446,6 +446,9 @@ Package=<4>
Project_Dep_Name mysqlimport Project_Dep_Name mysqlimport
End Project Dependency End Project Dependency
Begin Project Dependency Begin Project Dependency
Project_Dep_Name mysql_upgrade
End Project Dependency
Begin Project Dependency
Project_Dep_Name mysqlshow Project_Dep_Name mysqlshow
End Project Dependency End Project Dependency
Begin Project Dependency Begin Project Dependency
...@@ -530,6 +533,24 @@ Package=<4> ...@@ -530,6 +533,24 @@ Package=<4>
############################################################################### ###############################################################################
Project: "mysql_upgrade"=".\client\mysql_upgade.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name mysqlclient
End Project Dependency
Begin Project Dependency
Project_Dep_Name mysys
End Project Dependency
}}}
###############################################################################
Project: "mysqlserver"=".\mysqlserver\mysqlserver.dsp" - Package Owner=<4> Project: "mysqlserver"=".\mysqlserver\mysqlserver.dsp" - Package Owner=<4>
Package=<5> Package=<5>
......
...@@ -157,6 +157,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysqlimport", "client\mysql ...@@ -157,6 +157,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysqlimport", "client\mysql
{44D9C7DC-6636-4B82-BD01-6876C64017DF} = {44D9C7DC-6636-4B82-BD01-6876C64017DF} {44D9C7DC-6636-4B82-BD01-6876C64017DF} = {44D9C7DC-6636-4B82-BD01-6876C64017DF}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysql_upgrade", "client\mysql_upgrade.vcproj", "{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3D}"
ProjectSection(ProjectDependencies) = postProject
{BA86AE72-0CF5-423D-BBA2-E12B0D72EBFB} = {BA86AE72-0CF5-423D-BBA2-E12B0D72EBFB}
{26383276-4843-494B-8BE0-8936ED3EBAAB} = {26383276-4843-494B-8BE0-8936ED3EBAAB}
{8762A9B8-72A9-462E-A9A2-F3265081F8AF} = {8762A9B8-72A9-462E-A9A2-F3265081F8AF}
{44D9C7DC-6636-4B82-BD01-6876C64017DF} = {44D9C7DC-6636-4B82-BD01-6876C64017DF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysqlserver", "mysqlserver\mysqlserver.vcproj", "{94B86159-C581-42CD-825D-C69CBC237E5C}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysqlserver", "mysqlserver\mysqlserver.vcproj", "{94B86159-C581-42CD-825D-C69CBC237E5C}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{EEC1300B-85A5-497C-B3E1-F708021DF859} = {EEC1300B-85A5-497C-B3E1-F708021DF859} {EEC1300B-85A5-497C-B3E1-F708021DF859} = {EEC1300B-85A5-497C-B3E1-F708021DF859}
...@@ -249,6 +257,7 @@ EndProject ...@@ -249,6 +257,7 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysql_client_test", "tests\mysql_client_test.vcproj", "{DA224DAB-5006-42BE-BB77-16E8BE5326D5}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysql_client_test", "tests\mysql_client_test.vcproj", "{DA224DAB-5006-42BE-BB77-16E8BE5326D5}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{26383276-4843-494B-8BE0-8936ED3EBAAB} = {26383276-4843-494B-8BE0-8936ED3EBAAB} {26383276-4843-494B-8BE0-8936ED3EBAAB} = {26383276-4843-494B-8BE0-8936ED3EBAAB}
{44D9C7DC-6636-4B82-BD01-6876C64017DF} = {44D9C7DC-6636-4B82-BD01-6876C64017DF}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysqlmanager", "server-tools\instance-manager\mysqlmanager.vcproj", "{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysqlmanager", "server-tools\instance-manager\mysqlmanager.vcproj", "{6D524B3E-210A-4FCD-8D41-FEC0D21E83AC}"
......
...@@ -528,6 +528,9 @@ Package=<4> ...@@ -528,6 +528,9 @@ Package=<4>
Project_Dep_Name mysqlimport Project_Dep_Name mysqlimport
End Project Dependency End Project Dependency
Begin Project Dependency Begin Project Dependency
Project_Dep_Name mysql_upgrade
End Project Dependency
Begin Project Dependency
Project_Dep_Name mysqlshow Project_Dep_Name mysqlshow
End Project Dependency End Project Dependency
Begin Project Dependency Begin Project Dependency
...@@ -600,6 +603,21 @@ Package=<4> ...@@ -600,6 +603,21 @@ Package=<4>
############################################################################### ###############################################################################
Project: "mysql_upgrade"=".\client\mysql_upgrade_ia64.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name mysqlclient
End Project Dependency
}}}
###############################################################################
Project: "mysqlserver"=".\mysqlserver\mysqlserver_ia64.dsp" - Package Owner=<4> Project: "mysqlserver"=".\mysqlserver\mysqlserver_ia64.dsp" - Package Owner=<4>
Package=<5> Package=<5>
......
...@@ -3232,6 +3232,49 @@ ...@@ -3232,6 +3232,49 @@
PreprocessorDefinitions=""/> PreprocessorDefinitions=""/>
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath="my_memmem.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Max|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="TLS_DEBUG|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="TLS|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File <File
RelativePath="my_messnc.c"> RelativePath="my_messnc.c">
<FileConfiguration <FileConfiguration
......
...@@ -136,7 +136,7 @@ static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0, ...@@ -136,7 +136,7 @@ static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
tty_password= 0, opt_nobeep=0, opt_reconnect=1, tty_password= 0, opt_nobeep=0, opt_reconnect=1,
default_charset_used= 0, opt_secure_auth= 0, default_charset_used= 0, opt_secure_auth= 0,
default_pager_set= 0, opt_sigint_ignore= 0, default_pager_set= 0, opt_sigint_ignore= 0,
show_warnings = 0; show_warnings= 0, executing_query= 0, interrupted_query= 0;
static ulong opt_max_allowed_packet, opt_net_buffer_length; static ulong opt_max_allowed_packet, opt_net_buffer_length;
static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0; static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0;
static my_string opt_mysql_unix_port=0; static my_string opt_mysql_unix_port=0;
...@@ -338,7 +338,7 @@ static void end_timer(ulong start_time,char *buff); ...@@ -338,7 +338,7 @@ static void end_timer(ulong start_time,char *buff);
static void mysql_end_timer(ulong start_time,char *buff); static void mysql_end_timer(ulong start_time,char *buff);
static void nice_time(double sec,char *buff,bool part_second); static void nice_time(double sec,char *buff,bool part_second);
static sig_handler mysql_end(int sig); static sig_handler mysql_end(int sig);
static sig_handler handle_sigint(int sig);
int main(int argc,char *argv[]) int main(int argc,char *argv[])
{ {
...@@ -420,7 +420,7 @@ int main(int argc,char *argv[]) ...@@ -420,7 +420,7 @@ int main(int argc,char *argv[])
if (opt_sigint_ignore) if (opt_sigint_ignore)
signal(SIGINT, SIG_IGN); signal(SIGINT, SIG_IGN);
else else
signal(SIGINT, mysql_end); // Catch SIGINT to clean up signal(SIGINT, handle_sigint); // Catch SIGINT to clean up
signal(SIGQUIT, mysql_end); // Catch SIGQUIT to clean up signal(SIGQUIT, mysql_end); // Catch SIGQUIT to clean up
/* /*
...@@ -523,6 +523,35 @@ sig_handler mysql_end(int sig) ...@@ -523,6 +523,35 @@ sig_handler mysql_end(int sig)
} }
/*
This function handles sigint calls
If query is in process, kill query
no query in process, terminate like previous behavior
*/
sig_handler handle_sigint(int sig)
{
char kill_buffer[40];
MYSQL *kill_mysql= NULL;
/* terminate if no query being executed, or we already tried interrupting */
if (!executing_query || interrupted_query)
mysql_end(sig);
kill_mysql= mysql_init(kill_mysql);
if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password,
"", opt_mysql_port, opt_mysql_unix_port,0))
mysql_end(sig);
/* kill_buffer is always big enough because max length of %lu is 15 */
sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql));
mysql_real_query(kill_mysql, kill_buffer, strlen(kill_buffer));
mysql_close(kill_mysql);
tee_fprintf(stdout, "Query aborted by Ctrl+C\n");
interrupted_query= 1;
}
static struct my_option my_long_options[] = static struct my_option my_long_options[] =
{ {
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
...@@ -1932,6 +1961,7 @@ com_go(String *buffer,char *line __attribute__((unused))) ...@@ -1932,6 +1961,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
uint error= 0; uint error= 0;
int err= 0; int err= 0;
interrupted_query= 0;
if (!status.batch) if (!status.batch)
{ {
old_buffer= *buffer; // Save for edit command old_buffer= *buffer; // Save for edit command
...@@ -1967,7 +1997,7 @@ com_go(String *buffer,char *line __attribute__((unused))) ...@@ -1967,7 +1997,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
} }
timer=start_timer(); timer=start_timer();
executing_query= 1;
error= mysql_real_query_for_lazy(buffer->ptr(),buffer->length()); error= mysql_real_query_for_lazy(buffer->ptr(),buffer->length());
#ifdef HAVE_READLINE #ifdef HAVE_READLINE
...@@ -1981,6 +2011,7 @@ com_go(String *buffer,char *line __attribute__((unused))) ...@@ -1981,6 +2011,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
if (error) if (error)
{ {
executing_query= 0;
buffer->length(0); // Remove query on error buffer->length(0); // Remove query on error
return error; return error;
} }
...@@ -1992,13 +2023,19 @@ com_go(String *buffer,char *line __attribute__((unused))) ...@@ -1992,13 +2023,19 @@ com_go(String *buffer,char *line __attribute__((unused)))
if (quick) if (quick)
{ {
if (!(result=mysql_use_result(&mysql)) && mysql_field_count(&mysql)) if (!(result=mysql_use_result(&mysql)) && mysql_field_count(&mysql))
return put_error(&mysql); {
executing_query= 0;
return put_error(&mysql);
}
} }
else else
{ {
error= mysql_store_result_for_lazy(&result); error= mysql_store_result_for_lazy(&result);
if (error) if (error)
return error; {
executing_query= 0;
return error;
}
} }
if (verbose >= 3 || !opt_silent) if (verbose >= 3 || !opt_silent)
...@@ -2073,6 +2110,7 @@ com_go(String *buffer,char *line __attribute__((unused))) ...@@ -2073,6 +2110,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
(mysql.server_status & SERVER_STATUS_DB_DROPPED)) (mysql.server_status & SERVER_STATUS_DB_DROPPED))
get_current_db(); get_current_db();
executing_query= 0;
return error; /* New command follows */ return error; /* New command follows */
} }
...@@ -2286,6 +2324,8 @@ print_table_data(MYSQL_RES *result) ...@@ -2286,6 +2324,8 @@ print_table_data(MYSQL_RES *result)
while ((cur= mysql_fetch_row(result))) while ((cur= mysql_fetch_row(result)))
{ {
if (interrupted_query)
break;
ulong *lengths= mysql_fetch_lengths(result); ulong *lengths= mysql_fetch_lengths(result);
(void) tee_fputs("| ", PAGER); (void) tee_fputs("| ", PAGER);
mysql_field_seek(result, 0); mysql_field_seek(result, 0);
...@@ -2393,6 +2433,8 @@ print_table_data_html(MYSQL_RES *result) ...@@ -2393,6 +2433,8 @@ print_table_data_html(MYSQL_RES *result)
} }
while ((cur = mysql_fetch_row(result))) while ((cur = mysql_fetch_row(result)))
{ {
if (interrupted_query)
break;
ulong *lengths=mysql_fetch_lengths(result); ulong *lengths=mysql_fetch_lengths(result);
(void) tee_fputs("<TR>", PAGER); (void) tee_fputs("<TR>", PAGER);
for (uint i=0; i < mysql_num_fields(result); i++) for (uint i=0; i < mysql_num_fields(result); i++)
...@@ -2422,6 +2464,8 @@ print_table_data_xml(MYSQL_RES *result) ...@@ -2422,6 +2464,8 @@ print_table_data_xml(MYSQL_RES *result)
fields = mysql_fetch_fields(result); fields = mysql_fetch_fields(result);
while ((cur = mysql_fetch_row(result))) while ((cur = mysql_fetch_row(result)))
{ {
if (interrupted_query)
break;
ulong *lengths=mysql_fetch_lengths(result); ulong *lengths=mysql_fetch_lengths(result);
(void) tee_fputs("\n <row>\n", PAGER); (void) tee_fputs("\n <row>\n", PAGER);
for (uint i=0; i < mysql_num_fields(result); i++) for (uint i=0; i < mysql_num_fields(result); i++)
...@@ -2456,6 +2500,8 @@ print_table_data_vertically(MYSQL_RES *result) ...@@ -2456,6 +2500,8 @@ print_table_data_vertically(MYSQL_RES *result)
mysql_field_seek(result,0); mysql_field_seek(result,0);
for (uint row_count=1; (cur= mysql_fetch_row(result)); row_count++) for (uint row_count=1; (cur= mysql_fetch_row(result)); row_count++)
{ {
if (interrupted_query)
break;
mysql_field_seek(result,0); mysql_field_seek(result,0);
tee_fprintf(PAGER, tee_fprintf(PAGER,
"*************************** %d. row ***************************\n", row_count); "*************************** %d. row ***************************\n", row_count);
......
...@@ -135,7 +135,9 @@ static int create_check_file(const char *path) ...@@ -135,7 +135,9 @@ static int create_check_file(const char *path)
if (check_file < 0) if (check_file < 0)
return 1; return 1;
error= my_write(check_file, VERSION, strlen(VERSION), MYF(MY_WME | MY_FNABP)); error= my_write(check_file,
MYSQL_SERVER_VERSION, strlen(MYSQL_SERVER_VERSION),
MYF(MY_WME | MY_FNABP));
error= my_close(check_file, MYF(MY_FAE | MY_WME)) || error; error= my_close(check_file, MYF(MY_FAE | MY_WME)) || error;
return error; return error;
} }
...@@ -243,7 +245,7 @@ int main(int argc, char **argv) ...@@ -243,7 +245,7 @@ int main(int argc, char **argv)
&& (test_file_exists("./bin", "mysqld") || && (test_file_exists("./bin", "mysqld") ||
test_file_exists("./libexec", "mysqld"))) test_file_exists("./libexec", "mysqld")))
{ {
getcwd(bindir, sizeof(bindir)); my_getwd(bindir, sizeof(bindir), MYF(0));
bindir_end= bindir + strlen(bindir); bindir_end= bindir + strlen(bindir);
} }
else else
...@@ -305,7 +307,7 @@ int main(int argc, char **argv) ...@@ -305,7 +307,7 @@ int main(int argc, char **argv)
b_read= my_read(check_file, chf_buffer, sizeof(chf_buffer)-1, MYF(0)); b_read= my_read(check_file, chf_buffer, sizeof(chf_buffer)-1, MYF(0));
chf_buffer[b_read]= 0; chf_buffer[b_read]= 0;
my_close(check_file, MYF(0)); my_close(check_file, MYF(0));
if (!strcmp(chf_buffer, VERSION)) if (!strcmp(chf_buffer, MYSQL_SERVER_VERSION))
{ {
if (opt_verbose) if (opt_verbose)
puts("mysql_upgrade already done for this version"); puts("mysql_upgrade already done for this version");
......
...@@ -457,8 +457,8 @@ static struct my_option my_long_options[] = ...@@ -457,8 +457,8 @@ static struct my_option my_long_options[] =
(gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, (gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0,
0}, 0},
{"preserve-schema", OPT_MYSQL_PRESERVE_SCHEMA, {"preserve-schema", OPT_MYSQL_PRESERVE_SCHEMA,
"Preserve the schema from the mysqlslap run, this happens unless \ "Preserve the schema from the mysqlslap run, this happens unless "
--auto-generate-sql or --create are used.", "--auto-generate-sql or --create are used.",
(gptr*) &opt_preserve, (gptr*) &opt_preserve, 0, GET_BOOL, (gptr*) &opt_preserve, (gptr*) &opt_preserve, 0, GET_BOOL,
NO_ARG, TRUE, 0, 0, 0, 0, 0}, NO_ARG, TRUE, 0, 0, 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL, {"protocol", OPT_MYSQL_PROTOCOL,
......
...@@ -153,7 +153,7 @@ static uint global_expected_errors; ...@@ -153,7 +153,7 @@ static uint global_expected_errors;
/* ************************************************************************ */ /* ************************************************************************ */
static int record = 0, opt_sleep=0; static int record= 0, opt_sleep= -1;
static char *db = 0, *pass=0; static char *db = 0, *pass=0;
const char *user = 0, *host = 0, *unix_sock = 0, *opt_basedir="./"; const char *user = 0, *host = 0, *unix_sock = 0, *opt_basedir="./";
const char *opt_include= 0; const char *opt_include= 0;
...@@ -1880,11 +1880,12 @@ int do_sleep(struct st_query *query, my_bool real_sleep) ...@@ -1880,11 +1880,12 @@ int do_sleep(struct st_query *query, my_bool real_sleep)
query->first_argument); query->first_argument);
/* Fixed sleep time selected by --sleep option */ /* Fixed sleep time selected by --sleep option */
if (opt_sleep && !real_sleep) if (opt_sleep >= 0 && !real_sleep)
sleep_val= opt_sleep; sleep_val= opt_sleep;
DBUG_PRINT("info", ("sleep_val: %f", sleep_val)); DBUG_PRINT("info", ("sleep_val: %f", sleep_val));
my_sleep((ulong) (sleep_val * 1000000L)); if (sleep_val)
my_sleep((ulong) (sleep_val * 1000000L));
query->last_argument= sleep_end; query->last_argument= sleep_end;
return 0; return 0;
} }
...@@ -1956,7 +1957,13 @@ static uint get_errcodes(match_err *to,struct st_query *q) ...@@ -1956,7 +1957,13 @@ static uint get_errcodes(match_err *to,struct st_query *q)
; ;
for (; e->name; e++) for (; e->name; e++)
{ {
if (!strncmp(start, e->name, (int) (p - start))) /*
If we get a match, we need to check the length of the name we
matched against in case it was longer than what we are checking
(as in ER_WRONG_VALUE vs. ER_WRONG_VALUE_COUNT).
*/
if (!strncmp(start, e->name, (int) (p - start)) &&
strlen(e->name) == (p - start))
{ {
to[count].code.errnum= (uint) e->code; to[count].code.errnum= (uint) e->code;
to[count].type= ERR_ERRNO; to[count].type= ERR_ERRNO;
...@@ -3304,7 +3311,7 @@ static struct my_option my_long_options[] = ...@@ -3304,7 +3311,7 @@ static struct my_option my_long_options[] =
"Don't use the memory allocation checking.", 0, 0, 0, GET_NO_ARG, NO_ARG, "Don't use the memory allocation checking.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
{"sleep", 'T', "Sleep always this many seconds on sleep commands.", {"sleep", 'T', "Sleep always this many seconds on sleep commands.",
(gptr*) &opt_sleep, (gptr*) &opt_sleep, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, (gptr*) &opt_sleep, (gptr*) &opt_sleep, 0, GET_INT, REQUIRED_ARG, -1, 0, 0,
0, 0, 0}, 0, 0, 0},
{"socket", 'S', "Socket file to use for connection.", {"socket", 'S', "Socket file to use for connection.",
(gptr*) &unix_sock, (gptr*) &unix_sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, (gptr*) &unix_sock, (gptr*) &unix_sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
......
...@@ -9,56 +9,53 @@ SET(WITH_CSV_STORAGE_ENGINE TRUE) ...@@ -9,56 +9,53 @@ SET(WITH_CSV_STORAGE_ENGINE TRUE)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
${CMAKE_SOURCE_DIR}/include/mysql_version.h @ONLY) ${CMAKE_SOURCE_DIR}/include/mysql_version.h @ONLY)
SET(WITH_HEAP_STORAGE_ENGINE TRUE)
ADD_DEFINITIONS(-D WITH_HEAP_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_heap_plugin")
SET(WITH_MYISAM_STORAGE_ENGINE TRUE)
ADD_DEFINITIONS(-D WITH_MYISAM_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_myisam_plugin")
SET(WITH_MYISAMMRG_STORAGE_ENGINE TRUE)
ADD_DEFINITIONS(-D WITH_MYISAMMRG_STORAGE_ENGINE)
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_myisammrg_plugin")
IF(WITH_ARCHIVE_STORAGE_ENGINE) IF(WITH_ARCHIVE_STORAGE_ENGINE)
ADD_DEFINITIONS(-D WITH_ARCHIVE_STORAGE_ENGINE) ADD_DEFINITIONS(-D WITH_ARCHIVE_STORAGE_ENGINE)
SET (mysql_se_htons "${mysql_se_htons}, &archive_hton") SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_archive_plugin")
SET (mysql_se_decls "${mysql_se_decls}, archive_hton")
SET (mysql_se_ha_src ${mysql_se_ha_src} "../sql/ha_archive.cc")
ENDIF(WITH_ARCHIVE_STORAGE_ENGINE) ENDIF(WITH_ARCHIVE_STORAGE_ENGINE)
IF(WITH_BLACKHOLE_STORAGE_ENGINE) IF(WITH_BLACKHOLE_STORAGE_ENGINE)
ADD_DEFINITIONS(-D WITH_BLACKHOLE_STORAGE_ENGINE) ADD_DEFINITIONS(-D WITH_BLACKHOLE_STORAGE_ENGINE)
SET (mysql_se_htons "${mysql_se_htons}, &blackhole_hton") SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_blackhole_plugin")
SET (mysql_se_decls "${mysql_se_decls}, blackhole_hton")
SET (mysql_se_ha_src ${mysql_se_ha_src} "../sql/ha_blackhole.cc")
ENDIF(WITH_BLACKHOLE_STORAGE_ENGINE) ENDIF(WITH_BLACKHOLE_STORAGE_ENGINE)
IF(WITH_CSV_STORAGE_ENGINE) IF(WITH_CSV_STORAGE_ENGINE)
ADD_DEFINITIONS(-D WITH_CSV_STORAGE_ENGINE) ADD_DEFINITIONS(-D WITH_CSV_STORAGE_ENGINE)
SET (mysql_se_htons "${mysql_se_htons}, &tina_hton") SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_csv_plugin")
SET (mysql_se_decls "${mysql_se_decls}, tina_hton")
SET (mysql_se_ha_src ${mysql_se_ha_src} "../storage/csv/ha_tina.cc")
ENDIF(WITH_CSV_STORAGE_ENGINE) ENDIF(WITH_CSV_STORAGE_ENGINE)
IF(WITH_EXAMPLE_STORAGE_ENGINE) IF(WITH_EXAMPLE_STORAGE_ENGINE)
ADD_DEFINITIONS(-D WITH_EXAMPLE_STORAGE_ENGINE) ADD_DEFINITIONS(-D WITH_EXAMPLE_STORAGE_ENGINE)
SET (mysql_se_htons "${mysql_se_htons}, &example_hton") SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_example_plugin")
SET (mysql_se_decls "${mysql_se_decls}, example_hton")
ENDIF(WITH_EXAMPLE_STORAGE_ENGINE) ENDIF(WITH_EXAMPLE_STORAGE_ENGINE)
IF(WITH_INNOBASE_STORAGE_ENGINE) IF(WITH_INNOBASE_STORAGE_ENGINE)
ADD_DEFINITIONS(-D WITH_INNOBASE_STORAGE_ENGINE) ADD_DEFINITIONS(-D WITH_INNOBASE_STORAGE_ENGINE)
SET (mysql_se_htons "${mysql_se_htons}, &innobase_hton") SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_innobase_plugin")
SET (mysql_se_decls "${mysql_se_decls}, innobase_hton")
SET (mysql_se_ha_src ${mysql_se_ha_src} "../sql/ha_innodb.cc")
ENDIF(WITH_INNOBASE_STORAGE_ENGINE) ENDIF(WITH_INNOBASE_STORAGE_ENGINE)
IF(WITH_PARTITION_STORAGE_ENGINE) IF(WITH_PARTITION_STORAGE_ENGINE)
ADD_DEFINITIONS(-D WITH_PARTITION_STORAGE_ENGINE) ADD_DEFINITIONS(-D WITH_PARTITION_STORAGE_ENGINE)
SET (mysql_se_htons "${mysql_se_htons}, &partition_hton") SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_partition_plugin")
SET (mysql_se_decls "${mysql_se_decls}, partition_hton")
SET (mysql_se_ha_src ${mysql_se_ha_src} "../sql/ha_partition.cc")
ENDIF(WITH_PARTITION_STORAGE_ENGINE) ENDIF(WITH_PARTITION_STORAGE_ENGINE)
IF(WITH_FEDERATED_STORAGE_ENGINE) IF(WITH_FEDERATED_STORAGE_ENGINE)
ADD_DEFINITIONS(-D WITH_FEDERATED_STORAGE_ENGINE) ADD_DEFINITIONS(-D WITH_FEDERATED_STORAGE_ENGINE)
SET (mysql_se_htons "${mysql_se_htons}, &federated_hton") SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_federated_plugin")
SET (mysql_se_decls "${mysql_se_decls}, federated_hton")
SET (mysql_se_ha_src ${mysql_se_ha_src} "../sql/ha_federated.cc")
ENDIF(WITH_FEDERATED_STORAGE_ENGINE) ENDIF(WITH_FEDERATED_STORAGE_ENGINE)
IF(WITH_BERKELEY_STORAGE_ENGINE) IF(WITH_BERKELEY_STORAGE_ENGINE)
ADD_DEFINITIONS(-D WITH_BERKELEY_STORAGE_ENGINE) ADD_DEFINITIONS(-D WITH_BERKELEY_STORAGE_ENGINE)
SET (mysql_se_htons "${mysql_se_htons}, &berkeley_hton") SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_berkeley_plugin")
SET (mysql_se_decls "${mysql_se_decls}, berkeley_hton")
SET (mysql_se_ha_src ${mysql_se_ha_src} "../sql/ha_berkeley.cc")
ENDIF(WITH_BERKELEY_STORAGE_ENGINE) ENDIF(WITH_BERKELEY_STORAGE_ENGINE)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/handlerton.cc.in CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc.in
${CMAKE_SOURCE_DIR}/sql/handlerton.cc @ONLY) ${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc @ONLY)
SET(localstatedir "C:\\mysql\\data") SET(localstatedir "C:\\mysql\\data")
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-huge.cnf.sh CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-huge.cnf.sh
...@@ -137,6 +134,12 @@ ENDIF(WITH_ARCHIVE_STORAGE_ENGINE) ...@@ -137,6 +134,12 @@ ENDIF(WITH_ARCHIVE_STORAGE_ENGINE)
IF(WITH_BERKELEY_STORAGE_ENGINE) IF(WITH_BERKELEY_STORAGE_ENGINE)
ADD_SUBDIRECTORY(storage/bdb) ADD_SUBDIRECTORY(storage/bdb)
ENDIF(WITH_BERKELEY_STORAGE_ENGINE) ENDIF(WITH_BERKELEY_STORAGE_ENGINE)
IF(WITH_BLACKHOLE_STORAGE_ENGINE)
ADD_SUBDIRECTORY(storage/blackhole)
ENDIF(WITH_BLACKHOLE_STORAGE_ENGINE)
IF(WITH_CSV_STORAGE_ENGINE)
ADD_SUBDIRECTORY(storage/csv)
ENDIF(WITH_CSV_STORAGE_ENGINE)
IF(WITH_EXAMPLE_STORAGE_ENGINE) IF(WITH_EXAMPLE_STORAGE_ENGINE)
ADD_SUBDIRECTORY(storage/example) ADD_SUBDIRECTORY(storage/example)
ENDIF(WITH_EXAMPLE_STORAGE_ENGINE) ENDIF(WITH_EXAMPLE_STORAGE_ENGINE)
......
dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_CHECK_ARCHIVEDB
dnl Sets HAVE_ARCHIVE_DB if --with-archive-storage-engine is used
dnl ---------------------------------------------------------------------------
AC_DEFUN([MYSQL_CHECK_ARCHIVEDB], [
AC_ARG_WITH([archive-storage-engine],
[
--with-archive-storage-engine
Enable the Archive Storage Engine],
[archivedb="$withval"],
[archivedb=no])
AC_MSG_CHECKING([for archive storage engine])
case "$archivedb" in
yes )
AC_DEFINE([HAVE_ARCHIVE_DB], [1], [Builds Archive Storage Engine])
AC_MSG_RESULT([yes])
[archivedb=yes]
;;
* )
AC_MSG_RESULT([no])
[archivedb=no]
;;
esac
])
dnl ---------------------------------------------------------------------------
dnl END OF MYSQL_CHECK_ARCHIVE SECTION
dnl ---------------------------------------------------------------------------
...@@ -8,23 +8,20 @@ dnl --------------------------------------------------------------------------- ...@@ -8,23 +8,20 @@ dnl ---------------------------------------------------------------------------
AC_DEFUN([MYSQL_SETUP_BERKELEY_DB], [ AC_DEFUN([MYSQL_SETUP_BERKELEY_DB], [
AC_ARG_WITH([berkeley-db], AC_ARG_WITH([berkeley-db],
[ AS_HELP_STRING([--with-berkeley-db[[[[[=DIR]]]]]],
--with-berkeley-db[=DIR] [Use BerkeleyDB located in DIR]),
Use BerkeleyDB located in DIR],
[bdb="$withval"], [bdb="$withval"],
[bdb=yes]) [bdb=yes])
AC_ARG_WITH([berkeley-db-includes], AC_ARG_WITH([berkeley-db-includes],
[ AS_HELP_STRING([--with-berkeley-db-includes=DIR],
--with-berkeley-db-includes=DIR [Find Berkeley DB headers in DIR]),
Find Berkeley DB headers in DIR],
[bdb_includes="$withval"], [bdb_includes="$withval"],
[bdb_includes=default]) [bdb_includes=default])
AC_ARG_WITH([berkeley-db-libs], AC_ARG_WITH([berkeley-db-libs],
[ AS_HELP_STRING([--with-berkeley-db-libs=DIR],
--with-berkeley-db-libs=DIR [Find Berkeley DB libraries in DIR]),
Find Berkeley DB libraries in DIR],
[bdb_libs="$withval"], [bdb_libs="$withval"],
[bdb_libs=default]) [bdb_libs=default])
...@@ -120,12 +117,9 @@ AC_DEFUN([MYSQL_SETUP_BERKELEY_DB], [ ...@@ -120,12 +117,9 @@ AC_DEFUN([MYSQL_SETUP_BERKELEY_DB], [
sh $rel_srcdir/$bdb/dist/configure $bdb_conf_flags) || \ sh $rel_srcdir/$bdb/dist/configure $bdb_conf_flags) || \
AC_MSG_ERROR([could not configure Berkeley DB]) AC_MSG_ERROR([could not configure Berkeley DB])
mysql_se_libs="$mysql_se_libs $bdb_libs_with_path"
AC_SUBST(bdb_includes) AC_SUBST(bdb_includes)
AC_SUBST(bdb_libs) AC_SUBST(bdb_libs)
AC_SUBST(bdb_libs_with_path) AC_SUBST(bdb_libs_with_path)
AC_CONFIG_FILES(storage/bdb/Makefile)
]) ])
AC_DEFUN([MYSQL_CHECK_INSTALLED_BDB], [ AC_DEFUN([MYSQL_CHECK_INSTALLED_BDB], [
......
dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_CHECK_BLACKHOLEDB
dnl Sets HAVE_BLACKHOLE_DB if --with-blackhole-storage-engine is used
dnl ---------------------------------------------------------------------------
AC_DEFUN([MYSQL_CHECK_BLACKHOLEDB], [
AC_ARG_WITH([blackhole-storage-engine],
[
--with-blackhole-storage-engine
Enable the Blackhole Storage Engine],
[blackholedb="$withval"],
[blackholedb=no])
AC_MSG_CHECKING([for blackhole storage engine])
case "$blackholedb" in
yes )
AC_DEFINE([HAVE_BLACKHOLE_DB], [1], [Builds Blackhole Storage Engine])
AC_MSG_RESULT([yes])
[blackholedb=yes]
;;
* )
AC_MSG_RESULT([no])
[blackholedb=no]
;;
esac
])
dnl ---------------------------------------------------------------------------
dnl END OF MYSQL_CHECK_BLACKHOLE SECTION
dnl ---------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_CHECK_EXAMPLEDB
dnl Sets HAVE_EXAMPLE_DB if --with-example-storage-engine is used
dnl ---------------------------------------------------------------------------
AC_DEFUN([MYSQL_CHECK_EXAMPLEDB], [
AC_ARG_WITH([example-storage-engine],
[
--with-example-storage-engine
Enable the Example Storage Engine],
[exampledb="$withval"],
[exampledb=no])
AC_MSG_CHECKING([for example storage engine])
case "$exampledb" in
yes )
AC_DEFINE([HAVE_EXAMPLE_DB], [1], [Builds Example DB])
AC_MSG_RESULT([yes])
[exampledb=yes]
;;
* )
AC_MSG_RESULT([no])
[exampledb=no]
;;
esac
])
dnl ---------------------------------------------------------------------------
dnl END OF MYSQL_CHECK_EXAMPLE SECTION
dnl ---------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_CHECK_FEDERATED
dnl Sets HAVE_FEDERATED if --with-federated-storage-engine is used
dnl ---------------------------------------------------------------------------
AC_DEFUN([MYSQL_CHECK_FEDERATED], [
AC_ARG_WITH([federated-storage-engine],
[
--with-federated-storage-engine
Enable the MySQL Federated Storage Engine],
[federateddb="$withval"],
[federateddb=no])
AC_MSG_CHECKING([for MySQL federated storage engine])
case "$federateddb" in
yes )
AC_DEFINE([HAVE_FEDERATED_DB], [1], [Define to enable Federated Handler])
AC_MSG_RESULT([yes])
[federateddb=yes]
;;
* )
AC_MSG_RESULT([no])
[federateddb=no]
;;
esac
])
dnl ---------------------------------------------------------------------------
dnl END OF MYSQL_CHECK_FEDERATED SECTION
dnl ---------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_CHECK_INNODB
dnl Sets HAVE_INNOBASE_DB if --with-innodb is used
dnl ---------------------------------------------------------------------------
AC_DEFUN([MYSQL_CHECK_INNODB], [
AC_ARG_WITH([innodb],
[
--without-innodb Do not include the InnoDB table handler],
[innodb="$withval"],
[innodb=yes])
AC_MSG_CHECKING([for Innodb])
have_innodb=no
innodb_includes=
innodb_libs=
case "$innodb" in
yes )
AC_MSG_RESULT([Using Innodb])
AC_DEFINE([HAVE_INNOBASE_DB], [1], [Using Innobase DB])
have_innodb="yes"
innodb_includes="-I\$(top_builddir)/innobase/include"
innodb_system_libs=""
dnl Some libs are listed several times, in order for gcc to sort out
dnl circular references.
innodb_libs="\
\$(top_builddir)/storage/innobase/usr/libusr.a\
\$(top_builddir)/storage/innobase/srv/libsrv.a\
\$(top_builddir)/storage/innobase/dict/libdict.a\
\$(top_builddir)/storage/innobase/que/libque.a\
\$(top_builddir)/storage/innobase/srv/libsrv.a\
\$(top_builddir)/storage/innobase/ibuf/libibuf.a\
\$(top_builddir)/storage/innobase/row/librow.a\
\$(top_builddir)/storage/innobase/pars/libpars.a\
\$(top_builddir)/storage/innobase/btr/libbtr.a\
\$(top_builddir)/storage/innobase/trx/libtrx.a\
\$(top_builddir)/storage/innobase/read/libread.a\
\$(top_builddir)/storage/innobase/usr/libusr.a\
\$(top_builddir)/storage/innobase/buf/libbuf.a\
\$(top_builddir)/storage/innobase/ibuf/libibuf.a\
\$(top_builddir)/storage/innobase/eval/libeval.a\
\$(top_builddir)/storage/innobase/log/liblog.a\
\$(top_builddir)/storage/innobase/fsp/libfsp.a\
\$(top_builddir)/storage/innobase/fut/libfut.a\
\$(top_builddir)/storage/innobase/fil/libfil.a\
\$(top_builddir)/storage/innobase/lock/liblock.a\
\$(top_builddir)/storage/innobase/mtr/libmtr.a\
\$(top_builddir)/storage/innobase/page/libpage.a\
\$(top_builddir)/storage/innobase/rem/librem.a\
\$(top_builddir)/storage/innobase/thr/libthr.a\
\$(top_builddir)/storage/innobase/sync/libsync.a\
\$(top_builddir)/storage/innobase/data/libdata.a\
\$(top_builddir)/storage/innobase/mach/libmach.a\
\$(top_builddir)/storage/innobase/ha/libha.a\
\$(top_builddir)/storage/innobase/dyn/libdyn.a\
\$(top_builddir)/storage/innobase/mem/libmem.a\
\$(top_builddir)/storage/innobase/sync/libsync.a\
\$(top_builddir)/storage/innobase/ut/libut.a\
\$(top_builddir)/storage/innobase/os/libos.a\
\$(top_builddir)/storage/innobase/ut/libut.a"
AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"])
;;
* )
AC_MSG_RESULT([Not using Innodb])
;;
esac
AC_SUBST(innodb_includes)
AC_SUBST(innodb_libs)
AC_SUBST(innodb_system_libs)
])
dnl ---------------------------------------------------------------------------
dnl END OF MYSQL_CHECK_INNODB SECTION
dnl ---------------------------------------------------------------------------
...@@ -191,7 +191,6 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [ ...@@ -191,7 +191,6 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [
ndbcluster_libs="\$(top_builddir)/storage/ndb/src/.libs/libndbclient.a" ndbcluster_libs="\$(top_builddir)/storage/ndb/src/.libs/libndbclient.a"
ndbcluster_system_libs="" ndbcluster_system_libs=""
ndb_mgmclient_libs="\$(top_builddir)/storage/ndb/src/mgmclient/libndbmgmclient.la" ndb_mgmclient_libs="\$(top_builddir)/storage/ndb/src/mgmclient/libndbmgmclient.la"
mysql_se_objs="$mysql_se_objs ha_ndbcluster_binlog.o"
MYSQL_CHECK_NDB_OPTIONS MYSQL_CHECK_NDB_OPTIONS
NDBCLUSTER_WORKAROUNDS NDBCLUSTER_WORKAROUNDS
...@@ -282,9 +281,6 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [ ...@@ -282,9 +281,6 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [
ndb_bin_am_ldflags="" ndb_bin_am_ldflags=""
fi fi
mysql_se_libs="$mysql_se_libs $ndbcluster_libs $ndbcluster_system_libs"
mysql_se_libs="$mysql_se_libs $NDB_SCI_LIBS"
AC_SUBST(NDB_VERSION_MAJOR) AC_SUBST(NDB_VERSION_MAJOR)
AC_SUBST(NDB_VERSION_MINOR) AC_SUBST(NDB_VERSION_MINOR)
AC_SUBST(NDB_VERSION_BUILD) AC_SUBST(NDB_VERSION_BUILD)
...@@ -302,6 +298,7 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [ ...@@ -302,6 +298,7 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [
AC_SUBST(ndbcluster_libs) AC_SUBST(ndbcluster_libs)
AC_SUBST(ndbcluster_system_libs) AC_SUBST(ndbcluster_system_libs)
AC_SUBST(ndb_mgmclient_libs) AC_SUBST(ndb_mgmclient_libs)
AC_SUBST(NDB_SCI_LIBS)
AC_SUBST(ndb_transporter_opt_objs) AC_SUBST(ndb_transporter_opt_objs)
AC_SUBST(ndb_port) AC_SUBST(ndb_port)
...@@ -311,7 +308,7 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [ ...@@ -311,7 +308,7 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [
AC_SUBST(NDB_DEFS) AC_SUBST(NDB_DEFS)
AC_SUBST(ndb_cxxflags_fix) AC_SUBST(ndb_cxxflags_fix)
AC_CONFIG_FILES(storage/ndb/Makefile storage/ndb/include/Makefile dnl AC_CONFIG_FILES(storage/ndb/include/Makefile dnl
storage/ndb/src/Makefile storage/ndb/src/common/Makefile dnl storage/ndb/src/Makefile storage/ndb/src/common/Makefile dnl
storage/ndb/docs/Makefile dnl storage/ndb/docs/Makefile dnl
storage/ndb/tools/Makefile dnl storage/ndb/tools/Makefile dnl
......
dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_CHECK_PARTITIONDB
dnl Sets HAVE_PARTITION_DB if --with-partition is used
dnl ---------------------------------------------------------------------------
AC_DEFUN([MYSQL_CHECK_PARTITIONDB], [
AC_ARG_WITH([partition],
[
--with-partition
Enable the Partition Storage Engine],
[partitiondb="$withval"],
[partitiondb=no])
AC_MSG_CHECKING([for partition])
dnl case "$partitiondb" in
dnl yes )
dnl AC_DEFINE([HAVE_PARTITION_DB], [1], [Builds Partition DB])
dnl AC_MSG_RESULT([yes])
dnl [partitiondb=yes]
dnl ;;
dnl * )
dnl AC_MSG_RESULT([no])
dnl [partitiondb=no]
dnl ;;
dnl esac
AC_DEFINE([HAVE_PARTITION_DB], [1], [Builds Partition DB])
AC_MSG_RESULT([yes])
[partitiondb=yes]
])
dnl ---------------------------------------------------------------------------
dnl END OF MYSQL_CHECK_PARTITION SECTION
dnl ---------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_CHECK_CSVDB
dnl Sets HAVE_CSV_DB if --with-csv-storage-engine is used
dnl ---------------------------------------------------------------------------
AC_DEFUN([MYSQL_CHECK_CSVDB], [
AC_ARG_WITH([csv-storage-engine],
[
--with-csv-storage-engine
Enable the CSV Storage Engine],
[csvdb="$withval"],
[csvdb=no])
AC_MSG_CHECKING([for csv storage engine])
case "$csvdb" in
yes )
AC_DEFINE([HAVE_CSV_DB], [1], [Builds the CSV Storage Engine])
AC_MSG_RESULT([yes])
[csvdb=yes]
;;
* )
AC_MSG_RESULT([no])
[csvdb=no]
;;
esac
])
dnl ---------------------------------------------------------------------------
dnl END OF MYSQL_CHECK_CSV SECTION
dnl ---------------------------------------------------------------------------
...@@ -675,8 +675,8 @@ dnl Sets BIG_TABLES if --with-big-tables is used ...@@ -675,8 +675,8 @@ dnl Sets BIG_TABLES if --with-big-tables is used
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
AC_DEFUN([MYSQL_CHECK_BIG_TABLES], [ AC_DEFUN([MYSQL_CHECK_BIG_TABLES], [
AC_ARG_WITH([big-tables], AC_ARG_WITH([big-tables],
[ AS_HELP_STRING([--with-big-tables],
--with-big-tables Support tables with more than 4 G rows even on 32 bit platforms], [Support tables with more than 4 G rows even on 32 bit platforms]),
[bigtables="$withval"], [bigtables="$withval"],
[bigtables=no]) [bigtables=no])
AC_MSG_CHECKING([for big tables support]) AC_MSG_CHECKING([for big tables support])
...@@ -703,8 +703,8 @@ dnl Sets MAX_INDEXES ...@@ -703,8 +703,8 @@ dnl Sets MAX_INDEXES
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
AC_DEFUN([MYSQL_CHECK_MAX_INDEXES], [ AC_DEFUN([MYSQL_CHECK_MAX_INDEXES], [
AC_ARG_WITH([max-indexes], AC_ARG_WITH([max-indexes],
[ AS_HELP_STRING([--with-max-indexes=N],
--with-max-indexes=\# Sets the maximum number of indexes per table, default 64], [Sets the maximum number of indexes per table, default 64]),
[max_indexes="$withval"], [max_indexes="$withval"],
[max_indexes=64]) [max_indexes=64])
AC_MSG_CHECKING([max indexes per table]) AC_MSG_CHECKING([max indexes per table])
......
AC_DEFUN([MYSQL_FIND_OPENSSL], [ AC_DEFUN([MYSQL_FIND_OPENSSL], [
incs="$1" incs="$1"
libs="$2" libs="$2"
eval shrexts=\"$shrext_cmds\"
case "$incs---$libs" in case "$incs---$libs" in
---) ---)
for d in /usr/ssl/include /usr/local/ssl/include /usr/include \ for d in /usr/ssl/include /usr/local/ssl/include /usr/include \
...@@ -15,7 +16,7 @@ AC_DEFUN([MYSQL_FIND_OPENSSL], [ ...@@ -15,7 +16,7 @@ AC_DEFUN([MYSQL_FIND_OPENSSL], [
/usr/lib /usr/lib64 /opt/ssl/lib /opt/openssl/lib \ /usr/lib /usr/lib64 /opt/ssl/lib /opt/openssl/lib \
/usr/freeware/lib32 /usr/local/lib/ ; do /usr/freeware/lib32 /usr/local/lib/ ; do
# Just to be safe, we test for ".so" anyway # Just to be safe, we test for ".so" anyway
if test -f $d/libssl.a || test -f $d/libssl.so || test -f $d/libssl$shrext_cmds ; then if test -f $d/libssl.a || test -f $d/libssl.so || test -f $d/libssl$shrext ; then
OPENSSL_LIB=$d OPENSSL_LIB=$d
fi fi
done done
...@@ -28,7 +29,7 @@ AC_DEFUN([MYSQL_FIND_OPENSSL], [ ...@@ -28,7 +29,7 @@ AC_DEFUN([MYSQL_FIND_OPENSSL], [
OPENSSL_INCLUDE=-I$incs OPENSSL_INCLUDE=-I$incs
fi fi
# Just to be safe, we test for ".so" anyway # Just to be safe, we test for ".so" anyway
if test -f $libs/libssl.a || test -f $libs/libssl.so || test -f $libs/libssl$shrext_cmds ; then if test -f $libs/libssl.a || test -f $libs/libssl.so || test -f $libs/libssl$shrext ; then
OPENSSL_LIB=$libs OPENSSL_LIB=$libs
fi fi
;; ;;
......
This diff is collapsed.
dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_STORAGE_ENGINE
dnl
dnl What it does:
dnl creates --with-xxx configure option
dnl adds HAVE_XXX to config.h
dnl appends &xxx_hton, to the list of hanldertons
dnl appends a dir to the list of source directories
dnl appends ha_xxx.cc to the list of handler files
dnl
dnl all names above are configurable with reasonable defaults.
dnl
dnl ---------------------------------------------------------------------------
AC_DEFUN([MYSQL_STORAGE_ENGINE],
[_MYSQL_STORAGE_ENGINE(
[$1], dnl name
m4_default([$2], [$1 storage engine]), dnl verbose name
m4_default([$3], [$1-storage-engine]), dnl with-name
m4_default([$4], no), dnl default
m4_default([$5], [WITH_]AS_TR_CPP([$1])[_STORAGE_ENGINE]),
m4_default([$6], $1[_hton]), dnl hton
m4_default([$7], []), dnl path to the code
m4_default([$8], [ha_$1.o]), dnl path to the handler in
m4_default([$9], []), dnl path to extra libraries
[$10], dnl code-if-set
)])
AC_DEFUN([_MYSQL_STORAGE_ENGINE],
[
AC_ARG_WITH([$3], AS_HELP_STRING([--with-$3], [enable $2 (default is $4)]),
[], [ [with_]m4_bpatsubst([$3], -, _)=['$4']])
AC_CACHE_CHECK([whether to use $2], [mysql_cv_use_]m4_bpatsubst([$3], -, _),
[mysql_cv_use_]m4_bpatsubst([$3], -, _)=[$with_]m4_bpatsubst([$3], -, _))
AH_TEMPLATE([$5], [Build $2])
if test "[$mysql_cv_use_]m4_bpatsubst([$3], -, _)" != no; then
if test "$6" != "no"
then
AC_DEFINE([$5])
mysql_se_decls="${mysql_se_decls},$6"
mysql_se_htons="${mysql_se_htons},&$6"
if test "$8" != "no"
then
mysql_se_objs="$mysql_se_objs $8"
fi
mysql_se_dirs="$mysql_se_dirs $7"
mysql_se_libs="$mysql_se_libs $9"
else
mysql_se_plugins="$mysql_se_plugins $7"
fi
$10
fi
])
dnl ---------------------------------------------------------------------------
...@@ -11,8 +11,11 @@ AC_DEFUN([MYSQL_CHECK_YASSL], [ ...@@ -11,8 +11,11 @@ AC_DEFUN([MYSQL_CHECK_YASSL], [
AC_MSG_RESULT([using bundled yaSSL]) AC_MSG_RESULT([using bundled yaSSL])
AC_CONFIG_FILES(extra/yassl/Makefile dnl AC_CONFIG_FILES(extra/yassl/Makefile dnl
extra/yassl/taocrypt/Makefile dnl extra/yassl/taocrypt/Makefile dnl
extra/yassl/taocrypt/benchmark/Makefile dnl
extra/yassl/taocrypt/src/Makefile dnl extra/yassl/taocrypt/src/Makefile dnl
extra/yassl/src/Makefile) extra/yassl/taocrypt/test/Makefile dnl
extra/yassl/src/Makefile dnl
extra/yassl/testsuite/Makefile)
yassl_dir="yassl" yassl_dir="yassl"
yassl_libs="-L\$(top_srcdir)/extra/yassl/src -lyassl -L\$(top_srcdir)/extra/yassl/taocrypt/src -ltaocrypt" yassl_libs="-L\$(top_srcdir)/extra/yassl/src -lyassl -L\$(top_srcdir)/extra/yassl/taocrypt/src -ltaocrypt"
yassl_includes="-I\$(top_srcdir)/extra/yassl/include" yassl_includes="-I\$(top_srcdir)/extra/yassl/include"
......
...@@ -90,8 +90,9 @@ case $SYSTEM_TYPE in ...@@ -90,8 +90,9 @@ case $SYSTEM_TYPE in
;; ;;
*) *)
# Just to be safe, we test for ".so" anyway # Just to be safe, we test for ".so" anyway
eval shrexts=\"$shrext_cmds\"
if test \( -f "$mysql_zlib_dir/lib/libz.a" -o -f "$mysql_zlib_dir/lib/libz.so" -o \ if test \( -f "$mysql_zlib_dir/lib/libz.a" -o -f "$mysql_zlib_dir/lib/libz.so" -o \
-f "$mysql_zlib_dir/lib/libz$shrext_cmds" \) \ -f "$mysql_zlib_dir/lib/libz$shrext" \) \
-a -f "$mysql_zlib_dir/include/zlib.h"; then -a -f "$mysql_zlib_dir/include/zlib.h"; then
ZLIB_INCLUDES="-I$mysql_zlib_dir/include" ZLIB_INCLUDES="-I$mysql_zlib_dir/include"
ZLIB_LIBS="-L$mysql_zlib_dir/lib -lz" ZLIB_LIBS="-L$mysql_zlib_dir/lib -lz"
......
This diff is collapsed.
SUBDIRS = taocrypt src SUBDIRS = taocrypt src testsuite
EXTRA_DIST = yassl.dsp yassl.dsw yassl.vcproj $(wildcard mySTL/*.hpp) \ EXTRA_DIST = yassl.dsp yassl.dsw yassl.vcproj $(wildcard mySTL/*.hpp) \
cmakelists.txt cmakelists.txt
yaSSL Release notes, version 0.9.6 yaSSL Release notes, version 1.2.2 (03/27/06)
This release of yaSSL contains minor bug fixes and portability enhancements.
See build instructions below under 1.0.6:
*******************yaSSL Release notes, version 1.2.0
This release of yaSSL contains minor bug fixes, portability enhancements,
Diffie-Hellman compatibility fixes for other servers and client,
optimization improvements, and x86 ASM changes.
See build instructions below under 1.0.6:
*****************yaSSL Release notes, version 1.1.5
This release of yaSSL contains minor bug fixes, portability enhancements,
and user requested changes including the ability to add all certificates in
a directory, more robust socket handling, no new overloading unless
requested, and an SSL_VERIFY_NONE option.
See build instructions below under 1.0.6:
******************yaSSL Release notes, version 1.0.6
This release of yaSSL contains minor bug fixes, portability enhancements,
x86 assembly for ARC4, SHA, MD5, and RIPEMD, --enable-ia32-asm configure
option, and a security patch for certificate chain processing.
--To build on Linux, Solaris, *BSD, Mac OS X, or Cygwin:
./configure
make
run testsuite from yaSSL-Home/testsuite to test the build
to make a release build:
./configure --disable-debug
make
run testsuite from yaSSL-Home/testsuite to test the build
--To build on Win32
Choose (Re)Build All from the project workspace
run Debug\testsuite.exe from yaSSL-Home\testsuite to test the build
--To enable ia32 assembly for TaoCrypt ciphers and message digests
On MSVC this is always on
On GCC **, use ./configure --enable-ia32-asm
** This isn't on by default because of the use of intel syntax and the
problem that olders versions of gas have with some addressing statements.
If you enable this and get assemler errors during compilation or can't
pass the TaoCrypt tests, please send todd@yassl.com a message and disable
this option in the meantime.
***************** yaSSL Release notes, version 1.0.5
This release of yaSSL contains minor bug fixes, portability enhancements,
x86 assembly for AES, 3DES, BLOWFISH, and TWOFISH, --without-debug configure
option, and --enable-kernel-mode configure option for using TaoCrypt with
kernel modules.
--To build on Linux, Solaris, *BSD, Mac OS X, or Cygwin:
./configure
make
run testsuite from yaSSL-Home/testsuite to test the build
to make a release build:
./configure --without-debug
make
run testsuite from yaSSL-Home/testsuite to test the build
--To build on Win32
Choose (Re)Build All from the project workspace
run Debug\testsuite.exe from yaSSL-Home\testsuite to test the build
******************yaSSL Release notes, version 1.0.1
This release of yaSSL contains minor bug fixes, portability enhancements,
GCC 3.4.4 support, MSVC 2003 support, and more documentation.
Please see build instructions in the release notes for 0.9.6 below.
******************yaSSL Release notes, version 1.0
This release of yaSSL contains minor bug fixes, portability enhancements,
GCC 4.0 support, testsuite, improvements, and API additions.
Please see build instructions in the release notes for 0.9.6 below.
******************yaSSL Release notes, version 0.9.9
This release of yaSSL contains minor bug fixes, portability enchancements,
MSVC 7 support, memory improvements, and API additions.
Please see build instructions in the release notes for 0.9.6 below.
******************yaSSL Release notes, version 0.9.8
This release of yaSSL contains minor bug fixes and portability enchancements.
Please see build instructions in the release notes for 0.9.6 below.
******************yaSSL Release notes, version 0.9.6
This release of yaSSL contains minor bug fixes, removal of STL support, and This release of yaSSL contains minor bug fixes, removal of STL support, and
removal of exceptions and rtti so that the library can be linked without the removal of exceptions and rtti so that the library can be linked without the
......
/* client.cpp */
#include "../../testsuite/test.hpp"
//#define TEST_RESUME
void client_test(void* args)
{
#ifdef _WIN32
WSADATA wsd;
WSAStartup(0x0002, &wsd);
#endif
SOCKET_T sockfd = 0;
int argc = 0;
char** argv = 0;
set_args(argc, argv, *static_cast<func_args*>(args));
tcp_connect(sockfd);
SSL_METHOD* method = TLSv1_client_method();
SSL_CTX* ctx = SSL_CTX_new(method);
set_certs(ctx);
SSL* ssl = SSL_new(ctx);
SSL_set_fd(ssl, sockfd);
if (SSL_connect(ssl) != SSL_SUCCESS) err_sys("SSL_connect failed");
showPeer(ssl);
const char* cipher = 0;
int index = 0;
char list[1024];
strcpy(list, "cipherlist");
while ( (cipher = SSL_get_cipher_list(ssl, index++)) ) {
strcat(list, ":");
strcat(list, cipher);
}
printf("%s\n", list);
printf("Using Cipher Suite %s\n", SSL_get_cipher(ssl));
char msg[] = "hello yassl!";
if (SSL_write(ssl, msg, sizeof(msg)) != sizeof(msg))
err_sys("SSL_write failed");
char reply[1024];
reply[SSL_read(ssl, reply, sizeof(reply))] = 0;
printf("Server response: %s\n", reply);
#ifdef TEST_RESUME
SSL_SESSION* session = SSL_get_session(ssl);
SSL* sslResume = SSL_new(ctx);
#endif
SSL_shutdown(ssl);
SSL_free(ssl);
#ifdef TEST_RESUME
tcp_connect(sockfd);
SSL_set_fd(sslResume, sockfd);
SSL_set_session(sslResume, session);
if (SSL_connect(sslResume) != SSL_SUCCESS) err_sys("SSL resume failed");
if (SSL_write(sslResume, msg, sizeof(msg)) != sizeof(msg))
err_sys("SSL_write failed");
reply[SSL_read(sslResume, reply, sizeof(reply))] = 0;
printf("Server response: %s\n", reply);
SSL_shutdown(sslResume);
SSL_free(sslResume);
#endif // TEST_RESUME
SSL_CTX_free(ctx);
((func_args*)args)->return_code = 0;
}
#ifndef NO_MAIN_DRIVER
int main(int argc, char** argv)
{
func_args args;
args.argc = argc;
args.argv = argv;
client_test(&args);
return args.return_code;
}
#endif // NO_MAIN_DRIVER
# Microsoft Developer Studio Project File - Name="client" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=client - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "client.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "client.mak" CFG="client - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "client - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "client - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "client - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /O2 /I "..\..\taocrypt\include" /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "client - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "..\..\include" /I "..\..\taocrypt\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "client - Win32 Release"
# Name "client - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\client.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
/* echoclient.cpp */
#include "../../testsuite/test.hpp"
void echoclient_test(void* args)
{
#ifdef _WIN32
WSADATA wsd;
WSAStartup(0x0002, &wsd);
#endif
SOCKET_T sockfd = 0;
int argc = 0;
char** argv = 0;
FILE* fin = stdin;
FILE* fout = stdout;
bool inCreated = false;
bool outCreated = false;
set_args(argc, argv, *static_cast<func_args*>(args));
if (argc >= 2) {
fin = fopen(argv[1], "r");
inCreated = true;
}
if (argc >= 3) {
fout = fopen(argv[2], "w");
outCreated = true;
}
if (!fin) err_sys("can't open input file");
if (!fout) err_sys("can't open output file");
tcp_connect(sockfd);
SSL_METHOD* method = TLSv1_client_method();
SSL_CTX* ctx = SSL_CTX_new(method);
set_certs(ctx);
SSL* ssl = SSL_new(ctx);
SSL_set_fd(ssl, sockfd);
if (SSL_connect(ssl) != SSL_SUCCESS) err_sys("SSL_connect failed");
char send[1024];
char reply[1024];
while (fgets(send, sizeof(send), fin)) {
int sendSz = strlen(send) + 1;
if (SSL_write(ssl, send, sendSz) != sendSz)
err_sys("SSL_write failed");
if (strncmp(send, "quit", 4) == 0) {
fputs("sending server shutdown command: quit!\n", fout);
break;
}
if (SSL_read(ssl, reply, sizeof(reply)) > 0)
fputs(reply, fout);
}
SSL_CTX_free(ctx);
SSL_free(ssl);
fflush(fout);
if (inCreated) fclose(fin);
if (outCreated) fclose(fout);
((func_args*)args)->return_code = 0;
}
#ifndef NO_MAIN_DRIVER
int main(int argc, char** argv)
{
func_args args;
args.argc = argc;
args.argv = argv;
echoclient_test(&args);
return args.return_code;
}
#endif // NO_MAIN_DRIVER
# Microsoft Developer Studio Project File - Name="echoclient" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=echoclient - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "echoclient.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "echoclient.mak" CFG="echoclient - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "echoclient - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "echoclient - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "echoclient - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /O2 /I "..\..\include" /I "..\..\taocrypt\include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "echoclient - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "..\..\include" /I "..\..\taocrypt\include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "echoclient - Win32 Release"
# Name "echoclient - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\echoclient.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
/* echoclient.cpp */
#include "openssl/ssl.h" /* openssl compatibility test */
#include <stdio.h>
#include <stdlib.h>
#ifdef WIN32
#include <winsock2.h>
#else
#include <string.h>
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#endif /* WIN32 */
void err_sys(const char* msg)
{
fputs("yassl client error: ", stderr);
fputs(msg, stderr);
exit(EXIT_FAILURE);
}
const char* loopback = "127.0.0.1";
const short yasslPort = 11111;
using namespace yaSSL;
int main(int argc, char** argv)
{
#ifdef WIN32
WSADATA wsd;
WSAStartup(0x0002, &wsd);
int sockfd;
#else
unsigned int sockfd;
#endif /* WIN32 */
FILE* fin = stdin;
FILE* fout = stdout;
if (argc >= 2) fin = fopen(argv[1], "r");
if (argc >= 3) fout = fopen(argv[2], "w");
if (!fin) err_sys("can't open input file");
if (!fout) err_sys("can't open output file");
sockfd = socket(AF_INET, SOCK_STREAM, 0);
sockaddr_in servaddr;
memset(&servaddr, 0, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(yasslPort);
servaddr.sin_addr.s_addr = inet_addr(loopback);
if (connect(sockfd, (const sockaddr*)&servaddr, sizeof(servaddr)) != 0)
err_sys("tcp connect failed");
SSL_METHOD* method = TLSv1_client_method();
SSL_CTX* ctx = SSL_CTX_new(method);
SSL* ssl = SSL_new(ctx);
SSL_set_fd(ssl, sockfd);
if (SSL_connect(ssl) != SSL_SUCCESS) err_sys("SSL_connect failed");
char send[1024];
char reply[1024];
while (fgets(send, sizeof(send), fin)) {
int sendSz = strlen(send) + 1;
if (SSL_write(ssl, send, sendSz) != sendSz)
err_sys("SSL_write failed");
if (strncmp(send, "quit", 4) == 0) {
fputs("sending server shutdown command: quit!", fout);
break;
}
if (SSL_read(ssl, reply, sizeof(reply)) > 0)
fputs(reply, fout);
}
SSL_CTX_free(ctx);
SSL_free(ssl);
return 0;
}
/* echoserver.cpp */
#include "../../testsuite/test.hpp"
#ifndef NO_MAIN_DRIVER
#define ECHO_OUT
THREAD_RETURN YASSL_API echoserver_test(void*);
int main(int argc, char** argv)
{
func_args args;
args.argc = argc;
args.argv = argv;
echoserver_test(&args);
return args.return_code;
}
#endif // NO_MAIN_DRIVER
THREAD_RETURN YASSL_API echoserver_test(void* args)
{
#ifdef _WIN32
WSADATA wsd;
WSAStartup(0x0002, &wsd);
#endif
SOCKET_T sockfd = 0;
int argc = 0;
char** argv = 0;
set_args(argc, argv, *static_cast<func_args*>(args));
#ifdef ECHO_OUT
FILE* fout = stdout;
if (argc >= 2) fout = fopen(argv[1], "w");
if (!fout) err_sys("can't open output file");
#endif
tcp_listen(sockfd);
SSL_METHOD* method = TLSv1_server_method();
SSL_CTX* ctx = SSL_CTX_new(method);
set_serverCerts(ctx);
DH* dh = set_tmpDH(ctx);
bool shutdown(false);
#if defined(_POSIX_THREADS) && defined(NO_MAIN_DRIVER)
// signal ready to tcp_accept
func_args& server_args = *((func_args*)args);
tcp_ready& ready = *server_args.signal_;
pthread_mutex_lock(&ready.mutex_);
ready.ready_ = true;
pthread_cond_signal(&ready.cond_);
pthread_mutex_unlock(&ready.mutex_);
#endif
while (!shutdown) {
sockaddr_in client;
socklen_t client_len = sizeof(client);
int clientfd = accept(sockfd, (sockaddr*)&client, &client_len);
if (clientfd == -1) err_sys("tcp accept failed");
SSL* ssl = SSL_new(ctx);
SSL_set_fd(ssl, clientfd);
if (SSL_accept(ssl) != SSL_SUCCESS) err_sys("SSL_accept failed");
char command[1024];
int echoSz(0);
while ( (echoSz = SSL_read(ssl, command, sizeof(command))) > 0) {
if ( strncmp(command, "quit", 4) == 0) {
printf("client sent quit command: shutting down!\n");
shutdown = true;
break;
}
else if ( strncmp(command, "GET", 3) == 0) {
char type[] = "HTTP/1.0 200 ok\r\nContent-type:"
" text/html\r\n\r\n";
char header[] = "<html><body BGCOLOR=\"#ffffff\">\n<pre>\n";
char body[] = "greetings from yaSSL\n";
char footer[] = "</body></html>\r\n\r\n";
strncpy(command, type, sizeof(type));
echoSz = sizeof(type) - 1;
strncpy(&command[echoSz], header, sizeof(header));
echoSz += sizeof(header) - 1;
strncpy(&command[echoSz], body, sizeof(body));
echoSz += sizeof(body) - 1;
strncpy(&command[echoSz], footer, sizeof(footer));
echoSz += sizeof(footer);
if (SSL_write(ssl, command, echoSz) != echoSz)
err_sys("SSL_write failed");
break;
}
command[echoSz] = 0;
#ifdef ECHO_OUT
fputs(command, fout);
#endif
if (SSL_write(ssl, command, echoSz) != echoSz)
err_sys("SSL_write failed");
}
SSL_free(ssl);
}
#ifdef _WIN32
closesocket(sockfd);
#else
close(sockfd);
#endif
DH_free(dh);
SSL_CTX_free(ctx);
((func_args*)args)->return_code = 0;
return 0;
}
# Microsoft Developer Studio Project File - Name="echoserver" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=echoserver - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "echoserver.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "echoserver.mak" CFG="echoserver - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "echoserver - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "echoserver - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "echoserver - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "..\..\include" /I "..\..\taocrypt\include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "echoserver - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "..\..\include" /I "..\..\taocrypt\include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "echoserver - Win32 Release"
# Name "echoserver - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\echoserver.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
/* server.cpp */
#include "../../testsuite/test.hpp"
THREAD_RETURN YASSL_API server_test(void* args)
{
#ifdef _WIN32
WSADATA wsd;
WSAStartup(0x0002, &wsd);
#endif
SOCKET_T sockfd = 0;
int clientfd = 0;
int argc = 0;
char** argv = 0;
set_args(argc, argv, *static_cast<func_args*>(args));
tcp_accept(sockfd, clientfd, *static_cast<func_args*>(args));
#ifdef _WIN32
closesocket(sockfd);
#else
close(sockfd);
#endif
SSL_METHOD* method = TLSv1_server_method();
SSL_CTX* ctx = SSL_CTX_new(method);
//SSL_CTX_set_cipher_list(ctx, "RC4-SHA");
SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, 0);
set_serverCerts(ctx);
DH* dh = set_tmpDH(ctx);
SSL* ssl = SSL_new(ctx);
SSL_set_fd(ssl, clientfd);
if (SSL_accept(ssl) != SSL_SUCCESS) err_sys("SSL_accept failed");
showPeer(ssl);
printf("Using Cipher Suite %s\n", SSL_get_cipher(ssl));
char command[1024];
command[SSL_read(ssl, command, sizeof(command))] = 0;
printf("First client command: %s\n", command);
char msg[] = "I hear you, fa shizzle!";
if (SSL_write(ssl, msg, sizeof(msg)) != sizeof(msg))
err_sys("SSL_write failed");
DH_free(dh);
SSL_CTX_free(ctx);
SSL_free(ssl);
((func_args*)args)->return_code = 0;
return 0;
}
#ifndef NO_MAIN_DRIVER
int main(int argc, char** argv)
{
func_args args;
args.argc = argc;
args.argv = argv;
server_test(&args);
return args.return_code;
}
#endif // NO_MAIN_DRIVER
# Microsoft Developer Studio Project File - Name="server" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=server - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "server.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "server.mak" CFG="server - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "server - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "server - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "server - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /O2 /I "..\..\include" /I "..\..\taocrypt\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /subsystem:console /machine:I386
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "server - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "..\..\include" /I "..\..\taocrypt\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# SUBTRACT LINK32 /pdb:none /nodefaultlib
!ENDIF
# Begin Target
# Name "server - Win32 Release"
# Name "server - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\server.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
...@@ -83,6 +83,7 @@ class CertManager { ...@@ -83,6 +83,7 @@ class CertManager {
SignerList signers_; // decoded CA keys and names SignerList signers_; // decoded CA keys and names
// plus verified chained certs // plus verified chained certs
bool verifyPeer_; bool verifyPeer_;
bool verifyNone_; // no error if verify fails
bool failNoCert_; bool failNoCert_;
bool sendVerify_; bool sendVerify_;
public: public:
...@@ -107,10 +108,12 @@ public: ...@@ -107,10 +108,12 @@ public:
uint get_privateKeyLength() const; uint get_privateKeyLength() const;
bool verifyPeer() const; bool verifyPeer() const;
bool verifyNone() const;
bool failNoCert() const; bool failNoCert() const;
bool sendVerify() const; bool sendVerify() const;
void setVerifyPeer(); void setVerifyPeer();
void setVerifyNone();
void setFailNoCert(); void setFailNoCert();
void setSendVerify(); void setSendVerify();
private: private:
......
...@@ -41,8 +41,8 @@ ...@@ -41,8 +41,8 @@
namespace yaSSL { namespace yaSSL {
// Digest policy should implement a get_digest, update, and get sizes for pad and // Digest policy should implement a get_digest, update, and get sizes for pad
// digest // and digest
struct Digest : public virtual_base { struct Digest : public virtual_base {
virtual void get_digest(byte*) = 0; virtual void get_digest(byte*) = 0;
virtual void get_digest(byte*, const byte*, unsigned int) = 0; virtual void get_digest(byte*, const byte*, unsigned int) = 0;
...@@ -380,7 +380,7 @@ public: ...@@ -380,7 +380,7 @@ public:
uint get_agreedKeyLength() const; uint get_agreedKeyLength() const;
const byte* get_agreedKey() const; const byte* get_agreedKey() const;
const byte* get_publicKey() const; const byte* get_publicKey() const;
void makeAgreement(const byte*); void makeAgreement(const byte*, unsigned int);
void set_sizes(int&, int&, int&) const; void set_sizes(int&, int&, int&) const;
void get_parms(byte*, byte*, byte*) const; void get_parms(byte*, byte*, byte*) const;
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
* *
*/ */
#ifndef yaSSL_openssl_h__ #ifndef yaSSL_openssl_h__
#define yaSSL_openssl_h__ #define yaSSL_openssl_h__
...@@ -49,7 +51,7 @@ extern "C" { ...@@ -49,7 +51,7 @@ extern "C" {
class X509_NAME; class X509_NAME;
#else #else
typedef struct SSL SSL; typedef struct SSL SSL;
typedef struct SSL_SESION SSL_SESSION; typedef struct SSL_SESSION SSL_SESSION;
typedef struct SSL_METHOD SSL_METHOD; typedef struct SSL_METHOD SSL_METHOD;
typedef struct SSL_CTX SSL_CTX; typedef struct SSL_CTX SSL_CTX;
typedef struct SSL_CIPHER SSL_CIPHER; typedef struct SSL_CIPHER SSL_CIPHER;
...@@ -258,6 +260,8 @@ int SSL_pending(SSL*); ...@@ -258,6 +260,8 @@ int SSL_pending(SSL*);
enum { /* ssl Constants */ enum { /* ssl Constants */
SSL_BAD_STAT = -7,
SSL_BAD_PATH = -6,
SSL_BAD_FILETYPE = -5, SSL_BAD_FILETYPE = -5,
SSL_BAD_FILE = -4, SSL_BAD_FILE = -4,
SSL_NOT_IMPLEMENTED = -3, SSL_NOT_IMPLEMENTED = -3,
......
...@@ -77,7 +77,7 @@ public: ...@@ -77,7 +77,7 @@ public:
uint send(const byte* buf, unsigned int len, int flags = 0) const; uint send(const byte* buf, unsigned int len, int flags = 0) const;
uint receive(byte* buf, unsigned int len, int flags = 0) const; uint receive(byte* buf, unsigned int len, int flags = 0) const;
void wait() const; bool wait() const;
void closeSocket(); void closeSocket();
void shutDown(int how = SD_SEND); void shutDown(int how = SD_SEND);
......
/* yassl.hpp
*
* Copyright (C) 2003 Sawtooth Consulting Ltd.
*
* This file is part of yaSSL.
*
* yaSSL 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.
*
* yaSSL 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
/* yaSSL externel header defines yaSSL API
*/
#ifndef yaSSL_EXT_HPP
#define yaSSL_EXT_HPP
namespace yaSSL {
#ifdef _WIN32
typedef unsigned int SOCKET_T;
#else
typedef int SOCKET_T;
#endif
class Client {
public:
Client();
~Client();
// basics
int Connect(SOCKET_T);
int Write(const void*, int);
int Read(void*, int);
// options
void SetCA(const char*);
void SetCert(const char*);
void SetKey(const char*);
private:
struct ClientImpl;
ClientImpl* pimpl_;
Client(const Client&); // hide copy
Client& operator=(const Client&); // and assign
};
class Server {
public:
Server();
~Server();
// basics
int Accept(SOCKET_T);
int Write(const void*, int);
int Read(void*, int);
// options
void SetCA(const char*);
void SetCert(const char*);
void SetKey(const char*);
private:
struct ServerImpl;
ServerImpl* pimpl_;
Server(const Server&); // hide copy
Server& operator=(const Server&); // and assign
};
} // namespace yaSSL
#endif // yaSSL_EXT_HPP
...@@ -59,6 +59,10 @@ enum YasslError { ...@@ -59,6 +59,10 @@ enum YasslError {
enum Library { yaSSL_Lib = 0, CryptoLib, SocketLib }; enum Library { yaSSL_Lib = 0, CryptoLib, SocketLib };
enum { MAX_ERROR_SZ = 80 };
void SetErrorString(YasslError, char*);
// Base class for all yaSSL exceptions // Base class for all yaSSL exceptions
class Error : public mySTL::runtime_error { class Error : public mySTL::runtime_error {
......
...@@ -662,7 +662,7 @@ struct Parameters { ...@@ -662,7 +662,7 @@ struct Parameters {
uint8 suites_size_; uint8 suites_size_;
Cipher suites_[MAX_SUITE_SZ]; Cipher suites_[MAX_SUITE_SZ];
char cipher_name_[MAX_SUITE_NAME]; char cipher_name_[MAX_SUITE_NAME];
char cipher_list_[MAX_CIPHER_LIST]; char cipher_list_[MAX_CIPHERS][MAX_SUITE_NAME];
Parameters(ConnectionEnd, const Ciphers&, ProtocolVersion); Parameters(ConnectionEnd, const Ciphers&, ProtocolVersion);
......
...@@ -77,8 +77,6 @@ enum ServerState { ...@@ -77,8 +77,6 @@ enum ServerState {
// combines all states // combines all states
class States { class States {
enum {MAX_ERROR_SZ = 80 };
RecordLayerState recordLayer_; RecordLayerState recordLayer_;
HandShakeState handshakeLayer_; HandShakeState handshakeLayer_;
ClientState clientState_; ClientState clientState_;
...@@ -227,7 +225,8 @@ sslFactory& GetSSL_Factory(); ...@@ -227,7 +225,8 @@ sslFactory& GetSSL_Factory();
class SSL_METHOD { class SSL_METHOD {
ProtocolVersion version_; ProtocolVersion version_;
ConnectionEnd side_; ConnectionEnd side_;
bool verifyPeer_; bool verifyPeer_; // request or send certificate
bool verifyNone_; // whether to verify certificate
bool failNoCert_; bool failNoCert_;
public: public:
explicit SSL_METHOD(ConnectionEnd ce, ProtocolVersion pv); explicit SSL_METHOD(ConnectionEnd ce, ProtocolVersion pv);
...@@ -236,9 +235,11 @@ public: ...@@ -236,9 +235,11 @@ public:
ConnectionEnd getSide() const; ConnectionEnd getSide() const;
void setVerifyPeer(); void setVerifyPeer();
void setVerifyNone();
void setFailNoCert(); void setFailNoCert();
bool verifyPeer() const; bool verifyPeer() const;
bool verifyNone() const;
bool failNoCert() const; bool failNoCert() const;
private: private:
SSL_METHOD(const SSL_METHOD&); // hide copy SSL_METHOD(const SSL_METHOD&); // hide copy
...@@ -331,6 +332,7 @@ public: ...@@ -331,6 +332,7 @@ public:
const Stats& GetStats() const; const Stats& GetStats() const;
void setVerifyPeer(); void setVerifyPeer();
void setVerifyNone();
void setFailNoCert(); void setFailNoCert();
bool SetCipherList(const char*); bool SetCipherList(const char*);
bool SetDH(const DH&); bool SetDH(const DH&);
......
...@@ -39,32 +39,34 @@ namespace yaSSL { ...@@ -39,32 +39,34 @@ namespace yaSSL {
void CleanUp(); void CleanUp();
// library allocation #ifdef YASSL_PURE_C
struct new_t {}; // yaSSL New type
extern new_t ys; // pass in parameter
} // namespace yaSSL // library allocation
struct new_t {}; // yaSSL New type
extern new_t ys; // pass in parameter
void* operator new (size_t, yaSSL::new_t); } // namespace yaSSL
void* operator new[](size_t, yaSSL::new_t);
void operator delete (void*, yaSSL::new_t); void* operator new (size_t, yaSSL::new_t);
void operator delete[](void*, yaSSL::new_t); void* operator new[](size_t, yaSSL::new_t);
void operator delete (void*, yaSSL::new_t);
void operator delete[](void*, yaSSL::new_t);
namespace yaSSL {
namespace yaSSL {
template<typename T>
void ysDelete(T* ptr) template<typename T>
{ void ysDelete(T* ptr)
{
if (ptr) ptr->~T(); if (ptr) ptr->~T();
::operator delete(ptr, yaSSL::ys); ::operator delete(ptr, yaSSL::ys);
} }
template<typename T> template<typename T>
void ysArrayDelete(T* ptr) void ysArrayDelete(T* ptr)
{ {
// can't do array placement destruction since not tracking size in // can't do array placement destruction since not tracking size in
// allocation, only allow builtins to use array placement since they // allocation, only allow builtins to use array placement since they
// don't need destructors called // don't need destructors called
...@@ -72,15 +74,40 @@ void ysArrayDelete(T* ptr) ...@@ -72,15 +74,40 @@ void ysArrayDelete(T* ptr)
(void)sizeof(builtin); (void)sizeof(builtin);
::operator delete[](ptr, yaSSL::ys); ::operator delete[](ptr, yaSSL::ys);
} }
#define NEW_YS new (ys)
// to resolve compiler generated operator delete on base classes with // to resolve compiler generated operator delete on base classes with
// virtual destructors (when on stack), make sure doesn't get called // virtual destructors (when on stack), make sure doesn't get called
class virtual_base { class virtual_base {
public: public:
static void operator delete(void*) { assert(0); } static void operator delete(void*) { assert(0); }
}; };
#else // YASSL_PURE_C
template<typename T>
void ysDelete(T* ptr)
{
delete ptr;
}
template<typename T>
void ysArrayDelete(T* ptr)
{
delete[] ptr;
}
#define NEW_YS new
class virtual_base {};
#endif // YASSL_PURE_C
typedef unsigned char uint8; typedef unsigned char uint8;
...@@ -110,7 +137,7 @@ const int KEY_PREFIX = 7; // up to 7 prefix letters for key rounds ...@@ -110,7 +137,7 @@ const int KEY_PREFIX = 7; // up to 7 prefix letters for key rounds
const int FORTEZZA_MAX = 128; // Maximum Fortezza Key length const int FORTEZZA_MAX = 128; // Maximum Fortezza Key length
const int MAX_SUITE_SZ = 64; // 32 max suites * sizeof(suite) const int MAX_SUITE_SZ = 64; // 32 max suites * sizeof(suite)
const int MAX_SUITE_NAME = 48; // max length of suite name const int MAX_SUITE_NAME = 48; // max length of suite name
const int MAX_CIPHER_LIST = 512; // max length of cipher list names const int MAX_CIPHERS = 32; // max supported ciphers for cipher list
const int SIZEOF_ENUM = 1; // SSL considers an enum 1 byte, not 4 const int SIZEOF_ENUM = 1; // SSL considers an enum 1 byte, not 4
const int SIZEOF_SENDER = 4; // Sender constant, for finished generation const int SIZEOF_SENDER = 4; // Sender constant, for finished generation
const int PAD_MD5 = 48; // pad length 1 and 2 for md5 finished const int PAD_MD5 = 48; // pad length 1 and 2 for md5 finished
......
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
#define mySTL_HELPERS_HPP #define mySTL_HELPERS_HPP
#include <stdlib.h> #include <stdlib.h>
#ifdef _MSC_VER
#include <new>
#endif
/* /*
Workaround for the lack of operator new(size_t, void*) Workaround for the lack of operator new(size_t, void*)
...@@ -43,7 +46,6 @@ ...@@ -43,7 +46,6 @@
typedef Dummy* yassl_pointer; typedef Dummy* yassl_pointer;
namespace mySTL { namespace mySTL {
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
* with SSL types and sockets * with SSL types and sockets
*/ */
#include <string.h> // memcpy #include <string.h> // memcpy
#include "runtime.hpp" #include "runtime.hpp"
#include "buffer.hpp" #include "buffer.hpp"
...@@ -63,13 +64,13 @@ input_buffer::input_buffer() ...@@ -63,13 +64,13 @@ input_buffer::input_buffer()
input_buffer::input_buffer(uint s) input_buffer::input_buffer(uint s)
: size_(0), current_(0), buffer_(new (ys) byte[s]), end_(buffer_ + s) : size_(0), current_(0), buffer_(NEW_YS byte[s]), end_(buffer_ + s)
{} {}
// with assign // with assign
input_buffer::input_buffer(uint s, const byte* t, uint len) input_buffer::input_buffer(uint s, const byte* t, uint len)
: size_(0), current_(0), buffer_(new (ys) byte[s]), end_(buffer_ + s) : size_(0), current_(0), buffer_(NEW_YS byte[s]), end_(buffer_ + s)
{ {
assign(t, len); assign(t, len);
} }
...@@ -85,7 +86,7 @@ input_buffer::~input_buffer() ...@@ -85,7 +86,7 @@ input_buffer::~input_buffer()
void input_buffer::allocate(uint s) void input_buffer::allocate(uint s)
{ {
assert(!buffer_); // find realloc error assert(!buffer_); // find realloc error
buffer_ = new (ys) byte[s]; buffer_ = NEW_YS byte[s];
end_ = buffer_ + s; end_ = buffer_ + s;
} }
...@@ -97,7 +98,7 @@ byte* input_buffer::get_buffer() const ...@@ -97,7 +98,7 @@ byte* input_buffer::get_buffer() const
} }
// after a raw write user can set new (ys) size // after a raw write user can set NEW_YS size
// if you know the size before the write use assign() // if you know the size before the write use assign()
void input_buffer::add_size(uint i) void input_buffer::add_size(uint i)
{ {
...@@ -199,13 +200,13 @@ output_buffer::output_buffer() ...@@ -199,13 +200,13 @@ output_buffer::output_buffer()
// with allocate // with allocate
output_buffer::output_buffer(uint s) output_buffer::output_buffer(uint s)
: current_(0), buffer_(new (ys) byte[s]), end_(buffer_ + s) : current_(0), buffer_(NEW_YS byte[s]), end_(buffer_ + s)
{} {}
// with assign // with assign
output_buffer::output_buffer(uint s, const byte* t, uint len) output_buffer::output_buffer(uint s, const byte* t, uint len)
: current_(0), buffer_(new (ys) byte[s]), end_(buffer_+ s) : current_(0), buffer_(NEW_YS byte[s]), end_(buffer_+ s)
{ {
write(t, len); write(t, len);
} }
...@@ -240,7 +241,7 @@ void output_buffer::set_current(uint c) ...@@ -240,7 +241,7 @@ void output_buffer::set_current(uint c)
void output_buffer::allocate(uint s) void output_buffer::allocate(uint s)
{ {
assert(!buffer_); // find realloc error assert(!buffer_); // find realloc error
buffer_ = new (ys) byte[s]; end_ = buffer_ + s; buffer_ = NEW_YS byte[s]; end_ = buffer_ + s;
} }
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
namespace yaSSL { namespace yaSSL {
x509::x509(uint sz) : length_(sz), buffer_(new (ys) opaque[sz]) x509::x509(uint sz) : length_(sz), buffer_(NEW_YS opaque[sz])
{ {
} }
...@@ -51,7 +51,7 @@ x509::~x509() ...@@ -51,7 +51,7 @@ x509::~x509()
x509::x509(const x509& that) : length_(that.length_), x509::x509(const x509& that) : length_(that.length_),
buffer_(new (ys) opaque[length_]) buffer_(NEW_YS opaque[length_])
{ {
memcpy(buffer_, that.buffer_, length_); memcpy(buffer_, that.buffer_, length_);
} }
...@@ -92,7 +92,8 @@ opaque* x509::use_buffer() ...@@ -92,7 +92,8 @@ opaque* x509::use_buffer()
//CertManager //CertManager
CertManager::CertManager() CertManager::CertManager()
: peerX509_(0), verifyPeer_(false), failNoCert_(false), sendVerify_(false) : peerX509_(0), verifyPeer_(false), verifyNone_(false), failNoCert_(false),
sendVerify_(false)
{} {}
...@@ -114,6 +115,12 @@ bool CertManager::verifyPeer() const ...@@ -114,6 +115,12 @@ bool CertManager::verifyPeer() const
} }
bool CertManager::verifyNone() const
{
return verifyNone_;
}
bool CertManager::failNoCert() const bool CertManager::failNoCert() const
{ {
return failNoCert_; return failNoCert_;
...@@ -132,6 +139,12 @@ void CertManager::setVerifyPeer() ...@@ -132,6 +139,12 @@ void CertManager::setVerifyPeer()
} }
void CertManager::setVerifyNone()
{
verifyNone_ = true;
}
void CertManager::setFailNoCert() void CertManager::setFailNoCert()
{ {
failNoCert_ = true; failNoCert_ = true;
...@@ -153,7 +166,7 @@ void CertManager::AddPeerCert(x509* x) ...@@ -153,7 +166,7 @@ void CertManager::AddPeerCert(x509* x)
void CertManager::CopySelfCert(const x509* x) void CertManager::CopySelfCert(const x509* x)
{ {
if (x) if (x)
list_.push_back(new (ys) x509(*x)); list_.push_back(NEW_YS x509(*x));
} }
...@@ -161,11 +174,12 @@ void CertManager::CopySelfCert(const x509* x) ...@@ -161,11 +174,12 @@ void CertManager::CopySelfCert(const x509* x)
int CertManager::CopyCaCert(const x509* x) int CertManager::CopyCaCert(const x509* x)
{ {
TaoCrypt::Source source(x->get_buffer(), x->get_length()); TaoCrypt::Source source(x->get_buffer(), x->get_length());
TaoCrypt::CertDecoder cert(source, true, &signers_); TaoCrypt::CertDecoder cert(source, true, &signers_, verifyNone_,
TaoCrypt::CertDecoder::CA);
if (!cert.GetError().What()) { if (!cert.GetError().What()) {
const TaoCrypt::PublicKey& key = cert.GetPublicKey(); const TaoCrypt::PublicKey& key = cert.GetPublicKey();
signers_.push_back(new (ys) TaoCrypt::Signer(key.GetKey(), key.size(), signers_.push_back(NEW_YS TaoCrypt::Signer(key.GetKey(), key.size(),
cert.GetCommonName(), cert.GetHash())); cert.GetCommonName(), cert.GetHash()));
} }
return cert.GetError().What(); return cert.GetError().What();
...@@ -228,13 +242,13 @@ int CertManager::Validate() ...@@ -228,13 +242,13 @@ int CertManager::Validate()
while ( count > 1 ) { while ( count > 1 ) {
TaoCrypt::Source source((*last)->get_buffer(), (*last)->get_length()); TaoCrypt::Source source((*last)->get_buffer(), (*last)->get_length());
TaoCrypt::CertDecoder cert(source, true, &signers_); TaoCrypt::CertDecoder cert(source, true, &signers_, verifyNone_);
if (int err = cert.GetError().What()) if (int err = cert.GetError().What())
return err; return err;
const TaoCrypt::PublicKey& key = cert.GetPublicKey(); const TaoCrypt::PublicKey& key = cert.GetPublicKey();
signers_.push_back(new (ys) TaoCrypt::Signer(key.GetKey(), key.size(), signers_.push_back(NEW_YS TaoCrypt::Signer(key.GetKey(), key.size(),
cert.GetCommonName(), cert.GetHash())); cert.GetCommonName(), cert.GetHash()));
--last; --last;
--count; --count;
...@@ -243,7 +257,7 @@ int CertManager::Validate() ...@@ -243,7 +257,7 @@ int CertManager::Validate()
if (count) { if (count) {
// peer's is at the front // peer's is at the front
TaoCrypt::Source source((*last)->get_buffer(), (*last)->get_length()); TaoCrypt::Source source((*last)->get_buffer(), (*last)->get_length());
TaoCrypt::CertDecoder cert(source, true, &signers_); TaoCrypt::CertDecoder cert(source, true, &signers_, verifyNone_);
if (int err = cert.GetError().What()) if (int err = cert.GetError().What())
return err; return err;
...@@ -259,7 +273,7 @@ int CertManager::Validate() ...@@ -259,7 +273,7 @@ int CertManager::Validate()
int iSz = cert.GetIssuer() ? strlen(cert.GetIssuer()) + 1 : 0; int iSz = cert.GetIssuer() ? strlen(cert.GetIssuer()) + 1 : 0;
int sSz = cert.GetCommonName() ? strlen(cert.GetCommonName()) + 1 : 0; int sSz = cert.GetCommonName() ? strlen(cert.GetCommonName()) + 1 : 0;
peerX509_ = new (ys) X509(cert.GetIssuer(), iSz, cert.GetCommonName(), peerX509_ = NEW_YS X509(cert.GetIssuer(), iSz, cert.GetCommonName(),
sSz); sSz);
} }
return 0; return 0;
......
...@@ -58,13 +58,13 @@ struct MD5::MD5Impl { ...@@ -58,13 +58,13 @@ struct MD5::MD5Impl {
}; };
MD5::MD5() : pimpl_(new (ys) MD5Impl) {} MD5::MD5() : pimpl_(NEW_YS MD5Impl) {}
MD5::~MD5() { ysDelete(pimpl_); } MD5::~MD5() { ysDelete(pimpl_); }
MD5::MD5(const MD5& that) : Digest(), pimpl_(new (ys) MD5::MD5(const MD5& that) : Digest(), pimpl_(NEW_YS
MD5Impl(that.pimpl_->md5_)) {} MD5Impl(that.pimpl_->md5_)) {}
...@@ -116,13 +116,13 @@ struct SHA::SHAImpl { ...@@ -116,13 +116,13 @@ struct SHA::SHAImpl {
}; };
SHA::SHA() : pimpl_(new (ys) SHAImpl) {} SHA::SHA() : pimpl_(NEW_YS SHAImpl) {}
SHA::~SHA() { ysDelete(pimpl_); } SHA::~SHA() { ysDelete(pimpl_); }
SHA::SHA(const SHA& that) : Digest(), pimpl_(new (ys) SHAImpl(that.pimpl_->sha_)) {} SHA::SHA(const SHA& that) : Digest(), pimpl_(NEW_YS SHAImpl(that.pimpl_->sha_)) {}
SHA& SHA::operator=(const SHA& that) SHA& SHA::operator=(const SHA& that)
{ {
...@@ -173,13 +173,13 @@ struct RMD::RMDImpl { ...@@ -173,13 +173,13 @@ struct RMD::RMDImpl {
}; };
RMD::RMD() : pimpl_(new (ys) RMDImpl) {} RMD::RMD() : pimpl_(NEW_YS RMDImpl) {}
RMD::~RMD() { ysDelete(pimpl_); } RMD::~RMD() { ysDelete(pimpl_); }
RMD::RMD(const RMD& that) : Digest(), pimpl_(new (ys) RMDImpl(that.pimpl_->rmd_)) {} RMD::RMD(const RMD& that) : Digest(), pimpl_(NEW_YS RMDImpl(that.pimpl_->rmd_)) {}
RMD& RMD::operator=(const RMD& that) RMD& RMD::operator=(const RMD& that)
{ {
...@@ -230,7 +230,7 @@ struct HMAC_MD5::HMAC_MD5Impl { ...@@ -230,7 +230,7 @@ struct HMAC_MD5::HMAC_MD5Impl {
HMAC_MD5::HMAC_MD5(const byte* secret, unsigned int len) HMAC_MD5::HMAC_MD5(const byte* secret, unsigned int len)
: pimpl_(new (ys) HMAC_MD5Impl) : pimpl_(NEW_YS HMAC_MD5Impl)
{ {
pimpl_->mac_.SetKey(secret, len); pimpl_->mac_.SetKey(secret, len);
} }
...@@ -280,7 +280,7 @@ struct HMAC_SHA::HMAC_SHAImpl { ...@@ -280,7 +280,7 @@ struct HMAC_SHA::HMAC_SHAImpl {
HMAC_SHA::HMAC_SHA(const byte* secret, unsigned int len) HMAC_SHA::HMAC_SHA(const byte* secret, unsigned int len)
: pimpl_(new (ys) HMAC_SHAImpl) : pimpl_(NEW_YS HMAC_SHAImpl)
{ {
pimpl_->mac_.SetKey(secret, len); pimpl_->mac_.SetKey(secret, len);
} }
...@@ -331,7 +331,7 @@ struct HMAC_RMD::HMAC_RMDImpl { ...@@ -331,7 +331,7 @@ struct HMAC_RMD::HMAC_RMDImpl {
HMAC_RMD::HMAC_RMD(const byte* secret, unsigned int len) HMAC_RMD::HMAC_RMD(const byte* secret, unsigned int len)
: pimpl_(new (ys) HMAC_RMDImpl) : pimpl_(NEW_YS HMAC_RMDImpl)
{ {
pimpl_->mac_.SetKey(secret, len); pimpl_->mac_.SetKey(secret, len);
} }
...@@ -379,7 +379,7 @@ struct DES::DESImpl { ...@@ -379,7 +379,7 @@ struct DES::DESImpl {
}; };
DES::DES() : pimpl_(new (ys) DESImpl) {} DES::DES() : pimpl_(NEW_YS DESImpl) {}
DES::~DES() { ysDelete(pimpl_); } DES::~DES() { ysDelete(pimpl_); }
...@@ -415,7 +415,7 @@ struct DES_EDE::DES_EDEImpl { ...@@ -415,7 +415,7 @@ struct DES_EDE::DES_EDEImpl {
}; };
DES_EDE::DES_EDE() : pimpl_(new (ys) DES_EDEImpl) {} DES_EDE::DES_EDE() : pimpl_(NEW_YS DES_EDEImpl) {}
DES_EDE::~DES_EDE() { ysDelete(pimpl_); } DES_EDE::~DES_EDE() { ysDelete(pimpl_); }
...@@ -453,7 +453,7 @@ struct RC4::RC4Impl { ...@@ -453,7 +453,7 @@ struct RC4::RC4Impl {
}; };
RC4::RC4() : pimpl_(new (ys) RC4Impl) {} RC4::RC4() : pimpl_(NEW_YS RC4Impl) {}
RC4::~RC4() { ysDelete(pimpl_); } RC4::~RC4() { ysDelete(pimpl_); }
...@@ -495,7 +495,7 @@ struct AES::AESImpl { ...@@ -495,7 +495,7 @@ struct AES::AESImpl {
}; };
AES::AES(unsigned int ks) : pimpl_(new (ys) AESImpl(ks)) {} AES::AES(unsigned int ks) : pimpl_(NEW_YS AESImpl(ks)) {}
AES::~AES() { ysDelete(pimpl_); } AES::~AES() { ysDelete(pimpl_); }
...@@ -536,7 +536,7 @@ struct RandomPool::RandomImpl { ...@@ -536,7 +536,7 @@ struct RandomPool::RandomImpl {
TaoCrypt::RandomNumberGenerator RNG_; TaoCrypt::RandomNumberGenerator RNG_;
}; };
RandomPool::RandomPool() : pimpl_(new (ys) RandomImpl) {} RandomPool::RandomPool() : pimpl_(NEW_YS RandomImpl) {}
RandomPool::~RandomPool() { ysDelete(pimpl_); } RandomPool::~RandomPool() { ysDelete(pimpl_); }
...@@ -580,7 +580,7 @@ void DSS::DSSImpl::SetPrivate(const byte* key, unsigned int sz) ...@@ -580,7 +580,7 @@ void DSS::DSSImpl::SetPrivate(const byte* key, unsigned int sz)
// Set public or private key // Set public or private key
DSS::DSS(const byte* key, unsigned int sz, bool publicKey) DSS::DSS(const byte* key, unsigned int sz, bool publicKey)
: pimpl_(new (ys) DSSImpl) : pimpl_(NEW_YS DSSImpl)
{ {
if (publicKey) if (publicKey)
pimpl_->SetPublic(key, sz); pimpl_->SetPublic(key, sz);
...@@ -651,7 +651,7 @@ void RSA::RSAImpl::SetPrivate(const byte* key, unsigned int sz) ...@@ -651,7 +651,7 @@ void RSA::RSAImpl::SetPrivate(const byte* key, unsigned int sz)
// Set public or private key // Set public or private key
RSA::RSA(const byte* key, unsigned int sz, bool publicKey) RSA::RSA(const byte* key, unsigned int sz, bool publicKey)
: pimpl_(new (ys) RSAImpl) : pimpl_(NEW_YS RSAImpl)
{ {
if (publicKey) if (publicKey)
pimpl_->SetPublic(key, sz); pimpl_->SetPublic(key, sz);
...@@ -723,13 +723,13 @@ struct Integer::IntegerImpl { ...@@ -723,13 +723,13 @@ struct Integer::IntegerImpl {
explicit IntegerImpl(const TaoCrypt::Integer& i) : int_(i) {} explicit IntegerImpl(const TaoCrypt::Integer& i) : int_(i) {}
}; };
Integer::Integer() : pimpl_(new (ys) IntegerImpl) {} Integer::Integer() : pimpl_(NEW_YS IntegerImpl) {}
Integer::~Integer() { ysDelete(pimpl_); } Integer::~Integer() { ysDelete(pimpl_); }
Integer::Integer(const Integer& other) : pimpl_(new (ys) Integer::Integer(const Integer& other) : pimpl_(NEW_YS
IntegerImpl(other.pimpl_->int_)) IntegerImpl(other.pimpl_->int_))
{} {}
...@@ -773,9 +773,9 @@ struct DiffieHellman::DHImpl { ...@@ -773,9 +773,9 @@ struct DiffieHellman::DHImpl {
void AllocKeys(unsigned int pubSz, unsigned int privSz, unsigned int agrSz) void AllocKeys(unsigned int pubSz, unsigned int privSz, unsigned int agrSz)
{ {
publicKey_ = new (ys) byte[pubSz]; publicKey_ = NEW_YS byte[pubSz];
privateKey_ = new (ys) byte[privSz]; privateKey_ = NEW_YS byte[privSz];
agreedKey_ = new (ys) byte[agrSz]; agreedKey_ = NEW_YS byte[agrSz];
} }
}; };
...@@ -784,7 +784,7 @@ struct DiffieHellman::DHImpl { ...@@ -784,7 +784,7 @@ struct DiffieHellman::DHImpl {
/* /*
// server Side DH, server's view // server Side DH, server's view
DiffieHellman::DiffieHellman(const char* file, const RandomPool& random) DiffieHellman::DiffieHellman(const char* file, const RandomPool& random)
: pimpl_(new (ys) DHImpl(random.pimpl_->RNG_)) : pimpl_(NEW_YS DHImpl(random.pimpl_->RNG_))
{ {
using namespace TaoCrypt; using namespace TaoCrypt;
Source source; Source source;
...@@ -808,12 +808,12 @@ DiffieHellman::DiffieHellman(const char* file, const RandomPool& random) ...@@ -808,12 +808,12 @@ DiffieHellman::DiffieHellman(const char* file, const RandomPool& random)
DiffieHellman::DiffieHellman(const byte* p, unsigned int pSz, const byte* g, DiffieHellman::DiffieHellman(const byte* p, unsigned int pSz, const byte* g,
unsigned int gSz, const byte* pub, unsigned int gSz, const byte* pub,
unsigned int pubSz, const RandomPool& random) unsigned int pubSz, const RandomPool& random)
: pimpl_(new (ys) DHImpl(random.pimpl_->RNG_)) : pimpl_(NEW_YS DHImpl(random.pimpl_->RNG_))
{ {
using TaoCrypt::Integer; using TaoCrypt::Integer;
pimpl_->dh_.Initialize(Integer(p, pSz).Ref(), Integer(g, gSz).Ref()); pimpl_->dh_.Initialize(Integer(p, pSz).Ref(), Integer(g, gSz).Ref());
pimpl_->publicKey_ = new (ys) opaque[pubSz]; pimpl_->publicKey_ = NEW_YS opaque[pubSz];
memcpy(pimpl_->publicKey_, pub, pubSz); memcpy(pimpl_->publicKey_, pub, pubSz);
} }
...@@ -821,7 +821,7 @@ DiffieHellman::DiffieHellman(const byte* p, unsigned int pSz, const byte* g, ...@@ -821,7 +821,7 @@ DiffieHellman::DiffieHellman(const byte* p, unsigned int pSz, const byte* g,
// Server Side DH, server's view // Server Side DH, server's view
DiffieHellman::DiffieHellman(const Integer& p, const Integer& g, DiffieHellman::DiffieHellman(const Integer& p, const Integer& g,
const RandomPool& random) const RandomPool& random)
: pimpl_(new (ys) DHImpl(random.pimpl_->RNG_)) : pimpl_(NEW_YS DHImpl(random.pimpl_->RNG_))
{ {
using TaoCrypt::Integer; using TaoCrypt::Integer;
...@@ -839,7 +839,7 @@ DiffieHellman::~DiffieHellman() { ysDelete(pimpl_); } ...@@ -839,7 +839,7 @@ DiffieHellman::~DiffieHellman() { ysDelete(pimpl_); }
// Client side and view, use server that for p and g // Client side and view, use server that for p and g
DiffieHellman::DiffieHellman(const DiffieHellman& that) DiffieHellman::DiffieHellman(const DiffieHellman& that)
: pimpl_(new (ys) DHImpl(*that.pimpl_)) : pimpl_(NEW_YS DHImpl(*that.pimpl_))
{ {
pimpl_->dh_.GenerateKeyPair(pimpl_->ranPool_, pimpl_->privateKey_, pimpl_->dh_.GenerateKeyPair(pimpl_->ranPool_, pimpl_->privateKey_,
pimpl_->publicKey_); pimpl_->publicKey_);
...@@ -855,9 +855,9 @@ DiffieHellman& DiffieHellman::operator=(const DiffieHellman& that) ...@@ -855,9 +855,9 @@ DiffieHellman& DiffieHellman::operator=(const DiffieHellman& that)
} }
void DiffieHellman::makeAgreement(const byte* other) void DiffieHellman::makeAgreement(const byte* other, unsigned int otherSz)
{ {
pimpl_->dh_.Agree(pimpl_->agreedKey_, pimpl_->privateKey_, other); pimpl_->dh_.Agree(pimpl_->agreedKey_, pimpl_->privateKey_, other, otherSz);
} }
...@@ -960,7 +960,7 @@ x509* PemToDer(const char* fname, CertType type) ...@@ -960,7 +960,7 @@ x509* PemToDer(const char* fname, CertType type)
Base64Decoder b64Dec(der); Base64Decoder b64Dec(der);
uint sz = der.size(); uint sz = der.size();
mySTL::auto_ptr<x509> x(new (ys) x509(sz), ysDelete); mySTL::auto_ptr<x509> x(NEW_YS x509(sz), ysDelete);
memcpy(x->use_buffer(), der.get_buffer(), sz); memcpy(x->use_buffer(), der.get_buffer(), sz);
fclose(file); fclose(file);
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
* the various handshake messages. * the various handshake messages.
*/ */
#include "runtime.hpp" #include "runtime.hpp"
#include "handshake.hpp" #include "handshake.hpp"
#include "yassl_int.hpp" #include "yassl_int.hpp"
...@@ -362,9 +364,9 @@ void p_hash(output_buffer& result, const output_buffer& secret, ...@@ -362,9 +364,9 @@ void p_hash(output_buffer& result, const output_buffer& secret,
if (lastLen) times += 1; if (lastLen) times += 1;
if (hash == md5) if (hash == md5)
hmac.reset(new (ys) HMAC_MD5(secret.get_buffer(), secret.get_size())); hmac.reset(NEW_YS HMAC_MD5(secret.get_buffer(), secret.get_size()));
else else
hmac.reset(new (ys) HMAC_SHA(secret.get_buffer(), secret.get_size())); hmac.reset(NEW_YS HMAC_SHA(secret.get_buffer(), secret.get_size()));
// A0 = seed // A0 = seed
hmac->get_digest(previous, seed.get_buffer(), seed.get_size());// A1 hmac->get_digest(previous, seed.get_buffer(), seed.get_size());// A1
uint lastTime = times - 1; uint lastTime = times - 1;
...@@ -582,11 +584,11 @@ void TLS_hmac(SSL& ssl, byte* digest, const byte* buffer, uint sz, ...@@ -582,11 +584,11 @@ void TLS_hmac(SSL& ssl, byte* digest, const byte* buffer, uint sz,
MACAlgorithm algo = ssl.getSecurity().get_parms().mac_algorithm_; MACAlgorithm algo = ssl.getSecurity().get_parms().mac_algorithm_;
if (algo == sha) if (algo == sha)
hmac.reset(new (ys) HMAC_SHA(ssl.get_macSecret(verify), SHA_LEN)); hmac.reset(NEW_YS HMAC_SHA(ssl.get_macSecret(verify), SHA_LEN));
else if (algo == rmd) else if (algo == rmd)
hmac.reset(new (ys) HMAC_RMD(ssl.get_macSecret(verify), RMD_LEN)); hmac.reset(NEW_YS HMAC_RMD(ssl.get_macSecret(verify), RMD_LEN));
else else
hmac.reset(new (ys) HMAC_MD5(ssl.get_macSecret(verify), MD5_LEN)); hmac.reset(NEW_YS HMAC_MD5(ssl.get_macSecret(verify), MD5_LEN));
hmac->update(seq, SEQ_SZ); // seq_num hmac->update(seq, SEQ_SZ); // seq_num
inner[0] = content; // type inner[0] = content; // type
...@@ -603,7 +605,7 @@ void TLS_hmac(SSL& ssl, byte* digest, const byte* buffer, uint sz, ...@@ -603,7 +605,7 @@ void TLS_hmac(SSL& ssl, byte* digest, const byte* buffer, uint sz,
void PRF(byte* digest, uint digLen, const byte* secret, uint secLen, void PRF(byte* digest, uint digLen, const byte* secret, uint secLen,
const byte* label, uint labLen, const byte* seed, uint seedLen) const byte* label, uint labLen, const byte* seed, uint seedLen)
{ {
uint half = secLen / 2 + secLen % 2; uint half = (secLen + 1) / 2;
output_buffer md5_half(half); output_buffer md5_half(half);
output_buffer sha_half(half); output_buffer sha_half(half);
...@@ -648,18 +650,19 @@ void build_certHashes(SSL& ssl, Hashes& hashes) ...@@ -648,18 +650,19 @@ void build_certHashes(SSL& ssl, Hashes& hashes)
} }
// do process input requests // do process input requests
mySTL::auto_ptr<input_buffer> mySTL::auto_ptr<input_buffer>
DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered) DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered)
{ {
ssl.getSocket().wait(); // wait for input if blocking // wait for input if blocking
uint ready = ssl.getSocket().get_ready(); if (!ssl.getSocket().wait()) {
if (!ready) {
// Nothing to receive after blocking wait => error
ssl.SetError(receive_error); ssl.SetError(receive_error);
buffered.reset(0); buffered.reset(0);
return buffered; return buffered;
} }
uint ready = ssl.getSocket().get_ready();
if (!ready) return buffered;
// add buffered data if its there // add buffered data if its there
uint buffSz = buffered.get() ? buffered.get()->get_size() : 0; uint buffSz = buffered.get() ? buffered.get()->get_size() : 0;
...@@ -690,7 +693,7 @@ DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered) ...@@ -690,7 +693,7 @@ DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered)
// make sure we have enough input in buffer to process this record // make sure we have enough input in buffer to process this record
if (hdr.length_ > buffer.get_remaining()) { if (hdr.length_ > buffer.get_remaining()) {
uint sz = buffer.get_remaining() + RECORD_HEADER; uint sz = buffer.get_remaining() + RECORD_HEADER;
buffered.reset(new (ys) input_buffer(sz, buffer.get_buffer() + buffered.reset(NEW_YS input_buffer(sz, buffer.get_buffer() +
buffer.get_current() - RECORD_HEADER, sz)); buffer.get_current() - RECORD_HEADER, sz));
break; break;
} }
...@@ -730,6 +733,7 @@ void processReply(SSL& ssl) ...@@ -730,6 +733,7 @@ void processReply(SSL& ssl)
buffered = tmp; buffered = tmp;
else else
break; break;
if (ssl.GetError()) return;
} }
} }
...@@ -767,7 +771,7 @@ void sendClientKeyExchange(SSL& ssl, BufferOutput buffer) ...@@ -767,7 +771,7 @@ void sendClientKeyExchange(SSL& ssl, BufferOutput buffer)
RecordLayerHeader rlHeader; RecordLayerHeader rlHeader;
HandShakeHeader hsHeader; HandShakeHeader hsHeader;
mySTL::auto_ptr<output_buffer> out(new (ys) output_buffer, ysDelete); mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer, ysDelete);
buildHeaders(ssl, hsHeader, rlHeader, ck); buildHeaders(ssl, hsHeader, rlHeader, ck);
buildOutput(*out.get(), rlHeader, hsHeader, ck); buildOutput(*out.get(), rlHeader, hsHeader, ck);
hashHandShake(ssl, *out.get()); hashHandShake(ssl, *out.get());
...@@ -788,7 +792,7 @@ void sendServerKeyExchange(SSL& ssl, BufferOutput buffer) ...@@ -788,7 +792,7 @@ void sendServerKeyExchange(SSL& ssl, BufferOutput buffer)
RecordLayerHeader rlHeader; RecordLayerHeader rlHeader;
HandShakeHeader hsHeader; HandShakeHeader hsHeader;
mySTL::auto_ptr<output_buffer> out(new (ys) output_buffer, ysDelete); mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer, ysDelete);
buildHeaders(ssl, hsHeader, rlHeader, sk); buildHeaders(ssl, hsHeader, rlHeader, sk);
buildOutput(*out.get(), rlHeader, hsHeader, sk); buildOutput(*out.get(), rlHeader, hsHeader, sk);
hashHandShake(ssl, *out.get()); hashHandShake(ssl, *out.get());
...@@ -813,7 +817,7 @@ void sendChangeCipher(SSL& ssl, BufferOutput buffer) ...@@ -813,7 +817,7 @@ void sendChangeCipher(SSL& ssl, BufferOutput buffer)
ChangeCipherSpec ccs; ChangeCipherSpec ccs;
RecordLayerHeader rlHeader; RecordLayerHeader rlHeader;
buildHeader(ssl, rlHeader, ccs); buildHeader(ssl, rlHeader, ccs);
mySTL::auto_ptr<output_buffer> out(new (ys) output_buffer, ysDelete); mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer, ysDelete);
buildOutput(*out.get(), rlHeader, ccs); buildOutput(*out.get(), rlHeader, ccs);
if (buffer == buffered) if (buffer == buffered)
...@@ -830,7 +834,7 @@ void sendFinished(SSL& ssl, ConnectionEnd side, BufferOutput buffer) ...@@ -830,7 +834,7 @@ void sendFinished(SSL& ssl, ConnectionEnd side, BufferOutput buffer)
Finished fin; Finished fin;
buildFinished(ssl, fin, side == client_end ? client : server); buildFinished(ssl, fin, side == client_end ? client : server);
mySTL::auto_ptr<output_buffer> out(new (ys) output_buffer, ysDelete); mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer, ysDelete);
cipherFinished(ssl, fin, *out.get()); // hashes handshake cipherFinished(ssl, fin, *out.get()); // hashes handshake
if (ssl.getSecurity().get_resuming()) { if (ssl.getSecurity().get_resuming()) {
...@@ -914,7 +918,7 @@ void sendServerHello(SSL& ssl, BufferOutput buffer) ...@@ -914,7 +918,7 @@ void sendServerHello(SSL& ssl, BufferOutput buffer)
ServerHello sh(ssl.getSecurity().get_connection().version_); ServerHello sh(ssl.getSecurity().get_connection().version_);
RecordLayerHeader rlHeader; RecordLayerHeader rlHeader;
HandShakeHeader hsHeader; HandShakeHeader hsHeader;
mySTL::auto_ptr<output_buffer> out(new (ys) output_buffer, ysDelete); mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer, ysDelete);
buildServerHello(ssl, sh); buildServerHello(ssl, sh);
ssl.set_random(sh.get_random(), server_end); ssl.set_random(sh.get_random(), server_end);
...@@ -937,7 +941,7 @@ void sendServerHelloDone(SSL& ssl, BufferOutput buffer) ...@@ -937,7 +941,7 @@ void sendServerHelloDone(SSL& ssl, BufferOutput buffer)
ServerHelloDone shd; ServerHelloDone shd;
RecordLayerHeader rlHeader; RecordLayerHeader rlHeader;
HandShakeHeader hsHeader; HandShakeHeader hsHeader;
mySTL::auto_ptr<output_buffer> out(new (ys) output_buffer, ysDelete); mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer, ysDelete);
buildHeaders(ssl, hsHeader, rlHeader, shd); buildHeaders(ssl, hsHeader, rlHeader, shd);
buildOutput(*out.get(), rlHeader, hsHeader, shd); buildOutput(*out.get(), rlHeader, hsHeader, shd);
...@@ -958,7 +962,7 @@ void sendCertificate(SSL& ssl, BufferOutput buffer) ...@@ -958,7 +962,7 @@ void sendCertificate(SSL& ssl, BufferOutput buffer)
Certificate cert(ssl.getCrypto().get_certManager().get_cert()); Certificate cert(ssl.getCrypto().get_certManager().get_cert());
RecordLayerHeader rlHeader; RecordLayerHeader rlHeader;
HandShakeHeader hsHeader; HandShakeHeader hsHeader;
mySTL::auto_ptr<output_buffer> out(new (ys) output_buffer, ysDelete); mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer, ysDelete);
buildHeaders(ssl, hsHeader, rlHeader, cert); buildHeaders(ssl, hsHeader, rlHeader, cert);
buildOutput(*out.get(), rlHeader, hsHeader, cert); buildOutput(*out.get(), rlHeader, hsHeader, cert);
...@@ -980,7 +984,7 @@ void sendCertificateRequest(SSL& ssl, BufferOutput buffer) ...@@ -980,7 +984,7 @@ void sendCertificateRequest(SSL& ssl, BufferOutput buffer)
request.Build(); request.Build();
RecordLayerHeader rlHeader; RecordLayerHeader rlHeader;
HandShakeHeader hsHeader; HandShakeHeader hsHeader;
mySTL::auto_ptr<output_buffer> out(new (ys) output_buffer, ysDelete); mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer, ysDelete);
buildHeaders(ssl, hsHeader, rlHeader, request); buildHeaders(ssl, hsHeader, rlHeader, request);
buildOutput(*out.get(), rlHeader, hsHeader, request); buildOutput(*out.get(), rlHeader, hsHeader, request);
...@@ -1002,7 +1006,7 @@ void sendCertificateVerify(SSL& ssl, BufferOutput buffer) ...@@ -1002,7 +1006,7 @@ void sendCertificateVerify(SSL& ssl, BufferOutput buffer)
verify.Build(ssl); verify.Build(ssl);
RecordLayerHeader rlHeader; RecordLayerHeader rlHeader;
HandShakeHeader hsHeader; HandShakeHeader hsHeader;
mySTL::auto_ptr<output_buffer> out(new (ys) output_buffer, ysDelete); mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer, ysDelete);
buildHeaders(ssl, hsHeader, rlHeader, verify); buildHeaders(ssl, hsHeader, rlHeader, verify);
buildOutput(*out.get(), rlHeader, hsHeader, verify); buildOutput(*out.get(), rlHeader, hsHeader, verify);
......
# quick and dirty build file for testing different MSDEVs
setlocal
set myFLAGS= /I../include /I../mySTL /I../taocrypt/include /W3 /c /ZI
cl %myFLAGS% buffer.cpp
cl %myFLAGS% cert_wrapper.cpp
cl %myFLAGS% crypto_wrapper.cpp
cl %myFLAGS% handshake.cpp
cl %myFLAGS% lock.cpp
cl %myFLAGS% log.cpp
cl %myFLAGS% socket_wrapper.cpp
cl %myFLAGS% ssl.cpp
cl %myFLAGS% template_instnt.cpp
cl %myFLAGS% timer.cpp
cl %myFLAGS% yassl.cpp
cl %myFLAGS% yassl_error.cpp
cl %myFLAGS% yassl_imp.cpp
cl %myFLAGS% yassl_int.cpp
link.exe -lib /out:yassl.lib buffer.obj cert_wrapper.obj crypto_wrapper.obj handshake.obj lock.obj log.obj socket_wrapper.obj ssl.obj template_instnt.obj timer.obj yassl.obj yassl_error.obj yassl_imp.obj yassl_int.obj
...@@ -46,9 +46,11 @@ ...@@ -46,9 +46,11 @@
#ifdef _WIN32 #ifdef _WIN32
const int SOCKET_EINVAL = WSAEINVAL; const int SOCKET_EINVAL = WSAEINVAL;
const int SOCKET_EWOULDBLOCK = WSAEWOULDBLOCK; const int SOCKET_EWOULDBLOCK = WSAEWOULDBLOCK;
const int SOCKET_EAGAIN = WSAEWOULDBLOCK;
#else #else
const int SOCKET_EINVAL = EINVAL; const int SOCKET_EINVAL = EINVAL;
const int SOCKET_EWOULDBLOCK = EWOULDBLOCK; const int SOCKET_EWOULDBLOCK = EWOULDBLOCK;
const int SOCKET_EAGAIN = EAGAIN;
#endif // _WIN32 #endif // _WIN32
...@@ -98,10 +100,10 @@ uint Socket::get_ready() const ...@@ -98,10 +100,10 @@ uint Socket::get_ready() const
ioctlsocket(socket_, FIONREAD, &ready); ioctlsocket(socket_, FIONREAD, &ready);
#else #else
/* /*
64-bit Solaris requires the variable passed to 64-bit Solaris requires the variable passed to
FIONREAD be a 32-bit value. FIONREAD be a 32-bit value.
*/ */
int ready = 0; unsigned int ready = 0;
ioctl(socket_, FIONREAD, &ready); ioctl(socket_, FIONREAD, &ready);
#endif #endif
...@@ -126,18 +128,24 @@ uint Socket::receive(byte* buf, unsigned int sz, int flags) const ...@@ -126,18 +128,24 @@ uint Socket::receive(byte* buf, unsigned int sz, int flags) const
assert(socket_ != INVALID_SOCKET); assert(socket_ != INVALID_SOCKET);
int recvd = ::recv(socket_, reinterpret_cast<char *>(buf), sz, flags); int recvd = ::recv(socket_, reinterpret_cast<char *>(buf), sz, flags);
if (recvd == -1) // idea to seperate error from would block by arnetheduck@gmail.com
if (recvd == -1) {
if (get_lastError() == SOCKET_EWOULDBLOCK ||
get_lastError() == SOCKET_EAGAIN)
return 0; return 0;
}
else if (recvd == 0)
return static_cast<uint>(-1);
return recvd; return recvd;
} }
// wait if blocking for input, or error // wait if blocking for input, return false for error
void Socket::wait() const bool Socket::wait() const
{ {
byte b; byte b;
receive(&b, 1, MSG_PEEK); return receive(&b, 1, MSG_PEEK) != static_cast<uint>(-1);
} }
......
...@@ -38,6 +38,14 @@ ...@@ -38,6 +38,14 @@
#include "yassl_int.hpp" #include "yassl_int.hpp"
#include <stdio.h> #include <stdio.h>
#ifdef _WIN32
#include <windows.h> // FindFirstFile etc..
#else
#include <sys/types.h> // file helper
#include <sys/stat.h> // stat
#include <dirent.h> // opendir
#endif
namespace yaSSL { namespace yaSSL {
...@@ -52,25 +60,25 @@ SSL_METHOD* SSLv3_method() ...@@ -52,25 +60,25 @@ SSL_METHOD* SSLv3_method()
SSL_METHOD* SSLv3_server_method() SSL_METHOD* SSLv3_server_method()
{ {
return new (ys) SSL_METHOD(server_end, ProtocolVersion(3,0)); return NEW_YS SSL_METHOD(server_end, ProtocolVersion(3,0));
} }
SSL_METHOD* SSLv3_client_method() SSL_METHOD* SSLv3_client_method()
{ {
return new (ys) SSL_METHOD(client_end, ProtocolVersion(3,0)); return NEW_YS SSL_METHOD(client_end, ProtocolVersion(3,0));
} }
SSL_METHOD* TLSv1_server_method() SSL_METHOD* TLSv1_server_method()
{ {
return new (ys) SSL_METHOD(server_end, ProtocolVersion(3,1)); return NEW_YS SSL_METHOD(server_end, ProtocolVersion(3,1));
} }
SSL_METHOD* TLSv1_client_method() SSL_METHOD* TLSv1_client_method()
{ {
return new (ys) SSL_METHOD(client_end, ProtocolVersion(3,1)); return NEW_YS SSL_METHOD(client_end, ProtocolVersion(3,1));
} }
...@@ -83,7 +91,7 @@ SSL_METHOD* SSLv23_server_method() ...@@ -83,7 +91,7 @@ SSL_METHOD* SSLv23_server_method()
SSL_CTX* SSL_CTX_new(SSL_METHOD* method) SSL_CTX* SSL_CTX_new(SSL_METHOD* method)
{ {
return new (ys) SSL_CTX(method); return NEW_YS SSL_CTX(method);
} }
...@@ -95,7 +103,7 @@ void SSL_CTX_free(SSL_CTX* ctx) ...@@ -95,7 +103,7 @@ void SSL_CTX_free(SSL_CTX* ctx)
SSL* SSL_new(SSL_CTX* ctx) SSL* SSL_new(SSL_CTX* ctx)
{ {
return new (ys) SSL(ctx); return NEW_YS SSL(ctx);
} }
...@@ -115,7 +123,12 @@ int SSL_set_fd(SSL* ssl, int fd) ...@@ -115,7 +123,12 @@ int SSL_set_fd(SSL* ssl, int fd)
int SSL_connect(SSL* ssl) int SSL_connect(SSL* ssl)
{ {
sendClientHello(*ssl); sendClientHello(*ssl);
ClientState neededState = ssl->getSecurity().get_resuming() ?
serverFinishedComplete : serverHelloDoneComplete;
while (ssl->getStates().getClient() < neededState) {
if (ssl->GetError()) break;
processReply(*ssl); processReply(*ssl);
}
if(ssl->getCrypto().get_certManager().sendVerify()) if(ssl->getCrypto().get_certManager().sendVerify())
sendCertificate(*ssl); sendCertificate(*ssl);
...@@ -130,7 +143,10 @@ int SSL_connect(SSL* ssl) ...@@ -130,7 +143,10 @@ int SSL_connect(SSL* ssl)
sendFinished(*ssl, client_end); sendFinished(*ssl, client_end);
ssl->flushBuffer(); ssl->flushBuffer();
if (!ssl->getSecurity().get_resuming()) if (!ssl->getSecurity().get_resuming())
while (ssl->getStates().getClient() < serverFinishedComplete) {
if (ssl->GetError()) break;
processReply(*ssl); processReply(*ssl);
}
ssl->verifyState(serverFinishedComplete); ssl->verifyState(serverFinishedComplete);
ssl->useLog().ShowTCP(ssl->getSocket().get_fd()); ssl->useLog().ShowTCP(ssl->getSocket().get_fd());
...@@ -171,9 +187,7 @@ int SSL_accept(SSL* ssl) ...@@ -171,9 +187,7 @@ int SSL_accept(SSL* ssl)
sendServerHelloDone(*ssl); sendServerHelloDone(*ssl);
ssl->flushBuffer(); ssl->flushBuffer();
// Java Client sends fragmented response while (ssl->getStates().getServer() < clientFinishedComplete) {
while (ssl->getStates().getServer() <
clientFinishedComplete) {
if (ssl->GetError()) break; if (ssl->GetError()) break;
processReply(*ssl); processReply(*ssl);
} }
...@@ -182,10 +196,7 @@ int SSL_accept(SSL* ssl) ...@@ -182,10 +196,7 @@ int SSL_accept(SSL* ssl)
sendFinished(*ssl, server_end); sendFinished(*ssl, server_end);
ssl->flushBuffer(); ssl->flushBuffer();
if (ssl->getSecurity().get_resuming()) { if (ssl->getSecurity().get_resuming()) {
while (ssl->getStates().getServer() < clientFinishedComplete) {
// Java Client sends fragmented response
while (ssl->getStates().getServer() <
clientFinishedComplete) {
if (ssl->GetError()) break; if (ssl->GetError()) break;
processReply(*ssl); processReply(*ssl);
} }
...@@ -281,9 +292,15 @@ char* SSL_get_shared_ciphers(SSL* /*ssl*/, char* buf, int len) ...@@ -281,9 +292,15 @@ char* SSL_get_shared_ciphers(SSL* /*ssl*/, char* buf, int len)
} }
const char* SSL_get_cipher_list(SSL* ssl, int /*priority */) const char* SSL_get_cipher_list(SSL* ssl, int priority)
{ {
return ssl->getSecurity().get_parms().cipher_list_; if (priority < 0 || priority >= MAX_CIPHERS)
return 0;
if (ssl->getSecurity().get_parms().cipher_list_[priority][0])
return ssl->getSecurity().get_parms().cipher_list_[priority];
return 0;
} }
...@@ -455,7 +472,7 @@ int read_file(SSL_CTX* ctx, const char* file, int format, CertType type) ...@@ -455,7 +472,7 @@ int read_file(SSL_CTX* ctx, const char* file, int format, CertType type)
fseek(input, 0, SEEK_END); fseek(input, 0, SEEK_END);
long sz = ftell(input); long sz = ftell(input);
rewind(input); rewind(input);
x = new (ys) x509(sz); // takes ownership x = NEW_YS x509(sz); // takes ownership
size_t bytes = fread(x->use_buffer(), sz, 1, input); size_t bytes = fread(x->use_buffer(), sz, 1, input);
if (bytes != 1) { if (bytes != 1) {
fclose(input); fclose(input);
...@@ -492,16 +509,74 @@ void SSL_CTX_set_verify(SSL_CTX* ctx, int mode, VerifyCallback /*vc*/) ...@@ -492,16 +509,74 @@ void SSL_CTX_set_verify(SSL_CTX* ctx, int mode, VerifyCallback /*vc*/)
if (mode & SSL_VERIFY_PEER) if (mode & SSL_VERIFY_PEER)
ctx->setVerifyPeer(); ctx->setVerifyPeer();
if (mode == SSL_VERIFY_NONE)
ctx->setVerifyNone();
if (mode & SSL_VERIFY_FAIL_IF_NO_PEER_CERT) if (mode & SSL_VERIFY_FAIL_IF_NO_PEER_CERT)
ctx->setFailNoCert(); ctx->setFailNoCert();
} }
int SSL_CTX_load_verify_locations(SSL_CTX* ctx, const char* file, int SSL_CTX_load_verify_locations(SSL_CTX* ctx, const char* file,
const char* /*path*/) const char* path)
{ {
// just files for now int ret = SSL_SUCCESS;
return read_file(ctx, file, SSL_FILETYPE_PEM, CA); const int HALF_PATH = 128;
if (file) ret = read_file(ctx, file, SSL_FILETYPE_PEM, CA);
if (ret == SSL_SUCCESS && path) {
// call read_file for each reqular file in path
#ifdef _WIN32
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
char name[MAX_PATH + 1]; // directory specification
strncpy(name, path, MAX_PATH - 3);
strncat(name, "\\*", 3);
hFind = FindFirstFile(name, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE) return SSL_BAD_PATH;
do {
if (FindFileData.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY) {
strncpy(name, path, MAX_PATH - 2 - HALF_PATH);
strncat(name, "\\", 2);
strncat(name, FindFileData.cFileName, HALF_PATH);
ret = read_file(ctx, name, SSL_FILETYPE_PEM, CA);
}
} while (ret == SSL_SUCCESS && FindNextFile(hFind, &FindFileData));
FindClose(hFind);
#else // _WIN32
const int MAX_PATH = 260;
DIR* dir = opendir(path);
if (!dir) return SSL_BAD_PATH;
struct dirent* entry;
struct stat buf;
char name[MAX_PATH + 1];
while (ret == SSL_SUCCESS && (entry = readdir(dir))) {
strncpy(name, path, MAX_PATH - 1 - HALF_PATH);
strncat(name, "/", 1);
strncat(name, entry->d_name, HALF_PATH);
if (stat(name, &buf) < 0) return SSL_BAD_STAT;
if (S_ISREG(buf.st_mode))
ret = read_file(ctx, name, SSL_FILETYPE_PEM, CA);
}
closedir(dir);
#endif
}
return ret;
} }
...@@ -648,13 +723,13 @@ void OpenSSL_add_all_algorithms() // compatibility only ...@@ -648,13 +723,13 @@ void OpenSSL_add_all_algorithms() // compatibility only
{} {}
void SSL_library_init() // compatibility only void SSL_library_init() // compatiblity only
{} {}
DH* DH_new(void) DH* DH_new(void)
{ {
DH* dh = new (ys) DH; DH* dh = NEW_YS DH;
if (dh) if (dh)
dh->p = dh->g = 0; dh->p = dh->g = 0;
return dh; return dh;
...@@ -679,7 +754,7 @@ BIGNUM* BN_bin2bn(const unsigned char* num, int sz, BIGNUM* retVal) ...@@ -679,7 +754,7 @@ BIGNUM* BN_bin2bn(const unsigned char* num, int sz, BIGNUM* retVal)
if (!retVal) { if (!retVal) {
created = true; created = true;
bn.reset(new (ys) BIGNUM); bn.reset(NEW_YS BIGNUM);
retVal = bn.get(); retVal = bn.get();
} }
...@@ -706,12 +781,14 @@ void ERR_print_errors_fp(FILE* /*fp*/) ...@@ -706,12 +781,14 @@ void ERR_print_errors_fp(FILE* /*fp*/)
} }
char* ERR_error_string(unsigned long /*err*/, char* buffer) char* ERR_error_string(unsigned long errNumber, char* buffer)
{ {
// TODO: static char* msg = "Please supply a buffer for error string";
static char* msg = "Not Implemented";
if (buffer) if (buffer) {
return strncpy(buffer, msg, strlen(msg)); SetErrorString(YasslError(errNumber), buffer);
return buffer;
}
return msg; return msg;
} }
...@@ -728,14 +805,14 @@ const char* X509_verify_cert_error_string(long /* error */) ...@@ -728,14 +805,14 @@ const char* X509_verify_cert_error_string(long /* error */)
const EVP_MD* EVP_md5(void) const EVP_MD* EVP_md5(void)
{ {
// TODO: FIX add to some list for destruction // TODO: FIX add to some list for destruction
return new (ys) MD5; return NEW_YS MD5;
} }
const EVP_CIPHER* EVP_des_ede3_cbc(void) const EVP_CIPHER* EVP_des_ede3_cbc(void)
{ {
// TODO: FIX add to some list for destruction // TODO: FIX add to some list for destruction
return new (ys) DES_EDE; return NEW_YS DES_EDE;
} }
......
...@@ -35,13 +35,6 @@ ...@@ -35,13 +35,6 @@
#include "openssl/ssl.h" #include "openssl/ssl.h"
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION #ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
#if !defined(USE_CRYPTOPP_LIB)
namespace TaoCrypt {
template class HMAC<MD5>;
template class HMAC<SHA>;
template class HMAC<RIPEMD160>;
}
#endif // USE_CRYPTOPP_LIB
namespace mySTL { namespace mySTL {
template class list<unsigned char*>; template class list<unsigned char*>;
......
...@@ -26,17 +26,13 @@ ...@@ -26,17 +26,13 @@
#include "runtime.hpp" #include "runtime.hpp"
#include "timer.hpp" #include "timer.hpp"
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else
#include <sys/time.h>
#endif
namespace yaSSL { namespace yaSSL {
#ifdef _WIN32 #ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
timer_d timer() timer_d timer()
{ {
static bool init(false); static bool init(false);
...@@ -61,6 +57,8 @@ namespace yaSSL { ...@@ -61,6 +57,8 @@ namespace yaSSL {
#else // _WIN32 #else // _WIN32
#include <sys/time.h>
timer_d timer() timer_d timer()
{ {
struct timeval tv; struct timeval tv;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
SUBDIRS = src SUBDIRS = src test benchmark
EXTRA_DIST = taocrypt.dsw taocrypt.dsp taocrypt.vcproj cmakelists.txt EXTRA_DIST = taocrypt.dsw taocrypt.dsp taocrypt.vcproj cmakelists.txt
INCLUDES = -I../include -I../../mySTL
bin_PROGRAMS = benchmark
benchmark_SOURCES = benchmark.cpp
benchmark_LDFLAGS = -L../src
benchmark_LDADD = -ltaocrypt
benchmark_CXXFLAGS = -DYASSL_PURE_C
benchmark_DEPENDENCIES = ../src/libtaocrypt.la
EXTRA_DIST = benchmark.dsp rsa1024.der dh1024.der dsa1024.der make.bat
This diff is collapsed.
# Microsoft Developer Studio Project File - Name="benchmark" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=benchmark - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "benchmark.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "benchmark.mak" CFG="benchmark - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "benchmark - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "benchmark - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "benchmark - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "benchmark___Win32_Release"
# PROP BASE Intermediate_Dir "benchmark___Win32_Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\include" /I "..\..\mySTL" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "benchmark - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "benchmark___Win32_Debug"
# PROP BASE Intermediate_Dir "benchmark___Win32_Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\include" /I "..\..\mySTL" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "benchmark - Win32 Release"
# Name "benchmark - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\benchmark.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
# quick and dirty build file for testing different MSDEVs
setlocal
set myFLAGS= /I../include /I../../mySTL /c /W3 /G6 /O2
#set myFLAGS= /I../include /I../../mySTL /c /W3
cl %myFLAGS% benchmark.cpp
link.exe /out:benchmark.exe ../src/taocrypt.lib benchmark.obj
This diff is collapsed.
...@@ -42,6 +42,7 @@ public: ...@@ -42,6 +42,7 @@ public:
ARC4() {} ARC4() {}
void Process(byte*, const byte*, word32); void Process(byte*, const byte*, word32);
void AsmProcess(byte*, const byte*, word32);
void SetKey(const byte*, word32); void SetKey(const byte*, word32);
private: private:
byte x_; byte x_;
......
...@@ -232,7 +232,12 @@ enum KeyType { DSAk = 515, RSAk = 645 }; // sums of algo OID ...@@ -232,7 +232,12 @@ enum KeyType { DSAk = 515, RSAk = 645 }; // sums of algo OID
// an x509v Certificate BER Decoder // an x509v Certificate BER Decoder
class CertDecoder : public BER_Decoder { class CertDecoder : public BER_Decoder {
public: public:
explicit CertDecoder(Source&, bool decode = true, SignerList* = 0); enum DateType { BEFORE, AFTER };
enum NameType { ISSUER, SUBJECT };
enum CertType { CA, USER };
explicit CertDecoder(Source&, bool decode = true, SignerList* sl = 0,
bool noVerify = false, CertType ct = USER);
~CertDecoder(); ~CertDecoder();
const PublicKey& GetPublicKey() const { return key_; } const PublicKey& GetPublicKey() const { return key_; }
...@@ -242,9 +247,6 @@ public: ...@@ -242,9 +247,6 @@ public:
const byte* GetHash() const { return subjectHash_; } const byte* GetHash() const { return subjectHash_; }
void DecodeToKey(); void DecodeToKey();
enum DateType { BEFORE, AFTER };
enum NameType { ISSUER, SUBJECT };
private: private:
PublicKey key_; PublicKey key_;
word32 certBegin_; // offset to start of cert word32 certBegin_; // offset to start of cert
...@@ -257,9 +259,10 @@ private: ...@@ -257,9 +259,10 @@ private:
byte* signature_; byte* signature_;
char* issuer_; // CommonName char* issuer_; // CommonName
char* subject_; // CommonName char* subject_; // CommonName
bool verify_; // Default to yes, but could be off
void ReadHeader(); void ReadHeader();
void Decode(SignerList*); void Decode(SignerList*, CertType);
void StoreKey(); void StoreKey();
void AddDSA(); void AddDSA();
bool ValidateSelfSignature(); bool ValidateSelfSignature();
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment