mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 19:24:42 +02:00
RipeMd and Sha224 added to unit test.
This commit is contained in:
@@ -66,7 +66,7 @@
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="wolfcrypt/src/misc.c|IDE/LPCXPRESSO/wolf_example|tirtos|testsuite|tests|swig|support|sslSniffer|scripts|rpm|mqx|mplabx|mcapi|m4|IDE/WORKBENCH|IDE/WIN|IDE/ROWLEY-CROSSWORKS-ARM|IDE/MYSQL|IDE/MDK-ARM|IDE/MDK5-ARM|IDE/LPCXPRESSO/wolf_demo|IDE/LPCXPRESSO/lpc_chip_18xx|IDE/LPCXPRESSO/lpc_board_nxp_lpcxpresso_1837|IDE/iOS|IDE/IAR-EWARM|examples|Debug|certs|build-aux|Backup|autom4te.cache|wolfcrypt/src/aes_asm.s|wolfcrypt/src/aes_asm.asm|wolfcrypt/user-crypto" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="src/bio.c|wolfcrypt/src/evp.c|wolfcrypt/src/misc.c|IDE/LPCXPRESSO/wolf_example|tirtos|testsuite|tests|swig|support|sslSniffer|scripts|rpm|mqx|mplabx|mcapi|m4|IDE/WORKBENCH|IDE/WIN|IDE/ROWLEY-CROSSWORKS-ARM|IDE/MYSQL|IDE/MDK-ARM|IDE/MDK5-ARM|IDE/LPCXPRESSO/wolf_demo|IDE/LPCXPRESSO/lpc_chip_18xx|IDE/LPCXPRESSO/lpc_board_nxp_lpcxpresso_1837|IDE/iOS|IDE/IAR-EWARM|examples|Debug|certs|build-aux|Backup|autom4te.cache|wolfcrypt/src/aes_asm.s|wolfcrypt/src/aes_asm.asm|wolfcrypt/user-crypto" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
|
30
.gitignore
vendored
30
.gitignore
vendored
@@ -44,6 +44,12 @@ src/async.c
|
||||
wolfssl/async.h
|
||||
wolfcrypt/src/async.c
|
||||
wolfssl/wolfcrypt/async.h
|
||||
wolfcrypt/src/port/intel/quickassist.c
|
||||
wolfcrypt/src/port/intel/quickassist_mem.c
|
||||
wolfcrypt/src/port/cavium/cavium_nitrox.c
|
||||
wolfssl/wolfcrypt/port/intel/quickassist.h
|
||||
wolfssl/wolfcrypt/port/intel/quickassist_mem.h
|
||||
wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h
|
||||
ctaocrypt/benchmark/benchmark
|
||||
ctaocrypt/test/testctaocrypt
|
||||
wolfcrypt/benchmark/benchmark
|
||||
@@ -64,6 +70,7 @@ testsuite/testsuite
|
||||
tests/unit
|
||||
testsuite/testsuite.test
|
||||
tests/unit.test
|
||||
tests/bio_write_test.txt
|
||||
testsuite/*.der
|
||||
testsuite/*.pem
|
||||
testsuite/*.raw
|
||||
@@ -84,7 +91,18 @@ ecc-key.pem
|
||||
certreq.der
|
||||
certreq.pem
|
||||
pkcs7cert.der
|
||||
pkcs7signedData.der
|
||||
pkcs7signedData_RSA_SHA.der
|
||||
pkcs7signedData_RSA_SHA_noattr.der
|
||||
pkcs7signedData_RSA_SHA224.der
|
||||
pkcs7signedData_RSA_SHA256.der
|
||||
pkcs7signedData_RSA_SHA384.der
|
||||
pkcs7signedData_RSA_SHA512.der
|
||||
pkcs7signedData_ECDSA_SHA.der
|
||||
pkcs7signedData_ECDSA_SHA_noattr.der
|
||||
pkcs7signedData_ECDSA_SHA224.der
|
||||
pkcs7signedData_ECDSA_SHA256.der
|
||||
pkcs7signedData_ECDSA_SHA384.der
|
||||
pkcs7signedData_ECDSA_SHA512.der
|
||||
pkcs7envelopedDataDES3.der
|
||||
pkcs7envelopedDataAES128CBC.der
|
||||
pkcs7envelopedDataAES192CBC.der
|
||||
@@ -188,4 +206,12 @@ wolfcrypt/user-crypto/lib/libusercrypto.*
|
||||
wrapper/CSharp/x64/
|
||||
|
||||
# Visual Studio Code Workspace Files
|
||||
*.vscode
|
||||
*.vscode
|
||||
|
||||
IDE/INTIME-RTOS/Debug_*
|
||||
|
||||
# Hexiwear
|
||||
IDE/HEXIWEAR/wolfSSL_HW/Debug
|
||||
|
||||
# Binaries
|
||||
wolfcrypt/src/port/intel/qat_test
|
||||
|
@@ -13,3 +13,14 @@ if [ "$DIR" = "ARDUINO" ]; then
|
||||
else
|
||||
echo "ERROR: You must be in the IDE/ARDUINO directory to run this script"
|
||||
fi
|
||||
|
||||
#UPDATED: 19 Apr 2017 to remove bio.c and evp.c from the root directory since
|
||||
# they are included inline and should not be compiled directly
|
||||
|
||||
ARDUINO_DIR=${PWD}
|
||||
cd ../../
|
||||
rm bio.c
|
||||
rm evp.c
|
||||
cd $ARDUINO_DIR
|
||||
# end script in the origin directory for any future functionality that may be added.
|
||||
#End UPDATE: 19 Apr 2017
|
||||
|
143
IDE/HEXIWEAR/wolfSSL_HW/.cproject
Normal file
143
IDE/HEXIWEAR/wolfSSL_HW/.cproject
Normal file
@@ -0,0 +1,143 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.170735395">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.170735395" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||
<macros>
|
||||
<stringMacro name="PROJECT_KSDK_PATH" type="VALUE_TEXT" value="~/Work/KSDK_1.3.0"/>
|
||||
</macros>
|
||||
<externalSettings>
|
||||
<externalSetting>
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/wolfSSL_HW"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/wolfSSL_HW/Debug"/>
|
||||
<entry flags="RESOLVED" kind="libraryFile" name="wolfssl_hw" srcPrefixMapping="" srcRootPath=""/>
|
||||
</externalSetting>
|
||||
</externalSettings>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.managedbuilder.core.ManagedBuildManager" point="org.eclipse.cdt.core.ScannerInfoProvider"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactExtension="a" artifactName="wolfssl_hw" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="${cross_rm} -rf" description="" id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.170735395" name="Debug" parent="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug">
|
||||
<folderInfo id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.170735395." name="/" resourcePath="">
|
||||
<toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.elf.debug.955851768" name="Cross ARM GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.elf.debug">
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.1637878147" name="Optimization Level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level" value="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.none" valueType="enumerated"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength.596937133" name="Message length (-fmessage-length=0)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.signedchar.412948756" name="'char' is signed (-fsigned-char)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.signedchar" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.functionsections.1412387181" name="Function sections (-ffunction-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.functionsections" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.datasections.1877241998" name="Data sections (-fdata-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.datasections" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level.2038051180" name="Debug level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level" value="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level.max" valueType="enumerated"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format.1062002269" name="Debug format" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family.1592667634" name="ARM family" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.mcpu.cortex-m4" valueType="enumerated"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi.1112951710" name="Float ABI" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi.hard" valueType="enumerated"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit.1079530716" name="FPU Type" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit.fpv4spd16" valueType="enumerated"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name.192917244" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name" value="GNU Tools for ARM Embedded Processors" valueType="string"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix.2108482930" name="Prefix" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix" value="arm-none-eabi-" valueType="string"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.c.500222702" name="C compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.c" value="gcc" valueType="string"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.cpp.175873499" name="C++ compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.cpp" value="g++" valueType="string"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.objcopy.1700937041" name="Hex/Bin converter" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.objcopy" value="objcopy" valueType="string"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.objdump.1874549763" name="Listing generator" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.objdump" value="objdump" valueType="string"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.size.178137928" name="Size command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.size" value="size" valueType="string"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.make.1274071175" name="Build command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.make" value="make" valueType="string"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.rm.655658023" name="Remove command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.rm" value="rm" valueType="string"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar.1937238341" name="Archiver" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar" value="ar" valueType="string"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize.1476617138" name="Print size" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.allwarn.1035232247" name="Enable all common warnings (-Wall)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.allwarn" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.lto.8601271" name="Link-time optimizer (-flto)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.lto" value="false" valueType="boolean"/>
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.817253425" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/>
|
||||
<builder buildPath="${workspace_loc:/wolfSSL_HW}/Debug" id="ilg.gnuarmeclipse.managedbuild.cross.builder.2043375702" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder"/>
|
||||
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.1135882719" name="Cross ARM GNU Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler">
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.369489760" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" value="true" valueType="boolean"/>
|
||||
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.1086496768" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1696761989" name="Cross ARM GNU C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler">
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.std.9643995" name="Language standard" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.std" useByScannerDiscovery="true" value="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.std.c99" valueType="enumerated"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths.349147702" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/../../../""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}""/>
|
||||
<listOptionValue builtIn="false" value=""${PROJECT_KSDK_PATH}/platform/devices""/>
|
||||
<listOptionValue builtIn="false" value=""${PROJECT_KSDK_PATH}/platform/CMSIS/Include""/>
|
||||
<listOptionValue builtIn="false" value=""${PROJECT_KSDK_PATH}/platform/devices/MK64F12/startup""/>
|
||||
<listOptionValue builtIn="false" value=""${PROJECT_KSDK_PATH}/platform/drivers/inc""/>
|
||||
<listOptionValue builtIn="false" value=""${PROJECT_KSDK_PATH}/platform/hal/inc""/>
|
||||
<listOptionValue builtIn="false" value=""${PROJECT_KSDK_PATH}/platform/osa/inc""/>
|
||||
<listOptionValue builtIn="false" value=""${PROJECT_KSDK_PATH}/platform/utilities/inc""/>
|
||||
</option>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.1294205548" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value=""CPU_MK64FN1M0VMD12""/>
|
||||
<listOptionValue builtIn="false" value="WOLFSSL_USER_SETTINGS"/>
|
||||
</option>
|
||||
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.817994152" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.234608726" name="Cross ARM GNU C++ Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler">
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.include.paths.1452713629" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.include.paths" useByScannerDiscovery="false"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs.497680378" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value=""CPU_MK64FN1M0VMD12""/>
|
||||
</option>
|
||||
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.909966654" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.506002589" name="Cross ARM GNU C Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker">
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.gcsections.1489822225" name="Remove unused sections (-Xlinker --gc-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.gcsections" value="true" valueType="boolean"/>
|
||||
</tool>
|
||||
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.575756954" name="Cross ARM GNU C++ Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker">
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.gcsections.11344634" name="Remove unused sections (-Xlinker --gc-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.gcsections" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.paths.1878565771" name="Library search path (-L)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.paths" valueType="libPaths">
|
||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/Project_Settings/Linker_Files""/>
|
||||
</option>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.other.1517060693" name="Other linker flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.other" value="-specs=nosys.specs -specs=nano.specs -Xlinker -z -Xlinker muldefs" valueType="string"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.scriptfile.468376236" name="Script files (-T)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.scriptfile" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value=""MK64FN1M0xxx12_flash.ld""/>
|
||||
</option>
|
||||
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.input.955790366" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.archiver.1962941231" name="Cross ARM GNU Archiver" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.archiver"/>
|
||||
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.createflash.1365673947" name="Cross ARM GNU Create Flash Image" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.createflash"/>
|
||||
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.createlisting.790507756" name="Cross ARM GNU Create Listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.createlisting">
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.source.1929510617" name="Display source (--source|-S)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.source" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.allheaders.573901902" name="Display all headers (--all-headers|-x)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.allheaders" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.demangle.2051558160" name="Demangle names (--demangle|-C)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.demangle" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.linenumbers.851594065" name="Display line numbers (--line-numbers|-l)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.linenumbers" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.wide.1352373056" name="Wide lines (--wide|-w)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.wide" value="true" valueType="boolean"/>
|
||||
</tool>
|
||||
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize.934998862" name="Cross ARM GNU Print Size" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize">
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.printsize.format.1738611770" name="Size format" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.printsize.format"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="wolfcrypt/src/integer.c|wolfcrypt/src/misc.c|src/bio.c|wolfcrypt/src/evp.c|wolfcrypt/src/aes_asm.s|wolfcrypt/src/aes_asm.asm|SDK|wolfssl/wolfcrypt/port|wolfcrypt/src/port|wolfcrypt/user-crypto" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="wolfSSL_HW.ilg.gnuarmeclipse.managedbuild.cross.target.elf.1053752509" name="Executable" projectType="ilg.gnuarmeclipse.managedbuild.cross.target.elf"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<scannerConfigBuildInfo instanceId="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.170735395;ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.170735395.;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.234608726;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.909966654">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.170735395;ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.170735395.;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1696761989;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.817994152">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="refreshScope" versionNumber="2">
|
||||
<configuration configurationName="Debug">
|
||||
<resource resourceType="PROJECT" workspacePath="/wolfSSL_HW"/>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cproject>
|
19
IDE/HEXIWEAR/wolfSSL_HW/.cwGeneratedFileSetLog
Normal file
19
IDE/HEXIWEAR/wolfSSL_HW/.cwGeneratedFileSetLog
Normal file
@@ -0,0 +1,19 @@
|
||||
Sources/main.c
|
||||
Project_Settings/Linker_Files/MK64FN1M0xxx12_flash.ld
|
||||
SDK/platform/CMSIS/Include/core_cmSimd.h
|
||||
SDK/platform/devices/MK64F12/include/MK64F12.h
|
||||
SDK/platform/CMSIS/Include/arm_common_tables.h
|
||||
SDK/platform/CMSIS/Include/arm_const_structs.h
|
||||
SDK/platform/devices/MK64F12/include/MK64F12_features.h
|
||||
SDK/platform/CMSIS/Include/core_cm4.h
|
||||
SDK/platform/CMSIS/Include/core_cmFunc.h
|
||||
SDK/platform/CMSIS/Include/core_cmInstr.h
|
||||
SDK/platform/devices/fsl_device_registers.h
|
||||
SDK/platform/devices/MK64F12/include/fsl_bitaccess.h
|
||||
SDK/platform/CMSIS/Include/arm_math.h
|
||||
SDK/platform/devices/MK64F12/include/MK64F12_extension.h
|
||||
Project_Settings/Startup_Code/startup.c
|
||||
Project_Settings/Startup_Code/system_MK64F12.c
|
||||
Project_Settings/Startup_Code/startup.h
|
||||
Project_Settings/Startup_Code/startup_MK64F12.S
|
||||
Project_Settings/Startup_Code/system_MK64F12.h
|
50
IDE/HEXIWEAR/wolfSSL_HW/.project
Normal file
50
IDE/HEXIWEAR/wolfSSL_HW/.project
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>wolfSSL_HW</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
</natures>
|
||||
<linkedResources>
|
||||
<link>
|
||||
<name>src</name>
|
||||
<type>2</type>
|
||||
<locationURI>$%7BPARENT-3-PROJECT_LOC%7D/src</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>wolfcrypt</name>
|
||||
<type>2</type>
|
||||
<locationURI>$%7BPARENT-3-PROJECT_LOC%7D/wolfcrypt</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>wolfssl</name>
|
||||
<type>2</type>
|
||||
<locationURI>$%7BPARENT-3-PROJECT_LOC%7D/wolfssl</locationURI>
|
||||
</link>
|
||||
</linkedResources>
|
||||
<variableList>
|
||||
<variable>
|
||||
<name>PROJECT_KSDK_PATH</name>
|
||||
<value>file:/.KSDK_1.3.0</value>
|
||||
</variable>
|
||||
</variableList>
|
||||
</projectDescription>
|
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
versionGenerated/versionGenerated=1.0.0.RT7_b1550-0615
|
6
IDE/HEXIWEAR/wolfSSL_HW/user_settings.h
Normal file
6
IDE/HEXIWEAR/wolfSSL_HW/user_settings.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#define FREESCALE_KSDK_BM
|
||||
#define FREESCALE_KSDK_1_3
|
||||
#define FSL_HW_CRYPTO_MANUAL_SELECTION
|
||||
#define NO_MAIN_DRIVER
|
||||
#define USE_CERT_BUFFERS_1024
|
||||
#define ECC_USER_CURVES
|
@@ -2040,6 +2040,12 @@
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\..\..\..\wolfcrypt\src\wc_port.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\..\..\..\wolfcrypt\src\wolfmath.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\..\..\..\wolfcrypt\src\wolfevent.c</name>
|
||||
</file>
|
||||
</group>
|
||||
<group>
|
||||
<name>wolfSSL</name>
|
||||
|
@@ -8,6 +8,7 @@
|
||||
#define NO_DEV_RANDOM
|
||||
#define USE_CERT_BUFFERS_2048
|
||||
#define WOLFSSL_USER_CURRTIME
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
|
||||
#define CUSTOM_RAND_GENERATE custom_rand_generate
|
||||
/* warning "write a real random seed!!!!, just for testing now" */
|
||||
|
158
IDE/INTIME-RTOS/README.md
Executable file
158
IDE/INTIME-RTOS/README.md
Executable file
@@ -0,0 +1,158 @@
|
||||
# tenAsys INtime RTOS Port
|
||||
|
||||
## Overview
|
||||
|
||||
This port is for the tenAsys INtime RTOS available [here](http://www.tenasys.com/intime).
|
||||
|
||||
To enable use the define `INTIME_RTOS`.
|
||||
|
||||
## Usage
|
||||
|
||||
The wolfExamples.sln is a Visual Studio 2015 project. You must have the INtime SDK installed and an INtime RTOS agent running.
|
||||
|
||||
The default configuration is set inside the `IDE/INTIME-RTOS/user_settings.h` file.
|
||||
|
||||
The example application provides a simple menu interface to select difference application functions to test.
|
||||
|
||||
```
|
||||
wolfExamples started
|
||||
wolfExamples finished initialization
|
||||
|
||||
MENU
|
||||
|
||||
t. WolfCrypt Test
|
||||
b. WolfCrypt Benchmark
|
||||
c. WolfSSL Client Example
|
||||
s. WolfSSL Server Example
|
||||
l. WolfSSL Localhost Client/Server Example
|
||||
Please select one of the above options:
|
||||
```
|
||||
|
||||
### `t`wolfCrypt Test
|
||||
|
||||
Performs testing of all crypto algorithms.
|
||||
|
||||
```
|
||||
Crypt Test
|
||||
error test passed!
|
||||
base64 test passed!
|
||||
base64 test passed!
|
||||
MD5 test passed!
|
||||
SHA test passed!
|
||||
SHA-256 test passed!
|
||||
SHA-384 test passed!
|
||||
SHA-512 test passed!
|
||||
Hash test passed!
|
||||
HMAC-MD5 test passed!
|
||||
HMAC-SHA test passed!
|
||||
HMAC-SHA256 test passed!
|
||||
HMAC-SHA384 test passed!
|
||||
HMAC-SHA512 test passed!
|
||||
HMAC-KDF test passed!
|
||||
X963-KDF test passed!
|
||||
GMAC test passed!
|
||||
Chacha test passed!
|
||||
POLY1305 test passed!
|
||||
ChaCha20-Poly1305 AEAD test passed!
|
||||
DES test passed!
|
||||
DES3 test passed!
|
||||
AES test passed!
|
||||
AES-GCM test passed!
|
||||
AES-CCM test passed!
|
||||
AES Key Wrap test passed!
|
||||
RANDOM test passed!
|
||||
RSA test passed!
|
||||
DH test passed!
|
||||
DSA test passed!
|
||||
SRP test passed!
|
||||
PWDBASED test passed!
|
||||
openSSL extra test
|
||||
OPENSSL test passed!
|
||||
ECC test passed!
|
||||
ECC Enc test passed!
|
||||
ECC buffer test passed!
|
||||
CURVE25519 test passed!
|
||||
ED25519 test passed!
|
||||
CMAC test passed!
|
||||
PKCS7enveloped test passed!
|
||||
PKCS7signed test passed!
|
||||
PKCS7encrypted test passed!
|
||||
mutex test passed!
|
||||
memcb test passed!
|
||||
Crypt Test: Return code 0
|
||||
```
|
||||
|
||||
### `b` wolfCrypt Benchmark
|
||||
|
||||
Performs benchmark of crypto algorithms.
|
||||
|
||||
```
|
||||
Benchmark Test
|
||||
RNG 25 kB took 0.002 seconds, 11.017 MB/s
|
||||
AES enc 25 kB took 0.002 seconds, 15.090 MB/s
|
||||
AES dec 25 kB took 0.002 seconds, 15.119 MB/s
|
||||
AES-GCM 25 kB took 0.003 seconds, 9.433 MB/s
|
||||
AES-CTR 25 kB took 0.001 seconds, 22.378 MB/s
|
||||
AES-CCM 25 kB took 0.002 seconds, 15.306 MB/s
|
||||
CHACHA 25 kB took 0.002 seconds, 16.063 MB/s
|
||||
CHA-POLY 25 kB took 0.001 seconds, 20.447 MB/s
|
||||
3DES 25 kB took 0.002 seconds, 10.717 MB/s
|
||||
|
||||
MD5 25 kB took 0.00 seconds, 31.576 MB/s
|
||||
POLY1305 25 kB took 0.000 seconds, 201.575 MB/s
|
||||
SHA 25 kB took 0.00 seconds, 43.761 MB/s
|
||||
SHA-256 25 kB took 0.001 seconds, 19.299 MB/s
|
||||
SHA-384 25 kB took 0.002 seconds, 14.577 MB/s
|
||||
SHA-512 25 kB took 0.001 seconds, 21.718 MB/s
|
||||
AES-CMAC 25 kB took 0.00 seconds, 34.925 MB/s
|
||||
|
||||
RSA 2048 public 2.445 milliseconds, avg over 1 iterations
|
||||
RSA 2048 private 64.711 milliseconds, avg over 1 iterations
|
||||
|
||||
RSA 1024 key generation 318.755 milliseconds, avg over 5 iterations
|
||||
RSA 2048 key generation 22648.396 milliseconds, avg over 5 iterations
|
||||
DH 2048 key generation 23.119 milliseconds, avg over 1 iterations
|
||||
DH 2048 key agreement 26.756 milliseconds, avg over 1 iterations
|
||||
|
||||
ECC 256 key generation 2.984 milliseconds, avg over 5 iterations
|
||||
EC-DHE key agreement 2.967 milliseconds, avg over 5 iterations
|
||||
EC-DSA sign time 1.448 milliseconds, avg over 5 iterations
|
||||
EC-DSA verify time 3.304 milliseconds, avg over 5 iterations
|
||||
ECC encrypt 5.860 milliseconds, avg over 1 iterations
|
||||
ECC decrypt 6.360 milliseconds, avg over 1 iterations
|
||||
|
||||
CURVE25519 256 key generation 1.416 milliseconds, avg over 5 iterations
|
||||
CURVE25519 key agreement 1.332 milliseconds, avg over 5 iterations
|
||||
|
||||
ED25519 key generation 0.320 milliseconds, avg over 5 iterations
|
||||
ED25519 sign time 0.595 milliseconds, avg over 5 iterations
|
||||
ED25519 verify time 1.310 milliseconds, avg over 5 iterations
|
||||
Benchmark Test: Return code 0
|
||||
```
|
||||
|
||||
### `c` wolfSSL Client
|
||||
|
||||
To configure the host address and port modify the `TLS_HOST_REMOTE` and `TLS_PORT` macros at top of `wolfExamples.c`. This example uses TLS 1.2 to connect to a remote host.
|
||||
|
||||
### `s` wolfSSL Server
|
||||
|
||||
To configure the port to listen on modify `TLS_PORT` at top of `wolfExamples.c`.
|
||||
|
||||
### `l` wolfSSL Localhost Server/Client
|
||||
|
||||
Starts a TLS server thread listening on localhost. Starts the TLS client and performs connect, exchanges some data and disconnects.
|
||||
|
||||
```
|
||||
Waiting for a connection...
|
||||
Client connected successfully
|
||||
Using Non-Blocking I/O: 0
|
||||
Message for server: Client:
|
||||
|
||||
Received: I hear ya fa shizzle!
|
||||
|
||||
The client has closed the connection.
|
||||
```
|
||||
|
||||
## References
|
||||
|
||||
For more information please contact info@wolfssl.com.
|
13
IDE/INTIME-RTOS/include.am
Normal file
13
IDE/INTIME-RTOS/include.am
Normal file
@@ -0,0 +1,13 @@
|
||||
# vim:ft=automake
|
||||
# included from Top Level Makefile.am
|
||||
# All paths should be given relative to the root
|
||||
|
||||
EXTRA_DIST += \
|
||||
IDE/INTIME-RTOS/README.md \
|
||||
IDE/INTIME-RTOS/user_settings.h \
|
||||
IDE/INTIME-RTOS/libwolfssl.c \
|
||||
IDE/INTIME-RTOS/libwolfssl.vcxproj \
|
||||
IDE/INTIME-RTOS/wolfExamples.c \
|
||||
IDE/INTIME-RTOS/wolfExamples.h \
|
||||
IDE/INTIME-RTOS/wolfExamples.vcxproj \
|
||||
IDE/INTIME-RTOS/wolfExamples.sln
|
20
IDE/INTIME-RTOS/libwolfssl.c
Executable file
20
IDE/INTIME-RTOS/libwolfssl.c
Executable file
@@ -0,0 +1,20 @@
|
||||
// libwolfssl.c
|
||||
// Defines the entry point for the DLL application
|
||||
|
||||
#include <rt.h>
|
||||
|
||||
BOOLEAN __stdcall RslMain( RTHANDLE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
{
|
||||
switch (ul_reason_for_call) {
|
||||
case RSL_PROCESS_ATTACH:
|
||||
case RSL_THREAD_ATTACH:
|
||||
case RSL_THREAD_DETACH:
|
||||
case RSL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
225
IDE/INTIME-RTOS/libwolfssl.vcxproj
Executable file
225
IDE/INTIME-RTOS/libwolfssl.vcxproj
Executable file
@@ -0,0 +1,225 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|INtime">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>INtime</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|INtime">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>INtime</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="README.md" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="libwolfssl.c" />
|
||||
<ClCompile Include="..\..\src\crl.c" />
|
||||
<ClCompile Include="..\..\src\internal.c" />
|
||||
<ClCompile Include="..\..\src\io.c" />
|
||||
<ClCompile Include="..\..\src\keys.c" />
|
||||
<ClCompile Include="..\..\src\ocsp.c" />
|
||||
<ClCompile Include="..\..\src\sniffer.c" />
|
||||
<ClCompile Include="..\..\src\ssl.c" />
|
||||
<ClCompile Include="..\..\src\tls.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\aes.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\arc4.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\asm.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\asn.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\async.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\blake2b.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\camellia.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\chacha.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\chacha20_poly1305.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\cmac.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\coding.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\compress.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\curve25519.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\des3.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\dh.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\dsa.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\ecc.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\ecc_fp.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\ed25519.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\error.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\fe_low_mem.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\fe_operations.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\ge_low_mem.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\ge_operations.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\hash.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\hc128.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\hmac.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\idea.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\integer.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\logging.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\md2.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\md4.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\md5.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\memory.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\pkcs12.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\pkcs7.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\poly1305.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\pwdbased.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\rabbit.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\random.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\ripemd.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\rsa.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\sha.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\sha256.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\sha512.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\signature.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\srp.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\tfm.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\wc_encrypt.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\wc_port.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\wolfevent.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\wolfmath.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="user_settings.h" />
|
||||
<ClInclude Include="..\..\wolfssl\callbacks.h" />
|
||||
<ClInclude Include="..\..\wolfssl\certs_test.h" />
|
||||
<ClInclude Include="..\..\wolfssl\crl.h" />
|
||||
<ClInclude Include="..\..\wolfssl\error-ssl.h" />
|
||||
<ClInclude Include="..\..\wolfssl\internal.h" />
|
||||
<ClInclude Include="..\..\wolfssl\ocsp.h" />
|
||||
<ClInclude Include="..\..\wolfssl\options.h" />
|
||||
<ClInclude Include="..\..\wolfssl\sniffer.h" />
|
||||
<ClInclude Include="..\..\wolfssl\sniffer_error.h" />
|
||||
<ClInclude Include="..\..\wolfssl\ssl.h" />
|
||||
<ClInclude Include="..\..\wolfssl\test.h" />
|
||||
<ClInclude Include="..\..\wolfssl\version.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\aes.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\arc4.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\asn.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\asn_public.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\async.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\blake2-impl.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\blake2-int.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\blake2.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\camellia.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\chacha.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\chacha20_poly1305.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\cmac.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\coding.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\compress.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\curve25519.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\des3.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\dh.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\dsa.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\ecc.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\ed25519.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\error-crypt.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\fe_operations.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\fips_test.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\ge_operations.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\hash.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\hc128.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\hmac.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\idea.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\integer.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\logging.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\md2.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\md4.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\md5.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\memory.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\mem_track.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\misc.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\mpi_class.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\mpi_superclass.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\pkcs12.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\pkcs7.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\poly1305.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\pwdbased.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\rabbit.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\random.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\ripemd.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\rsa.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\settings.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\sha.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\sha256.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\sha512.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\signature.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\srp.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\tfm.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\types.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\visibility.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\wc_encrypt.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\wc_port.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\wolfevent.h" />
|
||||
<ClInclude Include="..\..\wolfssl\wolfcrypt\wolfmath.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{1731767D-573F-45C9-A466-191DA0D180CF}</ProjectGuid>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|INtime'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|INtime'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|INtime'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|INtime'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|INtime'">
|
||||
<IntDir>$(Configuration)_$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|INtime'">
|
||||
<IntDir>$(Configuration)_$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|INtime'">
|
||||
<ClCompile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<Version>21076.20052</Version>
|
||||
<AdditionalOptions>/SAFESEH:NO %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>rt.lib;pcibus.lib;netlib.lib;clib.lib;vshelper.lib</AdditionalDependencies>
|
||||
<OutputFile>$(SolutionDir)$(Configuration)\\libwolfssl.rsl</OutputFile>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<ExceptionHandling>Async</ExceptionHandling>
|
||||
<PreprocessorDefinitions>_USRDLL;WOLFSSL_DLL;BUILDING_WOLFSSL;WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<XMLDocumentationFileName>$(IntDir)</XMLDocumentationFileName>
|
||||
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|INtime'">
|
||||
<ClCompile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<Version>21076.20052</Version>
|
||||
<AdditionalOptions>/SAFESEH:NO %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>rt.lib;pcibus.lib;netlib.lib;clib.lib;vshelper.lib</AdditionalDependencies>
|
||||
<OutputFile>$(SolutionDir)$(Configuration)\\libwolfssl.rsl</OutputFile>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<ExceptionHandling>Async</ExceptionHandling>
|
||||
<PreprocessorDefinitions>_USRDLL;WOLFSSL_DLL;BUILDING_WOLFSSL;WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<XMLDocumentationFileName>$(IntDir)</XMLDocumentationFileName>
|
||||
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
511
IDE/INTIME-RTOS/user_settings.h
Executable file
511
IDE/INTIME-RTOS/user_settings.h
Executable file
@@ -0,0 +1,511 @@
|
||||
/* Example custom user settings for wolfSSL and INtime RTOS port */
|
||||
|
||||
#ifndef WOLFSSL_USER_SETTINGS_H
|
||||
#define WOLFSSL_USER_SETTINGS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Port - Platform */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#undef INTIME_RTOS
|
||||
#define INTIME_RTOS
|
||||
|
||||
#undef WOLF_EXAMPLES_STACK
|
||||
#define WOLF_EXAMPLES_STACK 65536
|
||||
|
||||
#undef WOLFSSL_GENERAL_ALIGNMENT
|
||||
#define WOLFSSL_GENERAL_ALIGNMENT 4
|
||||
|
||||
/* platform already has min()/max() */
|
||||
#undef WOLFSSL_HAVE_MIN
|
||||
#define WOLFSSL_HAVE_MIN
|
||||
#undef WOLFSSL_HAVE_MAX
|
||||
#define WOLFSSL_HAVE_MAX
|
||||
|
||||
/* disable directory support */
|
||||
#undef NO_WOLFSSL_DIR
|
||||
#define NO_WOLFSSL_DIR
|
||||
|
||||
/* disable writev */
|
||||
#undef NO_WRITEV
|
||||
#define NO_WRITEV
|
||||
|
||||
/* we provide main entry point */
|
||||
#undef NO_MAIN_DRIVER
|
||||
#define NO_MAIN_DRIVER
|
||||
|
||||
/* if using in single threaded mode */
|
||||
#undef SINGLE_THREADED
|
||||
//#define SINGLE_THREADED
|
||||
/* Note: HAVE_THREAD_LS is not support for INtime RTOS */
|
||||
|
||||
/* reduces stack usage, by using malloc/free for stack variables over 100 bytes */
|
||||
#undef WOLFSSL_SMALL_STACK
|
||||
//#define WOLFSSL_SMALL_STACK
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Math Configuration */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* fast math uses stack and inline assembly to speed up math */
|
||||
#undef USE_FAST_MATH
|
||||
#define USE_FAST_MATH
|
||||
|
||||
#ifdef USE_FAST_MATH
|
||||
/* timing resistance for side-channel attack protection */
|
||||
#undef TFM_TIMING_RESISTANT
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#endif
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Crypto */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* ECC */
|
||||
#if 1
|
||||
#undef HAVE_ECC
|
||||
#define HAVE_ECC
|
||||
|
||||
/* Support for custom curves */
|
||||
#define WOLFSSL_CUSTOM_CURVES
|
||||
|
||||
/* Curve types */
|
||||
//#define NO_ECC_SECP
|
||||
#define HAVE_ECC_SECPR2
|
||||
#define HAVE_ECC_SECPR3
|
||||
#define HAVE_ECC_BRAINPOOL
|
||||
#define HAVE_ECC_KOBLITZ
|
||||
|
||||
/* Curve sizes */
|
||||
#undef HAVE_ALL_CURVES
|
||||
//#define HAVE_ALL_CURVES
|
||||
#ifndef HAVE_ALL_CURVES
|
||||
/* allows enabling custom curve sizes */
|
||||
#undef ECC_USER_CURVES
|
||||
#define ECC_USER_CURVES
|
||||
|
||||
//#define HAVE_ECC112
|
||||
//#define HAVE_ECC128
|
||||
//#define HAVE_ECC160
|
||||
#define HAVE_ECC192
|
||||
#define HAVE_ECC224
|
||||
//#define NO_ECC256
|
||||
#define HAVE_ECC384
|
||||
#define HAVE_ECC521
|
||||
#endif
|
||||
|
||||
/* Fixed point cache (speeds repeated operations against same private key) */
|
||||
#undef FP_ECC
|
||||
#define FP_ECC
|
||||
#ifdef FP_ECC
|
||||
/* Bits / Entries */
|
||||
#undef FP_ENTRIES
|
||||
#define FP_ENTRIES 2
|
||||
#undef FP_LUT
|
||||
#define FP_LUT 4
|
||||
#endif
|
||||
|
||||
/* Optional ECC calculation method */
|
||||
/* Note: doubles heap usage, but slightly faster */
|
||||
#undef ECC_SHAMIR
|
||||
#define ECC_SHAMIR
|
||||
|
||||
/* Reduces heap usage, but slower */
|
||||
/* timing resistance for side-channel attack protection */
|
||||
#undef ECC_TIMING_RESISTANT
|
||||
#define ECC_TIMING_RESISTANT
|
||||
|
||||
#ifdef USE_FAST_MATH
|
||||
/* use reduced size math buffers for ecc points */
|
||||
#undef ALT_ECC_SIZE
|
||||
#define ALT_ECC_SIZE
|
||||
|
||||
/* Enable TFM optimizations for ECC */
|
||||
#if defined(HAVE_ECC192) || defined(HAVE_ALL_CURVES)
|
||||
#define TFM_ECC192
|
||||
#endif
|
||||
#if defined(HAVE_ECC224) || defined(HAVE_ALL_CURVES)
|
||||
#define TFM_ECC224
|
||||
#endif
|
||||
#if !defined(NO_ECC256) || defined(HAVE_ALL_CURVES)
|
||||
#define TFM_ECC256
|
||||
#endif
|
||||
#if defined(HAVE_ECC384) || defined(HAVE_ALL_CURVES)
|
||||
#define TFM_ECC384
|
||||
#endif
|
||||
#if defined(HAVE_ECC521) || defined(HAVE_ALL_CURVES)
|
||||
#define TFM_ECC521
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* RSA */
|
||||
#undef NO_RSA
|
||||
#if 1
|
||||
#ifdef USE_FAST_MATH
|
||||
/* Maximum math bits (Max RSA key bits * 2) */
|
||||
#undef FP_MAX_BITS
|
||||
#define FP_MAX_BITS 4096
|
||||
#endif
|
||||
|
||||
/* half as much memory but twice as slow */
|
||||
#undef RSA_LOW_MEM
|
||||
//#define RSA_LOW_MEM
|
||||
|
||||
/* RSA blinding countermeasures */
|
||||
#undef WC_RSA_BLINDING
|
||||
#define WC_RSA_BLINDING
|
||||
#else
|
||||
#define NO_RSA
|
||||
#endif
|
||||
|
||||
/* AES */
|
||||
#undef NO_AES
|
||||
#if 1
|
||||
#undef HAVE_AESGCM
|
||||
#define HAVE_AESGCM
|
||||
|
||||
#ifdef HAVE_AESGCM
|
||||
/* GCM Method: GCM_SMALL, GCM_WORD32 or GCM_TABLE */
|
||||
//#define GCM_SMALL
|
||||
#define GCM_TABLE
|
||||
#endif
|
||||
|
||||
#undef WOLFSSL_AES_COUNTER
|
||||
#define WOLFSSL_AES_COUNTER
|
||||
|
||||
#undef HAVE_AESCCM
|
||||
#define HAVE_AESCCM
|
||||
|
||||
#undef WOLFSSL_AES_DIRECT
|
||||
#define WOLFSSL_AES_DIRECT
|
||||
|
||||
#undef HAVE_AES_KEYWRAP
|
||||
#define HAVE_AES_KEYWRAP
|
||||
#else
|
||||
#define NO_AES
|
||||
#endif
|
||||
|
||||
/* ChaCha20 / Poly1305 */
|
||||
#undef HAVE_CHACHA
|
||||
#undef HAVE_POLY1305
|
||||
#if 1
|
||||
#define HAVE_CHACHA
|
||||
#define HAVE_POLY1305
|
||||
|
||||
/* Needed for Poly1305 */
|
||||
#undef HAVE_ONE_TIME_AUTH
|
||||
#define HAVE_ONE_TIME_AUTH
|
||||
#endif
|
||||
|
||||
/* Ed25519 / Curve25519 */
|
||||
#undef HAVE_CURVE25519
|
||||
#undef HAVE_ED25519
|
||||
#if 1
|
||||
#define HAVE_CURVE25519
|
||||
#define HAVE_ED25519
|
||||
|
||||
/* Optionally use small math (less flash usage, but much slower) */
|
||||
#if 0
|
||||
#define CURVED25519_SMALL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Hashing */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Sha */
|
||||
#undef NO_SHA
|
||||
#if 1
|
||||
/* 1k smaller, but 25% slower */
|
||||
//#define USE_SLOW_SHA
|
||||
#else
|
||||
#define NO_SHA
|
||||
#endif
|
||||
|
||||
/* Sha256 */
|
||||
#undef NO_SHA256
|
||||
#if 1
|
||||
#else
|
||||
#define NO_SHA256
|
||||
#endif
|
||||
|
||||
/* Sha512 */
|
||||
#undef WOLFSSL_SHA512
|
||||
#if 1
|
||||
#define WOLFSSL_SHA512
|
||||
|
||||
/* Sha384 */
|
||||
#undef WOLFSSL_SHA384
|
||||
#if 1
|
||||
#define WOLFSSL_SHA384
|
||||
#endif
|
||||
|
||||
/* over twice as small, but 50% slower */
|
||||
//#define USE_SLOW_SHA2
|
||||
#endif
|
||||
|
||||
/* MD5 */
|
||||
#undef NO_MD5
|
||||
#if 1
|
||||
#else
|
||||
#define NO_MD5
|
||||
#endif
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Enable Features */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#undef KEEP_PEER_CERT
|
||||
#define KEEP_PEER_CERT
|
||||
|
||||
#undef HAVE_COMP_KEY
|
||||
#define HAVE_COMP_KEY
|
||||
|
||||
#undef HAVE_ECC_ENCRYPT
|
||||
#define HAVE_ECC_ENCRYPT
|
||||
|
||||
#undef HAVE_TLS_EXTENSIONS
|
||||
#define HAVE_TLS_EXTENSIONS
|
||||
|
||||
#undef HAVE_SUPPORTED_CURVES
|
||||
#define HAVE_SUPPORTED_CURVES
|
||||
|
||||
#undef HAVE_EXTENDED_MASTER
|
||||
#define HAVE_EXTENDED_MASTER
|
||||
|
||||
#undef WOLFSSL_DTLS
|
||||
#define WOLFSSL_DTLS
|
||||
|
||||
#undef OPENSSL_EXTRA
|
||||
#define OPENSSL_EXTRA
|
||||
|
||||
#undef WOLFSSL_BASE64_ENCODE
|
||||
#define WOLFSSL_BASE64_ENCODE
|
||||
|
||||
#undef HAVE_HKDF
|
||||
#define HAVE_HKDF
|
||||
|
||||
#undef WOLFSSL_CMAC
|
||||
#define WOLFSSL_CMAC
|
||||
|
||||
#undef WOLFSSL_KEY_GEN
|
||||
#define WOLFSSL_KEY_GEN
|
||||
|
||||
#undef WOLFSSL_CERT_GEN
|
||||
#define WOLFSSL_CERT_GEN
|
||||
|
||||
#undef WOLFSSL_CERT_REQ
|
||||
#define WOLFSSL_CERT_REQ
|
||||
|
||||
#undef WOLFSSL_CERT_EXT
|
||||
#define WOLFSSL_CERT_EXT
|
||||
|
||||
#undef HAVE_PK_CALLBACKS
|
||||
#define HAVE_PK_CALLBACKS
|
||||
|
||||
#undef HAVE_ALPN
|
||||
#define HAVE_ALPN
|
||||
|
||||
#undef HAVE_SNI
|
||||
#define HAVE_SNI
|
||||
|
||||
#undef HAVE_MAX_FRAGMENT
|
||||
#define HAVE_MAX_FRAGMENT
|
||||
|
||||
#undef HAVE_TRUNCATED_HMAC
|
||||
#define HAVE_TRUNCATED_HMAC
|
||||
|
||||
#undef SESSION_CERTS
|
||||
#define SESSION_CERTS
|
||||
|
||||
#undef HAVE_SESSION_TICKET
|
||||
#define HAVE_SESSION_TICKET
|
||||
|
||||
#undef WOLFCRYPT_HAVE_SRP
|
||||
#define WOLFCRYPT_HAVE_SRP
|
||||
|
||||
#undef WOLFSSL_HAVE_CERT_SERVICE
|
||||
#define WOLFSSL_HAVE_CERT_SERVICE
|
||||
|
||||
#undef HAVE_PKCS7
|
||||
#define HAVE_PKCS7
|
||||
|
||||
#undef HAVE_X963_KDF
|
||||
#define HAVE_X963_KDF
|
||||
|
||||
#undef WOLFSSL_HAVE_WOLFSCEP
|
||||
#define WOLFSSL_HAVE_WOLFSCEP
|
||||
|
||||
#undef WOLFSSL_ALWAYS_KEEP_SNI
|
||||
#define WOLFSSL_ALWAYS_KEEP_SNI
|
||||
|
||||
#undef WOLFSSL_ALWAYS_VERIFY_CB
|
||||
#define WOLFSSL_ALWAYS_VERIFY_CB
|
||||
|
||||
#undef WOLFSSL_SEP
|
||||
#define WOLFSSL_SEP
|
||||
|
||||
#undef ATOMIC_USER
|
||||
#define ATOMIC_USER
|
||||
|
||||
#undef HAVE_OCSP
|
||||
#define HAVE_OCSP
|
||||
|
||||
#undef HAVE_CERTIFICATE_STATUS_REQUEST
|
||||
#define HAVE_CERTIFICATE_STATUS_REQUEST
|
||||
|
||||
#undef HAVE_CERTIFICATE_STATUS_REQUEST_V2
|
||||
#define HAVE_CERTIFICATE_STATUS_REQUEST_V2
|
||||
|
||||
#undef HAVE_CRL
|
||||
#define HAVE_CRL
|
||||
|
||||
#undef PERSIST_CERT_CACHE
|
||||
//#define PERSIST_CERT_CACHE
|
||||
|
||||
#undef PERSIST_SESSION_CACHE
|
||||
//#define PERSIST_SESSION_CACHE
|
||||
|
||||
#undef WOLFSSL_DER_LOAD
|
||||
//#define WOLFSSL_DER_LOAD
|
||||
|
||||
#undef WOLFSSL_DES_ECB
|
||||
//#define WOLFSSL_DES_ECB
|
||||
|
||||
#undef HAVE_CAMELLIA
|
||||
//#define HAVE_CAMELLIA
|
||||
|
||||
#undef HAVE_NULL_CIPHER
|
||||
//#define HAVE_NULL_CIPHER
|
||||
|
||||
#undef WOLFSSL_RIPEMD
|
||||
//#define WOLFSSL_RIPEMD
|
||||
|
||||
|
||||
/* TLS Session Cache */
|
||||
#if 1
|
||||
#define SMALL_SESSION_CACHE
|
||||
//#define MEDIUM_SESSION_CACHE
|
||||
//#define BIG_SESSION_CACHE
|
||||
//#define HUGE_SESSION_CACHE
|
||||
#else
|
||||
#define NO_SESSION_CACHE
|
||||
#endif
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Disable Features */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#undef NO_WOLFSSL_SERVER
|
||||
//#define NO_WOLFSSL_SERVER
|
||||
|
||||
#undef NO_WOLFSSL_CLIENT
|
||||
//#define NO_WOLFSSL_CLIENT
|
||||
|
||||
/* disables TLS 1.0/1.1 support */
|
||||
#undef NO_OLD_TLS
|
||||
//#define NO_OLD_TLS
|
||||
|
||||
/* disable access to filesystem */
|
||||
#undef NO_FILESYSTEM
|
||||
//#define NO_FILESYSTEM
|
||||
|
||||
#undef NO_RC4
|
||||
#define NO_RC4
|
||||
|
||||
#undef NO_HC128
|
||||
#define NO_HC128
|
||||
|
||||
#undef NO_RABBIT
|
||||
#define NO_RABBIT
|
||||
|
||||
#undef NO_MD4
|
||||
#define NO_MD4
|
||||
|
||||
/* Pre-shared keys */
|
||||
#undef NO_PSK
|
||||
//#define NO_PSK
|
||||
|
||||
#undef NO_DSA
|
||||
//#define NO_DSA
|
||||
|
||||
#undef NO_DH
|
||||
//#define NO_DH
|
||||
|
||||
#undef NO_DES3
|
||||
//#define NO_DES3
|
||||
|
||||
#undef NO_PWDBASED
|
||||
//#define NO_PWDBASED
|
||||
|
||||
/* encoding/decoding support */
|
||||
#undef NO_CODING
|
||||
//#define NO_CODING
|
||||
|
||||
/* memory wrappers and memory callbacks */
|
||||
#undef NO_WOLFSSL_MEMORY
|
||||
//#define NO_WOLFSSL_MEMORY
|
||||
|
||||
/* In-lining of misc.c functions */
|
||||
/* If defined, must include wolfcrypt/src/misc.c in build */
|
||||
/* Slower, but about 1k smaller */
|
||||
#undef NO_INLINE
|
||||
//#define NO_INLINE
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Benchmark / Test */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#undef NO_CRYPT_TEST
|
||||
//#define NO_CRYPT_TEST
|
||||
|
||||
#undef NO_CRYPT_BENCHMARK
|
||||
//#define NO_CRYPT_BENCHMARK
|
||||
|
||||
/* Use reduced benchmark / test sizes */
|
||||
#undef BENCH_EMBEDDED
|
||||
#define BENCH_EMBEDDED
|
||||
|
||||
#undef USE_CERT_BUFFERS_2048
|
||||
#define USE_CERT_BUFFERS_2048
|
||||
|
||||
#undef USE_CERT_BUFFERS_256
|
||||
#define USE_CERT_BUFFERS_256
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Debugging */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#undef DEBUG_WOLFSSL
|
||||
//#define DEBUG_WOLFSSL
|
||||
#ifdef DEBUG_WOLFSSL
|
||||
/* Use this to measure / print heap usage */
|
||||
#if 0
|
||||
#undef USE_WOLFSSL_MEMORY
|
||||
#define USE_WOLFSSL_MEMORY
|
||||
|
||||
#undef WOLFSSL_TRACK_MEMORY
|
||||
#define WOLFSSL_TRACK_MEMORY
|
||||
#endif
|
||||
|
||||
/* Math debugging (adds support for mp_dump) */
|
||||
#undef WOLFSSL_DEBUG_MATH
|
||||
//#define WOLFSSL_DEBUG_MATH
|
||||
#else
|
||||
#undef NO_ERROR_STRINGS
|
||||
//#define NO_ERROR_STRINGS
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* WOLFSSL_USER_SETTINGS_H */
|
619
IDE/INTIME-RTOS/wolfExamples.c
Executable file
619
IDE/INTIME-RTOS/wolfExamples.c
Executable file
@@ -0,0 +1,619 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <rt.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <io.h>
|
||||
|
||||
#include "wolfExamples.h"
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#include <wolfssl/ssl.h>
|
||||
#include <wolfssl/certs_test.h>
|
||||
#include <wolfcrypt/test/test.h>
|
||||
#include <wolfcrypt/benchmark/benchmark.h>
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Globals
|
||||
****************************************************************************/
|
||||
RTHANDLE hRootProcess;
|
||||
DWORD dwKtickInUsecs;
|
||||
INIT_STRUCT gInit;
|
||||
static int gServerExit = 0;
|
||||
static int gServerReady = 0;
|
||||
|
||||
static const char menu1[] = "\r\n"
|
||||
"\tt. WolfCrypt Test\r\n"
|
||||
"\tb. WolfCrypt Benchmark\r\n"
|
||||
"\tc. WolfSSL Client Example\r\n"
|
||||
"\ts. WolfSSL Server Example\r\n"
|
||||
"\tl. WolfSSL Localhost Client/Server Example\r\n";
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Configuration
|
||||
****************************************************************************/
|
||||
|
||||
#define TLS_MAXDATASIZE 4096 /* maximum acceptable amount of data */
|
||||
#define TLS_PORT 11111 /* define default port number */
|
||||
#define TLS_HOST_LOCAL "127.0.0.1"
|
||||
#define TLS_HOST_REMOTE "192.168.0.112"
|
||||
#define SOCK_MAX_PENDING 5
|
||||
#define THREAD_BASE_PRIO 150
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* TLS Client
|
||||
****************************************************************************/
|
||||
int wolfExample_TLSClient(const char* ip, int port)
|
||||
{
|
||||
int ret = 0;
|
||||
WOLFSSL_CTX* ctx = NULL;
|
||||
WOLFSSL* ssl = NULL; /* create WOLFSSL object */
|
||||
int sockFd = -1; /* socket file descriptor */
|
||||
struct sockaddr_in servAddr; /* struct for server address */
|
||||
char sendBuff[TLS_MAXDATASIZE], rcvBuff[TLS_MAXDATASIZE];
|
||||
|
||||
sockFd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (sockFd < 0) {
|
||||
printf("Failed to create socket. Error: %d\n", errno);
|
||||
return errno;
|
||||
}
|
||||
|
||||
memset(&servAddr, 0, sizeof(servAddr)); /* clears memory block for use */
|
||||
servAddr.sin_family = AF_INET; /* sets addressfamily to internet*/
|
||||
servAddr.sin_port = htons(port); /* sets port to defined port */
|
||||
|
||||
/* looks for the server at the entered address (ip in the command line) */
|
||||
if (inet_pton(AF_INET, ip, &servAddr.sin_addr) < 1) {
|
||||
/* checks validity of address */
|
||||
ret = errno;
|
||||
printf("Invalid Address. Error: %d\n", ret);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (connect(sockFd, (struct sockaddr *)&servAddr, sizeof(servAddr)) < 0) {
|
||||
/* if socket fails to connect to the server*/
|
||||
ret = errno;
|
||||
printf("Connect error. Error: %d\n", ret);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* create and initialize WOLFSSL_CTX structure */
|
||||
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method())) == NULL) {
|
||||
printf("SSL_CTX_new error.\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* load CA certificates into wolfSSL_CTX. which will verify the server */
|
||||
ret = wolfSSL_CTX_load_verify_buffer(ctx, ca_cert_der_2048,
|
||||
sizeof_ca_cert_der_2048, SSL_FILETYPE_ASN1);
|
||||
if (ret != SSL_SUCCESS) {
|
||||
printf("Error %d loading CA cert\n", ret);
|
||||
goto exit;
|
||||
}
|
||||
if ((ssl = wolfSSL_new(ctx)) == NULL) {
|
||||
printf("wolfSSL_new error.\n");
|
||||
goto exit;
|
||||
}
|
||||
wolfSSL_set_fd(ssl, sockFd);
|
||||
|
||||
ret = wolfSSL_connect(ssl);
|
||||
if (ret == SSL_SUCCESS) {
|
||||
printf("Message for server:\t");
|
||||
fgets(sendBuff, TLS_MAXDATASIZE, stdin);
|
||||
|
||||
if (wolfSSL_write(ssl, sendBuff, strlen(sendBuff)) != strlen(sendBuff)) {
|
||||
/* the message is not able to send, or error trying */
|
||||
ret = wolfSSL_get_error(ssl, 0);
|
||||
printf("Write error: Error: %d\n", ret);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
memset(rcvBuff, 0, TLS_MAXDATASIZE);
|
||||
if (wolfSSL_read(ssl, rcvBuff, TLS_MAXDATASIZE) < 0) {
|
||||
/* the server failed to send data, or error trying */
|
||||
ret = wolfSSL_get_error(ssl, 0);
|
||||
printf("Read error. Error: %d\n", ret);
|
||||
goto exit;
|
||||
}
|
||||
printf("Received: \t%s\n", rcvBuff);
|
||||
}
|
||||
|
||||
exit:
|
||||
/* frees all data before client termination */
|
||||
if (sockFd != -1)
|
||||
close(sockFd);
|
||||
wolfSSL_free(ssl);
|
||||
wolfSSL_CTX_free(ctx);
|
||||
gServerExit = 1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* TLS Server
|
||||
****************************************************************************/
|
||||
int wolfExample_TLSServer(int port)
|
||||
{
|
||||
int ret = 0;
|
||||
WOLFSSL_CTX* ctx = NULL;
|
||||
WOLFSSL* ssl = NULL;
|
||||
int sockFd = -1, clientFd = -1;
|
||||
struct sockaddr_in serverAddr = {0}, clientAddr = {0};
|
||||
const char reply[] = "I hear ya fa shizzle!\n";
|
||||
int addrSize = sizeof(clientAddr);
|
||||
char buff[256];
|
||||
|
||||
sockFd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (sockFd < 0) {
|
||||
printf("Failed to create socket. Error: %d\n", errno);
|
||||
return errno;
|
||||
}
|
||||
|
||||
/* create and initialize WOLFSSL_CTX structure */
|
||||
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_server_method())) == NULL) {
|
||||
fprintf(stderr, "wolfSSL_CTX_new error.\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* Load server certificate into WOLFSSL_CTX */
|
||||
ret = wolfSSL_CTX_use_certificate_buffer(ctx, server_cert_der_2048,
|
||||
sizeof_server_cert_der_2048, SSL_FILETYPE_ASN1);
|
||||
if (ret != SSL_SUCCESS) {
|
||||
fprintf(stderr, "Error %d loading server-cert!\n", ret);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* Load server key into WOLFSSL_CTX */
|
||||
ret = wolfSSL_CTX_use_PrivateKey_buffer(ctx, server_key_der_2048,
|
||||
sizeof_server_key_der_2048, SSL_FILETYPE_ASN1);
|
||||
if (ret != SSL_SUCCESS) {
|
||||
fprintf(stderr, "Error %d loading server-key!\n", ret);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* Initialize the server address struct to zero */
|
||||
memset((char *)&serverAddr, 0, sizeof(serverAddr));
|
||||
|
||||
/* Fill the server's address family */
|
||||
serverAddr.sin_family = AF_INET;
|
||||
serverAddr.sin_addr.s_addr = INADDR_ANY;
|
||||
serverAddr.sin_port = htons(port);
|
||||
|
||||
/* Attach the server socket to our port */
|
||||
if (bind(sockFd, (struct sockaddr *)&serverAddr, sizeof(serverAddr)) < 0) {
|
||||
printf("ERROR: failed to bind\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
printf("Waiting for a connection...\n");
|
||||
gServerReady = 1;
|
||||
|
||||
/* Continuously accept connects while not in an active connection */
|
||||
while (gServerExit == 0) {
|
||||
/* listen for a new connection */
|
||||
ret = listen(sockFd, SOCK_MAX_PENDING);
|
||||
if (ret == 0) {
|
||||
/* Wait until a client connects */
|
||||
clientFd = accept(sockFd, (struct sockaddr*)&clientAddr, &addrSize);
|
||||
|
||||
/* If fails to connect, loop back up and wait for a new connection */
|
||||
if (clientFd == -1) {
|
||||
printf("failed to accept the connection..\n");
|
||||
}
|
||||
/* If it connects, read in and reply to the client */
|
||||
else {
|
||||
printf("Client connected successfully\n");
|
||||
|
||||
ssl = wolfSSL_new(ctx);
|
||||
if (ssl == NULL) {
|
||||
fprintf(stderr, "wolfSSL_new error.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
/* direct our ssl to our clients connection */
|
||||
wolfSSL_set_fd(ssl, clientFd);
|
||||
|
||||
printf("Using Non-Blocking I/O: %d\n",
|
||||
wolfSSL_get_using_nonblock(ssl));
|
||||
|
||||
for ( ; ; ) {
|
||||
/* Clear the buffer memory for anything possibly left over */
|
||||
memset(&buff, 0, sizeof(buff));
|
||||
|
||||
/* Read the client data into our buff array */
|
||||
ret = wolfSSL_read(ssl, buff, sizeof(buff) - 1);
|
||||
if (ret > 0) {
|
||||
/* Print any data the client sends to the console */
|
||||
printf("Client: %s\n", buff);
|
||||
|
||||
/* Reply back to the client */
|
||||
ret = wolfSSL_write(ssl, reply, sizeof(reply) - 1);
|
||||
if (ret < 0) {
|
||||
printf("wolfSSL_write error = %d\n",
|
||||
wolfSSL_get_error(ssl, ret));
|
||||
gServerExit = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* if the client disconnects break the loop */
|
||||
else {
|
||||
if (ret < 0)
|
||||
printf("wolfSSL_read error = %d\n",
|
||||
wolfSSL_get_error(ssl, ret));
|
||||
else if (ret == 0)
|
||||
printf("The client has closed the connection.\n");
|
||||
gServerExit = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
wolfSSL_free(ssl); /* Free the WOLFSSL object */
|
||||
ssl = NULL;
|
||||
}
|
||||
close(clientFd); /* close the connected socket */
|
||||
clientFd = -1;
|
||||
}
|
||||
} /* while */
|
||||
|
||||
exit:
|
||||
if (clientFd != -1)
|
||||
close(clientFd);
|
||||
if (sockFd != -1)
|
||||
close(sockFd);
|
||||
wolfSSL_free(ssl); /* Free the WOLFSSL object */
|
||||
wolfSSL_CTX_free(ctx); /* Free WOLFSSL_CTX */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* TLS Local Test
|
||||
****************************************************************************/
|
||||
static void wolfSSLLocalServerThread(void* param)
|
||||
{
|
||||
int port = (int)((int*)param);
|
||||
wolfExample_TLSServer(port);
|
||||
}
|
||||
|
||||
int wolfExample_TLSLocal(int port)
|
||||
{
|
||||
int ret;
|
||||
RTHANDLE srvHandle;
|
||||
|
||||
/* start server thread */
|
||||
srvHandle = CreateRtThread(THREAD_BASE_PRIO + 10,
|
||||
(LPPROC)wolfSSLLocalServerThread, WOLF_EXAMPLES_STACK, (void*)port);
|
||||
if (srvHandle == BAD_RTHANDLE) {
|
||||
Fail("Cannot create server thread");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* wait for server to be ready */
|
||||
while (gServerReady != 1) {
|
||||
RtSleep(0);
|
||||
}
|
||||
|
||||
/* run client */
|
||||
ret = wolfExample_TLSClient(TLS_HOST_LOCAL, port);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Thread
|
||||
memset(&args, 0, sizeof(args));
|
||||
****************************************************************************/
|
||||
typedef struct func_args {
|
||||
int argc;
|
||||
char** argv;
|
||||
int return_code;
|
||||
} func_args;
|
||||
|
||||
static void wolfExampleThread(void* param)
|
||||
{
|
||||
func_args args;
|
||||
|
||||
#ifdef DEBUG_WOLFSSL
|
||||
wolfSSL_Debugging_ON();
|
||||
#endif
|
||||
|
||||
/* initialize wolfSSL */
|
||||
wolfSSL_Init();
|
||||
|
||||
while (1) {
|
||||
char rc;
|
||||
|
||||
gServerExit = 0;
|
||||
gServerReady = 0;
|
||||
|
||||
printf("\r\n\t\t\t\tMENU\r\n");
|
||||
printf(menu1);
|
||||
printf("Please select one of the above options: ");
|
||||
|
||||
rc = getchar();
|
||||
switch (rc) {
|
||||
case 't':
|
||||
printf("\nCrypt Test\n");
|
||||
wolfcrypt_test(&args);
|
||||
printf("Crypt Test: Return code %d\n", args.return_code);
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
printf("\nBenchmark Test\n");
|
||||
benchmark_test(&args);
|
||||
printf("Benchmark Test: Return code %d\n", args.return_code);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
wolfExample_TLSClient(TLS_HOST_REMOTE, TLS_PORT);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
wolfExample_TLSServer(TLS_PORT);
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
wolfExample_TLSLocal(TLS_PORT);
|
||||
break;
|
||||
|
||||
// All other cases go here
|
||||
default:
|
||||
if (rc != '\r' && rc != '\n')
|
||||
printf("\r\nSelection %c out of range\r\n", rc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
wolfSSL_Cleanup();
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* FUNCTION: Catalog
|
||||
*
|
||||
* PARAMETERS: 1. handle of the process whose object directory must be used
|
||||
* 2. the object whose handle must be cataloged
|
||||
* 3. the name to be used (upto 14 characters)
|
||||
*
|
||||
* RETURNS: TRUE on success
|
||||
*
|
||||
* DESCRIPTION: If the given name already exists,
|
||||
* and the existing name refers to a non-existing object,
|
||||
* then the existing name is removed before cataloging.
|
||||
\*****************************************************************************/
|
||||
BOOLEAN Catalog(
|
||||
RTHANDLE hProcess,
|
||||
RTHANDLE hObject,
|
||||
LPSTR lpszName)
|
||||
{
|
||||
RTHANDLE hOld;
|
||||
|
||||
if (CatalogRtHandle(hProcess, hObject, lpszName))
|
||||
return TRUE;
|
||||
|
||||
// something wrong: check for the case mentioned above
|
||||
if (((hOld = LookupRtHandle(hProcess, lpszName, NO_WAIT)) != BAD_RTHANDLE) &&
|
||||
(GetRtHandleType(hOld) == INVALID_TYPE))
|
||||
{
|
||||
// this is the case mentioned above: remove the old entry and try again
|
||||
if (UncatalogRtHandle(hProcess, lpszName))
|
||||
return (CatalogRtHandle(hProcess, hObject, lpszName));
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* FUNCTION: Cleanup (local function)
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Tell threads to delete themselves and wait a while;
|
||||
* if any thread still exists, kill it.
|
||||
* Remove all other objects as far as they have been created.
|
||||
\*****************************************************************************/
|
||||
void Cleanup(void)
|
||||
{
|
||||
// indicate that we are cleaning up
|
||||
gInit.state = CLEANUP_BUSY;
|
||||
gInit.bShutdown = TRUE;
|
||||
|
||||
#ifdef _DEBUG
|
||||
fprintf(stderr, "wolfExamples started cleaning up\n");
|
||||
#endif
|
||||
|
||||
// remove our name from the root process
|
||||
if (gInit.bCataloged) {
|
||||
if (!UncatalogRtHandle(hRootProcess, "wolfExample"))
|
||||
Fail("Cannot remove my own name");
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
fprintf(stderr, "wolfExamples finished cleaning up\n");
|
||||
#endif
|
||||
|
||||
// lie down
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* FUNCTION: Fail
|
||||
*
|
||||
* PARAMETERS: same parameters as expected by printf
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* If in debug mode, prints the message, appending a new line and the error number.
|
||||
* Then the current process is killed graciously:
|
||||
* If the current thread is the main thread, this is done directly.
|
||||
* if the current thread is another one, a terminate request is sent and
|
||||
* the function returns to the calling thread.
|
||||
\*****************************************************************************/
|
||||
void Fail(LPSTR lpszMessage, ...)
|
||||
{
|
||||
EXCEPTION eh;
|
||||
RTHANDLE hDelMbx;
|
||||
DWORD dwTerminate;
|
||||
|
||||
#ifdef _DEBUG
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, lpszMessage);
|
||||
vfprintf(stderr, lpszMessage, ap);
|
||||
va_end(ap);
|
||||
fprintf(stderr, "\nError nr=%x %s\n", GetLastRtError(), GetRtErrorText(GetLastRtError()));
|
||||
#endif
|
||||
|
||||
// make sure that exceptions are returned for inline handling
|
||||
GetRtExceptionHandlerInfo(THREAD_HANDLER, &eh);
|
||||
eh.ExceptionMode = 0;
|
||||
SetRtExceptionHandler(&eh);
|
||||
|
||||
// if we had not started initializing yet, just get out
|
||||
if (BEFORE_INIT == gInit.state)
|
||||
exit(0);
|
||||
|
||||
if (gInit.hMain == GetRtThreadHandles(THIS_THREAD))
|
||||
{
|
||||
// this is the main thread:
|
||||
// if we are busy initializing, then do Cleanup
|
||||
if (INIT_BUSY == gInit.state)
|
||||
Cleanup(); // does not return
|
||||
|
||||
// this is the main thread, but we are not initializing: just return
|
||||
return;
|
||||
}
|
||||
|
||||
// this is not the main thread:
|
||||
// ask main thread to do cleanup
|
||||
// (allow some time to setup the deletion mailbox, ignore errors)
|
||||
hDelMbx = LookupRtHandle(NULL_RTHANDLE, "R?EXIT_MBOX", 5000);
|
||||
dwTerminate = TERMINATE;
|
||||
SendRtData(hDelMbx, &dwTerminate, 4);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* FUNCTION: UsecsToKticks
|
||||
*
|
||||
* PARAMETERS: 1. number of usecs
|
||||
*
|
||||
* RETURNS: number of low level ticks
|
||||
*
|
||||
* DESCRIPTION: returns the parameter if it is WAIT_FOREVER
|
||||
* otherwise rounds up to number of low level ticks
|
||||
\*****************************************************************************/
|
||||
DWORD UsecsToKticks(DWORD dwUsecs)
|
||||
{
|
||||
if (dwUsecs == WAIT_FOREVER)
|
||||
return WAIT_FOREVER;
|
||||
|
||||
return (dwUsecs + dwKtickInUsecs - 1) / dwKtickInUsecs;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* FUNCTION: main
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* This is the main program module.
|
||||
* It creates global objects and all threads.
|
||||
* The main thread then waits for notifications and acts accordingly
|
||||
\*****************************************************************************/
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
SYSINFO sysinfo;
|
||||
EVENTINFO eiEventInfo;
|
||||
RTHANDLE taskHandle;
|
||||
|
||||
#ifdef _DEBUG
|
||||
fprintf(stderr, "wolfExamples started\n");
|
||||
#endif
|
||||
|
||||
// obtain handle of root process (cannot fail)
|
||||
hRootProcess = GetRtThreadHandles(ROOT_PROCESS);
|
||||
|
||||
// initialize the structure for cleaning up
|
||||
memset(&gInit, 0, sizeof(gInit));
|
||||
gInit.state = BEFORE_INIT;
|
||||
|
||||
// get low level tick length in usecs
|
||||
if (!CopyRtSystemInfo(&sysinfo))
|
||||
Fail("Cannot copy system info");
|
||||
dwKtickInUsecs = 10000 / sysinfo.KernelTickRatio;
|
||||
if (dwKtickInUsecs == 0)
|
||||
Fail("Invalid low level tick length");
|
||||
|
||||
// adjust process max priority (ignore error)
|
||||
// TODO adjust the 2nd parameter to a value closer to zero if you want to allow more priorities
|
||||
SetRtProcessMaxPriority(NULL_RTHANDLE, THREAD_BASE_PRIO);
|
||||
|
||||
// obtain main thread's handle
|
||||
gInit.hMain = GetRtThreadHandles(THIS_THREAD);
|
||||
gInit.state = INIT_BUSY;
|
||||
|
||||
// attempt to catalog the thread but ignore error
|
||||
Catalog(NULL_RTHANDLE, gInit.hMain, "TMain");
|
||||
|
||||
// catalog the handle of this process in the root process
|
||||
if (!Catalog(hRootProcess, GetRtThreadHandles(THIS_PROCESS), "wolfExample")) {
|
||||
Fail("Cannot catalog process name");
|
||||
}
|
||||
gInit.bCataloged = TRUE;
|
||||
|
||||
// create thread
|
||||
taskHandle = CreateRtThread(THREAD_BASE_PRIO + 20,
|
||||
(LPPROC)wolfExampleThread, WOLF_EXAMPLES_STACK, 0);
|
||||
if (taskHandle == BAD_RTHANDLE) {
|
||||
Fail("Cannot create thread");
|
||||
}
|
||||
|
||||
// indicate that initialization has finished
|
||||
gInit.state = INIT_DONE;
|
||||
#ifdef _DEBUG
|
||||
fprintf(stderr, "wolfExamples finished initialization\n");
|
||||
#endif
|
||||
|
||||
// wait for notifications
|
||||
while (RtNotifyEvent(RT_SYSTEM_NOTIFICATIONS | RT_EXIT_NOTIFICATIONS,
|
||||
WAIT_FOREVER, &eiEventInfo))
|
||||
{
|
||||
switch(eiEventInfo.dwNotifyType)
|
||||
{
|
||||
case TERMINATE:
|
||||
// TODO: this process should terminate
|
||||
// cleanup the environment
|
||||
Cleanup(); // does not return
|
||||
|
||||
case NT_HOST_UP:
|
||||
// TODO: react to a Windows host that has come back
|
||||
break;
|
||||
|
||||
case NT_BLUESCREEN:
|
||||
// TODO: react to a Windows blue screen
|
||||
break;
|
||||
|
||||
case KERNEL_STOPPING:
|
||||
// TODO: react to the INtime kernel stopping
|
||||
break;
|
||||
|
||||
case NT_HOST_HIBERNATE:
|
||||
// TODO: react to the Windows host going in hibernation
|
||||
break;
|
||||
|
||||
case NT_HOST_STANDBY:
|
||||
// TODO: react to the Windows host going in standby mode
|
||||
break;
|
||||
|
||||
case NT_HOST_SHUTDOWN_PENDING:
|
||||
// TODO: react to a Windows host that is about to shutdown
|
||||
break;
|
||||
}
|
||||
}
|
||||
Fail("Notify failed");
|
||||
return 0;
|
||||
}
|
47
IDE/INTIME-RTOS/wolfExamples.h
Executable file
47
IDE/INTIME-RTOS/wolfExamples.h
Executable file
@@ -0,0 +1,47 @@
|
||||
#ifndef _WOLFEXAMPLES_H_
|
||||
#define _WOLFEXAMPLES_H_
|
||||
|
||||
#include <rt.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// support functions for all threads
|
||||
BOOLEAN Catalog(RTHANDLE hProcess, RTHANDLE hObject, LPSTR lpszName);
|
||||
void Cleanup(void);
|
||||
void Fail(LPSTR lpszMessage, ...);
|
||||
DWORD UsecsToKticks(DWORD dwUsecs);
|
||||
|
||||
|
||||
/* Example API's */
|
||||
int wolfExample_TLSServer(int port);
|
||||
int wolfExample_TLSClient(const char* ip, int port);
|
||||
int wolfExample_TLSLocal(int port);
|
||||
|
||||
|
||||
// global type definitions
|
||||
typedef enum {
|
||||
BEFORE_INIT,
|
||||
INIT_BUSY,
|
||||
INIT_DONE,
|
||||
CLEANUP_BUSY
|
||||
} INIT_STATE;
|
||||
|
||||
typedef struct {
|
||||
RTHANDLE hMain; // RTHANDLE of main thread
|
||||
INIT_STATE state; // main thread state
|
||||
BOOLEAN bCataloged; // TRUE if we cataloged process name in root
|
||||
BOOLEAN bShutdown; // TRUE if all threads have to terminate
|
||||
} INIT_STRUCT;
|
||||
|
||||
// global variables
|
||||
extern RTHANDLE hRootProcess; // RTHANDLE of root process
|
||||
extern DWORD dwKtickInUsecs; // length of one low level tick in usecs
|
||||
extern INIT_STRUCT gInit; // structure describing all global objects
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* _WOLFEXAMPLES_H_ */
|
31
IDE/INTIME-RTOS/wolfExamples.sln
Executable file
31
IDE/INTIME-RTOS/wolfExamples.sln
Executable file
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wolfExamples", "wolfExamples.vcxproj", "{557A7EFD-2627-478A-A855-50F518DD13EE}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{1731767D-573F-45C9-A466-191DA0D180CF} = {1731767D-573F-45C9-A466-191DA0D180CF}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libwolfssl", "libwolfssl.vcxproj", "{1731767D-573F-45C9-A466-191DA0D180CF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|INtime = Debug|INtime
|
||||
Release|INtime = Release|INtime
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{557A7EFD-2627-478A-A855-50F518DD13EE}.Debug|INtime.ActiveCfg = Debug|INtime
|
||||
{557A7EFD-2627-478A-A855-50F518DD13EE}.Debug|INtime.Build.0 = Debug|INtime
|
||||
{557A7EFD-2627-478A-A855-50F518DD13EE}.Release|INtime.ActiveCfg = Release|INtime
|
||||
{557A7EFD-2627-478A-A855-50F518DD13EE}.Release|INtime.Build.0 = Release|INtime
|
||||
{1731767D-573F-45C9-A466-191DA0D180CF}.Debug|INtime.ActiveCfg = Debug|INtime
|
||||
{1731767D-573F-45C9-A466-191DA0D180CF}.Debug|INtime.Build.0 = Debug|INtime
|
||||
{1731767D-573F-45C9-A466-191DA0D180CF}.Release|INtime.ActiveCfg = Release|INtime
|
||||
{1731767D-573F-45C9-A466-191DA0D180CF}.Release|INtime.Build.0 = Release|INtime
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
100
IDE/INTIME-RTOS/wolfExamples.vcxproj
Executable file
100
IDE/INTIME-RTOS/wolfExamples.vcxproj
Executable file
@@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|INtime">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>INtime</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|INtime">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>INtime</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="README.md" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="wolfExamples.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\test\test.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\benchmark\benchmark.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="user_settings.h" />
|
||||
<ClInclude Include="wolfExamples.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{557A7EFD-2627-478A-A855-50F518DD13EE}</ProjectGuid>
|
||||
<ProjectName>wolfExamples</ProjectName>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|INtime'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|INtime'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|INtime'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|INtime'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|INtime'">
|
||||
<IntDir>$(Configuration)_$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|INtime'">
|
||||
<IntDir>$(Configuration)_$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|INtime'">
|
||||
<ClCompile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<Version>21076.20053</Version>
|
||||
<AdditionalOptions>/SAFESEH:NO %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>rt.lib;pcibus.lib;netlib.lib;clib.lib;vshelper.lib;libwolfssl.lib</AdditionalDependencies>
|
||||
<OutputFile>$(SolutionDir)$(Configuration)\\wolfExamples.rta</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<ExceptionHandling>Async</ExceptionHandling>
|
||||
<PreprocessorDefinitions>WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
|
||||
<XMLDocumentationFileName>$(IntDir)</XMLDocumentationFileName>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|INtime'">
|
||||
<ClCompile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<Version>21076.20053</Version>
|
||||
<AdditionalOptions>/SAFESEH:NO %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>rt.lib;pcibus.lib;netlib.lib;clib.lib;vshelper.lib;libwolfssl.lib</AdditionalDependencies>
|
||||
<OutputFile>$(SolutionDir)$(Configuration)\\wolfExamples.rta</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<ExceptionHandling>Async</ExceptionHandling>
|
||||
<PreprocessorDefinitions>WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
|
||||
<XMLDocumentationFileName>$(IntDir)</XMLDocumentationFileName>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@@ -216,6 +216,8 @@ extern "C" {
|
||||
#define FREESCALE_USE_LTC
|
||||
#define LTC_MAX_ECC_BITS (512)
|
||||
#define LTC_MAX_INT_BYTES (256)
|
||||
|
||||
//#define FREESCALE_LTC_TFM_RSA_4096_ENABLE
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
@@ -230,14 +232,17 @@ extern "C" {
|
||||
#undef USE_CERT_BUFFERS_2048
|
||||
#define USE_CERT_BUFFERS_2048
|
||||
|
||||
#undef USE_CERT_BUFFERS_256
|
||||
#define USE_CERT_BUFFERS_256
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Debugging */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#undef WOLFSSL_DEBUG
|
||||
//#define WOLFSSL_DEBUG
|
||||
#undef DEBUG_WOLFSSL
|
||||
//#define DEBUG_WOLFSSL
|
||||
|
||||
#ifdef WOLFSSL_DEBUG
|
||||
#ifdef DEBUG_WOLFSSL
|
||||
#define fprintf(file, format, ...) printf(format, ##__VA_ARGS__)
|
||||
|
||||
/* Use this to measure / print heap usage */
|
||||
@@ -253,7 +258,7 @@ extern "C" {
|
||||
#define NO_WOLFSSL_MEMORY
|
||||
|
||||
#undef NO_ERROR_STRINGS
|
||||
#define NO_ERROR_STRINGS
|
||||
//#define NO_ERROR_STRINGS
|
||||
#endif
|
||||
|
||||
|
||||
@@ -273,17 +278,21 @@ extern "C" {
|
||||
/* Size of returned HW RNG value */
|
||||
#define CUSTOM_RAND_TYPE unsigned int
|
||||
|
||||
/* Seed source */
|
||||
extern unsigned int custom_rand_generate(void);
|
||||
#undef CUSTOM_RAND_GENERATE
|
||||
#define CUSTOM_RAND_GENERATE custom_rand_generate
|
||||
|
||||
/* Choose RNG method */
|
||||
#if 1
|
||||
/* Use built-in P-RNG (SHA256 based) with HW RNG */
|
||||
/* P-RNG + HW RNG (P-RNG is ~8K) */
|
||||
#undef HAVE_HASHDRBG
|
||||
#define HAVE_HASHDRBG
|
||||
|
||||
extern unsigned int custom_rand_generate(void);
|
||||
#undef CUSTOM_RAND_GENERATE
|
||||
#define CUSTOM_RAND_GENERATE custom_rand_generate
|
||||
#else
|
||||
#undef WC_NO_HASHDRBG
|
||||
#define WC_NO_HASHDRBG
|
||||
|
||||
/* Bypass P-RNG and use only HW RNG */
|
||||
extern int custom_rand_generate_block(unsigned char* output, unsigned int sz);
|
||||
#undef CUSTOM_RAND_GENERATE_BLOCK
|
||||
|
@@ -102,6 +102,8 @@
|
||||
<file file_name="../../wolfcrypt/src/tfm.c" />
|
||||
<file file_name="../../wolfcrypt/src/wc_encrypt.c" />
|
||||
<file file_name="../../wolfcrypt/src/wc_port.c" />
|
||||
<file file_name="../../wolfcrypt/src/wolfmath.c" />
|
||||
<file file_name="../../wolfcrypt/src/wolfevent.c" />
|
||||
</folder>
|
||||
<folder Name="test">
|
||||
<file file_name="../../wolfcrypt/test/include.am" />
|
||||
@@ -120,12 +122,26 @@
|
||||
recurse="Yes" />
|
||||
<file file_name="user_settings.h" />
|
||||
<file file_name="README.md" />
|
||||
<folder
|
||||
Name="source"
|
||||
exclude=""
|
||||
filter=""
|
||||
path="../../src"
|
||||
recurse="No" />
|
||||
<folder Name="source">
|
||||
<file file_name="../../src/bio.c">
|
||||
<configuration Name="ARM_Debug" build_exclude_from_build="Yes" />
|
||||
</file>
|
||||
<file file_name="../../src/crl.c" />
|
||||
<file file_name="../../src/include.am" />
|
||||
<file file_name="../../src/internal.c" />
|
||||
<file file_name="../../src/io.c" />
|
||||
<file file_name="../../src/keys.c" />
|
||||
<file file_name="../../src/libwolfssl.la" />
|
||||
<file file_name="../../src/ocsp.c" />
|
||||
<file file_name="../../src/sniffer.c" />
|
||||
<file file_name="../../src/src_libwolfssl_la-internal.lo" />
|
||||
<file file_name="../../src/src_libwolfssl_la-io.lo" />
|
||||
<file file_name="../../src/src_libwolfssl_la-keys.lo" />
|
||||
<file file_name="../../src/src_libwolfssl_la-ssl.lo" />
|
||||
<file file_name="../../src/src_libwolfssl_la-tls.lo" />
|
||||
<file file_name="../../src/ssl.c" />
|
||||
<file file_name="../../src/tls.c" />
|
||||
</folder>
|
||||
</folder>
|
||||
</project>
|
||||
<project Name="test">
|
||||
|
@@ -104,6 +104,8 @@
|
||||
<file file_name="../../wolfcrypt/src/tfm.c" />
|
||||
<file file_name="../../wolfcrypt/src/wc_encrypt.c" />
|
||||
<file file_name="../../wolfcrypt/src/wc_port.c" />
|
||||
<file file_name="../../wolfcrypt/src/wolfmath.c" />
|
||||
<file file_name="../../wolfcrypt/src/wolfevent.c" />
|
||||
<folder Name="port">
|
||||
<folder Name="nxp">
|
||||
<file file_name="../../wolfcrypt/src/port/nxp/ksdk_port.c" />
|
||||
@@ -298,12 +300,26 @@
|
||||
recurse="Yes" />
|
||||
<file file_name="user_settings.h" />
|
||||
<file file_name="README.md" />
|
||||
<folder
|
||||
Name="source"
|
||||
exclude=""
|
||||
filter=""
|
||||
path="../../src"
|
||||
recurse="No" />
|
||||
<folder Name="source">
|
||||
<file file_name="../../src/bio.c">
|
||||
<configuration Name="ARM_Debug" build_exclude_from_build="Yes" />
|
||||
</file>
|
||||
<file file_name="../../src/crl.c" />
|
||||
<file file_name="../../src/include.am" />
|
||||
<file file_name="../../src/internal.c" />
|
||||
<file file_name="../../src/io.c" />
|
||||
<file file_name="../../src/keys.c" />
|
||||
<file file_name="../../src/libwolfssl.la" />
|
||||
<file file_name="../../src/ocsp.c" />
|
||||
<file file_name="../../src/sniffer.c" />
|
||||
<file file_name="../../src/src_libwolfssl_la-internal.lo" />
|
||||
<file file_name="../../src/src_libwolfssl_la-io.lo" />
|
||||
<file file_name="../../src/src_libwolfssl_la-keys.lo" />
|
||||
<file file_name="../../src/src_libwolfssl_la-ssl.lo" />
|
||||
<file file_name="../../src/src_libwolfssl_la-tls.lo" />
|
||||
<file file_name="../../src/ssl.c" />
|
||||
<file file_name="../../src/tls.c" />
|
||||
</folder>
|
||||
</folder>
|
||||
</project>
|
||||
<project Name="test_ltc">
|
||||
|
@@ -300,7 +300,9 @@
|
||||
<ClCompile Include="..\..\src\ssl.c" />
|
||||
<ClCompile Include="..\..\src\tls.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\wc_encrypt.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\wolfmath.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\wolfevent.c" />
|
||||
<ClCompile Include="..\..\wolfcrypt\src\pkcs12.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="..\..\wolfcrypt\src\aes_asm.asm">
|
||||
@@ -324,4 +326,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
## Wind River Workbench using VxWorks with wolfSSL
|
||||
####1 Steps to Add wolfSSL to Workbench Project
|
||||
#### 1 Steps to Add wolfSSL to Workbench Project
|
||||
1. Start by creating a new VxWorks image in Workbench by going to File > New >
|
||||
Project and then selecting VxWorks Image Project.
|
||||
|
||||
@@ -52,8 +52,8 @@ workspace folder. This is where the simulator looks for the filesystem.
|
||||
new project you created. Click "Ok".
|
||||
- Rebuild the project.
|
||||
|
||||
####2 Testing wolfSSL with VxWorks:
|
||||
#####2.1 wolfCrypt Test and Benchmark Applications
|
||||
#### 2 Testing wolfSSL with VxWorks:
|
||||
##### 2.1 wolfCrypt Test and Benchmark Applications
|
||||
The wolfCrypt test application will test each of the cryptographic algorithms
|
||||
and output the status for each as a success or failure. The benchmark application will output the runtime of the cryptographic algorithms in milliseconds.
|
||||
|
||||
@@ -85,7 +85,7 @@ by adding the following to the usrAppInit() function:
|
||||
|
||||
4. To run the VxWorks simulator, click the dropdown list next to "VxWorks Simulator" at the top of Workbench and go to "Open Connection Details". Add the correct Kernel Image file. This will be located in ```workspace/<project_name>/default/vxWorks```. Click Apply. Start the simulator by clicking the green, "Connect 'VxWorks Simulator'" button to the right of the "VxWorks Simulator" dropdown list. Verify in the simulator terminal that all wolfCrypt tests pass.
|
||||
|
||||
#####2.2 Example Client
|
||||
##### 2.2 Example Client
|
||||
The wolfSSL example client.c file can be found in ```<path_to_wolfssl>/wolfssl/examples/client```.
|
||||
|
||||
1. Add the following include to usrAppInit.c:
|
||||
@@ -117,7 +117,7 @@ section, and add a call to the client function:
|
||||
SSL cipher suite is TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
||||
Server response: I hear you fa shizzle!
|
||||
|
||||
#####2.3 Example Server
|
||||
##### 2.3 Example Server
|
||||
The example server requires more configuration than the client if using the
|
||||
VxWorks simulator.
|
||||
|
||||
@@ -164,7 +164,7 @@ Note: The wolfSSL example server and client cannot run at the same time on the V
|
||||
SSL cipher suite is TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
||||
Client message: hello wolfssl!
|
||||
|
||||
####3 Necessary Files if Using VxWorks Simulator
|
||||
#### 3 Necessary Files if Using VxWorks Simulator
|
||||
The following files are required to replicate this build:
|
||||
* vxsim\_linux\_1\_0\_2\_2 (directory)
|
||||
* compilers/gnu-4.8.1.5/include/c++/4.8
|
||||
|
@@ -8,5 +8,6 @@ include IDE/WIN-SGX/include.am
|
||||
include IDE/WORKBENCH/include.am
|
||||
include IDE/ROWLEY-CROSSWORKS-ARM/include.am
|
||||
include IDE/ARDUINO/include.am
|
||||
include IDE/INTIME-RTOS/include.am
|
||||
|
||||
EXTRA_DIST+= IDE/IAR-EWARM IDE/MDK-ARM IDE/MDK5-ARM IDE/MYSQL IDE/LPCXPRESSO
|
||||
EXTRA_DIST+= IDE/IAR-EWARM IDE/MDK-ARM IDE/MDK5-ARM IDE/MYSQL IDE/LPCXPRESSO IDE/HEXIWEAR
|
||||
|
13
Makefile.am
13
Makefile.am
@@ -54,7 +54,18 @@ CLEANFILES+= cert.der \
|
||||
pkcs7envelopedDataAES128CBC.der \
|
||||
pkcs7envelopedDataAES192CBC.der \
|
||||
pkcs7envelopedDataAES256CBC.der \
|
||||
pkcs7signedData.der
|
||||
pkcs7signedData_RSA_SHA.der \
|
||||
pkcs7signedData_RSA_SHA_noattr.der \
|
||||
pkcs7signedData_RSA_SHA224.der \
|
||||
pkcs7signedData_RSA_SHA256.der \
|
||||
pkcs7signedData_RSA_SHA384.der \
|
||||
pkcs7signedData_RSA_SHA512.der \
|
||||
pkcs7signedData_ECDSA_SHA.der \
|
||||
pkcs7signedData_ECDSA_SHA_noattr.der \
|
||||
pkcs7signedData_ECDSA_SHA224.der \
|
||||
pkcs7signedData_ECDSA_SHA256.der \
|
||||
pkcs7signedData_ECDSA_SHA384.der \
|
||||
pkcs7signedData_ECDSA_SHA512.der
|
||||
|
||||
exampledir = $(docdir)/example
|
||||
dist_example_DATA=
|
||||
|
118
README
118
README
@@ -3,7 +3,7 @@
|
||||
Note 1)
|
||||
wolfSSL as of 3.6.6 no longer enables SSLv3 by default. wolfSSL also no
|
||||
longer supports static key cipher suites with PSK, RSA, or ECDH. This means
|
||||
if you plan to use TLS cipher suites you must enable DH (DH is on by default),
|
||||
if you plan to use TLS cipher suites you must enable DH (DH is on by default),
|
||||
or enable ECC (ECC is on by default on 64bit systems), or you must enable static
|
||||
key cipher suites with
|
||||
WOLFSSL_STATIC_DH
|
||||
@@ -12,11 +12,11 @@ key cipher suites with
|
||||
WOLFSSL_STATIC_PSK
|
||||
|
||||
though static key cipher suites are deprecated and will be removed from future
|
||||
versions of TLS. They also lower your security by removing PFS. Since current
|
||||
versions of TLS. They also lower your security by removing PFS. Since current
|
||||
NTRU suites available do not use ephemeral keys, WOLFSSL_STATIC_RSA needs to be
|
||||
used in order to build with NTRU suites.
|
||||
|
||||
When compiling ssl.c wolfSSL will now issue a compiler error if no cipher suites
|
||||
When compiling ssl.c, wolfSSL will now issue a compiler error if no cipher suites
|
||||
are available. You can remove this error by defining WOLFSSL_ALLOW_NO_SUITES
|
||||
in the event that you desire that, i.e., you're not using TLS cipher suites.
|
||||
|
||||
@@ -34,6 +34,118 @@ before calling wolfSSL_new(); Though it's not recommended.
|
||||
|
||||
*** end Notes ***
|
||||
|
||||
********* wolfSSL (Formerly CyaSSL) Release 3.11.1 (5/11/2017)
|
||||
|
||||
Release 3.11.1 of wolfSSL is a TLS 1.3 BETA release, which includes:
|
||||
|
||||
- TLS 1.3 client and server support for TLS 1.3 with Draft 18 support
|
||||
|
||||
This is strictly a BETA release, and designed for testing and user feedback.
|
||||
Please send any comments, testing results, or feedback to wolfSSL at
|
||||
support@wolfssl.com.
|
||||
|
||||
See INSTALL file for build instructions.
|
||||
More info can be found on-line at http://wolfssl.com/wolfSSL/Docs.html
|
||||
|
||||
|
||||
********* wolfSSL (Formerly CyaSSL) Release 3.11.0 (5/04/2017)
|
||||
|
||||
Release 3.11.0 of wolfSSL has bug fixes and new features including:
|
||||
|
||||
- Code updates for warnings reported by Coverity scans
|
||||
- Testing and warning fixes for FreeBSD on PowerPC
|
||||
- Updates and refactoring done to ASN1 parsing functions
|
||||
- Change max PSK identity buffer to account for an identity length of 128 characters
|
||||
- Update Arduino script to handle recent files and additions
|
||||
- Added support for PKCS#7 Signed Data with ECDSA
|
||||
- Fix for interoperability with ChaCha20-Poly1305 suites using older draft versions
|
||||
- DTLS update to allow multiple handshake messages in one DTLS record. Thanks to Eric Samsel over at Welch Allyn for reporting this bug.
|
||||
- Intel QuickAssist asynchronous support (PR #715 - https://www.wolfssl.com/wolfSSL/Blog/Entries/2017/1/18_wolfSSL_Asynchronous_Intel_QuickAssist_Support.html)
|
||||
- Added support for HAproxy load balancer
|
||||
- Added option to allow SHA1 with TLS 1.2 for IIS compatibility (WOLFSSL_ALLOW_TLS_SHA1)
|
||||
- Added Curve25519 51-bit Implementation, increasing performance on systems that have 128 bit types
|
||||
- Fix to not send session ID on server side if session cache is off unless we're echoing
|
||||
session ID as part of session tickets
|
||||
- Fixes for ensuring all default ciphers are setup correctly (see PR #830)
|
||||
- Added NXP Hexiwear example in `IDE/HEXIWEAR`.
|
||||
- Added wolfSSL_write_dup() to create write only WOLFSSL object for concurrent access
|
||||
- Fixes for TLS elliptic curve selection on private key import.
|
||||
- Fixes for RNG with Intel rdrand and rdseed speedups.
|
||||
- Improved performance with Intel rdrand to use full 64-bit output
|
||||
- Added new --enable-intelrand option to indicate use of RDRAND preference for RNG source
|
||||
- Removed RNG ARC4 support
|
||||
- Added ECC helpers to get size and id from curve name.
|
||||
- Added ECC Cofactor DH (ECC-CDH) support
|
||||
- Added ECC private key only import / export functions.
|
||||
- Added PKCS8 create function
|
||||
- Improvements to TLS layer CTX handling for switching keys / certs.
|
||||
- Added check for duplicate certificate policy OID in certificates.
|
||||
- Normal math speed-up to not allocate on mp_int and defer until mp_grow
|
||||
- Reduce heap usage with fast math when not using ALT_ECC_SIZE
|
||||
- Fixes for building CRL with Windows
|
||||
- Added support for inline CRL lookup when HAVE_CRL_IO is defined
|
||||
- Added port for tenAsys INtime RTOS
|
||||
- Improvements to uTKernel port (WOLFSSL_uTKERNEL2)
|
||||
- Updated WPA Supplicant support
|
||||
- Added support for Nginx
|
||||
- Update stunnel port for version 5.40
|
||||
- Fixes for STM32 hardware crypto acceleration
|
||||
- Extended test code coverage in bundled test.c
|
||||
- Added a sanity check for minimum authentication tag size with AES-GCM. Thanks to Yueh-Hsun Lin and Peng Li at KNOX Security at Samsung Research America for suggesting this.
|
||||
- Added a sanity check that subject key identifier is marked as non-critical and a check that no policy OIDS appear more than once in the cert policies extension. Thanks to the report from Professor Zhenhua Duan, Professor Cong Tian, and Ph.D candidate Chu Chen from Institute of Computing Theory and Technology (ICTT) of Xidian University, China. Profs. Zhenhua Duan and Cong Tian are supervisors of Ph.D candidate Chu Chen.
|
||||
|
||||
|
||||
This release of wolfSSL fixes 5 low and 1 medium level security vulnerability.
|
||||
|
||||
3 Low level fixes reported by Yueh-Hsun Lin and Peng Li from KNOX Security, Samsung Research America.
|
||||
- Fix for out of bounds memory access in wc_DhParamsLoad() when GetLength() returns a zero. Before this fix there is a case where wolfSSL would read out of bounds memory in the function wc_DhParamsLoad.
|
||||
- Fix for DH key accepted by wc_DhAgree when the key was malformed.
|
||||
- Fix for a double free case when adding CA cert into X509_store.
|
||||
|
||||
Low level fix for memory management with static memory feature enabled. By default static memory is disabled. Thanks to GitHub user hajjihraf for reporting this.
|
||||
|
||||
Low level fix for out of bounds write in the function wolfSSL_X509_NAME_get_text_by_NID. This function is not used by TLS or crypto operations but could result in a buffer out of bounds write by one if called explicitly in an application. Discovered by Aleksandar Nikolic of Cisco Talos. http://talosintelligence.com/vulnerability-reports/
|
||||
|
||||
Medium level fix for check on certificate signature. There is a case in release versions 3.9.10, 3.10.0 and 3.10.2 where a corrupted signature on a peer certificate would not be properly flagged. Thanks to Wens Lo, James Tsai, Kenny Chang, and Oscar Yang at Castles Technology.
|
||||
|
||||
|
||||
See INSTALL file for build instructions.
|
||||
More info can be found on-line at http://wolfssl.com/wolfSSL/Docs.html
|
||||
|
||||
|
||||
********* wolfSSL (Formerly CyaSSL) Release 3.10.2 (2/10/2017)
|
||||
|
||||
Release 3.10.2 of wolfSSL has bug fixes and new features including:
|
||||
|
||||
- Poly1305 Windows macros fix. Thanks to GitHub user Jay Satiro
|
||||
- Compatibility layer expanded with multiple functions added
|
||||
- Improve fp_copy performance with ALT_ECC_SIZE
|
||||
- OCSP updates and improvements
|
||||
- Fixes for IAR EWARM 8 compiler warnings
|
||||
- Reduce stack usage with ECC_CACHE_CURVE disabled
|
||||
- Added ECC export raw for public and private key
|
||||
- Fix for NO_ASN_TIME build
|
||||
- Supported curves extensions now populated by default
|
||||
- Add DTLS build without big integer math
|
||||
- Fix for static memory feature with wc_ecc_verify_hash_ex and not SHAMIR
|
||||
- Added PSK interoperability testing to script bundled with wolfSSL
|
||||
- Fix for Python wrapper random number generation. Compiler optimizations with Python could place the random number in same buffer location each time. Thanks to GitHub user Erik Bray (embray)
|
||||
- Fix for tests on unaligned memory with static memory feature
|
||||
- Add macro WOLFSSL_NO_OCSP_OPTIONAL_CERTS to skip optional OCSP certificates
|
||||
- Sanity checks on NULL arguments added to wolfSSL_set_fd and wolfSSL_DTLS_SetCookieSecret
|
||||
- mp_jacobi stack use reduced, thanks to Szabi Tolnai for providing a solution to reduce stack usage
|
||||
|
||||
|
||||
This release of wolfSSL fixes 2 low and 1 medium level security vulnerability.
|
||||
|
||||
Low level fix of buffer overflow for when loading in a malformed temporary DH file. Thanks to Yueh-Hsun Lin and Peng Li from KNOX Security, Samsung Research America for the report.
|
||||
|
||||
Medium level fix for processing of OCSP response. If using OCSP without hard faults enforced and no alternate revocation checks like OCSP stapling then it is recommended to update.
|
||||
|
||||
Low level fix for potential cache attack on RSA operations. If using wolfSSL RSA on a server that other users can have access to monitor the cache, then it is recommended to update wolfSSL. Thanks to Andreas Zankl, Johann Heyszl and Georg Sigl at Fraunhofer AISEC for the initial report.
|
||||
|
||||
See INSTALL file for build instructions.
|
||||
More info can be found on-line at http://wolfssl.com/wolfSSL/Docs.html
|
||||
|
||||
********* wolfSSL (Formerly CyaSSL) Release 3.10.0 (12/21/2016)
|
||||
|
||||
|
120
README.md
120
README.md
@@ -4,7 +4,7 @@
|
||||
```
|
||||
wolfSSL as of 3.6.6 no longer enables SSLv3 by default. wolfSSL also no
|
||||
longer supports static key cipher suites with PSK, RSA, or ECDH. This means
|
||||
if you plan to use TLS cipher suites you must enable DH (DH is on by default),
|
||||
if you plan to use TLS cipher suites you must enable DH (DH is on by default),
|
||||
or enable ECC (ECC is on by default on 64bit systems), or you must enable static
|
||||
key cipher suites with
|
||||
WOLFSSL_STATIC_DH
|
||||
@@ -13,12 +13,12 @@ key cipher suites with
|
||||
WOLFSSL_STATIC_PSK
|
||||
|
||||
though static key cipher suites are deprecated and will be removed from future
|
||||
versions of TLS. They also lower your security by removing PFS. Since current
|
||||
versions of TLS. They also lower your security by removing PFS. Since current
|
||||
NTRU suites available do not use ephemeral keys, WOLFSSL_STATIC_RSA needs to be
|
||||
used in order to build with NTRU suites.
|
||||
|
||||
|
||||
When compiling ssl.c wolfSSL will now issue a compiler error if no cipher suites
|
||||
When compiling ssl.c, wolfSSL will now issue a compiler error if no cipher suites
|
||||
are available. You can remove this error by defining WOLFSSL_ALLOW_NO_SUITES
|
||||
in the event that you desire that, i.e., you're not using TLS cipher suites.
|
||||
```
|
||||
@@ -38,6 +38,120 @@ wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0);
|
||||
before calling wolfSSL_new(); Though it's not recommended.
|
||||
```
|
||||
|
||||
# wolfSSL (Formerly CyaSSL) Release 3.11.1 (5/11/2017)
|
||||
|
||||
## Release 3.11.1 of wolfSSL is a TLS 1.3 BETA release, which includes:
|
||||
|
||||
- TLS 1.3 client and server support for TLS 1.3 with Draft 18 support
|
||||
|
||||
This is strictly a BETA release, and designed for testing and user feedback.
|
||||
Please send any comments, testing results, or feedback to wolfSSL at
|
||||
support@wolfssl.com.
|
||||
|
||||
See INSTALL file for build instructions.
|
||||
More info can be found on-line at http://wolfssl.com/wolfSSL/Docs.html
|
||||
|
||||
|
||||
# wolfSSL (Formerly CyaSSL) Release 3.11.0 (5/04/2017)
|
||||
|
||||
## Release 3.11.0 of wolfSSL has bug fixes and new features including:
|
||||
|
||||
- Code updates for warnings reported by Coverity scans
|
||||
- Testing and warning fixes for FreeBSD on PowerPC
|
||||
- Updates and refactoring done to ASN1 parsing functions
|
||||
- Change max PSK identity buffer to account for an identity length of 128 characters
|
||||
- Update Arduino script to handle recent files and additions
|
||||
- Added support for PKCS#7 Signed Data with ECDSA
|
||||
- Fix for interoperability with ChaCha20-Poly1305 suites using older draft versions
|
||||
- DTLS update to allow multiple handshake messages in one DTLS record. Thanks to Eric Samsel over at Welch Allyn for reporting this bug.
|
||||
- Intel QuickAssist asynchronous support (PR #715 - https://www.wolfssl.com/wolfSSL/Blog/Entries/2017/1/18_wolfSSL_Asynchronous_Intel_QuickAssist_Support.html)
|
||||
- Added support for HAproxy load balancer
|
||||
- Added option to allow SHA1 with TLS 1.2 for IIS compatibility (WOLFSSL_ALLOW_TLS_SHA1)
|
||||
- Added Curve25519 51-bit Implementation, increasing performance on systems that have 128 bit types
|
||||
- Fix to not send session ID on server side if session cache is off unless we're echoing
|
||||
session ID as part of session tickets
|
||||
- Fixes for ensuring all default ciphers are setup correctly (see PR #830)
|
||||
- Added NXP Hexiwear example in `IDE/HEXIWEAR`.
|
||||
- Added wolfSSL_write_dup() to create write only WOLFSSL object for concurrent access
|
||||
- Fixes for TLS elliptic curve selection on private key import.
|
||||
- Fixes for RNG with Intel rdrand and rdseed speedups.
|
||||
- Improved performance with Intel rdrand to use full 64-bit output
|
||||
- Added new --enable-intelrand option to indicate use of RDRAND preference for RNG source
|
||||
- Removed RNG ARC4 support
|
||||
- Added ECC helpers to get size and id from curve name.
|
||||
- Added ECC Cofactor DH (ECC-CDH) support
|
||||
- Added ECC private key only import / export functions.
|
||||
- Added PKCS8 create function
|
||||
- Improvements to TLS layer CTX handling for switching keys / certs.
|
||||
- Added check for duplicate certificate policy OID in certificates.
|
||||
- Normal math speed-up to not allocate on mp_int and defer until mp_grow
|
||||
- Reduce heap usage with fast math when not using ALT_ECC_SIZE
|
||||
- Fixes for building CRL with Windows
|
||||
- Added support for inline CRL lookup when HAVE_CRL_IO is defined
|
||||
- Added port for tenAsys INtime RTOS
|
||||
- Improvements to uTKernel port (WOLFSSL_uTKERNEL2)
|
||||
- Updated WPA Supplicant support
|
||||
- Added support for Nginx
|
||||
- Update stunnel port for version 5.40
|
||||
- Fixes for STM32 hardware crypto acceleration
|
||||
- Extended test code coverage in bundled test.c
|
||||
- Added a sanity check for minimum authentication tag size with AES-GCM. Thanks to Yueh-Hsun Lin and Peng Li at KNOX Security at Samsung Research America for suggesting this.
|
||||
- Added a sanity check that subject key identifier is marked as non-critical and a check that no policy OIDS appear more than once in the cert policies extension. Thanks to the report from Professor Zhenhua Duan, Professor Cong Tian, and Ph.D candidate Chu Chen from Institute of Computing Theory and Technology (ICTT) of Xidian University, China. Profs. Zhenhua Duan and Cong Tian are supervisors of Ph.D candidate Chu Chen.
|
||||
|
||||
This release of wolfSSL fixes 5 low and 1 medium level security vulnerability.
|
||||
|
||||
3 Low level fixes reported by Yueh-Hsun Lin and Peng Li from KNOX Security, Samsung Research America.
|
||||
- Fix for out of bounds memory access in wc_DhParamsLoad() when GetLength() returns a zero. Before this fix there is a case where wolfSSL would read out of bounds memory in the function wc_DhParamsLoad.
|
||||
- Fix for DH key accepted by wc_DhAgree when the key was malformed.
|
||||
- Fix for a double free case when adding CA cert into X509_store.
|
||||
|
||||
Low level fix for memory management with static memory feature enabled. By default static memory is disabled. Thanks to GitHub user hajjihraf for reporting this.
|
||||
|
||||
|
||||
Low level fix for out of bounds write in the function wolfSSL_X509_NAME_get_text_by_NID. This function is not used by TLS or crypto operations but could result in a buffer out of bounds write by one if called explicitly in an application. Discovered by Aleksandar Nikolic of Cisco Talos. http://talosintelligence.com/vulnerability-reports/
|
||||
|
||||
Medium level fix for check on certificate signature. There is a case in release versions 3.9.10, 3.10.0 and 3.10.2 where a corrupted signature on a peer certificate would not be properly flagged. Thanks to Wens Lo, James Tsai, Kenny Chang, and Oscar Yang at Castles Technology.
|
||||
|
||||
|
||||
See INSTALL file for build instructions.
|
||||
More info can be found on-line at http://wolfssl.com/wolfSSL/Docs.html
|
||||
|
||||
|
||||
# wolfSSL (Formerly CyaSSL) Release 3.10.2 (2/10/2017)
|
||||
|
||||
## Release 3.10.2 of wolfSSL has bug fixes and new features including:
|
||||
|
||||
- Poly1305 Windows macros fix. Thanks to GitHub user Jay Satiro
|
||||
- Compatibility layer expanded with multiple functions added
|
||||
- Improve fp_copy performance with ALT_ECC_SIZE
|
||||
- OCSP updates and improvements
|
||||
- Fixes for IAR EWARM 8 compiler warnings
|
||||
- Reduce stack usage with ECC_CACHE_CURVE disabled
|
||||
- Added ECC export raw for public and private key
|
||||
- Fix for NO_ASN_TIME build
|
||||
- Supported curves extensions now populated by default
|
||||
- Add DTLS build without big integer math
|
||||
- Fix for static memory feature with wc_ecc_verify_hash_ex and not SHAMIR
|
||||
- Added PSK interoperability testing to script bundled with wolfSSL
|
||||
- Fix for Python wrapper random number generation. Compiler optimizations with Python could place the random number in same buffer location each time. Thanks to GitHub user Erik Bray (embray)
|
||||
- Fix for tests on unaligned memory with static memory feature
|
||||
- Add macro WOLFSSL_NO_OCSP_OPTIONAL_CERTS to skip optional OCSP certificates
|
||||
- Sanity checks on NULL arguments added to wolfSSL_set_fd and wolfSSL_DTLS_SetCookieSecret
|
||||
- mp_jacobi stack use reduced, thanks to Szabi Tolnai for providing a solution to reduce stack usage
|
||||
|
||||
|
||||
This release of wolfSSL fixes 2 low and 1 medium level security vulnerability.
|
||||
|
||||
Low level fix of buffer overflow for when loading in a malformed temporary DH file. Thanks to Yueh-Hsun Lin and Peng Li from KNOX Security, Samsung Research America for the report.
|
||||
|
||||
Medium level fix for processing of OCSP response. If using OCSP without hard faults enforced and no alternate revocation checks like OCSP stapling then it is recommended to update.
|
||||
|
||||
Low level fix for potential cache attack on RSA operations. If using wolfSSL RSA on a server that other users can have access to monitor the cache, then it is recommended to update wolfSSL. Thanks to Andreas Zankl, Johann Heyszl and Georg Sigl at Fraunhofer AISEC for the initial report.
|
||||
|
||||
See INSTALL file for build instructions.
|
||||
More info can be found on-line at http://wolfssl.com/wolfSSL/Docs.html
|
||||
|
||||
|
||||
# wolfSSL (Formerly CyaSSL) Release 3.10.0 (12/21/2016)
|
||||
|
||||
## Release 3.10.0 of wolfSSL has bug fixes and new features including:
|
||||
|
14
autogen.sh
14
autogen.sh
@@ -22,6 +22,20 @@ if test -e .git; then
|
||||
# touch async crypt files
|
||||
touch ./wolfcrypt/src/async.c
|
||||
touch ./wolfssl/wolfcrypt/async.h
|
||||
|
||||
# touch async port files
|
||||
touch ./wolfcrypt/src/port/intel/quickassist.c
|
||||
touch ./wolfcrypt/src/port/intel/quickassist_mem.c
|
||||
touch ./wolfcrypt/src/port/cavium/cavium_nitrox.c
|
||||
if [ ! -d ./wolfssl/wolfcrypt/port/intel ]; then
|
||||
mkdir ./wolfssl/wolfcrypt/port/intel
|
||||
fi
|
||||
touch ./wolfssl/wolfcrypt/port/intel/quickassist.h
|
||||
touch ./wolfssl/wolfcrypt/port/intel/quickassist_mem.h
|
||||
if [ ! -d ./wolfssl/wolfcrypt/port/cavium ]; then
|
||||
mkdir ./wolfssl/wolfcrypt/port/cavium
|
||||
fi
|
||||
touch ./wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h
|
||||
else
|
||||
WARNINGS="all"
|
||||
fi
|
||||
|
80
certs/crl/crl2.pem
Normal file
80
certs/crl/crl2.pem
Normal file
@@ -0,0 +1,80 @@
|
||||
Certificate Revocation List (CRL):
|
||||
Version 2 (0x1)
|
||||
Signature Algorithm: sha256WithRSAEncryption
|
||||
Issuer: /C=US/ST=Montana/L=Bozeman/O=Sawtooth/OU=Consulting/CN=www.wolfssl.com/emailAddress=info@wolfssl.com
|
||||
Last Update: Aug 11 20:07:38 2016 GMT
|
||||
Next Update: May 8 20:07:38 2019 GMT
|
||||
CRL extensions:
|
||||
X509v3 CRL Number:
|
||||
1
|
||||
Revoked Certificates:
|
||||
Serial Number: 02
|
||||
Revocation Date: Aug 11 20:07:38 2016 GMT
|
||||
Signature Algorithm: sha256WithRSAEncryption
|
||||
35:c6:7f:57:9a:e5:86:5a:15:1a:e2:e5:2b:9f:54:79:2a:58:
|
||||
51:a2:12:0c:4e:53:58:eb:99:e3:c2:ee:2b:d7:23:e4:3c:4d:
|
||||
0a:ab:ae:71:9b:ce:b1:c1:75:a1:b6:e5:32:5f:10:b0:72:28:
|
||||
2e:74:b1:99:dd:47:53:20:f6:9a:83:5c:bd:20:b0:aa:df:32:
|
||||
f6:95:54:98:9e:59:96:55:7b:0a:74:be:94:66:44:b7:32:82:
|
||||
f0:eb:16:f8:30:86:16:9f:73:43:98:82:b5:5e:ad:58:c0:c8:
|
||||
79:da:ad:b1:b4:d7:fb:34:c1:cc:3a:67:af:a4:56:5a:70:5c:
|
||||
2d:1f:73:16:78:92:01:06:e3:2c:fb:f1:ba:d5:8f:f9:be:dd:
|
||||
e1:4a:ce:de:ca:e6:2d:96:09:24:06:40:9e:10:15:2e:f2:cd:
|
||||
85:d6:84:88:db:9c:4a:7b:75:7a:06:0e:40:02:20:60:7e:91:
|
||||
f7:92:53:1e:34:7a:ea:ee:df:e7:cd:a8:9e:a6:61:b4:56:50:
|
||||
4d:dc:b1:78:0d:86:cf:45:c3:a6:0a:b9:88:2c:56:a7:b1:d3:
|
||||
d3:0d:44:aa:93:a4:05:4d:ce:9f:01:b0:c6:1e:e4:ea:6b:92:
|
||||
6f:93:dd:98:cf:fb:1d:06:72:ac:d4:99:e7:f2:b4:11:57:bd:
|
||||
9d:63:e5:dc
|
||||
-----BEGIN X509 CRL-----
|
||||
MIICBDCB7QIBATANBgkqhkiG9w0BAQsFADCBlDELMAkGA1UEBhMCVVMxEDAOBgNV
|
||||
BAgMB01vbnRhbmExEDAOBgNVBAcMB0JvemVtYW4xETAPBgNVBAoMCFNhd3Rvb3Ro
|
||||
MRMwEQYDVQQLDApDb25zdWx0aW5nMRgwFgYDVQQDDA93d3cud29sZnNzbC5jb20x
|
||||
HzAdBgkqhkiG9w0BCQEWEGluZm9Ad29sZnNzbC5jb20XDTE2MDgxMTIwMDczOFoX
|
||||
DTE5MDUwODIwMDczOFowFDASAgECFw0xNjA4MTEyMDA3MzhaoA4wDDAKBgNVHRQE
|
||||
AwIBATANBgkqhkiG9w0BAQsFAAOCAQEANcZ/V5rlhloVGuLlK59UeSpYUaISDE5T
|
||||
WOuZ48LuK9cj5DxNCquucZvOscF1obblMl8QsHIoLnSxmd1HUyD2moNcvSCwqt8y
|
||||
9pVUmJ5ZllV7CnS+lGZEtzKC8OsW+DCGFp9zQ5iCtV6tWMDIedqtsbTX+zTBzDpn
|
||||
r6RWWnBcLR9zFniSAQbjLPvxutWP+b7d4UrO3srmLZYJJAZAnhAVLvLNhdaEiNuc
|
||||
Snt1egYOQAIgYH6R95JTHjR66u7f582onqZhtFZQTdyxeA2Gz0XDpgq5iCxWp7HT
|
||||
0w1EqpOkBU3OnwGwxh7k6muSb5PdmM/7HQZyrNSZ5/K0EVe9nWPl3A==
|
||||
-----END X509 CRL-----
|
||||
Certificate Revocation List (CRL):
|
||||
Version 2 (0x1)
|
||||
Signature Algorithm: sha256WithRSAEncryption
|
||||
Issuer: /C=US/ST=Montana/L=Bozeman/O=wolfSSL_2048/OU=Programming-2048/CN=www.wolfssl.com/emailAddress=info@wolfssl.com
|
||||
Last Update: Aug 11 20:07:38 2016 GMT
|
||||
Next Update: May 8 20:07:38 2019 GMT
|
||||
CRL extensions:
|
||||
X509v3 CRL Number:
|
||||
3
|
||||
No Revoked Certificates.
|
||||
Signature Algorithm: sha256WithRSAEncryption
|
||||
14:85:d5:c8:db:62:74:48:94:5e:dc:52:0f:5e:43:8b:29:83:
|
||||
32:e0:7a:4c:5c:76:e3:7e:c1:87:74:40:b2:6f:f8:33:4c:2c:
|
||||
32:08:f0:5f:d9:85:b3:20:05:34:5d:15:4d:ba:45:bc:2d:9c:
|
||||
ae:40:d0:d8:9a:b3:a1:4f:0b:94:ce:c4:23:c6:bf:a2:f8:a6:
|
||||
02:4c:6d:ad:5a:59:b3:83:55:dd:37:91:f6:75:d4:6f:83:5f:
|
||||
1c:29:94:cd:01:09:dc:38:d8:6c:c0:9f:1e:76:9d:f9:8f:70:
|
||||
0d:48:e5:99:82:90:3a:36:f1:33:17:69:73:8a:ee:a7:22:4c:
|
||||
58:93:a1:dc:59:b9:44:8f:88:99:0b:c4:d3:74:aa:02:9a:84:
|
||||
36:48:d8:a0:05:73:bc:14:32:1e:76:23:85:c5:94:56:b2:2c:
|
||||
61:3b:07:d7:bd:0c:27:f7:d7:23:40:bd:0c:6c:c7:e0:f7:28:
|
||||
74:67:98:20:93:72:16:b6:6e:67:3f:9e:c9:34:c5:64:09:bf:
|
||||
b1:ab:87:0c:80:b6:1f:89:d8:0e:67:c2:c7:19:df:ee:9f:b2:
|
||||
e6:fb:64:3d:82:7a:47:e2:8d:a3:93:1d:29:f6:94:db:83:2f:
|
||||
b6:0a:a0:da:77:e3:56:ec:d7:d2:22:3c:88:4d:4a:87:de:b5:
|
||||
1c:eb:7b:08
|
||||
-----BEGIN X509 CRL-----
|
||||
MIIB+DCB4QIBATANBgkqhkiG9w0BAQsFADCBnjELMAkGA1UEBhMCVVMxEDAOBgNV
|
||||
BAgMB01vbnRhbmExEDAOBgNVBAcMB0JvemVtYW4xFTATBgNVBAoMDHdvbGZTU0xf
|
||||
MjA0ODEZMBcGA1UECwwQUHJvZ3JhbW1pbmctMjA0ODEYMBYGA1UEAwwPd3d3Lndv
|
||||
bGZzc2wuY29tMR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29tFw0xNjA4
|
||||
MTEyMDA3MzhaFw0xOTA1MDgyMDA3MzhaoA4wDDAKBgNVHRQEAwIBAzANBgkqhkiG
|
||||
9w0BAQsFAAOCAQEAFIXVyNtidEiUXtxSD15DiymDMuB6TFx2437Bh3RAsm/4M0ws
|
||||
MgjwX9mFsyAFNF0VTbpFvC2crkDQ2JqzoU8LlM7EI8a/ovimAkxtrVpZs4NV3TeR
|
||||
9nXUb4NfHCmUzQEJ3DjYbMCfHnad+Y9wDUjlmYKQOjbxMxdpc4rupyJMWJOh3Fm5
|
||||
RI+ImQvE03SqApqENkjYoAVzvBQyHnYjhcWUVrIsYTsH170MJ/fXI0C9DGzH4Pco
|
||||
dGeYIJNyFrZuZz+eyTTFZAm/sauHDIC2H4nYDmfCxxnf7p+y5vtkPYJ6R+KNo5Md
|
||||
KfaU24Mvtgqg2nfjVuzX0iI8iE1Kh961HOt7CA==
|
||||
-----END X509 CRL-----
|
@@ -6,7 +6,8 @@ EXTRA_DIST += \
|
||||
certs/crl/crl.pem \
|
||||
certs/crl/cliCrl.pem \
|
||||
certs/crl/eccSrvCRL.pem \
|
||||
certs/crl/eccCliCRL.pem
|
||||
certs/crl/eccCliCRL.pem \
|
||||
certs/crl/crl2.pem
|
||||
|
||||
EXTRA_DIST += \
|
||||
certs/crl/crl.revoked
|
||||
|
9
certs/dsaparams.pem
Normal file
9
certs/dsaparams.pem
Normal file
@@ -0,0 +1,9 @@
|
||||
-----BEGIN DSA PARAMETERS-----
|
||||
MIIBHwKBgQDN3iVogFMN5XfW0pA5P5CiPzOUbuhPK2OrMKsVuhHqil2NzLjUodXB
|
||||
R51ac2piSdEGB2f2L6M5vU4NtNMiI4TskyZaSe58iUhmTejo2FD7pXGfIhjl5gtG
|
||||
h2buUo9GT7UDzu3jvuW1gdJZ6cCtTdBNJve6UOjJj/4kGT0up1I8bQIVAPtH++yB
|
||||
IMgc6Uq6BG8Zm5TugmfTAoGBAJuVu4XFWEoynKpEhdZo3D4U9M5to0k46tZhSJJa
|
||||
QJVJOKrhOSloWEeKSwHhLo5sY29AylA/jAuZ5HJCuLHCJkjxnIPGNy5arhEJ2fOt
|
||||
H2+trVDjeDLm3o6qv9EAn7MCEhmiFewUGFwOJs75rsx7tdEm/IX+FJO2nX124zWX
|
||||
Ht7E
|
||||
-----END DSA PARAMETERS-----
|
4
certs/ecc-privkey.pem
Normal file
4
certs/ecc-privkey.pem
Normal file
@@ -0,0 +1,4 @@
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MDECAQEEIEW2aQJznGyFoThbcujox6zEA41TNQT6bCjcNI3hqAmMoAoGCCqGSM49
|
||||
AwEH
|
||||
-----END EC PRIVATE KEY-----
|
14
certs/external/ca-verisign-g5.pem
vendored
14
certs/external/ca-verisign-g5.pem
vendored
@@ -26,3 +26,17 @@ WE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiCKm0oHw0LxOXnGiYZ
|
||||
4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vEZV8N
|
||||
hnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICPDCCAaUCEDyRMcsf9tAbDpq40ES/Er4wDQYJKoZIhvcNAQEFBQAwXzELMAkG
|
||||
A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz
|
||||
cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2
|
||||
MDEyOTAwMDAwMFoXDTI4MDgwMjIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV
|
||||
BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt
|
||||
YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN
|
||||
ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE
|
||||
BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is
|
||||
I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G
|
||||
CSqGSIb3DQEBBQUAA4GBABByUqkFFBkyCEHwxWsKzH4PIRnN5GfcX6kb5sroc50i
|
||||
2JhucwNhkcV8sEVAbkSdjbCxlnRhLQ2pRdKkkirWmnWXbj9T/UWZYB2oK0z5XqcJ
|
||||
2HUw19JlYD1n1khVdWk/kfVIC0dpImmClr7JyDiGSnoscxlIaU5rfGW/D/xwzoiQ
|
||||
-----END CERTIFICATE-----
|
||||
|
@@ -9,6 +9,7 @@ EXTRA_DIST += \
|
||||
certs/client-keyEnc.pem \
|
||||
certs/client-key.pem \
|
||||
certs/ecc-key.pem \
|
||||
certs/ecc-privkey.pem \
|
||||
certs/ecc-keyPkcs8Enc.pem \
|
||||
certs/ecc-key-comp.pem \
|
||||
certs/ecc-keyPkcs8.pem \
|
||||
@@ -24,6 +25,7 @@ EXTRA_DIST += \
|
||||
certs/server-ecc-rsa.pem \
|
||||
certs/server-keyEnc.pem \
|
||||
certs/server-key.pem \
|
||||
certs/server-keyPkcs8.der \
|
||||
certs/server-keyPkcs8Enc12.pem \
|
||||
certs/server-keyPkcs8Enc2.pem \
|
||||
certs/server-keyPkcs8Enc.pem \
|
||||
@@ -31,7 +33,8 @@ EXTRA_DIST += \
|
||||
certs/server-revoked-cert.pem \
|
||||
certs/server-revoked-key.pem \
|
||||
certs/wolfssl-website-ca.pem \
|
||||
certs/test-servercert.p12
|
||||
certs/test-servercert.p12 \
|
||||
certs/dsaparams.pem
|
||||
EXTRA_DIST += \
|
||||
certs/ca-key.der \
|
||||
certs/ca-cert.der \
|
||||
@@ -51,10 +54,12 @@ EXTRA_DIST += \
|
||||
certs/server-ecc-comp.der \
|
||||
certs/server-ecc.der \
|
||||
certs/server-ecc-rsa.der \
|
||||
certs/server-cert-chain.der
|
||||
certs/server-cert-chain.der
|
||||
|
||||
dist_doc_DATA+= certs/taoCert.txt
|
||||
|
||||
EXTRA_DIST+= certs/ntru-key.raw
|
||||
|
||||
include certs/test/include.am
|
||||
include certs/test-pathlen/include.am
|
||||
include certs/test/include.am
|
||||
|
@@ -16,6 +16,7 @@
|
||||
# 1024/client-cert.pem
|
||||
# server-ecc-comp.pem
|
||||
# client-ca.pem
|
||||
# test/digsigku.pem
|
||||
# updates the following crls:
|
||||
# crl/cliCrl.pem
|
||||
# crl/crl.pem
|
||||
@@ -128,6 +129,23 @@ function run_renewcerts(){
|
||||
cat ca_tmp.pem >> server-revoked-cert.pem
|
||||
rm ca_tmp.pem
|
||||
###########################################################
|
||||
########## update and sign server-duplicate-policy.pem ####
|
||||
###########################################################
|
||||
echo "Updating server-duplicate-policy.pem"
|
||||
echo ""
|
||||
#pipe the following arguments to openssl req...
|
||||
echo -e "US\nMontana\nBozeman\nwolfSSL\ntesting duplicate policy\nwww.wolfssl.com\ninfo@wolfssl.com\n.\n.\n" | openssl req -new -key server-key.pem -nodes > ./test/server-duplicate-policy-req.pem
|
||||
|
||||
openssl x509 -req -in ./test/server-duplicate-policy-req.pem -extfile wolfssl.cnf -extensions policy_test -days 1000 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 02 > ./test/server-duplicate-policy.pem
|
||||
|
||||
rm ./test/server-duplicate-policy-req.pem
|
||||
|
||||
openssl x509 -in ca-cert.pem -text > ca_tmp.pem
|
||||
openssl x509 -in ./test/server-duplicate-policy.pem -text > srv_tmp.pem
|
||||
mv srv_tmp.pem ./test/server-duplicate-policy.pem
|
||||
cat ca_tmp.pem >> ./test/server-duplicate-policy.pem
|
||||
rm ca_tmp.pem
|
||||
###########################################################
|
||||
#### update and sign (1024-bit) server-cert.pem ###########
|
||||
###########################################################
|
||||
echo "Updating 1024-bit server-cert.pem"
|
||||
@@ -208,6 +226,22 @@ function run_renewcerts(){
|
||||
echo ""
|
||||
cat client-cert.pem client-ecc-cert.pem > client-ca.pem
|
||||
|
||||
############################################################
|
||||
###### update the self-signed test/digsigku.pem ##########
|
||||
############################################################
|
||||
echo "Updating test/digsigku.pem"
|
||||
echo ""
|
||||
#pipe the following arguments to openssl req...
|
||||
echo -e "US\nWashington\nSeattle\nFoofarah\nArglebargle\nfoobarbaz\ninfo@worlss.com\n.\n.\n" | openssl req -new -key ecc-key.pem -nodes -sha1 -out digsigku.csr
|
||||
|
||||
|
||||
openssl x509 -req -in digsigku.csr -days 1000 -extfile wolfssl.cnf -extensions digsigku -signkey ecc-key.pem -sha1 -set_serial 16393466893990650224 -out digsigku.pem
|
||||
rm digsigku.csr
|
||||
|
||||
openssl x509 -in digsigku.pem -text > tmp.pem
|
||||
mv tmp.pem digsigku.pem
|
||||
mv digsigku.pem test/digsigku.pem
|
||||
|
||||
############################################################
|
||||
########## make .der files from .pem files #################
|
||||
############################################################
|
||||
|
@@ -148,6 +148,28 @@ subjectKeyIdentifier=hash
|
||||
authorityKeyIdentifier=keyid,issuer
|
||||
proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo
|
||||
|
||||
# Test of rejecting duplicate policy extension OIDs
|
||||
[ policy_test ]
|
||||
subjectKeyIdentifier=hash
|
||||
authorityKeyIdentifier=keyid:always,issuer:always
|
||||
basicConstraints=CA:FALSE
|
||||
certificatePolicies=1.2.3.4,@policy_add
|
||||
|
||||
[ policy_add ]
|
||||
policyIdentifier=1.2.3.4
|
||||
CPS.1="www.wolfssl.com"
|
||||
userNotice.1=@policy_usr
|
||||
|
||||
[ policy_usr ]
|
||||
explicitText="Test of duplicate OIDs with different qualifiers"
|
||||
|
||||
# create certificate without the digitalSignature bit set and uses sha1 sig
|
||||
[ digsigku ]
|
||||
subjectKeyIdentifier=hash
|
||||
authorityKeyIdentifier=keyid:always,issuer:always
|
||||
basicConstraints=critical, CA:TRUE
|
||||
keyUsage=critical, nonRepudiation, keyEncipherment
|
||||
|
||||
#tsa default
|
||||
[ tsa ]
|
||||
default_tsa = tsa_config1
|
||||
|
BIN
certs/server-keyPkcs8.der
Normal file
BIN
certs/server-keyPkcs8.der
Normal file
Binary file not shown.
18
certs/test/cert-ext-ia.cfg
Normal file
18
certs/test/cert-ext-ia.cfg
Normal file
@@ -0,0 +1,18 @@
|
||||
[ req ]
|
||||
distinguished_name = req_distinguished_name
|
||||
prompt = no
|
||||
x509_extensions = v3_ca
|
||||
|
||||
[ req_distinguished_name ]
|
||||
C = AU
|
||||
ST = Queensland
|
||||
L = Brisbane
|
||||
O = wolfSSL Inc
|
||||
OU = Engineering
|
||||
CN = www.wolfssl.com
|
||||
emailAddress = support@www.wolfsssl.com
|
||||
|
||||
[ v3_ca ]
|
||||
inhibitAnyPolicy = critical,1
|
||||
nsComment = "Testing inhibit any"
|
||||
|
BIN
certs/test/cert-ext-ia.der
Normal file
BIN
certs/test/cert-ext-ia.der
Normal file
Binary file not shown.
18
certs/test/cert-ext-nc.cfg
Normal file
18
certs/test/cert-ext-nc.cfg
Normal file
@@ -0,0 +1,18 @@
|
||||
[ req ]
|
||||
distinguished_name = req_distinguished_name
|
||||
prompt = no
|
||||
x509_extensions = v3_ca
|
||||
|
||||
[ req_distinguished_name ]
|
||||
C = AU
|
||||
ST = Queensland
|
||||
L = Brisbane
|
||||
O = wolfSSL Inc
|
||||
OU = Engineering
|
||||
CN = www.wolfssl.com
|
||||
emailAddress = support@www.wolfsssl.com
|
||||
|
||||
[ v3_ca ]
|
||||
nameConstraints = critical,permitted;email:.wolfssl.com
|
||||
nsComment = "Testing name constraints"
|
||||
|
BIN
certs/test/cert-ext-nc.der
Normal file
BIN
certs/test/cert-ext-nc.der
Normal file
Binary file not shown.
BIN
certs/test/cert-ext-ns.der
Normal file
BIN
certs/test/cert-ext-ns.der
Normal file
Binary file not shown.
@@ -1,17 +1,16 @@
|
||||
Certificate:
|
||||
Data:
|
||||
Version: 3 (0x2)
|
||||
Serial Number:
|
||||
e3:81:4b:48:a5:70:61:70
|
||||
Signature Algorithm: ecdsa-with-SHA1
|
||||
Serial Number: 16393466893990650224 (0xe3814b48a5706170)
|
||||
Signature Algorithm: ecdsa-with-SHA1
|
||||
Issuer: C=US, ST=Washington, L=Seattle, O=Foofarah, OU=Arglebargle, CN=foobarbaz/emailAddress=info@worlss.com
|
||||
Validity
|
||||
Not Before: Sep 10 00:45:36 2014 GMT
|
||||
Not After : Jun 6 00:45:36 2017 GMT
|
||||
Not Before: May 3 00:07:20 2017 GMT
|
||||
Not After : Jan 28 00:07:20 2020 GMT
|
||||
Subject: C=US, ST=Washington, L=Seattle, O=Foofarah, OU=Arglebargle, CN=foobarbaz/emailAddress=info@worlss.com
|
||||
Subject Public Key Info:
|
||||
Public Key Algorithm: id-ecPublicKey
|
||||
EC Public Key:
|
||||
Public-Key: (256 bit)
|
||||
pub:
|
||||
04:bb:33:ac:4c:27:50:4a:c6:4a:a5:04:c3:3c:de:
|
||||
9f:36:db:72:2d:ce:94:ea:2b:fa:cb:20:09:39:2c:
|
||||
@@ -19,34 +18,40 @@ Certificate:
|
||||
21:7f:f0:cf:18:da:91:11:02:34:86:e8:20:58:33:
|
||||
0b:80:34:89:d8
|
||||
ASN1 OID: prime256v1
|
||||
NIST CURVE: P-256
|
||||
X509v3 extensions:
|
||||
X509v3 Subject Key Identifier:
|
||||
5D:5D:26:EF:AC:7E:36:F9:9B:76:15:2B:4A:25:02:23:EF:B2:89:30
|
||||
X509v3 Authority Key Identifier:
|
||||
keyid:5D:5D:26:EF:AC:7E:36:F9:9B:76:15:2B:4A:25:02:23:EF:B2:89:30
|
||||
DirName:/C=US/ST=Washington/L=Seattle/O=Foofarah/OU=Arglebargle/CN=foobarbaz/emailAddress=info@worlss.com
|
||||
serial:E3:81:4B:48:A5:70:61:70
|
||||
|
||||
X509v3 Basic Constraints: critical
|
||||
CA:TRUE
|
||||
X509v3 Key Usage: critical
|
||||
Non Repudiation, Key Encipherment
|
||||
Signature Algorithm: ecdsa-with-SHA1
|
||||
30:46:02:21:00:f4:36:ee:86:21:d5:c7:1f:2d:0d:bb:29:ae:
|
||||
c1:74:ff:a3:ce:41:fe:cb:93:eb:ff:ef:fe:e3:4d:20:e5:18:
|
||||
65:02:21:00:b1:39:13:12:e2:b5:19:f2:8f:5b:40:ac:7a:5c:
|
||||
e2:a6:e3:d3:e6:9f:79:3c:29:d8:c6:7d:88:f4:60:0c:48:00
|
||||
30:46:02:21:00:fe:d6:30:36:fb:43:39:51:d7:4a:02:24:5e:
|
||||
b4:b1:11:e3:83:66:00:fc:24:12:1a:7e:a8:05:77:ca:f7:24:
|
||||
2d:02:21:00:fb:59:c3:e9:6e:9b:f6:a2:46:0b:d8:ad:33:fb:
|
||||
89:2d:80:d6:1d:68:1f:f7:d7:93:f1:0b:7a:6b:81:f5:af:62
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICfTCCAiOgAwIBAgIJAOOBS0ilcGFwMAkGByqGSM49BAEwgZExCzAJBgNVBAYT
|
||||
MIIDKTCCAs+gAwIBAgIJAOOBS0ilcGFwMAkGByqGSM49BAEwgZExCzAJBgNVBAYT
|
||||
AlVTMRMwEQYDVQQIDApXYXNoaW5ndG9uMRAwDgYDVQQHDAdTZWF0dGxlMREwDwYD
|
||||
VQQKDAhGb29mYXJhaDEUMBIGA1UECwwLQXJnbGViYXJnbGUxEjAQBgNVBAMMCWZv
|
||||
b2JhcmJhejEeMBwGCSqGSIb3DQEJARYPaW5mb0B3b3Jsc3MuY29tMB4XDTE0MDkx
|
||||
MDAwNDUzNloXDTE3MDYwNjAwNDUzNlowgZExCzAJBgNVBAYTAlVTMRMwEQYDVQQI
|
||||
b2JhcmJhejEeMBwGCSqGSIb3DQEJARYPaW5mb0B3b3Jsc3MuY29tMB4XDTE3MDUw
|
||||
MzAwMDcyMFoXDTIwMDEyODAwMDcyMFowgZExCzAJBgNVBAYTAlVTMRMwEQYDVQQI
|
||||
DApXYXNoaW5ndG9uMRAwDgYDVQQHDAdTZWF0dGxlMREwDwYDVQQKDAhGb29mYXJh
|
||||
aDEUMBIGA1UECwwLQXJnbGViYXJnbGUxEjAQBgNVBAMMCWZvb2JhcmJhejEeMBwG
|
||||
CSqGSIb3DQEJARYPaW5mb0B3b3Jsc3MuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0D
|
||||
AQcDQgAEuzOsTCdQSsZKpQTDPN6fNttyLc6U6iv6yyAJOSwW6GEC6a9N0wKTmjFb
|
||||
l5Ihf/DPGNqREQI0huggWDMLgDSJ2KNjMGEwHQYDVR0OBBYEFF1dJu+sfjb5m3YV
|
||||
K0olAiPvsokwMB8GA1UdIwQYMBaAFF1dJu+sfjb5m3YVK0olAiPvsokwMA8GA1Ud
|
||||
EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgVgMAkGByqGSM49BAEDSQAwRgIhAPQ2
|
||||
7oYh1ccfLQ27Ka7BdP+jzkH+y5Pr/+/+400g5RhlAiEAsTkTEuK1GfKPW0Cselzi
|
||||
puPT5p95PCnYxn2I9GAMSAA=
|
||||
l5Ihf/DPGNqREQI0huggWDMLgDSJ2KOCAQ0wggEJMB0GA1UdDgQWBBRdXSbvrH42
|
||||
+Zt2FStKJQIj77KJMDCBxgYDVR0jBIG+MIG7gBRdXSbvrH42+Zt2FStKJQIj77KJ
|
||||
MKGBl6SBlDCBkTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xEDAO
|
||||
BgNVBAcMB1NlYXR0bGUxETAPBgNVBAoMCEZvb2ZhcmFoMRQwEgYDVQQLDAtBcmds
|
||||
ZWJhcmdsZTESMBAGA1UEAwwJZm9vYmFyYmF6MR4wHAYJKoZIhvcNAQkBFg9pbmZv
|
||||
QHdvcmxzcy5jb22CCQDjgUtIpXBhcDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
|
||||
/wQEAwIFYDAJBgcqhkjOPQQBA0kAMEYCIQD+1jA2+0M5UddKAiRetLER44NmAPwk
|
||||
Ehp+qAV3yvckLQIhAPtZw+lum/aiRgvYrTP7iS2A1h1oH/fXk/ELemuB9a9i
|
||||
-----END CERTIFICATE-----
|
||||
|
69
certs/test/gen-ext-certs.sh
Normal file
69
certs/test/gen-ext-certs.sh
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/bin/sh
|
||||
|
||||
TMP="/tmp/`basename $0`"
|
||||
|
||||
gen_cert() {
|
||||
openssl req -x509 -keyform DER -key certs/server-key.der \
|
||||
-outform DER -out $OUT -config $CONFIG \
|
||||
>$TMP 2>&1
|
||||
|
||||
if [ "$?" = "0" -a -f $OUT ]; then
|
||||
echo "Created: $OUT"
|
||||
else
|
||||
cat $TMP
|
||||
echo "Failed: $OUT"
|
||||
fi
|
||||
|
||||
rm $TMP
|
||||
}
|
||||
|
||||
OUT=certs/test/cert-ext-nc.der
|
||||
KEYFILE=certs/test/cert-ext-nc-key.der
|
||||
CONFIG=certs/test/cert-ext-nc.cfg
|
||||
tee >$CONFIG <<EOF
|
||||
[ req ]
|
||||
distinguished_name = req_distinguished_name
|
||||
prompt = no
|
||||
x509_extensions = v3_ca
|
||||
|
||||
[ req_distinguished_name ]
|
||||
C = AU
|
||||
ST = Queensland
|
||||
L = Brisbane
|
||||
O = wolfSSL Inc
|
||||
OU = Engineering
|
||||
CN = www.wolfssl.com
|
||||
emailAddress = support@www.wolfsssl.com
|
||||
|
||||
[ v3_ca ]
|
||||
nameConstraints = critical,permitted;email:.wolfssl.com
|
||||
nsComment = "Testing name constraints"
|
||||
|
||||
EOF
|
||||
gen_cert
|
||||
|
||||
OUT=certs/test/cert-ext-ia.der
|
||||
KEYFILE=certs/test/cert-ext-ia-key.der
|
||||
CONFIG=certs/test/cert-ext-ia.cfg
|
||||
tee >$CONFIG <<EOF
|
||||
[ req ]
|
||||
distinguished_name = req_distinguished_name
|
||||
prompt = no
|
||||
x509_extensions = v3_ca
|
||||
|
||||
[ req_distinguished_name ]
|
||||
C = AU
|
||||
ST = Queensland
|
||||
L = Brisbane
|
||||
O = wolfSSL Inc
|
||||
OU = Engineering
|
||||
CN = www.wolfssl.com
|
||||
emailAddress = support@www.wolfsssl.com
|
||||
|
||||
[ v3_ca ]
|
||||
inhibitAnyPolicy = critical,1
|
||||
nsComment = "Testing inhibit any"
|
||||
|
||||
EOF
|
||||
gen_cert
|
||||
|
13
certs/test/include.am
Normal file
13
certs/test/include.am
Normal file
@@ -0,0 +1,13 @@
|
||||
# vim:ft=automake
|
||||
# All paths should be given relative to the root
|
||||
#
|
||||
|
||||
EXTRA_DIST += \
|
||||
certs/test/cert-ext-ia.cfg \
|
||||
certs/test/cert-ext-ia.der \
|
||||
certs/test/cert-ext-nc.cfg \
|
||||
certs/test/cert-ext-nc.der \
|
||||
certs/test/cert-ext-ns.der \
|
||||
certs/test/gen-ext-certs.sh \
|
||||
certs/test/server-duplicate-policy.pem
|
||||
|
182
certs/test/server-duplicate-policy.pem
Normal file
182
certs/test/server-duplicate-policy.pem
Normal file
@@ -0,0 +1,182 @@
|
||||
Certificate:
|
||||
Data:
|
||||
Version: 3 (0x2)
|
||||
Serial Number: 2 (0x2)
|
||||
Signature Algorithm: sha256WithRSAEncryption
|
||||
Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com/emailAddress=info@wolfssl.com
|
||||
Validity
|
||||
Not Before: Mar 10 20:37:22 2017 GMT
|
||||
Not After : Dec 5 20:37:22 2019 GMT
|
||||
Subject: C=US, ST=Montana, L=Bozeman, O=wolfSSL, OU=testing duplicate policy, CN=www.wolfssl.com/emailAddress=info@wolfssl.com
|
||||
Subject Public Key Info:
|
||||
Public Key Algorithm: rsaEncryption
|
||||
Public-Key: (2048 bit)
|
||||
Modulus:
|
||||
00:c0:95:08:e1:57:41:f2:71:6d:b7:d2:45:41:27:
|
||||
01:65:c6:45:ae:f2:bc:24:30:b8:95:ce:2f:4e:d6:
|
||||
f6:1c:88:bc:7c:9f:fb:a8:67:7f:fe:5c:9c:51:75:
|
||||
f7:8a:ca:07:e7:35:2f:8f:e1:bd:7b:c0:2f:7c:ab:
|
||||
64:a8:17:fc:ca:5d:7b:ba:e0:21:e5:72:2e:6f:2e:
|
||||
86:d8:95:73:da:ac:1b:53:b9:5f:3f:d7:19:0d:25:
|
||||
4f:e1:63:63:51:8b:0b:64:3f:ad:43:b8:a5:1c:5c:
|
||||
34:b3:ae:00:a0:63:c5:f6:7f:0b:59:68:78:73:a6:
|
||||
8c:18:a9:02:6d:af:c3:19:01:2e:b8:10:e3:c6:cc:
|
||||
40:b4:69:a3:46:33:69:87:6e:c4:bb:17:a6:f3:e8:
|
||||
dd:ad:73:bc:7b:2f:21:b5:fd:66:51:0c:bd:54:b3:
|
||||
e1:6d:5f:1c:bc:23:73:d1:09:03:89:14:d2:10:b9:
|
||||
64:c3:2a:d0:a1:96:4a:bc:e1:d4:1a:5b:c7:a0:c0:
|
||||
c1:63:78:0f:44:37:30:32:96:80:32:23:95:a1:77:
|
||||
ba:13:d2:97:73:e2:5d:25:c9:6a:0d:c3:39:60:a4:
|
||||
b4:b0:69:42:42:09:e9:d8:08:bc:33:20:b3:58:22:
|
||||
a7:aa:eb:c4:e1:e6:61:83:c5:d2:96:df:d9:d0:4f:
|
||||
ad:d7
|
||||
Exponent: 65537 (0x10001)
|
||||
X509v3 extensions:
|
||||
X509v3 Subject Key Identifier:
|
||||
B3:11:32:C9:92:98:84:E2:C9:F8:D0:3B:6E:03:42:CA:1F:0E:8E:3C
|
||||
X509v3 Authority Key Identifier:
|
||||
keyid:27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5
|
||||
DirName:/C=US/ST=Montana/L=Bozeman/O=Sawtooth/OU=Consulting/CN=www.wolfssl.com/emailAddress=info@wolfssl.com
|
||||
serial:9C:86:DC:5C:A7:73:35:83
|
||||
|
||||
X509v3 Basic Constraints:
|
||||
CA:FALSE
|
||||
X509v3 Certificate Policies:
|
||||
Policy: 1.2.3.4
|
||||
Policy: 1.2.3.4
|
||||
CPS: www.wolfssl.com
|
||||
User Notice:
|
||||
Explicit Text: Test of duplicate OIDs with different qualifiers
|
||||
|
||||
Signature Algorithm: sha256WithRSAEncryption
|
||||
82:59:1f:4c:a7:19:9f:e7:ab:cc:51:21:da:ef:4f:73:75:22:
|
||||
6c:db:55:83:c4:35:c7:40:69:49:46:45:56:78:06:03:76:d8:
|
||||
3b:6c:75:aa:2c:a5:c0:61:e8:5c:c0:2b:ed:66:a9:66:c0:b3:
|
||||
37:83:23:c5:2c:b2:45:59:61:84:be:dd:44:72:00:7a:6b:f9:
|
||||
50:89:31:66:a7:84:46:74:0f:bb:5b:05:0d:1f:2d:4d:b4:dc:
|
||||
69:2c:e2:a0:fd:5e:93:14:c7:ce:a2:6e:50:61:8f:73:94:a0:
|
||||
7a:65:e5:9d:76:f0:1b:1c:da:da:72:3e:f9:8c:4d:c0:4a:cb:
|
||||
24:e8:40:51:a1:37:9c:e7:87:1a:0e:cd:a6:7f:54:39:65:5f:
|
||||
63:64:04:60:5e:cc:1d:a6:71:78:1f:44:32:32:f9:27:0d:23:
|
||||
75:95:01:0b:0d:f3:90:ec:e2:7e:df:0f:43:96:e4:32:c3:b4:
|
||||
e2:df:87:12:97:a1:1e:f1:c8:73:fe:5e:ea:55:5c:f7:4b:88:
|
||||
2e:31:6c:52:ff:b3:05:85:f7:fe:e7:ac:f6:74:a8:4f:8e:96:
|
||||
88:5f:73:5a:f1:77:9d:b9:16:a3:53:e2:4a:5b:e2:5e:2b:88:
|
||||
1c:a8:b8:ee:e2:ee:72:cb:b2:51:ab:c2:90:5f:15:df:1c:ff:
|
||||
fd:0d:95:20
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIFJjCCBA6gAwIBAgIBAjANBgkqhkiG9w0BAQsFADCBlDELMAkGA1UEBhMCVVMx
|
||||
EDAOBgNVBAgMB01vbnRhbmExEDAOBgNVBAcMB0JvemVtYW4xETAPBgNVBAoMCFNh
|
||||
d3Rvb3RoMRMwEQYDVQQLDApDb25zdWx0aW5nMRgwFgYDVQQDDA93d3cud29sZnNz
|
||||
bC5jb20xHzAdBgkqhkiG9w0BCQEWEGluZm9Ad29sZnNzbC5jb20wHhcNMTcwMzEw
|
||||
MjAzNzIyWhcNMTkxMjA1MjAzNzIyWjCBoTELMAkGA1UEBhMCVVMxEDAOBgNVBAgM
|
||||
B01vbnRhbmExEDAOBgNVBAcMB0JvemVtYW4xEDAOBgNVBAoMB3dvbGZTU0wxITAf
|
||||
BgNVBAsMGHRlc3RpbmcgZHVwbGljYXRlIHBvbGljeTEYMBYGA1UEAwwPd3d3Lndv
|
||||
bGZzc2wuY29tMR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29tMIIBIjAN
|
||||
BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwJUI4VdB8nFtt9JFQScBZcZFrvK8
|
||||
JDC4lc4vTtb2HIi8fJ/7qGd//lycUXX3isoH5zUvj+G9e8AvfKtkqBf8yl17uuAh
|
||||
5XIuby6G2JVz2qwbU7lfP9cZDSVP4WNjUYsLZD+tQ7ilHFw0s64AoGPF9n8LWWh4
|
||||
c6aMGKkCba/DGQEuuBDjxsxAtGmjRjNph27Euxem8+jdrXO8ey8htf1mUQy9VLPh
|
||||
bV8cvCNz0QkDiRTSELlkwyrQoZZKvOHUGlvHoMDBY3gPRDcwMpaAMiOVoXe6E9KX
|
||||
c+JdJclqDcM5YKS0sGlCQgnp2Ai8MyCzWCKnquvE4eZhg8XSlt/Z0E+t1wIDAQAB
|
||||
o4IBcjCCAW4wHQYDVR0OBBYEFLMRMsmSmITiyfjQO24DQsofDo48MIHJBgNVHSME
|
||||
gcEwgb6AFCeOZxF0wyYdP+0zY7Ok2B0w5ejVoYGapIGXMIGUMQswCQYDVQQGEwJV
|
||||
UzEQMA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjERMA8GA1UECgwI
|
||||
U2F3dG9vdGgxEzARBgNVBAsMCkNvbnN1bHRpbmcxGDAWBgNVBAMMD3d3dy53b2xm
|
||||
c3NsLmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbYIJAJyG3Fyn
|
||||
czWDMAkGA1UdEwQCMAAwdgYDVR0gBG8wbTAFBgMqAwQwZAYDKgMEMF0wGwYIKwYB
|
||||
BQUHAgEWD3d3dy53b2xmc3NsLmNvbTA+BggrBgEFBQcCAjAyGjBUZXN0IG9mIGR1
|
||||
cGxpY2F0ZSBPSURzIHdpdGggZGlmZmVyZW50IHF1YWxpZmllcnMwDQYJKoZIhvcN
|
||||
AQELBQADggEBAIJZH0ynGZ/nq8xRIdrvT3N1ImzbVYPENcdAaUlGRVZ4BgN22Dts
|
||||
daospcBh6FzAK+1mqWbAszeDI8UsskVZYYS+3URyAHpr+VCJMWanhEZ0D7tbBQ0f
|
||||
LU203Gks4qD9XpMUx86iblBhj3OUoHpl5Z128Bsc2tpyPvmMTcBKyyToQFGhN5zn
|
||||
hxoOzaZ/VDllX2NkBGBezB2mcXgfRDIy+ScNI3WVAQsN85Ds4n7fD0OW5DLDtOLf
|
||||
hxKXoR7xyHP+XupVXPdLiC4xbFL/swWF9/7nrPZ0qE+Olohfc1rxd525FqNT4kpb
|
||||
4l4riByouO7i7nLLslGrwpBfFd8c//0NlSA=
|
||||
-----END CERTIFICATE-----
|
||||
Certificate:
|
||||
Data:
|
||||
Version: 3 (0x2)
|
||||
Serial Number: 11278944607300433283 (0x9c86dc5ca7733583)
|
||||
Signature Algorithm: sha256WithRSAEncryption
|
||||
Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com/emailAddress=info@wolfssl.com
|
||||
Validity
|
||||
Not Before: Mar 10 20:37:22 2017 GMT
|
||||
Not After : Dec 5 20:37:22 2019 GMT
|
||||
Subject: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com/emailAddress=info@wolfssl.com
|
||||
Subject Public Key Info:
|
||||
Public Key Algorithm: rsaEncryption
|
||||
Public-Key: (2048 bit)
|
||||
Modulus:
|
||||
00:bf:0c:ca:2d:14:b2:1e:84:42:5b:cd:38:1f:4a:
|
||||
f2:4d:75:10:f1:b6:35:9f:df:ca:7d:03:98:d3:ac:
|
||||
de:03:66:ee:2a:f1:d8:b0:7d:6e:07:54:0b:10:98:
|
||||
21:4d:80:cb:12:20:e7:cc:4f:de:45:7d:c9:72:77:
|
||||
32:ea:ca:90:bb:69:52:10:03:2f:a8:f3:95:c5:f1:
|
||||
8b:62:56:1b:ef:67:6f:a4:10:41:95:ad:0a:9b:e3:
|
||||
a5:c0:b0:d2:70:76:50:30:5b:a8:e8:08:2c:7c:ed:
|
||||
a7:a2:7a:8d:38:29:1c:ac:c7:ed:f2:7c:95:b0:95:
|
||||
82:7d:49:5c:38:cd:77:25:ef:bd:80:75:53:94:3c:
|
||||
3d:ca:63:5b:9f:15:b5:d3:1d:13:2f:19:d1:3c:db:
|
||||
76:3a:cc:b8:7d:c9:e5:c2:d7:da:40:6f:d8:21:dc:
|
||||
73:1b:42:2d:53:9c:fe:1a:fc:7d:ab:7a:36:3f:98:
|
||||
de:84:7c:05:67:ce:6a:14:38:87:a9:f1:8c:b5:68:
|
||||
cb:68:7f:71:20:2b:f5:a0:63:f5:56:2f:a3:26:d2:
|
||||
b7:6f:b1:5a:17:d7:38:99:08:fe:93:58:6f:fe:c3:
|
||||
13:49:08:16:0b:a7:4d:67:00:52:31:67:23:4e:98:
|
||||
ed:51:45:1d:b9:04:d9:0b:ec:d8:28:b3:4b:bd:ed:
|
||||
36:79
|
||||
Exponent: 65537 (0x10001)
|
||||
X509v3 extensions:
|
||||
X509v3 Subject Key Identifier:
|
||||
27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5
|
||||
X509v3 Authority Key Identifier:
|
||||
keyid:27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5
|
||||
DirName:/C=US/ST=Montana/L=Bozeman/O=Sawtooth/OU=Consulting/CN=www.wolfssl.com/emailAddress=info@wolfssl.com
|
||||
serial:9C:86:DC:5C:A7:73:35:83
|
||||
|
||||
X509v3 Basic Constraints:
|
||||
CA:TRUE
|
||||
Signature Algorithm: sha256WithRSAEncryption
|
||||
10:6b:75:29:65:17:7e:78:ae:85:2e:b7:a4:50:98:69:74:f9:
|
||||
50:a1:8e:2c:9f:b0:43:66:a1:e0:42:32:38:15:5f:2e:cc:cc:
|
||||
c4:b9:7c:b5:c2:bc:59:24:49:17:ad:1c:e4:6e:dc:70:e3:93:
|
||||
fc:69:dd:04:7b:41:dd:08:f0:13:ee:2a:cb:6f:cf:af:d4:96:
|
||||
3c:44:50:29:45:60:89:cd:ec:5f:c1:bb:b0:03:61:74:b3:29:
|
||||
ad:df:e9:7c:d9:f2:18:22:45:e7:3d:d4:72:37:2c:b4:18:7d:
|
||||
34:ca:55:00:0d:89:d0:f7:3e:81:4d:da:02:4c:2b:a6:61:4b:
|
||||
bf:b1:ec:73:11:6a:53:a3:0a:0f:20:04:5d:17:67:b1:a6:a2:
|
||||
37:a8:f5:ea:78:6d:00:8b:64:16:62:0a:6f:44:94:15:9e:4d:
|
||||
15:0c:33:f0:ba:9d:e2:be:69:6f:12:9f:69:95:39:ba:97:9e:
|
||||
c3:af:22:ad:f2:f2:3b:67:81:1a:99:d2:02:89:86:6d:8f:92:
|
||||
98:32:dd:c1:fa:2e:38:03:2e:fc:02:a5:e7:b8:dc:94:3b:88:
|
||||
15:4a:09:80:98:61:b4:5e:07:b5:87:57:f4:a0:91:5c:7e:89:
|
||||
f5:89:16:f2:7a:15:52:1b:55:26:7c:59:d2:d0:23:e3:0e:12:
|
||||
b1:99:f9:6b
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEqjCCA5KgAwIBAgIJAJyG3FynczWDMA0GCSqGSIb3DQEBCwUAMIGUMQswCQYD
|
||||
VQQGEwJVUzEQMA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjERMA8G
|
||||
A1UECgwIU2F3dG9vdGgxEzARBgNVBAsMCkNvbnN1bHRpbmcxGDAWBgNVBAMMD3d3
|
||||
dy53b2xmc3NsLmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTAe
|
||||
Fw0xNzAzMTAyMDM3MjJaFw0xOTEyMDUyMDM3MjJaMIGUMQswCQYDVQQGEwJVUzEQ
|
||||
MA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjERMA8GA1UECgwIU2F3
|
||||
dG9vdGgxEzARBgNVBAsMCkNvbnN1bHRpbmcxGDAWBgNVBAMMD3d3dy53b2xmc3Ns
|
||||
LmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTCCASIwDQYJKoZI
|
||||
hvcNAQEBBQADggEPADCCAQoCggEBAL8Myi0Ush6EQlvNOB9K8k11EPG2NZ/fyn0D
|
||||
mNOs3gNm7irx2LB9bgdUCxCYIU2AyxIg58xP3kV9yXJ3MurKkLtpUhADL6jzlcXx
|
||||
i2JWG+9nb6QQQZWtCpvjpcCw0nB2UDBbqOgILHztp6J6jTgpHKzH7fJ8lbCVgn1J
|
||||
XDjNdyXvvYB1U5Q8PcpjW58VtdMdEy8Z0TzbdjrMuH3J5cLX2kBv2CHccxtCLVOc
|
||||
/hr8fat6Nj+Y3oR8BWfOahQ4h6nxjLVoy2h/cSAr9aBj9VYvoybSt2+xWhfXOJkI
|
||||
/pNYb/7DE0kIFgunTWcAUjFnI06Y7VFFHbkE2Qvs2CizS73tNnkCAwEAAaOB/DCB
|
||||
+TAdBgNVHQ4EFgQUJ45nEXTDJh0/7TNjs6TYHTDl6NUwgckGA1UdIwSBwTCBvoAU
|
||||
J45nEXTDJh0/7TNjs6TYHTDl6NWhgZqkgZcwgZQxCzAJBgNVBAYTAlVTMRAwDgYD
|
||||
VQQIDAdNb250YW5hMRAwDgYDVQQHDAdCb3plbWFuMREwDwYDVQQKDAhTYXd0b290
|
||||
aDETMBEGA1UECwwKQ29uc3VsdGluZzEYMBYGA1UEAwwPd3d3LndvbGZzc2wuY29t
|
||||
MR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29tggkAnIbcXKdzNYMwDAYD
|
||||
VR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAEGt1KWUXfniuhS63pFCYaXT5
|
||||
UKGOLJ+wQ2ah4EIyOBVfLszMxLl8tcK8WSRJF60c5G7ccOOT/GndBHtB3QjwE+4q
|
||||
y2/Pr9SWPERQKUVgic3sX8G7sANhdLMprd/pfNnyGCJF5z3UcjcstBh9NMpVAA2J
|
||||
0Pc+gU3aAkwrpmFLv7HscxFqU6MKDyAEXRdnsaaiN6j16nhtAItkFmIKb0SUFZ5N
|
||||
FQwz8Lqd4r5pbxKfaZU5upeew68irfLyO2eBGpnSAomGbY+SmDLdwfouOAMu/AKl
|
||||
57jclDuIFUoJgJhhtF4HtYdX9KCRXH6J9YkW8noVUhtVJnxZ0tAj4w4SsZn5aw==
|
||||
-----END CERTIFICATE-----
|
344
configure.ac
344
configure.ac
@@ -6,7 +6,7 @@
|
||||
#
|
||||
#
|
||||
|
||||
AC_INIT([wolfssl],[3.10.0],[https://github.com/wolfssl/wolfssl/issues],[wolfssl],[http://www.wolfssl.com])
|
||||
AC_INIT([wolfssl],[3.11.1],[https://github.com/wolfssl/wolfssl/issues],[wolfssl],[http://www.wolfssl.com])
|
||||
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
|
||||
@@ -35,7 +35,7 @@ AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CONFIG_HEADERS([config.h:config.in])dnl Keep filename to 8.3 for MS-DOS.
|
||||
|
||||
#shared library versioning
|
||||
WOLFSSL_LIBRARY_VERSION=9:0:6
|
||||
WOLFSSL_LIBRARY_VERSION=12:0:0
|
||||
# | | |
|
||||
# +------+ | +---+
|
||||
# | | |
|
||||
@@ -140,6 +140,7 @@ then
|
||||
enable_shared=yes
|
||||
enable_static=yes
|
||||
enable_dtls=yes
|
||||
enable_tls13=yes
|
||||
enable_openssh=yes
|
||||
enable_opensslextra=yes
|
||||
enable_savesession=yes
|
||||
@@ -148,9 +149,11 @@ then
|
||||
enable_pkcallbacks=yes
|
||||
enable_aesgcm=yes
|
||||
enable_aesccm=yes
|
||||
enable_aesctr=yes
|
||||
enable_camellia=yes
|
||||
enable_ripemd=yes
|
||||
enable_sha512=yes
|
||||
enable_sha224=yes
|
||||
enable_sessioncerts=yes
|
||||
enable_keygen=yes
|
||||
enable_certgen=yes
|
||||
@@ -189,8 +192,13 @@ then
|
||||
enable_certservice=yes
|
||||
enable_jni=yes
|
||||
enable_lighty=yes
|
||||
enable_haproxy=yes
|
||||
enable_stunnel=yes
|
||||
enable_nginx=yes
|
||||
enable_pwdbased=yes
|
||||
enable_aeskeywrap=yes
|
||||
enable_x963kdf=yes
|
||||
enable_scrypt=yes
|
||||
fi
|
||||
AM_CONDITIONAL([BUILD_DISTRO], [test "x$ENABLED_DISTRO" = "xyes"])
|
||||
|
||||
@@ -226,8 +234,24 @@ then
|
||||
fi
|
||||
|
||||
|
||||
# TLS v1.3
|
||||
AC_ARG_ENABLE([tls13],
|
||||
[ --enable-tls13 Enable wolfSSL TLS v1.3 (default: disabled)],
|
||||
[ ENABLED_TLS13=$enableval ],
|
||||
[ ENABLED_TLS13=no ]
|
||||
)
|
||||
if test "$ENABLED_TLS13" = "yes"
|
||||
then
|
||||
AM_CFLAGS="-DWOLFSSL_TLS13 -DHAVE_TLS_EXTENSIONS -DHAVE_FFDHE_2048 $AM_CFLAGS"
|
||||
AM_CFLAGS="-DWC_RSA_PSS $AM_CFLAGS"
|
||||
fi
|
||||
|
||||
# check if TLS v1.3 was enabled for conditionally running tls13.test script
|
||||
AM_CONDITIONAL([BUILD_TLS13], [test "x$ENABLED_TLS13" = "xyes"])
|
||||
|
||||
|
||||
AC_ARG_ENABLE([rng],
|
||||
[AS_HELP_STRING([ --enable-rng Enable compiling and using RNG (default: enabled)])],
|
||||
[AS_HELP_STRING([--enable-rng Enable compiling and using RNG (default: enabled)])],
|
||||
[ ENABLED_RNG=$enableval ],
|
||||
[ ENABLED_RNG=yes ]
|
||||
)
|
||||
@@ -268,6 +292,20 @@ AC_ARG_ENABLE([openssh],
|
||||
[ENABLED_OPENSSH=$enableval],
|
||||
[ENABLED_OPENSSH=no])
|
||||
|
||||
# nginx compatibility build
|
||||
AC_ARG_ENABLE([nginx],
|
||||
[ --enable-nginx Enable nginx (default: disabled)],
|
||||
[ ENABLED_NGINX=$enableval ],
|
||||
[ ENABLED_NGINX=no ]
|
||||
)
|
||||
|
||||
# haproxy compatibility build
|
||||
AC_ARG_ENABLE([haproxy],
|
||||
[ --enable-haproxy Enable haproxy (default: disabled)],
|
||||
[ ENABLED_HAPROXY=$enableval ],
|
||||
[ ENABLED_HAPROXY=no ]
|
||||
)
|
||||
|
||||
|
||||
# OPENSSL Extra Compatibility
|
||||
AC_ARG_ENABLE([opensslextra],
|
||||
@@ -275,7 +313,7 @@ AC_ARG_ENABLE([opensslextra],
|
||||
[ ENABLED_OPENSSLEXTRA=$enableval ],
|
||||
[ ENABLED_OPENSSLEXTRA=no ]
|
||||
)
|
||||
if test "$ENABLED_OPENSSH" = "yes"
|
||||
if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_NGINX" = "yes"
|
||||
then
|
||||
ENABLED_OPENSSLEXTRA="yes"
|
||||
fi
|
||||
@@ -319,12 +357,28 @@ AC_ARG_ENABLE([ipv6],
|
||||
|
||||
if test "$ENABLED_IPV6" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DTEST_IPV6"
|
||||
AM_CFLAGS="$AM_CFLAGS -DTEST_IPV6 -DWOLFSSL_IPV6"
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([BUILD_IPV6], [test "x$ENABLED_IPV6" = "xyes"])
|
||||
|
||||
|
||||
# wpa_supplicant support
|
||||
AC_ARG_ENABLE([wpas],
|
||||
[ --enable-wpas Enable wpa_supplicant support (default: disabled)],
|
||||
[ ENABLED_WPAS=$enableval ],
|
||||
[ ENABLED_WPAS=no ]
|
||||
)
|
||||
if test "$ENABLED_WPAS" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_SECRET_CALLBACK -DWOLFSSL_STATIC_RSA"
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PUBLIC_MP -DWOLFSSL_PUBLIC_ECC_ADD_DBL"
|
||||
AM_CFLAGS="$AM_CFLAGS -DATOMIC_USER -DHAVE_EX_DATA -DWOLFSSL_KEEP_PEER_CERT"
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_EXT_CACHE"
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_WPAS"
|
||||
fi
|
||||
|
||||
|
||||
# Fortress build
|
||||
AC_ARG_ENABLE([fortress],
|
||||
[ --enable-fortress Enable SSL fortress build (default: disabled)],
|
||||
@@ -332,14 +386,14 @@ AC_ARG_ENABLE([fortress],
|
||||
[ ENABLED_FORTRESS=no ]
|
||||
)
|
||||
|
||||
if test "$ENABLED_OPENSSH" = "yes"
|
||||
if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_WPAS" = "yes"
|
||||
then
|
||||
ENABLED_FORTRESS="yes"
|
||||
fi
|
||||
|
||||
if test "$ENABLED_FORTRESS" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DFORTRESS -DWOLFSSL_ALWAYS_VERIFY_CB -DOPENSSL_EXTRA -DWOLFSSL_DES_ECB -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT -DWOLFSSL_DER_LOAD -DWOLFSSL_SHA512 -DWOLFSSL_SHA384 -DWOLFSSL_KEY_GEN"
|
||||
AM_CFLAGS="$AM_CFLAGS -DFORTRESS -DWOLFSSL_ALWAYS_VERIFY_CB -DOPENSSL_EXTRA -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT -DWOLFSSL_DER_LOAD -DWOLFSSL_SHA512 -DWOLFSSL_SHA384 -DWOLFSSL_KEY_GEN"
|
||||
fi
|
||||
|
||||
|
||||
@@ -454,6 +508,19 @@ then
|
||||
fi
|
||||
|
||||
|
||||
# Write duplicate WOLFSSL object
|
||||
AC_ARG_ENABLE([writedup],
|
||||
[ --enable-writedup Enable write duplication of WOLFSSL objects (default: disabled)],
|
||||
[ ENABLED_WRITEDUP=$enableval ],
|
||||
[ ENABLED_WRITEDUP=no ]
|
||||
)
|
||||
|
||||
if test "$ENABLED_WRITEDUP" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_WRITE_DUP"
|
||||
fi
|
||||
|
||||
|
||||
# Atomic User Record Layer
|
||||
AC_ARG_ENABLE([atomicuser],
|
||||
[ --enable-atomicuser Enable Atomic User Record Layer (default: disabled)],
|
||||
@@ -562,6 +629,23 @@ fi
|
||||
AM_CONDITIONAL([BUILD_AESCCM], [test "x$ENABLED_AESCCM" = "xyes"])
|
||||
|
||||
|
||||
# AES-CTR
|
||||
AC_ARG_ENABLE([aesctr],
|
||||
[ --enable-aesctr Enable wolfSSL AES-CTR support (default: disabled)],
|
||||
[ ENABLED_AESCTR=$enableval ],
|
||||
[ ENABLED_AESCTR=no ]
|
||||
)
|
||||
|
||||
if test "$ENABLED_AESCTR" = "yes"
|
||||
then
|
||||
if test "x$ENABLED_FORTRESS" != "xyes"
|
||||
then
|
||||
# This is already implied by fortress build
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# AES-ARM
|
||||
AC_ARG_ENABLE([armasm],
|
||||
[AS_HELP_STRING([--enable-armasm],[Enable wolfSSL ARMv8 ASM support (default: disabled)])],
|
||||
@@ -590,7 +674,7 @@ fi
|
||||
|
||||
AM_CONDITIONAL([BUILD_ARMASM], [test "x$ENABLED_ARMASM" = "xyes"])
|
||||
|
||||
# AES-NI
|
||||
# INTEL AES-NI
|
||||
AC_ARG_ENABLE([aesni],
|
||||
[AS_HELP_STRING([--enable-aesni],[Enable wolfSSL AES-NI support (default: disabled)])],
|
||||
[ ENABLED_AESNI=$enableval ],
|
||||
@@ -604,6 +688,7 @@ AC_ARG_ENABLE([intelasm],
|
||||
[ ENABLED_INTELASM=no ]
|
||||
)
|
||||
|
||||
|
||||
if test "$ENABLED_AESNI" = "yes" || test "$ENABLED_INTELASM" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AESNI"
|
||||
@@ -621,10 +706,22 @@ fi
|
||||
|
||||
if test "$ENABLED_INTELASM" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_INTEL_RDGEN -DUSE_INTEL_SPEEDUP"
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_INTEL_RDSEED -DUSE_INTEL_SPEEDUP"
|
||||
ENABLED_AESNI=yes
|
||||
fi
|
||||
|
||||
# INTEL RDRAND
|
||||
AC_ARG_ENABLE([intelrand],
|
||||
[AS_HELP_STRING([--enable-intelrand],[Enable Intel rdrand as preferred RNG source (default: disabled)])],
|
||||
[ ENABLED_INTELRDRAND=$enableval ],
|
||||
[ ENABLED_INTELRDRAND=no ]
|
||||
)
|
||||
|
||||
if test "$ENABLED_INTELRDRAND" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_INTEL_RDRAND"
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([BUILD_AESNI], [test "x$ENABLED_AESNI" = "xyes"])
|
||||
|
||||
|
||||
@@ -761,6 +858,15 @@ AC_ARG_ENABLE([sessioncerts],
|
||||
[ ENABLED_SESSIONCERTS=no ]
|
||||
)
|
||||
|
||||
if test "x$ENABLED_NGINX" = "xyes"
|
||||
then
|
||||
ENABLED_SESSIONCERTS=yes
|
||||
fi
|
||||
if test "$ENABLED_TLS13" = "yes" && test "$ENABLED_PSK" = "yes"
|
||||
then
|
||||
ENABLED_SESSIONCERTS=yes
|
||||
fi
|
||||
|
||||
if test "$ENABLED_SESSIONCERTS" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
|
||||
@@ -845,6 +951,10 @@ AC_ARG_ENABLE([hkdf],
|
||||
[ ENABLED_HKDF=$enableval ],
|
||||
[ ENABLED_HKDF=no ]
|
||||
)
|
||||
if test "$ENABLED_TLS13" = "yes"
|
||||
then
|
||||
ENABLED_HKDF="yes"
|
||||
fi
|
||||
if test "$ENABLED_HKDF" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_HKDF"
|
||||
@@ -870,7 +980,7 @@ AC_ARG_ENABLE([dsa],
|
||||
[ ENABLED_DSA=no ]
|
||||
)
|
||||
|
||||
if test "$ENABLED_OPENSSH" = "yes"
|
||||
if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_NGINX" = "yes" || test "$ENABLED_WPAS" = "yes"
|
||||
then
|
||||
ENABLED_DSA="yes"
|
||||
fi
|
||||
@@ -912,7 +1022,7 @@ then
|
||||
ENABLED_ECC=no
|
||||
fi
|
||||
|
||||
if test "$ENABLED_OPENSSH" = "yes"
|
||||
if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_NGINX" = "yes"
|
||||
then
|
||||
ENABLED_ECC="yes"
|
||||
fi
|
||||
@@ -938,6 +1048,12 @@ AC_ARG_ENABLE([ecccustcurves],
|
||||
if test "$ENABLED_ECCCUSTCURVES" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CUSTOM_CURVES"
|
||||
|
||||
# For distro build, enable all curve types
|
||||
if test "$ENABLED_DISTRO" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC_SECPR2 -DHAVE_ECC_SECPR3 -DHAVE_ECC_BRAINPOOL -DHAVE_ECC_KOBLITZ"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -948,6 +1064,10 @@ AC_ARG_ENABLE([compkey],
|
||||
[ ENABLED_COMPKEY=no ]
|
||||
)
|
||||
|
||||
if test "$ENABLED_WPAS" = "yes"
|
||||
then
|
||||
ENABLED_COMPKEY=yes
|
||||
fi
|
||||
if test "$ENABLED_COMPKEY" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_COMP_KEY"
|
||||
@@ -1215,7 +1335,10 @@ AC_ARG_ENABLE([anon],
|
||||
[ ENABLED_ANON=no ]
|
||||
)
|
||||
|
||||
|
||||
if test "x$ENABLED_WPAS" = "xyes"
|
||||
then
|
||||
ENABLED_ANON=yes
|
||||
fi
|
||||
if test "x$ENABLED_ANON" = "xyes"
|
||||
then
|
||||
if test "x$ENABLED_DH" != "xyes"
|
||||
@@ -1298,6 +1421,10 @@ then
|
||||
then
|
||||
AC_MSG_ERROR([AESCCM requires AES.])
|
||||
fi
|
||||
if test "$ENABLED_AESCTR" = "yes"
|
||||
then
|
||||
AC_MSG_ERROR([AESCTR requires AES.])
|
||||
fi
|
||||
else
|
||||
# turn off AES if leanpsk on
|
||||
if test "$ENABLED_LEANPSK" = "yes"
|
||||
@@ -1380,7 +1507,7 @@ AC_ARG_ENABLE([arc4],
|
||||
[ ENABLED_ARC4=no ]
|
||||
)
|
||||
|
||||
if test "$ENABLED_OPENSSH" = "yes"
|
||||
if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_WPAS" = "yes"
|
||||
then
|
||||
ENABLED_ARC4="yes"
|
||||
fi
|
||||
@@ -1451,6 +1578,11 @@ AC_ARG_ENABLE([cmac],
|
||||
[ ENABLED_CMAC=no ]
|
||||
)
|
||||
|
||||
if test "$ENABLED_WPAS" = "yes"
|
||||
then
|
||||
ENABLED_CMAC=yes
|
||||
fi
|
||||
|
||||
AS_IF([test "x$ENABLED_CMAC" = "xyes"],
|
||||
[AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CMAC -DWOLFSSL_AES_DIRECT"])
|
||||
|
||||
@@ -1539,6 +1671,11 @@ then
|
||||
ENABLED_DES3="yes"
|
||||
fi
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_FIPS"
|
||||
else
|
||||
if test "x$ENABLED_FORTRESS" = "xyes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DES_ECB"
|
||||
fi
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([BUILD_FIPS], [test "x$ENABLED_FIPS" = "xyes"])
|
||||
@@ -1638,11 +1775,13 @@ if test "x$ENABLED_HASHDRBG" = "xyes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_HASHDRBG"
|
||||
else
|
||||
# turn on Hash DRBG if FIPS is on or ARC4 is off
|
||||
if test "x$ENABLED_FIPS" = "xyes" || test "x$ENABLED_ARC4" = "xno"
|
||||
# turn on Hash DRBG if FIPS is on
|
||||
if test "x$ENABLED_FIPS" = "xyes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_HASHDRBG"
|
||||
ENABLED_HASHDRBG=yes
|
||||
else
|
||||
AM_CFLAGS="$AM_CFLAGS -DWC_NO_HASHDRBG"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1689,6 +1828,11 @@ AC_ARG_ENABLE([ocsp],
|
||||
[ ENABLED_OCSP=no ],
|
||||
)
|
||||
|
||||
if test "x$ENABLED_NGINX" = "xyes"
|
||||
then
|
||||
ENABLED_OCSP=yes
|
||||
fi
|
||||
|
||||
if test "$ENABLED_OCSP" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
|
||||
@@ -1718,6 +1862,12 @@ AC_ARG_ENABLE([ocspstapling],
|
||||
[ ENABLED_CERTIFICATE_STATUS_REQUEST=no ]
|
||||
)
|
||||
|
||||
if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_WPAS" = "xyes" || test "x$ENABLED_HAPROXY" = "xyes"
|
||||
then
|
||||
echo "ELLO"
|
||||
ENABLED_CERTIFICATE_STATUS_REQUEST="yes"
|
||||
fi
|
||||
|
||||
if test "x$ENABLED_CERTIFICATE_STATUS_REQUEST" = "xyes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_CERTIFICATE_STATUS_REQUEST"
|
||||
@@ -1740,6 +1890,11 @@ AC_ARG_ENABLE([ocspstapling2],
|
||||
[ ENABLED_CERTIFICATE_STATUS_REQUEST_V2=no ]
|
||||
)
|
||||
|
||||
if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_WPAS" = "xyes" || test "x$ENABLED_HAPROXY" = "xyes"
|
||||
then
|
||||
ENABLED_CERTIFICATE_STATUS_REQUEST_V2=yes
|
||||
fi
|
||||
|
||||
if test "x$ENABLED_CERTIFICATE_STATUS_REQUEST_V2" = "xyes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_CERTIFICATE_STATUS_REQUEST_V2"
|
||||
@@ -1762,6 +1917,12 @@ AC_ARG_ENABLE([crl],
|
||||
[ ENABLED_CRL=no ],
|
||||
)
|
||||
|
||||
|
||||
if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_HAPROXY" = "xyes"
|
||||
then
|
||||
ENABLED_CRL=yes
|
||||
fi
|
||||
|
||||
if test "$ENABLED_CRL" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
|
||||
@@ -1958,7 +2119,7 @@ AC_ARG_ENABLE([maxfragment],
|
||||
|
||||
# ALPN
|
||||
AC_ARG_ENABLE([alpn],
|
||||
[ --enable-alpn Enable ALPN (default: disabled)],
|
||||
[ --enable-alpn Enable ALPN (default: disabled)],
|
||||
[ ENABLED_ALPN=$enableval ],
|
||||
[ ENABLED_ALPN=no ]
|
||||
)
|
||||
@@ -2034,6 +2195,11 @@ AC_ARG_ENABLE([session-ticket],
|
||||
[ ENABLED_SESSION_TICKET=no ]
|
||||
)
|
||||
|
||||
if test "x$ENABLED_NGINX" = "xyes" || test "$ENABLED_WPAS" = "yes" || test "x$ENABLED_HAPROXY" = "xyes"
|
||||
then
|
||||
ENABLED_SESSION_TICKET=yes
|
||||
fi
|
||||
|
||||
if test "x$ENABLED_SESSION_TICKET" = "xyes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SESSION_TICKET"
|
||||
@@ -2058,6 +2224,11 @@ AC_ARG_ENABLE([tlsx],
|
||||
[ ENABLED_TLSX=no ]
|
||||
)
|
||||
|
||||
if test "x$ENABLED_NGINX" = "xyes" || test "x$ENABLED_HAPROXY" = "xyes"
|
||||
then
|
||||
ENABLED_TLSX=yes
|
||||
fi
|
||||
|
||||
if test "x$ENABLED_TLSX" = "xyes"
|
||||
then
|
||||
ENABLED_SNI=yes
|
||||
@@ -2284,7 +2455,6 @@ then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# lighty Support
|
||||
AC_ARG_ENABLE([lighty],
|
||||
[ --enable-lighty Enable lighttpd/lighty (default: disabled)],
|
||||
@@ -2302,12 +2472,41 @@ then
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_LIGHTY -DHAVE_WOLFSSL_SSL_H=1"
|
||||
fi
|
||||
|
||||
if test "$ENABLED_NGINX" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NGINX"
|
||||
fi
|
||||
|
||||
if test "$ENABLED_HAPROXY" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAPROXY"
|
||||
# Requires opensslextra make sure on
|
||||
if test "x$ENABLED_OPENSSLEXTRA" = "xno"
|
||||
then
|
||||
ENABLED_OPENSSLEXTRA="yes"
|
||||
AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$ENABLED_NGINX" = "yes"|| test "x$ENABLED_HAPROXY" = "xyes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_VERIFY_CB"
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_KEEP_SNI"
|
||||
AM_CFLAGS="$AM_CFLAGS -DKEEP_OUR_CERT -DKEEP_PEER_CERT"
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_EXT_CACHE -DHAVE_EX_DATA"
|
||||
fi
|
||||
|
||||
|
||||
# stunnel Support
|
||||
AC_ARG_ENABLE([stunnel],
|
||||
[ --enable-stunnel Enable stunnel (default: disabled)],
|
||||
[ ENABLED_STUNNEL=$enableval ],
|
||||
[ ENABLED_STUNNEL=no ]
|
||||
)
|
||||
if test "$ENABLED_WPAS" = "yes"
|
||||
then
|
||||
ENABLED_STUNNEL="yes"
|
||||
fi
|
||||
if test "$ENABLED_STUNNEL" = "yes"
|
||||
then
|
||||
# Requires opensslextra make sure on
|
||||
@@ -2374,7 +2573,7 @@ then
|
||||
fi
|
||||
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_STUNNEL -DWOLFSSL_ALWAYS_VERIFY_CB"
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_KEEP_SNI"
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_KEEP_SNI -DHAVE_EX_DATA"
|
||||
fi
|
||||
|
||||
if test "$ENABLED_PSK" = "no" && test "$ENABLED_LEANPSK" = "no" \
|
||||
@@ -2609,6 +2808,7 @@ AC_ARG_WITH([cavium],
|
||||
[
|
||||
AC_MSG_CHECKING([for cavium])
|
||||
CPPFLAGS="$CPPFLAGS -DHAVE_CAVIUM"
|
||||
LIB_ADD="-lrt $LIB_ADD"
|
||||
|
||||
if test "x$withval" == "xyes" ; then
|
||||
AC_MSG_ERROR([need a PATH for --with-cavium])
|
||||
@@ -2625,6 +2825,8 @@ AC_ARG_WITH([cavium],
|
||||
if test "x$cavium_linked" == "xno" ; then
|
||||
AC_MSG_ERROR([cavium isn't found.
|
||||
If it's already installed, specify its path using --with-cavium=/dir/])
|
||||
else
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_CAVIUM"
|
||||
fi
|
||||
AC_MSG_RESULT([yes])
|
||||
enable_shared=no
|
||||
@@ -2641,6 +2843,7 @@ AC_ARG_WITH([cavium-v],
|
||||
[
|
||||
AC_MSG_CHECKING([for cavium])
|
||||
CPPFLAGS="$CPPFLAGS -DHAVE_CAVIUM -DHAVE_CAVIUM_V"
|
||||
LIB_ADD="-lrt $LIB_ADD"
|
||||
|
||||
if test "x$withval" == "xyes" ; then
|
||||
AC_MSG_ERROR([need a PATH for --with-cavium])
|
||||
@@ -2649,7 +2852,7 @@ AC_ARG_WITH([cavium-v],
|
||||
trycaviumdir=$withval
|
||||
fi
|
||||
|
||||
LDFLAGS="$AM_LDFLAGS $trycaviumdir/utils/sample_tests/cavium_common.o $trycaviumdir/utils/sample_tests/cavium_sym_crypto.o $trycaviumdir/utils/sample_tests/cavium_asym_crypto.o"
|
||||
LDFLAGS="$AM_LDFLAGS $trycaviumdir/api/obj/cavium_common.o $trycaviumdir/api/obj/cavium_sym_crypto.o $trycaviumdir/api/obj/cavium_asym_crypto.o"
|
||||
CPPFLAGS="$CPPFLAGS -I$trycaviumdir/include"
|
||||
|
||||
#AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cavium_common.h"]], [[ CspShutdown(0); ]])],[ cavium_linked=yes ],[ cavium_linked=no ])
|
||||
@@ -2657,6 +2860,8 @@ AC_ARG_WITH([cavium-v],
|
||||
if test "x$cavium_linked" == "xno" ; then
|
||||
AC_MSG_ERROR([cavium isn't found.
|
||||
If it's already installed, specify its path using --with-cavium-v=/dir/])
|
||||
else
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_CAVIUM -DHAVE_CAVIUM_V"
|
||||
fi
|
||||
AC_MSG_RESULT([yes])
|
||||
|
||||
@@ -2674,6 +2879,46 @@ AC_ARG_WITH([cavium-v],
|
||||
AM_CONDITIONAL([BUILD_CAVIUM], [test "x$ENABLED_CAVIUM" = "xyes"])
|
||||
|
||||
|
||||
# Intel Quick Assist
|
||||
tryqatdir=""
|
||||
AC_ARG_WITH([intelqa],
|
||||
[ --with-intelqa=PATH PATH to Intel QuickAssit (QAT) driver dir ],
|
||||
[
|
||||
AC_MSG_CHECKING([for intelqa])
|
||||
CPPFLAGS="$CPPFLAGS -DHAVE_INTEL_QA -DDO_CRYPTO -DUSER_SPACE"
|
||||
|
||||
if test "x$withval" == "xyes" ; then
|
||||
AC_MSG_ERROR([need a PATH for --with-intelqa])
|
||||
fi
|
||||
if test "x$withval" != "xno" ; then
|
||||
tryqatdir=$withval
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS -I$tryqatdir/quickassist/include -I$tryqatdir/quickassist/include/lac -I$tryqatdir/quickassist/utilities/osal/include -I$tryqatdir/quickassist/utilities/osal/src/linux/user_space/include -I$tryqatdir/quickassist/lookaside/access_layer/include -I$tryqatdir/quickassist/lookaside/access_layer/src/common/include -I$srcdir/wolfssl -I$srcdir/wolfssl/wolfcrypt/port/intel"
|
||||
LDFLAGS="$LDFLAGS -L$tryqatdir/build -Wl,-Map=output.map"
|
||||
LIBS="$LIBS -licp_qa_al_s"
|
||||
LIB_ADD="-ladf_proxy -losal -lrt $LIB_ADD"
|
||||
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cpa_cy_common.h"]], [[ Cpa16U count = 0; cpaCyGetNumInstances(&count); ]])],[ intelqa_linked=yes ],[ intelqa_linked=no ])
|
||||
|
||||
if test "x$intelqa_linked" == "xno" ; then
|
||||
AC_MSG_ERROR([Intel QuickAssist not found.
|
||||
If it's already installed, specify its path using --with-intelqa=/dir/])
|
||||
else
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_INTEL_QA -DDO_CRYPTO -DUSER_SPACE"
|
||||
fi
|
||||
AC_MSG_RESULT([yes])
|
||||
|
||||
ENABLED_INTEL_QA=yes
|
||||
],
|
||||
[
|
||||
ENABLED_INTEL_QA=no
|
||||
]
|
||||
)
|
||||
|
||||
AM_CONDITIONAL([BUILD_INTEL_QA], [test "x$ENABLED_INTEL_QA" = "xyes"])
|
||||
|
||||
|
||||
# Fast RSA using Intel IPP
|
||||
ippdir="${srcdir}/IPP"
|
||||
ipplib="lib" # if autoconf guesses 32bit system changes lib directory
|
||||
@@ -2850,7 +3095,12 @@ AC_ARG_ENABLE([mcapi],
|
||||
|
||||
if test "$ENABLED_MCAPI" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_MCAPI -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT"
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_MCAPI"
|
||||
if test "x$ENABLED_AESCTR" != "xyes"
|
||||
then
|
||||
# These flags are already implied by --enable-aesctr
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_SHA512" = "no"
|
||||
@@ -2873,18 +3123,19 @@ AM_CONDITIONAL([BUILD_MCAPI], [test "x$ENABLED_MCAPI" = "xyes"])
|
||||
|
||||
# Asynchronous Crypto
|
||||
AC_ARG_ENABLE([asynccrypt],
|
||||
[ --enable-asynccrypt Enable Asynchronous Crypto (default: disabled)],
|
||||
[ --enable-asynccrypt Enable Asynchronous Crypto (default: disabled)],
|
||||
[ ENABLED_ASYNCCRYPT=$enableval ],
|
||||
[ ENABLED_ASYNCCRYPT=no ]
|
||||
)
|
||||
|
||||
if test "$ENABLED_ASYNCCRYPT" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASYNC_CRYPT -DHAVE_WOLF_EVENT"
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASYNC_CRYPT -DHAVE_WOLF_EVENT -DHAVE_WOLF_BIGINT"
|
||||
|
||||
# if Cavium not enabled the use async simulator for testing
|
||||
if test "x$ENABLED_CAVIUM" = "xno"
|
||||
# if no async hardware then use simulator for testing
|
||||
if test "x$ENABLED_CAVIUM" = "xno" && test "x$ENABLED_INTEL_QA" = "xno"
|
||||
then
|
||||
# Async threading is Linux specific
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASYNC_CRYPT_TEST"
|
||||
fi
|
||||
fi
|
||||
@@ -2893,6 +3144,35 @@ AM_CONDITIONAL([BUILD_ASYNCCRYPT], [test "x$ENABLED_ASYNCCRYPT" = "xyes"])
|
||||
|
||||
AM_CONDITIONAL([BUILD_WOLFEVENT], [test "x$ENABLED_ASYNCCRYPT" = "xyes"])
|
||||
|
||||
# check for async if using Intel QuckAssist or Cavium
|
||||
if test "x$ENABLED_INTEL_QA" = "xyes" || test "x$ENABLED_CAVIUM" = "xyes" ; then
|
||||
if test "x$ENABLED_ASYNCCRYPT" = "xno" ; then
|
||||
AC_MSG_ERROR([Please enable enable asynchronous support using --enable-asynccrypt])
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Asynchronous threading
|
||||
AC_ARG_ENABLE([asyncthreads],
|
||||
[ --enable-asyncthreads Enable Asynchronous Threading (default: enabled)],
|
||||
[ ENABLED_ASYNCTHREADS=$enableval ],
|
||||
[ ENABLED_ASYNCTHREADS=yes ]
|
||||
)
|
||||
|
||||
if test "$ENABLED_ASYNCCRYPT" = "yes" && test "$ENABLED_ASYNCTHREADS" = "yes"
|
||||
then
|
||||
AX_PTHREAD([ENABLED_ASYNCTHREADS=yes],[ENABLED_ASYNCTHREADS=no])
|
||||
else
|
||||
ENABLED_ASYNCTHREADS=no
|
||||
fi
|
||||
|
||||
if test "$ENABLED_ASYNCTHREADS" = "yes"
|
||||
then
|
||||
LIB_ADD="-lpthread $LIB_ADD"
|
||||
AM_CFLAGS="$AM_CFLAGS -D_GNU_SOURCE"
|
||||
else
|
||||
AM_CFLAGS="$AM_CFLAGS -DWC_NO_ASYNC_THREADING"
|
||||
fi
|
||||
|
||||
|
||||
# Session Export
|
||||
@@ -2919,6 +3199,11 @@ AC_ARG_ENABLE([aeskeywrap],
|
||||
[ ENABLED_AESKEYWRAP=no ]
|
||||
)
|
||||
|
||||
if test "$ENABLED_WPAS" = "yes" && test "$ENABLED_FIPS" = "no"
|
||||
then
|
||||
ENABLED_AESKEYWRAP="yes"
|
||||
fi
|
||||
|
||||
if test "$ENABLED_AESKEYWRAP" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_AES_KEYWRAP -DWOLFSSL_AES_DIRECT"
|
||||
@@ -3137,6 +3422,7 @@ case $host_os in
|
||||
fi ;;
|
||||
esac
|
||||
|
||||
|
||||
# add user C_EXTRA_FLAGS back
|
||||
# For distro disable custom build options that interfere with symbol generation
|
||||
if test "$ENABLED_DISTRO" = "no"
|
||||
@@ -3145,6 +3431,8 @@ then
|
||||
fi
|
||||
OPTION_FLAGS="$USER_CFLAGS $USER_C_EXTRA_FLAGS $AM_CFLAGS"
|
||||
|
||||
|
||||
|
||||
CREATE_HEX_VERSION
|
||||
AC_SUBST([AM_CPPFLAGS])
|
||||
AC_SUBST([AM_CFLAGS])
|
||||
@@ -3251,7 +3539,7 @@ echo "#endif /* WOLFSSL_OPTIONS_H */" >> $OPTION_FILE
|
||||
echo "" >> $OPTION_FILE
|
||||
echo
|
||||
|
||||
#backwards compatability for those who have included options or version
|
||||
#backwards compatibility for those who have included options or version
|
||||
touch cyassl/options.h
|
||||
echo "/* cyassl options.h" > cyassl/options.h
|
||||
echo " * generated from wolfssl/options.h" >> cyassl/options.h
|
||||
@@ -3308,6 +3596,7 @@ echo " * AES: $ENABLED_AES"
|
||||
echo " * AES-NI: $ENABLED_AESNI"
|
||||
echo " * AES-GCM: $ENABLED_AESGCM"
|
||||
echo " * AES-CCM: $ENABLED_AESCCM"
|
||||
echo " * AES-CTR: $ENABLED_AESCTR"
|
||||
echo " * DES3: $ENABLED_DES3"
|
||||
echo " * IDEA: $ENABLED_IDEA"
|
||||
echo " * Camellia: $ENABLED_CAMELLIA"
|
||||
@@ -3351,12 +3640,15 @@ echo " * CODING: $ENABLED_CODING"
|
||||
echo " * MEMORY: $ENABLED_MEMORY"
|
||||
echo " * I/O POOL: $ENABLED_IOPOOL"
|
||||
echo " * LIGHTY: $ENABLED_LIGHTY"
|
||||
echo " * HAPROXY: $ENABLED_HAPROXY"
|
||||
echo " * STUNNEL: $ENABLED_STUNNEL"
|
||||
echo " * NGINX: $ENABLED_NGINX"
|
||||
echo " * ERROR_STRINGS: $ENABLED_ERROR_STRINGS"
|
||||
echo " * DTLS: $ENABLED_DTLS"
|
||||
echo " * SCTP: $ENABLED_SCTP"
|
||||
echo " * Old TLS Versions: $ENABLED_OLD_TLS"
|
||||
echo " * SSL version 3.0: $ENABLED_SSLV3"
|
||||
echo " * TLS v1.3: $ENABLED_TLS13"
|
||||
echo " * OCSP: $ENABLED_OCSP"
|
||||
echo " * OCSP Stapling: $ENABLED_CERTIFICATE_STATUS_REQUEST"
|
||||
echo " * OCSP Stapling v2: $ENABLED_CERTIFICATE_STATUS_REQUEST_V2"
|
||||
@@ -3391,6 +3683,8 @@ echo " * Async Crypto: $ENABLED_ASYNCCRYPT"
|
||||
echo " * Cavium: $ENABLED_CAVIUM"
|
||||
echo " * ARM ASM: $ENABLED_ARMASM"
|
||||
echo " * AES Key Wrap: $ENABLED_AESKEYWRAP"
|
||||
echo " * Write duplicate: $ENABLED_WRITEDUP"
|
||||
echo " * Intel Quick Assist: $ENABLED_INTEL_QA"
|
||||
echo ""
|
||||
echo "---"
|
||||
|
||||
|
@@ -246,7 +246,7 @@
|
||||
|
||||
/* Micrium will use Visual Studio for compilation but not the Win32 API */
|
||||
#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) \
|
||||
&& !defined(EBSNET) && !defined(CYASSL_EROAD)
|
||||
&& !defined(EBSNET) && !defined(CYASSL_EROAD) && !defined(INTIME_RTOS)
|
||||
#define USE_WINDOWS_API
|
||||
#endif
|
||||
|
||||
|
@@ -32,6 +32,7 @@ nobase_include_HEADERS+= \
|
||||
cyassl/openssl/rand.h \
|
||||
cyassl/openssl/rsa.h \
|
||||
cyassl/openssl/sha.h \
|
||||
cyassl/openssl/ssl23.h \
|
||||
cyassl/openssl/ssl.h \
|
||||
cyassl/openssl/stack.h \
|
||||
cyassl/openssl/ui.h \
|
||||
|
3
cyassl/openssl/ssl23.h
Normal file
3
cyassl/openssl/ssl23.h
Normal file
@@ -0,0 +1,3 @@
|
||||
/* ssl23.h for openssl */
|
||||
|
||||
#include <wolfssl/openssl/sssl23.h>
|
File diff suppressed because it is too large
Load Diff
@@ -23,7 +23,7 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <cyassl/ctaocrypt/settings.h>
|
||||
|
||||
/* let's use cyassl layer AND cyassl openssl layer */
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#if !defined(WOLFSSL_MDK_ARM)
|
||||
#include "cmsis_os.h"
|
||||
#include "cmsis_os.h"
|
||||
#include "rl_net.h"
|
||||
#else
|
||||
#include "rtl.h"
|
||||
@@ -81,16 +81,17 @@ void echoclient_test(void* args)
|
||||
int argc = 0;
|
||||
char** argv = 0;
|
||||
word16 port = yasslPort;
|
||||
char buffer[CYASSL_MAX_ERROR_SZ];
|
||||
|
||||
((func_args*)args)->return_code = -1; /* error state */
|
||||
|
||||
|
||||
#ifndef WOLFSSL_MDK_SHELL
|
||||
argc = ((func_args*)args)->argc;
|
||||
argv = ((func_args*)args)->argv;
|
||||
#endif
|
||||
|
||||
if (argc >= 2) {
|
||||
fin = fopen(argv[1], "r");
|
||||
fin = fopen(argv[1], "r");
|
||||
inCreated = 1;
|
||||
}
|
||||
if (argc >= 3) {
|
||||
@@ -105,7 +106,7 @@ void echoclient_test(void* args)
|
||||
doDTLS = 1;
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_LEANPSK
|
||||
#ifdef CYASSL_LEANPSK
|
||||
doPSK = 1;
|
||||
#endif
|
||||
|
||||
@@ -130,16 +131,16 @@ void echoclient_test(void* args)
|
||||
|
||||
#ifndef NO_FILESYSTEM
|
||||
#ifndef NO_RSA
|
||||
if (SSL_CTX_load_verify_locations(ctx, caCert, 0) != SSL_SUCCESS)
|
||||
if (SSL_CTX_load_verify_locations(ctx, caCertFile, 0) != SSL_SUCCESS)
|
||||
err_sys("can't load ca file, Please run from wolfSSL home dir");
|
||||
#endif
|
||||
#ifdef HAVE_ECC
|
||||
if (SSL_CTX_load_verify_locations(ctx, eccCert, 0) != SSL_SUCCESS)
|
||||
if (SSL_CTX_load_verify_locations(ctx, eccCertFile, 0) != SSL_SUCCESS)
|
||||
err_sys("can't load ca file, Please run from wolfSSL home dir");
|
||||
#endif
|
||||
#elif !defined(NO_CERTS)
|
||||
if (!doPSK)
|
||||
load_buffer(ctx, caCert, WOLFSSL_CA);
|
||||
load_buffer(ctx, caCertFile, WOLFSSL_CA);
|
||||
#endif
|
||||
|
||||
#if defined(CYASSL_SNIFFER)
|
||||
@@ -173,15 +174,15 @@ void echoclient_test(void* args)
|
||||
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
ret = wolfAsync_DevOpen(&devId);
|
||||
if (ret != 0) {
|
||||
err_sys("Async device open failed");
|
||||
if (ret < 0) {
|
||||
printf("Async device open failed\nRunning without async\n");
|
||||
}
|
||||
wolfSSL_CTX_UseAsync(ctx, devId);
|
||||
#endif /* WOLFSSL_ASYNC_CRYPT */
|
||||
|
||||
ssl = SSL_new(ctx);
|
||||
tcp_connect(&sockfd, yasslIP, port, doDTLS, 0, ssl);
|
||||
|
||||
|
||||
SSL_set_fd(ssl, sockfd);
|
||||
#if defined(USE_WINDOWS_API) && defined(CYASSL_DTLS) && defined(NO_MAIN_DRIVER)
|
||||
/* let echoserver bind first, TODO: add Windows signal like pthreads does */
|
||||
@@ -189,31 +190,46 @@ void echoclient_test(void* args)
|
||||
#endif
|
||||
|
||||
do {
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) { break; } else if (ret == 0) { continue; }
|
||||
}
|
||||
#endif
|
||||
err = 0; /* Reset error */
|
||||
ret = SSL_connect(ssl);
|
||||
if (ret != SSL_SUCCESS) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (ret != SSL_SUCCESS && err == WC_PENDING_E);
|
||||
|
||||
} while (err == WC_PENDING_E);
|
||||
if (ret != SSL_SUCCESS) {
|
||||
char buffer[CYASSL_MAX_ERROR_SZ];
|
||||
printf("err = %d, %s\n", err, ERR_error_string(err, buffer));
|
||||
printf("SSL_connect error %d, %s\n", err,
|
||||
ERR_error_string(err, buffer));
|
||||
err_sys("SSL_connect failed");
|
||||
}
|
||||
|
||||
while (fgets(msg, sizeof(msg), fin) != 0) {
|
||||
|
||||
|
||||
sendSz = (int)XSTRLEN(msg);
|
||||
|
||||
if (SSL_write(ssl, msg, sendSz) != sendSz)
|
||||
do {
|
||||
err = 0; /* reset error */
|
||||
ret = SSL_write(ssl, msg, sendSz);
|
||||
if (ret <= 0) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
if (ret != sendSz) {
|
||||
printf("SSL_write msg error %d, %s\n", err,
|
||||
ERR_error_string(err, buffer));
|
||||
err_sys("SSL_write failed");
|
||||
}
|
||||
|
||||
if (strncmp(msg, "quit", 4) == 0) {
|
||||
fputs("sending server shutdown command: quit!\n", fout);
|
||||
@@ -225,29 +241,39 @@ void echoclient_test(void* args)
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef WOLFSSL_MDK_SHELL
|
||||
while (sendSz) {
|
||||
int got;
|
||||
if ( (got = SSL_read(ssl, reply, sizeof(reply)-1)) > 0) {
|
||||
reply[got] = 0;
|
||||
fputs(reply, fout);
|
||||
fflush(fout) ;
|
||||
sendSz -= got;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
#else
|
||||
#ifndef WOLFSSL_MDK_SHELL
|
||||
while (sendSz)
|
||||
#endif
|
||||
{
|
||||
int got;
|
||||
if ( (got = SSL_read(ssl, reply, sizeof(reply)-1)) > 0) {
|
||||
reply[got] = 0;
|
||||
do {
|
||||
err = 0; /* reset error */
|
||||
ret = SSL_read(ssl, reply, sizeof(reply)-1);
|
||||
if (ret <= 0) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
if (ret > 0) {
|
||||
reply[ret] = 0;
|
||||
fputs(reply, fout);
|
||||
fflush(fout) ;
|
||||
sendSz -= got;
|
||||
sendSz -= ret;
|
||||
}
|
||||
else {
|
||||
printf("SSL_read msg error %d, %s\n", err,
|
||||
ERR_error_string(err, buffer));
|
||||
err_sys("SSL_read failed");
|
||||
|
||||
#ifndef WOLFSSL_MDK_SHELL
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -255,7 +281,19 @@ void echoclient_test(void* args)
|
||||
strncpy(msg, "break", 6);
|
||||
sendSz = (int)strlen(msg);
|
||||
/* try to tell server done */
|
||||
SSL_write(ssl, msg, sendSz);
|
||||
do {
|
||||
err = 0; /* reset error */
|
||||
ret = SSL_write(ssl, msg, sendSz);
|
||||
if (ret <= 0) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
#else
|
||||
SSL_shutdown(ssl);
|
||||
#endif
|
||||
@@ -272,7 +310,7 @@ void echoclient_test(void* args)
|
||||
if (outCreated) fclose(fout);
|
||||
|
||||
CloseSocket(sockfd);
|
||||
((func_args*)args)->return_code = 0;
|
||||
((func_args*)args)->return_code = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -311,7 +349,7 @@ void echoclient_test(void* args)
|
||||
|
||||
return args.return_code;
|
||||
}
|
||||
|
||||
|
||||
#endif /* NO_MAIN_DRIVER */
|
||||
|
||||
|
||||
|
@@ -36,8 +36,8 @@
|
||||
|
||||
#if !defined(WOLFSSL_MDK_ARM)
|
||||
#include "cmsis_os.h"
|
||||
#include "rl_fs.h"
|
||||
#include "rl_net.h"
|
||||
#include "rl_fs.h"
|
||||
#include "rl_net.h"
|
||||
#else
|
||||
#include "rtl.h"
|
||||
#include "wolfssl_MDK_ARM.h"
|
||||
@@ -91,6 +91,7 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
word16 port;
|
||||
int argc = ((func_args*)args)->argc;
|
||||
char** argv = ((func_args*)args)->argv;
|
||||
char buffer[CYASSL_MAX_ERROR_SZ];
|
||||
|
||||
#ifdef ECHO_OUT
|
||||
FILE* fout = stdout;
|
||||
@@ -165,23 +166,23 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
if (doPSK == 0) {
|
||||
#if defined(HAVE_NTRU) && defined(WOLFSSL_STATIC_RSA)
|
||||
/* ntru */
|
||||
if (CyaSSL_CTX_use_certificate_file(ctx, ntruCert, SSL_FILETYPE_PEM)
|
||||
if (CyaSSL_CTX_use_certificate_file(ctx, ntruCertFile, SSL_FILETYPE_PEM)
|
||||
!= SSL_SUCCESS)
|
||||
err_sys("can't load ntru cert file, "
|
||||
"Please run from wolfSSL home dir");
|
||||
|
||||
if (CyaSSL_CTX_use_NTRUPrivateKey_file(ctx, ntruKey)
|
||||
if (CyaSSL_CTX_use_NTRUPrivateKey_file(ctx, ntruKeyFile)
|
||||
!= SSL_SUCCESS)
|
||||
err_sys("can't load ntru key file, "
|
||||
"Please run from wolfSSL home dir");
|
||||
#elif defined(HAVE_ECC) && !defined(CYASSL_SNIFFER)
|
||||
/* ecc */
|
||||
if (CyaSSL_CTX_use_certificate_file(ctx, eccCert, SSL_FILETYPE_PEM)
|
||||
if (CyaSSL_CTX_use_certificate_file(ctx, eccCertFile, SSL_FILETYPE_PEM)
|
||||
!= SSL_SUCCESS)
|
||||
err_sys("can't load server cert file, "
|
||||
"Please run from wolfSSL home dir");
|
||||
|
||||
if (CyaSSL_CTX_use_PrivateKey_file(ctx, eccKey, SSL_FILETYPE_PEM)
|
||||
if (CyaSSL_CTX_use_PrivateKey_file(ctx, eccKeyFile, SSL_FILETYPE_PEM)
|
||||
!= SSL_SUCCESS)
|
||||
err_sys("can't load server key file, "
|
||||
"Please run from wolfSSL home dir");
|
||||
@@ -189,12 +190,12 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
/* do nothing, just don't load cert files */
|
||||
#else
|
||||
/* normal */
|
||||
if (CyaSSL_CTX_use_certificate_file(ctx, svrCert, SSL_FILETYPE_PEM)
|
||||
if (CyaSSL_CTX_use_certificate_file(ctx, svrCertFile, SSL_FILETYPE_PEM)
|
||||
!= SSL_SUCCESS)
|
||||
err_sys("can't load server cert file, "
|
||||
"Please run from wolfSSL home dir");
|
||||
|
||||
if (CyaSSL_CTX_use_PrivateKey_file(ctx, svrKey, SSL_FILETYPE_PEM)
|
||||
if (CyaSSL_CTX_use_PrivateKey_file(ctx, svrKeyFile, SSL_FILETYPE_PEM)
|
||||
!= SSL_SUCCESS)
|
||||
err_sys("can't load server key file, "
|
||||
"Please run from wolfSSL home dir");
|
||||
@@ -202,8 +203,8 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
} /* doPSK */
|
||||
#elif !defined(NO_CERTS)
|
||||
if (!doPSK) {
|
||||
load_buffer(ctx, svrCert, WOLFSSL_CERT);
|
||||
load_buffer(ctx, svrKey, WOLFSSL_KEY);
|
||||
load_buffer(ctx, svrCertFile, WOLFSSL_CERT);
|
||||
load_buffer(ctx, svrKeyFile, WOLFSSL_KEY);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -232,8 +233,8 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
ret = wolfAsync_DevOpen(&devId);
|
||||
if (ret != 0) {
|
||||
err_sys("Async device open failed");
|
||||
if (ret < 0) {
|
||||
printf("Async device open failed\nRunning without async\n");
|
||||
}
|
||||
wolfSSL_CTX_UseAsync(ctx, devId);
|
||||
#endif /* WOLFSSL_ASYNC_CRYPT */
|
||||
@@ -241,7 +242,8 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
SignalReady(args, port);
|
||||
|
||||
while (!shutDown) {
|
||||
CYASSL* ssl = 0;
|
||||
CYASSL* ssl = NULL;
|
||||
CYASSL* write_ssl = NULL; /* may have separate w/ HAVE_WRITE_DUP */
|
||||
char command[SVR_COMMAND_SIZE+1];
|
||||
int echoSz = 0;
|
||||
int clientfd;
|
||||
@@ -276,29 +278,27 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
wolfSSL_dtls_set_peer(ssl, &client, client_len);
|
||||
#endif
|
||||
#if !defined(NO_FILESYSTEM) && !defined(NO_DH) && !defined(NO_ASN)
|
||||
CyaSSL_SetTmpDH_file(ssl, dhParam, SSL_FILETYPE_PEM);
|
||||
CyaSSL_SetTmpDH_file(ssl, dhParamFile, SSL_FILETYPE_PEM);
|
||||
#elif !defined(NO_DH)
|
||||
SetDH(ssl); /* will repick suites with DHE, higher than PSK */
|
||||
#endif
|
||||
|
||||
do {
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) { break; } else if (ret == 0) { continue; }
|
||||
}
|
||||
#endif
|
||||
err = 0; /* Reset error */
|
||||
ret = CyaSSL_accept(ssl);
|
||||
if (ret != SSL_SUCCESS) {
|
||||
err = CyaSSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (ret != SSL_SUCCESS && err == WC_PENDING_E);
|
||||
|
||||
} while (err == WC_PENDING_E);
|
||||
if (ret != SSL_SUCCESS) {
|
||||
char buffer[CYASSL_MAX_ERROR_SZ];
|
||||
err = CyaSSL_get_error(ssl, 0);
|
||||
printf("error = %d, %s\n", err, CyaSSL_ERR_error_string(err, buffer));
|
||||
printf("SSL_accept error = %d, %s\n", err,
|
||||
CyaSSL_ERR_error_string(err, buffer));
|
||||
printf("SSL_accept failed\n");
|
||||
CyaSSL_free(ssl);
|
||||
CloseSocket(clientfd);
|
||||
@@ -308,7 +308,41 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
showPeer(ssl);
|
||||
#endif
|
||||
|
||||
while ( (echoSz = CyaSSL_read(ssl, command, sizeof(command)-1)) > 0) {
|
||||
#ifdef HAVE_WRITE_DUP
|
||||
write_ssl = wolfSSL_write_dup(ssl);
|
||||
if (write_ssl == NULL) {
|
||||
printf("wolfSSL_write_dup failed\n");
|
||||
CyaSSL_free(ssl);
|
||||
CloseSocket(clientfd);
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
write_ssl = ssl;
|
||||
#endif
|
||||
|
||||
while (1) {
|
||||
do {
|
||||
err = 0; /* reset error */
|
||||
ret = CyaSSL_read(ssl, command, sizeof(command)-1);
|
||||
if (ret <= 0) {
|
||||
err = CyaSSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
if (ret <= 0) {
|
||||
if (err != SSL_ERROR_WANT_READ) {
|
||||
printf("SSL_read echo error %d, %s!\n", err,
|
||||
CyaSSL_ERR_error_string(err, buffer));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
echoSz = ret;
|
||||
|
||||
if (firstRead == 1) {
|
||||
firstRead = 0; /* browser may send 1 byte 'G' to start */
|
||||
@@ -321,7 +355,7 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
strncpy(command, "GET", 4);
|
||||
/* fall through to normal GET */
|
||||
}
|
||||
|
||||
|
||||
if ( strncmp(command, "quit", 4) == 0) {
|
||||
printf("client sent quit command: shutting down!\n");
|
||||
shutDown = 1;
|
||||
@@ -343,7 +377,7 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
char header[] = "<html><body BGCOLOR=\"#ffffff\">\n<pre>\n";
|
||||
char body[] = "greetings from wolfSSL\n";
|
||||
char footer[] = "</body></html>\r\n\r\n";
|
||||
|
||||
|
||||
strncpy(command, type, sizeof(type));
|
||||
echoSz = sizeof(type) - 1;
|
||||
|
||||
@@ -354,21 +388,57 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
strncpy(&command[echoSz], footer, sizeof(footer));
|
||||
echoSz += (int)sizeof(footer);
|
||||
|
||||
if (CyaSSL_write(ssl, command, echoSz) != echoSz)
|
||||
err_sys("SSL_write failed");
|
||||
do {
|
||||
err = 0; /* reset error */
|
||||
ret = CyaSSL_write(write_ssl, command, echoSz);
|
||||
if (ret <= 0) {
|
||||
err = CyaSSL_get_error(write_ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
ret = wolfSSL_AsyncPoll(write_ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
if (ret != echoSz) {
|
||||
printf("SSL_write get error = %d, %s\n", err,
|
||||
CyaSSL_ERR_error_string(err, buffer));
|
||||
err_sys("SSL_write get failed");
|
||||
}
|
||||
break;
|
||||
}
|
||||
command[echoSz] = 0;
|
||||
|
||||
#ifdef ECHO_OUT
|
||||
fputs(command, fout);
|
||||
#endif
|
||||
#ifdef ECHO_OUT
|
||||
fputs(command, fout);
|
||||
#endif
|
||||
|
||||
if (CyaSSL_write(ssl, command, echoSz) != echoSz)
|
||||
err_sys("SSL_write failed");
|
||||
do {
|
||||
err = 0; /* reset error */
|
||||
ret = CyaSSL_write(write_ssl, command, echoSz);
|
||||
if (ret <= 0) {
|
||||
err = CyaSSL_get_error(write_ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
ret = wolfSSL_AsyncPoll(write_ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
|
||||
if (ret != echoSz) {
|
||||
printf("SSL_write echo error = %d, %s\n", err,
|
||||
CyaSSL_ERR_error_string(err, buffer));
|
||||
err_sys("SSL_write echo failed");
|
||||
}
|
||||
}
|
||||
#ifndef CYASSL_DTLS
|
||||
CyaSSL_shutdown(ssl);
|
||||
#endif
|
||||
#ifdef HAVE_WRITE_DUP
|
||||
CyaSSL_free(write_ssl);
|
||||
#endif
|
||||
CyaSSL_free(ssl);
|
||||
CloseSocket(clientfd);
|
||||
@@ -445,7 +515,7 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
return args.return_code;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif /* NO_MAIN_DRIVER */
|
||||
|
||||
|
||||
|
@@ -30,11 +30,6 @@
|
||||
#include <cyassl/ctaocrypt/ecc.h> /* ecc_fp_free */
|
||||
#endif
|
||||
|
||||
#if !defined(WOLFSSL_TRACK_MEMORY) && !defined(NO_MAIN_DRIVER)
|
||||
/* in case memory tracker wants stats */
|
||||
#define WOLFSSL_TRACK_MEMORY
|
||||
#endif
|
||||
|
||||
#if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET)
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -74,7 +69,19 @@
|
||||
int myHsDoneCb(WOLFSSL* ssl, void* user_ctx);
|
||||
#endif
|
||||
|
||||
|
||||
static const char webServerMsg[] =
|
||||
"HTTP/1.1 200 OK\n"
|
||||
"Content-Type: text/html\n"
|
||||
"Connection: close\n"
|
||||
"\n"
|
||||
"<html>\n"
|
||||
"<head>\n"
|
||||
"<title>Welcome to wolfSSL!</title>\n"
|
||||
"</head>\n"
|
||||
"<body>\n"
|
||||
"<p>wolfSSL has successfully performed handshake!</p>\n"
|
||||
"</body>\n"
|
||||
"</html>\n";
|
||||
|
||||
static int NonBlockingSSL_Accept(SSL* ssl)
|
||||
{
|
||||
@@ -85,25 +92,35 @@ static int NonBlockingSSL_Accept(SSL* ssl)
|
||||
#endif
|
||||
int error = SSL_get_error(ssl, 0);
|
||||
SOCKET_T sockfd = (SOCKET_T)CyaSSL_get_fd(ssl);
|
||||
int select_ret;
|
||||
int select_ret = 0;
|
||||
|
||||
while (ret != SSL_SUCCESS && (error == SSL_ERROR_WANT_READ ||
|
||||
error == SSL_ERROR_WANT_WRITE)) {
|
||||
error == SSL_ERROR_WANT_WRITE ||
|
||||
error == WC_PENDING_E)) {
|
||||
int currTimeout = 1;
|
||||
|
||||
if (error == SSL_ERROR_WANT_READ) {
|
||||
/* printf("... server would read block\n"); */
|
||||
} else {
|
||||
}
|
||||
else if (error == SSL_ERROR_WANT_WRITE) {
|
||||
/* printf("... server would write block\n"); */
|
||||
}
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
else if (error == WC_PENDING_E) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_DTLS
|
||||
currTimeout = CyaSSL_dtls_get_current_timeout(ssl);
|
||||
#endif
|
||||
select_ret = tcp_select(sockfd, currTimeout);
|
||||
if (error != WC_PENDING_E) {
|
||||
#ifdef CYASSL_DTLS
|
||||
currTimeout = CyaSSL_dtls_get_current_timeout(ssl);
|
||||
#endif
|
||||
select_ret = tcp_select(sockfd, currTimeout);
|
||||
}
|
||||
|
||||
if ((select_ret == TEST_RECV_READY) ||
|
||||
(select_ret == TEST_ERROR_READY)) {
|
||||
(select_ret == TEST_ERROR_READY) || error == WC_PENDING_E) {
|
||||
#ifndef CYASSL_CALLBACKS
|
||||
ret = SSL_accept(ssl);
|
||||
#else
|
||||
@@ -115,12 +132,12 @@ static int NonBlockingSSL_Accept(SSL* ssl)
|
||||
else if (select_ret == TEST_TIMEOUT && !CyaSSL_dtls(ssl)) {
|
||||
error = SSL_ERROR_WANT_READ;
|
||||
}
|
||||
#ifdef CYASSL_DTLS
|
||||
#ifdef CYASSL_DTLS
|
||||
else if (select_ret == TEST_TIMEOUT && CyaSSL_dtls(ssl) &&
|
||||
CyaSSL_dtls_got_timeout(ssl) >= 0) {
|
||||
error = SSL_ERROR_WANT_READ;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
else {
|
||||
error = SSL_FATAL_ERROR;
|
||||
}
|
||||
@@ -132,60 +149,92 @@ static int NonBlockingSSL_Accept(SSL* ssl)
|
||||
/* Echo number of bytes specified by -e arg */
|
||||
int ServerEchoData(SSL* ssl, int clientfd, int echoData, int throughput)
|
||||
{
|
||||
int ret = 0;
|
||||
char* buffer = (char*)malloc(TEST_BUFFER_SIZE);
|
||||
if(buffer) {
|
||||
double start = 0, rx_time = 0, tx_time = 0;
|
||||
int xfer_bytes = 0;
|
||||
while((echoData && throughput == 0) || (!echoData && xfer_bytes < throughput)) {
|
||||
int select_ret = tcp_select(clientfd, 1); /* Timeout=1 second */
|
||||
if (select_ret == TEST_RECV_READY) {
|
||||
int len = min(TEST_BUFFER_SIZE, throughput - xfer_bytes);
|
||||
int rx_pos = 0;
|
||||
if(throughput) {
|
||||
start = current_time(1);
|
||||
}
|
||||
while(rx_pos < len) {
|
||||
ret = SSL_read(ssl, &buffer[rx_pos], len - rx_pos);
|
||||
if (ret <= 0) {
|
||||
int readErr = SSL_get_error(ssl, 0);
|
||||
if (readErr != SSL_ERROR_WANT_READ) {
|
||||
printf("SSL_read error %d!\n", readErr);
|
||||
err_sys("SSL_read failed");
|
||||
}
|
||||
}
|
||||
else {
|
||||
rx_pos += ret;
|
||||
}
|
||||
}
|
||||
if(throughput) {
|
||||
rx_time += current_time(0) - start;
|
||||
start = current_time(1);
|
||||
}
|
||||
if (SSL_write(ssl, buffer, len) != len) {
|
||||
err_sys("SSL_write failed");
|
||||
}
|
||||
if(throughput) {
|
||||
tx_time += current_time(0) - start;
|
||||
}
|
||||
int ret = 0, err;
|
||||
double start = 0, rx_time = 0, tx_time = 0;
|
||||
int xfer_bytes = 0, select_ret, len, rx_pos;
|
||||
char* buffer;
|
||||
|
||||
xfer_bytes += len;
|
||||
buffer = (char*)malloc(TEST_BUFFER_SIZE);
|
||||
if (!buffer) {
|
||||
err_sys("Server buffer malloc failed");
|
||||
}
|
||||
|
||||
while ((echoData && throughput == 0) ||
|
||||
(!echoData && xfer_bytes < throughput))
|
||||
{
|
||||
select_ret = tcp_select(clientfd, 1); /* Timeout=1 second */
|
||||
if (select_ret == TEST_RECV_READY) {
|
||||
|
||||
len = min(TEST_BUFFER_SIZE, throughput - xfer_bytes);
|
||||
rx_pos = 0;
|
||||
|
||||
if (throughput) {
|
||||
start = current_time(1);
|
||||
}
|
||||
}
|
||||
free(buffer);
|
||||
|
||||
if(throughput) {
|
||||
printf("wolfSSL Server Benchmark %d bytes\n"
|
||||
"\tRX %8.3f ms (%8.3f MBps)\n"
|
||||
"\tTX %8.3f ms (%8.3f MBps)\n",
|
||||
throughput,
|
||||
tx_time * 1000, throughput / tx_time / 1024 / 1024,
|
||||
rx_time * 1000, throughput / rx_time / 1024 / 1024
|
||||
);
|
||||
/* Read data */
|
||||
while (rx_pos < len) {
|
||||
ret = SSL_read(ssl, &buffer[rx_pos], len - rx_pos);
|
||||
if (ret < 0) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (err != SSL_ERROR_WANT_READ) {
|
||||
printf("SSL_read echo error %d\n", err);
|
||||
err_sys("SSL_read failed");
|
||||
}
|
||||
}
|
||||
else {
|
||||
rx_pos += ret;
|
||||
}
|
||||
}
|
||||
if (throughput) {
|
||||
rx_time += current_time(0) - start;
|
||||
start = current_time(1);
|
||||
}
|
||||
|
||||
/* Write data */
|
||||
do {
|
||||
err = 0; /* reset error */
|
||||
ret = SSL_write(ssl, buffer, len);
|
||||
if (ret <= 0) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
if (ret != len) {
|
||||
printf("SSL_write echo error %d\n", err);
|
||||
err_sys("SSL_write failed");
|
||||
}
|
||||
|
||||
if (throughput) {
|
||||
tx_time += current_time(0) - start;
|
||||
}
|
||||
|
||||
xfer_bytes += len;
|
||||
}
|
||||
}
|
||||
else {
|
||||
err_sys("Server buffer malloc failed");
|
||||
|
||||
free(buffer);
|
||||
|
||||
if (throughput) {
|
||||
printf("wolfSSL Server Benchmark %d bytes\n"
|
||||
"\tRX %8.3f ms (%8.3f MBps)\n"
|
||||
"\tTX %8.3f ms (%8.3f MBps)\n",
|
||||
throughput,
|
||||
tx_time * 1000, throughput / tx_time / 1024 / 1024,
|
||||
rx_time * 1000, throughput / rx_time / 1024 / 1024
|
||||
);
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
@@ -201,12 +250,12 @@ static void Usage(void)
|
||||
printf("-v <num> SSL version [0-3], SSLv3(0) - TLS1.2(3)), default %d\n",
|
||||
SERVER_DEFAULT_VERSION);
|
||||
printf("-l <str> Cipher suite list (: delimited)\n");
|
||||
printf("-c <file> Certificate file, default %s\n", svrCert);
|
||||
printf("-k <file> Key file, default %s\n", svrKey);
|
||||
printf("-A <file> Certificate Authority file, default %s\n", cliCert);
|
||||
printf("-c <file> Certificate file, default %s\n", svrCertFile);
|
||||
printf("-k <file> Key file, default %s\n", svrKeyFile);
|
||||
printf("-A <file> Certificate Authority file, default %s\n", cliCertFile);
|
||||
printf("-R <file> Create Ready file for external monitor default none\n");
|
||||
#ifndef NO_DH
|
||||
printf("-D <file> Diffie-Hellman Params file, default %s\n", dhParam);
|
||||
printf("-D <file> Diffie-Hellman Params file, default %s\n", dhParamFile);
|
||||
printf("-Z <num> Minimum DH key bits, default %d\n",
|
||||
DEFAULT_MIN_DHKEY_BITS);
|
||||
#endif
|
||||
@@ -252,6 +301,13 @@ static void Usage(void)
|
||||
#endif
|
||||
#ifdef HAVE_WNR
|
||||
printf("-q <file> Whitewood config file, default %s\n", wnrConfig);
|
||||
#endif
|
||||
printf("-g Return basic HTML web page\n");
|
||||
printf("-C <num> The number of connections to accept, default: 1\n");
|
||||
printf("-H Force use of the default cipher suite list\n");
|
||||
#ifdef WOLFSSL_TLS13
|
||||
printf("-K Key Exchange for PSK not using (EC)DHE\n");
|
||||
printf("-U Update keys and IVs before sending\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -269,6 +325,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
#else
|
||||
const char msg[] = "I hear you fa shizzle!\n";
|
||||
#endif
|
||||
int useWebServerMsg = 0;
|
||||
char input[80];
|
||||
int ch;
|
||||
int version = SERVER_DEFAULT_VERSION;
|
||||
@@ -284,13 +341,12 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
int needDH = 0;
|
||||
int useNtruKey = 0;
|
||||
int nonBlocking = 0;
|
||||
int trackMemory = 0;
|
||||
int fewerPackets = 0;
|
||||
int pkCallbacks = 0;
|
||||
int wc_shutdown = 0;
|
||||
int resume = 0;
|
||||
int resumeCount = 0;
|
||||
int loopIndefinitely = 0;
|
||||
int loops = 1;
|
||||
int echoData = 0;
|
||||
int throughput = 0;
|
||||
int minDhKeyBits = DEFAULT_MIN_DHKEY_BITS;
|
||||
@@ -304,10 +360,11 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
char* alpnList = NULL;
|
||||
unsigned char alpn_opt = 0;
|
||||
char* cipherList = NULL;
|
||||
const char* verifyCert = cliCert;
|
||||
const char* ourCert = svrCert;
|
||||
const char* ourKey = svrKey;
|
||||
const char* ourDhParam = dhParam;
|
||||
int useDefCipherList = 0;
|
||||
const char* verifyCert = cliCertFile;
|
||||
const char* ourCert = svrCertFile;
|
||||
const char* ourKey = svrKeyFile;
|
||||
const char* ourDhParam = dhParamFile;
|
||||
tcp_ready* readySignal = NULL;
|
||||
int argc = ((func_args*)args)->argc;
|
||||
char** argv = ((func_args*)args)->argv;
|
||||
@@ -332,6 +389,11 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
#ifdef HAVE_WNR
|
||||
const char* wnrConfigFile = wnrConfig;
|
||||
#endif
|
||||
char buffer[CYASSL_MAX_ERROR_SZ];
|
||||
#ifdef WOLFSSL_TLS13
|
||||
int noPskDheKe = 0;
|
||||
#endif
|
||||
int updateKeysIVs = 0;
|
||||
|
||||
#ifdef WOLFSSL_STATIC_MEMORY
|
||||
#if (defined(HAVE_ECC) && !defined(ALT_ECC_SIZE)) \
|
||||
@@ -348,9 +410,9 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
((func_args*)args)->return_code = -1; /* error state */
|
||||
|
||||
#ifdef NO_RSA
|
||||
verifyCert = (char*)cliEccCert;
|
||||
ourCert = (char*)eccCert;
|
||||
ourKey = (char*)eccKey;
|
||||
verifyCert = (char*)cliEccCertFile;
|
||||
ourCert = (char*)eccCertFile;
|
||||
ourKey = (char*)eccKeyFile;
|
||||
#endif
|
||||
(void)pkCallbacks;
|
||||
(void)needDH;
|
||||
@@ -367,6 +429,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
(void)alpn_opt;
|
||||
(void)crlFlags;
|
||||
(void)readySignal;
|
||||
(void)updateKeysIVs;
|
||||
|
||||
#ifdef CYASSL_TIRTOS
|
||||
fdOpenSession(Task_self());
|
||||
@@ -375,8 +438,10 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
#ifdef WOLFSSL_VXWORKS
|
||||
useAnyAddr = 1;
|
||||
#else
|
||||
while ((ch = mygetopt(argc, argv,
|
||||
"?jdbstnNuGfrawPIR:p:v:l:A:c:k:Z:S:oO:D:L:ieB:E:q:")) != -1) {
|
||||
/* Not Used: h, m, t, x, y, z, F, J, M, Q, T, V, W, X, Y */
|
||||
while ((ch = mygetopt(argc, argv, "?"
|
||||
"abc:defgijk:l:nop:q:rsuv:w"
|
||||
"A:B:C:D:E:GHIKL:NO:PR:S:UYZ:")) != -1) {
|
||||
switch (ch) {
|
||||
case '?' :
|
||||
Usage();
|
||||
@@ -398,12 +463,6 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
usePskPlus = 1;
|
||||
break;
|
||||
|
||||
case 't' :
|
||||
#ifdef USE_WOLFSSL_MEMORY
|
||||
trackMemory = 1;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'n' :
|
||||
useNtruKey = 1;
|
||||
break;
|
||||
@@ -450,7 +509,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
|
||||
case 'v' :
|
||||
version = atoi(myoptarg);
|
||||
if (version < 0 || version > 3) {
|
||||
if (version < 0 || version > 4) {
|
||||
Usage();
|
||||
exit(MY_EX_USAGE);
|
||||
}
|
||||
@@ -460,6 +519,10 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
cipherList = myoptarg;
|
||||
break;
|
||||
|
||||
case 'H' :
|
||||
useDefCipherList = 1;
|
||||
break;
|
||||
|
||||
case 'A' :
|
||||
verifyCert = myoptarg;
|
||||
break;
|
||||
@@ -541,7 +604,15 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
break;
|
||||
|
||||
case 'i' :
|
||||
loopIndefinitely = 1;
|
||||
loops = -1;
|
||||
break;
|
||||
|
||||
case 'C' :
|
||||
loops = atoi(myoptarg);
|
||||
if (loops <= 0) {
|
||||
Usage();
|
||||
exit(MY_EX_USAGE);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'e' :
|
||||
@@ -568,6 +639,22 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'g' :
|
||||
useWebServerMsg = 1;
|
||||
break;
|
||||
|
||||
case 'K' :
|
||||
#ifdef WOLFSSL_TLS13
|
||||
noPskDheKe = 1;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'U' :
|
||||
#ifdef WOLFSSL_TLS13
|
||||
updateKeysIVs = 1;
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
Usage();
|
||||
exit(MY_EX_USAGE);
|
||||
@@ -598,11 +685,6 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(USE_CYASSL_MEMORY) && !defined(WOLFSSL_STATIC_MEMORY)
|
||||
if (trackMemory)
|
||||
InitMemoryTracker();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WNR
|
||||
if (wc_InitNetRandom(wnrConfigFile, NULL, 5000) != 0)
|
||||
err_sys("can't load whitewood net random config file");
|
||||
@@ -635,6 +717,12 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_TLS13
|
||||
case 4:
|
||||
method = wolfTLSv1_3_server_method_ex;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_DTLS
|
||||
#ifndef NO_OLD_TLS
|
||||
case -1:
|
||||
@@ -689,9 +777,10 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
wolfSSL_CTX_set_TicketEncCb(ctx, myTicketEncCb);
|
||||
#endif
|
||||
|
||||
if (cipherList)
|
||||
if (cipherList && !useDefCipherList) {
|
||||
if (SSL_CTX_set_cipher_list(ctx, cipherList) != SSL_SUCCESS)
|
||||
err_sys("server can't set cipher list 1");
|
||||
}
|
||||
|
||||
#ifdef CYASSL_LEANPSK
|
||||
if (!usePsk) {
|
||||
@@ -795,7 +884,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
if (useAnon) {
|
||||
#ifdef HAVE_ANON
|
||||
CyaSSL_CTX_allow_anon_cipher(ctx);
|
||||
if (cipherList == NULL) {
|
||||
if (cipherList == NULL || (cipherList && useDefCipherList)) {
|
||||
if (SSL_CTX_set_cipher_list(ctx, "ADH-AES128-SHA") != SSL_SUCCESS)
|
||||
err_sys("server can't set cipher list 4");
|
||||
}
|
||||
@@ -846,25 +935,31 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
ret = wolfAsync_DevOpen(&devId);
|
||||
if (ret != 0) {
|
||||
err_sys("Async device open failed");
|
||||
if (ret < 0) {
|
||||
printf("Async device open failed\nRunning without async\n");
|
||||
}
|
||||
wolfSSL_CTX_UseAsync(ctx, devId);
|
||||
#endif /* WOLFSSL_ASYNC_CRYPT */
|
||||
|
||||
#ifdef WOLFSSL_TLS13
|
||||
if (noPskDheKe)
|
||||
wolfSSL_CTX_no_dhe_psk(ctx);
|
||||
#endif
|
||||
|
||||
while (1) {
|
||||
/* allow resume option */
|
||||
if(resumeCount > 1) {
|
||||
if (resumeCount > 1) {
|
||||
if (dtlsUDP == 0) {
|
||||
SOCKADDR_IN_T client;
|
||||
socklen_t client_len = sizeof(client);
|
||||
clientfd = accept(sockfd, (struct sockaddr*)&client,
|
||||
(ACCEPT_THIRD_T)&client_len);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
tcp_listen(&sockfd, &port, useAnyAddr, dtlsUDP, dtlsSCTP);
|
||||
clientfd = sockfd;
|
||||
}
|
||||
if(WOLFSSL_SOCKET_IS_INVALID(clientfd)) {
|
||||
if (WOLFSSL_SOCKET_IS_INVALID(clientfd)) {
|
||||
err_sys("tcp accept failed");
|
||||
}
|
||||
}
|
||||
@@ -882,6 +977,9 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
ssl = SSL_new(ctx);
|
||||
if (ssl == NULL)
|
||||
err_sys("unable to get SSL");
|
||||
#ifdef OPENSSL_EXTRA
|
||||
wolfSSL_KeepArrays(ssl);
|
||||
#endif
|
||||
|
||||
#if defined(WOLFSSL_STATIC_MEMORY) && defined(DEBUG_WOLFSSL)
|
||||
{
|
||||
@@ -990,38 +1088,69 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
}
|
||||
#endif
|
||||
|
||||
do {
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) { break; } else if (ret == 0) { continue; }
|
||||
}
|
||||
#endif
|
||||
|
||||
err = 0; /* Reset error */
|
||||
#ifndef CYASSL_CALLBACKS
|
||||
if (nonBlocking) {
|
||||
ret = NonBlockingSSL_Accept(ssl);
|
||||
}
|
||||
else {
|
||||
ret = SSL_accept(ssl);
|
||||
}
|
||||
#else
|
||||
if (nonBlocking) {
|
||||
ret = NonBlockingSSL_Accept(ssl);
|
||||
}
|
||||
else {
|
||||
do {
|
||||
err = 0; /* reset error */
|
||||
ret = SSL_accept(ssl);
|
||||
if (ret != SSL_SUCCESS) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
}
|
||||
#else
|
||||
ret = NonBlockingSSL_Accept(ssl);
|
||||
#endif
|
||||
if (ret != SSL_SUCCESS) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
}
|
||||
} while (ret != SSL_SUCCESS && err == WC_PENDING_E);
|
||||
|
||||
if (ret != SSL_SUCCESS) {
|
||||
char buffer[CYASSL_MAX_ERROR_SZ];
|
||||
err = SSL_get_error(ssl, 0);
|
||||
printf("error = %d, %s\n", err, ERR_error_string(err, buffer));
|
||||
printf("SSL_accept error %d, %s\n", err,
|
||||
ERR_error_string(err, buffer));
|
||||
err_sys("SSL_accept failed");
|
||||
}
|
||||
|
||||
showPeer(ssl);
|
||||
if (SSL_state(ssl) != 0) {
|
||||
err_sys("SSL in error state");
|
||||
}
|
||||
|
||||
#ifdef OPENSSL_EXTRA
|
||||
{
|
||||
byte* rnd;
|
||||
byte* pt;
|
||||
size_t size;
|
||||
|
||||
/* get size of buffer then print */
|
||||
size = wolfSSL_get_server_random(NULL, NULL, 0);
|
||||
if (size == 0) {
|
||||
err_sys("error getting server random buffer size");
|
||||
}
|
||||
|
||||
rnd = (byte*)XMALLOC(size, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (rnd == NULL) {
|
||||
err_sys("error creating server random buffer");
|
||||
}
|
||||
|
||||
size = wolfSSL_get_server_random(ssl, rnd, size);
|
||||
if (size == 0) {
|
||||
XFREE(rnd, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
err_sys("error getting server random buffer");
|
||||
}
|
||||
|
||||
printf("Server Random : ");
|
||||
for (pt = rnd; pt < rnd + size; pt++) printf("%02X", *pt);
|
||||
printf("\n");
|
||||
XFREE(rnd, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ALPN
|
||||
if (alpnList != NULL) {
|
||||
@@ -1047,21 +1176,69 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
free(list);
|
||||
}
|
||||
#endif
|
||||
if(echoData == 0 && throughput == 0) {
|
||||
ret = SSL_read(ssl, input, sizeof(input)-1);
|
||||
if (echoData == 0 && throughput == 0) {
|
||||
const char* write_msg;
|
||||
int write_msg_sz;
|
||||
|
||||
/* Read data */
|
||||
do {
|
||||
err = 0; /* reset error */
|
||||
ret = SSL_read(ssl, input, sizeof(input)-1);
|
||||
if (ret < 0) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (err != SSL_ERROR_WANT_READ) {
|
||||
printf("SSL_read input error %d, %s\n", err,
|
||||
ERR_error_string(err, buffer));
|
||||
err_sys("SSL_read failed");
|
||||
}
|
||||
}
|
||||
} while (err == WC_PENDING_E);
|
||||
if (ret > 0) {
|
||||
input[ret] = 0;
|
||||
input[ret] = 0; /* null terminate message */
|
||||
printf("Client message: %s\n", input);
|
||||
|
||||
}
|
||||
else if (ret < 0) {
|
||||
int readErr = SSL_get_error(ssl, 0);
|
||||
if (readErr != SSL_ERROR_WANT_READ)
|
||||
err_sys("SSL_read failed");
|
||||
}
|
||||
|
||||
if (SSL_write(ssl, msg, sizeof(msg)) != sizeof(msg))
|
||||
#ifdef WOLFSSL_TLS13
|
||||
if (updateKeysIVs)
|
||||
wolfSSL_update_keys(ssl);
|
||||
#endif
|
||||
|
||||
/* Write data */
|
||||
if (!useWebServerMsg) {
|
||||
write_msg = msg;
|
||||
write_msg_sz = sizeof(msg);
|
||||
}
|
||||
else {
|
||||
write_msg = webServerMsg;
|
||||
write_msg_sz = sizeof(webServerMsg);
|
||||
}
|
||||
do {
|
||||
err = 0; /* reset error */
|
||||
ret = SSL_write(ssl, write_msg, write_msg_sz);
|
||||
if (ret <= 0) {
|
||||
err = SSL_get_error(ssl, 0);
|
||||
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (err == WC_PENDING_E) {
|
||||
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
||||
if (ret < 0) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} while (err == WC_PENDING_E || err == SSL_ERROR_WANT_WRITE);
|
||||
if (ret != write_msg_sz) {
|
||||
printf("SSL_write msg error %d, %s\n", err,
|
||||
ERR_error_string(err, buffer));
|
||||
err_sys("SSL_write failed");
|
||||
}
|
||||
}
|
||||
else {
|
||||
ServerEchoData(ssl, clientfd, echoData, throughput);
|
||||
@@ -1103,7 +1280,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
}
|
||||
resumeCount = 0;
|
||||
|
||||
if(!loopIndefinitely) {
|
||||
if (loops > 0 && --loops == 0) {
|
||||
break; /* out of while loop, done with normal and resume option */
|
||||
}
|
||||
} /* while(1) */
|
||||
@@ -1120,11 +1297,6 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
ecc_fp_free(); /* free per thread cache */
|
||||
#endif
|
||||
|
||||
#if defined(USE_WOLFSSL_MEMORY) && !defined(WOLFSSL_STATIC_MEMORY)
|
||||
if (trackMemory)
|
||||
ShowMemoryTracker();
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_TIRTOS
|
||||
fdCloseSession(Task_self());
|
||||
#endif
|
||||
@@ -1147,7 +1319,6 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
(void) useNtruKey;
|
||||
(void) ourDhParam;
|
||||
(void) ourCert;
|
||||
(void) trackMemory;
|
||||
#ifndef CYASSL_TIRTOS
|
||||
return 0;
|
||||
#endif
|
||||
|
@@ -9,14 +9,17 @@
|
||||
# This should check out all the approved versions. The command line
|
||||
# option selects the version.
|
||||
#
|
||||
# $ ./fips-check [version]
|
||||
# $ ./fips-check [version] [keep]
|
||||
#
|
||||
# - version: linux (default), ios, android, windows, freertos
|
||||
# - version: linux (default), ios, android, windows, freertos, linux-ecc
|
||||
#
|
||||
# - keep: (default off) XXX-fips-test temp dir around for inspection
|
||||
#
|
||||
|
||||
function Usage() {
|
||||
echo "Usage: $0 [platform]"
|
||||
echo "Where \"platform\" is one of linux (default), ios, android, windows, freertos"
|
||||
echo "Usage: $0 [platform] [keep]"
|
||||
echo "Where \"platform\" is one of linux (default), ios, android, windows, freertos, openrtos-3.9.2, linux-ecc"
|
||||
echo "Where \"keep\" means keep (default off) XXX-fips-test temp dir around for inspection"
|
||||
}
|
||||
|
||||
LINUX_FIPS_VERSION=v3.2.6
|
||||
@@ -24,6 +27,11 @@ LINUX_FIPS_REPO=git@github.com:wolfSSL/fips.git
|
||||
LINUX_CTAO_VERSION=v3.2.6
|
||||
LINUX_CTAO_REPO=git@github.com:cyassl/cyassl.git
|
||||
|
||||
LINUX_ECC_FIPS_VERSION=v3.10.3
|
||||
LINUX_ECC_FIPS_REPO=git@github.com:wolfSSL/fips.git
|
||||
LINUX_ECC_CTAO_VERSION=v3.2.6
|
||||
LINUX_ECC_CTAO_REPO=git@github.com:cyassl/cyassl.git
|
||||
|
||||
IOS_FIPS_VERSION=v3.4.8a
|
||||
IOS_FIPS_REPO=git@github.com:wolfSSL/fips.git
|
||||
IOS_CTAO_VERSION=v3.4.8.fips
|
||||
@@ -44,6 +52,11 @@ FREERTOS_FIPS_REPO=git@github.com:wolfSSL/fips.git
|
||||
FREERTOS_CTAO_VERSION=v3.6.1
|
||||
FREERTOS_CTAO_REPO=git@github.com:cyassl/cyassl.git
|
||||
|
||||
OPENRTOS_3_9_2_FIPS_VERSION=v3.9.2-OpenRTOS
|
||||
OPENRTOS_3_9_2_FIPS_REPO=git@github.com:wolfSSL/fips.git
|
||||
OPENRTOS_3_9_2_CTAO_VERSION=v3.6.1
|
||||
OPENRTOS_3_9_2_CTAO_REPO=git@github.com:cyassl/cyassl.git
|
||||
|
||||
FIPS_SRCS=( fips.c fips_test.c )
|
||||
WC_MODS=( aes des3 sha sha256 sha512 rsa hmac random )
|
||||
TEST_DIR=XXX-fips-test
|
||||
@@ -52,6 +65,8 @@ WC_SRC_PATH=ctaocrypt/src
|
||||
|
||||
if [ "x$1" == "x" ]; then PLATFORM="linux"; else PLATFORM=$1; fi
|
||||
|
||||
if [ "x$2" == "xkeep" ]; then KEEP="yes"; else KEEP="no"; fi
|
||||
|
||||
case $PLATFORM in
|
||||
ios)
|
||||
FIPS_VERSION=$IOS_FIPS_VERSION
|
||||
@@ -77,12 +92,25 @@ freertos)
|
||||
CTAO_VERSION=$FREERTOS_CTAO_VERSION
|
||||
CTAO_REPO=$FREERTOS_CTAO_REPO
|
||||
;;
|
||||
openrtos-3.9.2)
|
||||
FIPS_VERSION=$OPENRTOS_3_9_2_FIPS_VERSION
|
||||
FIPS_REPO=$OPENRTOS_3_9_2_FIPS_REPO
|
||||
CTAO_VERSION=$OPENRTOS_3_9_2_CTAO_VERSION
|
||||
CTAO_REPO=$OPENRTOS_3_9_2_CTAO_REPO
|
||||
FIPS_CONFLICTS=( aes hmac random sha256 )
|
||||
;;
|
||||
linux)
|
||||
FIPS_VERSION=$LINUX_FIPS_VERSION
|
||||
FIPS_REPO=$LINUX_FIPS_REPO
|
||||
CTAO_VERSION=$LINUX_CTAO_VERSION
|
||||
CTAO_REPO=$LINUX_CTAO_REPO
|
||||
;;
|
||||
linux-ecc)
|
||||
FIPS_VERSION=$LINUX_ECC_FIPS_VERSION
|
||||
FIPS_REPO=$LINUX_ECC_FIPS_REPO
|
||||
CTAO_VERSION=$LINUX_ECC_CTAO_VERSION
|
||||
CTAO_REPO=$LINUX_ECC_CTAO_REPO
|
||||
;;
|
||||
*)
|
||||
Usage
|
||||
exit 1
|
||||
@@ -134,7 +162,22 @@ fi
|
||||
make test
|
||||
[ $? -ne 0 ] && echo "\n\nTest failed. Debris left for analysis." && exit 1
|
||||
|
||||
if [ ${#FIPS_CONFLICTS[@]} -ne 0 ];
|
||||
then
|
||||
echo "Due to the way this package is compiled by the customer duplicate"
|
||||
echo "source file names are an issue, renaming:"
|
||||
for FNAME in ${FIPS_CONFLICTS[@]}
|
||||
do
|
||||
echo "wolfcrypt/src/$FNAME.c to wolfcrypt/src/wc_$FNAME.c"
|
||||
mv ./wolfcrypt/src/$FNAME.c ./wolfcrypt/src/wc_$FNAME.c
|
||||
done
|
||||
echo "Confirming files were renamed..."
|
||||
ls -la ./wolfcrypt/src/wc_*.c
|
||||
fi
|
||||
|
||||
# Clean up
|
||||
popd
|
||||
rm -rf $TEST_DIR
|
||||
|
||||
if [ "x$KEEP" == "xno" ];
|
||||
then
|
||||
rm -rf $TEST_DIR
|
||||
fi
|
||||
|
@@ -55,6 +55,7 @@ my @fileList_2048 = (
|
||||
[ "./certs/dh2048.der", "dh_key_der_2048" ],
|
||||
[ "./certs/dsa2048.der", "dsa_key_der_2048" ],
|
||||
[ "./certs/rsa2048.der", "rsa_key_der_2048" ],
|
||||
[ "./certs/ca-key.der", "ca_key_der_2048" ],
|
||||
[ "./certs/ca-cert.der", "ca_cert_der_2048" ],
|
||||
[ "./certs/server-key.der", "server_key_der_2048" ],
|
||||
[ "./certs/server-cert.der", "server_cert_der_2048" ]
|
||||
|
@@ -52,9 +52,7 @@ int CRYPT_MD5_Initialize(CRYPT_MD5_CTX* md5)
|
||||
if (md5 == NULL)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
wc_InitMd5((Md5*)md5);
|
||||
|
||||
return 0;
|
||||
return wc_InitMd5((Md5*)md5);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,9 +63,7 @@ int CRYPT_MD5_DataAdd(CRYPT_MD5_CTX* md5, const unsigned char* input,
|
||||
if (md5 == NULL || input == NULL)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
wc_Md5Update((Md5*)md5, input, sz);
|
||||
|
||||
return 0;
|
||||
return wc_Md5Update((Md5*)md5, input, sz);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,9 +73,7 @@ int CRYPT_MD5_Finalize(CRYPT_MD5_CTX* md5, unsigned char* digest)
|
||||
if (md5 == NULL || digest == NULL)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
wc_Md5Final((Md5*)md5, digest);
|
||||
|
||||
return 0;
|
||||
return wc_Md5Final((Md5*)md5, digest);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -34,7 +34,7 @@
|
||||
|
||||
/* MD5 */
|
||||
typedef struct CRYPT_MD5_CTX {
|
||||
int holder[24]; /* big enough to hold internal, but check on init */
|
||||
int holder[28]; /* big enough to hold internal, but check on init */
|
||||
} CRYPT_MD5_CTX;
|
||||
|
||||
int CRYPT_MD5_Initialize(CRYPT_MD5_CTX*);
|
||||
@@ -42,13 +42,13 @@ int CRYPT_MD5_DataAdd(CRYPT_MD5_CTX*, const unsigned char*, unsigned int);
|
||||
int CRYPT_MD5_Finalize(CRYPT_MD5_CTX*, unsigned char*);
|
||||
|
||||
enum {
|
||||
CRYPT_MD5_DIGEST_SIZE = 16
|
||||
CRYPT_MD5_DIGEST_SIZE = 16
|
||||
};
|
||||
|
||||
|
||||
/* SHA */
|
||||
typedef struct CRYPT_SHA_CTX {
|
||||
int holder[24]; /* big enough to hold internal, but check on init */
|
||||
int holder[28]; /* big enough to hold internal, but check on init */
|
||||
} CRYPT_SHA_CTX;
|
||||
|
||||
int CRYPT_SHA_Initialize(CRYPT_SHA_CTX*);
|
||||
@@ -62,7 +62,7 @@ enum {
|
||||
|
||||
/* SHA-256 */
|
||||
typedef struct CRYPT_SHA256_CTX {
|
||||
int holder[28]; /* big enough to hold internal, but check on init */
|
||||
int holder[32]; /* big enough to hold internal, but check on init */
|
||||
} CRYPT_SHA256_CTX;
|
||||
|
||||
int CRYPT_SHA256_Initialize(CRYPT_SHA256_CTX*);
|
||||
@@ -70,13 +70,13 @@ int CRYPT_SHA256_DataAdd(CRYPT_SHA256_CTX*, const unsigned char*, unsigned int);
|
||||
int CRYPT_SHA256_Finalize(CRYPT_SHA256_CTX*, unsigned char*);
|
||||
|
||||
enum {
|
||||
CRYPT_SHA256_DIGEST_SIZE = 32
|
||||
CRYPT_SHA256_DIGEST_SIZE = 32
|
||||
};
|
||||
|
||||
|
||||
/* SHA-384 */
|
||||
typedef struct CRYPT_SHA384_CTX {
|
||||
long long holder[32]; /* big enough to hold internal, but check on init */
|
||||
long long holder[36]; /* big enough to hold internal, but check on init */
|
||||
} CRYPT_SHA384_CTX;
|
||||
|
||||
int CRYPT_SHA384_Initialize(CRYPT_SHA384_CTX*);
|
||||
@@ -98,13 +98,13 @@ int CRYPT_SHA512_DataAdd(CRYPT_SHA512_CTX*, const unsigned char*, unsigned int);
|
||||
int CRYPT_SHA512_Finalize(CRYPT_SHA512_CTX*, unsigned char*);
|
||||
|
||||
enum {
|
||||
CRYPT_SHA512_DIGEST_SIZE = 64
|
||||
CRYPT_SHA512_DIGEST_SIZE = 64
|
||||
};
|
||||
|
||||
|
||||
/* HMAC */
|
||||
typedef struct CRYPT_HMAC_CTX {
|
||||
long long holder[69]; /* big enough to hold internal, but check on init */
|
||||
long long holder[72]; /* big enough to hold internal, but check on init */
|
||||
} CRYPT_HMAC_CTX;
|
||||
|
||||
int CRYPT_HMAC_SetKey(CRYPT_HMAC_CTX*, int, const unsigned char*, unsigned int);
|
||||
@@ -113,10 +113,10 @@ int CRYPT_HMAC_Finalize(CRYPT_HMAC_CTX*, unsigned char*);
|
||||
|
||||
/* HMAC types */
|
||||
enum {
|
||||
CRYPT_HMAC_SHA = 1,
|
||||
CRYPT_HMAC_SHA256 = 2,
|
||||
CRYPT_HMAC_SHA384 = 5,
|
||||
CRYPT_HMAC_SHA512 = 4
|
||||
CRYPT_HMAC_SHA = 1,
|
||||
CRYPT_HMAC_SHA256 = 2,
|
||||
CRYPT_HMAC_SHA384 = 5,
|
||||
CRYPT_HMAC_SHA512 = 4
|
||||
};
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ int CRYPT_HUFFMAN_DeCompress(unsigned char*, unsigned int, const unsigned char*,
|
||||
|
||||
/* flag to use static huffman */
|
||||
enum {
|
||||
CRYPT_HUFFMAN_COMPRESS_STATIC = 1
|
||||
CRYPT_HUFFMAN_COMPRESS_STATIC = 1
|
||||
};
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ int CRYPT_RNG_BlockGenerate(CRYPT_RNG_CTX*, unsigned char*, unsigned int);
|
||||
|
||||
/* TDES */
|
||||
typedef struct CRYPT_TDES_CTX {
|
||||
int holder[100]; /* big enough to hold internal, but check on init */
|
||||
int holder[104]; /* big enough to hold internal, but check on init */
|
||||
} CRYPT_TDES_CTX;
|
||||
|
||||
int CRYPT_TDES_KeySet(CRYPT_TDES_CTX*, const unsigned char*,
|
||||
@@ -158,13 +158,13 @@ int CRYPT_TDES_CBC_Decrypt(CRYPT_TDES_CTX*, unsigned char*,
|
||||
/* key direction flags for setup */
|
||||
enum {
|
||||
CRYPT_TDES_ENCRYPTION = 0,
|
||||
CRYPT_TDES_DECRYPTION = 1
|
||||
CRYPT_TDES_DECRYPTION = 1
|
||||
};
|
||||
|
||||
|
||||
/* AES */
|
||||
typedef struct CRYPT_AES_CTX {
|
||||
int holder[76]; /* big enough to hold internal, but check on init */
|
||||
int holder[78]; /* big enough to hold internal, but check on init */
|
||||
} CRYPT_AES_CTX;
|
||||
|
||||
/* key */
|
||||
@@ -262,7 +262,7 @@ int CRYPT_ERROR_StringGet(int, char*);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -214,25 +214,30 @@ static int check_md5(void)
|
||||
{
|
||||
CRYPT_MD5_CTX mcMd5;
|
||||
Md5 defMd5;
|
||||
int ret;
|
||||
byte mcDigest[CRYPT_MD5_DIGEST_SIZE];
|
||||
byte defDigest[MD5_DIGEST_SIZE];
|
||||
|
||||
CRYPT_MD5_Initialize(&mcMd5);
|
||||
wc_InitMd5(&defMd5);
|
||||
ret = wc_InitMd5(&defMd5);
|
||||
|
||||
CRYPT_MD5_DataAdd(&mcMd5, ourData, OUR_DATA_SIZE);
|
||||
wc_Md5Update(&defMd5, ourData, OUR_DATA_SIZE);
|
||||
if (ret == 0) {
|
||||
CRYPT_MD5_DataAdd(&mcMd5, ourData, OUR_DATA_SIZE);
|
||||
ret = wc_Md5Update(&defMd5, ourData, OUR_DATA_SIZE);
|
||||
}
|
||||
|
||||
CRYPT_MD5_Finalize(&mcMd5, mcDigest);
|
||||
wc_Md5Final(&defMd5, defDigest);
|
||||
if (ret == 0) {
|
||||
CRYPT_MD5_Finalize(&mcMd5, mcDigest);
|
||||
ret = wc_Md5Final(&defMd5, defDigest);
|
||||
}
|
||||
|
||||
if (memcmp(mcDigest, defDigest, CRYPT_MD5_DIGEST_SIZE) != 0) {
|
||||
printf("md5 final memcmp fialed\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
printf("md5 mcapi test passed\n");
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -261,7 +266,7 @@ static int check_sha(void)
|
||||
if (memcmp(mcDigest, defDigest, CRYPT_SHA_DIGEST_SIZE) != 0) {
|
||||
printf("sha final memcmp failed\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
printf("sha mcapi test passed\n");
|
||||
|
||||
return 0;
|
||||
@@ -301,7 +306,7 @@ static int check_sha256(void)
|
||||
if (memcmp(mcDigest, defDigest, CRYPT_SHA256_DIGEST_SIZE) != 0) {
|
||||
printf("sha256 final memcmp fialed\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
printf("sha256 mcapi test passed\n");
|
||||
|
||||
return 0;
|
||||
@@ -341,7 +346,7 @@ static int check_sha384(void)
|
||||
if (memcmp(mcDigest, defDigest, CRYPT_SHA384_DIGEST_SIZE) != 0) {
|
||||
printf("sha384 final memcmp fialed\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
printf("sha384 mcapi test passed\n");
|
||||
|
||||
return 0;
|
||||
@@ -381,7 +386,7 @@ static int check_sha512(void)
|
||||
if (memcmp(mcDigest, defDigest, CRYPT_SHA512_DIGEST_SIZE) != 0) {
|
||||
printf("sha512 final memcmp fialed\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
printf("sha512 mcapi test passed\n");
|
||||
|
||||
return 0;
|
||||
@@ -424,7 +429,7 @@ static int check_hmac(void)
|
||||
if (memcmp(mcDigest, defDigest, CRYPT_SHA_DIGEST_SIZE) != 0) {
|
||||
printf("hmac sha final memcmp fialed\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
printf("hmac sha mcapi test passed\n");
|
||||
|
||||
/* SHA-256 */
|
||||
@@ -452,7 +457,7 @@ static int check_hmac(void)
|
||||
if (memcmp(mcDigest, defDigest, CRYPT_SHA256_DIGEST_SIZE) != 0) {
|
||||
printf("hmac sha256 final memcmp fialed\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
printf("hmac sha256 mcapi test passed\n");
|
||||
|
||||
/* SHA-384 */
|
||||
@@ -480,7 +485,7 @@ static int check_hmac(void)
|
||||
if (memcmp(mcDigest, defDigest, CRYPT_SHA384_DIGEST_SIZE) != 0) {
|
||||
printf("hmac sha384 final memcmp fialed\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
printf("hmac sha384 mcapi test passed\n");
|
||||
|
||||
/* SHA-512 */
|
||||
@@ -508,7 +513,7 @@ static int check_hmac(void)
|
||||
if (memcmp(mcDigest, defDigest, CRYPT_SHA512_DIGEST_SIZE) != 0) {
|
||||
printf("hmac sha512 final memcmp fialed\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
printf("hmac sha512 mcapi test passed\n");
|
||||
|
||||
return 0;
|
||||
@@ -621,7 +626,7 @@ static int check_compress(void)
|
||||
static int check_rng(void)
|
||||
{
|
||||
int ret;
|
||||
int i;
|
||||
int i;
|
||||
byte in[RANDOM_BYTE_SZ];
|
||||
byte out[RANDOM_BYTE_SZ];
|
||||
|
||||
@@ -1326,7 +1331,7 @@ static int check_rsa(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = CRYPT_RSA_PrivateDecrypt(&mcRsa, out2, sizeof(out2), out1, ret);
|
||||
ret = CRYPT_RSA_PrivateDecrypt(&mcRsa, out2, sizeof(out2), out1, ret);
|
||||
if (ret < 0) {
|
||||
printf("mcapi rsa private derypt failed\n");
|
||||
return -1;
|
||||
@@ -1348,7 +1353,7 @@ static int check_rsa(void)
|
||||
printf("mcapi rsa free failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
printf("rsa mcapi test passed\n");
|
||||
|
||||
return 0;
|
||||
@@ -1358,7 +1363,7 @@ static int check_rsa(void)
|
||||
/* check mcapi ecc */
|
||||
static int check_ecc(void)
|
||||
{
|
||||
CRYPT_ECC_CTX userA;
|
||||
CRYPT_ECC_CTX userA;
|
||||
CRYPT_ECC_CTX userB;
|
||||
int ret;
|
||||
byte sharedA[100];
|
||||
@@ -1463,7 +1468,7 @@ static int check_ecc(void)
|
||||
printf("mcapi ecc public export failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
ret = CRYPT_ECC_PublicImport(&userB, sharedA, usedA);
|
||||
if (ret != 0) {
|
||||
printf("mcapi ecc public import failed\n");
|
||||
|
@@ -53,7 +53,7 @@ void bench_md5(void);
|
||||
void bench_sha(void);
|
||||
void bench_sha256(void);
|
||||
void bench_sha512(void);
|
||||
void bench_ripemd(void);
|
||||
int bench_ripemd(void);
|
||||
|
||||
void bench_rsa(void);
|
||||
void bench_rsaKeyGen(void);
|
||||
|
15
rpm/spec.in
15
rpm/spec.in
@@ -72,8 +72,8 @@ mkdir -p $RPM_BUILD_ROOT/
|
||||
%{_docdir}/wolfssl/README.txt
|
||||
%{_libdir}/libwolfssl.la
|
||||
%{_libdir}/libwolfssl.so
|
||||
%{_libdir}/libwolfssl.so.3
|
||||
%{_libdir}/libwolfssl.so.3.6.0
|
||||
%{_libdir}/libwolfssl.so.12
|
||||
%{_libdir}/libwolfssl.so.12.0.0
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root,-)
|
||||
@@ -159,6 +159,7 @@ mkdir -p $RPM_BUILD_ROOT/
|
||||
%{_includedir}/cyassl/openssl/rsa.h
|
||||
%{_includedir}/cyassl/openssl/sha.h
|
||||
%{_includedir}/cyassl/openssl/ssl.h
|
||||
%{_includedir}/cyassl/openssl/ssl23.h
|
||||
%{_includedir}/cyassl/openssl/stack.h
|
||||
%{_includedir}/cyassl/openssl/ui.h
|
||||
%{_includedir}/cyassl/openssl/x509.h
|
||||
@@ -172,6 +173,7 @@ mkdir -p $RPM_BUILD_ROOT/
|
||||
%{_includedir}/wolfssl/callbacks.h
|
||||
%{_includedir}/wolfssl/certs_test.h
|
||||
%{_includedir}/wolfssl/crl.h
|
||||
%{_includedir}/wolfssl/io.h
|
||||
%{_includedir}/wolfssl/wolfcrypt/aes.h
|
||||
%{_includedir}/wolfssl/wolfcrypt/cmac.h
|
||||
%{_includedir}/wolfssl/wolfcrypt/arc4.h
|
||||
@@ -229,8 +231,10 @@ mkdir -p $RPM_BUILD_ROOT/
|
||||
%{_includedir}/wolfssl/wolfcrypt/visibility.h
|
||||
%{_includedir}/wolfssl/wolfcrypt/wc_encrypt.h
|
||||
%{_includedir}/wolfssl/wolfcrypt/wolfevent.h
|
||||
%{_includedir}/wolfssl/wolfcrypt/wolfmath.h
|
||||
%{_includedir}/wolfssl/error-ssl.h
|
||||
%{_includedir}/wolfssl/ocsp.h
|
||||
%{_includedir}/wolfssl/openssl/aes.h
|
||||
%{_includedir}/wolfssl/openssl/asn1.h
|
||||
%{_includedir}/wolfssl/openssl/bio.h
|
||||
%{_includedir}/wolfssl/openssl/bn.h
|
||||
@@ -262,6 +266,7 @@ mkdir -p $RPM_BUILD_ROOT/
|
||||
%{_includedir}/wolfssl/openssl/rsa.h
|
||||
%{_includedir}/wolfssl/openssl/sha.h
|
||||
%{_includedir}/wolfssl/openssl/ssl.h
|
||||
%{_includedir}/wolfssl/openssl/ssl23.h
|
||||
%{_includedir}/wolfssl/openssl/stack.h
|
||||
%{_includedir}/wolfssl/openssl/ui.h
|
||||
%{_includedir}/wolfssl/openssl/x509.h
|
||||
@@ -275,6 +280,12 @@ mkdir -p $RPM_BUILD_ROOT/
|
||||
%{_libdir}/pkgconfig/wolfssl.pc
|
||||
|
||||
%changelog
|
||||
* Thu May 04 2017 Jacob Barthelmeh <jacob@wolfssl.com>
|
||||
- Added header for wolfssl/io.h, wolfssl/openssl/ssl23.h, cyassl/openssl/ssl23.h
|
||||
* Thu Feb 09 2017 Jacob Barthelmeh <jacob@wolfssl.com>
|
||||
- Added header for wolfssl/wolfcrypt/wolfmath.h
|
||||
* Fri Nov 11 2016 Jacob Barthelmeh <jacob@wolfssl.com>
|
||||
- Added header for wolfssl/openssl/aes.h
|
||||
* Fri Oct 28 2016 Jacob Barthelmeh <jacob@wolfssl.com>
|
||||
- Added header for pkcs12
|
||||
* Fri Sep 23 2016 John Safranek <john@wolfssl.com>
|
||||
|
@@ -62,6 +62,10 @@ dist_noinst_SCRIPTS+= scripts/openssl.test
|
||||
endif
|
||||
endif
|
||||
|
||||
if BUILD_TLS13
|
||||
dist_noinst_SCRIPTS+= scripts/tls13.test
|
||||
endif
|
||||
|
||||
EXTRA_DIST += scripts/testsuite.pcap \
|
||||
scripts/ping.test
|
||||
|
||||
|
@@ -82,7 +82,7 @@ found_free_port=0
|
||||
while [ "$counter" -lt 20 ]; do
|
||||
echo -e "\nTrying to start openssl server on port $openssl_port...\n"
|
||||
|
||||
openssl s_server -accept $openssl_port -cert ./certs/server-cert.pem -key ./certs/server-key.pem -quiet -CAfile ./certs/client-ca.pem -www -dhparam ./certs/dh2048.pem -dcert ./certs/server-ecc.pem -dkey ./certs/ecc-key.pem -verify 10 -verify_return_error -cipher "ALL:eNULL" &
|
||||
openssl s_server -accept $openssl_port -cert ./certs/server-cert.pem -key ./certs/server-key.pem -quiet -CAfile ./certs/client-ca.pem -www -dhparam ./certs/dh2048.pem -dcert ./certs/server-ecc.pem -dkey ./certs/ecc-key.pem -verify 10 -verify_return_error -psk 1a2b3c4d -cipher "ALL:eNULL" &
|
||||
server_pid=$!
|
||||
# wait to see if s_server successfully starts before continuing
|
||||
sleep 0.1
|
||||
@@ -215,12 +215,19 @@ do
|
||||
continue
|
||||
fi
|
||||
|
||||
# check for psk suite and turn on client psk if so
|
||||
psk = ""
|
||||
case $wolfSuite in
|
||||
*PSK*)
|
||||
psk="-s " ;;
|
||||
esac
|
||||
|
||||
if [ $version -lt 4 ]
|
||||
then
|
||||
./examples/client/client -p $openssl_port -g -r -l $wolfSuite -v $version
|
||||
./examples/client/client -p $openssl_port -g -r -l $wolfSuite -v $version $psk
|
||||
else
|
||||
# do all versions
|
||||
./examples/client/client -p $openssl_port -g -r -l $wolfSuite
|
||||
./examples/client/client -p $openssl_port -g -r -l $wolfSuite $psk
|
||||
fi
|
||||
|
||||
client_result=$?
|
||||
|
312
scripts/tls13.test
Executable file
312
scripts/tls13.test
Executable file
@@ -0,0 +1,312 @@
|
||||
#!/bin/sh
|
||||
|
||||
# tls13.test
|
||||
# copyright wolfSSL 2016
|
||||
|
||||
# getting unique port is modeled after resume.test script
|
||||
# need a unique port since may run the same time as testsuite
|
||||
# use server port zero hack to get one
|
||||
port=0
|
||||
no_pid=-1
|
||||
server_pid=$no_pid
|
||||
counter=0
|
||||
# let's use absolute path to a local dir (make distcheck may be in sub dir)
|
||||
# also let's add some randomness by adding pid in case multiple 'make check's
|
||||
# per source tree
|
||||
ready_file=`pwd`/wolfssl_psk_ready$$
|
||||
|
||||
echo "ready file $ready_file"
|
||||
|
||||
create_port() {
|
||||
while [ ! -s $ready_file -a "$counter" -lt 50 ]; do
|
||||
echo -e "waiting for ready file..."
|
||||
sleep 0.1
|
||||
counter=$((counter+ 1))
|
||||
done
|
||||
|
||||
if test -e $ready_file; then
|
||||
echo -e "found ready file, starting client..."
|
||||
|
||||
# get created port 0 ephemeral port
|
||||
port=`cat $ready_file`
|
||||
else
|
||||
echo -e "NO ready file ending test..."
|
||||
do_cleanup
|
||||
fi
|
||||
}
|
||||
|
||||
remove_ready_file() {
|
||||
if test -e $ready_file; then
|
||||
echo -e "removing existing ready file"
|
||||
rm $ready_file
|
||||
fi
|
||||
}
|
||||
|
||||
do_cleanup() {
|
||||
echo "in cleanup"
|
||||
|
||||
if [ $server_pid != $no_pid ]
|
||||
then
|
||||
echo "killing server"
|
||||
kill -9 $server_pid
|
||||
fi
|
||||
remove_ready_file
|
||||
}
|
||||
|
||||
do_trap() {
|
||||
echo "got trap"
|
||||
do_cleanup
|
||||
exit -1
|
||||
}
|
||||
|
||||
trap do_trap INT TERM
|
||||
|
||||
[ ! -x ./examples/client/client ] && echo -e "\n\nClient doesn't exist" && exit 1
|
||||
|
||||
# Usual TLS v1.3 server / TLS v1.3 client.
|
||||
echo -e "\n\nTLS v1.3 server with TLS v1.3 client"
|
||||
port=0
|
||||
./examples/server/server -v 4 -R $ready_file -p $port &
|
||||
server_pid=$!
|
||||
create_port
|
||||
./examples/client/client -v 4 -p $port
|
||||
RESULT=$?
|
||||
remove_ready_file
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
echo -e "\n\nTLS v1.3 not enabled"
|
||||
do_cleanup
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Use HelloRetryRequest with TLS v1.3 server / TLS v1.3 client.
|
||||
echo -e "\n\nTLS v1.3 HelloRetryRequest"
|
||||
port=0
|
||||
./examples/server/server -v 4 -R $ready_file -p $port &
|
||||
server_pid=$!
|
||||
create_port
|
||||
./examples/client/client -v 4 -J -p $port
|
||||
RESULT=$?
|
||||
remove_ready_file
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
echo -e "\n\nTLS v1.3 HelloRetryRequest not working"
|
||||
do_cleanup
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Resumption TLS v1.3 server / TLS v1.3 client.
|
||||
echo -e "\n\nTLS v1.3 resumption"
|
||||
port=0
|
||||
./examples/server/server -v 4 -r -R $ready_file -p $port &
|
||||
server_pid=$!
|
||||
create_port
|
||||
./examples/client/client -v 4 -r -p $port
|
||||
RESULT=$?
|
||||
remove_ready_file
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
echo -e "\n\nTLS v1.3 resumption not working"
|
||||
do_cleanup
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Usual TLS v1.3 server / TLS v1.3 client and ECC certificates.
|
||||
echo -e "\n\nTLS v1.3 server with TLS v1.3 client - ECC certificates"
|
||||
port=0
|
||||
./examples/server/server -v 4 -A certs/client-ecc-cert.pem -c certs/server-ecc.pem -k certs/ecc-key.pem -R $ready_file -p $port &
|
||||
server_pid=$!
|
||||
create_port
|
||||
./examples/client/client -v 4 -A certs/server-ecc.pem -c certs/client-ecc-cert.pem -k certs/ecc-client-key.pem -p $port
|
||||
RESULT=$?
|
||||
remove_ready_file
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
echo -e "\n\nTLS v1.3 ECC certificates not working"
|
||||
do_cleanup
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Usual TLS v1.3 server / TLS v1.3 client and DH Key.
|
||||
echo -e "\n\nTLS v1.3 server with TLS v1.3 client - DH Key Exchange"
|
||||
port=0
|
||||
./examples/server/server -v 4 -R $ready_file -p $port &
|
||||
server_pid=$!
|
||||
create_port
|
||||
./examples/client/client -v 4 -y -p $port
|
||||
RESULT=$?
|
||||
remove_ready_file
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
echo -e "\n\nTLS v1.3 DH Key Exchange not working"
|
||||
do_cleanup
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Usual TLS v1.3 server / TLS v1.3 client and ECC Key.
|
||||
echo -e "\n\nTLS v1.3 server with TLS v1.3 client - ECC Key Exchange"
|
||||
port=0
|
||||
./examples/server/server -v 4 -R $ready_file -p $port &
|
||||
server_pid=$!
|
||||
create_port
|
||||
./examples/client/client -v 4 -Y -p $port
|
||||
RESULT=$?
|
||||
remove_ready_file
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
echo -e "\n\nTLS v1.3 ECDH Key Exchange not working"
|
||||
do_cleanup
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# TLS 1.3 cipher suites server / client.
|
||||
echo -e "\n\nOnly TLS v1.3 cipher suites"
|
||||
port=0
|
||||
./examples/server/server -v 4 -R $ready_file -p $port -l TLS13-AES128-GCM-SHA256:TLS13-AES256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES128-CCM-SHA256:TLS13-AES128-CCM-8-SHA256 &
|
||||
server_pid=$!
|
||||
create_port
|
||||
./examples/client/client -v 4 -p $port
|
||||
RESULT=$?
|
||||
remove_ready_file
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
echo -e "\n\nIssue with TLS v1.3 cipher suites - only TLS v1.3"
|
||||
do_cleanup
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# TLS 1.3 cipher suites server / client.
|
||||
echo -e "\n\nOnly TLS v1.3 cipher suite - AES128-GCM SHA-256"
|
||||
port=0
|
||||
./examples/server/server -v 4 -R $ready_file -p $port -l TLS13-AES128-GCM-SHA256 &
|
||||
server_pid=$!
|
||||
create_port
|
||||
./examples/client/client -v 4 -p $port
|
||||
RESULT=$?
|
||||
remove_ready_file
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
echo -e "\n\nIssue with TLS v1.3 cipher suites - AES128-GCM SHA-256"
|
||||
do_cleanup
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# TLS 1.3 cipher suites server / client.
|
||||
echo -e "\n\nOnly TLS v1.3 cipher suite - AES256-GCM SHA-384"
|
||||
port=0
|
||||
./examples/server/server -v 4 -R $ready_file -p $port -l TLS13-AES256-GCM-SHA384 &
|
||||
server_pid=$!
|
||||
create_port
|
||||
./examples/client/client -v 4 -p $port
|
||||
RESULT=$?
|
||||
remove_ready_file
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
echo -e "\n\nIssue with TLS v1.3 cipher suites - AES256-GCM SHA-384"
|
||||
do_cleanup
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# TLS 1.3 cipher suites server / client.
|
||||
echo -e "\n\nOnly TLS v1.3 cipher suite - CHACHA20-POLY1305 SHA-256"
|
||||
port=0
|
||||
./examples/server/server -v 4 -R $ready_file -p $port -l TLS13-CHACHA20-POLY1305-SHA256 &
|
||||
server_pid=$!
|
||||
create_port
|
||||
./examples/client/client -v 4 -p $port
|
||||
RESULT=$?
|
||||
remove_ready_file
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
echo -e "\n\nIssue with TLS v1.3 cipher suites - CHACHA20-POLY1305 SHA-256"
|
||||
do_cleanup
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
./examples/client/client -v 4 -e 2>&1 | grep -- '-CCM'
|
||||
if [ $? -eq 0 ]; then
|
||||
# TLS 1.3 cipher suites server / client.
|
||||
echo -e "\n\nOnly TLS v1.3 cipher suite - AES128-CCM SHA-256"
|
||||
port=0
|
||||
./examples/server/server -v 4 -R $ready_file -p $port -l TLS13-AES128-CCM-SHA256 &
|
||||
server_pid=$!
|
||||
create_port
|
||||
./examples/client/client -v 4 -p $port
|
||||
RESULT=$?
|
||||
remove_ready_file
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
echo -e "\n\nIssue with TLS v1.3 cipher suites - AES128-CCM SHA-256"
|
||||
do_cleanup
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# TLS 1.3 cipher suites server / client.
|
||||
echo -e "\n\nOnly TLS v1.3 cipher suite - AES128-CCM-8 SHA-256"
|
||||
port=0
|
||||
./examples/server/server -v 4 -R $ready_file -p $port -l TLS13-AES128-CCM-8-SHA256 &
|
||||
server_pid=$!
|
||||
create_port
|
||||
./examples/client/client -v 4 -p $port
|
||||
RESULT=$?
|
||||
remove_ready_file
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
echo -e "\n\nIssue with TLS v1.3 cipher suites - AES128-CCM-8 SHA-256"
|
||||
do_cleanup
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# TLS 1.3 server / TLS 1.2 client.
|
||||
echo -e "\n\nTLS v1.3 server downgrading to TLS v1.2"
|
||||
port=0
|
||||
./examples/server/server -v 4 -R $ready_file -p $port &
|
||||
server_pid=$!
|
||||
create_port
|
||||
./examples/client/client -v 3 -p $port
|
||||
RESULT=$?
|
||||
remove_ready_file
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
echo -e "\n\nIssue with TLS v1.3 server downgrading to TLS v1.2"
|
||||
do_cleanup
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# TLS 1.2 server / TLS 1.3 client.
|
||||
echo -e "\n\nTLS v1.3 client downgrading to TLS v1.2"
|
||||
port=0
|
||||
./examples/server/server -v 3 -R $ready_file -p $port &
|
||||
server_pid=$!
|
||||
create_port
|
||||
./examples/client/client -v 4 -p $port
|
||||
RESULT=$?
|
||||
remove_ready_file
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
echo -e "\n\nIssue with TLS v1.3 client downgrading to TLS v1.2"
|
||||
do_cleanup
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# TLS 1.3 server / TLS 1.3 client send KeyUpdate before sending app data.
|
||||
echo -e "\n\nTLS v1.3 KeyUpdate"
|
||||
port=0
|
||||
./examples/server/server -v 4 -U -R $ready_file -p $port &
|
||||
server_pid=$!
|
||||
create_port
|
||||
./examples/client/client -v 4 -I -p $port
|
||||
RESULT=$?
|
||||
remove_ready_file
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
echo -e "\n\nIssue with TLS v1.3 KeyUpdate"
|
||||
do_cleanup
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo -e "\nALL Tests Passed"
|
||||
|
||||
exit 0
|
||||
|
446
src/bio.c
Normal file
446
src/bio.c
Normal file
@@ -0,0 +1,446 @@
|
||||
/* bio.c
|
||||
*
|
||||
* Copyright (C) 2006-2016 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
/*** TBD ***/
|
||||
WOLFSSL_API long wolfSSL_BIO_ctrl(WOLFSSL_BIO *bio, int cmd, long larg, void *parg)
|
||||
{
|
||||
(void)bio;
|
||||
(void)cmd;
|
||||
(void)larg;
|
||||
(void)parg;
|
||||
|
||||
WOLFSSL_ENTER("BIO_ctrl");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Return the number of pending bytes in read and write buffers */
|
||||
size_t wolfSSL_BIO_ctrl_pending(WOLFSSL_BIO *bio)
|
||||
{
|
||||
WOLFSSL_ENTER("BIO_ctrl_pending");
|
||||
if (bio == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (bio->ssl != NULL) {
|
||||
return (long)wolfSSL_pending(bio->ssl);
|
||||
}
|
||||
|
||||
if (bio->type == BIO_MEMORY) {
|
||||
return bio->memLen;
|
||||
}
|
||||
|
||||
/* type BIO_BIO then check paired buffer */
|
||||
if (bio->type == BIO_BIO && bio->pair != NULL) {
|
||||
WOLFSSL_BIO* pair = bio->pair;
|
||||
if (pair->wrIdx > 0 && pair->wrIdx <= pair->rdIdx) {
|
||||
/* in wrap around state where begining of buffer is being
|
||||
* overwritten */
|
||||
return pair->wrSz - pair->rdIdx + pair->wrIdx;
|
||||
}
|
||||
else {
|
||||
/* simple case where has not wrapped around */
|
||||
return pair->wrIdx - pair->rdIdx;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
long wolfSSL_BIO_get_mem_ptr(WOLFSSL_BIO *bio, WOLFSSL_BUF_MEM **ptr)
|
||||
{
|
||||
WOLFSSL_ENTER("BIO_get_mem_ptr");
|
||||
|
||||
if (bio == NULL || ptr == NULL) {
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
|
||||
*ptr = (WOLFSSL_BUF_MEM*)(bio->mem);
|
||||
return SSL_SUCCESS;
|
||||
}
|
||||
|
||||
/*** TBD ***/
|
||||
WOLFSSL_API long wolfSSL_BIO_int_ctrl(WOLFSSL_BIO *bp, int cmd, long larg, int iarg)
|
||||
{
|
||||
(void) bp;
|
||||
(void) cmd;
|
||||
(void) larg;
|
||||
(void) iarg;
|
||||
WOLFSSL_ENTER("BIO_int_ctrl");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int wolfSSL_BIO_set_write_buf_size(WOLFSSL_BIO *bio, long size)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_BIO_set_write_buf_size");
|
||||
|
||||
if (bio == NULL || bio->type != BIO_BIO || size < 0) {
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
|
||||
/* if already in pair then do not change size */
|
||||
if (bio->pair != NULL) {
|
||||
WOLFSSL_MSG("WOLFSSL_BIO is paired, free from pair before changing");
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
|
||||
bio->wrSz = (int)size;
|
||||
if (bio->wrSz < 0) {
|
||||
WOLFSSL_MSG("Unexpected negative size value");
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
|
||||
if (bio->mem != NULL) {
|
||||
XFREE(bio->mem, bio->heap, DYNAMIC_TYPE_OPENSSL);
|
||||
}
|
||||
|
||||
bio->mem = (byte*)XMALLOC(bio->wrSz, bio->heap, DYNAMIC_TYPE_OPENSSL);
|
||||
if (bio->mem == NULL) {
|
||||
WOLFSSL_MSG("Memory allocation error");
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
bio->wrIdx = 0;
|
||||
bio->rdIdx = 0;
|
||||
|
||||
return SSL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* Joins two BIO_BIO types. The write of b1 goes to the read of b2 and vise
|
||||
* versa. Creating something similar to a two way pipe.
|
||||
* Reading and writing between the two BIOs is not thread safe, they are
|
||||
* expected to be used by the same thread. */
|
||||
int wolfSSL_BIO_make_bio_pair(WOLFSSL_BIO *b1, WOLFSSL_BIO *b2)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_BIO_make_bio_pair");
|
||||
|
||||
if (b1 == NULL || b2 == NULL) {
|
||||
WOLFSSL_LEAVE("wolfSSL_BIO_make_bio_pair", BAD_FUNC_ARG);
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
|
||||
/* both are expected to be of type BIO and not already paired */
|
||||
if (b1->type != BIO_BIO || b2->type != BIO_BIO ||
|
||||
b1->pair != NULL || b2->pair != NULL) {
|
||||
WOLFSSL_MSG("Expected type BIO and not already paired");
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
|
||||
/* set default write size if not already set */
|
||||
if (b1->mem == NULL && wolfSSL_BIO_set_write_buf_size(b1,
|
||||
WOLFSSL_BIO_SIZE) != SSL_SUCCESS) {
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
|
||||
if (b2->mem == NULL && wolfSSL_BIO_set_write_buf_size(b2,
|
||||
WOLFSSL_BIO_SIZE) != SSL_SUCCESS) {
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
|
||||
b1->pair = b2;
|
||||
b2->pair = b1;
|
||||
|
||||
return SSL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int wolfSSL_BIO_ctrl_reset_read_request(WOLFSSL_BIO *b)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_BIO_ctrl_reset_read_request");
|
||||
|
||||
if (b == NULL) {
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
|
||||
b->readRq = 0;
|
||||
|
||||
return SSL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* Does not advance read index pointer */
|
||||
int wolfSSL_BIO_nread0(WOLFSSL_BIO *bio, char **buf)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_BIO_nread0");
|
||||
|
||||
if (bio == NULL || buf == NULL) {
|
||||
WOLFSSL_MSG("NULL argument passed in");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* if paired read from pair */
|
||||
if (bio->pair != NULL) {
|
||||
WOLFSSL_BIO* pair = bio->pair;
|
||||
|
||||
/* case where have wrapped around write buffer */
|
||||
*buf = (char*)pair->mem + pair->rdIdx;
|
||||
if (pair->wrIdx > 0 && pair->rdIdx >= pair->wrIdx) {
|
||||
return pair->wrSz - pair->rdIdx;
|
||||
}
|
||||
else {
|
||||
return pair->wrIdx - pair->rdIdx;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* similar to wolfSSL_BIO_nread0 but advances the read index */
|
||||
int wolfSSL_BIO_nread(WOLFSSL_BIO *bio, char **buf, int num)
|
||||
{
|
||||
int sz = WOLFSSL_BIO_UNSET;
|
||||
|
||||
WOLFSSL_ENTER("wolfSSL_BIO_nread");
|
||||
|
||||
if (bio == NULL || buf == NULL) {
|
||||
WOLFSSL_MSG("NULL argument passed in");
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
|
||||
if (bio->pair != NULL) {
|
||||
/* special case if asking to read 0 bytes */
|
||||
if (num == 0) {
|
||||
*buf = (char*)bio->pair->mem + bio->pair->rdIdx;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* get amount able to read and set buffer pointer */
|
||||
sz = wolfSSL_BIO_nread0(bio, buf);
|
||||
if (sz == 0) {
|
||||
return WOLFSSL_BIO_ERROR;
|
||||
}
|
||||
|
||||
if (num < sz) {
|
||||
sz = num;
|
||||
}
|
||||
bio->pair->rdIdx += sz;
|
||||
|
||||
/* check if have read to the end of the buffer and need to reset */
|
||||
if (bio->pair->rdIdx == bio->pair->wrSz) {
|
||||
bio->pair->rdIdx = 0;
|
||||
if (bio->pair->wrIdx == bio->pair->wrSz) {
|
||||
bio->pair->wrIdx = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* check if read up to write index, if so then reset indexs */
|
||||
if (bio->pair->rdIdx == bio->pair->wrIdx) {
|
||||
bio->pair->rdIdx = 0;
|
||||
bio->pair->wrIdx = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return sz;
|
||||
}
|
||||
|
||||
|
||||
int wolfSSL_BIO_nwrite(WOLFSSL_BIO *bio, char **buf, int num)
|
||||
{
|
||||
int sz = WOLFSSL_BIO_UNSET;
|
||||
|
||||
WOLFSSL_ENTER("wolfSSL_BIO_nwrite");
|
||||
|
||||
if (bio == NULL || buf == NULL) {
|
||||
WOLFSSL_MSG("NULL argument passed in");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (bio->pair != NULL) {
|
||||
if (num == 0) {
|
||||
*buf = (char*)bio->mem + bio->wrIdx;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (bio->wrIdx < bio->rdIdx) {
|
||||
/* if wrapped around only write up to read index. In this case
|
||||
* rdIdx is always greater then wrIdx so sz will not be negative. */
|
||||
sz = bio->rdIdx - bio->wrIdx;
|
||||
}
|
||||
else if (bio->rdIdx > 0 && bio->wrIdx == bio->rdIdx) {
|
||||
return WOLFSSL_BIO_ERROR; /* no more room to write */
|
||||
}
|
||||
else {
|
||||
/* write index is past read index so write to end of buffer */
|
||||
sz = bio->wrSz - bio->wrIdx;
|
||||
|
||||
if (sz <= 0) {
|
||||
/* either an error has occured with write index or it is at the
|
||||
* end of the write buffer. */
|
||||
if (bio->rdIdx == 0) {
|
||||
/* no more room, nothing has been read */
|
||||
return WOLFSSL_BIO_ERROR;
|
||||
}
|
||||
|
||||
bio->wrIdx = 0;
|
||||
|
||||
/* check case where read index is not at 0 */
|
||||
if (bio->rdIdx > 0) {
|
||||
sz = bio->rdIdx; /* can write up to the read index */
|
||||
}
|
||||
else {
|
||||
sz = bio->wrSz; /* no restriction other then buffer size */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (num < sz) {
|
||||
sz = num;
|
||||
}
|
||||
*buf = (char*)bio->mem + bio->wrIdx;
|
||||
bio->wrIdx += sz;
|
||||
|
||||
/* if at the end of the buffer and space for wrap around then set
|
||||
* write index back to 0 */
|
||||
if (bio->wrIdx == bio->wrSz && bio->rdIdx > 0) {
|
||||
bio->wrIdx = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return sz;
|
||||
}
|
||||
|
||||
|
||||
/* Reset BIO to initial state */
|
||||
int wolfSSL_BIO_reset(WOLFSSL_BIO *bio)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_BIO_reset");
|
||||
|
||||
if (bio == NULL) {
|
||||
WOLFSSL_MSG("NULL argument passed in");
|
||||
/* -1 is consistent failure even for FILE type */
|
||||
return WOLFSSL_BIO_ERROR;
|
||||
}
|
||||
|
||||
switch (bio->type) {
|
||||
#ifndef NO_FILESYSTEM
|
||||
case BIO_FILE:
|
||||
XREWIND(bio->file);
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
case BIO_BIO:
|
||||
bio->rdIdx = 0;
|
||||
bio->wrIdx = 0;
|
||||
return 0;
|
||||
|
||||
default:
|
||||
WOLFSSL_MSG("Unknown BIO type needs added to reset function");
|
||||
}
|
||||
|
||||
return WOLFSSL_BIO_ERROR;
|
||||
}
|
||||
|
||||
#ifndef NO_FILESYSTEM
|
||||
long wolfSSL_BIO_set_fp(WOLFSSL_BIO *bio, XFILE fp, int c)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_BIO_set_fp");
|
||||
|
||||
if (bio == NULL || fp == NULL) {
|
||||
WOLFSSL_LEAVE("wolfSSL_BIO_set_fp", BAD_FUNC_ARG);
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
|
||||
if (bio->type != BIO_FILE) {
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
|
||||
bio->close = (byte)c;
|
||||
bio->file = fp;
|
||||
|
||||
return SSL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
long wolfSSL_BIO_get_fp(WOLFSSL_BIO *bio, XFILE* fp)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_BIO_get_fp");
|
||||
|
||||
if (bio == NULL || fp == NULL) {
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
|
||||
if (bio->type != BIO_FILE) {
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
|
||||
*fp = bio->file;
|
||||
|
||||
return SSL_SUCCESS;
|
||||
}
|
||||
|
||||
/* overwrites file */
|
||||
int wolfSSL_BIO_write_filename(WOLFSSL_BIO *bio, char *name)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_BIO_write_filename");
|
||||
|
||||
if (bio == NULL || name == NULL) {
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
|
||||
if (bio->type == BIO_FILE) {
|
||||
if (bio->file != NULL && bio->close == BIO_CLOSE) {
|
||||
XFCLOSE(bio->file);
|
||||
}
|
||||
|
||||
bio->file = XFOPEN(name, "w");
|
||||
if (bio->file == NULL) {
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
bio->close = BIO_CLOSE;
|
||||
|
||||
return SSL_SUCCESS;
|
||||
}
|
||||
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
int wolfSSL_BIO_seek(WOLFSSL_BIO *bio, int ofs)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_BIO_seek");
|
||||
|
||||
if (bio == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* offset ofs from begining of file */
|
||||
if (bio->type == BIO_FILE && XFSEEK(bio->file, ofs, SEEK_SET) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* NO_FILESYSTEM */
|
||||
|
||||
|
||||
long wolfSSL_BIO_set_mem_eof_return(WOLFSSL_BIO *bio, int v)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_BIO_set_mem_eof_return");
|
||||
|
||||
if (bio != NULL) {
|
||||
bio->eof = v;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
298
src/crl.c
Normal file → Executable file
298
src/crl.c
Normal file → Executable file
@@ -34,11 +34,6 @@
|
||||
#include <wolfssl/internal.h>
|
||||
#include <wolfssl/error-ssl.h>
|
||||
|
||||
#ifndef NO_FILESYSTEM
|
||||
#include <dirent.h>
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_CRL_MONITOR
|
||||
@@ -79,7 +74,8 @@ int InitCRL(WOLFSSL_CRL* crl, WOLFSSL_CERT_MANAGER* cm)
|
||||
|
||||
|
||||
/* Initialize CRL Entry */
|
||||
static int InitCRL_Entry(CRL_Entry* crle, DecodedCRL* dcrl)
|
||||
static int InitCRL_Entry(CRL_Entry* crle, DecodedCRL* dcrl, const byte* buff,
|
||||
int verified, void* heap)
|
||||
{
|
||||
WOLFSSL_ENTER("InitCRL_Entry");
|
||||
|
||||
@@ -94,6 +90,34 @@ static int InitCRL_Entry(CRL_Entry* crle, DecodedCRL* dcrl)
|
||||
crle->certs = dcrl->certs; /* take ownsership */
|
||||
dcrl->certs = NULL;
|
||||
crle->totalCerts = dcrl->totalCerts;
|
||||
crle->verified = verified;
|
||||
if (!verified) {
|
||||
crle->tbsSz = dcrl->sigIndex - dcrl->certBegin;
|
||||
crle->signatureSz = dcrl->sigLength;
|
||||
crle->signatureOID = dcrl->signatureOID;
|
||||
crle->toBeSigned = XMALLOC(crle->tbsSz, heap, DYNAMIC_TYPE_CRL_ENTRY);
|
||||
if (crle->toBeSigned == NULL)
|
||||
return -1;
|
||||
crle->signature = XMALLOC(crle->signatureSz, heap,
|
||||
DYNAMIC_TYPE_CRL_ENTRY);
|
||||
if (crle->signature == NULL) {
|
||||
XFREE(crle->toBeSigned, crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
|
||||
return -1;
|
||||
}
|
||||
XMEMCPY(crle->toBeSigned, buff + dcrl->certBegin, crle->tbsSz);
|
||||
XMEMCPY(crle->signature, dcrl->signature, crle->signatureSz);
|
||||
#if !defined(NO_SKID) && defined(CRL_SKID_READY)
|
||||
crle->extAuthKeyIdSet = dcrl->extAuthKeyIdSet;
|
||||
if (crle->extAuthKeyIdSet)
|
||||
XMEMCPY(crle->extAuthKeyId, dcrl->extAuthKeyId, KEYID_SIZE);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
crle->toBeSigned = NULL;
|
||||
crle->signature = NULL;
|
||||
}
|
||||
|
||||
(void)verified;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -111,6 +135,10 @@ static void FreeCRL_Entry(CRL_Entry* crle, void* heap)
|
||||
XFREE(tmp, heap, DYNAMIC_TYPE_REVOKED);
|
||||
tmp = next;
|
||||
}
|
||||
if (crle->signature != NULL)
|
||||
XFREE(crle->signature, heap, DYNAMIC_TYPE_REVOKED);
|
||||
if (crle->toBeSigned != NULL)
|
||||
XFREE(crle->toBeSigned, heap, DYNAMIC_TYPE_REVOKED);
|
||||
|
||||
(void)heap;
|
||||
}
|
||||
@@ -154,15 +182,12 @@ void FreeCRL(WOLFSSL_CRL* crl, int dynamic)
|
||||
}
|
||||
|
||||
|
||||
/* Is the cert ok with CRL, return 0 on success */
|
||||
int CheckCertCRL(WOLFSSL_CRL* crl, DecodedCert* cert)
|
||||
static int CheckCertCRLList(WOLFSSL_CRL* crl, DecodedCert* cert, int *pFoundEntry)
|
||||
{
|
||||
CRL_Entry* crle;
|
||||
int foundEntry = 0;
|
||||
int ret = 0;
|
||||
|
||||
WOLFSSL_ENTER("CheckCertCRL");
|
||||
|
||||
if (wc_LockMutex(&crl->crlLock) != 0) {
|
||||
WOLFSSL_MSG("wc_LockMutex failed");
|
||||
return BAD_MUTEX_E;
|
||||
@@ -175,6 +200,95 @@ int CheckCertCRL(WOLFSSL_CRL* crl, DecodedCert* cert)
|
||||
int doNextDate = 1;
|
||||
|
||||
WOLFSSL_MSG("Found CRL Entry on list");
|
||||
|
||||
if (crle->verified == 0) {
|
||||
Signer* ca;
|
||||
#if !defined(NO_SKID) && defined(CRL_SKID_READY)
|
||||
byte extAuthKeyId[KEYID_SIZE]
|
||||
#endif
|
||||
byte issuerHash[CRL_DIGEST_SIZE];
|
||||
byte* tbs = NULL;
|
||||
word32 tbsSz = crle->tbsSz;
|
||||
byte* sig = NULL;
|
||||
word32 sigSz = crle->signatureSz;
|
||||
word32 sigOID = crle->signatureOID;
|
||||
SignatureCtx sigCtx;
|
||||
|
||||
tbs = XMALLOC(tbsSz, crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
|
||||
if (tbs == NULL) {
|
||||
wc_UnLockMutex(&crl->crlLock);
|
||||
return MEMORY_E;
|
||||
}
|
||||
sig = XMALLOC(sigSz, crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
|
||||
if (sig == NULL) {
|
||||
XFREE(tbs, crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
|
||||
wc_UnLockMutex(&crl->crlLock);
|
||||
return MEMORY_E;
|
||||
}
|
||||
|
||||
XMEMCPY(tbs, crle->toBeSigned, tbsSz);
|
||||
XMEMCPY(sig, crle->signature, sigSz);
|
||||
#if !defined(NO_SKID) && defined(CRL_SKID_READY)
|
||||
XMEMCMPY(extAuthKeyId, crle->extAuthKeyId,
|
||||
sizeof(extAuthKeyId));
|
||||
#endif
|
||||
XMEMCPY(issuerHash, crle->issuerHash, sizeof(issuerHash));
|
||||
|
||||
wc_UnLockMutex(&crl->crlLock);
|
||||
|
||||
#if !defined(NO_SKID) && defined(CRL_SKID_READY)
|
||||
if (crle->extAuthKeyIdSet)
|
||||
ca = GetCA(crl->cm, extAuthKeyId);
|
||||
if (ca == NULL)
|
||||
ca = GetCAByName(crl->cm, issuerHash);
|
||||
#else /* NO_SKID */
|
||||
ca = GetCA(crl->cm, issuerHash);
|
||||
#endif /* NO_SKID */
|
||||
if (ca == NULL) {
|
||||
WOLFSSL_MSG("Did NOT find CRL issuer CA");
|
||||
return ASN_CRL_NO_SIGNER_E;
|
||||
}
|
||||
|
||||
ret = VerifyCRL_Signature(&sigCtx, tbs, tbsSz, sig, sigSz,
|
||||
sigOID, ca, crl->heap);
|
||||
|
||||
XFREE(sig, crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
|
||||
XFREE(tbs, crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
|
||||
|
||||
if (wc_LockMutex(&crl->crlLock) != 0) {
|
||||
WOLFSSL_MSG("wc_LockMutex failed");
|
||||
return BAD_MUTEX_E;
|
||||
}
|
||||
|
||||
crle = crl->crlList;
|
||||
while (crle) {
|
||||
if (XMEMCMP(crle->issuerHash, cert->issuerHash,
|
||||
CRL_DIGEST_SIZE) == 0) {
|
||||
|
||||
if (ret == 0)
|
||||
crle->verified = 1;
|
||||
else
|
||||
crle->verified = ret;
|
||||
|
||||
XFREE(crle->toBeSigned, crl->heap,
|
||||
DYNAMIC_TYPE_CRL_ENTRY);
|
||||
crle->toBeSigned = NULL;
|
||||
XFREE(crle->signature, crl->heap,
|
||||
DYNAMIC_TYPE_CRL_ENTRY);
|
||||
crle->signature = NULL;
|
||||
break;
|
||||
}
|
||||
crle = crle->next;
|
||||
}
|
||||
if (crle == NULL || crle->verified < 0)
|
||||
break;
|
||||
}
|
||||
else if (crle->verified < 0) {
|
||||
WOLFSSL_MSG("Cannot use CRL as it didn't verify");
|
||||
ret = crle->verified;
|
||||
break;
|
||||
}
|
||||
|
||||
WOLFSSL_MSG("Checking next date validity");
|
||||
|
||||
#ifdef WOLFSSL_NO_CRL_NEXT_DATE
|
||||
@@ -182,13 +296,17 @@ int CheckCertCRL(WOLFSSL_CRL* crl, DecodedCert* cert)
|
||||
doNextDate = 0; /* skip */
|
||||
#endif
|
||||
|
||||
if (doNextDate && !ValidateDate(crle->nextDate,
|
||||
crle->nextDateFormat, AFTER)) {
|
||||
WOLFSSL_MSG("CRL next date is no longer valid");
|
||||
ret = ASN_AFTER_DATE_E;
|
||||
if (doNextDate) {
|
||||
#ifndef NO_ASN_TIME
|
||||
if (!ValidateDate(crle->nextDate,crle->nextDateFormat, AFTER)) {
|
||||
WOLFSSL_MSG("CRL next date is no longer valid");
|
||||
ret = ASN_AFTER_DATE_E;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
if (ret == 0) {
|
||||
foundEntry = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
crle = crle->next;
|
||||
@@ -209,9 +327,39 @@ int CheckCertCRL(WOLFSSL_CRL* crl, DecodedCert* cert)
|
||||
|
||||
wc_UnLockMutex(&crl->crlLock);
|
||||
|
||||
*pFoundEntry = foundEntry;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Is the cert ok with CRL, return 0 on success */
|
||||
int CheckCertCRL(WOLFSSL_CRL* crl, DecodedCert* cert)
|
||||
{
|
||||
int foundEntry = 0;
|
||||
int ret = 0;
|
||||
|
||||
WOLFSSL_ENTER("CheckCertCRL");
|
||||
|
||||
ret = CheckCertCRLList(crl, cert, &foundEntry);
|
||||
|
||||
#ifdef HAVE_CRL_IO
|
||||
if (foundEntry == 0) {
|
||||
/* perform embedded lookup */
|
||||
if (crl->crlIOCb) {
|
||||
ret = crl->crlIOCb(crl, (const char*)cert->extCrlInfo,
|
||||
cert->extCrlInfoSz);
|
||||
if (ret >= 0) {
|
||||
/* try again */
|
||||
ret = CheckCertCRLList(crl, cert, &foundEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (foundEntry == 0) {
|
||||
WOLFSSL_MSG("Couldn't find CRL for status check");
|
||||
ret = CRL_MISSING;
|
||||
|
||||
if (crl->cm->cbMissingCRL) {
|
||||
char url[256];
|
||||
|
||||
@@ -224,17 +372,18 @@ int CheckCertCRL(WOLFSSL_CRL* crl, DecodedCert* cert)
|
||||
else {
|
||||
WOLFSSL_MSG("CRL url too long");
|
||||
}
|
||||
|
||||
crl->cm->cbMissingCRL(url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* Add Decoded CRL, 0 on success */
|
||||
static int AddCRL(WOLFSSL_CRL* crl, DecodedCRL* dcrl)
|
||||
static int AddCRL(WOLFSSL_CRL* crl, DecodedCRL* dcrl, const byte* buff,
|
||||
int verified)
|
||||
{
|
||||
CRL_Entry* crle;
|
||||
|
||||
@@ -246,7 +395,7 @@ static int AddCRL(WOLFSSL_CRL* crl, DecodedCRL* dcrl)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (InitCRL_Entry(crle, dcrl) < 0) {
|
||||
if (InitCRL_Entry(crle, dcrl, buff, verified, crl->heap) < 0) {
|
||||
WOLFSSL_MSG("Init CRL Entry failed");
|
||||
XFREE(crle, crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
|
||||
return -1;
|
||||
@@ -267,7 +416,8 @@ static int AddCRL(WOLFSSL_CRL* crl, DecodedCRL* dcrl)
|
||||
|
||||
|
||||
/* Load CRL File of type, SSL_SUCCESS on ok */
|
||||
int BufferLoadCRL(WOLFSSL_CRL* crl, const byte* buff, long sz, int type)
|
||||
int BufferLoadCRL(WOLFSSL_CRL* crl, const byte* buff, long sz, int type,
|
||||
int noVerify)
|
||||
{
|
||||
int ret = SSL_SUCCESS;
|
||||
const byte* myBuffer = buff; /* if DER ok, otherwise switch */
|
||||
@@ -310,11 +460,11 @@ int BufferLoadCRL(WOLFSSL_CRL* crl, const byte* buff, long sz, int type)
|
||||
|
||||
InitDecodedCRL(dcrl, crl->heap);
|
||||
ret = ParseCRL(dcrl, myBuffer, (word32)sz, crl->cm);
|
||||
if (ret != 0) {
|
||||
if (ret != 0 && !(ret == ASN_CRL_NO_SIGNER_E && noVerify)) {
|
||||
WOLFSSL_MSG("ParseCRL error");
|
||||
}
|
||||
else {
|
||||
ret = AddCRL(crl, dcrl);
|
||||
ret = AddCRL(crl, dcrl, myBuffer, ret != ASN_CRL_NO_SIGNER_E);
|
||||
if (ret != 0) {
|
||||
WOLFSSL_MSG("AddCRL error");
|
||||
}
|
||||
@@ -790,74 +940,61 @@ static int StartMonitorCRL(WOLFSSL_CRL* crl)
|
||||
|
||||
#endif /* HAVE_CRL_MONITOR */
|
||||
|
||||
#ifndef NO_FILESYSTEM
|
||||
#if !defined(NO_FILESYSTEM) && !defined(NO_WOLFSSL_DIR)
|
||||
|
||||
/* Load CRL path files of type, SSL_SUCCESS on ok */
|
||||
int LoadCRL(WOLFSSL_CRL* crl, const char* path, int type, int monitor)
|
||||
{
|
||||
struct dirent* entry;
|
||||
DIR* dir;
|
||||
int ret = SSL_SUCCESS;
|
||||
int ret = SSL_SUCCESS;
|
||||
char* name = NULL;
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
char* name;
|
||||
ReadDirCtx* readCtx = NULL;
|
||||
#else
|
||||
char name[MAX_FILENAME_SZ];
|
||||
ReadDirCtx readCtx[1];
|
||||
#endif
|
||||
|
||||
WOLFSSL_ENTER("LoadCRL");
|
||||
if (crl == NULL)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
dir = opendir(path);
|
||||
if (dir == NULL) {
|
||||
WOLFSSL_MSG("opendir path crl load failed");
|
||||
return BAD_PATH_ERROR;
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
name = (char*)XMALLOC(MAX_FILENAME_SZ, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (name == NULL)
|
||||
readCtx = (ReadDirCtx*)XMALLOC(sizeof(ReadDirCtx), crl->heap,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (readCtx == NULL)
|
||||
return MEMORY_E;
|
||||
#endif
|
||||
|
||||
while ( (entry = readdir(dir)) != NULL) {
|
||||
struct stat s;
|
||||
|
||||
XMEMSET(name, 0, MAX_FILENAME_SZ);
|
||||
XSTRNCPY(name, path, MAX_FILENAME_SZ/2 - 2);
|
||||
XSTRNCAT(name, "/", 1);
|
||||
XSTRNCAT(name, entry->d_name, MAX_FILENAME_SZ/2);
|
||||
|
||||
if (stat(name, &s) != 0) {
|
||||
WOLFSSL_MSG("stat on name failed");
|
||||
continue;
|
||||
}
|
||||
if (s.st_mode & S_IFREG) {
|
||||
|
||||
if (type == SSL_FILETYPE_PEM) {
|
||||
if (XSTRSTR(entry->d_name, ".pem") == NULL) {
|
||||
WOLFSSL_MSG("not .pem file, skipping");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (XSTRSTR(entry->d_name, ".der") == NULL &&
|
||||
XSTRSTR(entry->d_name, ".crl") == NULL) {
|
||||
|
||||
WOLFSSL_MSG("not .der or .crl file, skipping");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (ProcessFile(NULL, name, type, CRL_TYPE, NULL, 0, crl)
|
||||
!= SSL_SUCCESS) {
|
||||
WOLFSSL_MSG("CRL file load failed, continuing");
|
||||
/* try to load each regular file in path */
|
||||
ret = wc_ReadDirFirst(readCtx, path, &name);
|
||||
while (ret == 0 && name) {
|
||||
int skip = 0;
|
||||
if (type == SSL_FILETYPE_PEM) {
|
||||
if (XSTRSTR(name, ".pem") == NULL) {
|
||||
WOLFSSL_MSG("not .pem file, skipping");
|
||||
skip = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (XSTRSTR(name, ".der") == NULL &&
|
||||
XSTRSTR(name, ".crl") == NULL)
|
||||
{
|
||||
WOLFSSL_MSG("not .der or .crl file, skipping");
|
||||
skip = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!skip && ProcessFile(NULL, name, type, CRL_TYPE, NULL, 0, crl)
|
||||
!= SSL_SUCCESS) {
|
||||
WOLFSSL_MSG("CRL file load failed, continuing");
|
||||
}
|
||||
|
||||
ret = wc_ReadDirNext(readCtx, path, &name);
|
||||
}
|
||||
wc_ReadDirClose(readCtx);
|
||||
ret = SSL_SUCCESS; /* load failures not reported, for backwards compat */
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(name, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(readCtx, crl->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
|
||||
if (monitor & WOLFSSL_CRL_MONITOR) {
|
||||
@@ -873,9 +1010,19 @@ int LoadCRL(WOLFSSL_CRL* crl, const char* path, int type, int monitor)
|
||||
pathBuf[pathLen] = '\0'; /* Null Terminate */
|
||||
|
||||
if (type == SSL_FILETYPE_PEM) {
|
||||
/* free old path before setting a new one */
|
||||
if (crl->monitors[0].path) {
|
||||
XFREE(crl->monitors[0].path, crl->heap,
|
||||
DYNAMIC_TYPE_CRL_MONITOR);
|
||||
}
|
||||
crl->monitors[0].path = pathBuf;
|
||||
crl->monitors[0].type = SSL_FILETYPE_PEM;
|
||||
} else {
|
||||
/* free old path before setting a new one */
|
||||
if (crl->monitors[1].path) {
|
||||
XFREE(crl->monitors[1].path, crl->heap,
|
||||
DYNAMIC_TYPE_CRL_MONITOR);
|
||||
}
|
||||
crl->monitors[1].path = pathBuf;
|
||||
crl->monitors[1].type = SSL_FILETYPE_ASN1;
|
||||
}
|
||||
@@ -891,12 +1038,21 @@ int LoadCRL(WOLFSSL_CRL* crl, const char* path, int type, int monitor)
|
||||
}
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* NO_FILESYSTEM */
|
||||
#else
|
||||
int LoadCRL(WOLFSSL_CRL* crl, const char* path, int type, int monitor)
|
||||
{
|
||||
(void)crl;
|
||||
(void)path;
|
||||
(void)type;
|
||||
(void)monitor;
|
||||
|
||||
/* stub for scenario where file system is not supported */
|
||||
return NOT_COMPILED_IN;
|
||||
}
|
||||
#endif /* !NO_FILESYSTEM && !NO_WOLFSSL_DIR */
|
||||
|
||||
#endif /* HAVE_CRL */
|
||||
#endif /* !WOLFCRYPT_ONLY */
|
||||
|
@@ -120,7 +120,8 @@ src_libwolfssl_la_SOURCES += \
|
||||
wolfcrypt/src/wc_encrypt.c \
|
||||
wolfcrypt/src/wc_port.c \
|
||||
wolfcrypt/src/error.c \
|
||||
wolfcrypt/src/signature.c
|
||||
wolfcrypt/src/signature.c \
|
||||
wolfcrypt/src/wolfmath.c
|
||||
|
||||
if BUILD_MEMORY
|
||||
src_libwolfssl_la_SOURCES += wolfcrypt/src/memory.c
|
||||
@@ -261,7 +262,8 @@ src_libwolfssl_la_SOURCES += \
|
||||
src/io.c \
|
||||
src/keys.c \
|
||||
src/ssl.c \
|
||||
src/tls.c
|
||||
src/tls.c \
|
||||
src/tls13.c
|
||||
|
||||
if BUILD_OCSP
|
||||
src_libwolfssl_la_SOURCES += src/ocsp.c
|
||||
|
8776
src/internal.c
Normal file → Executable file
8776
src/internal.c
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
460
src/keys.c
460
src/keys.c
@@ -1053,8 +1053,109 @@ int SetCipherSpecs(WOLFSSL* ssl)
|
||||
return UNSUPPORTED_SUITE;
|
||||
} /* switch */
|
||||
} /* if */
|
||||
if (ssl->options.cipherSuite0 != ECC_BYTE &&
|
||||
ssl->options.cipherSuite0 != CHACHA_BYTE) { /* normal suites */
|
||||
|
||||
/* TLSi v1.3 cipher suites, 0x13 */
|
||||
if (ssl->options.cipherSuite0 == TLS13_BYTE) {
|
||||
switch (ssl->options.cipherSuite) {
|
||||
|
||||
#ifdef WOLFSSL_TLS13
|
||||
#ifdef BUILD_TLS_AES_128_GCM_SHA256
|
||||
case TLS_AES_128_GCM_SHA256 :
|
||||
ssl->specs.bulk_cipher_algorithm = wolfssl_aes_gcm;
|
||||
ssl->specs.cipher_type = aead;
|
||||
ssl->specs.mac_algorithm = sha256_mac;
|
||||
ssl->specs.kea = 0;
|
||||
ssl->specs.sig_algo = 0;
|
||||
ssl->specs.hash_size = SHA256_DIGEST_SIZE;
|
||||
ssl->specs.pad_size = PAD_SHA;
|
||||
ssl->specs.static_ecdh = 0;
|
||||
ssl->specs.key_size = AES_128_KEY_SIZE;
|
||||
ssl->specs.block_size = AES_BLOCK_SIZE;
|
||||
ssl->specs.iv_size = AESGCM_NONCE_SZ;
|
||||
ssl->specs.aead_mac_size = AES_GCM_AUTH_SZ;
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_TLS_AES_256_GCM_SHA384
|
||||
case TLS_AES_256_GCM_SHA384 :
|
||||
ssl->specs.bulk_cipher_algorithm = wolfssl_aes_gcm;
|
||||
ssl->specs.cipher_type = aead;
|
||||
ssl->specs.mac_algorithm = sha384_mac;
|
||||
ssl->specs.kea = 0;
|
||||
ssl->specs.sig_algo = 0;
|
||||
ssl->specs.hash_size = SHA384_DIGEST_SIZE;
|
||||
ssl->specs.pad_size = PAD_SHA;
|
||||
ssl->specs.static_ecdh = 0;
|
||||
ssl->specs.key_size = AES_256_KEY_SIZE;
|
||||
ssl->specs.block_size = AES_BLOCK_SIZE;
|
||||
ssl->specs.iv_size = AESGCM_NONCE_SZ;
|
||||
ssl->specs.aead_mac_size = AES_GCM_AUTH_SZ;
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_TLS_CHACHA20_POLY1305_SHA256
|
||||
case TLS_CHACHA20_POLY1305_SHA256 :
|
||||
ssl->specs.bulk_cipher_algorithm = wolfssl_chacha;
|
||||
ssl->specs.cipher_type = aead;
|
||||
ssl->specs.mac_algorithm = sha256_mac;
|
||||
ssl->specs.kea = 0;
|
||||
ssl->specs.sig_algo = 0;
|
||||
ssl->specs.hash_size = SHA256_DIGEST_SIZE;
|
||||
ssl->specs.pad_size = PAD_SHA;
|
||||
ssl->specs.static_ecdh = 0;
|
||||
ssl->specs.key_size = CHACHA20_256_KEY_SIZE;
|
||||
ssl->specs.block_size = CHACHA20_BLOCK_SIZE;
|
||||
ssl->specs.iv_size = CHACHA20_IV_SIZE;
|
||||
ssl->specs.aead_mac_size = POLY1305_AUTH_SZ;
|
||||
ssl->options.oldPoly = 0; /* use recent padding RFC */
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_TLS_AES_128_CCM_SHA256
|
||||
case TLS_AES_128_CCM_SHA256 :
|
||||
ssl->specs.bulk_cipher_algorithm = wolfssl_aes_ccm;
|
||||
ssl->specs.cipher_type = aead;
|
||||
ssl->specs.mac_algorithm = sha256_mac;
|
||||
ssl->specs.kea = 0;
|
||||
ssl->specs.sig_algo = 0;
|
||||
ssl->specs.hash_size = SHA256_DIGEST_SIZE;
|
||||
ssl->specs.pad_size = PAD_SHA;
|
||||
ssl->specs.static_ecdh = 0;
|
||||
ssl->specs.key_size = AES_128_KEY_SIZE;
|
||||
ssl->specs.block_size = AES_BLOCK_SIZE;
|
||||
ssl->specs.iv_size = AESGCM_NONCE_SZ;
|
||||
ssl->specs.aead_mac_size = AES_CCM_16_AUTH_SZ;
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_TLS_AES_128_CCM_8_SHA256
|
||||
case TLS_AES_128_CCM_8_SHA256 :
|
||||
ssl->specs.bulk_cipher_algorithm = wolfssl_aes_ccm;
|
||||
ssl->specs.cipher_type = aead;
|
||||
ssl->specs.mac_algorithm = sha256_mac;
|
||||
ssl->specs.kea = 0;
|
||||
ssl->specs.sig_algo = 0;
|
||||
ssl->specs.hash_size = SHA256_DIGEST_SIZE;
|
||||
ssl->specs.pad_size = PAD_SHA;
|
||||
ssl->specs.static_ecdh = 0;
|
||||
ssl->specs.key_size = AES_128_KEY_SIZE;
|
||||
ssl->specs.block_size = AES_BLOCK_SIZE;
|
||||
ssl->specs.iv_size = AESGCM_NONCE_SZ;
|
||||
ssl->specs.aead_mac_size = AES_CCM_8_AUTH_SZ;
|
||||
|
||||
break;
|
||||
#endif
|
||||
#endif /* WOLFSSL_TLS13 */
|
||||
}
|
||||
}
|
||||
|
||||
if (ssl->options.cipherSuite0 != ECC_BYTE &&
|
||||
ssl->options.cipherSuite0 != CHACHA_BYTE &&
|
||||
ssl->options.cipherSuite0 != TLS13_BYTE) { /* normal suites */
|
||||
switch (ssl->options.cipherSuite) {
|
||||
|
||||
#ifdef BUILD_SSL_RSA_WITH_RC4_128_SHA
|
||||
@@ -1653,7 +1754,7 @@ int SetCipherSpecs(WOLFSSL* ssl)
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef BUILD_TLS_RSA_WITH_HC_128_SHA
|
||||
case TLS_RSA_WITH_HC_128_SHA :
|
||||
ssl->specs.bulk_cipher_algorithm = wolfssl_hc128;
|
||||
@@ -1667,7 +1768,7 @@ int SetCipherSpecs(WOLFSSL* ssl)
|
||||
ssl->specs.key_size = HC_128_KEY_SIZE;
|
||||
ssl->specs.block_size = 0;
|
||||
ssl->specs.iv_size = HC_128_IV_SIZE;
|
||||
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -1684,7 +1785,7 @@ int SetCipherSpecs(WOLFSSL* ssl)
|
||||
ssl->specs.key_size = HC_128_KEY_SIZE;
|
||||
ssl->specs.block_size = 0;
|
||||
ssl->specs.iv_size = HC_128_IV_SIZE;
|
||||
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -1701,7 +1802,7 @@ int SetCipherSpecs(WOLFSSL* ssl)
|
||||
ssl->specs.key_size = AES_128_KEY_SIZE;
|
||||
ssl->specs.iv_size = AES_IV_SIZE;
|
||||
ssl->specs.block_size = AES_BLOCK_SIZE;
|
||||
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -1718,7 +1819,7 @@ int SetCipherSpecs(WOLFSSL* ssl)
|
||||
ssl->specs.key_size = AES_256_KEY_SIZE;
|
||||
ssl->specs.iv_size = AES_IV_SIZE;
|
||||
ssl->specs.block_size = AES_BLOCK_SIZE;
|
||||
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -1827,7 +1928,7 @@ int SetCipherSpecs(WOLFSSL* ssl)
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef BUILD_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA
|
||||
case TLS_RSA_WITH_CAMELLIA_256_CBC_SHA :
|
||||
ssl->specs.bulk_cipher_algorithm = wolfssl_camellia;
|
||||
@@ -1978,7 +2079,7 @@ int SetCipherSpecs(WOLFSSL* ssl)
|
||||
ssl->specs.key_size = IDEA_KEY_SIZE;
|
||||
ssl->specs.block_size = IDEA_BLOCK_SIZE;
|
||||
ssl->specs.iv_size = IDEA_IV_SIZE;
|
||||
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -1993,8 +2094,11 @@ int SetCipherSpecs(WOLFSSL* ssl)
|
||||
#ifndef NO_TLS
|
||||
ssl->options.tls = 1;
|
||||
ssl->hmac = TLS_hmac;
|
||||
if (ssl->version.minor >= 2)
|
||||
if (ssl->version.minor >= 2) {
|
||||
ssl->options.tls1_1 = 1;
|
||||
if (ssl->version.minor >= 4)
|
||||
ssl->options.tls1_3 = 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2049,7 +2153,7 @@ static int SetPrefix(byte* sha_input, int idx)
|
||||
break;
|
||||
default:
|
||||
WOLFSSL_MSG("Set Prefix error, bad input");
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -2070,22 +2174,20 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
dec->arc4 = (Arc4*)XMALLOC(sizeof(Arc4), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (dec && dec->arc4 == NULL)
|
||||
return MEMORY_E;
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (devId != INVALID_DEVID) {
|
||||
if (enc) {
|
||||
if (wc_Arc4AsyncInit(enc->arc4, devId) != 0) {
|
||||
WOLFSSL_MSG("Arc4AsyncInit failed in SetKeys");
|
||||
return ASYNC_INIT_E;
|
||||
}
|
||||
}
|
||||
if (dec) {
|
||||
if (wc_Arc4AsyncInit(dec->arc4, devId) != 0) {
|
||||
WOLFSSL_MSG("Arc4AsyncInit failed in SetKeys");
|
||||
return ASYNC_INIT_E;
|
||||
}
|
||||
|
||||
if (enc) {
|
||||
if (wc_Arc4Init(enc->arc4, heap, devId) != 0) {
|
||||
WOLFSSL_MSG("Arc4Init failed in SetKeys");
|
||||
return ASYNC_INIT_E;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (dec) {
|
||||
if (wc_Arc4Init(dec->arc4, heap, devId) != 0) {
|
||||
WOLFSSL_MSG("Arc4Init failed in SetKeys");
|
||||
return ASYNC_INIT_E;
|
||||
}
|
||||
}
|
||||
|
||||
if (side == WOLFSSL_CLIENT_END) {
|
||||
if (enc)
|
||||
wc_Arc4SetKey(enc->arc4, keys->client_write_key, sz);
|
||||
@@ -2103,9 +2205,9 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
if (dec)
|
||||
dec->setup = 1;
|
||||
}
|
||||
#endif
|
||||
#endif /* BUILD_ARC4 */
|
||||
|
||||
|
||||
|
||||
#if defined(HAVE_CHACHA) && defined(HAVE_POLY1305)
|
||||
/* Check that the max implicit iv size is suffecient */
|
||||
#if (AEAD_MAX_IMP_SZ < 12) /* CHACHA20_IMP_IV_SZ */
|
||||
@@ -2165,7 +2267,8 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
if (dec)
|
||||
dec->setup = 1;
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_CHACHA && HAVE_POLY1305 */
|
||||
|
||||
|
||||
#ifdef HAVE_HC128
|
||||
/* check that buffer sizes are sufficient */
|
||||
@@ -2214,8 +2317,8 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
if (dec)
|
||||
dec->setup = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_HC128 */
|
||||
|
||||
#ifdef BUILD_RABBIT
|
||||
/* check that buffer sizes are sufficient */
|
||||
#if (MAX_WRITE_IV_SZ < 8) /* RABBIT_IV_SIZE */
|
||||
@@ -2263,8 +2366,8 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
if (dec)
|
||||
dec->setup = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BUILD_RABBIT */
|
||||
|
||||
#ifdef BUILD_DES3
|
||||
/* check that buffer sizes are sufficient */
|
||||
#if (MAX_WRITE_IV_SZ < 8) /* DES_IV_SIZE */
|
||||
@@ -2274,30 +2377,34 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
if (specs->bulk_cipher_algorithm == wolfssl_triple_des) {
|
||||
int desRet = 0;
|
||||
|
||||
if (enc && enc->des3 == NULL)
|
||||
enc->des3 = (Des3*)XMALLOC(sizeof(Des3), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (enc && enc->des3 == NULL)
|
||||
return MEMORY_E;
|
||||
if (dec && dec->des3 == NULL)
|
||||
dec->des3 = (Des3*)XMALLOC(sizeof(Des3), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (dec && dec->des3 == NULL)
|
||||
return MEMORY_E;
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (devId != INVALID_DEVID) {
|
||||
if (enc) {
|
||||
if (wc_Des3AsyncInit(enc->des3, devId) != 0) {
|
||||
WOLFSSL_MSG("Des3AsyncInit failed in SetKeys");
|
||||
return ASYNC_INIT_E;
|
||||
}
|
||||
}
|
||||
if (dec) {
|
||||
if (wc_Des3AsyncInit(dec->des3, devId) != 0) {
|
||||
WOLFSSL_MSG("Des3AsyncInit failed in SetKeys");
|
||||
return ASYNC_INIT_E;
|
||||
}
|
||||
if (enc) {
|
||||
if (enc->des3 == NULL)
|
||||
enc->des3 = (Des3*)XMALLOC(sizeof(Des3), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (enc->des3 == NULL)
|
||||
return MEMORY_E;
|
||||
XMEMSET(enc->des3, 0, sizeof(Des3));
|
||||
}
|
||||
if (dec) {
|
||||
if (dec->des3 == NULL)
|
||||
dec->des3 = (Des3*)XMALLOC(sizeof(Des3), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (dec->des3 == NULL)
|
||||
return MEMORY_E;
|
||||
XMEMSET(dec->des3, 0, sizeof(Des3));
|
||||
}
|
||||
|
||||
if (enc) {
|
||||
if (wc_Des3Init(enc->des3, heap, devId) != 0) {
|
||||
WOLFSSL_MSG("Des3Init failed in SetKeys");
|
||||
return ASYNC_INIT_E;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (dec) {
|
||||
if (wc_Des3Init(dec->des3, heap, devId) != 0) {
|
||||
WOLFSSL_MSG("Des3Init failed in SetKeys");
|
||||
return ASYNC_INIT_E;
|
||||
}
|
||||
}
|
||||
|
||||
if (side == WOLFSSL_CLIENT_END) {
|
||||
if (enc) {
|
||||
desRet = wc_Des3_SetKey(enc->des3, keys->client_write_key,
|
||||
@@ -2327,7 +2434,7 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
if (dec)
|
||||
dec->setup = 1;
|
||||
}
|
||||
#endif
|
||||
#endif /* BUILD_DES3 */
|
||||
|
||||
#ifdef BUILD_AES
|
||||
/* check that buffer sizes are sufficient */
|
||||
@@ -2338,30 +2445,33 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
if (specs->bulk_cipher_algorithm == wolfssl_aes) {
|
||||
int aesRet = 0;
|
||||
|
||||
if (enc && enc->aes == NULL)
|
||||
enc->aes = (Aes*)XMALLOC(sizeof(Aes), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (enc && enc->aes == NULL)
|
||||
return MEMORY_E;
|
||||
if (dec && dec->aes == NULL)
|
||||
dec->aes = (Aes*)XMALLOC(sizeof(Aes), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (dec && dec->aes == NULL)
|
||||
return MEMORY_E;
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (devId != INVALID_DEVID) {
|
||||
if (enc) {
|
||||
if (wc_AesAsyncInit(enc->aes, devId) != 0) {
|
||||
WOLFSSL_MSG("AesAsyncInit failed in SetKeys");
|
||||
return ASYNC_INIT_E;
|
||||
}
|
||||
}
|
||||
if (dec) {
|
||||
if (wc_AesAsyncInit(dec->aes, devId) != 0) {
|
||||
WOLFSSL_MSG("AesAsyncInit failed in SetKeys");
|
||||
return ASYNC_INIT_E;
|
||||
}
|
||||
if (enc) {
|
||||
if (enc->aes == NULL)
|
||||
enc->aes = (Aes*)XMALLOC(sizeof(Aes), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (enc->aes == NULL)
|
||||
return MEMORY_E;
|
||||
XMEMSET(enc->aes, 0, sizeof(Aes));
|
||||
}
|
||||
if (dec) {
|
||||
if (dec->aes == NULL)
|
||||
dec->aes = (Aes*)XMALLOC(sizeof(Aes), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (dec->aes == NULL)
|
||||
return MEMORY_E;
|
||||
XMEMSET(dec->aes, 0, sizeof(Aes));
|
||||
}
|
||||
if (enc) {
|
||||
if (wc_AesInit(enc->aes, heap, devId) != 0) {
|
||||
WOLFSSL_MSG("AesInit failed in SetKeys");
|
||||
return ASYNC_INIT_E;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (dec) {
|
||||
if (wc_AesInit(dec->aes, heap, devId) != 0) {
|
||||
WOLFSSL_MSG("AesInit failed in SetKeys");
|
||||
return ASYNC_INIT_E;
|
||||
}
|
||||
}
|
||||
|
||||
if (side == WOLFSSL_CLIENT_END) {
|
||||
if (enc) {
|
||||
aesRet = wc_AesSetKey(enc->aes, keys->client_write_key,
|
||||
@@ -2395,7 +2505,7 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
if (dec)
|
||||
dec->setup = 1;
|
||||
}
|
||||
#endif
|
||||
#endif /* BUILD_AES */
|
||||
|
||||
#ifdef BUILD_AESGCM
|
||||
/* check that buffer sizes are sufficient */
|
||||
@@ -2412,14 +2522,33 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
if (specs->bulk_cipher_algorithm == wolfssl_aes_gcm) {
|
||||
int gcmRet;
|
||||
|
||||
if (enc && enc->aes == NULL)
|
||||
enc->aes = (Aes*)XMALLOC(sizeof(Aes), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (enc && enc->aes == NULL)
|
||||
return MEMORY_E;
|
||||
if (dec && dec->aes == NULL)
|
||||
dec->aes = (Aes*)XMALLOC(sizeof(Aes), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (dec && dec->aes == NULL)
|
||||
return MEMORY_E;
|
||||
if (enc) {
|
||||
if (enc->aes == NULL)
|
||||
enc->aes = (Aes*)XMALLOC(sizeof(Aes), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (enc->aes == NULL)
|
||||
return MEMORY_E;
|
||||
XMEMSET(enc->aes, 0, sizeof(Aes));
|
||||
}
|
||||
if (dec) {
|
||||
if (dec->aes == NULL)
|
||||
dec->aes = (Aes*)XMALLOC(sizeof(Aes), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (dec->aes == NULL)
|
||||
return MEMORY_E;
|
||||
XMEMSET(dec->aes, 0, sizeof(Aes));
|
||||
}
|
||||
|
||||
if (enc) {
|
||||
if (wc_AesInit(enc->aes, heap, devId) != 0) {
|
||||
WOLFSSL_MSG("AesInit failed in SetKeys");
|
||||
return ASYNC_INIT_E;
|
||||
}
|
||||
}
|
||||
if (dec) {
|
||||
if (wc_AesInit(dec->aes, heap, devId) != 0) {
|
||||
WOLFSSL_MSG("AesInit failed in SetKeys");
|
||||
return ASYNC_INIT_E;
|
||||
}
|
||||
}
|
||||
|
||||
if (side == WOLFSSL_CLIENT_END) {
|
||||
if (enc) {
|
||||
@@ -2427,14 +2556,14 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
specs->key_size);
|
||||
if (gcmRet != 0) return gcmRet;
|
||||
XMEMCPY(keys->aead_enc_imp_IV, keys->client_write_IV,
|
||||
AESGCM_IMP_IV_SZ);
|
||||
AEAD_MAX_IMP_SZ);
|
||||
}
|
||||
if (dec) {
|
||||
gcmRet = wc_AesGcmSetKey(dec->aes, keys->server_write_key,
|
||||
specs->key_size);
|
||||
if (gcmRet != 0) return gcmRet;
|
||||
XMEMCPY(keys->aead_dec_imp_IV, keys->server_write_IV,
|
||||
AESGCM_IMP_IV_SZ);
|
||||
AEAD_MAX_IMP_SZ);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -2443,14 +2572,14 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
specs->key_size);
|
||||
if (gcmRet != 0) return gcmRet;
|
||||
XMEMCPY(keys->aead_enc_imp_IV, keys->server_write_IV,
|
||||
AESGCM_IMP_IV_SZ);
|
||||
AEAD_MAX_IMP_SZ);
|
||||
}
|
||||
if (dec) {
|
||||
gcmRet = wc_AesGcmSetKey(dec->aes, keys->client_write_key,
|
||||
specs->key_size);
|
||||
if (gcmRet != 0) return gcmRet;
|
||||
XMEMCPY(keys->aead_dec_imp_IV, keys->client_write_IV,
|
||||
AESGCM_IMP_IV_SZ);
|
||||
AEAD_MAX_IMP_SZ);
|
||||
}
|
||||
}
|
||||
if (enc)
|
||||
@@ -2458,7 +2587,7 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
if (dec)
|
||||
dec->setup = 1;
|
||||
}
|
||||
#endif
|
||||
#endif /* BUILD_AESGCM */
|
||||
|
||||
#ifdef HAVE_AESCCM
|
||||
/* check that buffer sizes are sufficient (CCM is same size as GCM) */
|
||||
@@ -2475,14 +2604,33 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
if (specs->bulk_cipher_algorithm == wolfssl_aes_ccm) {
|
||||
int CcmRet;
|
||||
|
||||
if (enc && enc->aes == NULL)
|
||||
enc->aes = (Aes*)XMALLOC(sizeof(Aes), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (enc && enc->aes == NULL)
|
||||
return MEMORY_E;
|
||||
if (dec && dec->aes == NULL)
|
||||
dec->aes = (Aes*)XMALLOC(sizeof(Aes), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (dec && dec->aes == NULL)
|
||||
return MEMORY_E;
|
||||
if (enc) {
|
||||
if (enc->aes == NULL)
|
||||
enc->aes = (Aes*)XMALLOC(sizeof(Aes), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (enc->aes == NULL)
|
||||
return MEMORY_E;
|
||||
XMEMSET(enc->aes, 0, sizeof(Aes));
|
||||
}
|
||||
if (dec) {
|
||||
if (dec->aes == NULL)
|
||||
dec->aes = (Aes*)XMALLOC(sizeof(Aes), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (dec->aes == NULL)
|
||||
return MEMORY_E;
|
||||
XMEMSET(dec->aes, 0, sizeof(Aes));
|
||||
}
|
||||
|
||||
if (enc) {
|
||||
if (wc_AesInit(enc->aes, heap, devId) != 0) {
|
||||
WOLFSSL_MSG("AesInit failed in SetKeys");
|
||||
return ASYNC_INIT_E;
|
||||
}
|
||||
}
|
||||
if (dec) {
|
||||
if (wc_AesInit(dec->aes, heap, devId) != 0) {
|
||||
WOLFSSL_MSG("AesInit failed in SetKeys");
|
||||
return ASYNC_INIT_E;
|
||||
}
|
||||
}
|
||||
|
||||
if (side == WOLFSSL_CLIENT_END) {
|
||||
if (enc) {
|
||||
@@ -2529,7 +2677,7 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
if (dec)
|
||||
dec->setup = 1;
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_AESCCM */
|
||||
|
||||
#ifdef HAVE_CAMELLIA
|
||||
/* check that buffer sizes are sufficient */
|
||||
@@ -2581,7 +2729,7 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
if (dec)
|
||||
dec->setup = 1;
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_CAMELLIA */
|
||||
|
||||
#ifdef HAVE_IDEA
|
||||
/* check that buffer sizes are sufficient */
|
||||
@@ -2635,7 +2783,7 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
if (dec)
|
||||
dec->setup = 1;
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_IDEA */
|
||||
|
||||
#ifdef HAVE_NULL_CIPHER
|
||||
if (specs->bulk_cipher_algorithm == wolfssl_cipher_null) {
|
||||
@@ -2681,6 +2829,7 @@ static int SetAuthKeys(OneTimeAuth* authentication, Keys* keys,
|
||||
if (authentication)
|
||||
authentication->setup = 1;
|
||||
#endif
|
||||
(void)authentication;
|
||||
(void)heap;
|
||||
(void)keys;
|
||||
(void)specs;
|
||||
@@ -2690,6 +2839,40 @@ static int SetAuthKeys(OneTimeAuth* authentication, Keys* keys,
|
||||
}
|
||||
#endif /* HAVE_ONE_TIME_AUTH */
|
||||
|
||||
#ifdef HAVE_SECURE_RENEGOTIATION
|
||||
/* function name is for cache_status++
|
||||
* This function was added because of error incrementing enum type when
|
||||
* compiling with a C++ compiler.
|
||||
*/
|
||||
static void CacheStatusPP(SecureRenegotiation* cache)
|
||||
{
|
||||
switch (cache->cache_status) {
|
||||
case SCR_CACHE_NULL:
|
||||
cache->cache_status = SCR_CACHE_NEEDED;
|
||||
break;
|
||||
|
||||
case SCR_CACHE_NEEDED:
|
||||
cache->cache_status = SCR_CACHE_COPY;
|
||||
break;
|
||||
|
||||
case SCR_CACHE_COPY:
|
||||
cache->cache_status = SCR_CACHE_PARTIAL;
|
||||
break;
|
||||
|
||||
case SCR_CACHE_PARTIAL:
|
||||
cache->cache_status = SCR_CACHE_COMPLETE;
|
||||
break;
|
||||
|
||||
case SCR_CACHE_COMPLETE:
|
||||
WOLFSSL_MSG("SCR Cache state Complete");
|
||||
break;
|
||||
|
||||
default:
|
||||
WOLFSSL_MSG("Unknown cache state!!");
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_SECURE_RENEGOTIATION */
|
||||
|
||||
|
||||
/* Set wc_encrypt/wc_decrypt or both sides of key setup
|
||||
* note: use wc_encrypt to avoid shadowing global encrypt
|
||||
@@ -2804,7 +2987,7 @@ int SetKeysSide(WOLFSSL* ssl, enum encrypt_side side)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
ssl->secure_renegotiation->cache_status++;
|
||||
CacheStatusPP(ssl->secure_renegotiation);
|
||||
}
|
||||
#endif /* HAVE_SECURE_RENEGOTIATION */
|
||||
|
||||
@@ -2822,7 +3005,7 @@ int StoreKeys(WOLFSSL* ssl, const byte* keyData)
|
||||
if (ssl->secure_renegotiation && ssl->secure_renegotiation->cache_status ==
|
||||
SCR_CACHE_NEEDED) {
|
||||
keys = &ssl->secure_renegotiation->tmp_keys;
|
||||
ssl->secure_renegotiation->cache_status++;
|
||||
CacheStatusPP(ssl->secure_renegotiation);
|
||||
}
|
||||
#endif /* HAVE_SECURE_RENEGOTIATION */
|
||||
|
||||
@@ -2857,12 +3040,12 @@ int StoreKeys(WOLFSSL* ssl, const byte* keyData)
|
||||
#ifndef NO_OLD_TLS
|
||||
int DeriveKeys(WOLFSSL* ssl)
|
||||
{
|
||||
int length = 2 * ssl->specs.hash_size +
|
||||
int length = 2 * ssl->specs.hash_size +
|
||||
2 * ssl->specs.key_size +
|
||||
2 * ssl->specs.iv_size;
|
||||
int rounds = (length + MD5_DIGEST_SIZE - 1 ) / MD5_DIGEST_SIZE, i;
|
||||
int ret = 0;
|
||||
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
byte* shaOutput;
|
||||
byte* md5Input;
|
||||
@@ -2878,9 +3061,9 @@ int DeriveKeys(WOLFSSL* ssl)
|
||||
Md5 md5[1];
|
||||
Sha sha[1];
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
shaOutput = (byte*)XMALLOC(SHA_DIGEST_SIZE,
|
||||
shaOutput = (byte*)XMALLOC(SHA_DIGEST_SIZE,
|
||||
NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
md5Input = (byte*)XMALLOC(SECRET_LEN + SHA_DIGEST_SIZE,
|
||||
NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
@@ -2890,7 +3073,7 @@ int DeriveKeys(WOLFSSL* ssl)
|
||||
NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
md5 = (Md5*)XMALLOC(sizeof(Md5), NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
sha = (Sha*)XMALLOC(sizeof(Sha), NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
|
||||
if (shaOutput == NULL || md5Input == NULL || shaInput == NULL ||
|
||||
keyData == NULL || md5 == NULL || sha == NULL) {
|
||||
if (shaOutput) XFREE(shaOutput, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
@@ -2899,15 +3082,15 @@ int DeriveKeys(WOLFSSL* ssl)
|
||||
if (keyData) XFREE(keyData, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (md5) XFREE(md5, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (sha) XFREE(sha, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
|
||||
return MEMORY_E;
|
||||
}
|
||||
#endif
|
||||
|
||||
wc_InitMd5(md5);
|
||||
|
||||
ret = wc_InitSha(sha);
|
||||
|
||||
ret = wc_InitMd5(md5);
|
||||
if (ret == 0) {
|
||||
ret = wc_InitSha(sha);
|
||||
}
|
||||
if (ret == 0) {
|
||||
XMEMCPY(md5Input, ssl->arrays->masterSecret, SECRET_LEN);
|
||||
|
||||
@@ -2925,14 +3108,21 @@ int DeriveKeys(WOLFSSL* ssl)
|
||||
XMEMCPY(shaInput + idx, ssl->arrays->serverRandom, RAN_LEN);
|
||||
idx += RAN_LEN;
|
||||
XMEMCPY(shaInput + idx, ssl->arrays->clientRandom, RAN_LEN);
|
||||
|
||||
wc_ShaUpdate(sha, shaInput, (KEY_PREFIX + SECRET_LEN + 2 * RAN_LEN)
|
||||
- KEY_PREFIX + j);
|
||||
wc_ShaFinal(sha, shaOutput);
|
||||
if (ret == 0) {
|
||||
ret = wc_ShaUpdate(sha, shaInput,
|
||||
(KEY_PREFIX + SECRET_LEN + 2 * RAN_LEN) - KEY_PREFIX + j);
|
||||
}
|
||||
if (ret == 0) {
|
||||
ret = wc_ShaFinal(sha, shaOutput);
|
||||
}
|
||||
|
||||
XMEMCPY(md5Input + SECRET_LEN, shaOutput, SHA_DIGEST_SIZE);
|
||||
wc_Md5Update(md5, md5Input, SECRET_LEN + SHA_DIGEST_SIZE);
|
||||
wc_Md5Final(md5, keyData + i * MD5_DIGEST_SIZE);
|
||||
if (ret == 0) {
|
||||
ret = wc_Md5Update(md5, md5Input, SECRET_LEN + SHA_DIGEST_SIZE);
|
||||
}
|
||||
if (ret == 0) {
|
||||
ret = wc_Md5Final(md5, keyData + i * MD5_DIGEST_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == 0)
|
||||
@@ -3010,7 +3200,7 @@ static int MakeSslMasterSecret(WOLFSSL* ssl)
|
||||
NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
md5 = (Md5*)XMALLOC(sizeof(Md5), NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
sha = (Sha*)XMALLOC(sizeof(Sha), NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
|
||||
if (shaOutput == NULL || md5Input == NULL || shaInput == NULL ||
|
||||
md5 == NULL || sha == NULL) {
|
||||
if (shaOutput) XFREE(shaOutput, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
@@ -3018,15 +3208,15 @@ static int MakeSslMasterSecret(WOLFSSL* ssl)
|
||||
if (shaInput) XFREE(shaInput, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (md5) XFREE(md5, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (sha) XFREE(sha, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
|
||||
return MEMORY_E;
|
||||
}
|
||||
#endif
|
||||
|
||||
wc_InitMd5(md5);
|
||||
|
||||
ret = wc_InitSha(sha);
|
||||
|
||||
ret = wc_InitMd5(md5);
|
||||
if (ret == 0) {
|
||||
ret = wc_InitSha(sha);
|
||||
}
|
||||
if (ret == 0) {
|
||||
XMEMCPY(md5Input, ssl->arrays->preMasterSecret, pmsSz);
|
||||
|
||||
@@ -3047,14 +3237,22 @@ static int MakeSslMasterSecret(WOLFSSL* ssl)
|
||||
idx += RAN_LEN;
|
||||
XMEMCPY(shaInput + idx, ssl->arrays->serverRandom, RAN_LEN);
|
||||
idx += RAN_LEN;
|
||||
wc_ShaUpdate(sha, shaInput, idx);
|
||||
wc_ShaFinal(sha, shaOutput);
|
||||
|
||||
if (ret == 0) {
|
||||
ret = wc_ShaUpdate(sha, shaInput, idx);
|
||||
}
|
||||
if (ret == 0) {
|
||||
ret = wc_ShaFinal(sha, shaOutput);
|
||||
}
|
||||
idx = pmsSz; /* preSz */
|
||||
XMEMCPY(md5Input + idx, shaOutput, SHA_DIGEST_SIZE);
|
||||
idx += SHA_DIGEST_SIZE;
|
||||
wc_Md5Update(md5, md5Input, idx);
|
||||
wc_Md5Final(md5, &ssl->arrays->masterSecret[i * MD5_DIGEST_SIZE]);
|
||||
if (ret == 0) {
|
||||
ret = wc_Md5Update(md5, md5Input, idx);
|
||||
}
|
||||
if (ret == 0) {
|
||||
ret = wc_Md5Final(md5,
|
||||
&ssl->arrays->masterSecret[i * MD5_DIGEST_SIZE]);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SHOW_SECRETS
|
||||
|
627
src/ocsp.c
627
src/ocsp.c
@@ -110,9 +110,9 @@ void FreeOCSP(WOLFSSL_OCSP* ocsp, int dynamic)
|
||||
}
|
||||
|
||||
|
||||
static int xstat2err(int stat)
|
||||
static int xstat2err(int st)
|
||||
{
|
||||
switch (stat) {
|
||||
switch (st) {
|
||||
case CERT_GOOD:
|
||||
return 0;
|
||||
case CERT_REVOKED:
|
||||
@@ -219,9 +219,11 @@ static int GetOcspStatus(WOLFSSL_OCSP* ocsp, OcspRequest* request,
|
||||
ret = OCSP_INVALID_STATUS;
|
||||
}
|
||||
else if (*status) {
|
||||
#ifndef NO_ASN_TIME
|
||||
if (ValidateDate((*status)->thisDate, (*status)->thisDateFormat, BEFORE)
|
||||
&& ((*status)->nextDate[0] != 0)
|
||||
&& ValidateDate((*status)->nextDate, (*status)->nextDateFormat, AFTER))
|
||||
#endif
|
||||
{
|
||||
ret = xstat2err((*status)->status);
|
||||
|
||||
@@ -244,6 +246,134 @@ static int GetOcspStatus(WOLFSSL_OCSP* ocsp, OcspRequest* request,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Check that the response for validity. Store result in status.
|
||||
*
|
||||
* ocsp Context object for OCSP status.
|
||||
* response OCSP response message data.
|
||||
* responseSz Length of OCSP response message data.
|
||||
* reponseBuffer Buffer object to return the response with.
|
||||
* status The certificate status object.
|
||||
* entry The OCSP entry for this certificate.
|
||||
* returns OCSP_LOOKUP_FAIL when the response is bad and 0 otherwise.
|
||||
*/
|
||||
static int CheckResponse(WOLFSSL_OCSP* ocsp, byte* response, int responseSz,
|
||||
buffer* responseBuffer, CertStatus* status,
|
||||
OcspEntry* entry, OcspRequest* ocspRequest)
|
||||
{
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
CertStatus* newStatus;
|
||||
OcspResponse* ocspResponse;
|
||||
#else
|
||||
CertStatus newStatus[1];
|
||||
OcspResponse ocspResponse[1];
|
||||
#endif
|
||||
int ret;
|
||||
int validated = 0; /* ocsp validation flag */
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
newStatus = (CertStatus*)XMALLOC(sizeof(CertStatus), NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
ocspResponse = (OcspResponse*)XMALLOC(sizeof(OcspResponse), NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
if (newStatus == NULL || ocspResponse == NULL) {
|
||||
if (newStatus) XFREE(newStatus, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (ocspResponse) XFREE(ocspResponse, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
WOLFSSL_LEAVE("CheckCertOCSP", MEMORY_ERROR);
|
||||
return MEMORY_E;
|
||||
}
|
||||
#endif
|
||||
XMEMSET(newStatus, 0, sizeof(CertStatus));
|
||||
|
||||
InitOcspResponse(ocspResponse, newStatus, response, responseSz);
|
||||
ret = OcspResponseDecode(ocspResponse, ocsp->cm, ocsp->cm->heap, 0);
|
||||
if (ret != 0) {
|
||||
WOLFSSL_MSG("OcspResponseDecode failed");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (ocspResponse->responseStatus != OCSP_SUCCESSFUL) {
|
||||
WOLFSSL_MSG("OcspResponse status bad");
|
||||
goto end;
|
||||
}
|
||||
if (ocspRequest != NULL) {
|
||||
ret = CompareOcspReqResp(ocspRequest, ocspResponse);
|
||||
if (ret != 0) {
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (responseBuffer) {
|
||||
responseBuffer->buffer = (byte*)XMALLOC(responseSz, ocsp->cm->heap,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
if (responseBuffer->buffer) {
|
||||
responseBuffer->length = responseSz;
|
||||
XMEMCPY(responseBuffer->buffer, response, responseSz);
|
||||
}
|
||||
}
|
||||
|
||||
ret = xstat2err(ocspResponse->status->status);
|
||||
if (ret == 0) {
|
||||
validated = 1;
|
||||
}
|
||||
|
||||
if (wc_LockMutex(&ocsp->ocspLock) != 0) {
|
||||
ret = BAD_MUTEX_E;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (status != NULL) {
|
||||
if (status->rawOcspResponse) {
|
||||
XFREE(status->rawOcspResponse, ocsp->cm->heap,
|
||||
DYNAMIC_TYPE_OCSP_STATUS);
|
||||
}
|
||||
|
||||
/* Replace existing certificate entry with updated */
|
||||
XMEMCPY(status, newStatus, sizeof(CertStatus));
|
||||
}
|
||||
else {
|
||||
/* Save new certificate entry */
|
||||
status = (CertStatus*)XMALLOC(sizeof(CertStatus),
|
||||
ocsp->cm->heap, DYNAMIC_TYPE_OCSP_STATUS);
|
||||
if (status != NULL) {
|
||||
XMEMCPY(status, newStatus, sizeof(CertStatus));
|
||||
status->next = entry->status;
|
||||
entry->status = status;
|
||||
entry->totalStatus++;
|
||||
}
|
||||
}
|
||||
|
||||
if (status && responseBuffer && responseBuffer->buffer) {
|
||||
status->rawOcspResponse = (byte*)XMALLOC(responseBuffer->length,
|
||||
ocsp->cm->heap,
|
||||
DYNAMIC_TYPE_OCSP_STATUS);
|
||||
|
||||
if (status->rawOcspResponse) {
|
||||
status->rawOcspResponseSz = responseBuffer->length;
|
||||
XMEMCPY(status->rawOcspResponse, responseBuffer->buffer,
|
||||
responseBuffer->length);
|
||||
}
|
||||
}
|
||||
|
||||
wc_UnLockMutex(&ocsp->ocspLock);
|
||||
|
||||
end:
|
||||
if (ret == 0 && validated == 1) {
|
||||
WOLFSSL_MSG("New OcspResponse validated");
|
||||
} else if (ret != OCSP_CERT_REVOKED) {
|
||||
ret = OCSP_LOOKUP_FAIL;
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(newStatus, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(ocspResponse, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 0 on success */
|
||||
int CheckOcspRequest(WOLFSSL_OCSP* ocsp, OcspRequest* ocspRequest,
|
||||
buffer* responseBuffer)
|
||||
{
|
||||
@@ -251,19 +381,12 @@ int CheckOcspRequest(WOLFSSL_OCSP* ocsp, OcspRequest* ocspRequest,
|
||||
CertStatus* status = NULL;
|
||||
byte* request = NULL;
|
||||
int requestSz = 2048;
|
||||
int responseSz = 0;
|
||||
byte* response = NULL;
|
||||
const char* url = NULL;
|
||||
int urlSz = 0;
|
||||
int ret = -1;
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
CertStatus* newStatus;
|
||||
OcspResponse* ocspResponse;
|
||||
#else
|
||||
CertStatus newStatus[1];
|
||||
OcspResponse ocspResponse[1];
|
||||
#endif
|
||||
|
||||
WOLFSSL_ENTER("CheckOcspRequest");
|
||||
|
||||
if (responseBuffer) {
|
||||
@@ -279,6 +402,22 @@ int CheckOcspRequest(WOLFSSL_OCSP* ocsp, OcspRequest* ocspRequest,
|
||||
if (ret != OCSP_INVALID_STATUS)
|
||||
return ret;
|
||||
|
||||
#if defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY)
|
||||
if (ocsp->statusCb != NULL && ocspRequest->ssl != NULL) {
|
||||
ret = ocsp->statusCb((WOLFSSL*)ocspRequest->ssl, ocsp->cm->ocspIOCtx);
|
||||
if (ret == 0) {
|
||||
ret = wolfSSL_get_ocsp_response((WOLFSSL*)ocspRequest->ssl,
|
||||
&response);
|
||||
ret = CheckResponse(ocsp, response, ret, responseBuffer, status,
|
||||
entry, NULL);
|
||||
if (response != NULL)
|
||||
XFREE(response, NULL, DYNAMIC_TYPE_OPENSSL);
|
||||
return ret;
|
||||
}
|
||||
return OCSP_LOOKUP_FAIL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ocsp->cm->ocspUseOverrideURL) {
|
||||
url = ocsp->cm->ocspOverrideURL;
|
||||
if (url != NULL && url[0] != '\0')
|
||||
@@ -301,102 +440,18 @@ int CheckOcspRequest(WOLFSSL_OCSP* ocsp, OcspRequest* ocspRequest,
|
||||
return MEMORY_ERROR;
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
newStatus = (CertStatus*)XMALLOC(sizeof(CertStatus), NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
ocspResponse = (OcspResponse*)XMALLOC(sizeof(OcspResponse), NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
if (newStatus == NULL || ocspResponse == NULL) {
|
||||
if (newStatus) XFREE(newStatus, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (ocspResponse) XFREE(ocspResponse, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
XFREE(request, NULL, DYNAMIC_TYPE_OCSP);
|
||||
|
||||
WOLFSSL_LEAVE("CheckCertOCSP", MEMORY_ERROR);
|
||||
return MEMORY_E;
|
||||
}
|
||||
#endif
|
||||
|
||||
requestSz = EncodeOcspRequest(ocspRequest, request, requestSz);
|
||||
|
||||
if (ocsp->cm->ocspIOCb)
|
||||
ret = ocsp->cm->ocspIOCb(ocsp->cm->ocspIOCtx, url, urlSz,
|
||||
request, requestSz, &response);
|
||||
|
||||
if (ret >= 0 && response) {
|
||||
XMEMSET(newStatus, 0, sizeof(CertStatus));
|
||||
|
||||
InitOcspResponse(ocspResponse, newStatus, response, ret);
|
||||
OcspResponseDecode(ocspResponse, ocsp->cm, ocsp->cm->heap);
|
||||
|
||||
if (ocspResponse->responseStatus != OCSP_SUCCESSFUL)
|
||||
ret = OCSP_LOOKUP_FAIL;
|
||||
else {
|
||||
if (CompareOcspReqResp(ocspRequest, ocspResponse) == 0) {
|
||||
if (responseBuffer) {
|
||||
responseBuffer->buffer = (byte*)XMALLOC(ret, ocsp->cm->heap,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
if (responseBuffer->buffer) {
|
||||
responseBuffer->length = ret;
|
||||
XMEMCPY(responseBuffer->buffer, response, ret);
|
||||
}
|
||||
}
|
||||
|
||||
ret = xstat2err(ocspResponse->status->status);
|
||||
|
||||
if (wc_LockMutex(&ocsp->ocspLock) != 0)
|
||||
ret = BAD_MUTEX_E;
|
||||
else {
|
||||
if (status != NULL) {
|
||||
if (status->rawOcspResponse)
|
||||
XFREE(status->rawOcspResponse, ocsp->cm->heap,
|
||||
DYNAMIC_TYPE_OCSP_STATUS);
|
||||
|
||||
/* Replace existing certificate entry with updated */
|
||||
XMEMCPY(status, newStatus, sizeof(CertStatus));
|
||||
}
|
||||
else {
|
||||
/* Save new certificate entry */
|
||||
status = (CertStatus*)XMALLOC(sizeof(CertStatus),
|
||||
ocsp->cm->heap, DYNAMIC_TYPE_OCSP_STATUS);
|
||||
if (status != NULL) {
|
||||
XMEMCPY(status, newStatus, sizeof(CertStatus));
|
||||
status->next = entry->status;
|
||||
entry->status = status;
|
||||
entry->totalStatus++;
|
||||
}
|
||||
}
|
||||
|
||||
if (status && responseBuffer && responseBuffer->buffer) {
|
||||
status->rawOcspResponse = (byte*)XMALLOC(
|
||||
responseBuffer->length,
|
||||
ocsp->cm->heap,
|
||||
DYNAMIC_TYPE_OCSP_STATUS);
|
||||
|
||||
if (status->rawOcspResponse) {
|
||||
status->rawOcspResponseSz = responseBuffer->length;
|
||||
XMEMCPY(status->rawOcspResponse,
|
||||
responseBuffer->buffer,
|
||||
responseBuffer->length);
|
||||
}
|
||||
}
|
||||
|
||||
wc_UnLockMutex(&ocsp->ocspLock);
|
||||
}
|
||||
}
|
||||
else
|
||||
ret = OCSP_LOOKUP_FAIL;
|
||||
}
|
||||
if (requestSz > 0 && ocsp->cm->ocspIOCb) {
|
||||
responseSz = ocsp->cm->ocspIOCb(ocsp->cm->ocspIOCtx, url, urlSz,
|
||||
request, requestSz, &response);
|
||||
}
|
||||
else
|
||||
ret = OCSP_LOOKUP_FAIL;
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(newStatus, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(ocspResponse, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
XFREE(request, ocsp->cm->heap, DYNAMIC_TYPE_OCSP);
|
||||
|
||||
if (responseSz >= 0 && response) {
|
||||
ret = CheckResponse(ocsp, response, responseSz, responseBuffer, status,
|
||||
entry, ocspRequest);
|
||||
}
|
||||
|
||||
if (response != NULL && ocsp->cm->ocspRespFreeCb)
|
||||
ocsp->cm->ocspRespFreeCb(ocsp->cm->ocspIOCtx, response);
|
||||
@@ -405,6 +460,372 @@ int CheckOcspRequest(WOLFSSL_OCSP* ocsp, OcspRequest* ocspRequest,
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY)
|
||||
|
||||
int wolfSSL_OCSP_resp_find_status(WOLFSSL_OCSP_BASICRESP *bs,
|
||||
WOLFSSL_OCSP_CERTID* id, int* status, int* reason,
|
||||
WOLFSSL_ASN1_TIME** revtime, WOLFSSL_ASN1_TIME** thisupd,
|
||||
WOLFSSL_ASN1_TIME** nextupd)
|
||||
{
|
||||
if (bs == NULL || id == NULL)
|
||||
return SSL_FAILURE;
|
||||
|
||||
/* Only supporting one certificate status in asn.c. */
|
||||
if (CompareOcspReqResp(id, bs) != 0)
|
||||
return SSL_FAILURE;
|
||||
|
||||
if (status != NULL)
|
||||
*status = bs->status->status;
|
||||
if (thisupd != NULL)
|
||||
*thisupd = (WOLFSSL_ASN1_TIME*)bs->status->thisDateAsn;
|
||||
if (nextupd != NULL)
|
||||
*nextupd = (WOLFSSL_ASN1_TIME*)bs->status->nextDateAsn;
|
||||
|
||||
/* TODO: Not needed for Nginx. */
|
||||
if (reason != NULL)
|
||||
*reason = 0;
|
||||
if (revtime != NULL)
|
||||
*revtime = NULL;
|
||||
|
||||
return SSL_SUCCESS;
|
||||
}
|
||||
|
||||
const char *wolfSSL_OCSP_cert_status_str(long s)
|
||||
{
|
||||
switch (s) {
|
||||
case CERT_GOOD:
|
||||
return "good";
|
||||
case CERT_REVOKED:
|
||||
return "revoked";
|
||||
case CERT_UNKNOWN:
|
||||
return "unknown";
|
||||
default:
|
||||
return "(UNKNOWN)";
|
||||
}
|
||||
}
|
||||
|
||||
int wolfSSL_OCSP_check_validity(WOLFSSL_ASN1_TIME* thisupd,
|
||||
WOLFSSL_ASN1_TIME* nextupd, long sec, long maxsec)
|
||||
{
|
||||
(void)thisupd;
|
||||
(void)nextupd;
|
||||
(void)sec;
|
||||
(void)maxsec;
|
||||
/* Dates validated in DecodeSingleResponse. */
|
||||
return SSL_SUCCESS;
|
||||
}
|
||||
|
||||
void wolfSSL_OCSP_CERTID_free(WOLFSSL_OCSP_CERTID* certId)
|
||||
{
|
||||
FreeOcspRequest(certId);
|
||||
XFREE(certId, NULL, DYNAMIC_TYPE_OPENSSL);
|
||||
}
|
||||
|
||||
WOLFSSL_OCSP_CERTID* wolfSSL_OCSP_cert_to_id(
|
||||
const WOLFSSL_EVP_MD *dgst, const WOLFSSL_X509 *subject,
|
||||
const WOLFSSL_X509 *issuer)
|
||||
{
|
||||
WOLFSSL_OCSP_CERTID* certId;
|
||||
DecodedCert cert;
|
||||
WOLFSSL_CERT_MANAGER* cm;
|
||||
int ret;
|
||||
DerBuffer* derCert = NULL;
|
||||
|
||||
(void)dgst;
|
||||
|
||||
cm = wolfSSL_CertManagerNew();
|
||||
if (cm == NULL)
|
||||
return NULL;
|
||||
|
||||
ret = AllocDer(&derCert, issuer->derCert->length,
|
||||
issuer->derCert->type, NULL);
|
||||
if (ret == 0) {
|
||||
/* AddCA() frees the buffer. */
|
||||
XMEMCPY(derCert->buffer, issuer->derCert->buffer,
|
||||
issuer->derCert->length);
|
||||
AddCA(cm, &derCert, WOLFSSL_USER_CA, 1);
|
||||
}
|
||||
|
||||
certId = (WOLFSSL_OCSP_CERTID*)XMALLOC(sizeof(WOLFSSL_OCSP_CERTID), NULL,
|
||||
DYNAMIC_TYPE_OPENSSL);
|
||||
if (certId != NULL) {
|
||||
InitDecodedCert(&cert, subject->derCert->buffer,
|
||||
subject->derCert->length, NULL);
|
||||
if (ParseCertRelative(&cert, CERT_TYPE, VERIFY_OCSP, cm) != 0) {
|
||||
XFREE(certId, NULL, DYNAMIC_TYPE_OPENSSL);
|
||||
certId = NULL;
|
||||
}
|
||||
else {
|
||||
ret = InitOcspRequest(certId, &cert, 0, NULL);
|
||||
if (ret != 0) {
|
||||
XFREE(certId, NULL, DYNAMIC_TYPE_OPENSSL);
|
||||
certId = NULL;
|
||||
}
|
||||
}
|
||||
FreeDecodedCert(&cert);
|
||||
}
|
||||
|
||||
wolfSSL_CertManagerFree(cm);
|
||||
|
||||
return certId;
|
||||
}
|
||||
|
||||
void wolfSSL_OCSP_BASICRESP_free(WOLFSSL_OCSP_BASICRESP* basicResponse)
|
||||
{
|
||||
wolfSSL_OCSP_RESPONSE_free(basicResponse);
|
||||
}
|
||||
|
||||
/* Signature verified in DecodeBasicOcspResponse.
|
||||
* But no store available to verify certificate. */
|
||||
int wolfSSL_OCSP_basic_verify(WOLFSSL_OCSP_BASICRESP *bs,
|
||||
STACK_OF(WOLFSSL_X509) *certs, WOLFSSL_X509_STORE *st, unsigned long flags)
|
||||
{
|
||||
DecodedCert cert;
|
||||
int ret = SSL_SUCCESS;
|
||||
|
||||
(void)certs;
|
||||
|
||||
if (flags & OCSP_NOVERIFY)
|
||||
return SSL_SUCCESS;
|
||||
|
||||
InitDecodedCert(&cert, bs->cert, bs->certSz, NULL);
|
||||
if (ParseCertRelative(&cert, CERT_TYPE, VERIFY, st->cm) < 0)
|
||||
ret = SSL_FAILURE;
|
||||
FreeDecodedCert(&cert);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void wolfSSL_OCSP_RESPONSE_free(OcspResponse* response)
|
||||
{
|
||||
if (response->status != NULL)
|
||||
XFREE(response->status, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (response->source != NULL)
|
||||
XFREE(response->source, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(response, NULL, DYNAMIC_TYPE_OPENSSL);
|
||||
}
|
||||
|
||||
OcspResponse* wolfSSL_d2i_OCSP_RESPONSE_bio(WOLFSSL_BIO* bio,
|
||||
OcspResponse** response)
|
||||
{
|
||||
byte* data;
|
||||
byte* p;
|
||||
int len;
|
||||
int dataAlloced = 0;
|
||||
OcspResponse* ret = NULL;
|
||||
|
||||
if (bio == NULL)
|
||||
return NULL;
|
||||
|
||||
if (bio->type == BIO_MEMORY) {
|
||||
len = wolfSSL_BIO_get_mem_data(bio, &data);
|
||||
if (len <= 0 || data == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else if (bio->type == BIO_FILE) {
|
||||
long i;
|
||||
long l;
|
||||
|
||||
i = XFTELL(bio->file);
|
||||
if (i < 0)
|
||||
return NULL;
|
||||
XFSEEK(bio->file, 0, SEEK_END);
|
||||
l = XFTELL(bio->file);
|
||||
if (l < 0)
|
||||
return NULL;
|
||||
XFSEEK(bio->file, i, SEEK_SET);
|
||||
|
||||
/* check calulated length */
|
||||
if (l - i <= 0)
|
||||
return NULL;
|
||||
|
||||
data = (byte*)XMALLOC(l - i, 0, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (data == NULL)
|
||||
return NULL;
|
||||
dataAlloced = 1;
|
||||
|
||||
len = wolfSSL_BIO_read(bio, (char *)data, (int)l);
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
if (len > 0) {
|
||||
p = data;
|
||||
ret = wolfSSL_d2i_OCSP_RESPONSE(response, (const unsigned char **)&p, len);
|
||||
}
|
||||
|
||||
if (dataAlloced)
|
||||
XFREE(data, 0, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
OcspResponse* wolfSSL_d2i_OCSP_RESPONSE(OcspResponse** response,
|
||||
const unsigned char** data, int len)
|
||||
{
|
||||
OcspResponse *resp = NULL;
|
||||
word32 idx = 0;
|
||||
int length = 0;
|
||||
|
||||
if (data == NULL)
|
||||
return NULL;
|
||||
|
||||
if (response != NULL)
|
||||
resp = *response;
|
||||
if (resp == NULL) {
|
||||
resp = (OcspResponse*)XMALLOC(sizeof(OcspResponse), NULL,
|
||||
DYNAMIC_TYPE_OPENSSL);
|
||||
if (resp == NULL)
|
||||
return NULL;
|
||||
XMEMSET(resp, 0, sizeof(OcspResponse));
|
||||
}
|
||||
|
||||
resp->source = (byte*)XMALLOC(len, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (resp->source == NULL) {
|
||||
XFREE(resp, NULL, DYNAMIC_TYPE_OPENSSL);
|
||||
return NULL;
|
||||
}
|
||||
resp->status = (CertStatus*)XMALLOC(sizeof(CertStatus), NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (resp->status == NULL) {
|
||||
XFREE(resp->source, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(resp, NULL, DYNAMIC_TYPE_OPENSSL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
XMEMCPY(resp->source, *data, len);
|
||||
resp->maxIdx = len;
|
||||
|
||||
if (OcspResponseDecode(resp, NULL, NULL, 1) != 0) {
|
||||
wolfSSL_OCSP_RESPONSE_free(resp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (GetSequence(*data, &idx, &length, len) >= 0)
|
||||
(*data) += idx + length;
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
int wolfSSL_i2d_OCSP_RESPONSE(OcspResponse* response,
|
||||
unsigned char** data)
|
||||
{
|
||||
if (data == NULL)
|
||||
return response->maxIdx;
|
||||
|
||||
XMEMCPY(*data, response->source, response->maxIdx);
|
||||
return response->maxIdx;
|
||||
}
|
||||
|
||||
int wolfSSL_OCSP_response_status(OcspResponse *response)
|
||||
{
|
||||
return response->responseStatus;
|
||||
}
|
||||
|
||||
const char *wolfSSL_OCSP_response_status_str(long s)
|
||||
{
|
||||
switch (s) {
|
||||
case OCSP_SUCCESSFUL:
|
||||
return "successful";
|
||||
case OCSP_MALFORMED_REQUEST:
|
||||
return "malformedrequest";
|
||||
case OCSP_INTERNAL_ERROR:
|
||||
return "internalerror";
|
||||
case OCSP_TRY_LATER:
|
||||
return "trylater";
|
||||
case OCSP_SIG_REQUIRED:
|
||||
return "sigrequired";
|
||||
case OCSP_UNAUTHROIZED:
|
||||
return "unauthorized";
|
||||
default:
|
||||
return "(UNKNOWN)";
|
||||
}
|
||||
}
|
||||
|
||||
WOLFSSL_OCSP_BASICRESP* wolfSSL_OCSP_response_get1_basic(OcspResponse* response)
|
||||
{
|
||||
WOLFSSL_OCSP_BASICRESP* bs;
|
||||
|
||||
bs = (WOLFSSL_OCSP_BASICRESP*)XMALLOC(sizeof(WOLFSSL_OCSP_BASICRESP), NULL,
|
||||
DYNAMIC_TYPE_OPENSSL);
|
||||
if (bs == NULL)
|
||||
return NULL;
|
||||
|
||||
XMEMCPY(bs, response, sizeof(OcspResponse));
|
||||
bs->status = (CertStatus*)XMALLOC(sizeof(CertStatus), NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
bs->source = (byte*)XMALLOC(bs->maxIdx, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (bs->status == NULL || bs->source == NULL) {
|
||||
if (bs->status) XFREE(bs->status, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (bs->source) XFREE(bs->source, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
wolfSSL_OCSP_RESPONSE_free(bs);
|
||||
bs = NULL;
|
||||
}
|
||||
else {
|
||||
XMEMCPY(bs->status, response->status, sizeof(CertStatus));
|
||||
XMEMCPY(bs->source, response->source, response->maxIdx);
|
||||
}
|
||||
return bs;
|
||||
}
|
||||
|
||||
OcspRequest* wolfSSL_OCSP_REQUEST_new(void)
|
||||
{
|
||||
OcspRequest* request;
|
||||
|
||||
request = (OcspRequest*)XMALLOC(sizeof(OcspRequest), NULL,
|
||||
DYNAMIC_TYPE_OPENSSL);
|
||||
if (request != NULL)
|
||||
XMEMSET(request, 0, sizeof(OcspRequest));
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
void wolfSSL_OCSP_REQUEST_free(OcspRequest* request)
|
||||
{
|
||||
FreeOcspRequest(request);
|
||||
XFREE(request, NULL, DYNAMIC_TYPE_OPENSSL);
|
||||
}
|
||||
|
||||
int wolfSSL_i2d_OCSP_REQUEST(OcspRequest* request, unsigned char** data)
|
||||
{
|
||||
word32 size;
|
||||
|
||||
size = EncodeOcspRequest(request, NULL, 0);
|
||||
if (size <= 0 || data == NULL)
|
||||
return size;
|
||||
|
||||
return EncodeOcspRequest(request, *data, size);
|
||||
}
|
||||
|
||||
WOLFSSL_OCSP_ONEREQ* wolfSSL_OCSP_request_add0_id(OcspRequest *req,
|
||||
WOLFSSL_OCSP_CERTID *cid)
|
||||
{
|
||||
if (req == NULL || cid == NULL)
|
||||
return NULL;
|
||||
|
||||
FreeOcspRequest(req);
|
||||
XMEMCPY(req, cid, sizeof(OcspRequest));
|
||||
|
||||
if (cid->serial != NULL) {
|
||||
req->serial = (byte*)XMALLOC(cid->serialSz, NULL,
|
||||
DYNAMIC_TYPE_OCSP_REQUEST);
|
||||
req->url = (byte*)XMALLOC(cid->urlSz, NULL, DYNAMIC_TYPE_OCSP_REQUEST);
|
||||
if (req->serial == NULL || req->url == NULL) {
|
||||
FreeOcspRequest(req);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
XMEMCPY(req->serial, cid->serial, cid->serialSz);
|
||||
XMEMCPY(req->url, cid->url, cid->urlSz);
|
||||
}
|
||||
|
||||
wolfSSL_OCSP_REQUEST_free(cid);
|
||||
|
||||
return req;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#else /* HAVE_OCSP */
|
||||
|
||||
|
332
src/sniffer.c
332
src/sniffer.c
File diff suppressed because it is too large
Load Diff
5557
src/tls13.c
Normal file
5557
src/tls13.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,6 @@ includedir=${prefix}/include
|
||||
|
||||
Name: wolfssl
|
||||
Description: wolfssl C library.
|
||||
Version: 3.10.0
|
||||
Version: 3.11.1
|
||||
Libs: -L${libdir} -lwolfssl
|
||||
Cflags: -I${includedir}
|
||||
|
2821
tests/api.c
2821
tests/api.c
File diff suppressed because it is too large
Load Diff
70
tests/hash.c
70
tests/hash.c
@@ -255,6 +255,7 @@ int md4_test(void)
|
||||
int md5_test(void)
|
||||
{
|
||||
Md5 md5;
|
||||
int ret;
|
||||
byte hash[MD5_DIGEST_SIZE];
|
||||
|
||||
testVector a, b, c, d, e;
|
||||
@@ -299,11 +300,22 @@ int md5_test(void)
|
||||
test_md5[3] = d;
|
||||
test_md5[4] = e;
|
||||
|
||||
wc_InitMd5(&md5);
|
||||
ret = wc_InitMd5(&md5);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
wc_Md5Update(&md5, (byte*)test_md5[i].input, (word32)test_md5[i].inLen);
|
||||
wc_Md5Final(&md5, hash);
|
||||
ret = wc_Md5Update(&md5, (byte*)test_md5[i].input,
|
||||
(word32)test_md5[i].inLen);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = wc_Md5Final(&md5, hash);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (XMEMCMP(hash, test_md5[i].output, MD5_DIGEST_SIZE) != 0)
|
||||
return -5 - i;
|
||||
@@ -578,6 +590,7 @@ int sha384_test()
|
||||
int ripemd_test(void)
|
||||
{
|
||||
RipeMd ripemd;
|
||||
int ret;
|
||||
byte hash[RIPEMD_DIGEST_SIZE];
|
||||
|
||||
testVector a, b, c, d;
|
||||
@@ -614,12 +627,22 @@ int ripemd_test(void)
|
||||
test_ripemd[2] = c;
|
||||
test_ripemd[3] = d;
|
||||
|
||||
wc_InitRipeMd(&ripemd);
|
||||
ret = wc_InitRipeMd(&ripemd);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
wc_RipeMdUpdate(&ripemd, (byte*)test_ripemd[i].input,
|
||||
(word32)test_ripemd[i].inLen);
|
||||
wc_RipeMdFinal(&ripemd, hash);
|
||||
ret = wc_RipeMdUpdate(&ripemd, (byte*)test_ripemd[i].input,
|
||||
(word32)test_ripemd[i].inLen);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = wc_RipeMdFinal(&ripemd, hash);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (XMEMCMP(hash, test_ripemd[i].output, RIPEMD_DIGEST_SIZE) != 0)
|
||||
return -10 - i;
|
||||
@@ -673,6 +696,10 @@ int hmac_md5_test(void)
|
||||
test_hmac[1] = b;
|
||||
test_hmac[2] = c;
|
||||
|
||||
ret = wc_HmacInit(&hmac, NULL, INVALID_DEVID);
|
||||
if (ret != 0)
|
||||
return -20009;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
#if defined(HAVE_FIPS)
|
||||
if (i == 1)
|
||||
@@ -693,6 +720,8 @@ int hmac_md5_test(void)
|
||||
return -20 - i;
|
||||
}
|
||||
|
||||
wc_HmacFree(&hmac);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -743,6 +772,10 @@ int hmac_sha_test(void)
|
||||
test_hmac[1] = b;
|
||||
test_hmac[2] = c;
|
||||
|
||||
ret = wc_HmacInit(&hmac, NULL, INVALID_DEVID);
|
||||
if (ret != 0)
|
||||
return -20009;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
#if defined(HAVE_FIPS)
|
||||
if (i == 1)
|
||||
@@ -763,6 +796,8 @@ int hmac_sha_test(void)
|
||||
return -20 - i;
|
||||
}
|
||||
|
||||
wc_HmacFree(&hmac);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -813,6 +848,10 @@ int hmac_sha224_test(void)
|
||||
test_hmac[1] = b;
|
||||
test_hmac[2] = c;
|
||||
|
||||
ret = wc_HmacInit(&hmac, NULL, INVALID_DEVID);
|
||||
if (ret != 0)
|
||||
return -20009;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
#if defined(HAVE_FIPS) || defined(HAVE_CAVIUM)
|
||||
if (i == 1)
|
||||
@@ -831,11 +870,10 @@ int hmac_sha224_test(void)
|
||||
|
||||
if (XMEMCMP(hash, test_hmac[i].output, SHA224_DIGEST_SIZE) != 0)
|
||||
return -20 - i;
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
wc_HmacAsyncFree(&hmac);
|
||||
#endif
|
||||
}
|
||||
|
||||
wc_HmacFree(&hmac);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -890,6 +928,10 @@ int hmac_sha256_test(void)
|
||||
test_hmac[1] = b;
|
||||
test_hmac[2] = c;
|
||||
|
||||
ret = wc_HmacInit(&hmac, NULL, INVALID_DEVID);
|
||||
if (ret != 0)
|
||||
return -20009;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
#if defined(HAVE_FIPS)
|
||||
if (i == 1)
|
||||
@@ -910,6 +952,8 @@ int hmac_sha256_test(void)
|
||||
return -20 - i;
|
||||
}
|
||||
|
||||
wc_HmacFree(&hmac);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -967,6 +1011,10 @@ int hmac_sha384_test(void)
|
||||
test_hmac[1] = b;
|
||||
test_hmac[2] = c;
|
||||
|
||||
ret = wc_HmacInit(&hmac, NULL, INVALID_DEVID);
|
||||
if (ret != 0)
|
||||
return -20009;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
#if defined(HAVE_FIPS)
|
||||
if (i == 1)
|
||||
@@ -987,6 +1035,8 @@ int hmac_sha384_test(void)
|
||||
return -20 - i;
|
||||
}
|
||||
|
||||
wc_HmacFree(&hmac);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@@ -20,6 +20,7 @@ tests_unit_test_DEPENDENCIES = src/libwolfssl.la
|
||||
endif
|
||||
EXTRA_DIST += tests/unit.h
|
||||
EXTRA_DIST += tests/test.conf \
|
||||
tests/test-tls13.conf \
|
||||
tests/test-qsh.conf \
|
||||
tests/test-psk-no-id.conf \
|
||||
tests/test-dtls.conf \
|
||||
|
34
tests/srp.c
34
tests/srp.c
@@ -117,8 +117,8 @@ static void test_SrpInit(void)
|
||||
|
||||
/* invalid params */
|
||||
AssertIntEQ(BAD_FUNC_ARG, wc_SrpInit(NULL, SRP_TYPE_SHA, SRP_CLIENT_SIDE));
|
||||
AssertIntEQ(BAD_FUNC_ARG, wc_SrpInit(&srp, 255, SRP_CLIENT_SIDE));
|
||||
AssertIntEQ(BAD_FUNC_ARG, wc_SrpInit(&srp, SRP_TYPE_SHA, 255 ));
|
||||
AssertIntEQ(BAD_FUNC_ARG, wc_SrpInit(&srp, (SrpType)255, SRP_CLIENT_SIDE));
|
||||
AssertIntEQ(BAD_FUNC_ARG, wc_SrpInit(&srp, SRP_TYPE_SHA, (SrpSide)255));
|
||||
|
||||
/* success */
|
||||
AssertIntEQ(0, wc_SrpInit(&srp, SRP_TYPE_SHA, SRP_CLIENT_SIDE));
|
||||
@@ -240,8 +240,8 @@ static void test_SrpSetPassword(void)
|
||||
static void test_SrpGetPublic(void)
|
||||
{
|
||||
Srp srp;
|
||||
byte public[64];
|
||||
word32 publicSz = 0;
|
||||
byte pub[64];
|
||||
word32 pubSz = 0;
|
||||
|
||||
AssertIntEQ(0, wc_SrpInit(&srp, SRP_TYPE_SHA, SRP_CLIENT_SIDE));
|
||||
AssertIntEQ(0, wc_SrpSetUsername(&srp, username, usernameSz));
|
||||
@@ -250,23 +250,23 @@ static void test_SrpGetPublic(void)
|
||||
salt, sizeof(salt)));
|
||||
|
||||
/* invalid call order */
|
||||
AssertIntEQ(SRP_CALL_ORDER_E, wc_SrpGetPublic(&srp, public, &publicSz));
|
||||
AssertIntEQ(SRP_CALL_ORDER_E, wc_SrpGetPublic(&srp, pub, &pubSz));
|
||||
|
||||
/* fix call order */
|
||||
AssertIntEQ(0, wc_SrpSetPassword(&srp, password, passwordSz));
|
||||
|
||||
/* invalid params */
|
||||
AssertIntEQ(BAD_FUNC_ARG, wc_SrpGetPublic(NULL, public, &publicSz));
|
||||
AssertIntEQ(BAD_FUNC_ARG, wc_SrpGetPublic(&srp, NULL, &publicSz));
|
||||
AssertIntEQ(BAD_FUNC_ARG, wc_SrpGetPublic(&srp, public, NULL));
|
||||
AssertIntEQ(BUFFER_E, wc_SrpGetPublic(&srp, public, &publicSz));
|
||||
AssertIntEQ(BAD_FUNC_ARG, wc_SrpGetPublic(NULL, pub, &pubSz));
|
||||
AssertIntEQ(BAD_FUNC_ARG, wc_SrpGetPublic(&srp, NULL, &pubSz));
|
||||
AssertIntEQ(BAD_FUNC_ARG, wc_SrpGetPublic(&srp, pub, NULL));
|
||||
AssertIntEQ(BUFFER_E, wc_SrpGetPublic(&srp, pub, &pubSz));
|
||||
|
||||
/* success */
|
||||
publicSz = sizeof(public);
|
||||
pubSz = sizeof(pub);
|
||||
AssertIntEQ(0, wc_SrpSetPrivate(&srp, a, sizeof(a)));
|
||||
AssertIntEQ(0, wc_SrpGetPublic(&srp, public, &publicSz));
|
||||
AssertIntEQ(publicSz, sizeof(A));
|
||||
AssertIntEQ(0, XMEMCMP(public, A, publicSz));
|
||||
AssertIntEQ(0, wc_SrpGetPublic(&srp, pub, &pubSz));
|
||||
AssertIntEQ(pubSz, sizeof(A));
|
||||
AssertIntEQ(0, XMEMCMP(pub, A, pubSz));
|
||||
|
||||
wc_SrpTerm(&srp);
|
||||
|
||||
@@ -277,16 +277,16 @@ static void test_SrpGetPublic(void)
|
||||
salt, sizeof(salt)));
|
||||
|
||||
/* invalid call order */
|
||||
AssertIntEQ(SRP_CALL_ORDER_E, wc_SrpGetPublic(&srp, public, &publicSz));
|
||||
AssertIntEQ(SRP_CALL_ORDER_E, wc_SrpGetPublic(&srp, pub, &pubSz));
|
||||
|
||||
/* fix call order */
|
||||
AssertIntEQ(0, wc_SrpSetVerifier(&srp, verifier, sizeof(verifier)));
|
||||
|
||||
/* success */
|
||||
AssertIntEQ(0, wc_SrpSetPrivate(&srp, b, sizeof(b)));
|
||||
AssertIntEQ(0, wc_SrpGetPublic(&srp, public, &publicSz));
|
||||
AssertIntEQ(publicSz, sizeof(B));
|
||||
AssertIntEQ(0, XMEMCMP(public, B, publicSz));
|
||||
AssertIntEQ(0, wc_SrpGetPublic(&srp, pub, &pubSz));
|
||||
AssertIntEQ(pubSz, sizeof(B));
|
||||
AssertIntEQ(0, XMEMCMP(pub, B, pubSz));
|
||||
|
||||
wc_SrpTerm(&srp);
|
||||
}
|
||||
|
243
tests/suites.c
243
tests/suites.c
@@ -35,7 +35,7 @@
|
||||
|
||||
#define MAX_ARGS 40
|
||||
#define MAX_COMMAND_SZ 240
|
||||
#define MAX_SUITE_SZ 80
|
||||
#define MAX_SUITE_SZ 80
|
||||
#define NOT_BUILT_IN -123
|
||||
#if defined(NO_OLD_TLS) || !defined(WOLFSSL_ALLOW_SSLV3)
|
||||
#define VERSION_TOO_OLD -124
|
||||
@@ -54,6 +54,11 @@ static char flagSep[] = " ";
|
||||
static char portFlag[] = "-p";
|
||||
static char svrPort[] = "0";
|
||||
#endif
|
||||
static char forceDefCipherListFlag[] = "-H";
|
||||
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
static int devId = INVALID_DEVID;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef WOLFSSL_ALLOW_SSLV3
|
||||
@@ -155,7 +160,8 @@ static int IsValidCipherSuite(const char* line, char* suite)
|
||||
static int execute_test_case(int svr_argc, char** svr_argv,
|
||||
int cli_argc, char** cli_argv,
|
||||
int addNoVerify, int addNonBlocking,
|
||||
int addDisableEMS)
|
||||
int addDisableEMS, int forceSrvDefCipherList,
|
||||
int forceCliDefCipherList)
|
||||
{
|
||||
#ifdef WOLFSSL_TIRTOS
|
||||
func_args cliArgs = {0};
|
||||
@@ -174,20 +180,22 @@ static int execute_test_case(int svr_argc, char** svr_argv,
|
||||
char commandLine[MAX_COMMAND_SZ];
|
||||
char cipherSuite[MAX_SUITE_SZ+1];
|
||||
int i;
|
||||
size_t added = 0;
|
||||
size_t added;
|
||||
static int tests = 1;
|
||||
|
||||
/* Is Valid Cipher and Version Checks */
|
||||
/* build command list for the Is checks below */
|
||||
commandLine[0] = '\0';
|
||||
for (i = 0; i < svr_argc; i++) {
|
||||
added = 0;
|
||||
for (i = 0; i < svrArgs.argc; i++) {
|
||||
added += XSTRLEN(svr_argv[i]) + 2;
|
||||
if (added >= MAX_COMMAND_SZ) {
|
||||
printf("server command line too long\n");
|
||||
printf("server command line too long\n");
|
||||
break;
|
||||
}
|
||||
strcat(commandLine, svr_argv[i]);
|
||||
strcat(commandLine, flagSep);
|
||||
}
|
||||
|
||||
if (IsValidCipherSuite(commandLine, cipherSuite) == 0) {
|
||||
#ifdef DEBUG_SUITE_TESTS
|
||||
printf("cipher suite %s not supported in build\n", cipherSuite);
|
||||
@@ -203,7 +211,6 @@ static int execute_test_case(int svr_argc, char** svr_argv,
|
||||
return VERSION_TOO_OLD;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NO_OLD_TLS
|
||||
if (IsOldTlsVersion(commandLine) == 1) {
|
||||
#ifdef DEBUG_SUITE_TESTS
|
||||
@@ -213,78 +220,52 @@ static int execute_test_case(int svr_argc, char** svr_argv,
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Build Client Command */
|
||||
if (addNoVerify) {
|
||||
printf("repeating test with client cert request off\n");
|
||||
added += 4; /* -d plus space plus terminator */
|
||||
if (added >= MAX_COMMAND_SZ || svr_argc >= MAX_ARGS)
|
||||
printf("repeating test with client cert request off\n");
|
||||
if (svrArgs.argc >= MAX_ARGS)
|
||||
printf("server command line too long\n");
|
||||
else {
|
||||
svr_argv[svr_argc++] = noVerifyFlag;
|
||||
svrArgs.argc = svr_argc;
|
||||
strcat(commandLine, noVerifyFlag);
|
||||
strcat(commandLine, flagSep);
|
||||
}
|
||||
else
|
||||
svr_argv[svrArgs.argc++] = noVerifyFlag;
|
||||
}
|
||||
if (addNonBlocking) {
|
||||
printf("repeating test with non blocking on\n");
|
||||
added += 4; /* -N plus terminator */
|
||||
if (added >= MAX_COMMAND_SZ || svr_argc >= MAX_ARGS)
|
||||
printf("repeating test with non blocking on\n");
|
||||
if (svrArgs.argc >= MAX_ARGS)
|
||||
printf("server command line too long\n");
|
||||
else {
|
||||
svr_argv[svr_argc++] = nonblockFlag;
|
||||
svrArgs.argc = svr_argc;
|
||||
strcat(commandLine, nonblockFlag);
|
||||
strcat(commandLine, flagSep);
|
||||
}
|
||||
else
|
||||
svr_argv[svrArgs.argc++] = nonblockFlag;
|
||||
}
|
||||
#if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_TIRTOS)
|
||||
/* add port 0 */
|
||||
if (svr_argc + 2 > MAX_ARGS)
|
||||
/* add port */
|
||||
if (svrArgs.argc + 2 > MAX_ARGS)
|
||||
printf("cannot add the magic port number flag to server\n");
|
||||
else
|
||||
{
|
||||
svr_argv[svr_argc++] = portFlag;
|
||||
svr_argv[svr_argc++] = svrPort;
|
||||
svrArgs.argc = svr_argc;
|
||||
else {
|
||||
svr_argv[svrArgs.argc++] = portFlag;
|
||||
svr_argv[svrArgs.argc++] = svrPort;
|
||||
}
|
||||
#endif
|
||||
printf("trying server command line[%d]: %s\n", tests, commandLine);
|
||||
if (forceSrvDefCipherList) {
|
||||
if (svrArgs.argc >= MAX_ARGS)
|
||||
printf("cannot add the force def cipher list flag to server\n");
|
||||
else
|
||||
svr_argv[svrArgs.argc++] = forceDefCipherListFlag;
|
||||
}
|
||||
|
||||
/* update server flags list */
|
||||
commandLine[0] = '\0';
|
||||
added = 0;
|
||||
for (i = 0; i < cli_argc; i++) {
|
||||
added += XSTRLEN(cli_argv[i]) + 2;
|
||||
for (i = 0; i < svrArgs.argc; i++) {
|
||||
added += XSTRLEN(svr_argv[i]) + 2;
|
||||
if (added >= MAX_COMMAND_SZ) {
|
||||
printf("client command line too long\n");
|
||||
printf("server command line too long\n");
|
||||
break;
|
||||
}
|
||||
strcat(commandLine, cli_argv[i]);
|
||||
strcat(commandLine, svr_argv[i]);
|
||||
strcat(commandLine, flagSep);
|
||||
}
|
||||
if (addNonBlocking) {
|
||||
added += 4; /* -N plus space plus terminator */
|
||||
if (added >= MAX_COMMAND_SZ)
|
||||
printf("client command line too long\n");
|
||||
else {
|
||||
cli_argv[cli_argc++] = nonblockFlag;
|
||||
strcat(commandLine, nonblockFlag);
|
||||
strcat(commandLine, flagSep);
|
||||
cliArgs.argc = cli_argc;
|
||||
}
|
||||
}
|
||||
if (addDisableEMS) {
|
||||
printf("repeating test without extended master secret\n");
|
||||
added += 4; /* -n plus terminator */
|
||||
if (added >= MAX_COMMAND_SZ)
|
||||
printf("client command line too long\n");
|
||||
else {
|
||||
cli_argv[cli_argc++] = disableEMSFlag;
|
||||
strcat(commandLine, disableEMSFlag);
|
||||
strcat(commandLine, flagSep);
|
||||
cliArgs.argc = cli_argc;
|
||||
}
|
||||
}
|
||||
printf("trying client command line[%d]: %s\n", tests++, commandLine);
|
||||
printf("trying server command line[%d]: %s\n", tests, commandLine);
|
||||
|
||||
tests++; /* test count */
|
||||
|
||||
InitTcpReady(&ready);
|
||||
|
||||
@@ -296,31 +277,65 @@ static int execute_test_case(int svr_argc, char** svr_argv,
|
||||
svrArgs.signal = &ready;
|
||||
start_thread(server_test, &svrArgs, &serverThread);
|
||||
wait_tcp_ready(&svrArgs);
|
||||
#if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_TIRTOS)
|
||||
if (ready.port != 0)
|
||||
{
|
||||
if (cli_argc + 2 > MAX_ARGS)
|
||||
printf("cannot add the magic port number flag to client\n");
|
||||
else {
|
||||
char portNumber[8];
|
||||
snprintf(portNumber, sizeof(portNumber), "%d", ready.port);
|
||||
cli_argv[cli_argc++] = portFlag;
|
||||
cli_argv[cli_argc++] = portNumber;
|
||||
cliArgs.argc = cli_argc;
|
||||
}
|
||||
|
||||
|
||||
/* Build Client Command */
|
||||
if (addNonBlocking) {
|
||||
if (cliArgs.argc >= MAX_ARGS)
|
||||
printf("cannot add the non block flag to client\n");
|
||||
else
|
||||
cli_argv[cliArgs.argc++] = nonblockFlag;
|
||||
}
|
||||
if (addDisableEMS) {
|
||||
printf("repeating test without extended master secret\n");
|
||||
if (cliArgs.argc >= MAX_ARGS)
|
||||
printf("cannot add the disable EMS flag to client\n");
|
||||
else
|
||||
cli_argv[cliArgs.argc++] = disableEMSFlag;
|
||||
}
|
||||
#if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_TIRTOS)
|
||||
if (ready.port != 0) {
|
||||
if (cliArgs.argc + 2 > MAX_ARGS)
|
||||
printf("cannot add the magic port number flag to client\n");
|
||||
else {
|
||||
char portNumber[8];
|
||||
snprintf(portNumber, sizeof(portNumber), "%d", ready.port);
|
||||
cli_argv[cliArgs.argc++] = portFlag;
|
||||
cli_argv[cliArgs.argc++] = portNumber;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (forceCliDefCipherList) {
|
||||
if (cliArgs.argc >= MAX_ARGS)
|
||||
printf("cannot add the force def cipher list flag to client\n");
|
||||
else
|
||||
cli_argv[cliArgs.argc++] = forceDefCipherListFlag;
|
||||
}
|
||||
|
||||
commandLine[0] = '\0';
|
||||
added = 0;
|
||||
for (i = 0; i < cliArgs.argc; i++) {
|
||||
added += XSTRLEN(cli_argv[i]) + 2;
|
||||
if (added >= MAX_COMMAND_SZ) {
|
||||
printf("client command line too long\n");
|
||||
break;
|
||||
}
|
||||
strcat(commandLine, cli_argv[i]);
|
||||
strcat(commandLine, flagSep);
|
||||
}
|
||||
printf("trying client command line[%d]: %s\n", tests, commandLine);
|
||||
|
||||
/* start client */
|
||||
client_test(&cliArgs);
|
||||
|
||||
/* verify results */
|
||||
/* verify results */
|
||||
if (cliArgs.return_code != 0) {
|
||||
printf("client_test failed\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
join_thread(serverThread);
|
||||
if (svrArgs.return_code != 0) {
|
||||
if (svrArgs.return_code != 0) {
|
||||
printf("server_test failed\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -329,7 +344,7 @@ static int execute_test_case(int svr_argc, char** svr_argv,
|
||||
fdCloseSession(Task_self());
|
||||
#endif
|
||||
FreeTcpReady(&ready);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -361,7 +376,7 @@ static void test_harness(void* vargs)
|
||||
fname = args->argv[1];
|
||||
}
|
||||
|
||||
file = fopen(fname, "r");
|
||||
file = fopen(fname, "rb");
|
||||
if (file == NULL) {
|
||||
fprintf(stderr, "unable to open %s\n", fname);
|
||||
args->return_code = 1;
|
||||
@@ -393,7 +408,7 @@ static void test_harness(void* vargs)
|
||||
args->return_code = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
fclose(file);
|
||||
script[sz] = 0;
|
||||
|
||||
@@ -442,7 +457,7 @@ static void test_harness(void* vargs)
|
||||
else
|
||||
svrArgs[svrArgsSz++] = strsep(&cursor, "\n");
|
||||
if (*cursor == 0) /* eof */
|
||||
do_it = 1;
|
||||
do_it = 1;
|
||||
}
|
||||
|
||||
if (svrArgsSz == MAX_ARGS || cliArgsSz == MAX_ARGS) {
|
||||
@@ -452,24 +467,31 @@ static void test_harness(void* vargs)
|
||||
|
||||
if (do_it) {
|
||||
ret = execute_test_case(svrArgsSz, svrArgs,
|
||||
cliArgsSz, cliArgs, 0, 0, 0);
|
||||
cliArgsSz, cliArgs, 0, 0, 0, 0, 0);
|
||||
/* don't repeat if not supported in build */
|
||||
if (ret == 0) {
|
||||
/* test with default cipher list on server side */
|
||||
execute_test_case(svrArgsSz, svrArgs,
|
||||
cliArgsSz, cliArgs, 0, 1, 0);
|
||||
cliArgsSz, cliArgs, 0, 0, 0, 1, 0);
|
||||
/* test with default cipher list on client side */
|
||||
execute_test_case(svrArgsSz, svrArgs,
|
||||
cliArgsSz, cliArgs, 1, 0, 0);
|
||||
cliArgsSz, cliArgs, 0, 0, 0, 0, 1);
|
||||
|
||||
execute_test_case(svrArgsSz, svrArgs,
|
||||
cliArgsSz, cliArgs, 1, 1, 0);
|
||||
cliArgsSz, cliArgs, 0, 1, 0, 0, 0);
|
||||
execute_test_case(svrArgsSz, svrArgs,
|
||||
cliArgsSz, cliArgs, 1, 0, 0, 0, 0);
|
||||
execute_test_case(svrArgsSz, svrArgs,
|
||||
cliArgsSz, cliArgs, 1, 1, 0, 0, 0);
|
||||
#ifdef HAVE_EXTENDED_MASTER
|
||||
execute_test_case(svrArgsSz, svrArgs,
|
||||
cliArgsSz, cliArgs, 0, 0, 1);
|
||||
cliArgsSz, cliArgs, 0, 0, 1, 0, 0);
|
||||
execute_test_case(svrArgsSz, svrArgs,
|
||||
cliArgsSz, cliArgs, 0, 1, 1);
|
||||
cliArgsSz, cliArgs, 0, 1, 1, 0, 0);
|
||||
execute_test_case(svrArgsSz, svrArgs,
|
||||
cliArgsSz, cliArgs, 1, 0, 1);
|
||||
cliArgsSz, cliArgs, 1, 0, 1, 0, 0);
|
||||
execute_test_case(svrArgsSz, svrArgs,
|
||||
cliArgsSz, cliArgs, 1, 1, 1);
|
||||
cliArgsSz, cliArgs, 1, 1, 1, 0, 0);
|
||||
#endif
|
||||
}
|
||||
svrArgsSz = 1;
|
||||
@@ -515,22 +537,43 @@ int SuiteTest(void)
|
||||
memory, sizeof(memory), 0, 1)
|
||||
!= SSL_SUCCESS) {
|
||||
printf("unable to load static memory and create ctx");
|
||||
exit(EXIT_FAILURE);
|
||||
args.return_code = EXIT_FAILURE;
|
||||
goto exit;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
if (wolfAsync_DevOpen(&devId) < 0) {
|
||||
printf("Async device open failed");
|
||||
args.return_code = EXIT_FAILURE;
|
||||
goto exit;
|
||||
}
|
||||
wolfSSL_CTX_UseAsync(cipherSuiteCtx, devId);
|
||||
#endif /* WOLFSSL_ASYNC_CRYPT */
|
||||
|
||||
/* default case */
|
||||
args.argc = 1;
|
||||
printf("starting default cipher suite tests\n");
|
||||
test_harness(&args);
|
||||
if (args.return_code != 0) {
|
||||
printf("error from script %d\n", args.return_code);
|
||||
exit(EXIT_FAILURE);
|
||||
args.return_code = EXIT_FAILURE;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* any extra cases will need another argument */
|
||||
args.argc = 2;
|
||||
|
||||
#ifdef WOLFSSL_TLS13
|
||||
/* add TLSv13 extra suites */
|
||||
strcpy(argv0[1], "tests/test-tls13.conf");
|
||||
printf("starting TLSv13 extra cipher suite tests\n");
|
||||
test_harness(&args);
|
||||
if (args.return_code != 0) {
|
||||
printf("error from script %d\n", args.return_code);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
#ifdef WOLFSSL_DTLS
|
||||
/* add dtls extra suites */
|
||||
strcpy(argv0[1], "tests/test-dtls.conf");
|
||||
@@ -538,7 +581,8 @@ int SuiteTest(void)
|
||||
test_harness(&args);
|
||||
if (args.return_code != 0) {
|
||||
printf("error from script %d\n", args.return_code);
|
||||
exit(EXIT_FAILURE);
|
||||
args.return_code = EXIT_FAILURE;
|
||||
goto exit;
|
||||
}
|
||||
#endif
|
||||
#ifdef WOLFSSL_SCTP
|
||||
@@ -548,7 +592,8 @@ int SuiteTest(void)
|
||||
test_harness(&args);
|
||||
if (args.return_code != 0) {
|
||||
printf("error from script %d\n", args.return_code);
|
||||
exit(EXIT_FAILURE);
|
||||
args.return_code = EXIT_FAILURE;
|
||||
goto exit;
|
||||
}
|
||||
#endif
|
||||
#ifndef WC_STRICT_SIG
|
||||
@@ -559,7 +604,8 @@ int SuiteTest(void)
|
||||
test_harness(&args);
|
||||
if (args.return_code != 0) {
|
||||
printf("error from script %d\n", args.return_code);
|
||||
exit(EXIT_FAILURE);
|
||||
args.return_code = EXIT_FAILURE;
|
||||
goto exit;
|
||||
}
|
||||
#endif /* HAVE_RSA and HAVE_ECC */
|
||||
#endif /* !WC_STRICT_SIG */
|
||||
@@ -570,7 +616,8 @@ int SuiteTest(void)
|
||||
test_harness(&args);
|
||||
if (args.return_code != 0) {
|
||||
printf("error from script %d\n", args.return_code);
|
||||
exit(EXIT_FAILURE);
|
||||
args.return_code = EXIT_FAILURE;
|
||||
goto exit;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -581,15 +628,21 @@ int SuiteTest(void)
|
||||
test_harness(&args);
|
||||
if (args.return_code != 0) {
|
||||
printf("error from script %d\n", args.return_code);
|
||||
exit(EXIT_FAILURE);
|
||||
args.return_code = EXIT_FAILURE;
|
||||
goto exit;
|
||||
}
|
||||
#endif
|
||||
|
||||
exit:
|
||||
printf(" End Cipher Suite Tests\n");
|
||||
|
||||
wolfSSL_CTX_free(cipherSuiteCtx);
|
||||
wolfSSL_Cleanup();
|
||||
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
wolfAsync_DevClose(&devId);
|
||||
#endif
|
||||
|
||||
return args.return_code;
|
||||
}
|
||||
|
||||
|
@@ -1,36 +1,3 @@
|
||||
# server DTLSv1 DHE-RSA-CHACHA20-POLY1305
|
||||
-u
|
||||
-v 2
|
||||
-l DHE-RSA-CHACHA20-POLY1305
|
||||
|
||||
# client DTLSv1 DHE-RSA-CHACHA20-POLY1305
|
||||
-u
|
||||
-v 2
|
||||
-l DHE-RSA-CHACHA20-POLY1305
|
||||
|
||||
# server DTLSv1 ECDHE-RSA-CHACHA20-POLY1305
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-RSA-CHACHA20-POLY1305
|
||||
|
||||
# client DTLSv1 ECDHE-RSA-CHACHA20-POLY1305
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-RSA-CHACHA20-POLY1305
|
||||
|
||||
# server DTLSv1 ECDHE-EDCSA-CHACHA20-POLY1305
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-ECDSA-CHACHA20-POLY1305
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1 ECDHE-ECDSA-CHACHA20-POLY1305
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-ECDSA-CHACHA20-POLY1305
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 DHE-RSA-CHACHA20-POLY1305
|
||||
-u
|
||||
-v 3
|
||||
@@ -133,26 +100,6 @@
|
||||
-l ECDHE-ECDSA-CHACHA20-POLY1305-OLD
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1 RC4-SHA
|
||||
-u
|
||||
-v 2
|
||||
-l RC4-SHA
|
||||
|
||||
# client DTLSv1 RC4-SHA
|
||||
-u
|
||||
-v 2
|
||||
-l RC4-SHA
|
||||
|
||||
# server DTLSv1.2 RC4-SHA
|
||||
-u
|
||||
-v 3
|
||||
-l RC4-SHA
|
||||
|
||||
# client DTLSv1.2 RC4-SHA
|
||||
-u
|
||||
-v 3
|
||||
-l RC4-SHA
|
||||
|
||||
# server DTLSv1 IDEA-CBC-SHA
|
||||
-u
|
||||
-v 2
|
||||
@@ -263,16 +210,6 @@
|
||||
-v 3
|
||||
-l AES256-SHA256
|
||||
|
||||
# server DTLSv1 ECDHE-RSA-RC4
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-RSA-RC4-SHA
|
||||
|
||||
# client DTLSv1 ECDHE-RSA-RC4
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-RSA-RC4-SHA
|
||||
|
||||
# server DTLSv1.1 ECDHE-RSA-DES3
|
||||
-u
|
||||
-v 2
|
||||
@@ -283,12 +220,12 @@
|
||||
-v 2
|
||||
-l ECDHE-RSA-DES-CBC3-SHA
|
||||
|
||||
# server DTLSv1.1 ECDHE-RSA-AES128
|
||||
# server DTLSv1.1 ECDHE-RSA-AES128
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-RSA-AES128-SHA
|
||||
|
||||
# client DTLSv1.1 ECDHE-RSA-AES128
|
||||
# client DTLSv1.1 ECDHE-RSA-AES128
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-RSA-AES128-SHA
|
||||
@@ -303,16 +240,6 @@
|
||||
-v 2
|
||||
-l ECDHE-RSA-AES256-SHA
|
||||
|
||||
# server DTLSv1.2 ECDHE-RSA-RC4
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-RC4-SHA
|
||||
|
||||
# client DTLSv1.2 ECDHE-RSA-RC4
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-RC4-SHA
|
||||
|
||||
# server DTLSv1.2 ECDHE-RSA-DES3
|
||||
-u
|
||||
-v 3
|
||||
@@ -323,12 +250,12 @@
|
||||
-v 3
|
||||
-l ECDHE-RSA-DES-CBC3-SHA
|
||||
|
||||
# server DTLSv1.2 ECDHE-RSA-AES128
|
||||
# server DTLSv1.2 ECDHE-RSA-AES128
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES128-SHA
|
||||
|
||||
# client DTLSv1.2 ECDHE-RSA-AES128
|
||||
# client DTLSv1.2 ECDHE-RSA-AES128
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES128-SHA
|
||||
@@ -338,7 +265,7 @@
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES128-SHA256
|
||||
|
||||
# client DTLSv1.2 ECDHE-RSA-AES128-SHA256
|
||||
# client DTLSv1.2 ECDHE-RSA-AES128-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES128-SHA256
|
||||
@@ -392,19 +319,6 @@
|
||||
-l ECDHE-ECDSA-NULL-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.1 ECDHE-EDCSA-RC4
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-ECDSA-RC4-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.1 ECDHE-ECDSA-RC4
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-ECDSA-RC4-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.1 ECDHE-ECDSA-DES3
|
||||
-u
|
||||
-v 2
|
||||
@@ -418,14 +332,14 @@
|
||||
-l ECDHE-ECDSA-DES-CBC3-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.1 ECDHE-ECDSA-AES128
|
||||
# server DTLSv1.1 ECDHE-ECDSA-AES128
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-ECDSA-AES128-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.1 ECDHE-ECDSA-AES128
|
||||
# client DTLSv1.1 ECDHE-ECDSA-AES128
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-ECDSA-AES128-SHA
|
||||
@@ -444,19 +358,6 @@
|
||||
-l ECDHE-ECDSA-AES256-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDHE-ECDSA-RC4
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-RC4-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDHE-ECDSA-RC4
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-RC4-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDHE-ECDSA-DES3
|
||||
-u
|
||||
-v 3
|
||||
@@ -470,14 +371,14 @@
|
||||
-l ECDHE-ECDSA-DES-CBC3-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDHE-ECDSA-AES128
|
||||
# server DTLSv1.2 ECDHE-ECDSA-AES128
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES128-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDHE-ECDSA-AES128
|
||||
# client DTLSv1.2 ECDHE-ECDSA-AES128
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES128-SHA
|
||||
@@ -509,18 +410,6 @@
|
||||
-l ECDHE-ECDSA-AES256-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.1 ECDH-RSA-RC4
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-RSA-RC4-SHA
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.1 ECDH-RSA-RC4
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-RSA-RC4-SHA
|
||||
|
||||
# server DTLSv1.1 ECDH-RSA-DES3
|
||||
-u
|
||||
-v 2
|
||||
@@ -533,14 +422,14 @@
|
||||
-v 2
|
||||
-l ECDH-RSA-DES-CBC3-SHA
|
||||
|
||||
# server DTLSv1.1 ECDH-RSA-AES128
|
||||
# server DTLSv1.1 ECDH-RSA-AES128
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-RSA-AES128-SHA
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.1 ECDH-RSA-AES128
|
||||
# client DTLSv1.1 ECDH-RSA-AES128
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-RSA-AES128-SHA
|
||||
@@ -557,18 +446,6 @@
|
||||
-v 2
|
||||
-l ECDH-RSA-AES256-SHA
|
||||
|
||||
# server DTLSv1.2 ECDH-RSA-RC4
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-RC4-SHA
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-RSA-RC4
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-RC4-SHA
|
||||
|
||||
# server DTLSv1.2 ECDH-RSA-DES3
|
||||
-u
|
||||
-v 3
|
||||
@@ -581,26 +458,26 @@
|
||||
-v 3
|
||||
-l ECDH-RSA-DES-CBC3-SHA
|
||||
|
||||
# server DTLSv1.2 ECDH-RSA-AES128
|
||||
# server DTLSv1.2 ECDH-RSA-AES128
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-AES128-SHA
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-RSA-AES128
|
||||
# client DTLSv1.2 ECDH-RSA-AES128
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-AES128-SHA
|
||||
|
||||
# server DTLSv1.2 ECDH-RSA-AES128-SHA256
|
||||
# server DTLSv1.2 ECDH-RSA-AES128-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-AES128-SHA256
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-RSA-AES128-SHA256
|
||||
# client DTLSv1.2 ECDH-RSA-AES128-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-AES128-SHA256
|
||||
@@ -617,19 +494,6 @@
|
||||
-v 3
|
||||
-l ECDH-RSA-AES256-SHA
|
||||
|
||||
# server DTLSv1.1 ECDH-EDCSA-RC4
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-ECDSA-RC4-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.1 ECDH-ECDSA-RC4
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-ECDSA-RC4-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.1 ECDH-ECDSA-DES3
|
||||
-u
|
||||
-v 2
|
||||
@@ -643,14 +507,14 @@
|
||||
-l ECDH-ECDSA-DES-CBC3-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.1 ECDH-ECDSA-AES128
|
||||
# server DTLSv1.1 ECDH-ECDSA-AES128
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-ECDSA-AES128-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.1 ECDH-ECDSA-AES128
|
||||
# client DTLSv1.1 ECDH-ECDSA-AES128
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-ECDSA-AES128-SHA
|
||||
@@ -669,19 +533,6 @@
|
||||
-l ECDH-ECDSA-AES256-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDHE-ECDSA-RC4
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-RC4-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-ECDSA-RC4
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-RC4-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDH-ECDSA-DES3
|
||||
-u
|
||||
-v 3
|
||||
@@ -695,14 +546,14 @@
|
||||
-l ECDH-ECDSA-DES-CBC3-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDH-ECDSA-AES128
|
||||
# server DTLSv1.2 ECDH-ECDSA-AES128
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES128-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-ECDSA-AES128
|
||||
# client DTLSv1.2 ECDH-ECDSA-AES128
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES128-SHA
|
||||
@@ -715,7 +566,7 @@
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-ECDSA-AES128-SHA256
|
||||
# client DTLSv1.2 ECDH-ECDSA-AES128-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES128-SHA256
|
||||
@@ -734,12 +585,12 @@
|
||||
-l ECDH-ECDSA-AES256-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDHE-RSA-AES256-SHA384
|
||||
# server DTLSv1.2 ECDHE-RSA-AES256-SHA384
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES256-SHA384
|
||||
|
||||
# client DTLSv1.2 ECDHE-RSA-AES256-SHA384
|
||||
# client DTLSv1.2 ECDHE-RSA-AES256-SHA384
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES256-SHA384
|
||||
@@ -757,14 +608,14 @@
|
||||
-l ECDHE-ECDSA-AES256-SHA384
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDH-RSA-AES256-SHA384
|
||||
# server DTLSv1.2 ECDH-RSA-AES256-SHA384
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-AES256-SHA384
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-RSA-AES256-SHA384
|
||||
# client DTLSv1.2 ECDH-RSA-AES256-SHA384
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-AES256-SHA384
|
||||
@@ -776,7 +627,7 @@
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-ECDSA-AES256-SHA384
|
||||
# client DTLSv1.2 ECDH-ECDSA-AES256-SHA384
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES256-SHA384
|
||||
@@ -926,14 +777,14 @@
|
||||
-v 3
|
||||
-l PSK-AES256-CBC-SHA384
|
||||
|
||||
# server DTLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
# server DTLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
# client DTLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
@@ -952,14 +803,14 @@
|
||||
-l ECDHE-ECDSA-AES256-GCM-SHA384
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDH-ECDSA-AES128-GCM-SHA256
|
||||
# server DTLSv1.2 ECDH-ECDSA-AES128-GCM-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES128-GCM-SHA256
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-ECDSA-AES128-GCM-SHA256
|
||||
# client DTLSv1.2 ECDH-ECDSA-AES128-GCM-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES128-GCM-SHA256
|
||||
@@ -978,12 +829,12 @@
|
||||
-l ECDH-ECDSA-AES256-GCM-SHA384
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDHE-RSA-AES128-GCM-SHA256
|
||||
# server DTLSv1.2 ECDHE-RSA-AES128-GCM-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES128-GCM-SHA256
|
||||
|
||||
# client DTLSv1.2 ECDHE-RSA-AES128-GCM-SHA256
|
||||
# client DTLSv1.2 ECDHE-RSA-AES128-GCM-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES128-GCM-SHA256
|
||||
@@ -998,14 +849,14 @@
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES256-GCM-SHA384
|
||||
|
||||
# server DTLSv1.2 ECDH-RSA-AES128-GCM-SHA256
|
||||
# server DTLSv1.2 ECDH-RSA-AES128-GCM-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-AES128-GCM-SHA256
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-RSA-AES128-GCM-SHA256
|
||||
# client DTLSv1.2 ECDH-RSA-AES128-GCM-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-AES128-GCM-SHA256
|
||||
|
@@ -174,6 +174,17 @@
|
||||
-l ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
-A ./certs/ca-cert.pem
|
||||
|
||||
# server TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-privkey.pem
|
||||
|
||||
# client TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
-A ./certs/ca-cert.pem
|
||||
|
||||
# server TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES256-GCM-SHA384
|
||||
|
95
tests/test-tls13.conf
Normal file
95
tests/test-tls13.conf
Normal file
@@ -0,0 +1,95 @@
|
||||
# server TLSv1.3 TLS13-CHACH20-POLY1305-SHA256
|
||||
-v 4
|
||||
-l TLS13-CHACH20-POLY1305-SHA256
|
||||
|
||||
# client TLSv1.3 TLS13-CHACH20-POLY1305-SHA256
|
||||
-v 4
|
||||
-l TLS13-CHACH20-POLY1305-SHA256
|
||||
|
||||
# server TLSv1.3 TLS13-AES128-GCM-SHA256
|
||||
-v 4
|
||||
-l TLS13-AES128-GCM-SHA256
|
||||
|
||||
# client TLSv1.3 TLS13-AES128-GCM-SHA256
|
||||
-v 4
|
||||
-l TLS13-AES128-GCM-SHA256
|
||||
|
||||
# server TLSv1.3 TLS13-AES256-GCM-SHA384
|
||||
-v 4
|
||||
-l TLS13-AES256-GCM-SHA384
|
||||
|
||||
# client TLSv1.3 TLS13-AES256-GCM-SHA384
|
||||
-v 4
|
||||
-l TLS13-AES256-GCM-SHA384
|
||||
|
||||
# server TLSv1.3 TLS13-AES128-CCM-SHA256
|
||||
-v 4
|
||||
-l TLS13-AES128-CCM-SHA256
|
||||
|
||||
# client TLSv1.3 TLS13-AES128-CCM-SHA256
|
||||
-v 4
|
||||
-l TLS13-AES128-CCM-SHA256
|
||||
|
||||
# server TLSv1.3 TLS13-AES128-CCM-8-SHA256
|
||||
-v 4
|
||||
-l TLS13-AES128-CCM-8-SHA256
|
||||
|
||||
# client TLSv1.3 TLS13-AES128-CCM-8-SHA256
|
||||
-v 4
|
||||
-l TLS13-AES128-CCM-8-SHA256
|
||||
|
||||
# server TLSv1.3 TLS13-CHACH20-POLY1305-SHA256
|
||||
-v 4
|
||||
-l TLS13-CHACH20-POLY1305-SHA256
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1.3 TLS13-CHACH20-POLY1305-SHA256
|
||||
-v 4
|
||||
-l TLS13-CHACH20-POLY1305-SHA256
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server TLSv1.3 TLS13-AES128-GCM-SHA256
|
||||
-v 4
|
||||
-l TLS13-AES128-GCM-SHA256
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1.3 TLS13-AES128-GCM-SHA256
|
||||
-v 4
|
||||
-l TLS13-AES128-GCM-SHA256
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server TLSv1.3 TLS13-AES256-GCM-SHA384
|
||||
-v 4
|
||||
-l TLS13-AES256-GCM-SHA384
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1.3 TLS13-AES256-GCM-SHA384
|
||||
-v 4
|
||||
-l TLS13-AES256-GCM-SHA384
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server TLSv1.3 TLS13-AES128-CCM-SHA256
|
||||
-v 4
|
||||
-l TLS13-AES128-CCM-SHA256
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1.3 TLS13-AES128-CCM-SHA256
|
||||
-v 4
|
||||
-l TLS13-AES128-CCM-SHA256
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server TLSv1.3 TLS13-AES128-CCM-8-SHA256
|
||||
-v 4
|
||||
-l TLS13-AES128-CCM-8-SHA256
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1.3 TLS13-AES128-CCM-8-SHA256
|
||||
-v 4
|
||||
-l TLS13-AES128-CCM-8-SHA256
|
||||
-A ./certs/server-ecc.pem
|
||||
|
124
tests/test.conf
124
tests/test.conf
@@ -1,30 +1,3 @@
|
||||
# server TLSv1.1 DHE-RSA-CHACHA20-POLY1305
|
||||
-v 2
|
||||
-l DHE-RSA-CHACHA20-POLY1305
|
||||
|
||||
# client TLSv1.1 DHE-RSA-CHACHA20-POLY1305
|
||||
-v 2
|
||||
-l DHE-RSA-CHACHA20-POLY1305
|
||||
|
||||
# server TLSv1.1 ECDHE-RSA-CHACHA20-POLY1305
|
||||
-v 2
|
||||
-l ECDHE-RSA-CHACHA20-POLY1305
|
||||
|
||||
# client TLSv1.1 ECDHE-RSA-CHACHA20-POLY1305
|
||||
-v 2
|
||||
-l ECDHE-RSA-CHACHA20-POLY1305
|
||||
|
||||
# server TLSv1.1 ECDHE-EDCSA-CHACHA20-POLY1305
|
||||
-v 2
|
||||
-l ECDHE-ECDSA-CHACHA20-POLY1305
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1.1 ECDHE-ECDSA-CHACHA20-POLY1305
|
||||
-v 2
|
||||
-l ECDHE-ECDSA-CHACHA20-POLY1305
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server TLSv1.2 DHE-RSA-CHACHA20-POLY1305
|
||||
-v 3
|
||||
-l DHE-RSA-CHACHA20-POLY1305
|
||||
@@ -341,11 +314,11 @@
|
||||
-v 1
|
||||
-l ECDHE-RSA-DES-CBC3-SHA
|
||||
|
||||
# server TLSv1 ECDHE-RSA-AES128
|
||||
# server TLSv1 ECDHE-RSA-AES128
|
||||
-v 1
|
||||
-l ECDHE-RSA-AES128-SHA
|
||||
|
||||
# client TLSv1 ECDHE-RSA-AES128
|
||||
# client TLSv1 ECDHE-RSA-AES128
|
||||
-v 1
|
||||
-l ECDHE-RSA-AES128-SHA
|
||||
|
||||
@@ -373,11 +346,11 @@
|
||||
-v 2
|
||||
-l ECDHE-RSA-DES-CBC3-SHA
|
||||
|
||||
# server TLSv1.1 ECDHE-RSA-AES128
|
||||
# server TLSv1.1 ECDHE-RSA-AES128
|
||||
-v 2
|
||||
-l ECDHE-RSA-AES128-SHA
|
||||
|
||||
# client TLSv1.1 ECDHE-RSA-AES128
|
||||
# client TLSv1.1 ECDHE-RSA-AES128
|
||||
-v 2
|
||||
-l ECDHE-RSA-AES128-SHA
|
||||
|
||||
@@ -405,11 +378,11 @@
|
||||
-v 3
|
||||
-l ECDHE-RSA-DES-CBC3-SHA
|
||||
|
||||
# server TLSv1.2 ECDHE-RSA-AES128
|
||||
# server TLSv1.2 ECDHE-RSA-AES128
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES128-SHA
|
||||
|
||||
# client TLSv1.2 ECDHE-RSA-AES128
|
||||
# client TLSv1.2 ECDHE-RSA-AES128
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES128-SHA
|
||||
|
||||
@@ -417,7 +390,7 @@
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES128-SHA256
|
||||
|
||||
# client TLSv1.2 ECDHE-RSA-AES128-SHA256
|
||||
# client TLSv1.2 ECDHE-RSA-AES128-SHA256
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES128-SHA256
|
||||
|
||||
@@ -484,13 +457,13 @@
|
||||
-l ECDHE-ECDSA-DES-CBC3-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server TLSv1 ECDHE-ECDSA-AES128
|
||||
# server TLSv1 ECDHE-ECDSA-AES128
|
||||
-v 1
|
||||
-l ECDHE-ECDSA-AES128-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1 ECDHE-ECDSA-AES128
|
||||
# client TLSv1 ECDHE-ECDSA-AES128
|
||||
-v 1
|
||||
-l ECDHE-ECDSA-AES128-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
@@ -528,13 +501,13 @@
|
||||
-l ECDHE-ECDSA-DES-CBC3-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server TLSv1.1 ECDHE-ECDSA-AES128
|
||||
# server TLSv1.1 ECDHE-ECDSA-AES128
|
||||
-v 2
|
||||
-l ECDHE-ECDSA-AES128-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1.1 ECDHE-ECDSA-AES128
|
||||
# client TLSv1.1 ECDHE-ECDSA-AES128
|
||||
-v 2
|
||||
-l ECDHE-ECDSA-AES128-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
@@ -572,13 +545,13 @@
|
||||
-l ECDHE-ECDSA-DES-CBC3-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server TLSv1.2 ECDHE-ECDSA-AES128
|
||||
# server TLSv1.2 ECDHE-ECDSA-AES128
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES128-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1.2 ECDHE-ECDSA-AES128
|
||||
# client TLSv1.2 ECDHE-ECDSA-AES128
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES128-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
@@ -625,13 +598,13 @@
|
||||
-v 1
|
||||
-l ECDH-RSA-DES-CBC3-SHA
|
||||
|
||||
# server TLSv1 ECDH-RSA-AES128
|
||||
# server TLSv1 ECDH-RSA-AES128
|
||||
-v 1
|
||||
-l ECDH-RSA-AES128-SHA
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1 ECDH-RSA-AES128
|
||||
# client TLSv1 ECDH-RSA-AES128
|
||||
-v 1
|
||||
-l ECDH-RSA-AES128-SHA
|
||||
|
||||
@@ -665,13 +638,13 @@
|
||||
-v 2
|
||||
-l ECDH-RSA-DES-CBC3-SHA
|
||||
|
||||
# server TLSv1.1 ECDH-RSA-AES128
|
||||
# server TLSv1.1 ECDH-RSA-AES128
|
||||
-v 2
|
||||
-l ECDH-RSA-AES128-SHA
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1.1 ECDH-RSA-AES128
|
||||
# client TLSv1.1 ECDH-RSA-AES128
|
||||
-v 2
|
||||
-l ECDH-RSA-AES128-SHA
|
||||
|
||||
@@ -705,23 +678,23 @@
|
||||
-v 3
|
||||
-l ECDH-RSA-DES-CBC3-SHA
|
||||
|
||||
# server TLSv1.2 ECDH-RSA-AES128
|
||||
# server TLSv1.2 ECDH-RSA-AES128
|
||||
-v 3
|
||||
-l ECDH-RSA-AES128-SHA
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1.2 ECDH-RSA-AES128
|
||||
# client TLSv1.2 ECDH-RSA-AES128
|
||||
-v 3
|
||||
-l ECDH-RSA-AES128-SHA
|
||||
|
||||
# server TLSv1.2 ECDH-RSA-AES128-SHA256
|
||||
# server TLSv1.2 ECDH-RSA-AES128-SHA256
|
||||
-v 3
|
||||
-l ECDH-RSA-AES128-SHA256
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1.2 ECDH-RSA-AES128-SHA256
|
||||
# client TLSv1.2 ECDH-RSA-AES128-SHA256
|
||||
-v 3
|
||||
-l ECDH-RSA-AES128-SHA256
|
||||
|
||||
@@ -757,13 +730,13 @@
|
||||
-l ECDH-ECDSA-DES-CBC3-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server TLSv1 ECDH-ECDSA-AES128
|
||||
# server TLSv1 ECDH-ECDSA-AES128
|
||||
-v 1
|
||||
-l ECDH-ECDSA-AES128-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1 ECDH-ECDSA-AES128
|
||||
# client TLSv1 ECDH-ECDSA-AES128
|
||||
-v 1
|
||||
-l ECDH-ECDSA-AES128-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
@@ -801,13 +774,13 @@
|
||||
-l ECDH-ECDSA-DES-CBC3-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server TLSv1.1 ECDH-ECDSA-AES128
|
||||
# server TLSv1.1 ECDH-ECDSA-AES128
|
||||
-v 2
|
||||
-l ECDH-ECDSA-AES128-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1.1 ECDH-ECDSA-AES128
|
||||
# client TLSv1.1 ECDH-ECDSA-AES128
|
||||
-v 2
|
||||
-l ECDH-ECDSA-AES128-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
@@ -845,13 +818,13 @@
|
||||
-l ECDH-ECDSA-DES-CBC3-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server TLSv1.2 ECDH-ECDSA-AES128
|
||||
# server TLSv1.2 ECDH-ECDSA-AES128
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES128-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1.2 ECDH-ECDSA-AES128
|
||||
# client TLSv1.2 ECDH-ECDSA-AES128
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES128-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
@@ -862,7 +835,7 @@
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1.2 ECDH-ECDSA-AES128-SHA256
|
||||
# client TLSv1.2 ECDH-ECDSA-AES128-SHA256
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES128-SHA256
|
||||
-A ./certs/server-ecc.pem
|
||||
@@ -882,7 +855,7 @@
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES256-SHA384
|
||||
|
||||
# client TLSv1.2 ECDHE-RSA-AES256-SHA384
|
||||
# client TLSv1.2 ECDHE-RSA-AES256-SHA384
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES256-SHA384
|
||||
|
||||
@@ -897,13 +870,13 @@
|
||||
-l ECDHE-ECDSA-AES256-SHA384
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server TLSv1.2 ECDH-RSA-AES256-SHA384
|
||||
# server TLSv1.2 ECDH-RSA-AES256-SHA384
|
||||
-v 3
|
||||
-l ECDH-RSA-AES256-SHA384
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1.2 ECDH-RSA-AES256-SHA384
|
||||
# client TLSv1.2 ECDH-RSA-AES256-SHA384
|
||||
-v 3
|
||||
-l ECDH-RSA-AES256-SHA384
|
||||
|
||||
@@ -913,7 +886,7 @@
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1.2 ECDH-ECDSA-AES256-SHA384
|
||||
# client TLSv1.2 ECDH-ECDSA-AES256-SHA384
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES256-SHA384
|
||||
-A ./certs/server-ecc.pem
|
||||
@@ -1664,11 +1637,11 @@
|
||||
-v 3
|
||||
-l DHE-RSA-CAMELLIA256-SHA256
|
||||
|
||||
# server TLSv1.2 RSA-AES128-GCM-SHA256
|
||||
# server TLSv1.2 RSA-AES128-GCM-SHA256
|
||||
-v 3
|
||||
-l AES128-GCM-SHA256
|
||||
|
||||
# client TLSv1.2 RSA-AES128-GCM-SHA256
|
||||
# client TLSv1.2 RSA-AES128-GCM-SHA256
|
||||
-v 3
|
||||
-l AES128-GCM-SHA256
|
||||
|
||||
@@ -1680,13 +1653,13 @@
|
||||
-v 3
|
||||
-l AES256-GCM-SHA384
|
||||
|
||||
# server TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
# server TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
# client TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
-A ./certs/server-ecc.pem
|
||||
@@ -1702,13 +1675,13 @@
|
||||
-l ECDHE-ECDSA-AES256-GCM-SHA384
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server TLSv1.2 ECDH-ECDSA-AES128-GCM-SHA256
|
||||
# server TLSv1.2 ECDH-ECDSA-AES128-GCM-SHA256
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES128-GCM-SHA256
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1.2 ECDH-ECDSA-AES128-GCM-SHA256
|
||||
# client TLSv1.2 ECDH-ECDSA-AES128-GCM-SHA256
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES128-GCM-SHA256
|
||||
-A ./certs/server-ecc.pem
|
||||
@@ -1724,11 +1697,11 @@
|
||||
-l ECDH-ECDSA-AES256-GCM-SHA384
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256
|
||||
# server TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES128-GCM-SHA256
|
||||
|
||||
# client TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256
|
||||
# client TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES128-GCM-SHA256
|
||||
|
||||
@@ -1740,13 +1713,13 @@
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES256-GCM-SHA384
|
||||
|
||||
# server TLSv1.2 ECDH-RSA-AES128-GCM-SHA256
|
||||
# server TLSv1.2 ECDH-RSA-AES128-GCM-SHA256
|
||||
-v 3
|
||||
-l ECDH-RSA-AES128-GCM-SHA256
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client TLSv1.2 ECDH-RSA-AES128-GCM-SHA256
|
||||
# client TLSv1.2 ECDH-RSA-AES128-GCM-SHA256
|
||||
-v 3
|
||||
-l ECDH-RSA-AES128-GCM-SHA256
|
||||
|
||||
@@ -1760,11 +1733,11 @@
|
||||
-v 3
|
||||
-l ECDH-RSA-AES256-GCM-SHA384
|
||||
|
||||
# server TLSv1.2 DHE-RSA-AES128-GCM-SHA256
|
||||
# server TLSv1.2 DHE-RSA-AES128-GCM-SHA256
|
||||
-v 3
|
||||
-l DHE-RSA-AES128-GCM-SHA256
|
||||
|
||||
# client TLSv1.2 DHE-RSA-AES128-GCM-SHA256
|
||||
# client TLSv1.2 DHE-RSA-AES128-GCM-SHA256
|
||||
-v 3
|
||||
-l DHE-RSA-AES128-GCM-SHA256
|
||||
|
||||
@@ -2196,3 +2169,12 @@
|
||||
-v 3
|
||||
-l NTRU-AES128-SHA
|
||||
|
||||
# server TLSv1.2 verify callback override
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES128-SHA256
|
||||
|
||||
# client TLSv1.2 verify callback override
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES128-SHA256
|
||||
-j
|
||||
|
||||
|
@@ -45,7 +45,7 @@ int main(int argc, char** argv)
|
||||
|
||||
int unit_test(int argc, char** argv)
|
||||
{
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
@@ -68,24 +68,25 @@ int unit_test(int argc, char** argv)
|
||||
|
||||
if ( (ret = HashTest()) != 0){
|
||||
printf("hash test failed with %d\n", ret);
|
||||
return ret;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
#ifndef SINGLE_THREADED
|
||||
if ( (ret = SuiteTest()) != 0){
|
||||
printf("suite test failed with %d\n", ret);
|
||||
return ret;
|
||||
goto exit;
|
||||
}
|
||||
#endif
|
||||
|
||||
SrpTest();
|
||||
|
||||
exit:
|
||||
#ifdef HAVE_WNR
|
||||
if (wc_FreeNetRandom() < 0)
|
||||
err_sys("Failed to free netRandom context");
|
||||
#endif /* HAVE_WNR */
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -210,7 +210,7 @@ int testsuite_test(int argc, char** argv)
|
||||
#endif /* HAVE_WNR */
|
||||
|
||||
printf("\nAll tests passed!\n");
|
||||
EXIT_TEST(EXIT_SUCCESS);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
void simple_test(func_args* args)
|
||||
@@ -405,11 +405,13 @@ int main(int argc, char** argv)
|
||||
server_args.argc = argc;
|
||||
server_args.argv = argv;
|
||||
|
||||
wolfSSL_Init();
|
||||
ChangeToWolfRoot();
|
||||
|
||||
wolfcrypt_test(&server_args);
|
||||
if (server_args.return_code != 0) return server_args.return_code;
|
||||
|
||||
wolfSSL_Cleanup();
|
||||
printf("\nAll tests passed!\n");
|
||||
|
||||
EXIT_TEST(EXIT_SUCCESS);
|
||||
|
@@ -7,6 +7,9 @@ library and the example applications.
|
||||
Also read TI-RTOS Getting Started Guide and TI-RTOS User Guide to learn more
|
||||
about TI-RTOS (http://www.ti.com/tool/ti-rtos).
|
||||
|
||||
For more information see:
|
||||
(https://github.com/wolfSSL/wolfssl-examples/blob/master/tirtos_ccs_examples/README.md)
|
||||
|
||||
## Example Application
|
||||
|
||||
A simple "TCP echo server with TLS" example application is provided with TI-RTOS
|
||||
|
@@ -41,6 +41,7 @@ var wolfSSLObjList = [
|
||||
"wolfcrypt/src/sha512.c",
|
||||
"wolfcrypt/src/tfm.c",
|
||||
"wolfcrypt/src/wc_port.c",
|
||||
"wolfcrypt/src/wolfmath.c",
|
||||
|
||||
"src/internal.c",
|
||||
"src/io.c",
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -28,7 +28,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int benchmark_test(void* args);
|
||||
#ifdef HAVE_STACK_SIZE
|
||||
THREAD_RETURN WOLFSSL_THREAD benchmark_test(void* args);
|
||||
#else
|
||||
int benchmark_test(void *args);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
1196
wolfcrypt/src/aes.c
Normal file → Executable file
1196
wolfcrypt/src/aes.c
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
@@ -32,12 +32,14 @@
|
||||
#include <wolfssl/wolfcrypt/arc4.h>
|
||||
|
||||
|
||||
void wc_Arc4SetKey(Arc4* arc4, const byte* key, word32 length)
|
||||
int wc_Arc4SetKey(Arc4* arc4, const byte* key, word32 length)
|
||||
{
|
||||
int ret = 0;
|
||||
word32 i;
|
||||
word32 keyIndex = 0, stateIndex = 0;
|
||||
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(HAVE_CAVIUM) && !defined(HAVE_CAVIUM_V)
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_ARC4) && \
|
||||
defined(HAVE_CAVIUM) && !defined(HAVE_CAVIUM_V)
|
||||
if (arc4->asyncDev.marker == WOLFSSL_ASYNC_MARKER_ARC4) {
|
||||
return NitroxArc4SetKey(arc4, key, length);
|
||||
}
|
||||
@@ -59,6 +61,8 @@ void wc_Arc4SetKey(Arc4* arc4, const byte* key, word32 length)
|
||||
if (++keyIndex >= length)
|
||||
keyIndex = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,12 +80,14 @@ static INLINE byte MakeByte(word32* x, word32* y, byte* s)
|
||||
}
|
||||
|
||||
|
||||
void wc_Arc4Process(Arc4* arc4, byte* out, const byte* in, word32 length)
|
||||
int wc_Arc4Process(Arc4* arc4, byte* out, const byte* in, word32 length)
|
||||
{
|
||||
int ret = 0;
|
||||
word32 x;
|
||||
word32 y;
|
||||
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(HAVE_CAVIUM) && !defined(HAVE_CAVIUM_V)
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_ARC4) && \
|
||||
defined(HAVE_CAVIUM) && !defined(HAVE_CAVIUM_V)
|
||||
if (arc4->asyncDev.marker == WOLFSSL_ASYNC_MARKER_ARC4) {
|
||||
return NitroxArc4Process(arc4, out, in, length);
|
||||
}
|
||||
@@ -95,31 +101,41 @@ void wc_Arc4Process(Arc4* arc4, byte* out, const byte* in, word32 length)
|
||||
|
||||
arc4->x = (byte)x;
|
||||
arc4->y = (byte)y;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
|
||||
/* Initialize Arc4 for use with Nitrox device */
|
||||
int wc_Arc4AsyncInit(Arc4* arc4, int devId)
|
||||
/* Initialize Arc4 for use with async device */
|
||||
int wc_Arc4Init(Arc4* arc4, void* heap, int devId)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (arc4 == NULL)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
return wolfAsync_DevCtxInit(&arc4->asyncDev, WOLFSSL_ASYNC_MARKER_ARC4, devId);
|
||||
arc4->heap = heap;
|
||||
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_ARC4)
|
||||
ret = wolfAsync_DevCtxInit(&arc4->asyncDev, WOLFSSL_ASYNC_MARKER_ARC4,
|
||||
arc4->heap, devId);
|
||||
#else
|
||||
(void)devId;
|
||||
#endif /* WOLFSSL_ASYNC_CRYPT */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* Free Arc4 from use with Nitrox device */
|
||||
void wc_Arc4AsyncFree(Arc4* arc4)
|
||||
/* Free Arc4 from use with async device */
|
||||
void wc_Arc4Free(Arc4* arc4)
|
||||
{
|
||||
if (arc4 == NULL)
|
||||
return;
|
||||
|
||||
wolfAsync_DevCtxFree(&arc4->asyncDev);
|
||||
}
|
||||
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_ARC4)
|
||||
wolfAsync_DevCtxFree(&arc4->asyncDev, WOLFSSL_ASYNC_MARKER_ARC4);
|
||||
#endif /* WOLFSSL_ASYNC_CRYPT */
|
||||
}
|
||||
|
||||
#endif /* NO_RC4 */
|
||||
|
||||
|
3727
wolfcrypt/src/asn.c
Executable file → Normal file
3727
wolfcrypt/src/asn.c
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
@@ -126,6 +126,7 @@ int blake2b_init( blake2b_state *S, const byte outlen )
|
||||
|
||||
if ( ( !outlen ) || ( outlen > BLAKE2B_OUTBYTES ) ) return -1;
|
||||
|
||||
#ifdef WOLFSSL_BLAKE2B_INIT_EACH_FIELD
|
||||
P->digest_length = outlen;
|
||||
P->key_length = 0;
|
||||
P->fanout = 1;
|
||||
@@ -137,6 +138,12 @@ int blake2b_init( blake2b_state *S, const byte outlen )
|
||||
XMEMSET( P->reserved, 0, sizeof( P->reserved ) );
|
||||
XMEMSET( P->salt, 0, sizeof( P->salt ) );
|
||||
XMEMSET( P->personal, 0, sizeof( P->personal ) );
|
||||
#else
|
||||
XMEMSET( P, 0, sizeof( *P ) );
|
||||
P->digest_length = outlen;
|
||||
P->fanout = 1;
|
||||
P->depth = 1;
|
||||
#endif
|
||||
return blake2b_init_param( S, P );
|
||||
}
|
||||
|
||||
@@ -150,6 +157,7 @@ int blake2b_init_key( blake2b_state *S, const byte outlen, const void *key,
|
||||
|
||||
if ( !key || !keylen || keylen > BLAKE2B_KEYBYTES ) return -1;
|
||||
|
||||
#ifdef WOLFSSL_BLAKE2B_INIT_EACH_FIELD
|
||||
P->digest_length = outlen;
|
||||
P->key_length = keylen;
|
||||
P->fanout = 1;
|
||||
@@ -161,6 +169,13 @@ int blake2b_init_key( blake2b_state *S, const byte outlen, const void *key,
|
||||
XMEMSET( P->reserved, 0, sizeof( P->reserved ) );
|
||||
XMEMSET( P->salt, 0, sizeof( P->salt ) );
|
||||
XMEMSET( P->personal, 0, sizeof( P->personal ) );
|
||||
#else
|
||||
XMEMSET( P, 0, sizeof( *P ) );
|
||||
P->digest_length = outlen;
|
||||
P->key_length = keylen;
|
||||
P->fanout = 1;
|
||||
P->depth = 1;
|
||||
#endif
|
||||
|
||||
if( blake2b_init_param( S, P ) < 0 ) return -1;
|
||||
|
||||
|
@@ -40,17 +40,6 @@
|
||||
#include <wolfssl/wolfcrypt/cmac.h>
|
||||
|
||||
|
||||
#ifndef WOLFSSL_HAVE_MIN
|
||||
#define WOLFSSL_HAVE_MIN
|
||||
|
||||
static INLINE word32 min(word32 a, word32 b)
|
||||
{
|
||||
return a > b ? b : a;
|
||||
}
|
||||
|
||||
#endif /* WOLFSSL_HAVE_MIN */
|
||||
|
||||
|
||||
static void ShiftAndXorRb(byte* out, byte* in)
|
||||
{
|
||||
int i, j, xorRb;
|
||||
|
@@ -347,7 +347,8 @@ int Base64_Encode_NoNl(const byte* in, word32 inLen, byte* out, word32* outLen)
|
||||
#endif /* defined(WOLFSSL_BASE64_ENCODE) */
|
||||
|
||||
|
||||
#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) || defined(HAVE_FIPS)
|
||||
#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) || defined(HAVE_FIPS) \
|
||||
|| defined(HAVE_ECC_CDH)
|
||||
|
||||
static
|
||||
const byte hexDecode[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
|
1598
wolfcrypt/src/des3.c
Normal file → Executable file
1598
wolfcrypt/src/des3.c
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
777
wolfcrypt/src/dh.c
Normal file → Executable file
777
wolfcrypt/src/dh.c
Normal file → Executable file
@@ -30,6 +30,15 @@
|
||||
|
||||
#include <wolfssl/wolfcrypt/dh.h>
|
||||
#include <wolfssl/wolfcrypt/error-crypt.h>
|
||||
#include <wolfssl/wolfcrypt/logging.h>
|
||||
|
||||
#ifdef NO_INLINE
|
||||
#include <wolfssl/wolfcrypt/misc.h>
|
||||
#else
|
||||
#define WOLFSSL_MISC_INCLUDED
|
||||
#include <wolfcrypt/src/misc.c>
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(USER_MATH_LIB) && !defined(WOLFSSL_DH_CONST)
|
||||
#include <math.h>
|
||||
@@ -39,48 +48,502 @@
|
||||
/* user's own math lib */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FFDHE_2048
|
||||
static const byte dh_ffdhe2048_p[] = {
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xAD, 0xF8, 0x54, 0x58, 0xA2, 0xBB, 0x4A, 0x9A,
|
||||
0xAF, 0xDC, 0x56, 0x20, 0x27, 0x3D, 0x3C, 0xF1,
|
||||
0xD8, 0xB9, 0xC5, 0x83, 0xCE, 0x2D, 0x36, 0x95,
|
||||
0xA9, 0xE1, 0x36, 0x41, 0x14, 0x64, 0x33, 0xFB,
|
||||
0xCC, 0x93, 0x9D, 0xCE, 0x24, 0x9B, 0x3E, 0xF9,
|
||||
0x7D, 0x2F, 0xE3, 0x63, 0x63, 0x0C, 0x75, 0xD8,
|
||||
0xF6, 0x81, 0xB2, 0x02, 0xAE, 0xC4, 0x61, 0x7A,
|
||||
0xD3, 0xDF, 0x1E, 0xD5, 0xD5, 0xFD, 0x65, 0x61,
|
||||
0x24, 0x33, 0xF5, 0x1F, 0x5F, 0x06, 0x6E, 0xD0,
|
||||
0x85, 0x63, 0x65, 0x55, 0x3D, 0xED, 0x1A, 0xF3,
|
||||
0xB5, 0x57, 0x13, 0x5E, 0x7F, 0x57, 0xC9, 0x35,
|
||||
0x98, 0x4F, 0x0C, 0x70, 0xE0, 0xE6, 0x8B, 0x77,
|
||||
0xE2, 0xA6, 0x89, 0xDA, 0xF3, 0xEF, 0xE8, 0x72,
|
||||
0x1D, 0xF1, 0x58, 0xA1, 0x36, 0xAD, 0xE7, 0x35,
|
||||
0x30, 0xAC, 0xCA, 0x4F, 0x48, 0x3A, 0x79, 0x7A,
|
||||
0xBC, 0x0A, 0xB1, 0x82, 0xB3, 0x24, 0xFB, 0x61,
|
||||
0xD1, 0x08, 0xA9, 0x4B, 0xB2, 0xC8, 0xE3, 0xFB,
|
||||
0xB9, 0x6A, 0xDA, 0xB7, 0x60, 0xD7, 0xF4, 0x68,
|
||||
0x1D, 0x4F, 0x42, 0xA3, 0xDE, 0x39, 0x4D, 0xF4,
|
||||
0xAE, 0x56, 0xED, 0xE7, 0x63, 0x72, 0xBB, 0x19,
|
||||
0x0B, 0x07, 0xA7, 0xC8, 0xEE, 0x0A, 0x6D, 0x70,
|
||||
0x9E, 0x02, 0xFC, 0xE1, 0xCD, 0xF7, 0xE2, 0xEC,
|
||||
0xC0, 0x34, 0x04, 0xCD, 0x28, 0x34, 0x2F, 0x61,
|
||||
0x91, 0x72, 0xFE, 0x9C, 0xE9, 0x85, 0x83, 0xFF,
|
||||
0x8E, 0x4F, 0x12, 0x32, 0xEE, 0xF2, 0x81, 0x83,
|
||||
0xC3, 0xFE, 0x3B, 0x1B, 0x4C, 0x6F, 0xAD, 0x73,
|
||||
0x3B, 0xB5, 0xFC, 0xBC, 0x2E, 0xC2, 0x20, 0x05,
|
||||
0xC5, 0x8E, 0xF1, 0x83, 0x7D, 0x16, 0x83, 0xB2,
|
||||
0xC6, 0xF3, 0x4A, 0x26, 0xC1, 0xB2, 0xEF, 0xFA,
|
||||
0x88, 0x6B, 0x42, 0x38, 0x61, 0x28, 0x5C, 0x97,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
|
||||
};
|
||||
static const byte dh_ffdhe2048_g[] = { 0x02 };
|
||||
|
||||
#if !defined(WOLFSSL_HAVE_MIN) && !defined(WOLFSSL_DH_CONST)
|
||||
#define WOLFSSL_HAVE_MIN
|
||||
|
||||
static INLINE word32 min(word32 a, word32 b)
|
||||
{
|
||||
return a > b ? b : a;
|
||||
}
|
||||
|
||||
#endif /* WOLFSSL_HAVE_MIN */
|
||||
|
||||
|
||||
void wc_InitDhKey(DhKey* key)
|
||||
const DhParams* wc_Dh_ffdhe2048_Get(void)
|
||||
{
|
||||
(void)key;
|
||||
/* TomsFastMath doesn't use memory allocation */
|
||||
#ifndef USE_FAST_MATH
|
||||
key->p.dp = NULL;
|
||||
key->g.dp = NULL;
|
||||
static const DhParams ffdhe2048 = {
|
||||
dh_ffdhe2048_p, sizeof(dh_ffdhe2048_p),
|
||||
dh_ffdhe2048_g, sizeof(dh_ffdhe2048_g)
|
||||
};
|
||||
return &ffdhe2048;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FFDHE_3072
|
||||
static const byte dh_ffdhe3072_p[] = {
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xAD, 0xF8, 0x54, 0x58, 0xA2, 0xBB, 0x4A, 0x9A,
|
||||
0xAF, 0xDC, 0x56, 0x20, 0x27, 0x3D, 0x3C, 0xF1,
|
||||
0xD8, 0xB9, 0xC5, 0x83, 0xCE, 0x2D, 0x36, 0x95,
|
||||
0xA9, 0xE1, 0x36, 0x41, 0x14, 0x64, 0x33, 0xFB,
|
||||
0xCC, 0x93, 0x9D, 0xCE, 0x24, 0x9B, 0x3E, 0xF9,
|
||||
0x7D, 0x2F, 0xE3, 0x63, 0x63, 0x0C, 0x75, 0xD8,
|
||||
0xF6, 0x81, 0xB2, 0x02, 0xAE, 0xC4, 0x61, 0x7A,
|
||||
0xD3, 0xDF, 0x1E, 0xD5, 0xD5, 0xFD, 0x65, 0x61,
|
||||
0x24, 0x33, 0xF5, 0x1F, 0x5F, 0x06, 0x6E, 0xD0,
|
||||
0x85, 0x63, 0x65, 0x55, 0x3D, 0xED, 0x1A, 0xF3,
|
||||
0xB5, 0x57, 0x13, 0x5E, 0x7F, 0x57, 0xC9, 0x35,
|
||||
0x98, 0x4F, 0x0C, 0x70, 0xE0, 0xE6, 0x8B, 0x77,
|
||||
0xE2, 0xA6, 0x89, 0xDA, 0xF3, 0xEF, 0xE8, 0x72,
|
||||
0x1D, 0xF1, 0x58, 0xA1, 0x36, 0xAD, 0xE7, 0x35,
|
||||
0x30, 0xAC, 0xCA, 0x4F, 0x48, 0x3A, 0x79, 0x7A,
|
||||
0xBC, 0x0A, 0xB1, 0x82, 0xB3, 0x24, 0xFB, 0x61,
|
||||
0xD1, 0x08, 0xA9, 0x4B, 0xB2, 0xC8, 0xE3, 0xFB,
|
||||
0xB9, 0x6A, 0xDA, 0xB7, 0x60, 0xD7, 0xF4, 0x68,
|
||||
0x1D, 0x4F, 0x42, 0xA3, 0xDE, 0x39, 0x4D, 0xF4,
|
||||
0xAE, 0x56, 0xED, 0xE7, 0x63, 0x72, 0xBB, 0x19,
|
||||
0x0B, 0x07, 0xA7, 0xC8, 0xEE, 0x0A, 0x6D, 0x70,
|
||||
0x9E, 0x02, 0xFC, 0xE1, 0xCD, 0xF7, 0xE2, 0xEC,
|
||||
0xC0, 0x34, 0x04, 0xCD, 0x28, 0x34, 0x2F, 0x61,
|
||||
0x91, 0x72, 0xFE, 0x9C, 0xE9, 0x85, 0x83, 0xFF,
|
||||
0x8E, 0x4F, 0x12, 0x32, 0xEE, 0xF2, 0x81, 0x83,
|
||||
0xC3, 0xFE, 0x3B, 0x1B, 0x4C, 0x6F, 0xAD, 0x73,
|
||||
0x3B, 0xB5, 0xFC, 0xBC, 0x2E, 0xC2, 0x20, 0x05,
|
||||
0xC5, 0x8E, 0xF1, 0x83, 0x7D, 0x16, 0x83, 0xB2,
|
||||
0xC6, 0xF3, 0x4A, 0x26, 0xC1, 0xB2, 0xEF, 0xFA,
|
||||
0x88, 0x6B, 0x42, 0x38, 0x61, 0x1F, 0xCF, 0xDC,
|
||||
0xDE, 0x35, 0x5B, 0x3B, 0x65, 0x19, 0x03, 0x5B,
|
||||
0xBC, 0x34, 0xF4, 0xDE, 0xF9, 0x9C, 0x02, 0x38,
|
||||
0x61, 0xB4, 0x6F, 0xC9, 0xD6, 0xE6, 0xC9, 0x07,
|
||||
0x7A, 0xD9, 0x1D, 0x26, 0x91, 0xF7, 0xF7, 0xEE,
|
||||
0x59, 0x8C, 0xB0, 0xFA, 0xC1, 0x86, 0xD9, 0x1C,
|
||||
0xAE, 0xFE, 0x13, 0x09, 0x85, 0x13, 0x92, 0x70,
|
||||
0xB4, 0x13, 0x0C, 0x93, 0xBC, 0x43, 0x79, 0x44,
|
||||
0xF4, 0xFD, 0x44, 0x52, 0xE2, 0xD7, 0x4D, 0xD3,
|
||||
0x64, 0xF2, 0xE2, 0x1E, 0x71, 0xF5, 0x4B, 0xFF,
|
||||
0x5C, 0xAE, 0x82, 0xAB, 0x9C, 0x9D, 0xF6, 0x9E,
|
||||
0xE8, 0x6D, 0x2B, 0xC5, 0x22, 0x36, 0x3A, 0x0D,
|
||||
0xAB, 0xC5, 0x21, 0x97, 0x9B, 0x0D, 0xEA, 0xDA,
|
||||
0x1D, 0xBF, 0x9A, 0x42, 0xD5, 0xC4, 0x48, 0x4E,
|
||||
0x0A, 0xBC, 0xD0, 0x6B, 0xFA, 0x53, 0xDD, 0xEF,
|
||||
0x3C, 0x1B, 0x20, 0xEE, 0x3F, 0xD5, 0x9D, 0x7C,
|
||||
0x25, 0xE4, 0x1D, 0x2B, 0x66, 0xC6, 0x2E, 0x37,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
|
||||
};
|
||||
static const byte dh_ffdhe3072_g[] = { 0x02 };
|
||||
|
||||
const DhParams* wc_Dh_ffdhe3072_Get(void)
|
||||
{
|
||||
static const DhParams ffdhe3072 = {
|
||||
dh_ffdhe3072_p, sizeof(dh_ffdhe3072_p),
|
||||
dh_ffdhe3072_g, sizeof(dh_ffdhe3072_g)
|
||||
};
|
||||
return &ffdhe3072;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FFDHE_4096
|
||||
static const byte dh_ffdhe4096_p[] = {
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xAD, 0xF8, 0x54, 0x58, 0xA2, 0xBB, 0x4A, 0x9A,
|
||||
0xAF, 0xDC, 0x56, 0x20, 0x27, 0x3D, 0x3C, 0xF1,
|
||||
0xD8, 0xB9, 0xC5, 0x83, 0xCE, 0x2D, 0x36, 0x95,
|
||||
0xA9, 0xE1, 0x36, 0x41, 0x14, 0x64, 0x33, 0xFB,
|
||||
0xCC, 0x93, 0x9D, 0xCE, 0x24, 0x9B, 0x3E, 0xF9,
|
||||
0x7D, 0x2F, 0xE3, 0x63, 0x63, 0x0C, 0x75, 0xD8,
|
||||
0xF6, 0x81, 0xB2, 0x02, 0xAE, 0xC4, 0x61, 0x7A,
|
||||
0xD3, 0xDF, 0x1E, 0xD5, 0xD5, 0xFD, 0x65, 0x61,
|
||||
0x24, 0x33, 0xF5, 0x1F, 0x5F, 0x06, 0x6E, 0xD0,
|
||||
0x85, 0x63, 0x65, 0x55, 0x3D, 0xED, 0x1A, 0xF3,
|
||||
0xB5, 0x57, 0x13, 0x5E, 0x7F, 0x57, 0xC9, 0x35,
|
||||
0x98, 0x4F, 0x0C, 0x70, 0xE0, 0xE6, 0x8B, 0x77,
|
||||
0xE2, 0xA6, 0x89, 0xDA, 0xF3, 0xEF, 0xE8, 0x72,
|
||||
0x1D, 0xF1, 0x58, 0xA1, 0x36, 0xAD, 0xE7, 0x35,
|
||||
0x30, 0xAC, 0xCA, 0x4F, 0x48, 0x3A, 0x79, 0x7A,
|
||||
0xBC, 0x0A, 0xB1, 0x82, 0xB3, 0x24, 0xFB, 0x61,
|
||||
0xD1, 0x08, 0xA9, 0x4B, 0xB2, 0xC8, 0xE3, 0xFB,
|
||||
0xB9, 0x6A, 0xDA, 0xB7, 0x60, 0xD7, 0xF4, 0x68,
|
||||
0x1D, 0x4F, 0x42, 0xA3, 0xDE, 0x39, 0x4D, 0xF4,
|
||||
0xAE, 0x56, 0xED, 0xE7, 0x63, 0x72, 0xBB, 0x19,
|
||||
0x0B, 0x07, 0xA7, 0xC8, 0xEE, 0x0A, 0x6D, 0x70,
|
||||
0x9E, 0x02, 0xFC, 0xE1, 0xCD, 0xF7, 0xE2, 0xEC,
|
||||
0xC0, 0x34, 0x04, 0xCD, 0x28, 0x34, 0x2F, 0x61,
|
||||
0x91, 0x72, 0xFE, 0x9C, 0xE9, 0x85, 0x83, 0xFF,
|
||||
0x8E, 0x4F, 0x12, 0x32, 0xEE, 0xF2, 0x81, 0x83,
|
||||
0xC3, 0xFE, 0x3B, 0x1B, 0x4C, 0x6F, 0xAD, 0x73,
|
||||
0x3B, 0xB5, 0xFC, 0xBC, 0x2E, 0xC2, 0x20, 0x05,
|
||||
0xC5, 0x8E, 0xF1, 0x83, 0x7D, 0x16, 0x83, 0xB2,
|
||||
0xC6, 0xF3, 0x4A, 0x26, 0xC1, 0xB2, 0xEF, 0xFA,
|
||||
0x88, 0x6B, 0x42, 0x38, 0x61, 0x1F, 0xCF, 0xDC,
|
||||
0xDE, 0x35, 0x5B, 0x3B, 0x65, 0x19, 0x03, 0x5B,
|
||||
0xBC, 0x34, 0xF4, 0xDE, 0xF9, 0x9C, 0x02, 0x38,
|
||||
0x61, 0xB4, 0x6F, 0xC9, 0xD6, 0xE6, 0xC9, 0x07,
|
||||
0x7A, 0xD9, 0x1D, 0x26, 0x91, 0xF7, 0xF7, 0xEE,
|
||||
0x59, 0x8C, 0xB0, 0xFA, 0xC1, 0x86, 0xD9, 0x1C,
|
||||
0xAE, 0xFE, 0x13, 0x09, 0x85, 0x13, 0x92, 0x70,
|
||||
0xB4, 0x13, 0x0C, 0x93, 0xBC, 0x43, 0x79, 0x44,
|
||||
0xF4, 0xFD, 0x44, 0x52, 0xE2, 0xD7, 0x4D, 0xD3,
|
||||
0x64, 0xF2, 0xE2, 0x1E, 0x71, 0xF5, 0x4B, 0xFF,
|
||||
0x5C, 0xAE, 0x82, 0xAB, 0x9C, 0x9D, 0xF6, 0x9E,
|
||||
0xE8, 0x6D, 0x2B, 0xC5, 0x22, 0x36, 0x3A, 0x0D,
|
||||
0xAB, 0xC5, 0x21, 0x97, 0x9B, 0x0D, 0xEA, 0xDA,
|
||||
0x1D, 0xBF, 0x9A, 0x42, 0xD5, 0xC4, 0x48, 0x4E,
|
||||
0x0A, 0xBC, 0xD0, 0x6B, 0xFA, 0x53, 0xDD, 0xEF,
|
||||
0x3C, 0x1B, 0x20, 0xEE, 0x3F, 0xD5, 0x9D, 0x7C,
|
||||
0x25, 0xE4, 0x1D, 0x2B, 0x66, 0x9E, 0x1E, 0xF1,
|
||||
0x6E, 0x6F, 0x52, 0xC3, 0x16, 0x4D, 0xF4, 0xFB,
|
||||
0x79, 0x30, 0xE9, 0xE4, 0xE5, 0x88, 0x57, 0xB6,
|
||||
0xAC, 0x7D, 0x5F, 0x42, 0xD6, 0x9F, 0x6D, 0x18,
|
||||
0x77, 0x63, 0xCF, 0x1D, 0x55, 0x03, 0x40, 0x04,
|
||||
0x87, 0xF5, 0x5B, 0xA5, 0x7E, 0x31, 0xCC, 0x7A,
|
||||
0x71, 0x35, 0xC8, 0x86, 0xEF, 0xB4, 0x31, 0x8A,
|
||||
0xED, 0x6A, 0x1E, 0x01, 0x2D, 0x9E, 0x68, 0x32,
|
||||
0xA9, 0x07, 0x60, 0x0A, 0x91, 0x81, 0x30, 0xC4,
|
||||
0x6D, 0xC7, 0x78, 0xF9, 0x71, 0xAD, 0x00, 0x38,
|
||||
0x09, 0x29, 0x99, 0xA3, 0x33, 0xCB, 0x8B, 0x7A,
|
||||
0x1A, 0x1D, 0xB9, 0x3D, 0x71, 0x40, 0x00, 0x3C,
|
||||
0x2A, 0x4E, 0xCE, 0xA9, 0xF9, 0x8D, 0x0A, 0xCC,
|
||||
0x0A, 0x82, 0x91, 0xCD, 0xCE, 0xC9, 0x7D, 0xCF,
|
||||
0x8E, 0xC9, 0xB5, 0x5A, 0x7F, 0x88, 0xA4, 0x6B,
|
||||
0x4D, 0xB5, 0xA8, 0x51, 0xF4, 0x41, 0x82, 0xE1,
|
||||
0xC6, 0x8A, 0x00, 0x7E, 0x5E, 0x65, 0x5F, 0x6A,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
|
||||
};
|
||||
static const byte dh_ffdhe4096_g[] = { 0x02 };
|
||||
|
||||
const DhParams* wc_Dh_ffdhe4096_Get(void)
|
||||
{
|
||||
static const DhParams ffdhe4096 = {
|
||||
dh_ffdhe4096_p, sizeof(dh_ffdhe4096_p),
|
||||
dh_ffdhe4096_g, sizeof(dh_ffdhe4096_g)
|
||||
};
|
||||
return &ffdhe4096;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FFDHE_6144
|
||||
static const byte dh_ffdhe6144_p[] = {
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xAD, 0xF8, 0x54, 0x58, 0xA2, 0xBB, 0x4A, 0x9A,
|
||||
0xAF, 0xDC, 0x56, 0x20, 0x27, 0x3D, 0x3C, 0xF1,
|
||||
0xD8, 0xB9, 0xC5, 0x83, 0xCE, 0x2D, 0x36, 0x95,
|
||||
0xA9, 0xE1, 0x36, 0x41, 0x14, 0x64, 0x33, 0xFB,
|
||||
0xCC, 0x93, 0x9D, 0xCE, 0x24, 0x9B, 0x3E, 0xF9,
|
||||
0x7D, 0x2F, 0xE3, 0x63, 0x63, 0x0C, 0x75, 0xD8,
|
||||
0xF6, 0x81, 0xB2, 0x02, 0xAE, 0xC4, 0x61, 0x7A,
|
||||
0xD3, 0xDF, 0x1E, 0xD5, 0xD5, 0xFD, 0x65, 0x61,
|
||||
0x24, 0x33, 0xF5, 0x1F, 0x5F, 0x06, 0x6E, 0xD0,
|
||||
0x85, 0x63, 0x65, 0x55, 0x3D, 0xED, 0x1A, 0xF3,
|
||||
0xB5, 0x57, 0x13, 0x5E, 0x7F, 0x57, 0xC9, 0x35,
|
||||
0x98, 0x4F, 0x0C, 0x70, 0xE0, 0xE6, 0x8B, 0x77,
|
||||
0xE2, 0xA6, 0x89, 0xDA, 0xF3, 0xEF, 0xE8, 0x72,
|
||||
0x1D, 0xF1, 0x58, 0xA1, 0x36, 0xAD, 0xE7, 0x35,
|
||||
0x30, 0xAC, 0xCA, 0x4F, 0x48, 0x3A, 0x79, 0x7A,
|
||||
0xBC, 0x0A, 0xB1, 0x82, 0xB3, 0x24, 0xFB, 0x61,
|
||||
0xD1, 0x08, 0xA9, 0x4B, 0xB2, 0xC8, 0xE3, 0xFB,
|
||||
0xB9, 0x6A, 0xDA, 0xB7, 0x60, 0xD7, 0xF4, 0x68,
|
||||
0x1D, 0x4F, 0x42, 0xA3, 0xDE, 0x39, 0x4D, 0xF4,
|
||||
0xAE, 0x56, 0xED, 0xE7, 0x63, 0x72, 0xBB, 0x19,
|
||||
0x0B, 0x07, 0xA7, 0xC8, 0xEE, 0x0A, 0x6D, 0x70,
|
||||
0x9E, 0x02, 0xFC, 0xE1, 0xCD, 0xF7, 0xE2, 0xEC,
|
||||
0xC0, 0x34, 0x04, 0xCD, 0x28, 0x34, 0x2F, 0x61,
|
||||
0x91, 0x72, 0xFE, 0x9C, 0xE9, 0x85, 0x83, 0xFF,
|
||||
0x8E, 0x4F, 0x12, 0x32, 0xEE, 0xF2, 0x81, 0x83,
|
||||
0xC3, 0xFE, 0x3B, 0x1B, 0x4C, 0x6F, 0xAD, 0x73,
|
||||
0x3B, 0xB5, 0xFC, 0xBC, 0x2E, 0xC2, 0x20, 0x05,
|
||||
0xC5, 0x8E, 0xF1, 0x83, 0x7D, 0x16, 0x83, 0xB2,
|
||||
0xC6, 0xF3, 0x4A, 0x26, 0xC1, 0xB2, 0xEF, 0xFA,
|
||||
0x88, 0x6B, 0x42, 0x38, 0x61, 0x1F, 0xCF, 0xDC,
|
||||
0xDE, 0x35, 0x5B, 0x3B, 0x65, 0x19, 0x03, 0x5B,
|
||||
0xBC, 0x34, 0xF4, 0xDE, 0xF9, 0x9C, 0x02, 0x38,
|
||||
0x61, 0xB4, 0x6F, 0xC9, 0xD6, 0xE6, 0xC9, 0x07,
|
||||
0x7A, 0xD9, 0x1D, 0x26, 0x91, 0xF7, 0xF7, 0xEE,
|
||||
0x59, 0x8C, 0xB0, 0xFA, 0xC1, 0x86, 0xD9, 0x1C,
|
||||
0xAE, 0xFE, 0x13, 0x09, 0x85, 0x13, 0x92, 0x70,
|
||||
0xB4, 0x13, 0x0C, 0x93, 0xBC, 0x43, 0x79, 0x44,
|
||||
0xF4, 0xFD, 0x44, 0x52, 0xE2, 0xD7, 0x4D, 0xD3,
|
||||
0x64, 0xF2, 0xE2, 0x1E, 0x71, 0xF5, 0x4B, 0xFF,
|
||||
0x5C, 0xAE, 0x82, 0xAB, 0x9C, 0x9D, 0xF6, 0x9E,
|
||||
0xE8, 0x6D, 0x2B, 0xC5, 0x22, 0x36, 0x3A, 0x0D,
|
||||
0xAB, 0xC5, 0x21, 0x97, 0x9B, 0x0D, 0xEA, 0xDA,
|
||||
0x1D, 0xBF, 0x9A, 0x42, 0xD5, 0xC4, 0x48, 0x4E,
|
||||
0x0A, 0xBC, 0xD0, 0x6B, 0xFA, 0x53, 0xDD, 0xEF,
|
||||
0x3C, 0x1B, 0x20, 0xEE, 0x3F, 0xD5, 0x9D, 0x7C,
|
||||
0x25, 0xE4, 0x1D, 0x2B, 0x66, 0x9E, 0x1E, 0xF1,
|
||||
0x6E, 0x6F, 0x52, 0xC3, 0x16, 0x4D, 0xF4, 0xFB,
|
||||
0x79, 0x30, 0xE9, 0xE4, 0xE5, 0x88, 0x57, 0xB6,
|
||||
0xAC, 0x7D, 0x5F, 0x42, 0xD6, 0x9F, 0x6D, 0x18,
|
||||
0x77, 0x63, 0xCF, 0x1D, 0x55, 0x03, 0x40, 0x04,
|
||||
0x87, 0xF5, 0x5B, 0xA5, 0x7E, 0x31, 0xCC, 0x7A,
|
||||
0x71, 0x35, 0xC8, 0x86, 0xEF, 0xB4, 0x31, 0x8A,
|
||||
0xED, 0x6A, 0x1E, 0x01, 0x2D, 0x9E, 0x68, 0x32,
|
||||
0xA9, 0x07, 0x60, 0x0A, 0x91, 0x81, 0x30, 0xC4,
|
||||
0x6D, 0xC7, 0x78, 0xF9, 0x71, 0xAD, 0x00, 0x38,
|
||||
0x09, 0x29, 0x99, 0xA3, 0x33, 0xCB, 0x8B, 0x7A,
|
||||
0x1A, 0x1D, 0xB9, 0x3D, 0x71, 0x40, 0x00, 0x3C,
|
||||
0x2A, 0x4E, 0xCE, 0xA9, 0xF9, 0x8D, 0x0A, 0xCC,
|
||||
0x0A, 0x82, 0x91, 0xCD, 0xCE, 0xC9, 0x7D, 0xCF,
|
||||
0x8E, 0xC9, 0xB5, 0x5A, 0x7F, 0x88, 0xA4, 0x6B,
|
||||
0x4D, 0xB5, 0xA8, 0x51, 0xF4, 0x41, 0x82, 0xE1,
|
||||
0xC6, 0x8A, 0x00, 0x7E, 0x5E, 0x0D, 0xD9, 0x02,
|
||||
0x0B, 0xFD, 0x64, 0xB6, 0x45, 0x03, 0x6C, 0x7A,
|
||||
0x4E, 0x67, 0x7D, 0x2C, 0x38, 0x53, 0x2A, 0x3A,
|
||||
0x23, 0xBA, 0x44, 0x42, 0xCA, 0xF5, 0x3E, 0xA6,
|
||||
0x3B, 0xB4, 0x54, 0x32, 0x9B, 0x76, 0x24, 0xC8,
|
||||
0x91, 0x7B, 0xDD, 0x64, 0xB1, 0xC0, 0xFD, 0x4C,
|
||||
0xB3, 0x8E, 0x8C, 0x33, 0x4C, 0x70, 0x1C, 0x3A,
|
||||
0xCD, 0xAD, 0x06, 0x57, 0xFC, 0xCF, 0xEC, 0x71,
|
||||
0x9B, 0x1F, 0x5C, 0x3E, 0x4E, 0x46, 0x04, 0x1F,
|
||||
0x38, 0x81, 0x47, 0xFB, 0x4C, 0xFD, 0xB4, 0x77,
|
||||
0xA5, 0x24, 0x71, 0xF7, 0xA9, 0xA9, 0x69, 0x10,
|
||||
0xB8, 0x55, 0x32, 0x2E, 0xDB, 0x63, 0x40, 0xD8,
|
||||
0xA0, 0x0E, 0xF0, 0x92, 0x35, 0x05, 0x11, 0xE3,
|
||||
0x0A, 0xBE, 0xC1, 0xFF, 0xF9, 0xE3, 0xA2, 0x6E,
|
||||
0x7F, 0xB2, 0x9F, 0x8C, 0x18, 0x30, 0x23, 0xC3,
|
||||
0x58, 0x7E, 0x38, 0xDA, 0x00, 0x77, 0xD9, 0xB4,
|
||||
0x76, 0x3E, 0x4E, 0x4B, 0x94, 0xB2, 0xBB, 0xC1,
|
||||
0x94, 0xC6, 0x65, 0x1E, 0x77, 0xCA, 0xF9, 0x92,
|
||||
0xEE, 0xAA, 0xC0, 0x23, 0x2A, 0x28, 0x1B, 0xF6,
|
||||
0xB3, 0xA7, 0x39, 0xC1, 0x22, 0x61, 0x16, 0x82,
|
||||
0x0A, 0xE8, 0xDB, 0x58, 0x47, 0xA6, 0x7C, 0xBE,
|
||||
0xF9, 0xC9, 0x09, 0x1B, 0x46, 0x2D, 0x53, 0x8C,
|
||||
0xD7, 0x2B, 0x03, 0x74, 0x6A, 0xE7, 0x7F, 0x5E,
|
||||
0x62, 0x29, 0x2C, 0x31, 0x15, 0x62, 0xA8, 0x46,
|
||||
0x50, 0x5D, 0xC8, 0x2D, 0xB8, 0x54, 0x33, 0x8A,
|
||||
0xE4, 0x9F, 0x52, 0x35, 0xC9, 0x5B, 0x91, 0x17,
|
||||
0x8C, 0xCF, 0x2D, 0xD5, 0xCA, 0xCE, 0xF4, 0x03,
|
||||
0xEC, 0x9D, 0x18, 0x10, 0xC6, 0x27, 0x2B, 0x04,
|
||||
0x5B, 0x3B, 0x71, 0xF9, 0xDC, 0x6B, 0x80, 0xD6,
|
||||
0x3F, 0xDD, 0x4A, 0x8E, 0x9A, 0xDB, 0x1E, 0x69,
|
||||
0x62, 0xA6, 0x95, 0x26, 0xD4, 0x31, 0x61, 0xC1,
|
||||
0xA4, 0x1D, 0x57, 0x0D, 0x79, 0x38, 0xDA, 0xD4,
|
||||
0xA4, 0x0E, 0x32, 0x9C, 0xD0, 0xE4, 0x0E, 0x65,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
|
||||
};
|
||||
static const byte dh_ffdhe6144_g[] = { 0x02 };
|
||||
|
||||
const DhParams* wc_Dh_ffdhe6144_Get(void)
|
||||
{
|
||||
static const DhParams ffdhe6144 = {
|
||||
dh_ffdhe6144_p, sizeof(dh_ffdhe6144_p),
|
||||
dh_ffdhe6144_g, sizeof(dh_ffdhe6144_g)
|
||||
};
|
||||
return &ffdhe6144;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FFDHE_8192
|
||||
static const byte dh_ffdhe8192_p[] = {
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xAD, 0xF8, 0x54, 0x58, 0xA2, 0xBB, 0x4A, 0x9A,
|
||||
0xAF, 0xDC, 0x56, 0x20, 0x27, 0x3D, 0x3C, 0xF1,
|
||||
0xD8, 0xB9, 0xC5, 0x83, 0xCE, 0x2D, 0x36, 0x95,
|
||||
0xA9, 0xE1, 0x36, 0x41, 0x14, 0x64, 0x33, 0xFB,
|
||||
0xCC, 0x93, 0x9D, 0xCE, 0x24, 0x9B, 0x3E, 0xF9,
|
||||
0x7D, 0x2F, 0xE3, 0x63, 0x63, 0x0C, 0x75, 0xD8,
|
||||
0xF6, 0x81, 0xB2, 0x02, 0xAE, 0xC4, 0x61, 0x7A,
|
||||
0xD3, 0xDF, 0x1E, 0xD5, 0xD5, 0xFD, 0x65, 0x61,
|
||||
0x24, 0x33, 0xF5, 0x1F, 0x5F, 0x06, 0x6E, 0xD0,
|
||||
0x85, 0x63, 0x65, 0x55, 0x3D, 0xED, 0x1A, 0xF3,
|
||||
0xB5, 0x57, 0x13, 0x5E, 0x7F, 0x57, 0xC9, 0x35,
|
||||
0x98, 0x4F, 0x0C, 0x70, 0xE0, 0xE6, 0x8B, 0x77,
|
||||
0xE2, 0xA6, 0x89, 0xDA, 0xF3, 0xEF, 0xE8, 0x72,
|
||||
0x1D, 0xF1, 0x58, 0xA1, 0x36, 0xAD, 0xE7, 0x35,
|
||||
0x30, 0xAC, 0xCA, 0x4F, 0x48, 0x3A, 0x79, 0x7A,
|
||||
0xBC, 0x0A, 0xB1, 0x82, 0xB3, 0x24, 0xFB, 0x61,
|
||||
0xD1, 0x08, 0xA9, 0x4B, 0xB2, 0xC8, 0xE3, 0xFB,
|
||||
0xB9, 0x6A, 0xDA, 0xB7, 0x60, 0xD7, 0xF4, 0x68,
|
||||
0x1D, 0x4F, 0x42, 0xA3, 0xDE, 0x39, 0x4D, 0xF4,
|
||||
0xAE, 0x56, 0xED, 0xE7, 0x63, 0x72, 0xBB, 0x19,
|
||||
0x0B, 0x07, 0xA7, 0xC8, 0xEE, 0x0A, 0x6D, 0x70,
|
||||
0x9E, 0x02, 0xFC, 0xE1, 0xCD, 0xF7, 0xE2, 0xEC,
|
||||
0xC0, 0x34, 0x04, 0xCD, 0x28, 0x34, 0x2F, 0x61,
|
||||
0x91, 0x72, 0xFE, 0x9C, 0xE9, 0x85, 0x83, 0xFF,
|
||||
0x8E, 0x4F, 0x12, 0x32, 0xEE, 0xF2, 0x81, 0x83,
|
||||
0xC3, 0xFE, 0x3B, 0x1B, 0x4C, 0x6F, 0xAD, 0x73,
|
||||
0x3B, 0xB5, 0xFC, 0xBC, 0x2E, 0xC2, 0x20, 0x05,
|
||||
0xC5, 0x8E, 0xF1, 0x83, 0x7D, 0x16, 0x83, 0xB2,
|
||||
0xC6, 0xF3, 0x4A, 0x26, 0xC1, 0xB2, 0xEF, 0xFA,
|
||||
0x88, 0x6B, 0x42, 0x38, 0x61, 0x1F, 0xCF, 0xDC,
|
||||
0xDE, 0x35, 0x5B, 0x3B, 0x65, 0x19, 0x03, 0x5B,
|
||||
0xBC, 0x34, 0xF4, 0xDE, 0xF9, 0x9C, 0x02, 0x38,
|
||||
0x61, 0xB4, 0x6F, 0xC9, 0xD6, 0xE6, 0xC9, 0x07,
|
||||
0x7A, 0xD9, 0x1D, 0x26, 0x91, 0xF7, 0xF7, 0xEE,
|
||||
0x59, 0x8C, 0xB0, 0xFA, 0xC1, 0x86, 0xD9, 0x1C,
|
||||
0xAE, 0xFE, 0x13, 0x09, 0x85, 0x13, 0x92, 0x70,
|
||||
0xB4, 0x13, 0x0C, 0x93, 0xBC, 0x43, 0x79, 0x44,
|
||||
0xF4, 0xFD, 0x44, 0x52, 0xE2, 0xD7, 0x4D, 0xD3,
|
||||
0x64, 0xF2, 0xE2, 0x1E, 0x71, 0xF5, 0x4B, 0xFF,
|
||||
0x5C, 0xAE, 0x82, 0xAB, 0x9C, 0x9D, 0xF6, 0x9E,
|
||||
0xE8, 0x6D, 0x2B, 0xC5, 0x22, 0x36, 0x3A, 0x0D,
|
||||
0xAB, 0xC5, 0x21, 0x97, 0x9B, 0x0D, 0xEA, 0xDA,
|
||||
0x1D, 0xBF, 0x9A, 0x42, 0xD5, 0xC4, 0x48, 0x4E,
|
||||
0x0A, 0xBC, 0xD0, 0x6B, 0xFA, 0x53, 0xDD, 0xEF,
|
||||
0x3C, 0x1B, 0x20, 0xEE, 0x3F, 0xD5, 0x9D, 0x7C,
|
||||
0x25, 0xE4, 0x1D, 0x2B, 0x66, 0x9E, 0x1E, 0xF1,
|
||||
0x6E, 0x6F, 0x52, 0xC3, 0x16, 0x4D, 0xF4, 0xFB,
|
||||
0x79, 0x30, 0xE9, 0xE4, 0xE5, 0x88, 0x57, 0xB6,
|
||||
0xAC, 0x7D, 0x5F, 0x42, 0xD6, 0x9F, 0x6D, 0x18,
|
||||
0x77, 0x63, 0xCF, 0x1D, 0x55, 0x03, 0x40, 0x04,
|
||||
0x87, 0xF5, 0x5B, 0xA5, 0x7E, 0x31, 0xCC, 0x7A,
|
||||
0x71, 0x35, 0xC8, 0x86, 0xEF, 0xB4, 0x31, 0x8A,
|
||||
0xED, 0x6A, 0x1E, 0x01, 0x2D, 0x9E, 0x68, 0x32,
|
||||
0xA9, 0x07, 0x60, 0x0A, 0x91, 0x81, 0x30, 0xC4,
|
||||
0x6D, 0xC7, 0x78, 0xF9, 0x71, 0xAD, 0x00, 0x38,
|
||||
0x09, 0x29, 0x99, 0xA3, 0x33, 0xCB, 0x8B, 0x7A,
|
||||
0x1A, 0x1D, 0xB9, 0x3D, 0x71, 0x40, 0x00, 0x3C,
|
||||
0x2A, 0x4E, 0xCE, 0xA9, 0xF9, 0x8D, 0x0A, 0xCC,
|
||||
0x0A, 0x82, 0x91, 0xCD, 0xCE, 0xC9, 0x7D, 0xCF,
|
||||
0x8E, 0xC9, 0xB5, 0x5A, 0x7F, 0x88, 0xA4, 0x6B,
|
||||
0x4D, 0xB5, 0xA8, 0x51, 0xF4, 0x41, 0x82, 0xE1,
|
||||
0xC6, 0x8A, 0x00, 0x7E, 0x5E, 0x0D, 0xD9, 0x02,
|
||||
0x0B, 0xFD, 0x64, 0xB6, 0x45, 0x03, 0x6C, 0x7A,
|
||||
0x4E, 0x67, 0x7D, 0x2C, 0x38, 0x53, 0x2A, 0x3A,
|
||||
0x23, 0xBA, 0x44, 0x42, 0xCA, 0xF5, 0x3E, 0xA6,
|
||||
0x3B, 0xB4, 0x54, 0x32, 0x9B, 0x76, 0x24, 0xC8,
|
||||
0x91, 0x7B, 0xDD, 0x64, 0xB1, 0xC0, 0xFD, 0x4C,
|
||||
0xB3, 0x8E, 0x8C, 0x33, 0x4C, 0x70, 0x1C, 0x3A,
|
||||
0xCD, 0xAD, 0x06, 0x57, 0xFC, 0xCF, 0xEC, 0x71,
|
||||
0x9B, 0x1F, 0x5C, 0x3E, 0x4E, 0x46, 0x04, 0x1F,
|
||||
0x38, 0x81, 0x47, 0xFB, 0x4C, 0xFD, 0xB4, 0x77,
|
||||
0xA5, 0x24, 0x71, 0xF7, 0xA9, 0xA9, 0x69, 0x10,
|
||||
0xB8, 0x55, 0x32, 0x2E, 0xDB, 0x63, 0x40, 0xD8,
|
||||
0xA0, 0x0E, 0xF0, 0x92, 0x35, 0x05, 0x11, 0xE3,
|
||||
0x0A, 0xBE, 0xC1, 0xFF, 0xF9, 0xE3, 0xA2, 0x6E,
|
||||
0x7F, 0xB2, 0x9F, 0x8C, 0x18, 0x30, 0x23, 0xC3,
|
||||
0x58, 0x7E, 0x38, 0xDA, 0x00, 0x77, 0xD9, 0xB4,
|
||||
0x76, 0x3E, 0x4E, 0x4B, 0x94, 0xB2, 0xBB, 0xC1,
|
||||
0x94, 0xC6, 0x65, 0x1E, 0x77, 0xCA, 0xF9, 0x92,
|
||||
0xEE, 0xAA, 0xC0, 0x23, 0x2A, 0x28, 0x1B, 0xF6,
|
||||
0xB3, 0xA7, 0x39, 0xC1, 0x22, 0x61, 0x16, 0x82,
|
||||
0x0A, 0xE8, 0xDB, 0x58, 0x47, 0xA6, 0x7C, 0xBE,
|
||||
0xF9, 0xC9, 0x09, 0x1B, 0x46, 0x2D, 0x53, 0x8C,
|
||||
0xD7, 0x2B, 0x03, 0x74, 0x6A, 0xE7, 0x7F, 0x5E,
|
||||
0x62, 0x29, 0x2C, 0x31, 0x15, 0x62, 0xA8, 0x46,
|
||||
0x50, 0x5D, 0xC8, 0x2D, 0xB8, 0x54, 0x33, 0x8A,
|
||||
0xE4, 0x9F, 0x52, 0x35, 0xC9, 0x5B, 0x91, 0x17,
|
||||
0x8C, 0xCF, 0x2D, 0xD5, 0xCA, 0xCE, 0xF4, 0x03,
|
||||
0xEC, 0x9D, 0x18, 0x10, 0xC6, 0x27, 0x2B, 0x04,
|
||||
0x5B, 0x3B, 0x71, 0xF9, 0xDC, 0x6B, 0x80, 0xD6,
|
||||
0x3F, 0xDD, 0x4A, 0x8E, 0x9A, 0xDB, 0x1E, 0x69,
|
||||
0x62, 0xA6, 0x95, 0x26, 0xD4, 0x31, 0x61, 0xC1,
|
||||
0xA4, 0x1D, 0x57, 0x0D, 0x79, 0x38, 0xDA, 0xD4,
|
||||
0xA4, 0x0E, 0x32, 0x9C, 0xCF, 0xF4, 0x6A, 0xAA,
|
||||
0x36, 0xAD, 0x00, 0x4C, 0xF6, 0x00, 0xC8, 0x38,
|
||||
0x1E, 0x42, 0x5A, 0x31, 0xD9, 0x51, 0xAE, 0x64,
|
||||
0xFD, 0xB2, 0x3F, 0xCE, 0xC9, 0x50, 0x9D, 0x43,
|
||||
0x68, 0x7F, 0xEB, 0x69, 0xED, 0xD1, 0xCC, 0x5E,
|
||||
0x0B, 0x8C, 0xC3, 0xBD, 0xF6, 0x4B, 0x10, 0xEF,
|
||||
0x86, 0xB6, 0x31, 0x42, 0xA3, 0xAB, 0x88, 0x29,
|
||||
0x55, 0x5B, 0x2F, 0x74, 0x7C, 0x93, 0x26, 0x65,
|
||||
0xCB, 0x2C, 0x0F, 0x1C, 0xC0, 0x1B, 0xD7, 0x02,
|
||||
0x29, 0x38, 0x88, 0x39, 0xD2, 0xAF, 0x05, 0xE4,
|
||||
0x54, 0x50, 0x4A, 0xC7, 0x8B, 0x75, 0x82, 0x82,
|
||||
0x28, 0x46, 0xC0, 0xBA, 0x35, 0xC3, 0x5F, 0x5C,
|
||||
0x59, 0x16, 0x0C, 0xC0, 0x46, 0xFD, 0x82, 0x51,
|
||||
0x54, 0x1F, 0xC6, 0x8C, 0x9C, 0x86, 0xB0, 0x22,
|
||||
0xBB, 0x70, 0x99, 0x87, 0x6A, 0x46, 0x0E, 0x74,
|
||||
0x51, 0xA8, 0xA9, 0x31, 0x09, 0x70, 0x3F, 0xEE,
|
||||
0x1C, 0x21, 0x7E, 0x6C, 0x38, 0x26, 0xE5, 0x2C,
|
||||
0x51, 0xAA, 0x69, 0x1E, 0x0E, 0x42, 0x3C, 0xFC,
|
||||
0x99, 0xE9, 0xE3, 0x16, 0x50, 0xC1, 0x21, 0x7B,
|
||||
0x62, 0x48, 0x16, 0xCD, 0xAD, 0x9A, 0x95, 0xF9,
|
||||
0xD5, 0xB8, 0x01, 0x94, 0x88, 0xD9, 0xC0, 0xA0,
|
||||
0xA1, 0xFE, 0x30, 0x75, 0xA5, 0x77, 0xE2, 0x31,
|
||||
0x83, 0xF8, 0x1D, 0x4A, 0x3F, 0x2F, 0xA4, 0x57,
|
||||
0x1E, 0xFC, 0x8C, 0xE0, 0xBA, 0x8A, 0x4F, 0xE8,
|
||||
0xB6, 0x85, 0x5D, 0xFE, 0x72, 0xB0, 0xA6, 0x6E,
|
||||
0xDE, 0xD2, 0xFB, 0xAB, 0xFB, 0xE5, 0x8A, 0x30,
|
||||
0xFA, 0xFA, 0xBE, 0x1C, 0x5D, 0x71, 0xA8, 0x7E,
|
||||
0x2F, 0x74, 0x1E, 0xF8, 0xC1, 0xFE, 0x86, 0xFE,
|
||||
0xA6, 0xBB, 0xFD, 0xE5, 0x30, 0x67, 0x7F, 0x0D,
|
||||
0x97, 0xD1, 0x1D, 0x49, 0xF7, 0xA8, 0x44, 0x3D,
|
||||
0x08, 0x22, 0xE5, 0x06, 0xA9, 0xF4, 0x61, 0x4E,
|
||||
0x01, 0x1E, 0x2A, 0x94, 0x83, 0x8F, 0xF8, 0x8C,
|
||||
0xD6, 0x8C, 0x8B, 0xB7, 0xC5, 0xC6, 0x42, 0x4C,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
|
||||
};
|
||||
static const byte dh_ffdhe8192_g[] = { 0x02 };
|
||||
|
||||
const DhParams* wc_Dh_ffdhe8192_Get(void)
|
||||
{
|
||||
static const DhParams ffdhe8192 = {
|
||||
dh_ffdhe8192_p, sizeof(dh_ffdhe8192_p),
|
||||
dh_ffdhe8192_g, sizeof(dh_ffdhe8192_g)
|
||||
};
|
||||
return &ffdhe8192;
|
||||
}
|
||||
#endif
|
||||
|
||||
int wc_InitDhKey_ex(DhKey* key, void* heap, int devId)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (key == NULL)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
key->heap = heap; /* for XMALLOC/XFREE in future */
|
||||
|
||||
if (mp_init_multi(&key->p, &key->g, NULL, NULL, NULL, NULL) != MP_OKAY)
|
||||
return MEMORY_E;
|
||||
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_DH)
|
||||
/* handle as async */
|
||||
ret = wolfAsync_DevCtxInit(&key->asyncDev, WOLFSSL_ASYNC_MARKER_DH,
|
||||
key->heap, devId);
|
||||
#else
|
||||
(void)devId;
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int wc_InitDhKey(DhKey* key)
|
||||
{
|
||||
return wc_InitDhKey_ex(key, NULL, INVALID_DEVID);
|
||||
}
|
||||
|
||||
|
||||
void wc_FreeDhKey(DhKey* key)
|
||||
{
|
||||
(void)key;
|
||||
mp_clear(&key->p);
|
||||
mp_clear(&key->g);
|
||||
if (key) {
|
||||
mp_clear(&key->p);
|
||||
mp_clear(&key->g);
|
||||
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_DH)
|
||||
wolfAsync_DevCtxFree(&key->asyncDev, WOLFSSL_ASYNC_MARKER_DH);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* if defined to not use floating point values do not compile in */
|
||||
#ifndef WOLFSSL_DH_CONST
|
||||
static word32 DiscreteLogWorkFactor(word32 n)
|
||||
{
|
||||
/* assuming discrete log takes about the same time as factoring */
|
||||
if (n<5)
|
||||
return 0;
|
||||
else
|
||||
return (word32)(2.4 * XPOW((double)n, 1.0/3.0) *
|
||||
XPOW(XLOG((double)n), 2.0/3.0) - 5);
|
||||
}
|
||||
static word32 DiscreteLogWorkFactor(word32 n)
|
||||
{
|
||||
/* assuming discrete log takes about the same time as factoring */
|
||||
if (n < 5)
|
||||
return 0;
|
||||
else
|
||||
return (word32)(2.4 * XPOW((double)n, 1.0/3.0) *
|
||||
XPOW(XLOG((double)n), 2.0/3.0) - 5);
|
||||
}
|
||||
#endif /* WOLFSSL_DH_CONST*/
|
||||
|
||||
|
||||
@@ -100,9 +563,9 @@ static word32 DiscreteLogWorkFactor(word32 n)
|
||||
#endif
|
||||
|
||||
|
||||
static int GeneratePrivate(DhKey* key, WC_RNG* rng, byte* priv, word32* privSz)
|
||||
static int GeneratePrivateDh(DhKey* key, WC_RNG* rng, byte* priv, word32* privSz)
|
||||
{
|
||||
int ret;
|
||||
int ret = 0;
|
||||
word32 sz = mp_unsigned_bin_size(&key->p);
|
||||
|
||||
/* Table of predetermined values from the operation
|
||||
@@ -120,33 +583,31 @@ static int GeneratePrivate(DhKey* key, WC_RNG* rng, byte* priv, word32* privSz)
|
||||
case 896: sz = 49; break;
|
||||
case 1024: sz = 52; break;
|
||||
default:
|
||||
#ifndef WOLFSSL_DH_CONST
|
||||
/* if using floating points and size of p is not in table */
|
||||
sz = min(sz, 2 * DiscreteLogWorkFactor(sz * WOLFSSL_BIT_SIZE) /
|
||||
WOLFSSL_BIT_SIZE + 1);
|
||||
break;
|
||||
#else
|
||||
return BAD_FUNC_ARG;
|
||||
#endif
|
||||
#ifndef WOLFSSL_DH_CONST
|
||||
/* if using floating points and size of p is not in table */
|
||||
sz = min(sz, 2 * DiscreteLogWorkFactor(sz * WOLFSSL_BIT_SIZE) /
|
||||
WOLFSSL_BIT_SIZE + 1);
|
||||
break;
|
||||
#else
|
||||
return BAD_FUNC_ARG;
|
||||
#endif
|
||||
}
|
||||
|
||||
ret = wc_RNG_GenerateBlock(rng, priv, sz);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
priv[0] |= 0x0C;
|
||||
if (ret == 0) {
|
||||
priv[0] |= 0x0C;
|
||||
*privSz = sz;
|
||||
}
|
||||
|
||||
*privSz = sz;
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int GeneratePublic(DhKey* key, const byte* priv, word32 privSz,
|
||||
byte* pub, word32* pubSz)
|
||||
static int GeneratePublicDh(DhKey* key, byte* priv, word32 privSz,
|
||||
byte* pub, word32* pubSz)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
mp_int x;
|
||||
mp_int y;
|
||||
|
||||
@@ -171,24 +632,163 @@ static int GeneratePublic(DhKey* key, const byte* priv, word32 privSz,
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int wc_DhGenerateKeyPair(DhKey* key, WC_RNG* rng, byte* priv, word32* privSz,
|
||||
byte* pub, word32* pubSz)
|
||||
static int wc_DhGenerateKeyPair_Sync(DhKey* key, WC_RNG* rng,
|
||||
byte* priv, word32* privSz, byte* pub, word32* pubSz)
|
||||
{
|
||||
int ret = GeneratePrivate(key, rng, priv, privSz);
|
||||
int ret;
|
||||
|
||||
return (ret != 0) ? ret : GeneratePublic(key, priv, *privSz, pub, pubSz);
|
||||
if (key == NULL || rng == NULL || priv == NULL || privSz == NULL ||
|
||||
pub == NULL || pubSz == NULL) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
ret = GeneratePrivateDh(key, rng, priv, privSz);
|
||||
|
||||
return (ret != 0) ? ret : GeneratePublicDh(key, priv, *privSz, pub, pubSz);
|
||||
}
|
||||
|
||||
int wc_DhAgree(DhKey* key, byte* agree, word32* agreeSz, const byte* priv,
|
||||
word32 privSz, const byte* otherPub, word32 pubSz)
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_DH)
|
||||
static int wc_DhGenerateKeyPair_Async(DhKey* key, WC_RNG* rng,
|
||||
byte* priv, word32* privSz, byte* pub, word32* pubSz)
|
||||
{
|
||||
int ret;
|
||||
|
||||
#if defined(HAVE_INTEL_QA)
|
||||
mp_int x;
|
||||
|
||||
ret = mp_init(&x);
|
||||
if (ret != MP_OKAY)
|
||||
return ret;
|
||||
|
||||
ret = GeneratePrivateDh(key, rng, priv, privSz);
|
||||
if (ret == 0)
|
||||
ret = mp_read_unsigned_bin(&x, priv, *privSz);
|
||||
if (ret == MP_OKAY)
|
||||
ret = wc_mp_to_bigint(&x, &x.raw);
|
||||
if (ret == MP_OKAY)
|
||||
ret = wc_mp_to_bigint(&key->p, &key->p.raw);
|
||||
if (ret == MP_OKAY)
|
||||
ret = wc_mp_to_bigint(&key->g, &key->g.raw);
|
||||
if (ret == MP_OKAY)
|
||||
ret = IntelQaDhKeyGen(&key->asyncDev, &key->p.raw, &key->g.raw,
|
||||
&x.raw, pub, pubSz);
|
||||
mp_clear(&x);
|
||||
|
||||
#else
|
||||
|
||||
#if defined(HAVE_CAVIUM)
|
||||
/* TODO: Not implemented - use software for now */
|
||||
|
||||
#else /* WOLFSSL_ASYNC_CRYPT_TEST */
|
||||
WC_ASYNC_TEST* testDev = &key->asyncDev.test;
|
||||
if (testDev->type == ASYNC_TEST_NONE) {
|
||||
testDev->type = ASYNC_TEST_DH_GEN;
|
||||
testDev->dhGen.key = key;
|
||||
testDev->dhGen.rng = rng;
|
||||
testDev->dhGen.priv = priv;
|
||||
testDev->dhGen.privSz = privSz;
|
||||
testDev->dhGen.pub = pub;
|
||||
testDev->dhGen.pubSz = pubSz;
|
||||
return WC_PENDING_E;
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = wc_DhGenerateKeyPair_Sync(key, rng, priv, privSz, pub, pubSz);
|
||||
|
||||
#endif /* HAVE_INTEL_QA */
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif /* WOLFSSL_ASYNC_CRYPT && WC_ASYNC_ENABLE_DH */
|
||||
|
||||
|
||||
/* Check DH Public Key for invalid numbers
|
||||
*
|
||||
* key DH key group parameters.
|
||||
* pub Public Key.
|
||||
* pubSz Public Key size.
|
||||
*
|
||||
* returns 0 on success or error code
|
||||
*/
|
||||
int wc_DhCheckPubKey(DhKey* key, const byte* pub, word32 pubSz)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
mp_int x;
|
||||
mp_int x;
|
||||
mp_int y;
|
||||
|
||||
if (key == NULL || pub == NULL) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
if (mp_init_multi(&x, &y, NULL, NULL, NULL, NULL) != MP_OKAY) {
|
||||
return MP_INIT_E;
|
||||
}
|
||||
|
||||
if (mp_read_unsigned_bin(&x, pub, pubSz) != MP_OKAY) {
|
||||
ret = MP_READ_E;
|
||||
}
|
||||
|
||||
/* pub should not be 0 or 1 */
|
||||
if (ret == 0 && mp_cmp_d(&x, 2) == MP_LT) {
|
||||
ret = MP_CMP_E;
|
||||
}
|
||||
|
||||
/* pub shouldn't be greater than or equal to p - 1 */
|
||||
if (ret == 0 && mp_copy(&key->p, &y) != MP_OKAY) {
|
||||
ret = MP_INIT_E;
|
||||
}
|
||||
if (ret == 0 && mp_sub_d(&y, 2, &y) != MP_OKAY) {
|
||||
ret = MP_SUB_E;
|
||||
}
|
||||
if (ret == 0 && mp_cmp(&x, &y) == MP_GT) {
|
||||
ret = MP_CMP_E;
|
||||
}
|
||||
|
||||
mp_clear(&y);
|
||||
mp_clear(&x);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int wc_DhGenerateKeyPair(DhKey* key, WC_RNG* rng,
|
||||
byte* priv, word32* privSz, byte* pub, word32* pubSz)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (key == NULL || rng == NULL || priv == NULL || privSz == NULL ||
|
||||
pub == NULL || pubSz == NULL) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_DH)
|
||||
if (key->asyncDev.marker == WOLFSSL_ASYNC_MARKER_DH) {
|
||||
ret = wc_DhGenerateKeyPair_Async(key, rng, priv, privSz, pub, pubSz);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
ret = wc_DhGenerateKeyPair_Sync(key, rng, priv, privSz, pub, pubSz);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int wc_DhAgree_Sync(DhKey* key, byte* agree, word32* agreeSz,
|
||||
const byte* priv, word32 privSz, const byte* otherPub, word32 pubSz)
|
||||
{
|
||||
int ret = 0;
|
||||
mp_int x;
|
||||
mp_int y;
|
||||
mp_int z;
|
||||
|
||||
if (wc_DhCheckPubKey(key, otherPub, pubSz) != 0) {
|
||||
WOLFSSL_MSG("wc_DhAgree wc_DhCheckPubKey failed");
|
||||
return DH_CHECK_PUB_E;
|
||||
}
|
||||
|
||||
if (mp_init_multi(&x, &y, &z, 0, 0, 0) != MP_OKAY)
|
||||
return MP_INIT_E;
|
||||
|
||||
@@ -209,7 +809,65 @@ int wc_DhAgree(DhKey* key, byte* agree, word32* agreeSz, const byte* priv,
|
||||
|
||||
mp_clear(&z);
|
||||
mp_clear(&y);
|
||||
mp_clear(&x);
|
||||
mp_forcezero(&x);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_DH)
|
||||
static int wc_DhAgree_Async(DhKey* key, byte* agree, word32* agreeSz,
|
||||
const byte* priv, word32 privSz, const byte* otherPub, word32 pubSz)
|
||||
{
|
||||
int ret;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
/* TODO: Not implemented - use software for now */
|
||||
ret = wc_DhAgree_Sync(key, agree, agreeSz, priv, privSz, otherPub, pubSz);
|
||||
|
||||
#elif defined(HAVE_INTEL_QA)
|
||||
ret = wc_mp_to_bigint(&key->p, &key->p.raw);
|
||||
if (ret == MP_OKAY)
|
||||
ret = IntelQaDhAgree(&key->asyncDev, &key->p.raw,
|
||||
agree, agreeSz, priv, privSz, otherPub, pubSz);
|
||||
#else /* WOLFSSL_ASYNC_CRYPT_TEST */
|
||||
WC_ASYNC_TEST* testDev = &key->asyncDev.test;
|
||||
if (testDev->type == ASYNC_TEST_NONE) {
|
||||
testDev->type = ASYNC_TEST_DH_AGREE;
|
||||
testDev->dhAgree.key = key;
|
||||
testDev->dhAgree.agree = agree;
|
||||
testDev->dhAgree.agreeSz = agreeSz;
|
||||
testDev->dhAgree.priv = priv;
|
||||
testDev->dhAgree.privSz = privSz;
|
||||
testDev->dhAgree.otherPub = otherPub;
|
||||
testDev->dhAgree.pubSz = pubSz;
|
||||
return WC_PENDING_E;
|
||||
}
|
||||
ret = wc_DhAgree_Sync(key, agree, agreeSz, priv, privSz, otherPub, pubSz);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif /* WOLFSSL_ASYNC_CRYPT */
|
||||
|
||||
int wc_DhAgree(DhKey* key, byte* agree, word32* agreeSz, const byte* priv,
|
||||
word32 privSz, const byte* otherPub, word32 pubSz)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (key == NULL || agree == NULL || agreeSz == NULL || priv == NULL ||
|
||||
otherPub == NULL) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_DH)
|
||||
if (key->asyncDev.marker == WOLFSSL_ASYNC_MARKER_DH) {
|
||||
ret = wc_DhAgree_Async(key, agree, agreeSz, priv, privSz, otherPub, pubSz);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
ret = wc_DhAgree_Sync(key, agree, agreeSz, priv, privSz, otherPub, pubSz);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -219,8 +877,9 @@ int wc_DhAgree(DhKey* key, byte* agree, word32* agreeSz, const byte* priv,
|
||||
int wc_DhSetKey(DhKey* key, const byte* p, word32 pSz, const byte* g,
|
||||
word32 gSz)
|
||||
{
|
||||
if (key == NULL || p == NULL || g == NULL || pSz == 0 || gSz == 0)
|
||||
if (key == NULL || p == NULL || g == NULL || pSz == 0 || gSz == 0) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
/* may have leading 0 */
|
||||
if (p[0] == 0) {
|
||||
@@ -251,6 +910,4 @@ int wc_DhSetKey(DhKey* key, const byte* p, word32 pSz, const byte* g,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#endif /* NO_DH */
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user