diff --git a/ChangeLog b/ChangeLog index e73ad3ad2..c7cef198a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,8 @@ Changes * Split up the GCM module into a starts/update/finish cycle * Client and server now filter sent and accepted ciphersuites on minimum and maximum protocol version + * Renamed error_strerror() to the less conflicting polarssl_strerror() + (Ability to keep old as well with POLARSSL_ERROR_STRERROR_BC) Bugfix * Fix for MPI assembly for ARM diff --git a/include/polarssl/config.h b/include/polarssl/config.h index b9eee8365..fddd50b68 100644 --- a/include/polarssl/config.h +++ b/include/polarssl/config.h @@ -325,6 +325,17 @@ */ #define POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED +/** + * \def POLARSSL_ERROR_STRERROR_BC + * + * Make available the backward compatible error_strerror() next to the + * current polarssl_strerror(). + * + * Disable if you run into name conflicts and want to really remove the + * error_strerror() + */ +#define POLARSSL_ERROR_STRERROR_BC + /** * \def POLARSSL_ERROR_STRERROR_DUMMY * diff --git a/include/polarssl/error.h b/include/polarssl/error.h index 0c3fb801b..7658814d4 100644 --- a/include/polarssl/error.h +++ b/include/polarssl/error.h @@ -103,7 +103,11 @@ extern "C" { * \param buffer buffer to place representation in * \param buflen length of the buffer */ +void polarssl_strerror( int errnum, char *buffer, size_t buflen ); + +#if defined(POLARSSL_ERROR_STRERROR_BC) void error_strerror( int errnum, char *buffer, size_t buflen ); +#endif #ifdef __cplusplus } diff --git a/library/error.c b/library/error.c index 84570040f..833598ca5 100644 --- a/library/error.c +++ b/library/error.c @@ -156,7 +156,7 @@ #define snprintf _snprintf #endif -void error_strerror( int ret, char *buf, size_t buflen ) +void polarssl_strerror( int ret, char *buf, size_t buflen ) { size_t len; int use_ret; @@ -613,6 +613,13 @@ void error_strerror( int ret, char *buf, size_t buflen ) snprintf( buf, buflen, "UNKNOWN ERROR CODE (%04X)", use_ret ); } +#if defined(POLARSSL_ERROR_STRERROR_BC) +void error_strerror( int ret, char *buf, size_t buflen ) +{ + return polarssl_strerror( ret, buf, buflen ); +} +#endif /* POLARSSL_ERROR_STRERROR_BC */ + #else /* POLARSSL_ERROR_C */ #if defined(POLARSSL_ERROR_STRERROR_DUMMY) @@ -622,7 +629,7 @@ void error_strerror( int ret, char *buf, size_t buflen ) /* * Provide an non-function in case POLARSSL_ERROR_C is not defined */ -void error_strerror( int ret, char *buf, size_t buflen ) +void polarssl_strerror( int ret, char *buf, size_t buflen ) { ((void) ret); @@ -630,5 +637,12 @@ void error_strerror( int ret, char *buf, size_t buflen ) buf[0] = '\0'; } +#if defined(POLARSSL_ERROR_STRERROR_BC) +void error_strerror( int ret, char *buf, size_t buflen ) +{ + return polarssl_strerror( ret, buf, buflen ); +} +#endif /* POLARSSL_ERROR_STRERROR_BC */ #endif /* POLARSSL_ERROR_STRERROR_DUMMY */ + #endif /* POLARSSL_ERROR_C */ diff --git a/scripts/data_files/error.fmt b/scripts/data_files/error.fmt index 93d1e4eeb..9a3e7e661 100644 --- a/scripts/data_files/error.fmt +++ b/scripts/data_files/error.fmt @@ -37,7 +37,7 @@ HEADER_INCLUDED #define snprintf _snprintf #endif -void error_strerror( int ret, char *buf, size_t buflen ) +void polarssl_strerror( int ret, char *buf, size_t buflen ) { size_t len; int use_ret; @@ -88,6 +88,13 @@ LOW_LEVEL_CODE_CHECKS snprintf( buf, buflen, "UNKNOWN ERROR CODE (%04X)", use_ret ); } +#if defined(POLARSSL_ERROR_STRERROR_BC) +void error_strerror( int ret, char *buf, size_t buflen ) +{ + return polarssl_strerror( ret, buf, buflen ); +} +#endif /* POLARSSL_ERROR_STRERROR_BC */ + #else /* POLARSSL_ERROR_C */ #if defined(POLARSSL_ERROR_STRERROR_DUMMY) @@ -97,7 +104,7 @@ LOW_LEVEL_CODE_CHECKS /* * Provide an non-function in case POLARSSL_ERROR_C is not defined */ -void error_strerror( int ret, char *buf, size_t buflen ) +void polarssl_strerror( int ret, char *buf, size_t buflen ) { ((void) ret); @@ -105,5 +112,12 @@ void error_strerror( int ret, char *buf, size_t buflen ) buf[0] = '\0'; } +#if defined(POLARSSL_ERROR_STRERROR_BC) +void error_strerror( int ret, char *buf, size_t buflen ) +{ + return polarssl_strerror( ret, buf, buflen ); +} +#endif /* POLARSSL_ERROR_STRERROR_BC */ #endif /* POLARSSL_ERROR_STRERROR_DUMMY */ + #endif /* POLARSSL_ERROR_C */