Rework mbedtls_test_unhexify()

Rework mbedtls_test_unhexify to extend its scope of usage.
Return in error when the function detects an error instead
of calling mbedtls_exit().
Improve safety by checking the output buffer is not overrun.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
diff --git a/tests/suites/host_test.function b/tests/suites/host_test.function
index c57fa07..a459eed 100644
--- a/tests/suites/host_test.function
+++ b/tests/suites/host_test.function
@@ -277,8 +277,13 @@
         {
             if ( verify_string( &val ) == 0 )
             {
-                *int_params_store = mbedtls_test_unhexify(
-                                        (unsigned char *) val, val );
+                size_t len;
+
+                TEST_HELPER_ASSERT(
+                  mbedtls_test_unhexify( (unsigned char *) val, strlen( val ),
+                                         val, &len ) == 0 );
+
+                *int_params_store = len;
                 *out++ = val;
                 *out++ = (char *)(int_params_store++);
             }