ssl: add pre-verify callback setter test with no callback set
diff --git a/tests/suites/test_suite_ssl.data b/tests/suites/test_suite_ssl.data
index ec54c73..891dc17 100644
--- a/tests/suites/test_suite_ssl.data
+++ b/tests/suites/test_suite_ssl.data
@@ -59,4 +59,7 @@
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 c858467..573d854 100644
--- a/tests/suites/test_suite_ssl.function
+++ b/tests/suites/test_suite_ssl.function
@@ -83,7 +83,7 @@
/* 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 @@
/* 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 );