Update WolfSSL library to the latest version.

This commit is contained in:
Richard Barry 2015-08-28 13:46:22 +00:00
parent 8af1ad9bac
commit 5a6242fbd0
443 changed files with 70230 additions and 45414 deletions

View file

@ -1,40 +1,43 @@
# file: runme.py
import cyassl
import wolfssl
print ""
print "Trying to connect to the echo server..."
print "Trying to connect to the example server -d..."
cyassl.CyaSSL_Init()
#cyassl.CyaSSL_Debugging_ON()
ctx = cyassl.CyaSSL_CTX_new(cyassl.CyaTLSv1_client_method())
wolfssl.wolfSSL_Init()
#wolfssl.wolfSSL_Debugging_ON()
ctx = wolfssl.wolfSSL_CTX_new(wolfssl.wolfTLSv1_2_client_method())
if ctx == None:
print "Couldn't get SSL CTX for TLSv1"
print "Couldn't get SSL CTX for TLSv1.2"
exit(-1)
ret = cyassl.CyaSSL_CTX_load_verify_locations(ctx, "../certs/ca-cert.pem", None)
if ret != cyassl.SSL_SUCCESS:
ret = wolfssl.wolfSSL_CTX_load_verify_locations(ctx, "../certs/ca-cert.pem", None)
if ret != wolfssl.SSL_SUCCESS:
print "Couldn't do SSL_CTX_load_verify_locations "
print "error string = ", ret
print "error string = ", ret
exit(-1)
ssl = cyassl.CyaSSL_new(ctx)
ret = cyassl.CyaSSL_swig_connect(ssl, "localhost", 11111)
ssl = wolfssl.wolfSSL_new(ctx)
ret = wolfssl.wolfSSL_swig_connect(ssl, "localhost", 11111)
if ret != cyassl.SSL_SUCCESS:
if ret != wolfssl.SSL_SUCCESS:
print "Couldn't do SSL connect"
err = cyassl.CyaSSL_get_error(ssl, 0)
print "error string = ", cyassl.CyaSSL_error_string(err)
err = wolfssl.wolfSSL_get_error(ssl, 0)
if ret == -2:
print "tcp error, is example server running?"
else:
print "error string = ", wolfssl.wolfSSL_error_string(err)
exit(-1)
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:
print "Wrote ", written, " bytes"
byteArray = cyassl.byteArray(100)
readBytes = cyassl.CyaSSL_read(ssl, byteArray, 100)
byteArray = wolfssl.byteArray(100)
readBytes = wolfssl.wolfSSL_read(ssl, byteArray, 100)
print "server reply: ", cyassl.cdata(byteArray, readBytes)
print "server reply: ", wolfssl.cdata(byteArray, readBytes)