Add platform error codes
Add error codes for the platform module, to be used by
the setup \ terminate API.
diff --git a/library/error.c b/library/error.c
index 774244b..f34a6ef 100644
--- a/library/error.c
+++ b/library/error.c
@@ -165,6 +165,10 @@
#include "mbedtls/pkcs5.h"
#endif
+#if defined(MBEDTLS_PLATFORM_C)
+#include "mbedtls/platform.h"
+#endif
+
#if defined(MBEDTLS_POLY1305_C)
#include "mbedtls/poly1305.h"
#endif
@@ -821,6 +825,13 @@
mbedtls_snprintf( buf, buflen, "PADLOCK - Input data should be aligned" );
#endif /* MBEDTLS_PADLOCK_C */
+#if defined(MBEDTLS_PLATFORM_C)
+ if( use_ret == -(MBEDTLS_ERR_PLATFORM_INVALID_DATA) )
+ mbedtls_snprintf( buf, buflen, "PLATFORM - Bad input parameters to the platform function" );
+ if( use_ret == -(MBEDTLS_ERR_PLATFORM_HW_FAILED) )
+ mbedtls_snprintf( buf, buflen, "PLATFORM - Hardware platform function failed" );
+#endif /* MBEDTLS_PLATFORM_C */
+
#if defined(MBEDTLS_POLY1305_C)
if( use_ret == -(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA) )
mbedtls_snprintf( buf, buflen, "POLY1305 - Invalid input parameter(s)" );