Corrections to the new functions names and error message wording
Signed-off-by: TRodziewicz <tomasz.rodziewicz@mobica.com>
diff --git a/include/mbedtls/error.h b/include/mbedtls/error.h
index d2d31a8..49a6416 100644
--- a/include/mbedtls/error.h
+++ b/include/mbedtls/error.h
@@ -129,7 +129,7 @@
* Only used when invasive testing is enabled via MBEDTLS_TEST_HOOKS.
*/
extern void (*mbedtls_test_hook_error_add)( int, int, const char *, int );
-extern void (*mbedtls_test_hook_value)( int test, const char * file, int line );
+extern void (*mbedtls_test_hook_assert_test)( int test, const char * file, int line );
#endif
/**
diff --git a/include/mbedtls/mbedtls_config.h b/include/mbedtls/mbedtls_config.h
index 1ab0ade..a60db7e 100644
--- a/include/mbedtls/mbedtls_config.h
+++ b/include/mbedtls/mbedtls_config.h
@@ -1683,7 +1683,7 @@
*
* Uncomment to enable invasive tests.
*/
-#define MBEDTLS_TEST_HOOKS
+//#define MBEDTLS_TEST_HOOKS
/**
* \def MBEDTLS_THREADING_ALT
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index c7186af..f5a8793 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -1003,8 +1003,8 @@
if( slot->lock_count != 1 )
{
#if defined(MBEDTLS_TEST_HOOKS)
- if( *mbedtls_test_hook_value != NULL )
- ( *mbedtls_test_hook_value )( slot->lock_count == 1, __FILE__, __LINE__ );
+ if( *mbedtls_test_hook_assert_test != NULL )
+ ( *mbedtls_test_hook_assert_test )( slot->lock_count == 1, __FILE__, __LINE__ );
#endif
status = PSA_ERROR_CORRUPTION_DETECTED;
}
diff --git a/library/psa_crypto_slot_management.c b/library/psa_crypto_slot_management.c
index 256408d..4a0763f 100644
--- a/library/psa_crypto_slot_management.c
+++ b/library/psa_crypto_slot_management.c
@@ -416,8 +416,8 @@
slot->lock_count = 1;
#if defined(MBEDTLS_TEST_HOOKS)
- if( *mbedtls_test_hook_value != NULL )
- ( *mbedtls_test_hook_value )( slot->lock_count > 0, __FILE__, __LINE__ );
+ if( *mbedtls_test_hook_assert_test != NULL )
+ ( *mbedtls_test_hook_assert_test )( slot->lock_count > 0, __FILE__, __LINE__ );
#endif
return( PSA_ERROR_CORRUPTION_DETECTED );
diff --git a/scripts/data_files/error.fmt b/scripts/data_files/error.fmt
index c2b4b08..8651a7b 100644
--- a/scripts/data_files/error.fmt
+++ b/scripts/data_files/error.fmt
@@ -164,7 +164,7 @@
#if defined(MBEDTLS_TEST_HOOKS)
void (*mbedtls_test_hook_error_add)( int, int, const char *, int );
-void (*mbedtls_test_hook_value)( int, const char *, int );
+void (*mbedtls_test_hook_assert_test)( int, const char *, int );
#endif
#endif /* MBEDTLS_ERROR_C || MBEDTLS_ERROR_STRERROR_DUMMY */
diff --git a/tests/include/test/helpers.h b/tests/include/test/helpers.h
index 40fcb03..8ee6996 100644
--- a/tests/include/test/helpers.h
+++ b/tests/include/test/helpers.h
@@ -237,7 +237,7 @@
* \note If the check fails, fail the test currently being run.
*/
#if defined(MBEDTLS_TEST_HOOKS)
-void mbedtls_test_hook_value_check( int test, const char * file, int line );
+void mbedtls_test_assert_test( int test, const char * file, int line );
#endif
#endif /* TEST_HELPERS_H */
diff --git a/tests/src/helpers.c b/tests/src/helpers.c
index bf25f21..e35ed62 100644
--- a/tests/src/helpers.c
+++ b/tests/src/helpers.c
@@ -276,11 +276,11 @@
#endif
#if defined(MBEDTLS_TEST_HOOKS)
-void mbedtls_test_hook_value_check( int test, const char * file, int line )
+void mbedtls_test_assert_test( int test, const char * file, int line )
{
if ( !test )
{
- mbedtls_test_fail( "Wrong value in test", line, file );
+ mbedtls_test_fail( "Test hook - test assertion failed.", line, file );
}
}
#endif
diff --git a/tests/suites/main_test.function b/tests/suites/main_test.function
index 9ac5a4a..f34c1bd 100644
--- a/tests/suites/main_test.function
+++ b/tests/suites/main_test.function
@@ -239,9 +239,13 @@
{
#if defined(MBEDTLS_TEST_HOOKS) && defined (MBEDTLS_ERROR_C)
mbedtls_test_hook_error_add = &mbedtls_test_err_add_check;
- mbedtls_test_hook_value = &mbedtls_test_hook_value_check;
#endif
+#if defined(MBEDTLS_TEST_HOOKS)
+ mbedtls_test_hook_assert_test = &mbedtls_test_assert_test;
+#endif
+
+
int ret = mbedtls_test_platform_setup();
if( ret != 0 )
{