Merge development commit 8e76332 into development-psa
Additional changes to temporarily enable running tests:
ssl_srv.c and test_suite_ecdh use mbedtls_ecp_group_load instead of
mbedtls_ecdh_setup
test_suite_ctr_drbg uses mbedtls_ctr_drbg_update instead of
mbedtls_ctr_drbg_update_ret
diff --git a/tests/suites/main_test.function b/tests/suites/main_test.function
index 8bd408c..efe128e 100644
--- a/tests/suites/main_test.function
+++ b/tests/suites/main_test.function
@@ -137,9 +137,39 @@
#line $line_no "suites/main_test.function"
};
+/**
+ * \brief Execute the test function.
+ *
+ * This is a wrapper function around the test function execution
+ * to allow the setjmp() call used to catch any calls to the
+ * parameter failure callback, to be used. Calls to setjmp()
+ * can invalidate the state of any local auto variables.
+ *
+ * \param fp Function pointer to the test function
+ * \param params Parameters to pass
+ *
+ */
+void execute_function_ptr(TestWrapper_t fp, void **params)
+{
+#if defined(MBEDTLS_CHECK_PARAMS)
+ if ( setjmp( param_fail_jmp ) == 0 )
+ {
+ fp( params );
+ }
+ else
+ {
+ /* Unexpected parameter validation error */
+ test_info.failed = 1;
+ }
+
+ memset( param_fail_jmp, 0, sizeof(jmp_buf) );
+#else
+ fp( params );
+#endif
+}
/**
- * \brief Dispatches test functions based on function index.
+ * \brief Dispatches test functions based on function index.
*
* \param exp_id Test function index.
*
@@ -156,7 +186,7 @@
{
fp = test_funcs[func_idx];
if ( fp )
- fp( params );
+ execute_function_ptr(fp, params);
else
ret = DISPATCH_UNSUPPORTED_SUITE;
}