Files
wolfssl/examples/echoserver/echoserver.c
T

499 lines
15 KiB
C
Raw Normal View History

2011-07-26 13:27:22 -07:00
/* echoserver.c
*
2026-02-18 09:52:21 -07:00
* Copyright (C) 2006-2026 wolfSSL Inc.
2011-07-26 13:27:22 -07:00
*
2016-03-17 16:02:13 -06:00
* This file is part of wolfSSL.
2011-07-26 13:27:22 -07:00
*
2015-01-06 12:14:15 -07:00
* wolfSSL is free software; you can redistribute it and/or modify
2011-07-26 13:27:22 -07:00
* it under the terms of the GNU General Public License as published by
2025-07-10 16:01:52 -06:00
* the Free Software Foundation; either version 3 of the License, or
2011-07-26 13:27:22 -07:00
* (at your option) any later version.
*
2015-01-06 12:14:15 -07:00
* wolfSSL is distributed in the hope that it will be useful,
2011-07-26 13:27:22 -07:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
2016-03-17 16:02:13 -06:00
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
2011-07-26 13:27:22 -07:00
*/
2011-02-05 11:14:47 -08:00
2016-03-17 16:02:13 -06:00
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
2011-08-04 16:42:55 -06:00
#ifndef WOLFSSL_USER_SETTINGS
#include <wolfssl/options.h>
#endif
#include <wolfssl/wolfcrypt/settings.h>
#undef TEST_OPENSSL_COEXIST /* can't use this option with this example */
#undef OPENSSL_COEXIST /* can't use this option with this example */
2023-08-01 10:17:38 -04:00
#include <wolfssl/ssl.h> /* name change portability layer */
#include <wolfssl/wolfcrypt/settings.h>
#ifdef HAVE_ECC
2023-08-01 10:17:38 -04:00
#include <wolfssl/wolfcrypt/ecc.h> /* ecc_fp_free */
#endif
#if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET)
2014-04-11 16:20:12 +09:00
#include <stdio.h>
#include <string.h>
2018-01-01 11:57:31 +09:00
#include "cmsis_os.h"
#include "rl_fs.h"
#include "rl_net.h"
#include "wolfssl_MDK_ARM.h"
2013-05-16 09:47:27 -07:00
#endif
2023-08-01 10:17:38 -04:00
#include <wolfssl/ssl.h>
#include <wolfssl/test.h>
2011-02-05 11:14:47 -08:00
#ifndef NO_MAIN_DRIVER
#define ECHO_OUT
#endif
#include "examples/echoserver/echoserver.h"
#if !defined(NO_WOLFSSL_SERVER) && !defined(NO_TLS)
2020-10-09 09:45:00 -07:00
#ifdef NO_FILESYSTEM
#ifdef NO_RSA
#error currently the example only tries to load in a RSA buffer
#endif
#undef USE_CERT_BUFFERS_2048
#define USE_CERT_BUFFERS_2048
#include <wolfssl/certs_test.h>
#endif
#ifdef WOLFSSL_ASYNC_CRYPT
static int devId = INVALID_DEVID;
#endif
2013-05-16 09:47:27 -07:00
#define SVR_COMMAND_SIZE 256
2011-02-05 11:14:47 -08:00
static void SignalReady(void* args, word16 port)
2011-02-05 11:14:47 -08:00
{
2023-07-25 19:27:48 +02:00
#if defined(NO_MAIN_DRIVER) && defined(WOLFSSL_COND)
2011-02-05 11:14:47 -08:00
/* signal ready to tcp_accept */
func_args* server_args = (func_args*)args;
tcp_ready* ready = server_args->signal;
THREAD_CHECK_RET(wolfSSL_CondStart(&ready->cond));
2011-02-05 11:14:47 -08:00
ready->ready = 1;
ready->port = port;
THREAD_CHECK_RET(wolfSSL_CondSignal(&ready->cond));
THREAD_CHECK_RET(wolfSSL_CondEnd(&ready->cond));
2023-07-25 19:27:48 +02:00
#endif /* NO_MAIN_DRIVER && WOLFSSL_COND */
2012-09-20 15:39:15 -07:00
(void)args;
(void)port;
2011-02-05 11:14:47 -08:00
}
2023-07-31 15:36:38 -04:00
THREAD_RETURN WOLFSSL_THREAD echoserver_test(void* args)
2011-02-05 11:14:47 -08:00
{
SOCKET_T sockfd = 0;
2023-07-31 15:36:38 -04:00
WOLFSSL_METHOD* method = 0;
WOLFSSL_CTX* ctx = 0;
2011-02-05 11:14:47 -08:00
int ret = 0;
2020-01-15 22:15:38 +10:00
int doPSK;
2011-02-05 11:14:47 -08:00
int outCreated = 0;
2012-09-20 15:39:15 -07:00
int shutDown = 0;
int useAnyAddr = 0;
word16 port;
2011-02-05 11:14:47 -08:00
int argc = ((func_args*)args)->argc;
char** argv = ((func_args*)args)->argv;
2023-07-31 15:36:38 -04:00
char buffer[WOLFSSL_MAX_ERROR_SZ];
#ifdef HAVE_TEST_SESSION_TICKET
MyTicketCtx myTicketCtx;
#endif
2011-02-05 11:14:47 -08:00
#ifdef ECHO_OUT
FILE* fout = stdout;
if (argc >= 2) {
fout = fopen(argv[1], "w");
outCreated = 1;
}
if (!fout) err_sys("can't open output file");
#endif
2012-09-20 15:39:15 -07:00
(void)outCreated;
(void)argc;
(void)argv;
2011-02-05 11:14:47 -08:00
((func_args*)args)->return_code = -1; /* error state */
2020-02-19 18:07:45 +10:00
#if (defined(NO_RSA) && !defined(HAVE_ECC) && !defined(HAVE_ED25519) && \
2023-07-31 15:36:38 -04:00
!defined(HAVE_ED448)) || defined(WOLFSSL_LEANPSK)
2013-03-11 13:19:43 -07:00
doPSK = 1;
2020-01-15 22:15:38 +10:00
#else
doPSK = 0;
2012-10-30 12:51:14 -07:00
#endif
2023-07-31 15:36:38 -04:00
#if defined(NO_MAIN_DRIVER) && !defined(WOLFSSL_SNIFFER) && \
!defined(WOLFSSL_MDK_SHELL) && !defined(WOLFSSL_TIRTOS) && \
2016-06-16 16:39:18 -06:00
!defined(USE_WINDOWS_API)
/* Let tcp_listen assign port */
port = 0;
#else
/* Use default port */
port = wolfSSLPort;
#endif
#if defined(USE_ANY_ADDR)
useAnyAddr = 1;
#endif
2014-05-08 15:52:20 -07:00
2023-07-31 15:36:38 -04:00
#ifdef WOLFSSL_TIRTOS
2014-09-08 19:40:03 -07:00
fdOpenSession(Task_self());
2014-05-08 15:52:20 -07:00
#endif
tcp_listen(&sockfd, &port, useAnyAddr, 0, 0);
2011-02-05 11:14:47 -08:00
#if !defined(NO_TLS)
2021-09-23 18:37:53 -04:00
#if defined(WOLFSSL_TLS13) && defined(WOLFSSL_SNIFFER)
2023-08-01 17:55:38 -04:00
method = wolfTLSv1_2_server_method();
2020-06-04 16:42:40 -07:00
#else
2023-08-01 10:17:38 -04:00
method = wolfSSLv23_server_method();
2020-06-04 16:42:40 -07:00
#endif
2015-08-12 16:39:13 -07:00
#elif defined(WOLFSSL_ALLOW_SSLV3)
2023-08-01 10:17:38 -04:00
method = wolfSSLv3_server_method();
2015-08-12 16:39:13 -07:00
#else
#error "no valid server method built in"
2011-02-05 11:14:47 -08:00
#endif
2023-08-01 10:17:38 -04:00
ctx = wolfSSL_CTX_new(method);
/* wolfSSL_CTX_set_session_cache_mode(ctx, WOLFSSL_SESS_CACHE_OFF); */
2011-02-05 11:14:47 -08:00
#ifdef WOLFSSL_ENCRYPTED_KEYS
2023-08-01 10:17:38 -04:00
wolfSSL_CTX_set_default_passwd_cb(ctx, PasswordCallBack);
2011-02-05 11:14:47 -08:00
#endif
#ifdef HAVE_TEST_SESSION_TICKET
if (TicketInit() != 0)
err_sys("unable to setup Session Ticket Key context");
wolfSSL_CTX_set_TicketEncCb(ctx, myTicketEncCb);
XMEMSET(&myTicketCtx, 0, sizeof(myTicketCtx));
wolfSSL_CTX_set_TicketEncCtx(ctx, &myTicketCtx);
#endif
2011-02-05 11:14:47 -08:00
#ifndef NO_FILESYSTEM
2013-03-11 13:19:43 -07:00
if (doPSK == 0) {
2023-07-31 15:36:38 -04:00
#if defined(HAVE_ECC) && !defined(WOLFSSL_SNIFFER)
2011-02-05 11:14:47 -08:00
/* ecc */
if (wolfSSL_CTX_use_certificate_file(ctx, eccCertFile, CERT_FILETYPE)
!= WOLFSSL_SUCCESS)
err_sys("can't load server cert file, "
2015-01-20 12:36:20 -07:00
"Please run from wolfSSL home dir");
2011-02-05 11:14:47 -08:00
if (wolfSSL_CTX_use_PrivateKey_file(ctx, eccKeyFile, CERT_FILETYPE)
!= WOLFSSL_SUCCESS)
err_sys("can't load server key file, "
2015-01-20 12:36:20 -07:00
"Please run from wolfSSL home dir");
2023-07-31 15:36:38 -04:00
#elif defined(HAVE_ED25519) && !defined(WOLFSSL_SNIFFER)
/* ed25519 */
2023-08-01 10:17:38 -04:00
if (wolfSSL_CTX_use_certificate_chain_file(ctx, edCertFile)
!= WOLFSSL_SUCCESS)
err_sys("can't load server cert file, "
"Please run from wolfSSL home dir");
if (wolfSSL_CTX_use_PrivateKey_file(ctx, edKeyFile, CERT_FILETYPE)
!= WOLFSSL_SUCCESS)
err_sys("can't load server key file, "
"Please run from wolfSSL home dir");
2023-07-31 15:36:38 -04:00
#elif defined(HAVE_ED448) && !defined(WOLFSSL_SNIFFER)
2020-02-19 18:07:45 +10:00
/* ed448 */
2023-08-01 10:17:38 -04:00
if (wolfSSL_CTX_use_certificate_chain_file(ctx, ed448CertFile)
2020-02-19 18:07:45 +10:00
!= WOLFSSL_SUCCESS)
err_sys("can't load server cert file, "
"Please run from wolfSSL home dir");
2023-08-01 10:17:38 -04:00
if (wolfSSL_CTX_use_PrivateKey_file(ctx, ed448KeyFile,
CERT_FILETYPE) != WOLFSSL_SUCCESS)
2020-02-19 18:07:45 +10:00
err_sys("can't load server key file, "
"Please run from wolfSSL home dir");
#elif defined(NO_CERTS)
/* do nothing, just don't load cert files */
2011-02-05 11:14:47 -08:00
#else
/* normal */
if (wolfSSL_CTX_use_certificate_file(ctx, svrCertFile, CERT_FILETYPE)
!= WOLFSSL_SUCCESS)
err_sys("can't load server cert file, "
2015-01-20 12:36:20 -07:00
"Please run from wolfSSL home dir");
2011-02-05 11:14:47 -08:00
if (wolfSSL_CTX_use_PrivateKey_file(ctx, svrKeyFile, CERT_FILETYPE)
!= WOLFSSL_SUCCESS)
err_sys("can't load server key file, "
2015-01-20 12:36:20 -07:00
"Please run from wolfSSL home dir");
2011-02-05 11:14:47 -08:00
#endif
2013-03-11 13:19:43 -07:00
} /* doPSK */
#elif !defined(NO_CERTS)
2013-03-11 13:19:43 -07:00
if (!doPSK) {
2023-08-01 10:17:38 -04:00
if (wolfSSL_CTX_use_certificate_buffer(ctx, server_cert_der_2048,
2020-10-09 09:45:00 -07:00
sizeof_server_cert_der_2048, WOLFSSL_FILETYPE_ASN1)
!= WOLFSSL_SUCCESS)
err_sys("can't load server cert buffer");
2023-08-01 10:17:38 -04:00
if (wolfSSL_CTX_use_PrivateKey_buffer(ctx, server_key_der_2048,
2020-10-09 09:45:00 -07:00
sizeof_server_key_der_2048, WOLFSSL_FILETYPE_ASN1)
!= WOLFSSL_SUCCESS)
err_sys("can't load server key buffer");
2012-10-30 12:51:14 -07:00
}
2011-02-05 11:14:47 -08:00
#endif
2023-07-31 15:36:38 -04:00
#if defined(WOLFSSL_SNIFFER)
/* Only set if not running testsuite */
if (XSTRSTR(argv[0], "testsuite") == NULL) {
/* don't use EDH, can't sniff tmp keys */
2023-08-01 10:17:38 -04:00
wolfSSL_CTX_set_cipher_list(ctx, "AES256-SHA");
}
#endif
2013-03-11 13:19:43 -07:00
if (doPSK) {
#ifndef NO_PSK
const char *defaultCipherList;
2023-08-01 10:17:38 -04:00
wolfSSL_CTX_set_psk_server_callback(ctx, my_psk_server_cb);
wolfSSL_CTX_use_psk_identity_hint(ctx, "cyassl server");
2013-03-11 13:19:43 -07:00
#ifdef HAVE_NULL_CIPHER
defaultCipherList = "PSK-NULL-SHA256";
2015-08-14 12:49:30 -07:00
#elif defined(HAVE_AESGCM) && !defined(NO_DH)
#ifdef WOLFSSL_TLS13
2020-10-28 11:47:31 +10:00
defaultCipherList = "TLS13-AES128-GCM-SHA256"
#ifndef WOLFSSL_NO_TLS12
":DHE-PSK-AES128-GCM-SHA256"
#endif
;
#else
2015-08-14 12:49:30 -07:00
defaultCipherList = "DHE-PSK-AES128-GCM-SHA256";
#endif
2020-10-28 11:47:31 +10:00
#elif defined(HAVE_AESGCM) && defined(WOLFSSL_TLS13)
defaultCipherList = "TLS13-AES128-GCM-SHA256"
#ifndef WOLFSSL_NO_TLS12
":PSK-AES128-GCM-SHA256"
#endif
;
2013-03-11 13:19:43 -07:00
#else
defaultCipherList = "PSK-AES128-CBC-SHA256";
#endif
2023-08-01 10:17:38 -04:00
if (wolfSSL_CTX_set_cipher_list(ctx, defaultCipherList) != WOLFSSL_SUCCESS)
2013-03-11 13:19:43 -07:00
err_sys("server can't set cipher list 2");
wolfSSL_CTX_set_psk_callback_ctx(ctx, (void*)defaultCipherList);
2012-10-30 12:51:14 -07:00
#endif
}
#ifdef WOLFSSL_ASYNC_CRYPT
ret = wolfAsync_DevOpen(&devId);
if (ret < 0) {
2022-05-12 13:07:32 -05:00
fprintf(stderr, "Async device open failed\nRunning without async\n");
}
wolfSSL_CTX_SetDevId(ctx, devId);
#endif /* WOLFSSL_ASYNC_CRYPT */
SignalReady(args, port);
2011-02-05 11:14:47 -08:00
2012-09-20 15:39:15 -07:00
while (!shutDown) {
2023-07-31 15:36:38 -04:00
WOLFSSL* ssl = NULL;
WOLFSSL* write_ssl = NULL; /* may have separate w/ HAVE_WRITE_DUP */
2013-05-16 09:47:27 -07:00
char command[SVR_COMMAND_SIZE+1];
int clientfd;
int firstRead = 1;
int gotFirstG = 0;
int err = 0;
2011-02-05 11:14:47 -08:00
SOCKADDR_IN_T client;
socklen_t client_len = sizeof(client);
clientfd = accept(sockfd, (struct sockaddr*)&client,
(ACCEPT_THIRD_T)&client_len);
if (WOLFSSL_SOCKET_IS_INVALID(clientfd)) err_sys("tcp accept failed");
2011-02-05 11:14:47 -08:00
2023-08-01 10:17:38 -04:00
ssl = wolfSSL_new(ctx);
2011-02-05 11:14:47 -08:00
if (ssl == NULL) err_sys("SSL_new failed");
2023-08-01 10:17:38 -04:00
wolfSSL_set_fd(ssl, clientfd);
2015-03-27 14:28:05 -07:00
#if !defined(NO_FILESYSTEM) && !defined(NO_DH) && !defined(NO_ASN)
wolfSSL_SetTmpDH_file(ssl, dhParamFile, CERT_FILETYPE);
#elif !defined(NO_DH)
2011-11-01 16:17:45 -07:00
SetDH(ssl); /* will repick suites with DHE, higher than PSK */
#endif
2025-08-10 19:56:00 +10:00
WOLFSSL_ASYNC_WHILE_PENDING(ret = wolfSSL_accept(ssl),
ret != WOLFSSL_SUCCESS);
if (ret != WOLFSSL_SUCCESS) {
2022-05-12 13:07:32 -05:00
fprintf(stderr, "SSL_accept error = %d, %s\n", err,
2024-05-08 10:14:53 -04:00
wolfSSL_ERR_error_string((unsigned long)err, buffer));
2022-05-12 13:07:32 -05:00
fprintf(stderr, "SSL_accept failed\n");
2023-08-01 10:17:38 -04:00
wolfSSL_free(ssl);
2011-02-05 11:14:47 -08:00
CloseSocket(clientfd);
continue;
}
#if defined(PEER_INFO)
showPeer(ssl);
#endif
2011-02-05 11:14:47 -08:00
#ifdef HAVE_WRITE_DUP
write_ssl = wolfSSL_write_dup(ssl);
if (write_ssl == NULL) {
2022-05-12 13:07:32 -05:00
fprintf(stderr, "wolfSSL_write_dup failed\n");
2023-08-01 10:17:38 -04:00
wolfSSL_free(ssl);
CloseSocket(clientfd);
continue;
}
#else
write_ssl = ssl;
#endif
while (1) {
2023-04-03 16:51:07 +10:00
int echoSz;
2025-08-10 19:56:00 +10:00
WOLFSSL_ASYNC_WHILE_PENDING(ret = wolfSSL_read(ssl, command, sizeof(command)-1),
ret <= 0);
if (ret <= 0) {
if (err != WOLFSSL_ERROR_WANT_READ && err != WOLFSSL_ERROR_ZERO_RETURN){
2022-05-12 13:07:32 -05:00
fprintf(stderr, "SSL_read echo error %d, %s!\n", err,
2024-05-08 10:14:53 -04:00
wolfSSL_ERR_error_string((unsigned long)err, buffer));
}
break;
}
echoSz = ret;
if (firstRead == 1) {
firstRead = 0; /* browser may send 1 byte 'G' to start */
if (echoSz == 1 && command[0] == 'G') {
gotFirstG = 1;
continue;
}
}
else if (gotFirstG == 1 && strncmp(command, "ET /", 4) == 0) {
strncpy(command, "GET", 4);
/* fall through to normal GET */
}
2011-02-05 11:14:47 -08:00
if ( strncmp(command, "quit", 4) == 0) {
printf("client sent quit command: shutting down!\n");
2012-09-20 15:39:15 -07:00
shutDown = 1;
2011-02-05 11:14:47 -08:00
break;
}
if ( strncmp(command, "break", 5) == 0) {
printf("client sent break command: closing session!\n");
break;
}
#ifdef PRINT_SESSION_STATS
2011-02-05 11:14:47 -08:00
if ( strncmp(command, "printstats", 10) == 0) {
2023-08-01 10:17:38 -04:00
wolfSSL_PrintSessionStats();
2011-02-05 11:14:47 -08:00
break;
}
#endif
2018-06-11 13:39:49 -07:00
if (strncmp(command, "GET", 3) == 0) {
const char resp[] =
"HTTP/1.0 200 ok\r\nContent-type: text/html\r\n\r\n"
"<html><body BGCOLOR=\"#ffffff\"><pre>\r\n"
2020-01-22 16:23:46 -08:00
"greetings from wolfSSL\r\n</pre></body></html>\r\n\r\n";
2018-06-11 13:39:49 -07:00
echoSz = (int)strlen(resp) + 1;
if (echoSz > (int)sizeof(command)) {
/* Internal error. */
err_sys("HTTP response greater than buffer.");
}
strncpy(command, resp, sizeof(command));
2011-02-05 11:14:47 -08:00
2025-08-10 19:56:00 +10:00
WOLFSSL_ASYNC_WHILE_PENDING(ret = wolfSSL_write(write_ssl, command, echoSz),
ret <= 0);
if (ret != echoSz) {
2022-05-12 13:07:32 -05:00
fprintf(stderr, "SSL_write get error = %d, %s\n", err,
2024-05-08 10:14:53 -04:00
wolfSSL_ERR_error_string((unsigned long)err, buffer));
err_sys("SSL_write get failed");
}
2011-02-05 11:14:47 -08:00
break;
}
command[echoSz] = 0;
#ifdef ECHO_OUT
LIBCALL_CHECK_RET(fputs(command, fout));
#endif
2011-02-05 11:14:47 -08:00
2025-08-10 19:56:00 +10:00
WOLFSSL_ASYNC_WHILE_PENDING(ret = wolfSSL_write(write_ssl, command, echoSz),
ret <= 0);
if (ret != echoSz) {
2022-05-12 13:07:32 -05:00
fprintf(stderr, "SSL_write echo error = %d, %s\n", err,
2024-05-08 10:14:53 -04:00
wolfSSL_ERR_error_string((unsigned long)err, buffer));
err_sys("SSL_write echo failed");
}
2011-02-05 11:14:47 -08:00
}
2023-08-01 10:17:38 -04:00
wolfSSL_shutdown(ssl);
#ifdef HAVE_WRITE_DUP
2023-08-01 10:17:38 -04:00
wolfSSL_free(write_ssl);
2011-02-05 11:14:47 -08:00
#endif
2023-08-01 10:17:38 -04:00
wolfSSL_free(ssl);
2011-02-05 11:14:47 -08:00
CloseSocket(clientfd);
}
CloseSocket(sockfd);
2023-08-01 10:17:38 -04:00
wolfSSL_CTX_free(ctx);
2011-02-05 11:14:47 -08:00
#ifdef ECHO_OUT
if (outCreated)
fclose(fout);
#endif
((func_args*)args)->return_code = 0;
2014-05-08 15:52:20 -07:00
#if defined(NO_MAIN_DRIVER) && defined(HAVE_ECC) && defined(FP_ECC) \
&& defined(HAVE_THREAD_LS)
2023-08-01 10:17:38 -04:00
wc_ecc_fp_free(); /* free per thread cache */
#endif
2023-07-31 15:36:38 -04:00
#ifdef WOLFSSL_TIRTOS
2014-09-08 19:40:03 -07:00
fdCloseSession(Task_self());
2014-05-08 15:52:20 -07:00
#endif
#ifdef HAVE_TEST_SESSION_TICKET
TicketCleanup();
#endif
#ifdef WOLFSSL_ASYNC_CRYPT
wolfAsync_DevClose(&devId);
#endif
2023-07-25 19:27:48 +02:00
WOLFSSL_RETURN_FROM_THREAD(0);
2011-02-05 11:14:47 -08:00
}
#endif /* !NO_WOLFSSL_SERVER && !NO_TLS */
2011-02-05 11:14:47 -08:00
/* so overall tests can pull in test function */
#ifndef NO_MAIN_DRIVER
int main(int argc, char** argv)
{
func_args args;
#ifdef HAVE_WNR
if (wc_InitNetRandom(wnrConfig, NULL, 5000) != 0)
err_sys("Whitewood netRandom global config failed");
#endif
2011-02-05 11:14:47 -08:00
StartTCP();
args.argc = argc;
args.argv = argv;
args.return_code = 0;
2011-02-05 11:14:47 -08:00
2023-08-01 10:17:38 -04:00
wolfSSL_Init();
2023-07-31 15:36:38 -04:00
#if defined(DEBUG_WOLFSSL) && !defined(WOLFSSL_MDK_SHELL)
2023-08-01 10:17:38 -04:00
wolfSSL_Debugging_ON();
2011-02-05 11:14:47 -08:00
#endif
ChangeToWolfRoot();
#if !defined(NO_WOLFSSL_SERVER) && !defined(NO_TLS)
2011-02-05 11:14:47 -08:00
echoserver_test(&args);
#endif
2023-08-01 10:17:38 -04:00
wolfSSL_Cleanup();
2011-02-05 11:14:47 -08:00
#ifdef HAVE_WNR
if (wc_FreeNetRandom() < 0)
err_sys("Failed to free netRandom context");
#endif /* HAVE_WNR */
2011-02-05 11:14:47 -08:00
return args.return_code;
}
#endif /* NO_MAIN_DRIVER */