From ba6a9efd4bef152a30c1ffc3be4fee5f30b3d7a3 Mon Sep 17 00:00:00 2001 From: Jun Nie Date: Mon, 12 Jun 2023 16:19:38 +0800 Subject: clean up code and add README Signed-off-by: Jun Nie --- cmd-in-qemu.txt | 6 ------ ssl_client/README | 8 ++++++++ ssl_client/ta/ssl_client_ta.c | 5 +++-- 3 files changed, 11 insertions(+), 8 deletions(-) delete mode 100644 cmd-in-qemu.txt create mode 100644 ssl_client/README 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 #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 -- cgit v1.2.3