From 2448d482f4d03b960729817f92b7c58ca97f4154 Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Tue, 20 Aug 2024 23:37:21 -0500 Subject: [PATCH] wolfssl/wolfcrypt/error-crypt.h: move MPI error codes to range {-97, -100} to avoid collisions. --- wolfcrypt/test/test.c | 1 - wolfssl/error-ssl.h | 2 +- wolfssl/wolfcrypt/error-crypt.h | 17 +++++++---------- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 64c2ef25e..39f1be94f 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -2627,7 +2627,6 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t error_test(void) int first; int last; } missing[] = { - { -6, -100 }, { -124, -124 }, { -166, -169 } }; diff --git a/wolfssl/error-ssl.h b/wolfssl/error-ssl.h index 2dde4fb90..c7e50f830 100644 --- a/wolfssl/error-ssl.h +++ b/wolfssl/error-ssl.h @@ -220,7 +220,7 @@ enum wolfSSL_ErrorCodes { WOLFSSL_LOCAL void SetErrorString(int err, char* buff); -#ifdef WOLFSSL_DEBUG_TRACE_ERROR_CODES +#if defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES) && defined(BUILDING_WOLFSSL) #include #endif diff --git a/wolfssl/wolfcrypt/error-crypt.h b/wolfssl/wolfcrypt/error-crypt.h index eb392fe72..2e332a4e7 100644 --- a/wolfssl/wolfcrypt/error-crypt.h +++ b/wolfssl/wolfcrypt/error-crypt.h @@ -43,14 +43,14 @@ the error status. /* error codes, add string for new errors !!! */ enum { - MAX_CODE_E = -1, /* errors -2 - -299 */ - WC_FIRST_E = -2, /* errors -2 - -299 */ + MAX_CODE_E = -96, /* errors -97 - -299 */ + WC_FIRST_E = -97, /* errors -97 - -299 */ - MP_MEM = -2, /* MP dynamic memory allocation failed. */ - MP_VAL = -3, /* MP value passed is not able to be used. */ - MP_WOULDBLOCK = -4, /* MP non-blocking operation is returning after + MP_MEM = -97, /* MP dynamic memory allocation failed. */ + MP_VAL = -98, /* MP value passed is not able to be used. */ + MP_WOULDBLOCK = -99, /* MP non-blocking operation is returning after * 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 */ 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); #endif -#if defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES) && !defined(BUILDING_WOLFSSL) - #undef WOLFSSL_DEBUG_TRACE_ERROR_CODES -#endif -#ifdef WOLFSSL_DEBUG_TRACE_ERROR_CODES +#if defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES) && defined(BUILDING_WOLFSSL) extern void wc_backtrace_render(void); #define WC_NO_ERR_TRACE(label) (CONST_NUM_ERR_ ## label) #ifndef WOLFSSL_DEBUG_BACKTRACE_RENDER_CLAUSE