remove error string function when no error strings is defined

This commit is contained in:
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;
}
first = (XSTRSTR(cipherName, "CHACHA")) ? "CHACHA"
: (XSTRSTR(cipherName, "EC")) ? "EC"
: (XSTRSTR(cipherName, "CCM")) ? "CCM"
: NULL; /* normal */
first =
#ifdef HAVE_CHACHA
(XSTRSTR(cipherName, "CHACHA")) ? "CHACHA" :
#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++) {
if (cipher_name_idx[i] == cipherSuite) {

View File

@ -33,15 +33,9 @@
#pragma warning(disable: 4996)
#endif
#ifndef NO_ERROR_STRINGS
const char* wc_GetErrorString(int error)
{
#ifdef NO_ERROR_STRINGS
(void)error;
return "no support for error strings built in";
#else
switch (error) {
case OPEN_RAN_E :
@ -456,12 +450,11 @@ const char* wc_GetErrorString(int error)
return "unknown error number";
}
#endif /* NO_ERROR_STRINGS */
}
void wc_ErrorString(int error, char* buffer)
{
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 const char* wc_GetErrorString(int error);
#endif
#ifdef __cplusplus
} /* extern "C" */