forked from wolfSSL/wolfssl
swig updated, tested, and working
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@ -95,9 +95,13 @@ TAGS
|
|||||||
support/cyassl.pc
|
support/cyassl.pc
|
||||||
cyassl/ctaocrypt/stamp-h1
|
cyassl/ctaocrypt/stamp-h1
|
||||||
swig/_cyassl.so
|
swig/_cyassl.so
|
||||||
|
swig/_wolfssl.so
|
||||||
swig/cyassl.py
|
swig/cyassl.py
|
||||||
|
swig/wolfssl.py
|
||||||
swig/cyassl.pyc
|
swig/cyassl.pyc
|
||||||
|
swig/wolfssl.pyc
|
||||||
swig/cyassl_wrap.c
|
swig/cyassl_wrap.c
|
||||||
|
swig/wolfssl_wrap.c
|
||||||
stamp-h1
|
stamp-h1
|
||||||
clang_output_*
|
clang_output_*
|
||||||
internal.plist
|
internal.plist
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo
|
echo
|
||||||
swig -python cyassl.i
|
swig -python wolfssl.i
|
||||||
pythonIncludes=`python-config --includes`
|
pythonIncludes=`python-config --includes`
|
||||||
pythonLibs=`python-config --libs`
|
pythonLibs=`python-config --libs`
|
||||||
gcc -c -fpic cyassl_wrap.c -I$pythonIncludes
|
gcc -c -fpic wolfssl_wrap.c -I$pythonIncludes
|
||||||
gcc -c -fpic cyassl_adds.c
|
gcc -c -fpic wolfssl_adds.c
|
||||||
gcc -shared -flat_namespace cyassl_adds.o cyassl_wrap.o -lcyassl $pythonLibs -o _cyassl.so
|
gcc -shared -flat_namespace wolfssl_adds.o wolfssl_wrap.o -lwolfssl $pythonLibs -o _wolfssl.so
|
||||||
python runme.py
|
python runme.py
|
||||||
|
22
swig/README
22
swig/README
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Initial swig interface file
|
Initial swig interface file
|
||||||
|
|
||||||
Please send questions to support@yassl.com
|
Please send questions to support@wolfssl.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -10,26 +10,26 @@ Please send questions to support@yassl.com
|
|||||||
|
|
||||||
For Linux, OS X, or *nix
|
For Linux, OS X, or *nix
|
||||||
|
|
||||||
1) build CyaSSL with fpic on Linux, not needed on OS X
|
1) build wolfSSL with fpic on Linux, not needed on OS X
|
||||||
./configure --disable-shared CFLAGS=-fpic
|
./configure --disable-shared CFLAGS=-fpic
|
||||||
make
|
make
|
||||||
sudo make install
|
sudo make install
|
||||||
|
|
||||||
|
|
||||||
2) start the example echoserver from the examples/echoserver directory
|
2) start the example echoserver from the root directory
|
||||||
./echoserver
|
./examples/echoserver/echoserver
|
||||||
|
|
||||||
3) run ./PtyonBuild.sh from this directory it will
|
3) run ./PythonBuild.sh from this directory it will
|
||||||
a) build the swig wrapper file
|
a) build the swig wrapper file
|
||||||
b) compile the swig wrapper and cyassl wrapper files
|
b) compile the swig wrapper and wolfssl wrapper files
|
||||||
c) place them into a cyassl shared library for python
|
c) place them into a wolfssl shared library for python
|
||||||
d) run runme.py which will connect to the CyaSSL echo server, write a
|
d) run runme.py which will connect to the wolfSSL echo server, write a
|
||||||
string, then read the result and output it
|
string, then read the result and output it
|
||||||
|
|
||||||
|
|
||||||
Windows only
|
Windows only
|
||||||
|
|
||||||
1) Make sure the install path to cyassl doesn't have any spaces anywhere in the
|
1) Make sure the install path to wolfssl doesn't have any spaces anywhere in the
|
||||||
directory path because swig doesn't like that
|
directory path because swig doesn't like that
|
||||||
2) Have python for Windows installed, note install directory
|
2) Have python for Windows installed, note install directory
|
||||||
3) Have swigwin installed, note install directory
|
3) Have swigwin installed, note install directory
|
||||||
@ -37,8 +37,8 @@ Please send questions to support@yassl.com
|
|||||||
5) Make sure env. variables PYTHON_INCLUDE and PYTHON_LIB are set correctly e.g.
|
5) Make sure env. variables PYTHON_INCLUDE and PYTHON_LIB are set correctly e.g.
|
||||||
PYTHON_INCLUE="c:\Python26\include"
|
PYTHON_INCLUE="c:\Python26\include"
|
||||||
PYTHON_LIB="c:\Python26\libs\python26.lib"
|
PYTHON_LIB="c:\Python26\libs\python26.lib"
|
||||||
6) Build python_cyassl in Release mode only, Debug build fails to find a debug
|
6) Build python_wolfssl in Release mode only, Debug build fails to find a debug
|
||||||
python library that isn't included by default
|
python library that isn't included by default
|
||||||
7) The outputs _cyassl.pyd and cyassl.py are the cyassl import library
|
7) The outputs _wolfssl.pyd and wolfssl.py are the wolfssl import library
|
||||||
8) Can now run python runme.py from the swig directory
|
8) Can now run python runme.py from the swig directory
|
||||||
|
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
EXTRA_DIST+= \
|
EXTRA_DIST+= \
|
||||||
swig/PythonBuild.sh \
|
swig/PythonBuild.sh \
|
||||||
swig/README \
|
swig/README \
|
||||||
swig/cyassl.i \
|
swig/wolfssl.i \
|
||||||
swig/cyassl_adds.c \
|
swig/wolfssl_adds.c \
|
||||||
swig/python_cyassl.vcproj \
|
swig/python_wolfssl.vcproj \
|
||||||
swig/rsasign.py \
|
swig/rsasign.py \
|
||||||
swig/runme.py
|
swig/runme.py
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
<VisualStudioProject
|
<VisualStudioProject
|
||||||
ProjectType="Visual C++"
|
ProjectType="Visual C++"
|
||||||
Version="9.00"
|
Version="9.00"
|
||||||
Name="python_cyassl"
|
Name="python_wolfssl"
|
||||||
ProjectGUID="{47A3ABA9-EC54-4788-BC7E-370595B2011A}"
|
ProjectGUID="{47A3ABA9-EC54-4788-BC7E-370595B2011A}"
|
||||||
RootNamespace="python_cyassl"
|
RootNamespace="python_wolfssl"
|
||||||
Keyword="Win32Proj"
|
Keyword="Win32Proj"
|
||||||
TargetFrameworkVersion="196613"
|
TargetFrameworkVersion="196613"
|
||||||
>
|
>
|
||||||
@ -41,8 +41,8 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="../include;../ctaocrypt/include;"$(PYTHON_INCLUDE)""
|
AdditionalIncludeDirectories="../include;../wolfcrypt/include;"$(PYTHON_INCLUDE)""
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PYTHON_CYASSL_EXPORTS"
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PYTHON_WOLFSSL_EXPORTS"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="3"
|
RuntimeLibrary="3"
|
||||||
@ -62,7 +62,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="$(PYTHON_LIB) Ws2_32.lib"
|
AdditionalDependencies="$(PYTHON_LIB) Ws2_32.lib"
|
||||||
OutputFile="_cyassl.pyd"
|
OutputFile="_wolfssl.pyd"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
SubSystem="2"
|
SubSystem="2"
|
||||||
@ -117,8 +117,8 @@
|
|||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="2"
|
Optimization="2"
|
||||||
EnableIntrinsicFunctions="true"
|
EnableIntrinsicFunctions="true"
|
||||||
AdditionalIncludeDirectories="../include;../ctaocrypt/include;"$(PYTHON_INCLUDE)""
|
AdditionalIncludeDirectories="../include;../wolfcrypt/include;"$(PYTHON_INCLUDE)""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PYTHON_CYASSL_EXPORTS"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PYTHON_WOLFSSL_EXPORTS"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
EnableFunctionLevelLinking="true"
|
EnableFunctionLevelLinking="true"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
@ -137,7 +137,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="$(PYTHON_LIB) Ws2_32.lib"
|
AdditionalDependencies="$(PYTHON_LIB) Ws2_32.lib"
|
||||||
OutputFile="_cyassl.pyd"
|
OutputFile="_wolfssl.pyd"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
SubSystem="2"
|
SubSystem="2"
|
||||||
@ -177,11 +177,11 @@
|
|||||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||||
>
|
>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\cyassl_adds.c"
|
RelativePath=".\wolfssl_adds.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\cyassl_wrap.c"
|
RelativePath=".\wolfssl_wrap.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
@ -198,7 +198,7 @@
|
|||||||
>
|
>
|
||||||
</Filter>
|
</Filter>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\cyassl.i"
|
RelativePath=".\wolfssl.i"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Debug|Win32"
|
Name="Debug|Win32"
|
@ -1,35 +1,35 @@
|
|||||||
# file: rsasign.py
|
# file: rsasign.py
|
||||||
|
|
||||||
import cyassl
|
import wolfssl
|
||||||
|
|
||||||
|
|
||||||
# start Random Number Generator
|
# start Random Number Generator
|
||||||
rng = cyassl.GetRng()
|
rng = wolfssl.GetRng()
|
||||||
if rng == None:
|
if rng == None:
|
||||||
print "Couldn't get an RNG"
|
print "Couldn't get an RNG"
|
||||||
exit(-1)
|
exit(-1)
|
||||||
|
|
||||||
# load RSA private key in DER format
|
# load RSA private key in DER format
|
||||||
key = cyassl.GetRsaPrivateKey("../certs/client-key.der")
|
key = wolfssl.GetRsaPrivateKey("../certs/client-key.der")
|
||||||
if key == None:
|
if key == None:
|
||||||
print "Couldn't load DER private key file"
|
print "Couldn't load DER private key file"
|
||||||
exit(-1)
|
exit(-1)
|
||||||
|
|
||||||
# Make byte Arrays and fill input
|
# Make byte Arrays and fill input
|
||||||
signOutput = cyassl.byteArray(128) # 128 allows 1024 bit private key
|
signOutput = wolfssl.byteArray(128) # 128 allows 1024 bit private key
|
||||||
signStr = cyassl.byteArray(25) # input can't be larger then key size
|
signStr = wolfssl.byteArray(25) # input can't be larger then key size
|
||||||
# 64 for 512 bit 128 for 1024 bit
|
# 64 for 512 bit 128 for 1024 bit
|
||||||
cyassl.FillSignStr(signStr, "Everybody gets Friday off", 25)
|
wolfssl.FillSignStr(signStr, "Everybody gets Friday off", 25)
|
||||||
|
|
||||||
# Do RSA Sign
|
# Do RSA Sign
|
||||||
signedSize = cyassl.RsaSSL_Sign(signStr, 25, signOutput, 128, key, rng)
|
signedSize = wolfssl.RsaSSL_Sign(signStr, 25, signOutput, 128, key, rng)
|
||||||
|
|
||||||
# Show output
|
# Show output
|
||||||
print "Signed Size = ", signedSize, " signed array = ", cyassl.cdata(signOutput, signedSize)
|
print "Signed Size = ", signedSize, " signed array = ", wolfssl.cdata(signOutput, signedSize)
|
||||||
|
|
||||||
# let's verify this worked
|
# let's verify this worked
|
||||||
signVerify = cyassl.byteArray(signedSize)
|
signVerify = wolfssl.byteArray(signedSize)
|
||||||
verifySize = cyassl.RsaSSL_Verify(signOutput, signedSize, signVerify, signedSize, key)
|
verifySize = wolfssl.RsaSSL_Verify(signOutput, signedSize, signVerify, signedSize, key)
|
||||||
|
|
||||||
print "Verify Size = ", verifySize, " verify array = ", cyassl.cdata(signVerify, verifySize)
|
print "Verify Size = ", verifySize, " verify array = ", wolfssl.cdata(signVerify, verifySize)
|
||||||
|
|
||||||
|
@ -1,40 +1,40 @@
|
|||||||
# file: runme.py
|
# file: runme.py
|
||||||
|
|
||||||
import cyassl
|
import wolfssl
|
||||||
|
|
||||||
print ""
|
print ""
|
||||||
print "Trying to connect to the echo server..."
|
print "Trying to connect to the echo server..."
|
||||||
|
|
||||||
cyassl.CyaSSL_Init()
|
wolfssl.wolfSSL_Init()
|
||||||
#cyassl.CyaSSL_Debugging_ON()
|
#wolfssl.wolfSSL_Debugging_ON()
|
||||||
ctx = cyassl.CyaSSL_CTX_new(cyassl.CyaTLSv1_client_method())
|
ctx = wolfssl.wolfSSL_CTX_new(wolfssl.wolfTLSv1_client_method())
|
||||||
if ctx == None:
|
if ctx == None:
|
||||||
print "Couldn't get SSL CTX for TLSv1"
|
print "Couldn't get SSL CTX for TLSv1"
|
||||||
exit(-1)
|
exit(-1)
|
||||||
|
|
||||||
ret = cyassl.CyaSSL_CTX_load_verify_locations(ctx, "../certs/ca-cert.pem", None)
|
ret = wolfssl.wolfSSL_CTX_load_verify_locations(ctx, "../certs/ca-cert.pem", None)
|
||||||
if ret != cyassl.SSL_SUCCESS:
|
if ret != wolfssl.SSL_SUCCESS:
|
||||||
print "Couldn't do SSL_CTX_load_verify_locations "
|
print "Couldn't do SSL_CTX_load_verify_locations "
|
||||||
print "error string = ", ret
|
print "error string = ", ret
|
||||||
exit(-1)
|
exit(-1)
|
||||||
|
|
||||||
ssl = cyassl.CyaSSL_new(ctx)
|
ssl = wolfssl.wolfSSL_new(ctx)
|
||||||
ret = cyassl.CyaSSL_swig_connect(ssl, "localhost", 11111)
|
ret = wolfssl.wolfSSL_swig_connect(ssl, "localhost", 11111)
|
||||||
|
|
||||||
if ret != cyassl.SSL_SUCCESS:
|
if ret != wolfssl.SSL_SUCCESS:
|
||||||
print "Couldn't do SSL connect"
|
print "Couldn't do SSL connect"
|
||||||
err = cyassl.CyaSSL_get_error(ssl, 0)
|
err = wolfssl.wolfSSL_get_error(ssl, 0)
|
||||||
print "error string = ", cyassl.CyaSSL_error_string(err)
|
print "error string = ", wolfssl.wolfSSL_error_string(err)
|
||||||
exit(-1)
|
exit(-1)
|
||||||
|
|
||||||
print "...Connected"
|
print "...Connected"
|
||||||
written = cyassl.CyaSSL_write(ssl, "hello from python\r\n", 19)
|
written = wolfssl.wolfSSL_write(ssl, "hello from python\r\n", 19)
|
||||||
|
|
||||||
if written > 0:
|
if written > 0:
|
||||||
print "Wrote ", written, " bytes"
|
print "Wrote ", written, " bytes"
|
||||||
|
|
||||||
byteArray = cyassl.byteArray(100)
|
byteArray = wolfssl.byteArray(100)
|
||||||
readBytes = cyassl.CyaSSL_read(ssl, byteArray, 100)
|
readBytes = wolfssl.wolfSSL_read(ssl, byteArray, 100)
|
||||||
|
|
||||||
print "server reply: ", cyassl.cdata(byteArray, readBytes)
|
print "server reply: ", wolfssl.cdata(byteArray, readBytes)
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* cyassl.i
|
/* wolfssl.i
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2015 wolfSSL Inc.
|
* Copyright (C) 2006-2015 wolfSSL Inc.
|
||||||
*
|
*
|
||||||
@ -19,34 +19,34 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
%module cyassl
|
%module wolfssl
|
||||||
%{
|
%{
|
||||||
#include <cyassl/ssl.h>
|
#include <wolfssl/ssl.h>
|
||||||
#include <cyassl/ctaocrypt/rsa.h>
|
#include <wolfssl/wolfcrypt/rsa.h>
|
||||||
|
|
||||||
/* defn adds */
|
/* defn adds */
|
||||||
char* CyaSSL_error_string(int err);
|
char* wolfSSL_error_string(int err);
|
||||||
int CyaSSL_swig_connect(CYASSL*, const char* server, int port);
|
int wolfSSL_swig_connect(WOLFSSL*, const char* server, int port);
|
||||||
RNG* GetRng(void);
|
RNG* GetRng(void);
|
||||||
RsaKey* GetRsaPrivateKey(const char* file);
|
RsaKey* GetRsaPrivateKey(const char* file);
|
||||||
void FillSignStr(unsigned char*, const char*, int);
|
void FillSignStr(unsigned char*, const char*, int);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
||||||
CYASSL_METHOD* CyaTLSv1_client_method(void);
|
WOLFSSL_METHOD* wolfTLSv1_client_method(void);
|
||||||
CYASSL_CTX* CyaSSL_CTX_new(CYASSL_METHOD*);
|
WOLFSSL_CTX* wolfSSL_CTX_new(WOLFSSL_METHOD*);
|
||||||
int CyaSSL_CTX_load_verify_locations(CYASSL_CTX*, const char*, const char*);
|
int wolfSSL_CTX_load_verify_locations(WOLFSSL_CTX*, const char*, const char*);
|
||||||
CYASSL* CyaSSL_new(CYASSL_CTX*);
|
WOLFSSL* wolfSSL_new(WOLFSSL_CTX*);
|
||||||
int CyaSSL_get_error(CYASSL*, int);
|
int wolfSSL_get_error(WOLFSSL*, int);
|
||||||
int CyaSSL_write(CYASSL*, const char*, int);
|
int wolfSSL_write(WOLFSSL*, const char*, int);
|
||||||
int CyaSSL_Debugging_ON(void);
|
int wolfSSL_Debugging_ON(void);
|
||||||
int CyaSSL_Init(void);
|
int wolfSSL_Init(void);
|
||||||
char* CyaSSL_error_string(int);
|
char* wolfSSL_error_string(int);
|
||||||
int CyaSSL_swig_connect(CYASSL*, const char* server, int port);
|
int wolfSSL_swig_connect(WOLFSSL*, const char* server, int port);
|
||||||
|
|
||||||
int RsaSSL_Sign(const unsigned char* in, int inLen, unsigned char* out, int outLen, RsaKey* key, RNG* rng);
|
int wc_RsaSSL_Sign(const unsigned char* in, int inLen, unsigned char* out, int outLen, RsaKey* key, RNG* rng);
|
||||||
|
|
||||||
int RsaSSL_Verify(const unsigned char* in, int inLen, unsigned char* out, int outLen, RsaKey* key);
|
int wc_RsaSSL_Verify(const unsigned char* in, int inLen, unsigned char* out, int outLen, RsaKey* key);
|
||||||
|
|
||||||
RNG* GetRng(void);
|
RNG* GetRng(void);
|
||||||
RsaKey* GetRsaPrivateKey(const char* file);
|
RsaKey* GetRsaPrivateKey(const char* file);
|
||||||
@ -55,7 +55,7 @@ void FillSignStr(unsigned char*, const char*, int);
|
|||||||
%include carrays.i
|
%include carrays.i
|
||||||
%include cdata.i
|
%include cdata.i
|
||||||
%array_class(unsigned char, byteArray);
|
%array_class(unsigned char, byteArray);
|
||||||
int CyaSSL_read(CYASSL*, unsigned char*, int);
|
int wolfSSL_read(WOLFSSL*, unsigned char*, int);
|
||||||
|
|
||||||
|
|
||||||
#define SSL_FAILURE 0
|
#define SSL_FAILURE 0
|
@ -1,4 +1,4 @@
|
|||||||
/* cyassl_adds.c
|
/* wolfssl_adds.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2015 wolfSSL Inc.
|
* Copyright (C) 2006-2015 wolfSSL Inc.
|
||||||
*
|
*
|
||||||
@ -23,15 +23,15 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cyassl/ctaocrypt/settings.h>
|
#include <wolfssl/wolfcrypt/settings.h>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#define HAVE_CONFIG_H
|
#define HAVE_CONFIG_H
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cyassl/ssl.h>
|
#include <wolfssl/ssl.h>
|
||||||
#include <cyassl/ctaocrypt/rsa.h>
|
#include <wolfssl/wolfcrypt/rsa.h>
|
||||||
#include <cyassl/ctaocrypt/asn.h>
|
#include <wolfssl/wolfcrypt/asn.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -162,23 +162,23 @@ static int tcp_connect(SOCKET_T* sockfd, const char* ip, short port)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int CyaSSL_swig_connect(CYASSL* ssl, const char* server, int port)
|
int wolfSSL_swig_connect(WOLFSSL* ssl, const char* server, int port)
|
||||||
{
|
{
|
||||||
SOCKET_T sockfd;
|
SOCKET_T sockfd;
|
||||||
int ret = tcp_connect(&sockfd, server, port);
|
int ret = tcp_connect(&sockfd, server, port);
|
||||||
if (ret != 0) return ret;
|
if (ret != 0) return ret;
|
||||||
|
|
||||||
CyaSSL_set_fd(ssl, sockfd);
|
wolfSSL_set_fd(ssl, sockfd);
|
||||||
|
|
||||||
return CyaSSL_connect(ssl);
|
return wolfSSL_connect(ssl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char* CyaSSL_error_string(int err)
|
char* wolfSSL_error_string(int err)
|
||||||
{
|
{
|
||||||
static char buffer[CYASSL_MAX_ERROR_SZ];
|
static char buffer[WOLFSSL_MAX_ERROR_SZ];
|
||||||
|
|
||||||
return CyaSSL_ERR_error_string(err, buffer);
|
return wolfSSL_ERR_error_string(err, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ RNG* GetRng(void)
|
|||||||
RNG* rng = (RNG*)malloc(sizeof(RNG));
|
RNG* rng = (RNG*)malloc(sizeof(RNG));
|
||||||
|
|
||||||
if (rng)
|
if (rng)
|
||||||
if (InitRng(rng) != 0) {
|
if (wc_InitRng(rng) != 0) {
|
||||||
free(rng);
|
free(rng);
|
||||||
rng = 0;
|
rng = 0;
|
||||||
}
|
}
|
||||||
@ -214,11 +214,11 @@ RsaKey* GetRsaPrivateKey(const char* keyFile)
|
|||||||
|
|
||||||
bytes = fread(tmp, 1, sizeof(tmp), file);
|
bytes = fread(tmp, 1, sizeof(tmp), file);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
InitRsaKey(key, 0);
|
wc_InitRsaKey(key, 0);
|
||||||
|
|
||||||
ret = RsaPrivateKeyDecode(tmp, &idx, key, (word32)bytes);
|
ret = wc_RsaPrivateKeyDecode(tmp, &idx, key, (word32)bytes);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
FreeRsaKey(key);
|
wc_FreeRsaKey(key);
|
||||||
free(key);
|
free(key);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
Reference in New Issue
Block a user