diff --git a/tests/suites/test_suite_ssl.data b/tests/suites/test_suite_ssl.data index ec54c73ff..891dc1715 100644 --- a/tests/suites/test_suite_ssl.data +++ b/tests/suites/test_suite_ssl.data @@ -59,4 +59,7 @@ SSL SET_HOSTNAME memory leak: call ssl_set_hostname twice ssl_set_hostname_twice:"server0":"server1" SSL preverify callback: basic -ssl_preverifycb:"data_files/server1.crt" +ssl_preverifycb:"data_files/server1.crt":1:1 + +SSL preverify callback: no callback +ssl_preverifycb:"data_files/server1.crt":0:0 diff --git a/tests/suites/test_suite_ssl.function b/tests/suites/test_suite_ssl.function index c85846769..573d854d5 100644 --- a/tests/suites/test_suite_ssl.function +++ b/tests/suites/test_suite_ssl.function @@ -83,7 +83,7 @@ void ssl_set_hostname_twice( char *hostname0, char *hostname1 ) /* END_CASE */ /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_KEY_EXCHANGE_RSA_ENABLED:MBEDTLS_AES_C:MBEDTLS_SHA256_C:MBEDTLS_CIPHER_MODE_CBC */ -void ssl_preverifycb( char *crt_file ) +void ssl_preverifycb( char *crt_file, int set_callback, int data_value ) { mbedtls_ssl_context ssl; mbedtls_ssl_config conf; @@ -112,10 +112,13 @@ void ssl_preverifycb( char *crt_file ) /* Read in the certificate record, and check it calls the pre-verify callback */ conf.endpoint = MBEDTLS_SSL_IS_CLIENT; - mbedtls_ssl_conf_pre_verify( &conf, pre_vrfy_fn, (void*)&pre_vrfy_data ); + if( set_callback != 0 ) + { + mbedtls_ssl_conf_pre_verify( &conf, pre_vrfy_fn, (void*)&pre_vrfy_data ); + } TEST_ASSERT( mbedtls_ssl_parse_certificate( &ssl ) == 0 ); - TEST_ASSERT( pre_vrfy_data != 0 ); + TEST_ASSERT( pre_vrfy_data == data_value ); mbedtls_ssl_free( &ssl ); mbedtls_ssl_config_free( &conf );