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.
This commit is contained in:
Simon Butcher 2018-12-06 17:36:34 +00:00 committed by Manuel Pégourié-Gonnard
parent 01b34fb316
commit b4868034dd
3 changed files with 59 additions and 0 deletions

View file

@ -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