Correction to callback declaration and usage

Signed-off-by: TRodziewicz <tomasz.rodziewicz@mobica.com>
diff --git a/library/platform_util.c b/library/platform_util.c
index 4e97e4d..3d5cb5b 100644
--- a/library/platform_util.c
+++ b/library/platform_util.c
@@ -131,3 +131,8 @@
 #endif /* _WIN32 && !EFIX64 && !EFI32 */
 }
 #endif /* MBEDTLS_HAVE_TIME_DATE && MBEDTLS_PLATFORM_GMTIME_R_ALT */
+
+#if defined(MBEDTLS_TEST_HOOKS)
+void (*mbedtls_test_hook_test_fail)( const char *, int, const char *);
+#endif /* MBEDTLS_TEST_HOOKS */
+
diff --git a/scripts/data_files/error.fmt b/scripts/data_files/error.fmt
index fd491b8..3be94bd 100644
--- a/scripts/data_files/error.fmt
+++ b/scripts/data_files/error.fmt
@@ -164,7 +164,6 @@
 
 #if defined(MBEDTLS_TEST_HOOKS)
 void (*mbedtls_test_hook_error_add)( int, int, const char *, int );
-void (*mbedtls_test_hook_test_fail)( const char *, int, const char *);
 #endif
 
 #endif /* MBEDTLS_ERROR_C || MBEDTLS_ERROR_STRERROR_DUMMY */
diff --git a/tests/suites/main_test.function b/tests/suites/main_test.function
index 3044bed..80c730b 100644
--- a/tests/suites/main_test.function
+++ b/tests/suites/main_test.function
@@ -237,12 +237,11 @@
  */
 int main( int argc, const char *argv[] )
 {
-#if defined(MBEDTLS_TEST_HOOKS) && defined (MBEDTLS_ERROR_C)
-    mbedtls_test_hook_error_add = &mbedtls_test_err_add_check;
-#endif
-
 #if defined(MBEDTLS_TEST_HOOKS)
     mbedtls_test_hook_test_fail = &mbedtls_test_fail;
+#if defined(MBEDTLS_ERROR_C)
+    mbedtls_test_hook_error_add = &mbedtls_test_err_add_check;
+#endif
 #endif
 
     int ret = mbedtls_test_platform_setup();