summaryrefslogtreecommitdiff
path: root/library/platform_util.c
diff options
context:
space:
mode:
authorSimon Butcher <simon.butcher@arm.com>2018-12-06 17:36:34 +0000
committerManuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>2018-12-11 12:28:56 +0100
commitb4868034dd60ce0a19f230c6394aceb0bb8ca77b (patch)
tree2a3788870f40259d6ddff283e3d7c10b82218dac /library/platform_util.c
parent01b34fb316a5d8c37244719be3f11ccf2ae85e41 (diff)
Add initial options and support for parameter validation
This function adds the additional config.h option of MBEDTLS_CHECK_PARAMS which allows additional validation of parameters passed to the library.
Diffstat (limited to 'library/platform_util.c')
-rw-r--r--library/platform_util.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/library/platform_util.c b/library/platform_util.c
index ca5fe4fb..61ed926f 100644
--- a/library/platform_util.c
+++ b/library/platform_util.c
@@ -35,6 +35,7 @@
#endif
#include "mbedtls/platform_util.h"
+#include "mbedtls/platform.h"
#include "mbedtls/threading.h"
#include <stddef.h>
@@ -133,3 +134,11 @@ struct tm *mbedtls_platform_gmtime_r( const mbedtls_time_t *tt,
#endif /* _WIN32 && !EFIX64 && !EFI32 */
}
#endif /* MBEDTLS_HAVE_TIME_DATE && MBEDTLS_PLATFORM_GMTIME_R_ALT */
+
+#if defined( MBEDTLS_CHECK_PARAMS ) && defined(MBEDTLS_PLATFORM_C) && \
+ defined(MBEDTLS_DEBUG_INVALID_PARAMS)
+void mbedtls_param_failed( char* failure_condition )
+{
+ mbedtls_printf("%s:%i: Input param failed - %s\n", __FILE__, __LINE__, failure_condition );
+}
+#endif