summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun Nie <jun.nie@linaro.org>2023-06-12 16:19:38 +0800
committerJun Nie <jun.nie@linaro.org>2023-06-12 16:35:18 +0800
commitba6a9efd4bef152a30c1ffc3be4fee5f30b3d7a3 (patch)
tree36cd6d0d24343bba3895661403af8a9c38763220
parentcc755170584fcbbcb939e236ddb310df26e009e1 (diff)
clean up code and add READMEmbedtls_connection
Signed-off-by: Jun Nie <jun.nie@linaro.org>
-rw-r--r--cmd-in-qemu.txt6
-rw-r--r--ssl_client/README8
-rw-r--r--ssl_client/ta/ssl_client_ta.c5
3 files changed, 11 insertions, 8 deletions
diff --git a/cmd-in-qemu.txt b/cmd-in-qemu.txt
deleted file mode 100644
index fd5e1f5..0000000
--- a/cmd-in-qemu.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-#run server in background of qemu linux console first, then run optee app
-
-echo "ssl_server 2>&1 > /tmp/log" > /tmp/server.sh
-sh /tmp/server.sh &
-optee_example_ssl_client
-
diff --git a/ssl_client/README b/ssl_client/README
new file mode 100644
index 0000000..6d94a8b
--- /dev/null
+++ b/ssl_client/README
@@ -0,0 +1,8 @@
+This is a prototype of TLS connection setup.
+
+Run ssl_server from mbedtls project in background of qemu linux console first,
+then run ssl_client app.
+
+echo "ssl_server 2>&1 > /tmp/log" > /tmp/server.sh
+sh /tmp/server.sh &
+optee_example_ssl_client
diff --git a/ssl_client/ta/ssl_client_ta.c b/ssl_client/ta/ssl_client_ta.c
index b87472d..326f602 100644
--- a/ssl_client/ta/ssl_client_ta.c
+++ b/ssl_client/ta/ssl_client_ta.c
@@ -41,13 +41,14 @@
#include "mbedtls/error.h"
#include "mbedtls/certs.h"
-#include "ca.h"
#include <string.h>
#define DEBUG_LEVEL 4
//#define RAND_TEST
#ifdef RAND_TEST
+#include "ca.h"
+
static int portno = 443;
static const char *host_name = "www.random.org";
static const char *host_payload = "/cgi-bin/randbyte?nbytes=32&format=h";
@@ -192,9 +193,9 @@ mbedtls_printf( "\n ---line %d---", __LINE__ );
/*
* 0. Initialize certificates
*/
- mbedtls_printf( " . Loading the CA root certificate %d bytes ...", sizeof(mozilla_ca_file) );
#ifdef RAND_TEST
+ mbedtls_printf( " . Loading the CA root certificate %d bytes ...", sizeof(mozilla_ca_file) );
ret = mbedtls_x509_crt_parse( &cacert, mozilla_ca_file,
sizeof(mozilla_ca_file) + 1);
#else