mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-10 05:03:02 +03:00
tests: Set the default conf then customize
Set the default conf then customize, not the other way around. Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
@@ -66,14 +66,12 @@ void debug_print_msg_threshold(int threshold, int level, char *file,
|
|||||||
memset(buffer.buf, 0, 2000);
|
memset(buffer.buf, 0, 2000);
|
||||||
buffer.ptr = buffer.buf;
|
buffer.ptr = buffer.buf;
|
||||||
|
|
||||||
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
|
||||||
|
|
||||||
TEST_EQUAL(mbedtls_ssl_config_defaults(&conf,
|
TEST_EQUAL(mbedtls_ssl_config_defaults(&conf,
|
||||||
MBEDTLS_SSL_IS_CLIENT,
|
MBEDTLS_SSL_IS_CLIENT,
|
||||||
MBEDTLS_SSL_TRANSPORT_STREAM,
|
MBEDTLS_SSL_TRANSPORT_STREAM,
|
||||||
MBEDTLS_SSL_PRESET_DEFAULT),
|
MBEDTLS_SSL_PRESET_DEFAULT),
|
||||||
0);
|
0);
|
||||||
|
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
||||||
mbedtls_ssl_conf_dbg(&conf, string_debug, &buffer);
|
mbedtls_ssl_conf_dbg(&conf, string_debug, &buffer);
|
||||||
|
|
||||||
TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == 0);
|
TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == 0);
|
||||||
@@ -107,14 +105,12 @@ void mbedtls_debug_print_ret(char *file, int line, char *text, int value,
|
|||||||
memset(buffer.buf, 0, 2000);
|
memset(buffer.buf, 0, 2000);
|
||||||
buffer.ptr = buffer.buf;
|
buffer.ptr = buffer.buf;
|
||||||
|
|
||||||
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
|
||||||
|
|
||||||
TEST_EQUAL(mbedtls_ssl_config_defaults(&conf,
|
TEST_EQUAL(mbedtls_ssl_config_defaults(&conf,
|
||||||
MBEDTLS_SSL_IS_CLIENT,
|
MBEDTLS_SSL_IS_CLIENT,
|
||||||
MBEDTLS_SSL_TRANSPORT_STREAM,
|
MBEDTLS_SSL_TRANSPORT_STREAM,
|
||||||
MBEDTLS_SSL_PRESET_DEFAULT),
|
MBEDTLS_SSL_PRESET_DEFAULT),
|
||||||
0);
|
0);
|
||||||
|
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
||||||
mbedtls_ssl_conf_dbg(&conf, string_debug, &buffer);
|
mbedtls_ssl_conf_dbg(&conf, string_debug, &buffer);
|
||||||
|
|
||||||
TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == 0);
|
TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == 0);
|
||||||
@@ -145,14 +141,12 @@ void mbedtls_debug_print_buf(char *file, int line, char *text,
|
|||||||
memset(buffer.buf, 0, 2000);
|
memset(buffer.buf, 0, 2000);
|
||||||
buffer.ptr = buffer.buf;
|
buffer.ptr = buffer.buf;
|
||||||
|
|
||||||
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
|
||||||
|
|
||||||
TEST_EQUAL(mbedtls_ssl_config_defaults(&conf,
|
TEST_EQUAL(mbedtls_ssl_config_defaults(&conf,
|
||||||
MBEDTLS_SSL_IS_CLIENT,
|
MBEDTLS_SSL_IS_CLIENT,
|
||||||
MBEDTLS_SSL_TRANSPORT_STREAM,
|
MBEDTLS_SSL_TRANSPORT_STREAM,
|
||||||
MBEDTLS_SSL_PRESET_DEFAULT),
|
MBEDTLS_SSL_PRESET_DEFAULT),
|
||||||
0);
|
0);
|
||||||
|
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
||||||
mbedtls_ssl_conf_dbg(&conf, string_debug, &buffer);
|
mbedtls_ssl_conf_dbg(&conf, string_debug, &buffer);
|
||||||
|
|
||||||
TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == 0);
|
TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == 0);
|
||||||
@@ -185,14 +179,12 @@ void mbedtls_debug_print_crt(char *crt_file, char *file, int line,
|
|||||||
memset(buffer.buf, 0, 2000);
|
memset(buffer.buf, 0, 2000);
|
||||||
buffer.ptr = buffer.buf;
|
buffer.ptr = buffer.buf;
|
||||||
|
|
||||||
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
|
||||||
|
|
||||||
TEST_EQUAL(mbedtls_ssl_config_defaults(&conf,
|
TEST_EQUAL(mbedtls_ssl_config_defaults(&conf,
|
||||||
MBEDTLS_SSL_IS_CLIENT,
|
MBEDTLS_SSL_IS_CLIENT,
|
||||||
MBEDTLS_SSL_TRANSPORT_STREAM,
|
MBEDTLS_SSL_TRANSPORT_STREAM,
|
||||||
MBEDTLS_SSL_PRESET_DEFAULT),
|
MBEDTLS_SSL_PRESET_DEFAULT),
|
||||||
0);
|
0);
|
||||||
|
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
||||||
mbedtls_ssl_conf_dbg(&conf, string_debug, &buffer);
|
mbedtls_ssl_conf_dbg(&conf, string_debug, &buffer);
|
||||||
|
|
||||||
TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == 0);
|
TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == 0);
|
||||||
@@ -227,14 +219,12 @@ void mbedtls_debug_print_mpi(char *value, char *file, int line,
|
|||||||
memset(buffer.buf, 0, 2000);
|
memset(buffer.buf, 0, 2000);
|
||||||
buffer.ptr = buffer.buf;
|
buffer.ptr = buffer.buf;
|
||||||
|
|
||||||
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
|
||||||
|
|
||||||
TEST_EQUAL(mbedtls_ssl_config_defaults(&conf,
|
TEST_EQUAL(mbedtls_ssl_config_defaults(&conf,
|
||||||
MBEDTLS_SSL_IS_CLIENT,
|
MBEDTLS_SSL_IS_CLIENT,
|
||||||
MBEDTLS_SSL_TRANSPORT_STREAM,
|
MBEDTLS_SSL_TRANSPORT_STREAM,
|
||||||
MBEDTLS_SSL_PRESET_DEFAULT),
|
MBEDTLS_SSL_PRESET_DEFAULT),
|
||||||
0);
|
0);
|
||||||
|
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
||||||
mbedtls_ssl_conf_dbg(&conf, string_debug, &buffer);
|
mbedtls_ssl_conf_dbg(&conf, string_debug, &buffer);
|
||||||
|
|
||||||
TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == 0);
|
TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == 0);
|
||||||
|
@@ -1121,12 +1121,12 @@ void ssl_dtls_replay(data_t *prevs, data_t *new, int ret)
|
|||||||
mbedtls_ssl_config_init(&conf);
|
mbedtls_ssl_config_init(&conf);
|
||||||
MD_OR_USE_PSA_INIT();
|
MD_OR_USE_PSA_INIT();
|
||||||
|
|
||||||
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
|
||||||
|
|
||||||
TEST_ASSERT(mbedtls_ssl_config_defaults(&conf,
|
TEST_ASSERT(mbedtls_ssl_config_defaults(&conf,
|
||||||
MBEDTLS_SSL_IS_CLIENT,
|
MBEDTLS_SSL_IS_CLIENT,
|
||||||
MBEDTLS_SSL_TRANSPORT_DATAGRAM,
|
MBEDTLS_SSL_TRANSPORT_DATAGRAM,
|
||||||
MBEDTLS_SSL_PRESET_DEFAULT) == 0);
|
MBEDTLS_SSL_PRESET_DEFAULT) == 0);
|
||||||
|
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
||||||
|
|
||||||
TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == 0);
|
TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == 0);
|
||||||
|
|
||||||
/* Read previous record numbers */
|
/* Read previous record numbers */
|
||||||
@@ -3075,12 +3075,11 @@ void cookie_parsing(data_t *cookie, int exp_ret)
|
|||||||
mbedtls_ssl_config_init(&conf);
|
mbedtls_ssl_config_init(&conf);
|
||||||
USE_PSA_INIT();
|
USE_PSA_INIT();
|
||||||
|
|
||||||
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
|
||||||
|
|
||||||
TEST_EQUAL(mbedtls_ssl_config_defaults(&conf, MBEDTLS_SSL_IS_SERVER,
|
TEST_EQUAL(mbedtls_ssl_config_defaults(&conf, MBEDTLS_SSL_IS_SERVER,
|
||||||
MBEDTLS_SSL_TRANSPORT_DATAGRAM,
|
MBEDTLS_SSL_TRANSPORT_DATAGRAM,
|
||||||
MBEDTLS_SSL_PRESET_DEFAULT),
|
MBEDTLS_SSL_PRESET_DEFAULT),
|
||||||
0);
|
0);
|
||||||
|
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
||||||
|
|
||||||
TEST_EQUAL(mbedtls_ssl_setup(&ssl, &conf), 0);
|
TEST_EQUAL(mbedtls_ssl_setup(&ssl, &conf), 0);
|
||||||
TEST_EQUAL(mbedtls_ssl_check_dtls_clihlo_cookie(&ssl, ssl.cli_id,
|
TEST_EQUAL(mbedtls_ssl_check_dtls_clihlo_cookie(&ssl, ssl.cli_id,
|
||||||
@@ -3130,13 +3129,12 @@ void cid_sanity()
|
|||||||
mbedtls_ssl_config_init(&conf);
|
mbedtls_ssl_config_init(&conf);
|
||||||
MD_OR_USE_PSA_INIT();
|
MD_OR_USE_PSA_INIT();
|
||||||
|
|
||||||
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
|
||||||
|
|
||||||
TEST_ASSERT(mbedtls_ssl_config_defaults(&conf,
|
TEST_ASSERT(mbedtls_ssl_config_defaults(&conf,
|
||||||
MBEDTLS_SSL_IS_CLIENT,
|
MBEDTLS_SSL_IS_CLIENT,
|
||||||
MBEDTLS_SSL_TRANSPORT_STREAM,
|
MBEDTLS_SSL_TRANSPORT_STREAM,
|
||||||
MBEDTLS_SSL_PRESET_DEFAULT)
|
MBEDTLS_SSL_PRESET_DEFAULT)
|
||||||
== 0);
|
== 0);
|
||||||
|
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
||||||
|
|
||||||
TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == 0);
|
TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == 0);
|
||||||
|
|
||||||
@@ -3390,12 +3388,11 @@ void ssl_ecjpake_set_password(int use_opaque_arg)
|
|||||||
|
|
||||||
mbedtls_ssl_config_init(&conf);
|
mbedtls_ssl_config_init(&conf);
|
||||||
|
|
||||||
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
|
||||||
|
|
||||||
TEST_EQUAL(mbedtls_ssl_config_defaults(&conf,
|
TEST_EQUAL(mbedtls_ssl_config_defaults(&conf,
|
||||||
MBEDTLS_SSL_IS_CLIENT,
|
MBEDTLS_SSL_IS_CLIENT,
|
||||||
MBEDTLS_SSL_TRANSPORT_STREAM,
|
MBEDTLS_SSL_TRANSPORT_STREAM,
|
||||||
MBEDTLS_SSL_PRESET_DEFAULT), 0);
|
MBEDTLS_SSL_PRESET_DEFAULT), 0);
|
||||||
|
mbedtls_ssl_conf_rng(&conf, mbedtls_test_random, NULL);
|
||||||
|
|
||||||
TEST_EQUAL(mbedtls_ssl_setup(&ssl, &conf), 0);
|
TEST_EQUAL(mbedtls_ssl_setup(&ssl, &conf), 0);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user