Simple SSL client with CyaSSL

Dependencies:   CyaSSL EthernetInterface mbed-rtos mbed

Fork of SimpleClient-TCP-FRDM by wolf SSL

Files at this revision

API Documentation at this revision

Comitter:
wolfSSL
Date:
Mon Dec 08 13:08:09 2014 +0000
Parent:
2:2e68626be425
Commit message:
Cleaned

Changed in this revision

EthernetInterface.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/EthernetInterface.lib	Mon Dec 08 06:14:57 2014 +0000
+++ b/EthernetInterface.lib	Mon Dec 08 13:08:09 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/EthernetInterface/#de796e2a5e98
+http://developer.mbed.org/users/wolfSSL/code/EthernetInterface/#a477218b744e
--- a/main.cpp	Mon Dec 08 06:14:57 2014 +0000
+++ b/main.cpp	Mon Dec 08 13:08:09 2014 +0000
@@ -36,7 +36,7 @@
 
 EthernetInterface eth;
 
-main()
+void net_main(void const *av)
 {
     char server_ip[20] ;
 
@@ -52,7 +52,7 @@
     CYASSL*         ssl     = 0;
 
     CYASSL_METHOD* method = CyaTLSv1_2_client_method();
-
+    /* CyaSSL_Debugging_ON() ; */
     /* Initialize CyaSSL Context */
     ctx = CyaSSL_CTX_new(method);
     if (ctx == NULL)
@@ -88,7 +88,7 @@
     }
     printf("SSL Connected\n") ;
 
-    char msg[] = "GET / HTTP/1.0\r\nConnection: Close\r\n\r\n" ;
+    char msg[] = "GET /congrats.html HTTP/1.0\r\nConnection: Close\r\n\r\n" ;
     // const char msg[] = "Hello World\r\n" ;
 
     if (
@@ -105,8 +105,8 @@
         if (n >= 0) {
             buf[n] = 0;
             printf("%s", buf);
-        } else
-            err_sys("CyaSSL_read failed");
+        } else break ;
+
     } while(n > 0) ;
     puts("=== === === ===") ;
     CyaSSL_free(ssl) ; 
@@ -114,3 +114,15 @@
     CyaSSL_CTX_free(ctx) ; 
     eth.disconnect();
 }
+
+
+main()
+{
+
+#define STACK_SIZE 20000
+    Thread t(net_main, NULL, osPriorityNormal, STACK_SIZE);
+
+    while (true) {
+        Thread::wait(1000);
+    }
+}
\ No newline at end of file