diff --git a/.gitignore b/.gitignore index c0290918..cce5f5aa 100644 --- a/.gitignore +++ b/.gitignore @@ -60,6 +60,7 @@ android/wolfssljni-ndk-sample/proguard-project.txt /tls/client-tcp /tls/client-tls +/tls/client-tls-cacb /tls/client-tls-callback /tls/client-tls-ecdhe /tls/client-tls-nonblocking diff --git a/embedded/tls-client-server.c b/embedded/tls-client-server.c index 548b079d..b16bae45 100644 --- a/embedded/tls-client-server.c +++ b/embedded/tls-client-server.c @@ -19,11 +19,15 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#ifndef WOLFSSL_USER_SETTINGS + #include +#endif +#include #include #include "certs.h" +#if !defined(NO_WOLFSSL_CLIENT) && !defined(NO_WOLFSSL_SERVER) /* I/O buffer size - wolfSSL buffers messages internally as well. */ #define BUFFER_SIZE 2048 @@ -478,3 +482,14 @@ int main(int argc, char* argv[]) return (ret == 0) ? 0 : 1; } +#else + +int main(int argc, char* argv[]) +{ + (void)argc; + (void)argv; + printf("Must build wolfSSL with client and server enabled for this example\n"); + return 0; +} + +#endif diff --git a/embedded/tls-server-size.c b/embedded/tls-server-size.c index 58295db4..b7d53ddb 100644 --- a/embedded/tls-server-size.c +++ b/embedded/tls-server-size.c @@ -21,11 +21,16 @@ #include -#include +#ifndef WOLFSSL_USER_SETTINGS + #include +#endif +#include #include #include "certs.h" +#if !defined(NO_WOLFSSL_SERVER) && !defined(WOLFSSL_NO_TLS12) + /* I/O buffer size - wolfSSL buffers messages internally as well. */ #define BUFFER_SIZE 2048 /* Size of static buffer for dynamic memory allocation. */ @@ -296,3 +301,15 @@ int main(int argc, char* argv[]) return (ret == 0) ? 0 : 1; } + +#else + +int main(int argc, char* argv[]) +{ + (void)argc; + (void)argv; + printf("Must build wolfSSL with TLS v1.2 and server enabled for this example\n"); + return 0; +} + +#endif diff --git a/embedded/tls-sock-client-ca.c b/embedded/tls-sock-client-ca.c index 1af1f212..07201020 100644 --- a/embedded/tls-sock-client-ca.c +++ b/embedded/tls-sock-client-ca.c @@ -19,7 +19,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#ifndef WOLFSSL_USER_SETTINGS + #include +#endif +#include #include #include @@ -27,6 +30,8 @@ #include "tls-info.h" #include "certs.h" +#if !defined(NO_WOLFSSL_CLIENT) + /* Application data to send. */ static const char msgHTTPGet[] = "GET /index.html HTTP/1.0\r\n\r\n"; @@ -264,3 +269,15 @@ int main(int argc, char* argv[]) return (ret == 0) ? 0 : 1; } + +#else + +int main(int argc, char* argv[]) +{ + (void)argc; + (void)argv; + printf("Must build wolfSSL with client enabled for this example\n"); + return 0; +} + +#endif diff --git a/embedded/tls-sock-client.c b/embedded/tls-sock-client.c index 5b9c7ca2..eebb8b43 100644 --- a/embedded/tls-sock-client.c +++ b/embedded/tls-sock-client.c @@ -19,7 +19,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#ifndef WOLFSSL_USER_SETTINGS + #include +#endif +#include #include #include @@ -27,6 +30,8 @@ #include "tls-info.h" #include "certs.h" +#if !defined(NO_WOLFSSL_CLIENT) + /* Application data to send. */ static const char msgHTTPGet[] = "GET /index.html HTTP/1.0\r\n\r\n"; @@ -244,3 +249,14 @@ int main(int argc, char* argv[]) return (ret == 0) ? 0 : 1; } +#else + +int main(int argc, char* argv[]) +{ + (void)argc; + (void)argv; + printf("Must build wolfSSL with client enabled for this example\n"); + return 0; +} + +#endif diff --git a/embedded/tls-sock-server-ca.c b/embedded/tls-sock-server-ca.c index 0b6e96d5..15762a80 100644 --- a/embedded/tls-sock-server-ca.c +++ b/embedded/tls-sock-server-ca.c @@ -19,13 +19,18 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#ifndef WOLFSSL_USER_SETTINGS + #include +#endif +#include #include #include "sockets.h" #include "tls-info.h" #include "certs.h" +#if !defined(NO_WOLFSSL_SERVER) + /* Application data to send. */ static const char msgHTTPIndex[] = "HTTP/1.1 200 OK\n" @@ -296,3 +301,14 @@ int main(int argc, char* argv[]) return (ret == 0) ? 0 : 1; } +#else + +int main(int argc, char* argv[]) +{ + (void)argc; + (void)argv; + printf("Must build wolfSSL with server enabled for this example\n"); + return 0; +} + +#endif diff --git a/embedded/tls-sock-server.c b/embedded/tls-sock-server.c index 3358d26e..7c737dd6 100644 --- a/embedded/tls-sock-server.c +++ b/embedded/tls-sock-server.c @@ -19,13 +19,18 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#ifndef WOLFSSL_USER_SETTINGS + #include +#endif +#include #include #include "sockets.h" #include "tls-info.h" #include "certs.h" +#if !defined(NO_WOLFSSL_SERVER) + /* Application data to send. */ static const char msgHTTPIndex[] = "HTTP/1.1 200 OK\n" @@ -282,3 +287,14 @@ int main(int argc, char* argv[]) return (ret == 0) ? 0 : 1; } +#else + +int main(int argc, char* argv[]) +{ + (void)argc; + (void)argv; + printf("Must build wolfSSL with server enabled for this example\n"); + return 0; +} + +#endif diff --git a/embedded/tls-sock-threaded.c b/embedded/tls-sock-threaded.c index 1f4aaa55..716ce78c 100644 --- a/embedded/tls-sock-threaded.c +++ b/embedded/tls-sock-threaded.c @@ -19,10 +19,14 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#ifndef WOLFSSL_USER_SETTINGS + #include +#endif +#include #include -#ifndef SINGLE_THREADED +#if !defined(SINGLE_THREADED) && !defined(NO_WOLFSSL_CLIENT) && \ + !defined(NO_WOLFSSL_SERVER) #include "sockets.h" #include "threading.h" @@ -460,9 +464,8 @@ int main(int argc, char* argv[]) int main(int argc, char* argv[]) { - printf("Threading required - compile wolfSSL without SINGLE_THREAED\n"); + printf("Threading and TLS client and server required - compile wolfSSL without SINGLE_THREAED\n"); return 0; } #endif - diff --git a/embedded/tls-threaded.c b/embedded/tls-threaded.c index 00c3c19a..1307a729 100644 --- a/embedded/tls-threaded.c +++ b/embedded/tls-threaded.c @@ -19,10 +19,14 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#ifndef WOLFSSL_USER_SETTINGS + #include +#endif +#include #include -#ifndef SINGLE_THREADED +#if !defined(SINGLE_THREADED) && !defined(NO_WOLFSSL_CLIENT) && \ + !defined(NO_WOLFSSL_SERVER) #include "threading.h" #include "certs.h" @@ -487,7 +491,9 @@ int main(int argc, char* argv[]) int main(int argc, char* argv[]) { - printf("Requires threading - compile wolfssl without SINGLE_THREADED\n"); + (void)argc; + (void)argv; + printf("Threading and TLS client and server required - compile wolfSSL without SINGLE_THREAED\n"); return 0; } diff --git a/tls/client-tls-cacb b/tls/client-tls-cacb new file mode 100755 index 00000000..3258865c Binary files /dev/null and b/tls/client-tls-cacb differ