forked from wolfSSL/wolfssl
Merge pull request #1313 from JacobBarthelmeh/Testing
DHE suite with test case and set server/client method
This commit is contained in:
41
tests/api.c
41
tests/api.c
@@ -1072,13 +1072,11 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_nofail(void* args)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NO_PSK
|
|
||||||
#if !defined(NO_FILESYSTEM) && !defined(NO_DH)
|
#if !defined(NO_FILESYSTEM) && !defined(NO_DH)
|
||||||
wolfSSL_SetTmpDH_file(ssl, dhParamFile, WOLFSSL_FILETYPE_PEM);
|
wolfSSL_SetTmpDH_file(ssl, dhParamFile, WOLFSSL_FILETYPE_PEM);
|
||||||
#elif !defined(NO_DH)
|
#elif !defined(NO_DH)
|
||||||
SetDH(ssl); /* will repick suites with DHE, higher priority than PSK */
|
SetDH(ssl); /* will repick suites with DHE, higher priority than PSK */
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
/* call ssl setup callback */
|
/* call ssl setup callback */
|
||||||
if (cbf != NULL && cbf->ssl_ready != NULL) {
|
if (cbf != NULL && cbf->ssl_ready != NULL) {
|
||||||
@@ -15947,7 +15945,7 @@ static int test_tls13_apis(void)
|
|||||||
|
|
||||||
#ifdef HAVE_PK_CALLBACKS
|
#ifdef HAVE_PK_CALLBACKS
|
||||||
#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) && !defined(NO_RSA) && \
|
#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) && !defined(NO_RSA) && \
|
||||||
!defined(NO_WOLFSSL_CLIENT) && !defined(NO_DH) && \
|
!defined(NO_WOLFSSL_CLIENT) && !defined(NO_DH) && !defined(NO_AES) && \
|
||||||
defined(HAVE_IO_TESTS_DEPENDENCIES) && !defined(SINGLE_THREADED)
|
defined(HAVE_IO_TESTS_DEPENDENCIES) && !defined(SINGLE_THREADED)
|
||||||
static int my_DhCallback(WOLFSSL* ssl, struct DhKey* key,
|
static int my_DhCallback(WOLFSSL* ssl, struct DhKey* key,
|
||||||
const unsigned char* priv, unsigned int privSz,
|
const unsigned char* priv, unsigned int privSz,
|
||||||
@@ -16001,7 +15999,7 @@ static void test_dh_ssl_setup_fail(WOLFSSL* ssl)
|
|||||||
static void test_DhCallbacks(void)
|
static void test_DhCallbacks(void)
|
||||||
{
|
{
|
||||||
#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) && !defined(NO_RSA) && \
|
#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) && !defined(NO_RSA) && \
|
||||||
!defined(NO_WOLFSSL_CLIENT) && !defined(NO_DH) && \
|
!defined(NO_WOLFSSL_CLIENT) && !defined(NO_DH) && !defined(NO_AES) && \
|
||||||
defined(HAVE_IO_TESTS_DEPENDENCIES) && !defined(SINGLE_THREADED)
|
defined(HAVE_IO_TESTS_DEPENDENCIES) && !defined(SINGLE_THREADED)
|
||||||
WOLFSSL_CTX *ctx;
|
WOLFSSL_CTX *ctx;
|
||||||
WOLFSSL *ssl;
|
WOLFSSL *ssl;
|
||||||
@@ -16009,7 +16007,8 @@ static void test_DhCallbacks(void)
|
|||||||
func_args server_args;
|
func_args server_args;
|
||||||
func_args client_args;
|
func_args client_args;
|
||||||
THREAD_TYPE serverThread;
|
THREAD_TYPE serverThread;
|
||||||
callback_functions func_cb;
|
callback_functions func_cb_client;
|
||||||
|
callback_functions func_cb_server;
|
||||||
int test;
|
int test;
|
||||||
|
|
||||||
printf(testingFmt, "test_DhCallbacks");
|
printf(testingFmt, "test_DhCallbacks");
|
||||||
@@ -16040,7 +16039,8 @@ static void test_DhCallbacks(void)
|
|||||||
#endif
|
#endif
|
||||||
XMEMSET(&server_args, 0, sizeof(func_args));
|
XMEMSET(&server_args, 0, sizeof(func_args));
|
||||||
XMEMSET(&client_args, 0, sizeof(func_args));
|
XMEMSET(&client_args, 0, sizeof(func_args));
|
||||||
XMEMSET(&func_cb, 0, sizeof(callback_functions));
|
XMEMSET(&func_cb_client, 0, sizeof(callback_functions));
|
||||||
|
XMEMSET(&func_cb_server, 0, sizeof(callback_functions));
|
||||||
|
|
||||||
StartTCP();
|
StartTCP();
|
||||||
InitTcpReady(&ready);
|
InitTcpReady(&ready);
|
||||||
@@ -16056,10 +16056,15 @@ static void test_DhCallbacks(void)
|
|||||||
client_args.return_code = TEST_FAIL;
|
client_args.return_code = TEST_FAIL;
|
||||||
|
|
||||||
/* set callbacks to use DH functions */
|
/* set callbacks to use DH functions */
|
||||||
func_cb.ctx_ready = &test_dh_ctx_setup;
|
func_cb_client.ctx_ready = &test_dh_ctx_setup;
|
||||||
func_cb.ssl_ready = &test_dh_ssl_setup;
|
func_cb_client.ssl_ready = &test_dh_ssl_setup;
|
||||||
client_args.callbacks = &func_cb;
|
func_cb_client.method = wolfTLSv1_2_client_method;
|
||||||
server_args.callbacks = &func_cb;
|
client_args.callbacks = &func_cb_client;
|
||||||
|
|
||||||
|
func_cb_server.ctx_ready = &test_dh_ctx_setup;
|
||||||
|
func_cb_server.ssl_ready = &test_dh_ssl_setup;
|
||||||
|
func_cb_server.method = wolfTLSv1_2_server_method;
|
||||||
|
server_args.callbacks = &func_cb_server;
|
||||||
|
|
||||||
start_thread(test_server_nofail, &server_args, &serverThread);
|
start_thread(test_server_nofail, &server_args, &serverThread);
|
||||||
wait_tcp_ready(&server_args);
|
wait_tcp_ready(&server_args);
|
||||||
@@ -16081,7 +16086,8 @@ static void test_DhCallbacks(void)
|
|||||||
#endif
|
#endif
|
||||||
XMEMSET(&server_args, 0, sizeof(func_args));
|
XMEMSET(&server_args, 0, sizeof(func_args));
|
||||||
XMEMSET(&client_args, 0, sizeof(func_args));
|
XMEMSET(&client_args, 0, sizeof(func_args));
|
||||||
XMEMSET(&func_cb, 0, sizeof(callback_functions));
|
XMEMSET(&func_cb_client, 0, sizeof(callback_functions));
|
||||||
|
XMEMSET(&func_cb_server, 0, sizeof(callback_functions));
|
||||||
|
|
||||||
StartTCP();
|
StartTCP();
|
||||||
InitTcpReady(&ready);
|
InitTcpReady(&ready);
|
||||||
@@ -16097,10 +16103,15 @@ static void test_DhCallbacks(void)
|
|||||||
client_args.return_code = TEST_FAIL;
|
client_args.return_code = TEST_FAIL;
|
||||||
|
|
||||||
/* set callbacks to use DH functions */
|
/* set callbacks to use DH functions */
|
||||||
func_cb.ctx_ready = &test_dh_ctx_setup;
|
func_cb_client.ctx_ready = &test_dh_ctx_setup;
|
||||||
func_cb.ssl_ready = &test_dh_ssl_setup_fail;
|
func_cb_client.ssl_ready = &test_dh_ssl_setup_fail;
|
||||||
client_args.callbacks = &func_cb;
|
func_cb_client.method = wolfTLSv1_2_client_method;
|
||||||
server_args.callbacks = &func_cb;
|
client_args.callbacks = &func_cb_client;
|
||||||
|
|
||||||
|
func_cb_server.ctx_ready = &test_dh_ctx_setup;
|
||||||
|
func_cb_server.ssl_ready = &test_dh_ssl_setup_fail;
|
||||||
|
func_cb_server.method = wolfTLSv1_2_server_method;
|
||||||
|
server_args.callbacks = &func_cb_server;
|
||||||
|
|
||||||
start_thread(test_server_nofail, &server_args, &serverThread);
|
start_thread(test_server_nofail, &server_args, &serverThread);
|
||||||
wait_tcp_ready(&server_args);
|
wait_tcp_ready(&server_args);
|
||||||
|
Reference in New Issue
Block a user