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.
diff --git a/library/platform_util.c b/library/platform_util.c
index ca5fe4f..61ed926 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 @@
#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