remove error string function when no error strings is defined

pull/1397/head
Jacob Barthelmeh 2018-02-23 17:31:20 -07:00
parent 79f13478df
commit 9391c608cc
3 changed files with 21 additions and 15 deletions

View File

@ -15941,10 +15941,17 @@ const char* GetCipherNameInternal(const char* cipherName, int cipherSuite)
return NULL; return NULL;
} }
first = (XSTRSTR(cipherName, "CHACHA")) ? "CHACHA" first =
: (XSTRSTR(cipherName, "EC")) ? "EC" #ifdef HAVE_CHACHA
: (XSTRSTR(cipherName, "CCM")) ? "CCM" (XSTRSTR(cipherName, "CHACHA")) ? "CHACHA" :
: NULL; /* normal */ #endif
#ifdef HAVE_ECC
(XSTRSTR(cipherName, "EC")) ? "EC" :
#endif
#ifdef HAVE_AESCCM
(XSTRSTR(cipherName, "CCM")) ? "CCM" :
#endif
NULL; /* normal */
for (i = 0; i < (int)(sizeof(cipher_name_idx)/sizeof(int)); i++) { for (i = 0; i < (int)(sizeof(cipher_name_idx)/sizeof(int)); i++) {
if (cipher_name_idx[i] == cipherSuite) { if (cipher_name_idx[i] == cipherSuite) {

View File

@ -33,15 +33,9 @@
#pragma warning(disable: 4996) #pragma warning(disable: 4996)
#endif #endif
#ifndef NO_ERROR_STRINGS
const char* wc_GetErrorString(int error) const char* wc_GetErrorString(int error)
{ {
#ifdef NO_ERROR_STRINGS
(void)error;
return "no support for error strings built in";
#else
switch (error) { switch (error) {
case OPEN_RAN_E : case OPEN_RAN_E :
@ -456,12 +450,11 @@ const char* wc_GetErrorString(int error)
return "unknown error number"; return "unknown error number";
} }
#endif /* NO_ERROR_STRINGS */
} }
void wc_ErrorString(int error, char* buffer) void wc_ErrorString(int error, char* buffer)
{ {
XSTRNCPY(buffer, wc_GetErrorString(error), WOLFSSL_MAX_ERROR_SZ); XSTRNCPY(buffer, wc_GetErrorString(error), WOLFSSL_MAX_ERROR_SZ);
} }
#endif /* !NO_ERROR_STRINGS */

View File

@ -208,9 +208,15 @@ enum {
}; };
#ifdef NO_ERROR_STRINGS
#define wc_GetErrorString(error) "no support for error strings built in"
#define wc_ErrorString(err, buf) \
XSTRNCPY((buf), wc_GetErrorString((err)), WOLFSSL_MAX_ERROR_SZ);
#else
WOLFSSL_API void wc_ErrorString(int err, char* buff); WOLFSSL_API void wc_ErrorString(int err, char* buff);
WOLFSSL_API const char* wc_GetErrorString(int error); WOLFSSL_API const char* wc_GetErrorString(int error);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */