Renamed error_strerror() to the less conflicting polarssl_strerror()
Ability to keep old function error_strerror() as well with
POLARSSL_ERROR_STRERROR_BC. Also works with
POLARSSL_ERROR_STRERROR_DUMMY.
diff --git a/ChangeLog b/ChangeLog
index e73ad3a..c7cef19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,8 @@
* 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 b9eee83..fddd50b 100644
--- a/include/polarssl/config.h
+++ b/include/polarssl/config.h
@@ -326,6 +326,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
*
* Enable a dummy error function to make use of error_strerror() in
diff --git a/include/polarssl/error.h b/include/polarssl/error.h
index 0c3fb80..7658814 100644
--- a/include/polarssl/error.h
+++ b/include/polarssl/error.h
@@ -103,7 +103,11 @@
* \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 8457004..833598c 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 @@
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 @@
/*
* 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 @@
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 93d1e4e..9a3e7e6 100644
--- a/scripts/data_files/error.fmt
+++ b/scripts/data_files/error.fmt
@@ -37,7 +37,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;
@@ -88,6 +88,13 @@
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 @@
/*
* 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 @@
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 */