wolfssl/wolfcrypt/error-crypt.h: move MPI error codes to range {-97, -100} to avoid collisions.

This commit is contained in:
Daniel Pouzzner
2024-08-20 23:37:21 -05:00
parent 05c4955316
commit 2448d482f4
3 changed files with 8 additions and 12 deletions

View File

@@ -2627,7 +2627,6 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t error_test(void)
int first; int first;
int last; int last;
} missing[] = { } missing[] = {
{ -6, -100 },
{ -124, -124 }, { -124, -124 },
{ -166, -169 } { -166, -169 }
}; };

View File

@@ -220,7 +220,7 @@ enum wolfSSL_ErrorCodes {
WOLFSSL_LOCAL WOLFSSL_LOCAL
void SetErrorString(int err, char* buff); void SetErrorString(int err, char* buff);
#ifdef WOLFSSL_DEBUG_TRACE_ERROR_CODES #if defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES) && defined(BUILDING_WOLFSSL)
#include <wolfssl/debug-trace-error-codes.h> #include <wolfssl/debug-trace-error-codes.h>
#endif #endif

View File

@@ -43,14 +43,14 @@ the error status.
/* error codes, add string for new errors !!! */ /* error codes, add string for new errors !!! */
enum { enum {
MAX_CODE_E = -1, /* errors -2 - -299 */ MAX_CODE_E = -96, /* errors -97 - -299 */
WC_FIRST_E = -2, /* errors -2 - -299 */ WC_FIRST_E = -97, /* errors -97 - -299 */
MP_MEM = -2, /* MP dynamic memory allocation failed. */ MP_MEM = -97, /* MP dynamic memory allocation failed. */
MP_VAL = -3, /* MP value passed is not able to be used. */ MP_VAL = -98, /* MP value passed is not able to be used. */
MP_WOULDBLOCK = -4, /* MP non-blocking operation is returning after MP_WOULDBLOCK = -99, /* MP non-blocking operation is returning after
* partial completion. */ * partial completion. */
MP_NOT_INF = -5, /* MP point not at infinity */ MP_NOT_INF = -100, /* MP point not at infinity */
OPEN_RAN_E = -101, /* opening random device error */ OPEN_RAN_E = -101, /* opening random device error */
READ_RAN_E = -102, /* reading random device error */ READ_RAN_E = -102, /* reading random device error */
@@ -304,10 +304,7 @@ WOLFSSL_API void wc_ErrorString(int err, char* buff);
WOLFSSL_ABI WOLFSSL_API const char* wc_GetErrorString(int error); WOLFSSL_ABI WOLFSSL_API const char* wc_GetErrorString(int error);
#endif #endif
#if defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES) && !defined(BUILDING_WOLFSSL) #if defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES) && defined(BUILDING_WOLFSSL)
#undef WOLFSSL_DEBUG_TRACE_ERROR_CODES
#endif
#ifdef WOLFSSL_DEBUG_TRACE_ERROR_CODES
extern void wc_backtrace_render(void); extern void wc_backtrace_render(void);
#define WC_NO_ERR_TRACE(label) (CONST_NUM_ERR_ ## label) #define WC_NO_ERR_TRACE(label) (CONST_NUM_ERR_ ## label)
#ifndef WOLFSSL_DEBUG_BACKTRACE_RENDER_CLAUSE #ifndef WOLFSSL_DEBUG_BACKTRACE_RENDER_CLAUSE