1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

Add platform error codes

Add error codes for the platform module, to be used by
the setup \ terminate API.
This commit is contained in:
Ron Eldor
2018-08-29 18:53:20 +03:00
parent d22c1b2445
commit 0ff4e0b824
4 changed files with 16 additions and 1 deletions

View File

@ -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 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
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)" );