diff --git a/src/internal.c b/src/internal.c index c365168dd..e5ef65961 100644 --- a/src/internal.c +++ b/src/internal.c @@ -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) { diff --git a/wolfcrypt/src/error.c b/wolfcrypt/src/error.c index 414b77a3f..0839ed85e 100644 --- a/wolfcrypt/src/error.c +++ b/wolfcrypt/src/error.c @@ -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 */ + diff --git a/wolfssl/wolfcrypt/error-crypt.h b/wolfssl/wolfcrypt/error-crypt.h index 6088bd9cb..92ce085ca 100644 --- a/wolfssl/wolfcrypt/error-crypt.h +++ b/wolfssl/wolfcrypt/error-crypt.h @@ -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" */