forked from wolfSSL/wolfssl
update swig interface
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -61,4 +61,8 @@ TAGS
|
|||||||
support/libcyassl.pc
|
support/libcyassl.pc
|
||||||
cyassl/version.h
|
cyassl/version.h
|
||||||
cyassl/ctaocrypt/stamp-h1
|
cyassl/ctaocrypt/stamp-h1
|
||||||
|
swig/_cyassl.so
|
||||||
|
swig/cyassl.py
|
||||||
|
swig/cyassl.pyc
|
||||||
|
swig/cyassl_wrap.c
|
||||||
stamp-h1
|
stamp-h1
|
||||||
|
@@ -3,7 +3,7 @@ echo
|
|||||||
swig -python cyassl.i
|
swig -python cyassl.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 -I/usr/local/cyassl/include -DHAVE_CONFIG_H
|
gcc -c -fpic cyassl_wrap.c -I$pythonIncludes
|
||||||
gcc -c -fpic cyassl_adds.c -I/usr/local/cyassl/include
|
gcc -c -fpic cyassl_adds.c
|
||||||
gcc -shared -flat_namespace cyassl_adds.o cyassl_wrap.o -lcyassl -L/usr/local/cyassl/lib $pythonLibs -o _cyassl.so
|
gcc -shared -flat_namespace cyassl_adds.o cyassl_wrap.o -lcyassl $pythonLibs -o _cyassl.so
|
||||||
python runme.py
|
python runme.py
|
||||||
|
@@ -21,12 +21,12 @@
|
|||||||
|
|
||||||
%module cyassl
|
%module cyassl
|
||||||
%{
|
%{
|
||||||
#include "openssl/ssl.h"
|
#include <cyassl/openssl/ssl.h>
|
||||||
#include "rsa.h"
|
#include <cyassl/ctaocrypt/rsa.h>
|
||||||
|
|
||||||
/* defn adds */
|
/* defn adds */
|
||||||
char* CyaSSL_error_string(int err);
|
char* CyaSSL_error_string(int err);
|
||||||
int CyaSSL_connect(SSL*, const char* server, int port);
|
int CyaSSL_swig_connect(SSL*, 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);
|
||||||
@@ -39,8 +39,10 @@ int SSL_CTX_load_verify_locations(SSL_CTX*, const char*, const char*);
|
|||||||
SSL* SSL_new(SSL_CTX*);
|
SSL* SSL_new(SSL_CTX*);
|
||||||
int SSL_get_error(SSL*, int);
|
int SSL_get_error(SSL*, int);
|
||||||
int SSL_write(SSL*, const char*, int);
|
int SSL_write(SSL*, const char*, int);
|
||||||
|
int CyaSSL_Debugging_ON(void);
|
||||||
|
int CyaSSL_Init(void);
|
||||||
char* CyaSSL_error_string(int);
|
char* CyaSSL_error_string(int);
|
||||||
int CyaSSL_connect(SSL*, const char* server, int port);
|
int CyaSSL_swig_connect(SSL*, const char* server, int port);
|
||||||
|
|
||||||
int RsaSSL_Sign(const unsigned char* in, int inLen, unsigned char* out, int outLen, RsaKey* key, RNG* rng);
|
int RsaSSL_Sign(const unsigned char* in, int inLen, unsigned char* out, int outLen, RsaKey* key, RNG* rng);
|
||||||
|
|
||||||
|
@@ -160,7 +160,7 @@ static int tcp_connect(SOCKET_T* sockfd, const char* ip, short port)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int CyaSSL_connect(SSL* ssl, const char* server, int port)
|
int CyaSSL_swig_connect(SSL* 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);
|
||||||
|
@@ -5,11 +5,21 @@ import cyassl
|
|||||||
print ""
|
print ""
|
||||||
print "Trying to connect to the echo server..."
|
print "Trying to connect to the echo server..."
|
||||||
|
|
||||||
|
cyassl.CyaSSL_Init()
|
||||||
|
#cyassl.CyaSSL_Debugging_ON()
|
||||||
ctx = cyassl.SSL_CTX_new(cyassl.TLSv1_client_method())
|
ctx = cyassl.SSL_CTX_new(cyassl.TLSv1_client_method())
|
||||||
ret = cyassl.SSL_CTX_load_verify_locations(ctx, "../certs/ca-cert.pem", None)
|
if ctx == None:
|
||||||
ssl = cyassl.SSL_new(ctx)
|
print "Couldn't get SSL CTX for TLSv1"
|
||||||
|
exit(-1)
|
||||||
|
|
||||||
ret = cyassl.CyaSSL_connect(ssl, "localhost", 11111)
|
ret = cyassl.SSL_CTX_load_verify_locations(ctx, "../certs/ca-cert.pem", None)
|
||||||
|
if ret != cyassl.SSL_SUCCESS:
|
||||||
|
print "Couldn't do SSL_CTX_load_verify_locations "
|
||||||
|
print "error string = ", ret
|
||||||
|
exit(-1)
|
||||||
|
|
||||||
|
ssl = cyassl.SSL_new(ctx)
|
||||||
|
ret = cyassl.CyaSSL_swig_connect(ssl, "localhost", 11111)
|
||||||
|
|
||||||
if ret != cyassl.SSL_SUCCESS:
|
if ret != cyassl.SSL_SUCCESS:
|
||||||
print "Couldn't do SSL connect"
|
print "Couldn't do SSL connect"
|
||||||
|
Reference in New Issue
Block a user