mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-10 13:14:30 +00:00
tests: ssl: Move setting of debug callback
Move the setting of the debug callback to the endpoint initialization function. That way, no need to repeat it in various testing scenarios. Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
parent
d903a86e52
commit
ec3408d707
@ -841,6 +841,23 @@ int mbedtls_test_ssl_endpoint_init(
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_DEBUG_C)
|
||||
#if defined(MBEDTLS_SSL_SRV_C)
|
||||
if (endpoint_type == MBEDTLS_SSL_IS_SERVER &&
|
||||
options->srv_log_fun != NULL) {
|
||||
mbedtls_ssl_conf_dbg(&(ep->conf), options->srv_log_fun,
|
||||
options->srv_log_obj);
|
||||
}
|
||||
#endif
|
||||
#if defined(MBEDTLS_SSL_CLI_C)
|
||||
if (endpoint_type == MBEDTLS_SSL_IS_CLIENT &&
|
||||
options->cli_log_fun != NULL) {
|
||||
mbedtls_ssl_conf_dbg(&(ep->conf), options->cli_log_fun,
|
||||
options->cli_log_obj);
|
||||
}
|
||||
#endif
|
||||
#endif /* MBEDTLS_DEBUG_C */
|
||||
|
||||
ret = mbedtls_test_ssl_endpoint_certificate_init(ep, options->pk_alg,
|
||||
options->opaque_alg,
|
||||
options->opaque_alg2,
|
||||
@ -1977,6 +1994,12 @@ void mbedtls_test_ssl_perform_handshake(
|
||||
mbedtls_test_message_socket_init(&server_context);
|
||||
mbedtls_test_message_socket_init(&client_context);
|
||||
|
||||
#if defined(MBEDTLS_DEBUG_C)
|
||||
if (options->cli_log_fun || options->srv_log_fun) {
|
||||
mbedtls_debug_set_threshold(4);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Client side */
|
||||
if (options->dtls != 0) {
|
||||
TEST_ASSERT(mbedtls_test_ssl_endpoint_init(&client,
|
||||
@ -2000,14 +2023,6 @@ void mbedtls_test_ssl_perform_handshake(
|
||||
set_ciphersuite(&client.conf, options->cipher, forced_ciphersuite);
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_DEBUG_C)
|
||||
if (options->cli_log_fun) {
|
||||
mbedtls_debug_set_threshold(4);
|
||||
mbedtls_ssl_conf_dbg(&client.conf, options->cli_log_fun,
|
||||
options->cli_log_obj);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Server side */
|
||||
if (options->dtls != 0) {
|
||||
TEST_ASSERT(mbedtls_test_ssl_endpoint_init(&server,
|
||||
@ -2072,14 +2087,6 @@ void mbedtls_test_ssl_perform_handshake(
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_RENEGOTIATION */
|
||||
|
||||
#if defined(MBEDTLS_DEBUG_C)
|
||||
if (options->srv_log_fun) {
|
||||
mbedtls_debug_set_threshold(4);
|
||||
mbedtls_ssl_conf_dbg(&server.conf, options->srv_log_fun,
|
||||
options->srv_log_obj);
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_ASSERT(mbedtls_test_mock_socket_connect(&(client.socket),
|
||||
&(server.socket),
|
||||
BUFFSIZE) == 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user